* feat(gsd-tools): add compound init commands for workflow setup Adds 8 compound commands that return all context a workflow needs in one JSON blob, replacing 5-10 atomic calls per workflow: - init execute-phase: models, config, phase info, plan inventory - init plan-phase: models, workflow flags, existing artifacts - init new-project: models, brownfield detection, state checks - init new-milestone: models, milestone info - init quick: models, next task number, timestamps - init resume: file existence, interrupted agent - init verify-work: models, phase info - init phase-op: generic phase context Updated 8 workflows to use compound commands: - execute-phase, plan-phase, new-project, quick - resume-project, verify-work, discuss-phase Token savings: ~200 lines of bash setup replaced with single init calls. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(gsd-tools): add 4 new init commands and update files to use compound commands Add new compound init commands: - init todos - context for todo workflows - init milestone-op - context for milestone operations - init map-codebase - context for codebase mapping - init progress - context for progress workflow Update 24 files to use compound init commands instead of atomic calls: - 4 phase operation workflows (add-phase, insert-phase, remove-phase, verify-phase) - 5 todo/milestone workflows (add-todo, check-todos, audit-milestone, complete-milestone, new-milestone) - 6 misc workflows (execute-plan, map-codebase, pause-work, progress, set-profile, settings) - 6 agent files (gsd-executor, gsd-planner, gsd-phase-researcher, gsd-plan-checker, gsd-debugger, gsd-research-synthesizer) - 2 command files (debug, research-phase) - 1 reference file (planning-config) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(gsd-tools): add init to help output Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(verify-phase): correct expected init fields The workflow was referencing plans/summaries from init phase-op, but those fields come from ls command. Updated to reference has_plans and plan_count which are actually in phase-op output. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
8.6 KiB
<required_reading> Read all files referenced by the invoking prompt's execution_context before starting. </required_reading>
Parse the command arguments: - Argument is the phase number to remove (integer or decimal) - Example: `/gsd:remove-phase 17` → phase = 17 - Example: `/gsd:remove-phase 16.1` → phase = 16.1If no argument provided:
ERROR: Phase number required
Usage: /gsd:remove-phase <phase-number>
Example: /gsd:remove-phase 17
Exit.
Load phase operation context:INIT=$(node ~/.claude/get-shit-done/bin/gsd-tools.js init phase-op "${target}")
Extract: phase_found, phase_dir, phase_number, commit_docs, roadmap_exists.
Also read STATE.md and ROADMAP.md content for parsing current position.
Verify the target phase exists in ROADMAP.md:-
Search for
### Phase {target}:heading -
If not found:
ERROR: Phase {target} not found in roadmap Available phases: [list phase numbers]Exit.
- Compare target phase to current phase from STATE.md
- Target must be > current phase number
If target <= current phase:
ERROR: Cannot remove Phase {target}
Only future phases can be removed:
- Current phase: {current}
- Phase {target} is current or completed
To abandon current work, use /gsd:pause-work instead.
Exit.
- Check for SUMMARY.md files in phase directory:
ls .planning/phases/{target}-*/*-SUMMARY.md 2>/dev/null
If any SUMMARY.md files exist:
ERROR: Phase {target} has completed work
Found executed plans:
- {list of SUMMARY.md files}
Cannot remove phases with completed work.
Exit.
Collect information about the phase being removed:- Extract phase name from ROADMAP.md heading:
### Phase {target}: {Name} - Find phase directory:
.planning/phases/{target}-{slug}/ - Find all subsequent phases (integer and decimal) that need renumbering
Subsequent phase detection:
For integer phase removal (e.g., 17):
- Find all phases > 17 (integers: 18, 19, 20...)
- Find all decimal phases >= 17.0 and < 18.0 (17.1, 17.2...) → these become 16.x
- Find all decimal phases for subsequent integers (18.1, 19.1...) → renumber with their parent
For decimal phase removal (e.g., 17.1):
- Find all decimal phases > 17.1 and < 18 (17.2, 17.3...) → renumber down
- Integer phases unchanged
List all phases that will be renumbered.
Present removal summary and confirm:Removing Phase {target}: {Name}
This will:
- Delete: .planning/phases/{target}-{slug}/
- Renumber {N} subsequent phases:
- Phase 18 → Phase 17
- Phase 18.1 → Phase 17.1
- Phase 19 → Phase 18
[etc.]
Proceed? (y/n)
Wait for confirmation.
Use the init context from earlier. The `phase_dir` from `init phase-op` provides the path.Delete the target phase directory if it exists:
# phase_dir from init phase-op contains the path if found
if [ -n "$phase_dir" ]; then
rm -rf "$phase_dir"
echo "Deleted: $phase_dir/"
fi
If directory doesn't exist (phase_found=false from init), note: "No directory to delete (phase not yet created)"
For each phase directory that needs renumbering (in reverse order to avoid conflicts):
# Example: renaming 18-dashboard to 17-dashboard
mv ".planning/phases/18-dashboard" ".planning/phases/17-dashboard"
Process in descending order (20→19, then 19→18, then 18→17) to avoid overwriting.
Also rename decimal phase directories:
17.1-fix-bug→16.1-fix-bug(if removing integer 17)17.2-hotfix→17.1-hotfix(if removing decimal 17.1)
For each renumbered directory, rename files that contain the phase number:
# Inside 17-dashboard (was 18-dashboard):
mv "18-01-PLAN.md" "17-01-PLAN.md"
mv "18-02-PLAN.md" "17-02-PLAN.md"
mv "18-01-SUMMARY.md" "17-01-SUMMARY.md" # if exists
# etc.
Also handle CONTEXT.md and DISCOVERY.md (these don't have phase prefixes, so no rename needed).
Update ROADMAP.md:-
Remove the phase section entirely:
- Delete from
### Phase {target}:to the next phase heading (or section end)
- Delete from
-
Remove from phase list:
- Delete line
- [ ] **Phase {target}: {Name}**or similar
- Delete line
-
Remove from Progress table:
- Delete the row for Phase {target}
-
Renumber all subsequent phases:
### Phase 18:→### Phase 17:- [ ] **Phase 18:→- [ ] **Phase 17:- Table rows:
| 18. Dashboard |→| 17. Dashboard | - Plan references:
18-01:→17-01:
-
Update dependency references:
**Depends on:** Phase 18→**Depends on:** Phase 17- For the phase that depended on the removed phase:
**Depends on:** Phase 17(removed) →**Depends on:** Phase 16
-
Renumber decimal phases:
### Phase 17.1:→### Phase 16.1:(if integer 17 removed)- Update all references consistently
Write updated ROADMAP.md.
Update STATE.md:-
Update total phase count:
Phase: 16 of 20→Phase: 16 of 19
-
Recalculate progress percentage:
- New percentage based on completed plans / new total plans
Do NOT add a "Roadmap Evolution" note - the git commit is the record.
Write updated STATE.md.
Search for and update phase references inside plan files:# Find files that reference the old phase numbers
grep -r "Phase 18" .planning/phases/17-*/ 2>/dev/null
grep -r "Phase 19" .planning/phases/18-*/ 2>/dev/null
# etc.
Update any internal references to reflect new numbering.
Stage and commit the removal:node ~/.claude/get-shit-done/bin/gsd-tools.js commit "chore: remove phase {target} ({original-phase-name})" --files .planning/
The commit message preserves the historical record of what was removed.
Present completion summary:Phase {target} ({original-name}) removed.
Changes:
- Deleted: .planning/phases/{target}-{slug}/
- Renumbered: Phases {first-renumbered}-{last-old} → {first-renumbered-1}-{last-new}
- Updated: ROADMAP.md, STATE.md
- Committed: chore: remove phase {target} ({original-name})
Current roadmap: {total-remaining} phases
Current position: Phase {current} of {new-total}
---
## What's Next
Would you like to:
- `/gsd:progress` — see updated roadmap status
- Continue with current phase
- Review roadmap
---
<anti_patterns>
- Don't remove completed phases (have SUMMARY.md files)
- Don't remove current or past phases
- Don't leave gaps in numbering - always renumber
- Don't add "removed phase" notes to STATE.md - git commit is the record
- Don't ask about each decimal phase - just renumber them
- Don't modify completed phase directories </anti_patterns>
<edge_cases>
Removing a decimal phase (e.g., 17.1):
- Only affects other decimals in same series (17.2 → 17.1, 17.3 → 17.2)
- Integer phases unchanged
- Simpler operation
No subsequent phases to renumber:
- Removing the last phase (e.g., Phase 20 when that's the end)
- Just delete and update ROADMAP.md, no renumbering needed
Phase directory doesn't exist:
- Phase may be in ROADMAP.md but directory not created yet
- Skip directory deletion, proceed with ROADMAP.md updates
Decimal phases under removed integer:
- Removing Phase 17 when 17.1, 17.2 exist
- 17.1 → 16.1, 17.2 → 16.2
- They maintain their position in execution order (after current last integer)
</edge_cases>
<success_criteria> Phase removal is complete when:
- Target phase validated as future/unstarted
- Phase directory deleted (if existed)
- All subsequent phase directories renumbered
- Files inside directories renamed ({old}-01-PLAN.md → {new}-01-PLAN.md)
- ROADMAP.md updated (section removed, all references renumbered)
- STATE.md updated (phase count, progress percentage)
- Dependency references updated in subsequent phases
- Changes committed with descriptive message
- No gaps in phase numbering
- User informed of changes </success_criteria>