Files
kandev/apps/web/lib/walkthrough-request.ts
João Salavisa 5257dfbaab fix(web): close the i18n coverage gaps in the non-JSX scanner and locale catalogs (#2727)
Co-authored-by: Kandev Agent <agent@kandev.dev>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-16 23:03:29 +00:00

30 lines
1.1 KiB
TypeScript

import { formatPromptReferenceExpansions } from "@/lib/prompts/expand-prompt-references";
export const CHANGES_WALKTHROUGH_PROMPT_NAME = "changes-walkthrough";
// Custom prompts may still contain placeholders from earlier walkthrough prompt iterations.
const DIFF_CONTEXT_PLACEHOLDER = "{{diff_context}}";
const CHANGED_FILES_PLACEHOLDER = "{{changed_files}}";
// i18n-exempt: agent-facing prompt substitution, sent to the model verbatim.
const STATIC_CONTEXT_INSTRUCTION = "Inspect the task changes and compare against the correct base.";
function buildExpansionContent(template: string): string {
return template
.trim()
.replaceAll(DIFF_CONTEXT_PLACEHOLDER, STATIC_CONTEXT_INSTRUCTION)
.replaceAll(CHANGED_FILES_PLACEHOLDER, STATIC_CONTEXT_INSTRUCTION);
}
export function buildChangesWalkthroughPrompt(template: string): string {
const expansionContext = formatPromptReferenceExpansions([
{ name: CHANGES_WALKTHROUGH_PROMPT_NAME, content: buildExpansionContent(template) },
]);
return [
`@${CHANGES_WALKTHROUGH_PROMPT_NAME}`,
"",
"<kandev-system>",
expansionContext,
"</kandev-system>",
].join("\n");
}