feat: delegate deterministic workflow operations to gsd-tools CLI

Add 10 new CLI commands that replace manual AI orchestration of
mechanical, deterministic operations — saving tokens and reducing
errors on the most complex GSD workflows.

New commands:
- phase add <desc> — append phase to roadmap + create directory
- phase insert <after> <desc> — insert decimal phase
- phase remove <N> [--force] — remove phase with full renumbering
- phase complete <N> — mark done, update state + roadmap, detect milestone end
- roadmap analyze — unified roadmap parser with disk status
- milestone complete <ver> [--name] — archive roadmap/requirements/audit
- validate consistency — check phase numbering and disk/roadmap sync
- progress [json|table|bar] — render progress in various formats
- todo complete <file> — move todo from pending to completed
- scaffold [context|uat|verification|phase-dir] — template generation

Updated workflows to use new CLI commands:
- remove-phase.md: 13 manual steps → 1 CLI call + confirm + commit
- add-phase.md: 6 manual steps → 1 CLI call + state update
- insert-phase.md: 7 manual steps → 1 CLI call + state update
- transition.md: roadmap/state updates delegated to phase complete
- progress.md: roadmap parsing delegated to roadmap analyze
- complete-milestone.md: archival delegated to milestone complete

75 tests passing (33 new).

https://claude.ai/code/session_01UhMGMrNGGn2bfeAi7MBphs
This commit is contained in:
Claude
2026-02-08 13:53:09 +00:00
parent 9ad7903895
commit 36f5bb3d5f
8 changed files with 2176 additions and 618 deletions

View File

@@ -37,18 +37,16 @@ When a milestone completes:
<step name="verify_readiness">
Check milestone completion:
**Use `roadmap analyze` for comprehensive readiness check:**
```bash
cat .planning/ROADMAP.md
ls .planning/phases/*/SUMMARY.md 2>/dev/null | wc -l
ROADMAP=$(node ~/.claude/get-shit-done/bin/gsd-tools.js roadmap analyze)
```
Verify:
This returns all phases with plan/summary counts and disk status. Use this to verify:
- Which phases belong to this milestone?
- All phases complete (all plans have summaries)?
- Work tested/validated?
- Ready to ship/tag?
- All phases complete (all plans have summaries)? Check `disk_status === 'complete'` for each.
- `progress_percent` should be 100%.
Present:
@@ -61,7 +59,7 @@ Includes:
- Phase 3: Core Features (3/3 plans complete)
- Phase 4: Polish (1/1 plan complete)
Total: 4 phases, 8 plans, all complete
Total: {phase_count} phases, {total_plans} plans, all complete
```
<config-check>
@@ -152,36 +150,9 @@ Key accomplishments for this milestone:
<step name="create_milestone_entry">
Create or update `.planning/MILESTONES.md`.
**Note:** MILESTONES.md entry is now created automatically by `gsd-tools milestone complete` in the archive_milestone step. The entry includes version, date, phase/plan/task counts, and accomplishments extracted from SUMMARY.md files.
If file doesn't exist, create with project name header. If exists, prepend new entry (reverse chronological).
Use template from `templates/milestone.md`:
```markdown
## v[Version] [Name] (Shipped: YYYY-MM-DD)
**Delivered:** [One sentence from user]
**Phases completed:** [X-Y] ([Z] plans total)
**Key accomplishments:**
- [List from previous step]
**Stats:**
- [Files] files created/modified
- [LOC] lines of [language]
- [Phases] phases, [Plans] plans, [Tasks] tasks
- [Days] days from [start] to ship
**Git range:** `feat(XX-XX)` → `feat(YY-YY)`
**What's next:** [Ask user: what's the next goal?]
---
```
If additional details are needed (e.g., user-provided "Delivered" summary, git range, LOC stats), add them manually after the CLI creates the base entry.
</step>
@@ -370,103 +341,71 @@ Update `.planning/ROADMAP.md` — group completed milestone phases:
<step name="archive_milestone">
Extract completed milestone details to archive.
**Delegate archival to gsd-tools:**
1. Create `.planning/milestones/v[X.Y]-ROADMAP.md`
2. Read `~/.claude/get-shit-done/templates/milestone-archive.md` template
3. Extract from ROADMAP.md: all phases in milestone (by number range), full phase details, plan lists with checkmarks
4. Extract from PROJECT.md: key decisions, validated requirements
5. Fill template placeholders: {{VERSION}}, {{MILESTONE_NAME}}, {{DATE}}, {{PHASE_START}}, {{PHASE_END}}, {{TOTAL_PLANS}}, {{MILESTONE_DESCRIPTION}}, {{PHASES_SECTION}}, {{DECISIONS_FROM_PROJECT}}, {{ISSUES_RESOLVED_DURING_MILESTONE}}
6. Write to `.planning/milestones/v[X.Y]-ROADMAP.md`
7. Delete ROADMAP.md:
```bash
rm .planning/ROADMAP.md
```
8. Verify:
```bash
ls .planning/milestones/v[X.Y]-ROADMAP.md
```
9. Confirm:
```
✅ v[X.Y] roadmap archived to milestones/v[X.Y]-ROADMAP.md
✅ ROADMAP.md deleted (fresh one for next milestone)
```
```bash
ARCHIVE=$(node ~/.claude/get-shit-done/bin/gsd-tools.js milestone complete "v[X.Y]" --name "[Milestone Name]")
```
The CLI handles:
- Creating `.planning/milestones/` directory
- Archiving ROADMAP.md to `milestones/v[X.Y]-ROADMAP.md`
- Archiving REQUIREMENTS.md to `milestones/v[X.Y]-REQUIREMENTS.md` with archive header
- Moving audit file to milestones if it exists
- Creating/appending MILESTONES.md entry with accomplishments from SUMMARY.md files
- Updating STATE.md (status, last activity)
Extract from result: `version`, `date`, `phases`, `plans`, `tasks`, `accomplishments`, `archived`.
Verify: `✅ Milestone archived to .planning/milestones/`
**Note:** Phase directories (`.planning/phases/`) are NOT deleted — they accumulate across milestones as raw execution history. Phase numbering continues (v1.0 phases 1-4, v1.1 phases 5-8, etc.).
</step>
<step name="archive_requirements">
Archive requirements for next milestone.
1. Read REQUIREMENTS.md:
```bash
cat .planning/REQUIREMENTS.md
```
2. Create `.planning/milestones/v[X.Y]-REQUIREMENTS.md`
3. Transform: mark all requirements `[x]` complete, add outcome notes, update traceability table to "Complete", add milestone summary (total shipped, scope changes, drops)
4. Write archive with header:
```markdown
# Requirements Archive: v[X.Y] [Milestone Name]
**Archived:** [DATE]
**Status:** ✅ SHIPPED
For current requirements, see `.planning/REQUIREMENTS.md`.
---
[Full REQUIREMENTS.md content with checkboxes marked complete]
---
## Milestone Summary
**Shipped:** [X] of [Y] requirements
**Adjusted:** [list any that changed]
**Dropped:** [list any removed and why]
---
*Archived: [DATE] as part of v[X.Y] milestone completion*
```
5. Delete original:
```bash
rm .planning/REQUIREMENTS.md
```
6. Confirm:
```
✅ Requirements archived to milestones/v[X.Y]-REQUIREMENTS.md
✅ REQUIREMENTS.md deleted (fresh one for next milestone)
```
**Note:** Next milestone starts with `/gsd:new-milestone` which includes requirements definition. PROJECT.md's Validated section carries cumulative record across milestones.
After archival, the AI still handles:
- Reorganizing ROADMAP.md with milestone grouping (requires judgment)
- Full PROJECT.md evolution review (requires understanding)
- Deleting original ROADMAP.md and REQUIREMENTS.md
- These are NOT fully delegated because they require AI interpretation of content
</step>
<step name="archive_audit">
<step name="reorganize_roadmap_and_delete_originals">
Move audit file to archive (if exists). Use init context or check directly:
After `milestone complete` has archived, reorganize ROADMAP.md with milestone groupings, then delete originals:
```bash
# Check if audit file exists
[ -f ".planning/v[X.Y]-MILESTONE-AUDIT.md" ] && mv .planning/v[X.Y]-MILESTONE-AUDIT.md .planning/milestones/
**Reorganize ROADMAP.md** — group completed milestone phases:
```markdown
# Roadmap: [Project Name]
## Milestones
- ✅ **v1.0 MVP** — Phases 1-4 (shipped YYYY-MM-DD)
- 🚧 **v1.1 Security** — Phases 5-6 (in progress)
## Phases
<details>
<summary>✅ v1.0 MVP (Phases 1-4) — SHIPPED YYYY-MM-DD</summary>
- [x] Phase 1: Foundation (2/2 plans) — completed YYYY-MM-DD
- [x] Phase 2: Authentication (2/2 plans) — completed YYYY-MM-DD
</details>
```
Confirm: `✅ Audit archived to milestones/v[X.Y]-MILESTONE-AUDIT.md`
**Then delete originals:**
Skip silently if no audit file — audit is optional.
```bash
rm .planning/ROADMAP.md
rm .planning/REQUIREMENTS.md
```
</step>
<step name="update_state">
Update STATE.md for milestone completion.
Most STATE.md updates were handled by `milestone complete`, but verify and update remaining fields:
**Project Reference:**
@@ -479,17 +418,6 @@ See: .planning/PROJECT.md (updated [today])
**Current focus:** [Next milestone or "Planning next milestone"]
```
**Current Position:**
```markdown
Phase: [Next phase] of [Total] ([Phase name])
Plan: Not started
Status: Ready to plan
Last activity: [today] — v[X.Y] milestone complete
Progress: [updated progress bar]
```
**Accumulated Context:**
- Clear decisions summary (full log in PROJECT.md)
- Clear resolved blockers