feat: auto --init flag, headless prompts, and prompt sanitizer (#1417)

* fix: Created 10 headless prompt files (5 workflows + 5 agents) in sdk/p…

- "sdk/prompts/workflows/execute-plan.md"
- "sdk/prompts/workflows/research-phase.md"
- "sdk/prompts/workflows/plan-phase.md"
- "sdk/prompts/workflows/verify-phase.md"
- "sdk/prompts/workflows/discuss-phase.md"
- "sdk/prompts/agents/gsd-executor.md"
- "sdk/prompts/agents/gsd-phase-researcher.md"
- "sdk/prompts/agents/gsd-planner.md"

GSD-Task: S01/T02

* feat: Created prompt-sanitizer.ts, wired headless prompt loading into P…

- "sdk/src/prompt-sanitizer.ts"
- "sdk/src/phase-prompt.ts"
- "sdk/src/gsd-tools.ts"
- "sdk/src/gsd-tools.test.ts"
- "sdk/src/phase-runner-types.test.ts"

GSD-Task: S01/T01

* test: Added 111 unit tests covering sanitizePrompt(), headless prompt l…

- "sdk/src/prompt-sanitizer.test.ts"
- "sdk/src/headless-prompts.test.ts"
- "sdk/src/phase-prompt.test.ts"

GSD-Task: S01/T03

* feat: Wired sdkPromptsDir preference and sanitizePrompt into InitRunner…

- "sdk/src/init-runner.ts"
- "sdk/package.json"

GSD-Task: S02/T01

* feat: add --init flag to auto command for single-command PRD-to-execution

gsd-sdk auto --init @path/to/prd.md now bootstraps the project (init)
then immediately runs the autonomous phase execution loop.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: add remaining headless prompt files and templates

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: Extended init-runner.test.ts with 7 sdkPromptsDir preference and…

- "sdk/src/init-runner.test.ts"

GSD-Task: S02/T03

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
TÂCHES
2026-03-26 22:40:34 -06:00
committed by GitHub
parent 0fde35acf9
commit 89f95c43ba
38 changed files with 5146 additions and 49 deletions

View File

@@ -0,0 +1,84 @@
<purpose>
Create executable phase plans (PLAN.md files) for a roadmap phase with integrated research and verification.
Headless SDK variant — runs autonomously. Research, planning, and plan-checking proceed without user prompts.
Default flow: Research (if needed) -> Plan -> Verify -> Done.
</purpose>
<process>
<step name="initialize">
Load all context from injected context files. Extract: phase directory, phase number, phase name, research status, context status, plan count, requirement IDs.
If planning directory is missing: report error via event stream.
</step>
<step name="validate_phase">
Validate phase exists in roadmap. If not found: report error with available phases.
</step>
<step name="load_context">
Load CONTEXT.md if it exists. This contains user decisions that constrain planning.
If no CONTEXT.md exists: proceed without — plan using research and requirements only. In headless mode, there is no interactive discuss-phase; context comes from prior artifacts or is skipped.
</step>
<step name="handle_research">
If RESEARCH.md exists: use existing research.
If RESEARCH.md is missing and research is enabled:
1. Execute research phase (spawn researcher agent)
2. Researcher writes RESEARCH.md
3. Continue to planning
If research is disabled: skip to planning step.
</step>
<step name="spawn_planner">
Execute planning with the planner agent definition. Provide:
- Phase number, name, and goal
- Context files: state, roadmap, requirements, context, research
- Phase requirement IDs (every ID must appear in a plan's requirements field)
The planner creates PLAN.md files with task breakdown, dependency analysis, and verification criteria.
</step>
<step name="handle_planner_return">
- **PLANNING COMPLETE** — Plans created. If plan checker is enabled: proceed to verification.
- **PLANNING BLOCKED** — Log blocker, report via event stream.
- **PLANNING INCONCLUSIVE** — Report with available context.
</step>
<step name="spawn_plan_checker">
If plan checker is enabled, execute verification with the plan-checker agent. Provide:
- Phase number and goal
- Plan files to verify
- Roadmap, requirements, context, research files
- Phase requirement IDs
The checker verifies plans will achieve the phase goal before execution.
</step>
<step name="handle_checker_return">
- **VERIFICATION PASSED** — Plans ready for execution.
- **ISSUES FOUND** — Enter revision loop (max 3 iterations):
1. Send issues back to planner for targeted revision
2. Re-run plan checker
3. If max iterations reached: proceed with current plans, log remaining issues
</step>
<step name="requirements_coverage_gate">
After plans pass the checker (or checker is skipped), verify all phase requirements are covered:
1. Extract requirement IDs claimed by plans
2. Compare against phase requirements from roadmap
3. If gaps found: log as warning, continue (headless mode does not block for coverage gaps)
</step>
</process>
<success_criteria>
- Phase validated against roadmap
- Research completed (unless skipped or existing)
- PLAN.md file(s) created with valid structure
- Plan checker passed (or issues logged)
- Requirements coverage verified
</success_criteria>