diff --git a/src/resources/extensions/sf/auto-prompts.ts b/src/resources/extensions/sf/auto-prompts.ts index 16dc2f1c8..1f991991a 100644 --- a/src/resources/extensions/sf/auto-prompts.ts +++ b/src/resources/extensions/sf/auto-prompts.ts @@ -1559,6 +1559,97 @@ export async function checkNeedsRunUat( // ─── Prompt Builders ────────────────────────────────────────────────────── +/** + * Build a prompt for the workflow-preferences unit type (deep mode). + * Captures workflow + planning preferences during deep-mode bootstrap, + * before discuss-project runs. + */ +export async function buildWorkflowPreferencesPrompt( + base: string, + structuredQuestionsAvailable = "false", +): Promise { + return loadPrompt("guided-workflow-preferences", { + workingDirectory: base, + structuredQuestionsAvailable, + }); +} + +/** + * Build a prompt for the discuss-project unit type (deep mode). + * Project-level interview: produces .sf/PROJECT.md. + * Fires before any milestone-level work when planning_depth === "deep" + * and PROJECT.md is missing. + */ +export async function buildDiscussProjectPrompt( + base: string, + structuredQuestionsAvailable = "false", +): Promise { + const inlinedTemplates = inlineTemplate("project", "Project"); + + return loadPrompt("guided-discuss-project", { + workingDirectory: base, + inlinedTemplates, + structuredQuestionsAvailable, + commitInstruction: + "Do not commit planning artifacts — .sf/ is managed externally.", + }); +} + +/** + * Build a prompt for the discuss-requirements unit type (deep mode). + * Requirements-level interview: produces .sf/REQUIREMENTS.md using the + * structured R### format. Reads PROJECT.md as authoritative context. + * Fires when planning_depth === "deep", PROJECT.md exists, and + * REQUIREMENTS.md is missing. + */ +export async function buildDiscussRequirementsPrompt( + base: string, + structuredQuestionsAvailable = "false", +): Promise { + const inlinedTemplates = inlineTemplate("requirements", "Requirements"); + + return loadPrompt("guided-discuss-requirements", { + workingDirectory: base, + inlinedTemplates, + structuredQuestionsAvailable, + commitInstruction: + "Do not commit planning artifacts — .sf/ is managed externally.", + }); +} + +/** + * Build a prompt for the research-decision unit type (deep mode). + * Fixed-question stage: asks "research first or skip?" via + * ask_user_questions and writes .sf/runtime/research-decision.json. + * Fires after discuss-requirements and before research-project-parallel. + */ +export async function buildResearchDecisionPrompt( + base: string, + structuredQuestionsAvailable = "false", +): Promise { + return loadPrompt("guided-research-decision", { + workingDirectory: base, + structuredQuestionsAvailable, + }); +} + +/** + * Build a prompt for the research-project-parallel unit type (deep mode). + * Orchestrator that spawns parallel subagents covering stack, features, + * architecture, and pitfalls. Each subagent writes its findings to + * .sf/research/. Fires after research-decision marker says "research" and + * project research files are missing. Skipped entirely if user picked "skip". + */ +export async function buildResearchProjectPrompt( + base: string, + structuredQuestionsAvailable = "false", +): Promise { + return loadPrompt("guided-research-project", { + workingDirectory: base, + structuredQuestionsAvailable, + }); +} + /** * Build a prompt for the discuss-milestone unit type. * Loads the guided-discuss-milestone template and inlines the CONTEXT-DRAFT