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

@@ -118,39 +118,22 @@ If found, delete them — phase is complete, handoffs are stale.
</step>
<step name="update_roadmap">
<step name="update_roadmap_and_state">
Update the roadmap file:
**Delegate ROADMAP.md and STATE.md updates to gsd-tools:**
```bash
ROADMAP_FILE=".planning/ROADMAP.md"
TRANSITION=$(node ~/.claude/get-shit-done/bin/gsd-tools.js phase complete "${current_phase}")
```
Update the file:
The CLI handles:
- Marking the phase checkbox as `[x]` complete with today's date
- Updating plan count to final (e.g., "3/3 plans complete")
- Updating the Progress table (Status → Complete, adding date)
- Advancing STATE.md to next phase (Current Phase, Status → Ready to plan, Current Plan → Not started)
- Detecting if this is the last phase in the milestone
- Mark current phase: `[x] Complete`
- Add completion date
- Update plan count to final (e.g., "3/3 plans complete")
- Update Progress table
- Keep next phase as `[ ] Not started`
**Example:**
```markdown
## Phases
- [x] Phase 1: Foundation (completed 2025-01-15)
- [ ] Phase 2: Authentication ← Next
- [ ] Phase 3: Core Features
## Progress
| Phase | Plans Complete | Status | Completed |
| ----------------- | -------------- | ----------- | ---------- |
| 1. Foundation | 3/3 | Complete | 2025-01-15 |
| 2. Authentication | 0/2 | Not started | - |
| 3. Core Features | 0/1 | Not started | - |
```
Extract from result: `completed_phase`, `plans_executed`, `next_phase`, `next_phase_name`, `is_last_phase`.
</step>
@@ -250,61 +233,21 @@ After (Phase 2 shipped JWT auth, discovered rate limiting needed):
<step name="update_current_position_after_transition">
Update Current Position section in STATE.md to reflect phase completion and transition.
**Note:** Basic position updates (Current Phase, Status, Current Plan, Last Activity) were already handled by `gsd-tools phase complete` in the update_roadmap_and_state step.
**Format:**
Verify the updates are correct by reading STATE.md. If the progress bar needs updating, use:
```markdown
Phase: [next] of [total] ([Next phase name])
Plan: Not started
Status: Ready to plan
Last activity: [today] — Phase [X] complete, transitioned to Phase [X+1]
Progress: [updated progress bar]
```bash
PROGRESS=$(node ~/.claude/get-shit-done/bin/gsd-tools.js progress bar --raw)
```
**Instructions:**
- Increment phase number to next phase
- Reset plan to "Not started"
- Set status to "Ready to plan"
- Update last activity to describe transition
- Recalculate progress bar based on completed plans
**Example — transitioning from Phase 2 to Phase 3:**
Before:
```markdown
## Current Position
Phase: 2 of 4 (Authentication)
Plan: 2 of 2 in current phase
Status: Phase complete
Last activity: 2025-01-20 — Completed 02-02-PLAN.md
Progress: ███████░░░ 60%
```
After:
```markdown
## Current Position
Phase: 3 of 4 (Core Features)
Plan: Not started
Status: Ready to plan
Last activity: 2025-01-20 — Phase 2 complete, transitioned to Phase 3
Progress: ███████░░░ 60%
```
Update the progress bar line in STATE.md with the result.
**Step complete when:**
- [ ] Phase number incremented to next phase
- [ ] Plan status reset to "Not started"
- [ ] Status shows "Ready to plan"
- [ ] Last activity describes the transition
- [ ] Phase number incremented to next phase (done by phase complete)
- [ ] Plan status reset to "Not started" (done by phase complete)
- [ ] Status shows "Ready to plan" (done by phase complete)
- [ ] Progress bar reflects total completed plans
</step>
@@ -394,26 +337,20 @@ Resume file: None
**MANDATORY: Verify milestone status before presenting next steps.**
**Step 1: Read ROADMAP.md and identify phases in current milestone**
**Use the transition result from `gsd-tools phase complete`:**
Read the ROADMAP.md file and extract:
1. Current phase number (the phase just transitioned from)
2. All phase numbers in the current milestone section
The `is_last_phase` field from the phase complete result tells you directly:
- `is_last_phase: false` → More phases remain → Go to **Route A**
- `is_last_phase: true` → Milestone complete → Go to **Route B**
To find phases, look for:
- Phase headers: lines starting with `### Phase` or `#### Phase`
- Phase list items: lines like `- [ ] **Phase X:` or `- [x] **Phase X:`
The `next_phase` and `next_phase_name` fields give you the next phase details.
Count total phases and identify the highest phase number in the milestone.
If you need additional context, use:
```bash
ROADMAP=$(node ~/.claude/get-shit-done/bin/gsd-tools.js roadmap analyze)
```
State: "Current phase is {X}. Milestone has {N} phases (highest: {Y})."
**Step 2: Route based on milestone status**
| Condition | Meaning | Action |
|-----------|---------|--------|
| current phase < highest phase | More phases remain | Go to **Route A** |
| current phase = highest phase | Milestone complete | Go to **Route B** |
This returns all phases with goals, disk status, and completion info.
---