feat: Add phase-by-phase prompt generation for complex projects

- Generate prompts/phase{1-4}-prompt.txt files with phase-specific tasks
- Update GUIDE.md with phase-by-phase execution instructions
- Include both /ralph-wiggum and bash loop alternatives for each phase
- Each phase prompt references PROMPT.md and focuses on one phase only
- Add tech-stack-specific build/test/lint commands per phase

Also includes fix for JSON parsing with markdown code fences.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Debian
2026-01-11 04:40:05 +00:00
parent da86128d96
commit 75294a2daf
8 changed files with 440 additions and 115 deletions

View File

@@ -125,3 +125,41 @@
9. README.md documents all commands and options ✓
10. npm publish --dry-run succeeds ✓
[2026-01-11T03:21:00Z] [5] [FIX] - Fixed JSON parsing for Claude responses wrapped in markdown code fences
- Added stripCodeFences() utility function to src/utils/files.ts
- Updated src/generators/specification.ts to use stripCodeFences
- Updated src/clients/claude.ts in 3 places:
* parseArchitectureResponse()
* parseQueriesResponse()
* generateSpec()
- The new approach handles edge cases better than the regex match approach
- Build and all 110 tests pass
[2026-01-11T04:37:00Z] [6] [FEATURE] - Phase-by-phase prompt generation
- Modified src/generators/scaffold.ts:
* Added prompts/ directory creation
* Added writePhasePrompts() method to generate 4 phase-specific prompt files
* Added generatePhasePrompt() to create individual phase prompts
* Added helper methods for build/test/lint commands per language
* Updated dry-run structure logging to include prompts/
- Modified src/generators/prd.ts:
* Rewrote generateGuideMd() to generate deterministic phase-by-phase guide
* GUIDE.md now includes 4 phases with:
- /ralph-wiggum:ralph-loop command for each phase
- Verification command after each phase
- Bash loop alternative for each phase
* Still includes full project execution as alternative
- Updated test in src/__tests__/prd.test.ts to match new GUIDE.md format
- Generated files:
* prompts/phase1-prompt.txt - Foundation phase
* prompts/phase2-prompt.txt - Core phase
* prompts/phase3-prompt.txt - Integration phase
* prompts/phase4-prompt.txt - Polish phase
- Each phase prompt includes:
* Reference to PROMPT.md for context
* Phase-specific tasks from prd.json
* Working instructions with tech-stack-specific commands
* Phase-specific completion promise (PHASE_X_COMPLETE)
- Build succeeds, all 110 tests pass, lint clean
- Tested with ralph-vibe new word-counter - all phase files generated correctly