gsd-code-first 1.0.0

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 (238) hide show
  1. package/LICENSE +21 -0
  2. package/README.ja-JP.md +834 -0
  3. package/README.ko-KR.md +823 -0
  4. package/README.md +937 -0
  5. package/README.pt-BR.md +452 -0
  6. package/README.zh-CN.md +800 -0
  7. package/agents/gsd-advisor-researcher.md +104 -0
  8. package/agents/gsd-annotator.md +148 -0
  9. package/agents/gsd-arc-executor.md +537 -0
  10. package/agents/gsd-arc-planner.md +374 -0
  11. package/agents/gsd-assumptions-analyzer.md +105 -0
  12. package/agents/gsd-code-planner.md +155 -0
  13. package/agents/gsd-codebase-mapper.md +770 -0
  14. package/agents/gsd-debugger.md +1373 -0
  15. package/agents/gsd-executor.md +509 -0
  16. package/agents/gsd-integration-checker.md +443 -0
  17. package/agents/gsd-nyquist-auditor.md +176 -0
  18. package/agents/gsd-phase-researcher.md +698 -0
  19. package/agents/gsd-plan-checker.md +773 -0
  20. package/agents/gsd-planner.md +1354 -0
  21. package/agents/gsd-project-researcher.md +654 -0
  22. package/agents/gsd-prototyper.md +161 -0
  23. package/agents/gsd-research-synthesizer.md +247 -0
  24. package/agents/gsd-roadmapper.md +679 -0
  25. package/agents/gsd-ui-auditor.md +439 -0
  26. package/agents/gsd-ui-checker.md +300 -0
  27. package/agents/gsd-ui-researcher.md +357 -0
  28. package/agents/gsd-user-profiler.md +171 -0
  29. package/agents/gsd-verifier.md +700 -0
  30. package/bin/install.js +5009 -0
  31. package/commands/gsd/add-backlog.md +76 -0
  32. package/commands/gsd/add-phase.md +43 -0
  33. package/commands/gsd/add-tests.md +41 -0
  34. package/commands/gsd/add-todo.md +47 -0
  35. package/commands/gsd/annotate.md +54 -0
  36. package/commands/gsd/audit-milestone.md +36 -0
  37. package/commands/gsd/audit-uat.md +24 -0
  38. package/commands/gsd/autonomous.md +41 -0
  39. package/commands/gsd/check-todos.md +45 -0
  40. package/commands/gsd/cleanup.md +18 -0
  41. package/commands/gsd/complete-milestone.md +136 -0
  42. package/commands/gsd/debug.md +173 -0
  43. package/commands/gsd/deep-plan.md +52 -0
  44. package/commands/gsd/discuss-phase.md +64 -0
  45. package/commands/gsd/do.md +30 -0
  46. package/commands/gsd/execute-phase.md +59 -0
  47. package/commands/gsd/extract-plan.md +35 -0
  48. package/commands/gsd/fast.md +30 -0
  49. package/commands/gsd/forensics.md +56 -0
  50. package/commands/gsd/health.md +22 -0
  51. package/commands/gsd/help.md +22 -0
  52. package/commands/gsd/insert-phase.md +32 -0
  53. package/commands/gsd/iterate.md +124 -0
  54. package/commands/gsd/join-discord.md +18 -0
  55. package/commands/gsd/list-phase-assumptions.md +46 -0
  56. package/commands/gsd/list-workspaces.md +19 -0
  57. package/commands/gsd/manager.md +39 -0
  58. package/commands/gsd/map-codebase.md +71 -0
  59. package/commands/gsd/milestone-summary.md +51 -0
  60. package/commands/gsd/new-milestone.md +44 -0
  61. package/commands/gsd/new-project.md +42 -0
  62. package/commands/gsd/new-workspace.md +44 -0
  63. package/commands/gsd/next.md +24 -0
  64. package/commands/gsd/note.md +34 -0
  65. package/commands/gsd/pause-work.md +38 -0
  66. package/commands/gsd/plan-milestone-gaps.md +34 -0
  67. package/commands/gsd/plan-phase.md +47 -0
  68. package/commands/gsd/plant-seed.md +28 -0
  69. package/commands/gsd/pr-branch.md +25 -0
  70. package/commands/gsd/profile-user.md +46 -0
  71. package/commands/gsd/progress.md +24 -0
  72. package/commands/gsd/prototype.md +56 -0
  73. package/commands/gsd/quick.md +47 -0
  74. package/commands/gsd/reapply-patches.md +123 -0
  75. package/commands/gsd/remove-phase.md +31 -0
  76. package/commands/gsd/remove-workspace.md +26 -0
  77. package/commands/gsd/research-phase.md +195 -0
  78. package/commands/gsd/resume-work.md +40 -0
  79. package/commands/gsd/review-backlog.md +61 -0
  80. package/commands/gsd/review.md +37 -0
  81. package/commands/gsd/session-report.md +19 -0
  82. package/commands/gsd/set-mode.md +41 -0
  83. package/commands/gsd/set-profile.md +12 -0
  84. package/commands/gsd/settings.md +36 -0
  85. package/commands/gsd/ship.md +23 -0
  86. package/commands/gsd/stats.md +18 -0
  87. package/commands/gsd/thread.md +127 -0
  88. package/commands/gsd/ui-phase.md +34 -0
  89. package/commands/gsd/ui-review.md +32 -0
  90. package/commands/gsd/update.md +37 -0
  91. package/commands/gsd/validate-phase.md +35 -0
  92. package/commands/gsd/verify-work.md +38 -0
  93. package/commands/gsd/workstreams.md +63 -0
  94. package/get-shit-done/bin/gsd-tools.cjs +946 -0
  95. package/get-shit-done/bin/lib/arc-scanner.cjs +341 -0
  96. package/get-shit-done/bin/lib/commands.cjs +959 -0
  97. package/get-shit-done/bin/lib/config.cjs +466 -0
  98. package/get-shit-done/bin/lib/core.cjs +1230 -0
  99. package/get-shit-done/bin/lib/frontmatter.cjs +336 -0
  100. package/get-shit-done/bin/lib/init.cjs +1442 -0
  101. package/get-shit-done/bin/lib/milestone.cjs +252 -0
  102. package/get-shit-done/bin/lib/model-profiles.cjs +68 -0
  103. package/get-shit-done/bin/lib/phase.cjs +888 -0
  104. package/get-shit-done/bin/lib/profile-output.cjs +952 -0
  105. package/get-shit-done/bin/lib/profile-pipeline.cjs +539 -0
  106. package/get-shit-done/bin/lib/roadmap.cjs +329 -0
  107. package/get-shit-done/bin/lib/security.cjs +382 -0
  108. package/get-shit-done/bin/lib/state.cjs +1031 -0
  109. package/get-shit-done/bin/lib/template.cjs +222 -0
  110. package/get-shit-done/bin/lib/uat.cjs +282 -0
  111. package/get-shit-done/bin/lib/verify.cjs +888 -0
  112. package/get-shit-done/bin/lib/workstream.cjs +491 -0
  113. package/get-shit-done/commands/gsd/workstreams.md +63 -0
  114. package/get-shit-done/references/arc-standard.md +315 -0
  115. package/get-shit-done/references/checkpoints.md +778 -0
  116. package/get-shit-done/references/continuation-format.md +249 -0
  117. package/get-shit-done/references/decimal-phase-calculation.md +64 -0
  118. package/get-shit-done/references/git-integration.md +295 -0
  119. package/get-shit-done/references/git-planning-commit.md +38 -0
  120. package/get-shit-done/references/model-profile-resolution.md +36 -0
  121. package/get-shit-done/references/model-profiles.md +139 -0
  122. package/get-shit-done/references/phase-argument-parsing.md +61 -0
  123. package/get-shit-done/references/planning-config.md +202 -0
  124. package/get-shit-done/references/questioning.md +162 -0
  125. package/get-shit-done/references/tdd.md +263 -0
  126. package/get-shit-done/references/ui-brand.md +160 -0
  127. package/get-shit-done/references/user-profiling.md +681 -0
  128. package/get-shit-done/references/verification-patterns.md +612 -0
  129. package/get-shit-done/references/workstream-flag.md +58 -0
  130. package/get-shit-done/templates/DEBUG.md +164 -0
  131. package/get-shit-done/templates/UAT.md +265 -0
  132. package/get-shit-done/templates/UI-SPEC.md +100 -0
  133. package/get-shit-done/templates/VALIDATION.md +76 -0
  134. package/get-shit-done/templates/claude-md.md +122 -0
  135. package/get-shit-done/templates/codebase/architecture.md +255 -0
  136. package/get-shit-done/templates/codebase/concerns.md +310 -0
  137. package/get-shit-done/templates/codebase/conventions.md +307 -0
  138. package/get-shit-done/templates/codebase/integrations.md +280 -0
  139. package/get-shit-done/templates/codebase/stack.md +186 -0
  140. package/get-shit-done/templates/codebase/structure.md +285 -0
  141. package/get-shit-done/templates/codebase/testing.md +480 -0
  142. package/get-shit-done/templates/config.json +44 -0
  143. package/get-shit-done/templates/context.md +352 -0
  144. package/get-shit-done/templates/continue-here.md +78 -0
  145. package/get-shit-done/templates/copilot-instructions.md +7 -0
  146. package/get-shit-done/templates/debug-subagent-prompt.md +91 -0
  147. package/get-shit-done/templates/dev-preferences.md +21 -0
  148. package/get-shit-done/templates/discovery.md +146 -0
  149. package/get-shit-done/templates/discussion-log.md +63 -0
  150. package/get-shit-done/templates/milestone-archive.md +123 -0
  151. package/get-shit-done/templates/milestone.md +115 -0
  152. package/get-shit-done/templates/phase-prompt.md +610 -0
  153. package/get-shit-done/templates/planner-subagent-prompt.md +117 -0
  154. package/get-shit-done/templates/project.md +186 -0
  155. package/get-shit-done/templates/requirements.md +231 -0
  156. package/get-shit-done/templates/research-project/ARCHITECTURE.md +204 -0
  157. package/get-shit-done/templates/research-project/FEATURES.md +147 -0
  158. package/get-shit-done/templates/research-project/PITFALLS.md +200 -0
  159. package/get-shit-done/templates/research-project/STACK.md +120 -0
  160. package/get-shit-done/templates/research-project/SUMMARY.md +170 -0
  161. package/get-shit-done/templates/research.md +552 -0
  162. package/get-shit-done/templates/retrospective.md +54 -0
  163. package/get-shit-done/templates/roadmap.md +202 -0
  164. package/get-shit-done/templates/state.md +176 -0
  165. package/get-shit-done/templates/summary-complex.md +59 -0
  166. package/get-shit-done/templates/summary-minimal.md +41 -0
  167. package/get-shit-done/templates/summary-standard.md +48 -0
  168. package/get-shit-done/templates/summary.md +248 -0
  169. package/get-shit-done/templates/user-profile.md +146 -0
  170. package/get-shit-done/templates/user-setup.md +311 -0
  171. package/get-shit-done/templates/verification-report.md +322 -0
  172. package/get-shit-done/workflows/add-phase.md +112 -0
  173. package/get-shit-done/workflows/add-tests.md +351 -0
  174. package/get-shit-done/workflows/add-todo.md +158 -0
  175. package/get-shit-done/workflows/audit-milestone.md +340 -0
  176. package/get-shit-done/workflows/audit-uat.md +109 -0
  177. package/get-shit-done/workflows/autonomous.md +891 -0
  178. package/get-shit-done/workflows/check-todos.md +177 -0
  179. package/get-shit-done/workflows/cleanup.md +152 -0
  180. package/get-shit-done/workflows/complete-milestone.md +767 -0
  181. package/get-shit-done/workflows/diagnose-issues.md +231 -0
  182. package/get-shit-done/workflows/discovery-phase.md +289 -0
  183. package/get-shit-done/workflows/discuss-phase-assumptions.md +653 -0
  184. package/get-shit-done/workflows/discuss-phase.md +1049 -0
  185. package/get-shit-done/workflows/do.md +104 -0
  186. package/get-shit-done/workflows/execute-phase.md +846 -0
  187. package/get-shit-done/workflows/execute-plan.md +514 -0
  188. package/get-shit-done/workflows/fast.md +105 -0
  189. package/get-shit-done/workflows/forensics.md +265 -0
  190. package/get-shit-done/workflows/health.md +181 -0
  191. package/get-shit-done/workflows/help.md +634 -0
  192. package/get-shit-done/workflows/insert-phase.md +130 -0
  193. package/get-shit-done/workflows/list-phase-assumptions.md +178 -0
  194. package/get-shit-done/workflows/list-workspaces.md +56 -0
  195. package/get-shit-done/workflows/manager.md +362 -0
  196. package/get-shit-done/workflows/map-codebase.md +377 -0
  197. package/get-shit-done/workflows/milestone-summary.md +223 -0
  198. package/get-shit-done/workflows/new-milestone.md +486 -0
  199. package/get-shit-done/workflows/new-project.md +1250 -0
  200. package/get-shit-done/workflows/new-workspace.md +237 -0
  201. package/get-shit-done/workflows/next.md +97 -0
  202. package/get-shit-done/workflows/node-repair.md +92 -0
  203. package/get-shit-done/workflows/note.md +156 -0
  204. package/get-shit-done/workflows/pause-work.md +176 -0
  205. package/get-shit-done/workflows/plan-milestone-gaps.md +273 -0
  206. package/get-shit-done/workflows/plan-phase.md +859 -0
  207. package/get-shit-done/workflows/plant-seed.md +169 -0
  208. package/get-shit-done/workflows/pr-branch.md +129 -0
  209. package/get-shit-done/workflows/profile-user.md +450 -0
  210. package/get-shit-done/workflows/progress.md +507 -0
  211. package/get-shit-done/workflows/quick.md +757 -0
  212. package/get-shit-done/workflows/remove-phase.md +155 -0
  213. package/get-shit-done/workflows/remove-workspace.md +90 -0
  214. package/get-shit-done/workflows/research-phase.md +82 -0
  215. package/get-shit-done/workflows/resume-project.md +326 -0
  216. package/get-shit-done/workflows/review.md +228 -0
  217. package/get-shit-done/workflows/session-report.md +146 -0
  218. package/get-shit-done/workflows/settings.md +283 -0
  219. package/get-shit-done/workflows/ship.md +228 -0
  220. package/get-shit-done/workflows/stats.md +60 -0
  221. package/get-shit-done/workflows/transition.md +671 -0
  222. package/get-shit-done/workflows/ui-phase.md +302 -0
  223. package/get-shit-done/workflows/ui-review.md +165 -0
  224. package/get-shit-done/workflows/update.md +323 -0
  225. package/get-shit-done/workflows/validate-phase.md +174 -0
  226. package/get-shit-done/workflows/verify-phase.md +254 -0
  227. package/get-shit-done/workflows/verify-work.md +637 -0
  228. package/hooks/dist/gsd-check-update.js +114 -0
  229. package/hooks/dist/gsd-context-monitor.js +156 -0
  230. package/hooks/dist/gsd-prompt-guard.js +96 -0
  231. package/hooks/dist/gsd-statusline.js +119 -0
  232. package/hooks/dist/gsd-workflow-guard.js +94 -0
  233. package/package.json +52 -0
  234. package/scripts/base64-scan.sh +262 -0
  235. package/scripts/build-hooks.js +82 -0
  236. package/scripts/prompt-injection-scan.sh +198 -0
  237. package/scripts/run-tests.cjs +29 -0
  238. package/scripts/secret-scan.sh +227 -0
@@ -0,0 +1,237 @@
1
+ <purpose>
2
+ Create an isolated workspace directory with git repo copies (worktrees or clones) and an independent `.planning/` directory. Supports multi-repo orchestration and single-repo feature branch isolation.
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
+ ## 1. Setup
12
+
13
+ **MANDATORY FIRST STEP — Execute init command:**
14
+
15
+ ```bash
16
+ INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init new-workspace)
17
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
18
+ ```
19
+
20
+ Parse JSON for: `default_workspace_base`, `child_repos`, `child_repo_count`, `worktree_available`, `is_git_repo`, `cwd_repo_name`, `project_root`.
21
+
22
+ ## 2. Parse Arguments
23
+
24
+ Extract from $ARGUMENTS:
25
+ - `--name` → `WORKSPACE_NAME` (required)
26
+ - `--repos` → `REPO_LIST` (comma-separated paths or names)
27
+ - `--path` → `TARGET_PATH` (defaults to `$default_workspace_base/$WORKSPACE_NAME`)
28
+ - `--strategy` → `STRATEGY` (defaults to `worktree`)
29
+ - `--branch` → `BRANCH_NAME` (defaults to `workspace/$WORKSPACE_NAME`)
30
+ - `--auto` → skip interactive questions
31
+
32
+ **If `--name` is missing and not `--auto`:**
33
+
34
+ Use AskUserQuestion:
35
+ - header: "Workspace Name"
36
+ - question: "What should this workspace be called?"
37
+ - requireAnswer: true
38
+
39
+ ## 3. Select Repos
40
+
41
+ **If `--repos` is provided:** Parse comma-separated values. For each value:
42
+ - If it's an absolute path, use it directly
43
+ - If it's a relative path or name, resolve against `$project_root`
44
+ - Special case: `.` means current repo (use `$project_root`, name it `$cwd_repo_name`)
45
+
46
+ **If `--repos` is NOT provided and not `--auto`:**
47
+
48
+ **If `child_repo_count` > 0:**
49
+
50
+ Present child repos for selection:
51
+
52
+ Use AskUserQuestion:
53
+ - header: "Select Repos"
54
+ - question: "Which repos should be included in the workspace?"
55
+ - options: List each child repo from `child_repos` array by name
56
+ - multiSelect: true
57
+
58
+ **If `child_repo_count` is 0 and `is_git_repo` is true:**
59
+
60
+ Use AskUserQuestion:
61
+ - header: "Current Repo"
62
+ - question: "No child repos found. Create a workspace with the current repo?"
63
+ - options:
64
+ - "Yes — create workspace with current repo" → use current repo
65
+ - "Cancel" → exit
66
+
67
+ **If `child_repo_count` is 0 and `is_git_repo` is false:**
68
+
69
+ Error:
70
+ ```
71
+ No git repos found in the current directory and this is not a git repo.
72
+
73
+ Run this command from a directory containing git repos, or specify repos explicitly:
74
+ /gsd:new-workspace --name my-workspace --repos /path/to/repo1,/path/to/repo2
75
+ ```
76
+ Exit.
77
+
78
+ **If `--auto` and `--repos` is NOT provided:**
79
+
80
+ Error:
81
+ ```
82
+ Error: --auto requires --repos to specify which repos to include.
83
+
84
+ Usage:
85
+ /gsd:new-workspace --name my-workspace --repos repo1,repo2 --auto
86
+ ```
87
+ Exit.
88
+
89
+ ## 4. Select Strategy
90
+
91
+ **If `--strategy` is provided:** Use it (validate: must be `worktree` or `clone`).
92
+
93
+ **If `--strategy` is NOT provided and not `--auto`:**
94
+
95
+ Use AskUserQuestion:
96
+ - header: "Strategy"
97
+ - question: "How should repos be copied into the workspace?"
98
+ - options:
99
+ - "Worktree (recommended) — lightweight, shares .git objects with source repo" → `worktree`
100
+ - "Clone — fully independent copy, no connection to source repo" → `clone`
101
+
102
+ **If `--auto`:** Default to `worktree`.
103
+
104
+ ## 5. Validate
105
+
106
+ Before creating anything, validate:
107
+
108
+ 1. **Target path** — must not exist or must be empty:
109
+ ```bash
110
+ if [ -d "$TARGET_PATH" ] && [ "$(ls -A "$TARGET_PATH" 2>/dev/null)" ]; then
111
+ echo "Error: Target path already exists and is not empty: $TARGET_PATH"
112
+ echo "Choose a different --name or --path."
113
+ exit 1
114
+ fi
115
+ ```
116
+
117
+ 2. **Source repos exist and are git repos** — for each repo path:
118
+ ```bash
119
+ if [ ! -d "$REPO_PATH/.git" ]; then
120
+ echo "Error: Not a git repo: $REPO_PATH"
121
+ exit 1
122
+ fi
123
+ ```
124
+
125
+ 3. **Worktree availability** — if strategy is `worktree` and `worktree_available` is false:
126
+ ```
127
+ Error: git is not available. Install git or use --strategy clone.
128
+ ```
129
+
130
+ Report all validation errors at once, not one at a time.
131
+
132
+ ## 6. Create Workspace
133
+
134
+ ```bash
135
+ mkdir -p "$TARGET_PATH"
136
+ ```
137
+
138
+ ### For each repo:
139
+
140
+ **Worktree strategy:**
141
+ ```bash
142
+ cd "$SOURCE_REPO_PATH"
143
+ git worktree add "$TARGET_PATH/$REPO_NAME" -b "$BRANCH_NAME" 2>&1
144
+ ```
145
+
146
+ If `git worktree add` fails because the branch already exists, try with a timestamped branch:
147
+ ```bash
148
+ TIMESTAMP=$(date +%Y%m%d%H%M%S)
149
+ git worktree add "$TARGET_PATH/$REPO_NAME" -b "${BRANCH_NAME}-${TIMESTAMP}" 2>&1
150
+ ```
151
+
152
+ If that also fails, report the error and continue with remaining repos.
153
+
154
+ **Clone strategy:**
155
+ ```bash
156
+ git clone "$SOURCE_REPO_PATH" "$TARGET_PATH/$REPO_NAME" 2>&1
157
+ cd "$TARGET_PATH/$REPO_NAME"
158
+ git checkout -b "$BRANCH_NAME" 2>&1
159
+ ```
160
+
161
+ Track results: which repos succeeded, which failed, what branch was used.
162
+
163
+ ## 7. Write WORKSPACE.md
164
+
165
+ Write the workspace manifest at `$TARGET_PATH/WORKSPACE.md`:
166
+
167
+ ```markdown
168
+ # Workspace: $WORKSPACE_NAME
169
+
170
+ Created: $DATE
171
+ Strategy: $STRATEGY
172
+
173
+ ## Member Repos
174
+
175
+ | Repo | Source | Branch | Strategy |
176
+ |------|--------|--------|----------|
177
+ | $REPO_NAME | $SOURCE_PATH | $BRANCH | $STRATEGY |
178
+ ...for each repo...
179
+
180
+ ## Notes
181
+
182
+ [Add context about what this workspace is for]
183
+ ```
184
+
185
+ ## 8. Initialize .planning/
186
+
187
+ ```bash
188
+ mkdir -p "$TARGET_PATH/.planning"
189
+ ```
190
+
191
+ ## 9. Report and Next Steps
192
+
193
+ **If all repos succeeded:**
194
+
195
+ ```
196
+ Workspace created: $TARGET_PATH
197
+
198
+ Repos: $REPO_COUNT
199
+ Strategy: $STRATEGY
200
+ Branch: $BRANCH_NAME
201
+
202
+ Next steps:
203
+ cd $TARGET_PATH
204
+ /gsd:new-project # Initialize GSD in the workspace
205
+ ```
206
+
207
+ **If some repos failed:**
208
+
209
+ ```
210
+ Workspace created with $SUCCESS_COUNT of $TOTAL_COUNT repos: $TARGET_PATH
211
+
212
+ Succeeded: repo1, repo2
213
+ Failed: repo3 (branch already exists), repo4 (not a git repo)
214
+
215
+ Next steps:
216
+ cd $TARGET_PATH
217
+ /gsd:new-project # Initialize GSD in the workspace
218
+ ```
219
+
220
+ **Offer to initialize GSD (if not `--auto`):**
221
+
222
+ Use AskUserQuestion:
223
+ - header: "Initialize GSD"
224
+ - question: "Would you like to initialize a GSD project in the new workspace?"
225
+ - options:
226
+ - "Yes — run /gsd:new-project" → tell user to `cd $TARGET_PATH` first, then run `/gsd:new-project`
227
+ - "No — I'll set it up later" → done
228
+
229
+ </process>
230
+
231
+ <success_criteria>
232
+ - [ ] Workspace directory created at target path
233
+ - [ ] All specified repos copied (worktree or clone) into workspace
234
+ - [ ] WORKSPACE.md manifest written with correct repo table
235
+ - [ ] `.planning/` directory initialized at workspace root
236
+ - [ ] User informed of workspace path and next steps
237
+ </success_criteria>
@@ -0,0 +1,97 @@
1
+ <purpose>
2
+ Detect current project state and automatically advance to the next logical GSD workflow step.
3
+ Reads project state to determine: discuss → plan → execute → verify → complete progression.
4
+ </purpose>
5
+
6
+ <required_reading>
7
+ Read all files referenced by the invoking prompt's execution_context before starting.
8
+ </required_reading>
9
+
10
+ <process>
11
+
12
+ <step name="detect_state">
13
+ Read project state to determine current position:
14
+
15
+ ```bash
16
+ # Get state snapshot
17
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state json 2>/dev/null || echo "{}"
18
+ ```
19
+
20
+ Also read:
21
+ - `.planning/STATE.md` — current phase, progress, plan counts
22
+ - `.planning/ROADMAP.md` — milestone structure and phase list
23
+
24
+ Extract:
25
+ - `current_phase` — which phase is active
26
+ - `plan_of` / `plans_total` — plan execution progress
27
+ - `progress` — overall percentage
28
+ - `status` — active, paused, etc.
29
+
30
+ If no `.planning/` directory exists:
31
+ ```
32
+ No GSD project detected. Run `/gsd:new-project` to get started.
33
+ ```
34
+ Exit.
35
+ </step>
36
+
37
+ <step name="determine_next_action">
38
+ Apply routing rules based on state:
39
+
40
+ **Route 1: No phases exist yet → discuss**
41
+ If ROADMAP has phases but no phase directories exist on disk:
42
+ → Next action: `/gsd:discuss-phase <first-phase>`
43
+
44
+ **Route 2: Phase exists but has no CONTEXT.md or RESEARCH.md → discuss**
45
+ If the current phase directory exists but has neither CONTEXT.md nor RESEARCH.md:
46
+ → Next action: `/gsd:discuss-phase <current-phase>`
47
+
48
+ **Route 3: Phase has context but no plans → plan**
49
+ If the current phase has CONTEXT.md (or RESEARCH.md) but no PLAN.md files:
50
+ → Next action: `/gsd:plan-phase <current-phase>`
51
+
52
+ **Route 4: Phase has plans but incomplete summaries → execute**
53
+ If plans exist but not all have matching summaries:
54
+ → Next action: `/gsd:execute-phase <current-phase>`
55
+
56
+ **Route 5: All plans have summaries → verify and complete**
57
+ If all plans in the current phase have summaries:
58
+ → Next action: `/gsd:verify-work` then `/gsd:complete-phase`
59
+
60
+ **Route 6: Phase complete, next phase exists → advance**
61
+ If the current phase is complete and the next phase exists in ROADMAP:
62
+ → Next action: `/gsd:discuss-phase <next-phase>`
63
+
64
+ **Route 7: All phases complete → complete milestone**
65
+ If all phases are complete:
66
+ → Next action: `/gsd:complete-milestone`
67
+
68
+ **Route 8: Paused → resume**
69
+ If STATE.md shows paused_at:
70
+ → Next action: `/gsd:resume-work`
71
+ </step>
72
+
73
+ <step name="show_and_execute">
74
+ Display the determination:
75
+
76
+ ```
77
+ ## GSD Next
78
+
79
+ **Current:** Phase [N] — [name] | [progress]%
80
+ **Status:** [status description]
81
+
82
+ ▶ **Next step:** `/gsd:[command] [args]`
83
+ [One-line explanation of why this is the next step]
84
+ ```
85
+
86
+ Then immediately invoke the determined command via SlashCommand.
87
+ Do not ask for confirmation — the whole point of `/gsd:next` is zero-friction advancement.
88
+ </step>
89
+
90
+ </process>
91
+
92
+ <success_criteria>
93
+ - [ ] Project state correctly detected
94
+ - [ ] Next action correctly determined from routing rules
95
+ - [ ] Command invoked immediately without user confirmation
96
+ - [ ] Clear status shown before invoking
97
+ </success_criteria>
@@ -0,0 +1,92 @@
1
+ <purpose>
2
+ Autonomous repair operator for failed task verification. Invoked by execute-plan when a task fails its done-criteria. Proposes and attempts structured fixes before escalating to the user.
3
+ </purpose>
4
+
5
+ <inputs>
6
+ - FAILED_TASK: Task number, name, and done-criteria from the plan
7
+ - ERROR: What verification produced — actual result vs expected
8
+ - PLAN_CONTEXT: Adjacent tasks and phase goal (for constraint awareness)
9
+ - REPAIR_BUDGET: Max repair attempts remaining (default: 2)
10
+ </inputs>
11
+
12
+ <repair_directive>
13
+ Analyze the failure and choose exactly one repair strategy:
14
+
15
+ **RETRY** — The approach was right but execution failed. Try again with a concrete adjustment.
16
+ - Use when: command error, missing dependency, wrong path, env issue, transient failure
17
+ - Output: `RETRY: [specific adjustment to make before retrying]`
18
+
19
+ **DECOMPOSE** — The task is too coarse. Break it into smaller verifiable sub-steps.
20
+ - Use when: done-criteria covers multiple concerns, implementation gaps are structural
21
+ - Output: `DECOMPOSE: [sub-task 1] | [sub-task 2] | ...` (max 3 sub-tasks)
22
+ - Sub-tasks must each have a single verifiable outcome
23
+
24
+ **PRUNE** — The task is infeasible given current constraints. Skip with justification.
25
+ - Use when: prerequisite missing and not fixable here, out of scope, contradicts an earlier decision
26
+ - Output: `PRUNE: [one-sentence justification]`
27
+
28
+ **ESCALATE** — Repair budget exhausted, or this is an architectural decision (Rule 4).
29
+ - Use when: RETRY failed more than once with different approaches, or fix requires structural change
30
+ - Output: `ESCALATE: [what was tried] | [what decision is needed]`
31
+ </repair_directive>
32
+
33
+ <process>
34
+
35
+ <step name="diagnose">
36
+ Read the error and done-criteria carefully. Ask:
37
+ 1. Is this a transient/environmental issue? → RETRY
38
+ 2. Is the task verifiably too broad? → DECOMPOSE
39
+ 3. Is a prerequisite genuinely missing and unfixable in scope? → PRUNE
40
+ 4. Has RETRY already been attempted with this task? Check REPAIR_BUDGET. If 0 → ESCALATE
41
+ </step>
42
+
43
+ <step name="execute_retry">
44
+ If RETRY:
45
+ 1. Apply the specific adjustment stated in the directive
46
+ 2. Re-run the task implementation
47
+ 3. Re-run verification
48
+ 4. If passes → continue normally, log `[Node Repair - RETRY] Task [X]: [adjustment made]`
49
+ 5. If fails again → decrement REPAIR_BUDGET, re-invoke node-repair with updated context
50
+ </step>
51
+
52
+ <step name="execute_decompose">
53
+ If DECOMPOSE:
54
+ 1. Replace the failed task inline with the sub-tasks (do not modify PLAN.md on disk)
55
+ 2. Execute sub-tasks sequentially, each with its own verification
56
+ 3. If all sub-tasks pass → treat original task as succeeded, log `[Node Repair - DECOMPOSE] Task [X] → [N] sub-tasks`
57
+ 4. If a sub-task fails → re-invoke node-repair for that sub-task (REPAIR_BUDGET applies per sub-task)
58
+ </step>
59
+
60
+ <step name="execute_prune">
61
+ If PRUNE:
62
+ 1. Mark task as skipped with justification
63
+ 2. Log to SUMMARY "Issues Encountered": `[Node Repair - PRUNE] Task [X]: [justification]`
64
+ 3. Continue to next task
65
+ </step>
66
+
67
+ <step name="execute_escalate">
68
+ If ESCALATE:
69
+ 1. Surface to user via verification_failure_gate with full repair history
70
+ 2. Present: what was tried (each RETRY/DECOMPOSE attempt), what the blocker is, options available
71
+ 3. Wait for user direction before continuing
72
+ </step>
73
+
74
+ </process>
75
+
76
+ <logging>
77
+ All repair actions must appear in SUMMARY.md under "## Deviations from Plan":
78
+
79
+ | Type | Format |
80
+ |------|--------|
81
+ | RETRY success | `[Node Repair - RETRY] Task X: [adjustment] — resolved` |
82
+ | RETRY fail → ESCALATE | `[Node Repair - RETRY] Task X: [N] attempts exhausted — escalated to user` |
83
+ | DECOMPOSE | `[Node Repair - DECOMPOSE] Task X split into [N] sub-tasks — all passed` |
84
+ | PRUNE | `[Node Repair - PRUNE] Task X skipped: [justification]` |
85
+ </logging>
86
+
87
+ <constraints>
88
+ - REPAIR_BUDGET defaults to 2 per task. Configurable via config.json `workflow.node_repair_budget`.
89
+ - Never modify PLAN.md on disk — decomposed sub-tasks are in-memory only.
90
+ - DECOMPOSE sub-tasks must be more specific than the original, not synonymous rewrites.
91
+ - If config.json `workflow.node_repair` is `false`, skip directly to verification_failure_gate (user retains original behavior).
92
+ </constraints>
@@ -0,0 +1,156 @@
1
+ <purpose>
2
+ Zero-friction idea capture. One Write call, one confirmation line. No questions, no prompts.
3
+ Runs inline — no Task, no AskUserQuestion, no Bash.
4
+ </purpose>
5
+
6
+ <required_reading>
7
+ Read all files referenced by the invoking prompt's execution_context before starting.
8
+ </required_reading>
9
+
10
+ <process>
11
+
12
+ <step name="storage_format">
13
+ **Note storage format.**
14
+
15
+ Notes are stored as individual markdown files:
16
+
17
+ - **Project scope**: `.planning/notes/{YYYY-MM-DD}-{slug}.md` — used when `.planning/` exists in cwd
18
+ - **Global scope**: `~/.claude/notes/{YYYY-MM-DD}-{slug}.md` — fallback when no `.planning/`, or when `--global` flag is present
19
+
20
+ Each note file:
21
+
22
+ ```markdown
23
+ ---
24
+ date: "YYYY-MM-DD HH:mm"
25
+ promoted: false
26
+ ---
27
+
28
+ {note text verbatim}
29
+ ```
30
+
31
+ **`--global` flag**: Strip `--global` from anywhere in `$ARGUMENTS` before parsing. When present, force global scope regardless of whether `.planning/` exists.
32
+
33
+ **Important**: Do NOT create `.planning/` if it doesn't exist. Fall back to global scope silently.
34
+ </step>
35
+
36
+ <step name="parse_subcommand">
37
+ **Parse subcommand from $ARGUMENTS (after stripping --global).**
38
+
39
+ | Condition | Subcommand |
40
+ |-----------|------------|
41
+ | Arguments are exactly `list` (case-insensitive) | **list** |
42
+ | Arguments are exactly `promote <N>` where N is a number | **promote** |
43
+ | Arguments are empty (no text at all) | **list** |
44
+ | Anything else | **append** (the text IS the note) |
45
+
46
+ **Critical**: `list` is only a subcommand when it's the ENTIRE argument. `/gsd:note list of groceries` saves a note with text "list of groceries". Same for `promote` — only a subcommand when followed by exactly one number.
47
+ </step>
48
+
49
+ <step name="append">
50
+ **Subcommand: append — create a timestamped note file.**
51
+
52
+ 1. Determine scope (project or global) per storage format above
53
+ 2. Ensure the notes directory exists (`.planning/notes/` or `~/.claude/notes/`)
54
+ 3. Generate slug: first ~4 meaningful words of the note text, lowercase, hyphen-separated (strip articles/prepositions from the start)
55
+ 4. Generate filename: `{YYYY-MM-DD}-{slug}.md`
56
+ - If a file with that name already exists, append `-2`, `-3`, etc.
57
+ 5. Write the file with frontmatter and note text (see storage format)
58
+ 6. Confirm with exactly one line: `Noted ({scope}): {note text}`
59
+ - Where `{scope}` is "project" or "global"
60
+
61
+ **Constraints:**
62
+ - **Never modify the note text** — capture verbatim, including typos
63
+ - **Never ask questions** — just write and confirm
64
+ - **Timestamp format**: Use local time, `YYYY-MM-DD HH:mm` (24-hour, no seconds)
65
+ </step>
66
+
67
+ <step name="list">
68
+ **Subcommand: list — show notes from both scopes.**
69
+
70
+ 1. Glob `.planning/notes/*.md` (if directory exists) — project notes
71
+ 2. Glob `~/.claude/notes/*.md` (if directory exists) — global notes
72
+ 3. For each file, read frontmatter to get `date` and `promoted` status
73
+ 4. Exclude files where `promoted: true` from active counts (but still show them, dimmed)
74
+ 5. Sort by date, number all active entries sequentially starting at 1
75
+ 6. If total active entries > 20, show only the last 10 with a note about how many were omitted
76
+
77
+ **Display format:**
78
+
79
+ ```
80
+ Notes:
81
+
82
+ Project (.planning/notes/):
83
+ 1. [2026-02-08 14:32] refactor the hook system to support async validators
84
+ 2. [promoted] [2026-02-08 14:40] add rate limiting to the API endpoints
85
+ 3. [2026-02-08 15:10] consider adding a --dry-run flag to build
86
+
87
+ Global (~/.claude/notes/):
88
+ 4. [2026-02-08 10:00] cross-project idea about shared config
89
+
90
+ {count} active note(s). Use `/gsd:note promote <N>` to convert to a todo.
91
+ ```
92
+
93
+ If a scope has no directory or no entries, show: `(no notes)`
94
+ </step>
95
+
96
+ <step name="promote">
97
+ **Subcommand: promote — convert a note into a todo.**
98
+
99
+ 1. Run the **list** logic to build the numbered index (both scopes)
100
+ 2. Find entry N from the numbered list
101
+ 3. If N is invalid or refers to an already-promoted note, tell the user and stop
102
+ 4. **Requires `.planning/` directory** — if it doesn't exist, warn: "Todos require a GSD project. Run `/gsd:new-project` to initialize one."
103
+ 5. Ensure `.planning/todos/pending/` directory exists
104
+ 6. Generate todo ID: `{NNN}-{slug}` where NNN is the next sequential number (scan both `.planning/todos/pending/` and `.planning/todos/done/` for the highest existing number, increment by 1, zero-pad to 3 digits) and slug is the first ~4 meaningful words of the note text
105
+ 7. Extract the note text from the source file (body after frontmatter)
106
+ 8. Create `.planning/todos/pending/{id}.md`:
107
+
108
+ ```yaml
109
+ ---
110
+ title: "{note text}"
111
+ status: pending
112
+ priority: P2
113
+ source: "promoted from /gsd:note"
114
+ created: {YYYY-MM-DD}
115
+ theme: general
116
+ ---
117
+
118
+ ## Goal
119
+
120
+ {note text}
121
+
122
+ ## Context
123
+
124
+ Promoted from quick note captured on {original date}.
125
+
126
+ ## Acceptance Criteria
127
+
128
+ - [ ] {primary criterion derived from note text}
129
+ ```
130
+
131
+ 9. Mark the source note file as promoted: update its frontmatter to `promoted: true`
132
+ 10. Confirm: `Promoted note {N} to todo {id}: {note text}`
133
+ </step>
134
+
135
+ </process>
136
+
137
+ <edge_cases>
138
+ 1. **"list" as note text**: `/gsd:note list of things` saves note "list of things" (subcommand only when `list` is the entire arg)
139
+ 2. **No `.planning/`**: Falls back to global `~/.claude/notes/` — works in any directory
140
+ 3. **Promote without project**: Warns that todos require `.planning/`, suggests `/gsd:new-project`
141
+ 4. **Large files**: `list` shows last 10 when >20 active entries
142
+ 5. **Duplicate slugs**: Append `-2`, `-3` etc. to filename if slug already used on same date
143
+ 6. **`--global` position**: Stripped from anywhere — `--global my idea` and `my idea --global` both save "my idea" globally
144
+ 7. **Promote already-promoted**: Tell user "Note {N} is already promoted" and stop
145
+ 8. **Empty note text after stripping flags**: Treat as `list` subcommand
146
+ </edge_cases>
147
+
148
+ <success_criteria>
149
+ - [ ] Append: Note file written with correct frontmatter and verbatim text
150
+ - [ ] Append: No questions asked — instant capture
151
+ - [ ] List: Both scopes shown with sequential numbering
152
+ - [ ] List: Promoted notes shown but dimmed
153
+ - [ ] Promote: Todo created with correct format
154
+ - [ ] Promote: Source note marked as promoted
155
+ - [ ] Global fallback: Works when no `.planning/` exists
156
+ </success_criteria>