MCPcopy Create free account
hub / github.com/Gan-Xing/CodexBridge / buildAutomationCommandSkillPrompt

Function buildAutomationCommandSkillPrompt

src/core/bridge_coordinator.ts:15909–15952  ·  view source on GitHub ↗
({
  event,
  subcommand,
  userInput,
  locale,
  now,
  pendingDraft,
  jobs,
}: {
  event: InboundTextEvent;
  subcommand: 'add' | 'edit' | 'natural';
  userInput: string;
  locale: string | null;
  now: number;
  pendingDraft: PendingAutomationDraft | null;
  jobs: any[];
})

Source from the content-addressed store, hash-verified

15907}
15908
15909function buildAutomationCommandSkillPrompt({
15910 event,
15911 subcommand,
15912 userInput,
15913 locale,
15914 now,
15915 pendingDraft,
15916 jobs,
15917}: {
15918 event: InboundTextEvent;
15919 subcommand: 'add' | 'edit' | 'natural';
15920 userInput: string;
15921 locale: string | null;
15922 now: number;
15923 pendingDraft: PendingAutomationDraft | null;
15924 jobs: any[];
15925}): string {
15926 const payload = {
15927 command: 'auto',
15928 subcommand,
15929 rawText: String(event.text ?? ''),
15930 userInput,
15931 now: new Date(now).toISOString(),
15932 locale: normalizeLocale(locale) ?? 'zh-CN',
15933 scope: {
15934 platform: event.platform,
15935 externalScopeId: event.externalScopeId,
15936 },
15937 pendingDraft: pendingDraft ? automationDraftToCommandSkillJson(pendingDraft) : null,
15938 jobs: jobs.map((job, index) => automationJobToCommandSkillJson(job, index + 1)),
15939 skillPath: AUTO_COMMAND_SKILL_PATH,
15940 };
15941 return [
15942 'CodexBridge command skill invocation.',
15943 '',
15944 `Please read and follow this command skill file: ${AUTO_COMMAND_SKILL_PATH}`,
15945 'Use it to interpret the /auto command request below.',
15946 'Return exactly one JSON object that matches the skill contract.',
15947 'Do not use Markdown. Do not explain. Do not execute or persist automation jobs yourself.',
15948 '',
15949 'Invocation payload:',
15950 JSON.stringify(payload, null, 2),
15951 ].join('\n');
15952}
15953
15954function automationDraftToCommandSkillJson(draft: PendingAutomationDraft): Record<string, unknown> {
15955 return {

Calls 3

normalizeLocaleFunction · 0.85

Tested by

no test coverage detected