gsd-opencode 1.10.2 → 1.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/agents/gsd-codebase-mapper.md +29 -3
  2. package/agents/gsd-debugger.md +19 -21
  3. package/agents/gsd-executor.md +213 -528
  4. package/agents/gsd-integration-checker.md +20 -0
  5. package/agents/gsd-phase-researcher.md +189 -267
  6. package/agents/gsd-plan-checker.md +278 -279
  7. package/agents/gsd-planner.md +299 -490
  8. package/agents/gsd-project-researcher.md +103 -345
  9. package/agents/gsd-research-synthesizer.md +5 -22
  10. package/agents/gsd-roadmapper.md +43 -6
  11. package/agents/gsd-verifier.md +158 -377
  12. package/{lib → bin/dm/lib}/constants.js +10 -3
  13. package/{src → bin/dm/src}/commands/install.js +5 -4
  14. package/{src → bin/dm/src}/commands/uninstall.js +3 -1
  15. package/{src → bin/dm/src}/services/backup-manager.js +1 -1
  16. package/{src → bin/dm/src}/services/config.js +1 -1
  17. package/{src → bin/dm/src}/services/file-ops.js +20 -4
  18. package/{src → bin/dm/src}/services/health-checker.js +3 -1
  19. package/{src → bin/dm/src}/services/repair-service.js +3 -1
  20. package/{src → bin/dm/src}/services/settings.js +1 -1
  21. package/{src → bin/dm/src}/services/update-service.js +2 -2
  22. package/bin/gsd-install.js +0 -0
  23. package/bin/gsd.js +9 -9
  24. package/commands/gsd/gsd-add-phase.md +43 -0
  25. package/commands/gsd/gsd-add-todo.md +47 -0
  26. package/commands/gsd/gsd-audit-milestone.md +36 -0
  27. package/commands/gsd/gsd-check-todos.md +45 -0
  28. package/commands/gsd/gsd-cleanup.md +18 -0
  29. package/commands/gsd/{complete-milestone.md → gsd-complete-milestone.md} +1 -1
  30. package/commands/gsd/{debug.md → gsd-debug.md} +16 -21
  31. package/commands/gsd/{discuss-phase.md → gsd-discuss-phase.md} +6 -9
  32. package/commands/gsd/gsd-execute-phase.md +41 -0
  33. package/commands/gsd/gsd-health.md +22 -0
  34. package/commands/gsd/gsd-help.md +22 -0
  35. package/commands/gsd/gsd-insert-phase.md +32 -0
  36. package/commands/gsd/gsd-join-discord.md +18 -0
  37. package/commands/gsd/{list-phase-assumptions.md → gsd-list-phase-assumptions.md} +3 -7
  38. package/commands/gsd/{map-codebase.md → gsd-map-codebase.md} +3 -3
  39. package/commands/gsd/gsd-new-milestone.md +44 -0
  40. package/commands/gsd/gsd-new-project.md +42 -0
  41. package/commands/gsd/gsd-pause-work.md +38 -0
  42. package/commands/gsd/gsd-plan-milestone-gaps.md +34 -0
  43. package/commands/gsd/gsd-plan-phase.md +44 -0
  44. package/commands/gsd/gsd-progress.md +24 -0
  45. package/commands/gsd/gsd-quick.md +41 -0
  46. package/commands/gsd/gsd-reapply-patches.md +119 -0
  47. package/commands/gsd/gsd-remove-phase.md +31 -0
  48. package/commands/gsd/{research-phase.md → gsd-research-phase.md} +38 -49
  49. package/commands/gsd/{resume-work.md → gsd-resume-work.md} +2 -2
  50. package/commands/gsd/gsd-set-profile.md +34 -0
  51. package/commands/gsd/gsd-settings.md +36 -0
  52. package/commands/gsd/gsd-update.md +37 -0
  53. package/commands/gsd/gsd-verify-work.md +38 -0
  54. package/get-shit-done/bin/gsd-tools.cjs +553 -0
  55. package/get-shit-done/bin/gsd-tools.test.cjs +2346 -0
  56. package/get-shit-done/bin/lib/commands.cjs +556 -0
  57. package/get-shit-done/bin/lib/config.cjs +162 -0
  58. package/get-shit-done/bin/lib/core.cjs +377 -0
  59. package/get-shit-done/bin/lib/frontmatter.cjs +299 -0
  60. package/get-shit-done/bin/lib/init.cjs +694 -0
  61. package/get-shit-done/bin/lib/milestone.cjs +215 -0
  62. package/get-shit-done/bin/lib/phase.cjs +877 -0
  63. package/get-shit-done/bin/lib/roadmap.cjs +298 -0
  64. package/get-shit-done/bin/lib/state.cjs +490 -0
  65. package/get-shit-done/bin/lib/template.cjs +222 -0
  66. package/get-shit-done/bin/lib/verify.cjs +772 -0
  67. package/get-shit-done/references/checkpoints.md +62 -364
  68. package/get-shit-done/references/decimal-phase-calculation.md +65 -0
  69. package/get-shit-done/references/git-integration.md +10 -16
  70. package/get-shit-done/references/git-planning-commit.md +38 -0
  71. package/get-shit-done/references/model-profile-resolution.md +34 -0
  72. package/get-shit-done/references/model-profiles.md +54 -66
  73. package/get-shit-done/references/phase-argument-parsing.md +61 -0
  74. package/get-shit-done/references/planning-config.md +112 -10
  75. package/get-shit-done/references/questioning.md +4 -0
  76. package/get-shit-done/references/ui-brand.md +1 -1
  77. package/get-shit-done/templates/UAT.md +1 -1
  78. package/get-shit-done/templates/VALIDATION.md +104 -0
  79. package/get-shit-done/templates/codebase/structure.md +6 -6
  80. package/get-shit-done/templates/config.json +37 -0
  81. package/get-shit-done/templates/context.md +2 -10
  82. package/get-shit-done/templates/continue-here.md +6 -6
  83. package/get-shit-done/templates/debug-subagent-prompt.md +2 -2
  84. package/get-shit-done/templates/discovery.md +6 -6
  85. package/get-shit-done/templates/milestone-archive.md +3 -3
  86. package/get-shit-done/templates/phase-prompt.md +9 -7
  87. package/get-shit-done/templates/planner-subagent-prompt.md +6 -6
  88. package/get-shit-done/templates/research-project/ARCHITECTURE.md +1 -1
  89. package/get-shit-done/templates/research.md +29 -6
  90. package/get-shit-done/templates/roadmap.md +1 -1
  91. package/get-shit-done/templates/state.md +0 -30
  92. package/get-shit-done/templates/summary-complex.md +59 -0
  93. package/get-shit-done/templates/summary-minimal.md +41 -0
  94. package/get-shit-done/templates/summary-standard.md +48 -0
  95. package/get-shit-done/templates/summary.md +16 -37
  96. package/get-shit-done/templates/user-setup.md +1 -13
  97. package/get-shit-done/templates/verification-report.md +5 -5
  98. package/get-shit-done/workflows/add-phase.md +111 -0
  99. package/{commands/gsd → get-shit-done/workflows}/add-todo.md +24 -60
  100. package/{commands/gsd → get-shit-done/workflows}/audit-milestone.md +83 -63
  101. package/{commands/gsd → get-shit-done/workflows}/check-todos.md +21 -73
  102. package/get-shit-done/workflows/cleanup.md +152 -0
  103. package/get-shit-done/workflows/complete-milestone.md +251 -312
  104. package/get-shit-done/workflows/diagnose-issues.md +6 -31
  105. package/get-shit-done/workflows/discovery-phase.md +11 -11
  106. package/get-shit-done/workflows/discuss-phase.md +156 -49
  107. package/get-shit-done/workflows/execute-phase.md +238 -396
  108. package/get-shit-done/workflows/execute-plan.md +180 -1609
  109. package/get-shit-done/workflows/health.md +156 -0
  110. package/{commands/gsd → get-shit-done/workflows}/help.md +33 -35
  111. package/get-shit-done/workflows/insert-phase.md +129 -0
  112. package/get-shit-done/workflows/list-phase-assumptions.md +3 -3
  113. package/get-shit-done/workflows/map-codebase.md +73 -80
  114. package/get-shit-done/workflows/new-milestone.md +382 -0
  115. package/{commands/gsd → get-shit-done/workflows}/new-project.md +281 -234
  116. package/get-shit-done/workflows/oc-set-profile.md +320 -0
  117. package/{commands/gsd → get-shit-done/workflows}/pause-work.md +31 -43
  118. package/{commands/gsd → get-shit-done/workflows}/plan-milestone-gaps.md +29 -50
  119. package/get-shit-done/workflows/plan-phase.md +478 -0
  120. package/{commands/gsd → get-shit-done/workflows}/progress.md +64 -47
  121. package/get-shit-done/workflows/quick.md +453 -0
  122. package/get-shit-done/workflows/remove-phase.md +154 -0
  123. package/get-shit-done/workflows/research-phase.md +73 -0
  124. package/get-shit-done/workflows/resume-project.md +17 -26
  125. package/get-shit-done/workflows/set-profile.md +80 -0
  126. package/get-shit-done/workflows/settings.md +213 -0
  127. package/get-shit-done/workflows/transition.md +84 -104
  128. package/{commands/gsd → get-shit-done/workflows}/update.md +70 -28
  129. package/get-shit-done/workflows/verify-phase.md +106 -492
  130. package/get-shit-done/workflows/verify-work.md +26 -53
  131. package/package.json +7 -4
  132. package/rules/gsd-oc-work-hard.md +36 -0
  133. package/skills/gsd-oc-select-model/SKILL.md +348 -0
  134. package/skills/gsd-oc-select-model/scripts/select-models.cjs +268 -0
  135. package/agents/gsd-set-model.md +0 -287
  136. package/agents/gsd-set-profile.md +0 -239
  137. package/agents/gsd-settings.md +0 -749
  138. package/bin/install.js +0 -323
  139. package/commands/gsd/add-phase.md +0 -207
  140. package/commands/gsd/execute-phase.md +0 -339
  141. package/commands/gsd/insert-phase.md +0 -227
  142. package/commands/gsd/new-milestone.md +0 -721
  143. package/commands/gsd/plan-phase.md +0 -525
  144. package/commands/gsd/quick.md +0 -309
  145. package/commands/gsd/remove-phase.md +0 -349
  146. package/commands/gsd/set-model.md +0 -77
  147. package/commands/gsd/set-profile.md +0 -46
  148. package/commands/gsd/settings.md +0 -33
  149. package/commands/gsd/verify-work.md +0 -219
  150. package/commands/gsd/whats-new.md +0 -124
  151. /package/{src → bin/dm/src}/commands/check.js +0 -0
  152. /package/{src → bin/dm/src}/commands/config.js +0 -0
  153. /package/{src → bin/dm/src}/commands/list.js +0 -0
  154. /package/{src → bin/dm/src}/commands/repair.js +0 -0
  155. /package/{src → bin/dm/src}/commands/update.js +0 -0
  156. /package/{src → bin/dm/src}/services/manifest-manager.js +0 -0
  157. /package/{src → bin/dm/src}/services/migration-service.js +0 -0
  158. /package/{src → bin/dm/src}/services/scope-manager.js +0 -0
  159. /package/{src → bin/dm/src}/services/structure-detector.js +0 -0
  160. /package/{src → bin/dm/src}/utils/hash.js +0 -0
  161. /package/{src → bin/dm/src}/utils/interactive.js +0 -0
  162. /package/{src → bin/dm/src}/utils/logger.js +0 -0
  163. /package/{src → bin/dm/src}/utils/npm-registry.js +0 -0
  164. /package/{src → bin/dm/src}/utils/path-resolver.js +0 -0
@@ -0,0 +1,156 @@
1
+ <purpose>
2
+ Validate `.planning/` directory integrity and report actionable issues. Checks for missing files, invalid configurations, inconsistent state, and orphaned plans. Optionally repairs auto-fixable issues.
3
+ </purpose>
4
+
5
+ <required_reading>
6
+ read all files referenced by the invoking prompt's execution_context before starting.
7
+ </required_reading>
8
+
9
+ <process>
10
+
11
+ <step name="parse_args">
12
+ **Parse arguments:**
13
+
14
+ Check if `--repair` flag is present in the command arguments.
15
+
16
+ ```
17
+ REPAIR_FLAG=""
18
+ if arguments contain "--repair"; then
19
+ REPAIR_FLAG="--repair"
20
+ fi
21
+ ```
22
+ </step>
23
+
24
+ <step name="run_health_check">
25
+ **Run health validation:**
26
+
27
+ ```bash
28
+ node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs validate health $REPAIR_FLAG
29
+ ```
30
+
31
+ Parse JSON output:
32
+ - `status`: "healthy" | "degraded" | "broken"
33
+ - `errors[]`: Critical issues (code, message, fix, repairable)
34
+ - `warnings[]`: Non-critical issues
35
+ - `info[]`: Informational notes
36
+ - `repairable_count`: Number of auto-fixable issues
37
+ - `repairs_performed[]`: Actions taken if --repair was used
38
+ </step>
39
+
40
+ <step name="format_output">
41
+ **Format and display results:**
42
+
43
+ ```
44
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
45
+ GSD Health Check
46
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
47
+
48
+ Status: HEALTHY | DEGRADED | BROKEN
49
+ Errors: N | Warnings: N | Info: N
50
+ ```
51
+
52
+ **If repairs were performed:**
53
+ ```
54
+ ## Repairs Performed
55
+
56
+ - ✓ config.json: Created with defaults
57
+ - ✓ STATE.md: Regenerated from roadmap
58
+ ```
59
+
60
+ **If errors exist:**
61
+ ```
62
+ ## Errors
63
+
64
+ - [E001] config.json: JSON parse error at line 5
65
+ Fix: Run /gsd-health --repair to reset to defaults
66
+
67
+ - [E002] PROJECT.md not found
68
+ Fix: Run /gsd-new-project to create
69
+ ```
70
+
71
+ **If warnings exist:**
72
+ ```
73
+ ## Warnings
74
+
75
+ - [W001] STATE.md references phase 5, but only phases 1-3 exist
76
+ Fix: Run /gsd-health --repair to regenerate
77
+
78
+ - [W005] Phase directory "1-setup" doesn't follow NN-name format
79
+ Fix: Rename to match pattern (e.g., 01-setup)
80
+ ```
81
+
82
+ **If info exists:**
83
+ ```
84
+ ## Info
85
+
86
+ - [I001] 02-implementation/02-01-PLAN.md has no SUMMARY.md
87
+ Note: May be in progress
88
+ ```
89
+
90
+ **Footer (if repairable issues exist and --repair was NOT used):**
91
+ ```
92
+ ---
93
+ N issues can be auto-repaired. Run: /gsd-health --repair
94
+ ```
95
+ </step>
96
+
97
+ <step name="offer_repair">
98
+ **If repairable issues exist and --repair was NOT used:**
99
+
100
+ Ask user if they want to run repairs:
101
+
102
+ ```
103
+ Would you like to run /gsd-health --repair to fix N issues automatically?
104
+ ```
105
+
106
+ If yes, re-run with --repair flag and display results.
107
+ </step>
108
+
109
+ <step name="verify_repairs">
110
+ **If repairs were performed:**
111
+
112
+ Re-run health check without --repair to confirm issues are resolved:
113
+
114
+ ```bash
115
+ node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs validate health
116
+ ```
117
+
118
+ Report final status.
119
+ </step>
120
+
121
+ </process>
122
+
123
+ <error_codes>
124
+
125
+ | Code | Severity | Description | Repairable |
126
+ |------|----------|-------------|------------|
127
+ | E001 | error | .planning/ directory not found | No |
128
+ | E002 | error | PROJECT.md not found | No |
129
+ | E003 | error | ROADMAP.md not found | No |
130
+ | E004 | error | STATE.md not found | Yes |
131
+ | E005 | error | config.json parse error | Yes |
132
+ | W001 | warning | PROJECT.md missing required section | No |
133
+ | W002 | warning | STATE.md references invalid phase | Yes |
134
+ | W003 | warning | config.json not found | Yes |
135
+ | W004 | warning | config.json invalid field value | No |
136
+ | W005 | warning | Phase directory naming mismatch | No |
137
+ | W006 | warning | Phase in ROADMAP but no directory | No |
138
+ | W007 | warning | Phase on disk but not in ROADMAP | No |
139
+ | I001 | info | Plan without SUMMARY (may be in progress) | No |
140
+
141
+ </error_codes>
142
+
143
+ <repair_actions>
144
+
145
+ | Action | Effect | Risk |
146
+ |--------|--------|------|
147
+ | createConfig | Create config.json with defaults | None |
148
+ | resetConfig | Delete + recreate config.json | Loses custom settings |
149
+ | regenerateState | Create STATE.md from ROADMAP structure | Loses session history |
150
+
151
+ **Not repairable (too risky):**
152
+ - PROJECT.md, ROADMAP.md content
153
+ - Phase directory renaming
154
+ - Orphaned plan cleanup
155
+
156
+ </repair_actions>
@@ -1,18 +1,6 @@
1
- ---
2
- name: gsd-help
3
- description: Show available GSD commands and usage guide
4
- ---
5
-
6
- <objective>
7
- Display the complete GSD command reference.
8
-
9
- Output ONLY the reference content below. Do NOT add:
10
-
11
- - Project-specific analysis
12
- - Git status or file context
13
- - Next-step suggestions
14
- - Any commentary beyond the reference
15
- </objective>
1
+ <purpose>
2
+ Display the complete GSD command reference. Output ONLY the reference content. Do NOT add project-specific analysis, git status, next-step suggestions, or any commentary beyond the reference.
3
+ </purpose>
16
4
 
17
5
  <reference>
18
6
  # GSD Command Reference
@@ -27,13 +15,7 @@ Output ONLY the reference content below. Do NOT add:
27
15
 
28
16
  ## Staying Updated
29
17
 
30
- GSD evolves fast. Check for updates periodically:
31
-
32
- ```
33
- /gsd-whats-new
34
- ```
35
-
36
- Shows what changed since your installed version. Update with:
18
+ GSD evolves fast. Update periodically:
37
19
 
38
20
  ```bash
39
21
  npx gsd-opencode@latest
@@ -123,7 +105,7 @@ Result: Creates `.planning/phases/01-foundation/01-01-PLAN.md`
123
105
  Execute all plans in a phase.
124
106
 
125
107
  - Groups plans by wave (from frontmatter), executes waves sequentially
126
- - Plans within each wave run in parallel via Task tool
108
+ - Plans within each wave run in parallel via task tool
127
109
  - Verifies phase goal after all plans complete
128
110
  - Updates REQUIREMENTS.md, ROADMAP.md, STATE.md
129
111
 
@@ -314,7 +296,7 @@ Usage: `/gsd-plan-milestone-gaps`
314
296
  Configure workflow toggles and model profile interactively.
315
297
 
316
298
  - Toggle researcher, plan checker, verifier agents
317
- - Select model profile (quality/balanced/budget)
299
+ - Select model profile (simple/smart/custom)
318
300
  - Updates `.planning/config.json`
319
301
 
320
302
  Usage: `/gsd-settings`
@@ -330,28 +312,38 @@ Usage: `/gsd-set-profile budget`
330
312
 
331
313
  ### Utility Commands
332
314
 
333
- **`/gsd-help`**
334
- Show this command reference.
315
+ **`/gsd-cleanup`**
316
+ Archive accumulated phase directories from completed milestones.
335
317
 
336
- **`/gsd-whats-new`**
337
- See what's changed since your installed version.
318
+ - Identifies phases from completed milestones still in `.planning/phases/`
319
+ - Shows dry-run summary before moving anything
320
+ - Moves phase dirs to `.planning/milestones/v{X.Y}-phases/`
321
+ - Use after multiple milestones to reduce `.planning/phases/` clutter
338
322
 
339
- - Shows installed vs latest version comparison
340
- - Displays changelog entries for versions you've missed
341
- - Highlights breaking changes
342
- - Provides update instructions when behind
323
+ Usage: `/gsd-cleanup`
343
324
 
344
- Usage: `/gsd-whats-new`
325
+ **`/gsd-help`**
326
+ Show this command reference.
345
327
 
346
328
  **`/gsd-update`**
347
329
  Update GSD to latest version with changelog preview.
348
330
 
349
- - Shows what changed before updating
331
+ - Shows installed vs latest version comparison
332
+ - Displays changelog entries for versions you've missed
333
+ - Highlights breaking changes
350
334
  - Confirms before running install
351
335
  - Better than raw `npx gsd-opencode`
352
336
 
353
337
  Usage: `/gsd-update`
354
338
 
339
+ **`/gsd-join-discord`**
340
+ Join the GSD Discord community.
341
+
342
+ - Get help, share what you're building, stay updated
343
+ - Connect with other GSD users
344
+
345
+ Usage: `/gsd-join-discord`
346
+
355
347
  ## Files & Structure
356
348
 
357
349
  ```
@@ -365,6 +357,12 @@ Usage: `/gsd-update`
365
357
  │ └── done/ # Completed todos
366
358
  ├── debug/ # Active debug sessions
367
359
  │ └── resolved/ # Archived resolved issues
360
+ ├── milestones/
361
+ │ ├── v1.0-ROADMAP.md # Archived roadmap snapshot
362
+ │ ├── v1.0-REQUIREMENTS.md # Archived requirements
363
+ │ └── v1.0-phases/ # Archived phase dirs (via /gsd-cleanup or --archive-phases)
364
+ │ ├── 01-foundation/
365
+ │ └── 02-core-features/
368
366
  ├── codebase/ # Codebase map (brownfield projects)
369
367
  │ ├── STACK.md # Languages, frameworks, dependencies
370
368
  │ ├── ARCHITECTURE.md # Patterns, layers, data flow
@@ -485,4 +483,4 @@ Example config:
485
483
  - read `.planning/STATE.md` for current context
486
484
  - Check `.planning/ROADMAP.md` for phase status
487
485
  - Run `/gsd-progress` to check where you're up to
488
- </reference>
486
+ </reference>
@@ -0,0 +1,129 @@
1
+ <purpose>
2
+ Insert a decimal phase for urgent work discovered mid-milestone between existing integer phases. Uses decimal numbering (72.1, 72.2, etc.) to preserve the logical sequence of planned phases while accommodating urgent insertions without renumbering the entire roadmap.
3
+ </purpose>
4
+
5
+ <required_reading>
6
+ read all files referenced by the invoking prompt's execution_context before starting.
7
+ </required_reading>
8
+
9
+ <process>
10
+
11
+ <step name="parse_arguments">
12
+ Parse the command arguments:
13
+ - First argument: integer phase number to insert after
14
+ - Remaining arguments: phase description
15
+
16
+ Example: `/gsd-insert-phase 72 Fix critical auth bug`
17
+ -> after = 72
18
+ -> description = "Fix critical auth bug"
19
+
20
+ If arguments missing:
21
+
22
+ ```
23
+ ERROR: Both phase number and description required
24
+ Usage: /gsd-insert-phase <after> <description>
25
+ Example: /gsd-insert-phase 72 Fix critical auth bug
26
+ ```
27
+
28
+ Exit.
29
+
30
+ Validate first argument is an integer.
31
+ </step>
32
+
33
+ <step name="init_context">
34
+ Load phase operation context:
35
+
36
+ ```bash
37
+ INIT=$(node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs init phase-op "${after_phase}")
38
+ ```
39
+
40
+ Check `roadmap_exists` from init JSON. If false:
41
+ ```
42
+ ERROR: No roadmap found (.planning/ROADMAP.md)
43
+ ```
44
+ Exit.
45
+ </step>
46
+
47
+ <step name="insert_phase">
48
+ **Delegate the phase insertion to gsd-tools:**
49
+
50
+ ```bash
51
+ RESULT=$(node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs phase insert "${after_phase}" "${description}")
52
+ ```
53
+
54
+ The CLI handles:
55
+ - Verifying target phase exists in ROADMAP.md
56
+ - Calculating next decimal phase number (checking existing decimals on disk)
57
+ - Generating slug from description
58
+ - Creating the phase directory (`.planning/phases/{N.M}-{slug}/`)
59
+ - Inserting the phase entry into ROADMAP.md after the target phase with (INSERTED) marker
60
+
61
+ Extract from result: `phase_number`, `after_phase`, `name`, `slug`, `directory`.
62
+ </step>
63
+
64
+ <step name="update_project_state">
65
+ Update STATE.md to reflect the inserted phase:
66
+
67
+ 1. read `.planning/STATE.md`
68
+ 2. Under "## Accumulated Context" → "### Roadmap Evolution" add entry:
69
+ ```
70
+ - Phase {decimal_phase} inserted after Phase {after_phase}: {description} (URGENT)
71
+ ```
72
+
73
+ If "Roadmap Evolution" section doesn't exist, create it.
74
+ </step>
75
+
76
+ <step name="completion">
77
+ Present completion summary:
78
+
79
+ ```
80
+ Phase {decimal_phase} inserted after Phase {after_phase}:
81
+ - Description: {description}
82
+ - Directory: .planning/phases/{decimal-phase}-{slug}/
83
+ - Status: Not planned yet
84
+ - Marker: (INSERTED) - indicates urgent work
85
+
86
+ Roadmap updated: .planning/ROADMAP.md
87
+ Project state updated: .planning/STATE.md
88
+
89
+ ---
90
+
91
+ ## Next Up
92
+
93
+ **Phase {decimal_phase}: {description}** -- urgent insertion
94
+
95
+ `/gsd-plan-phase {decimal_phase}`
96
+
97
+ *`/new` first -> fresh context window*
98
+
99
+ ---
100
+
101
+ **Also available:**
102
+ - Review insertion impact: Check if Phase {next_integer} dependencies still make sense
103
+ - Review roadmap
104
+
105
+ ---
106
+ ```
107
+ </step>
108
+
109
+ </process>
110
+
111
+ <anti_patterns>
112
+
113
+ - Don't use this for planned work at end of milestone (use /gsd-add-phase)
114
+ - Don't insert before Phase 1 (decimal 0.1 makes no sense)
115
+ - Don't renumber existing phases
116
+ - Don't modify the target phase content
117
+ - Don't create plans yet (that's /gsd-plan-phase)
118
+ - Don't commit changes (user decides when to commit)
119
+ </anti_patterns>
120
+
121
+ <success_criteria>
122
+ Phase insertion is complete when:
123
+
124
+ - [ ] `gsd-tools phase insert` executed successfully
125
+ - [ ] Phase directory created
126
+ - [ ] Roadmap updated with new phase entry (includes "(INSERTED)" marker)
127
+ - [ ] STATE.md updated with roadmap evolution note
128
+ - [ ] User informed of next steps and dependency implications
129
+ </success_criteria>
@@ -7,7 +7,7 @@ Key difference from discuss-phase: This is ANALYSIS of what OpenCode thinks, not
7
7
  <process>
8
8
 
9
9
  <step name="validate_phase" priority="first">
10
- Phase number: `$ARGUMENTS` (required)
10
+ Phase number: $ARGUMENTS (required)
11
11
 
12
12
  **If argument missing:**
13
13
 
@@ -132,7 +132,7 @@ Wait for user response.
132
132
  Acknowledge the corrections:
133
133
 
134
134
  ```
135
- Got it. Key corrections:
135
+ Key corrections:
136
136
  - [correction 1]
137
137
  - [correction 2]
138
138
 
@@ -142,7 +142,7 @@ This changes my understanding significantly. [Summarize new understanding]
142
142
  **If user confirms assumptions:**
143
143
 
144
144
  ```
145
- Great, assumptions validated.
145
+ Assumptions validated.
146
146
  ```
147
147
 
148
148
  Continue to offer_next.
@@ -22,29 +22,22 @@ Documents are reference material for OpenCode when planning/executing. Always in
22
22
 
23
23
  <process>
24
24
 
25
- <step name="resolve_model_profile" priority="first">
26
- read model profile for agent spawning:
25
+ <step name="init_context" priority="first">
26
+ Load codebase mapping context:
27
27
 
28
28
  ```bash
29
- MODEL_PROFILE=$(cat .planning/config.json 2>/dev/null | grep -o '"model_profile"[[:space:]]*:[[:space:]]*"[^"]*"' | grep -o '"[^"]*"$' | tr -d '"' || echo "balanced")
29
+ INIT=$(node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs init map-codebase)
30
30
  ```
31
31
 
32
- Default to "balanced" if not set.
33
-
34
- **Model lookup table:**
35
-
36
- | Agent | quality | balanced | budget |
37
- |-------|---------|----------|--------|
38
- | gsd-codebase-mapper | sonnet | haiku | haiku |
39
-
40
- Store resolved model for use in Task calls below.
32
+ Extract from init JSON: `mapper_model`, `commit_docs`, `codebase_dir`, `existing_maps`, `has_maps`, `codebase_dir_exists`.
41
33
  </step>
42
34
 
43
35
  <step name="check_existing">
44
- Check if .planning/codebase/ already exists:
36
+ Check if .planning/codebase/ already exists using `has_maps` from init context.
45
37
 
38
+ If `codebase_dir_exists` is true:
46
39
  ```bash
47
- ls -la .planning/codebase/ 2>/dev/null
40
+ ls -la .planning/codebase/
48
41
  ```
49
42
 
50
43
  **If exists:**
@@ -91,23 +84,19 @@ Continue to spawn_agents.
91
84
  <step name="spawn_agents">
92
85
  Spawn 4 parallel gsd-codebase-mapper agents.
93
86
 
94
- Use Task tool with `subagent_type="gsd-codebase-mapper"`, `model="{mapper_model}"`, and `run_in_background=true` for parallel execution.
87
+ Use task tool with `subagent_type="gsd-codebase-mapper"`, `model="{mapper_model}"`, and `run_in_background=true` for parallel execution.
95
88
 
96
89
  **CRITICAL:** Use the dedicated `gsd-codebase-mapper` agent, NOT `Explore`. The mapper agent writes documents directly.
97
90
 
98
91
  **Agent 1: Tech Focus**
99
92
 
100
- Task tool parameters:
101
- ```
102
- subagent_type: "gsd-codebase-mapper"
103
- model: "{mapper_model}"
104
- run_in_background: true
105
- description: "Map codebase tech stack"
106
93
  ```
107
-
108
- Prompt:
109
- ```
110
- Focus: tech
94
+ task(
95
+ subagent_type="gsd-codebase-mapper",
96
+ model="{mapper_model}",
97
+ run_in_background=true,
98
+ description="Map codebase tech stack",
99
+ prompt="Focus: tech
111
100
 
112
101
  Analyze this codebase for technology stack and external integrations.
113
102
 
@@ -115,22 +104,19 @@ write these documents to .planning/codebase/:
115
104
  - STACK.md - Languages, runtime, frameworks, dependencies, configuration
116
105
  - INTEGRATIONS.md - External APIs, databases, auth providers, webhooks
117
106
 
118
- Explore thoroughly. write documents directly using templates. Return confirmation only.
107
+ Explore thoroughly. write documents directly using templates. Return confirmation only."
108
+ )
119
109
  ```
120
110
 
121
111
  **Agent 2: Architecture Focus**
122
112
 
123
- Task tool parameters:
124
- ```
125
- subagent_type: "gsd-codebase-mapper"
126
- model: "{mapper_model}"
127
- run_in_background: true
128
- description: "Map codebase architecture"
129
113
  ```
130
-
131
- Prompt:
132
- ```
133
- Focus: arch
114
+ task(
115
+ subagent_type="gsd-codebase-mapper",
116
+ model="{mapper_model}",
117
+ run_in_background=true,
118
+ description="Map codebase architecture",
119
+ prompt="Focus: arch
134
120
 
135
121
  Analyze this codebase architecture and directory structure.
136
122
 
@@ -138,22 +124,19 @@ write these documents to .planning/codebase/:
138
124
  - ARCHITECTURE.md - Pattern, layers, data flow, abstractions, entry points
139
125
  - STRUCTURE.md - Directory layout, key locations, naming conventions
140
126
 
141
- Explore thoroughly. write documents directly using templates. Return confirmation only.
127
+ Explore thoroughly. write documents directly using templates. Return confirmation only."
128
+ )
142
129
  ```
143
130
 
144
131
  **Agent 3: Quality Focus**
145
132
 
146
- Task tool parameters:
147
- ```
148
- subagent_type: "gsd-codebase-mapper"
149
- model: "{mapper_model}"
150
- run_in_background: true
151
- description: "Map codebase conventions"
152
- ```
153
-
154
- Prompt:
155
133
  ```
156
- Focus: quality
134
+ task(
135
+ subagent_type="gsd-codebase-mapper",
136
+ model="{mapper_model}",
137
+ run_in_background=true,
138
+ description="Map codebase conventions",
139
+ prompt="Focus: quality
157
140
 
158
141
  Analyze this codebase for coding conventions and testing patterns.
159
142
 
@@ -161,29 +144,27 @@ write these documents to .planning/codebase/:
161
144
  - CONVENTIONS.md - Code style, naming, patterns, error handling
162
145
  - TESTING.md - Framework, structure, mocking, coverage
163
146
 
164
- Explore thoroughly. write documents directly using templates. Return confirmation only.
147
+ Explore thoroughly. write documents directly using templates. Return confirmation only."
148
+ )
165
149
  ```
166
150
 
167
151
  **Agent 4: Concerns Focus**
168
152
 
169
- Task tool parameters:
170
153
  ```
171
- subagent_type: "gsd-codebase-mapper"
172
- model: "{mapper_model}"
173
- run_in_background: true
174
- description: "Map codebase concerns"
175
- ```
176
-
177
- Prompt:
178
- ```
179
- Focus: concerns
154
+ task(
155
+ subagent_type="gsd-codebase-mapper",
156
+ model="{mapper_model}",
157
+ run_in_background=true,
158
+ description="Map codebase concerns",
159
+ prompt="Focus: concerns
180
160
 
181
161
  Analyze this codebase for technical debt, known issues, and areas of concern.
182
162
 
183
163
  write this document to .planning/codebase/:
184
164
  - CONCERNS.md - Tech debt, bugs, security, performance, fragile areas
185
165
 
186
- Explore thoroughly. write document directly using template. Return confirmation only.
166
+ Explore thoroughly. write document directly using template. Return confirmation only."
167
+ )
187
168
  ```
188
169
 
189
170
  Continue to collect_confirmations.
@@ -227,37 +208,49 @@ wc -l .planning/codebase/*.md
227
208
 
228
209
  If any documents missing or empty, note which agents may have failed.
229
210
 
230
- Continue to commit_codebase_map.
211
+ Continue to scan_for_secrets.
231
212
  </step>
232
213
 
233
- <step name="commit_codebase_map">
234
- Commit the codebase map:
214
+ <step name="scan_for_secrets">
215
+ **CRITICAL SECURITY CHECK:** Scan output files for accidentally leaked secrets before committing.
235
216
 
236
- **Check planning config:**
217
+ Run secret pattern detection:
237
218
 
238
219
  ```bash
239
- COMMIT_PLANNING_DOCS=$(cat .planning/config.json 2>/dev/null | grep -o '"commit_docs"[[:space:]]*:[[:space:]]*[^,}]*' | grep -o 'true\|false' || echo "true")
240
- git check-ignore -q .planning 2>/dev/null && COMMIT_PLANNING_DOCS=false
220
+ # Check for common API key patterns in generated docs
221
+ grep -E '(sk-[a-zA-Z0-9]{20,}|sk_live_[a-zA-Z0-9]+|sk_test_[a-zA-Z0-9]+|ghp_[a-zA-Z0-9]{36}|gho_[a-zA-Z0-9]{36}|glpat-[a-zA-Z0-9_-]+|AKIA[A-Z0-9]{16}|xox[baprs]-[a-zA-Z0-9-]+|-----BEGIN.*PRIVATE KEY|eyJ[a-zA-Z0-9_-]+\.eyJ[a-zA-Z0-9_-]+\.)' .planning/codebase/*.md 2>/dev/null && SECRETS_FOUND=true || SECRETS_FOUND=false
222
+ ```
223
+
224
+ **If SECRETS_FOUND=true:**
225
+
226
+ ```
227
+ ⚠️ SECURITY ALERT: Potential secrets detected in codebase documents!
228
+
229
+ Found patterns that look like API keys or tokens in:
230
+ [show grep output]
231
+
232
+ This would expose credentials if committed.
233
+
234
+ **Action required:**
235
+ 1. Review the flagged content above
236
+ 2. If these are real secrets, they must be removed before committing
237
+ 3. Consider adding sensitive files to OpenCode "Deny" permissions
238
+
239
+ Pausing before commit. Reply "safe to proceed" if the flagged content is not actually sensitive, or edit the files first.
241
240
  ```
242
241
 
243
- **If `COMMIT_PLANNING_DOCS=false`:** Skip git operations
242
+ Wait for user confirmation before continuing to commit_codebase_map.
243
+
244
+ **If SECRETS_FOUND=false:**
245
+
246
+ Continue to commit_codebase_map.
247
+ </step>
244
248
 
245
- **If `COMMIT_PLANNING_DOCS=true` (default):**
249
+ <step name="commit_codebase_map">
250
+ Commit the codebase map:
246
251
 
247
252
  ```bash
248
- git add .planning/codebase/*.md
249
- git commit -m "$(cat <<'EOF'
250
- docs: map existing codebase
251
-
252
- - STACK.md - Technologies and dependencies
253
- - ARCHITECTURE.md - System design and patterns
254
- - STRUCTURE.md - Directory layout
255
- - CONVENTIONS.md - Code style and patterns
256
- - TESTING.md - Test structure
257
- - INTEGRATIONS.md - External services
258
- - CONCERNS.md - Technical debt and issues
259
- EOF
260
- )"
253
+ node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs commit "docs: map existing codebase" --files .planning/codebase/*.md
261
254
  ```
262
255
 
263
256
  Continue to offer_next.