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

Function buildInstructionsCommandSkillPrompt

src/core/bridge_coordinator.ts:12515–12578  ·  view source on GitHub ↗
({
  event,
  subcommand,
  userInput,
  locale,
  now,
  cwd,
  currentInstructions,
  pendingDraft,
}: {
  event: InboundTextEvent;
  subcommand: 'natural' | 'edit';
  userInput: string;
  locale: string | null;
  now: number;
  cwd: string | null;
  currentInstructions: CodexInstructionsSnapshot;
  pendingDraft: PendingInstructionsOperation | null;
})

Source from the content-addressed store, hash-verified

12513}
12514
12515function buildInstructionsCommandSkillPrompt({
12516 event,
12517 subcommand,
12518 userInput,
12519 locale,
12520 now,
12521 cwd,
12522 currentInstructions,
12523 pendingDraft,
12524}: {
12525 event: InboundTextEvent;
12526 subcommand: 'natural' | 'edit';
12527 userInput: string;
12528 locale: string | null;
12529 now: number;
12530 cwd: string | null;
12531 currentInstructions: CodexInstructionsSnapshot;
12532 pendingDraft: PendingInstructionsOperation | null;
12533}): string {
12534 const payload = {
12535 command: 'instructions',
12536 subcommand,
12537 rawText: String(event.text ?? ''),
12538 userInput,
12539 now: new Date(now).toISOString(),
12540 locale: normalizeLocale(locale) ?? 'zh-CN',
12541 scope: {
12542 platform: event.platform,
12543 externalScopeId: event.externalScopeId,
12544 },
12545 cwd,
12546 instructionsPath: currentInstructions.path,
12547 currentInstructions: {
12548 exists: currentInstructions.exists,
12549 content: currentInstructions.content,
12550 },
12551 pendingDraft: pendingDraft
12552 ? {
12553 kind: pendingDraft.kind,
12554 rawInput: pendingDraft.rawInput,
12555 baseContent: pendingDraft.baseContent,
12556 proposedContent: pendingDraft.proposedContent,
12557 summary: pendingDraft.summary,
12558 changes: pendingDraft.changes,
12559 }
12560 : null,
12561 capabilities: {
12562 supportedActions: [...INSTRUCTIONS_COMMAND_SKILL_ACTIONS],
12563 supportedProposalKinds: ['patch', 'replace', 'clear'],
12564 },
12565 skillPath: INSTRUCTIONS_COMMAND_SKILL_PATH,
12566 };
12567 return [
12568 'CodexBridge command skill invocation.',
12569 '',
12570 `Please read and follow this command skill file: ${INSTRUCTIONS_COMMAND_SKILL_PATH}`,
12571 'Use it to interpret the /instructions command request below.',
12572 'Return exactly one JSON object that matches the skill contract.',

Calls 1

normalizeLocaleFunction · 0.85

Tested by

no test coverage detected