cap-pro 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 (275) hide show
  1. package/.claude-plugin/README.md +26 -0
  2. package/.claude-plugin/marketplace.json +24 -0
  3. package/.claude-plugin/plugin.json +24 -0
  4. package/LICENSE +21 -0
  5. package/README.ja-JP.md +834 -0
  6. package/README.ko-KR.md +823 -0
  7. package/README.md +806 -0
  8. package/README.pt-BR.md +452 -0
  9. package/README.zh-CN.md +800 -0
  10. package/agents/cap-architect.md +269 -0
  11. package/agents/cap-brainstormer.md +207 -0
  12. package/agents/cap-curator.md +276 -0
  13. package/agents/cap-debugger.md +365 -0
  14. package/agents/cap-designer.md +246 -0
  15. package/agents/cap-historian.md +464 -0
  16. package/agents/cap-migrator.md +291 -0
  17. package/agents/cap-prototyper.md +197 -0
  18. package/agents/cap-validator.md +308 -0
  19. package/bin/install.js +5433 -0
  20. package/cap/bin/cap-tools.cjs +853 -0
  21. package/cap/bin/lib/arc-scanner.cjs +344 -0
  22. package/cap/bin/lib/cap-affinity-engine.cjs +862 -0
  23. package/cap/bin/lib/cap-anchor.cjs +228 -0
  24. package/cap/bin/lib/cap-annotation-writer.cjs +340 -0
  25. package/cap/bin/lib/cap-checkpoint.cjs +434 -0
  26. package/cap/bin/lib/cap-cluster-detect.cjs +945 -0
  27. package/cap/bin/lib/cap-cluster-display.cjs +52 -0
  28. package/cap/bin/lib/cap-cluster-format.cjs +245 -0
  29. package/cap/bin/lib/cap-cluster-helpers.cjs +295 -0
  30. package/cap/bin/lib/cap-cluster-io.cjs +212 -0
  31. package/cap/bin/lib/cap-completeness.cjs +540 -0
  32. package/cap/bin/lib/cap-deps.cjs +583 -0
  33. package/cap/bin/lib/cap-design-families.cjs +332 -0
  34. package/cap/bin/lib/cap-design.cjs +966 -0
  35. package/cap/bin/lib/cap-divergence-detector.cjs +400 -0
  36. package/cap/bin/lib/cap-doctor.cjs +752 -0
  37. package/cap/bin/lib/cap-feature-map-internals.cjs +19 -0
  38. package/cap/bin/lib/cap-feature-map-migrate.cjs +335 -0
  39. package/cap/bin/lib/cap-feature-map-monorepo.cjs +885 -0
  40. package/cap/bin/lib/cap-feature-map-shard.cjs +315 -0
  41. package/cap/bin/lib/cap-feature-map.cjs +1943 -0
  42. package/cap/bin/lib/cap-fitness-score.cjs +1075 -0
  43. package/cap/bin/lib/cap-impact-analysis.cjs +652 -0
  44. package/cap/bin/lib/cap-learn-review.cjs +1072 -0
  45. package/cap/bin/lib/cap-learning-signals.cjs +627 -0
  46. package/cap/bin/lib/cap-loader.cjs +227 -0
  47. package/cap/bin/lib/cap-logger.cjs +57 -0
  48. package/cap/bin/lib/cap-memory-bridge.cjs +764 -0
  49. package/cap/bin/lib/cap-memory-confidence.cjs +452 -0
  50. package/cap/bin/lib/cap-memory-dir.cjs +987 -0
  51. package/cap/bin/lib/cap-memory-engine.cjs +698 -0
  52. package/cap/bin/lib/cap-memory-extends.cjs +398 -0
  53. package/cap/bin/lib/cap-memory-graph.cjs +790 -0
  54. package/cap/bin/lib/cap-memory-migrate.cjs +2015 -0
  55. package/cap/bin/lib/cap-memory-pin.cjs +183 -0
  56. package/cap/bin/lib/cap-memory-platform.cjs +490 -0
  57. package/cap/bin/lib/cap-memory-prune.cjs +707 -0
  58. package/cap/bin/lib/cap-memory-schema.cjs +812 -0
  59. package/cap/bin/lib/cap-migrate-tags.cjs +309 -0
  60. package/cap/bin/lib/cap-migrate.cjs +540 -0
  61. package/cap/bin/lib/cap-pattern-apply.cjs +1203 -0
  62. package/cap/bin/lib/cap-pattern-pipeline.cjs +1034 -0
  63. package/cap/bin/lib/cap-plugin-manifest.cjs +80 -0
  64. package/cap/bin/lib/cap-realtime-affinity.cjs +399 -0
  65. package/cap/bin/lib/cap-reconcile.cjs +570 -0
  66. package/cap/bin/lib/cap-research-gate.cjs +218 -0
  67. package/cap/bin/lib/cap-scope-filter.cjs +402 -0
  68. package/cap/bin/lib/cap-semantic-pipeline.cjs +1038 -0
  69. package/cap/bin/lib/cap-session-extract.cjs +987 -0
  70. package/cap/bin/lib/cap-session.cjs +445 -0
  71. package/cap/bin/lib/cap-snapshot-linkage.cjs +963 -0
  72. package/cap/bin/lib/cap-stack-docs.cjs +646 -0
  73. package/cap/bin/lib/cap-tag-observer.cjs +371 -0
  74. package/cap/bin/lib/cap-tag-scanner.cjs +1766 -0
  75. package/cap/bin/lib/cap-telemetry.cjs +466 -0
  76. package/cap/bin/lib/cap-test-audit.cjs +1438 -0
  77. package/cap/bin/lib/cap-thread-migrator.cjs +307 -0
  78. package/cap/bin/lib/cap-thread-synthesis.cjs +545 -0
  79. package/cap/bin/lib/cap-thread-tracker.cjs +519 -0
  80. package/cap/bin/lib/cap-trace.cjs +399 -0
  81. package/cap/bin/lib/cap-trust-mode.cjs +336 -0
  82. package/cap/bin/lib/cap-ui-design-editor.cjs +642 -0
  83. package/cap/bin/lib/cap-ui-mind-map.cjs +712 -0
  84. package/cap/bin/lib/cap-ui-thread-nav.cjs +693 -0
  85. package/cap/bin/lib/cap-ui.cjs +1245 -0
  86. package/cap/bin/lib/cap-upgrade.cjs +1028 -0
  87. package/cap/bin/lib/cli/arg-helpers.cjs +49 -0
  88. package/cap/bin/lib/cli/frontmatter-router.cjs +31 -0
  89. package/cap/bin/lib/cli/init-router.cjs +68 -0
  90. package/cap/bin/lib/cli/phase-router.cjs +102 -0
  91. package/cap/bin/lib/cli/state-router.cjs +61 -0
  92. package/cap/bin/lib/cli/template-router.cjs +37 -0
  93. package/cap/bin/lib/cli/uat-router.cjs +29 -0
  94. package/cap/bin/lib/cli/validation-router.cjs +26 -0
  95. package/cap/bin/lib/cli/verification-router.cjs +31 -0
  96. package/cap/bin/lib/cli/workstream-router.cjs +39 -0
  97. package/cap/bin/lib/commands.cjs +961 -0
  98. package/cap/bin/lib/config.cjs +467 -0
  99. package/cap/bin/lib/convention-reader.cjs +258 -0
  100. package/cap/bin/lib/core.cjs +1241 -0
  101. package/cap/bin/lib/feature-aggregator.cjs +423 -0
  102. package/cap/bin/lib/frontmatter.cjs +337 -0
  103. package/cap/bin/lib/init.cjs +1443 -0
  104. package/cap/bin/lib/manifest-generator.cjs +383 -0
  105. package/cap/bin/lib/milestone.cjs +253 -0
  106. package/cap/bin/lib/model-profiles.cjs +69 -0
  107. package/cap/bin/lib/monorepo-context.cjs +226 -0
  108. package/cap/bin/lib/monorepo-migrator.cjs +509 -0
  109. package/cap/bin/lib/phase.cjs +889 -0
  110. package/cap/bin/lib/profile-output.cjs +989 -0
  111. package/cap/bin/lib/profile-pipeline.cjs +540 -0
  112. package/cap/bin/lib/roadmap.cjs +330 -0
  113. package/cap/bin/lib/security.cjs +394 -0
  114. package/cap/bin/lib/session-manager.cjs +292 -0
  115. package/cap/bin/lib/skeleton-generator.cjs +179 -0
  116. package/cap/bin/lib/state.cjs +1032 -0
  117. package/cap/bin/lib/template.cjs +231 -0
  118. package/cap/bin/lib/test-detector.cjs +62 -0
  119. package/cap/bin/lib/uat.cjs +283 -0
  120. package/cap/bin/lib/verify.cjs +889 -0
  121. package/cap/bin/lib/workspace-detector.cjs +371 -0
  122. package/cap/bin/lib/workstream.cjs +492 -0
  123. package/cap/commands/gsd/workstreams.md +63 -0
  124. package/cap/references/arc-standard.md +315 -0
  125. package/cap/references/cap-agent-architecture.md +101 -0
  126. package/cap/references/cap-gitignore-template +9 -0
  127. package/cap/references/cap-zero-deps.md +158 -0
  128. package/cap/references/checkpoints.md +778 -0
  129. package/cap/references/continuation-format.md +249 -0
  130. package/cap/references/contract-test-templates.md +312 -0
  131. package/cap/references/feature-map-template.md +25 -0
  132. package/cap/references/git-integration.md +295 -0
  133. package/cap/references/git-planning-commit.md +38 -0
  134. package/cap/references/model-profiles.md +174 -0
  135. package/cap/references/phase-numbering.md +126 -0
  136. package/cap/references/planning-config.md +202 -0
  137. package/cap/references/property-test-templates.md +316 -0
  138. package/cap/references/security-test-templates.md +347 -0
  139. package/cap/references/session-template.json +8 -0
  140. package/cap/references/tdd.md +263 -0
  141. package/cap/references/user-profiling.md +681 -0
  142. package/cap/references/verification-patterns.md +612 -0
  143. package/cap/templates/UAT.md +265 -0
  144. package/cap/templates/claude-md.md +175 -0
  145. package/cap/templates/codebase/architecture.md +255 -0
  146. package/cap/templates/codebase/concerns.md +310 -0
  147. package/cap/templates/codebase/conventions.md +307 -0
  148. package/cap/templates/codebase/integrations.md +280 -0
  149. package/cap/templates/codebase/stack.md +186 -0
  150. package/cap/templates/codebase/structure.md +285 -0
  151. package/cap/templates/codebase/testing.md +480 -0
  152. package/cap/templates/config.json +44 -0
  153. package/cap/templates/context.md +352 -0
  154. package/cap/templates/continue-here.md +78 -0
  155. package/cap/templates/copilot-instructions.md +7 -0
  156. package/cap/templates/debug-subagent-prompt.md +91 -0
  157. package/cap/templates/discussion-log.md +63 -0
  158. package/cap/templates/milestone-archive.md +123 -0
  159. package/cap/templates/milestone.md +115 -0
  160. package/cap/templates/phase-prompt.md +610 -0
  161. package/cap/templates/planner-subagent-prompt.md +117 -0
  162. package/cap/templates/project.md +186 -0
  163. package/cap/templates/requirements.md +231 -0
  164. package/cap/templates/research-project/ARCHITECTURE.md +204 -0
  165. package/cap/templates/research-project/FEATURES.md +147 -0
  166. package/cap/templates/research-project/PITFALLS.md +200 -0
  167. package/cap/templates/research-project/STACK.md +120 -0
  168. package/cap/templates/research-project/SUMMARY.md +170 -0
  169. package/cap/templates/research.md +552 -0
  170. package/cap/templates/roadmap.md +202 -0
  171. package/cap/templates/state.md +176 -0
  172. package/cap/templates/summary.md +364 -0
  173. package/cap/templates/user-preferences.md +498 -0
  174. package/cap/templates/verification-report.md +322 -0
  175. package/cap/workflows/add-phase.md +112 -0
  176. package/cap/workflows/add-tests.md +351 -0
  177. package/cap/workflows/add-todo.md +158 -0
  178. package/cap/workflows/audit-milestone.md +340 -0
  179. package/cap/workflows/audit-uat.md +109 -0
  180. package/cap/workflows/autonomous.md +891 -0
  181. package/cap/workflows/check-todos.md +177 -0
  182. package/cap/workflows/cleanup.md +152 -0
  183. package/cap/workflows/complete-milestone.md +767 -0
  184. package/cap/workflows/diagnose-issues.md +231 -0
  185. package/cap/workflows/discovery-phase.md +289 -0
  186. package/cap/workflows/discuss-phase-assumptions.md +653 -0
  187. package/cap/workflows/discuss-phase.md +1049 -0
  188. package/cap/workflows/do.md +104 -0
  189. package/cap/workflows/execute-phase.md +846 -0
  190. package/cap/workflows/execute-plan.md +514 -0
  191. package/cap/workflows/fast.md +105 -0
  192. package/cap/workflows/forensics.md +265 -0
  193. package/cap/workflows/health.md +181 -0
  194. package/cap/workflows/help.md +660 -0
  195. package/cap/workflows/insert-phase.md +130 -0
  196. package/cap/workflows/list-phase-assumptions.md +178 -0
  197. package/cap/workflows/list-workspaces.md +56 -0
  198. package/cap/workflows/manager.md +362 -0
  199. package/cap/workflows/map-codebase.md +377 -0
  200. package/cap/workflows/milestone-summary.md +223 -0
  201. package/cap/workflows/new-milestone.md +486 -0
  202. package/cap/workflows/new-project.md +1250 -0
  203. package/cap/workflows/new-workspace.md +237 -0
  204. package/cap/workflows/next.md +97 -0
  205. package/cap/workflows/node-repair.md +92 -0
  206. package/cap/workflows/note.md +156 -0
  207. package/cap/workflows/pause-work.md +176 -0
  208. package/cap/workflows/plan-milestone-gaps.md +273 -0
  209. package/cap/workflows/plan-phase.md +857 -0
  210. package/cap/workflows/plant-seed.md +169 -0
  211. package/cap/workflows/pr-branch.md +129 -0
  212. package/cap/workflows/profile-user.md +449 -0
  213. package/cap/workflows/progress.md +507 -0
  214. package/cap/workflows/quick.md +757 -0
  215. package/cap/workflows/remove-phase.md +155 -0
  216. package/cap/workflows/remove-workspace.md +90 -0
  217. package/cap/workflows/research-phase.md +82 -0
  218. package/cap/workflows/resume-project.md +326 -0
  219. package/cap/workflows/review.md +228 -0
  220. package/cap/workflows/session-report.md +146 -0
  221. package/cap/workflows/settings.md +283 -0
  222. package/cap/workflows/ship.md +228 -0
  223. package/cap/workflows/stats.md +60 -0
  224. package/cap/workflows/transition.md +671 -0
  225. package/cap/workflows/ui-phase.md +298 -0
  226. package/cap/workflows/ui-review.md +161 -0
  227. package/cap/workflows/update.md +323 -0
  228. package/cap/workflows/validate-phase.md +170 -0
  229. package/cap/workflows/verify-phase.md +254 -0
  230. package/cap/workflows/verify-work.md +637 -0
  231. package/commands/cap/annotate.md +165 -0
  232. package/commands/cap/brainstorm.md +393 -0
  233. package/commands/cap/checkpoint.md +106 -0
  234. package/commands/cap/completeness.md +94 -0
  235. package/commands/cap/continue.md +72 -0
  236. package/commands/cap/debug.md +588 -0
  237. package/commands/cap/deps.md +169 -0
  238. package/commands/cap/design.md +479 -0
  239. package/commands/cap/init.md +354 -0
  240. package/commands/cap/iterate.md +249 -0
  241. package/commands/cap/learn.md +459 -0
  242. package/commands/cap/memory.md +275 -0
  243. package/commands/cap/migrate-feature-map.md +91 -0
  244. package/commands/cap/migrate-memory.md +108 -0
  245. package/commands/cap/migrate-tags.md +91 -0
  246. package/commands/cap/migrate.md +131 -0
  247. package/commands/cap/prototype.md +510 -0
  248. package/commands/cap/reconcile.md +121 -0
  249. package/commands/cap/review.md +360 -0
  250. package/commands/cap/save.md +72 -0
  251. package/commands/cap/scan.md +404 -0
  252. package/commands/cap/start.md +356 -0
  253. package/commands/cap/status.md +118 -0
  254. package/commands/cap/test-audit.md +262 -0
  255. package/commands/cap/test.md +394 -0
  256. package/commands/cap/trace.md +133 -0
  257. package/commands/cap/ui.md +167 -0
  258. package/hooks/dist/cap-check-update.js +115 -0
  259. package/hooks/dist/cap-context-monitor.js +185 -0
  260. package/hooks/dist/cap-learn-review-hook.js +114 -0
  261. package/hooks/dist/cap-learning-hook.js +192 -0
  262. package/hooks/dist/cap-memory.js +299 -0
  263. package/hooks/dist/cap-prompt-guard.js +97 -0
  264. package/hooks/dist/cap-statusline.js +157 -0
  265. package/hooks/dist/cap-tag-observer.js +115 -0
  266. package/hooks/dist/cap-version-check.js +112 -0
  267. package/hooks/dist/cap-workflow-guard.js +175 -0
  268. package/hooks/hooks.json +55 -0
  269. package/package.json +58 -0
  270. package/scripts/base64-scan.sh +262 -0
  271. package/scripts/build-hooks.js +93 -0
  272. package/scripts/cap-removal-checklist.md +202 -0
  273. package/scripts/prompt-injection-scan.sh +199 -0
  274. package/scripts/run-tests.cjs +181 -0
  275. package/scripts/secret-scan.sh +227 -0
@@ -0,0 +1,265 @@
1
+ # UAT Template
2
+
3
+ Template for `.planning/phases/XX-name/{phase_num}-UAT.md` — persistent UAT session tracking.
4
+
5
+ ---
6
+
7
+ ## File Template
8
+
9
+ ```markdown
10
+ ---
11
+ status: testing | partial | complete | diagnosed
12
+ phase: XX-name
13
+ source: [list of SUMMARY.md files tested]
14
+ started: [ISO timestamp]
15
+ updated: [ISO timestamp]
16
+ ---
17
+
18
+ ## Current Test
19
+ <!-- OVERWRITE each test - shows where we are -->
20
+
21
+ number: [N]
22
+ name: [test name]
23
+ expected: |
24
+ [what user should observe]
25
+ awaiting: user response
26
+
27
+ ## Tests
28
+
29
+ ### 1. [Test Name]
30
+ expected: [observable behavior - what user should see]
31
+ result: [pending]
32
+
33
+ ### 2. [Test Name]
34
+ expected: [observable behavior]
35
+ result: pass
36
+
37
+ ### 3. [Test Name]
38
+ expected: [observable behavior]
39
+ result: issue
40
+ reported: "[verbatim user response]"
41
+ severity: major
42
+
43
+ ### 4. [Test Name]
44
+ expected: [observable behavior]
45
+ result: skipped
46
+ reason: [why skipped]
47
+
48
+ ### 5. [Test Name]
49
+ expected: [observable behavior]
50
+ result: blocked
51
+ blocked_by: server | physical-device | release-build | third-party | prior-phase
52
+ reason: [why blocked]
53
+
54
+ ...
55
+
56
+ ## Summary
57
+
58
+ total: [N]
59
+ passed: [N]
60
+ issues: [N]
61
+ pending: [N]
62
+ skipped: [N]
63
+ blocked: [N]
64
+
65
+ ## Gaps
66
+
67
+ <!-- YAML format for plan-phase --gaps consumption -->
68
+ - truth: "[expected behavior from test]"
69
+ status: failed
70
+ reason: "User reported: [verbatim response]"
71
+ severity: blocker | major | minor | cosmetic
72
+ test: [N]
73
+ root_cause: "" # Filled by diagnosis
74
+ artifacts: [] # Filled by diagnosis
75
+ missing: [] # Filled by diagnosis
76
+ debug_session: "" # Filled by diagnosis
77
+ ```
78
+
79
+ ---
80
+
81
+ <section_rules>
82
+
83
+ **Frontmatter:**
84
+ - `status`: OVERWRITE - "testing", "partial", or "complete"
85
+ - `phase`: IMMUTABLE - set on creation
86
+ - `source`: IMMUTABLE - SUMMARY files being tested
87
+ - `started`: IMMUTABLE - set on creation
88
+ - `updated`: OVERWRITE - update on every change
89
+
90
+ **Current Test:**
91
+ - OVERWRITE entirely on each test transition
92
+ - Shows which test is active and what's awaited
93
+ - On completion: "[testing complete]"
94
+
95
+ **Tests:**
96
+ - Each test: OVERWRITE result field when user responds
97
+ - `result` values: [pending], pass, issue, skipped, blocked
98
+ - If issue: add `reported` (verbatim) and `severity` (inferred)
99
+ - If skipped: add `reason` if provided
100
+ - If blocked: add `blocked_by` (tag) and `reason` (if provided)
101
+
102
+ **Summary:**
103
+ - OVERWRITE counts after each response
104
+ - Tracks: total, passed, issues, pending, skipped
105
+
106
+ **Gaps:**
107
+ - APPEND only when issue found (YAML format)
108
+ - After diagnosis: fill `root_cause`, `artifacts`, `missing`, `debug_session`
109
+ - This section feeds directly into /gsd:plan-phase --gaps
110
+
111
+ </section_rules>
112
+
113
+ <diagnosis_lifecycle>
114
+
115
+ **After testing complete (status: complete), if gaps exist:**
116
+
117
+ 1. User runs diagnosis (from verify-work offer or manually)
118
+ 2. diagnose-issues workflow spawns parallel debug agents
119
+ 3. Each agent investigates one gap, returns root cause
120
+ 4. UAT.md Gaps section updated with diagnosis:
121
+ - Each gap gets `root_cause`, `artifacts`, `missing`, `debug_session` filled
122
+ 5. status → "diagnosed"
123
+ 6. Ready for /gsd:plan-phase --gaps with root causes
124
+
125
+ **After diagnosis:**
126
+ ```yaml
127
+ ## Gaps
128
+
129
+ - truth: "Comment appears immediately after submission"
130
+ status: failed
131
+ reason: "User reported: works but doesn't show until I refresh the page"
132
+ severity: major
133
+ test: 2
134
+ root_cause: "useEffect in CommentList.tsx missing commentCount dependency"
135
+ artifacts:
136
+ - path: "src/components/CommentList.tsx"
137
+ issue: "useEffect missing dependency"
138
+ missing:
139
+ - "Add commentCount to useEffect dependency array"
140
+ debug_session: ".planning/debug/comment-not-refreshing.md"
141
+ ```
142
+
143
+ </diagnosis_lifecycle>
144
+
145
+ <lifecycle>
146
+
147
+ **Creation:** When /gsd:verify-work starts new session
148
+ - Extract tests from SUMMARY.md files
149
+ - Set status to "testing"
150
+ - Current Test points to test 1
151
+ - All tests have result: [pending]
152
+
153
+ **During testing:**
154
+ - Present test from Current Test section
155
+ - User responds with pass confirmation or issue description
156
+ - Update test result (pass/issue/skipped)
157
+ - Update Summary counts
158
+ - If issue: append to Gaps section (YAML format), infer severity
159
+ - Move Current Test to next pending test
160
+
161
+ **On completion:**
162
+ - status → "complete"
163
+ - Current Test → "[testing complete]"
164
+ - Commit file
165
+ - Present summary with next steps
166
+
167
+ **Partial completion:**
168
+ - status → "partial" (if pending, blocked, or unresolved skipped tests remain)
169
+ - Current Test → "[testing paused — {N} items outstanding]"
170
+ - Commit file
171
+ - Present summary with outstanding items highlighted
172
+
173
+ **Resuming partial session:**
174
+ - `/gsd:verify-work {phase}` picks up from first pending/blocked test
175
+ - When all items resolved, status advances to "complete"
176
+
177
+ **Resume after /clear:**
178
+ 1. Read frontmatter → know phase and status
179
+ 2. Read Current Test → know where we are
180
+ 3. Find first [pending] result → continue from there
181
+ 4. Summary shows progress so far
182
+
183
+ </lifecycle>
184
+
185
+ <severity_guide>
186
+
187
+ Severity is INFERRED from user's natural language, never asked.
188
+
189
+ | User describes | Infer |
190
+ |----------------|-------|
191
+ | Crash, error, exception, fails completely, unusable | blocker |
192
+ | Doesn't work, nothing happens, wrong behavior, missing | major |
193
+ | Works but..., slow, weird, minor, small issue | minor |
194
+ | Color, font, spacing, alignment, visual, looks off | cosmetic |
195
+
196
+ Default: **major** (safe default, user can clarify if wrong)
197
+
198
+ </severity_guide>
199
+
200
+ <good_example>
201
+ ```markdown
202
+ ---
203
+ status: diagnosed
204
+ phase: 04-comments
205
+ source: 04-01-SUMMARY.md, 04-02-SUMMARY.md
206
+ started: 2025-01-15T10:30:00Z
207
+ updated: 2025-01-15T10:45:00Z
208
+ ---
209
+
210
+ ## Current Test
211
+
212
+ [testing complete]
213
+
214
+ ## Tests
215
+
216
+ ### 1. View Comments on Post
217
+ expected: Comments section expands, shows count and comment list
218
+ result: pass
219
+
220
+ ### 2. Create Top-Level Comment
221
+ expected: Submit comment via rich text editor, appears in list with author info
222
+ result: issue
223
+ reported: "works but doesn't show until I refresh the page"
224
+ severity: major
225
+
226
+ ### 3. Reply to a Comment
227
+ expected: Click Reply, inline composer appears, submit shows nested reply
228
+ result: pass
229
+
230
+ ### 4. Visual Nesting
231
+ expected: 3+ level thread shows indentation, left borders, caps at reasonable depth
232
+ result: pass
233
+
234
+ ### 5. Delete Own Comment
235
+ expected: Click delete on own comment, removed or shows [deleted] if has replies
236
+ result: pass
237
+
238
+ ### 6. Comment Count
239
+ expected: Post shows accurate count, increments when adding comment
240
+ result: pass
241
+
242
+ ## Summary
243
+
244
+ total: 6
245
+ passed: 5
246
+ issues: 1
247
+ pending: 0
248
+ skipped: 0
249
+
250
+ ## Gaps
251
+
252
+ - truth: "Comment appears immediately after submission in list"
253
+ status: failed
254
+ reason: "User reported: works but doesn't show until I refresh the page"
255
+ severity: major
256
+ test: 2
257
+ root_cause: "useEffect in CommentList.tsx missing commentCount dependency"
258
+ artifacts:
259
+ - path: "src/components/CommentList.tsx"
260
+ issue: "useEffect missing dependency"
261
+ missing:
262
+ - "Add commentCount to useEffect dependency array"
263
+ debug_session: ".planning/debug/comment-not-refreshing.md"
264
+ ```
265
+ </good_example>
@@ -0,0 +1,175 @@
1
+ # CLAUDE.md Template
2
+
3
+ Template for project-root `CLAUDE.md` — auto-generated by `gsd-tools generate-claude-md`.
4
+
5
+ Contains 6 marker-bounded sections. Each section is independently updatable.
6
+ The `generate-claude-md` subcommand manages 5 sections (project, stack, conventions, architecture, workflow enforcement).
7
+ The profile section is managed exclusively by `generate-claude-profile`.
8
+
9
+ ---
10
+
11
+ ## Section Templates
12
+
13
+ ### Project Section
14
+ ```
15
+ <!-- GSD:project-start source:PROJECT.md -->
16
+ ## Project
17
+
18
+ {{project_content}}
19
+ <!-- GSD:project-end -->
20
+ ```
21
+
22
+ **Fallback text:**
23
+ ```
24
+ Project not yet initialized. Run /gsd:new-project to set up.
25
+ ```
26
+
27
+ ### Stack Section
28
+ ```
29
+ <!-- GSD:stack-start source:STACK.md -->
30
+ ## Technology Stack
31
+
32
+ {{stack_content}}
33
+ <!-- GSD:stack-end -->
34
+ ```
35
+
36
+ **Fallback text:**
37
+ ```
38
+ Technology stack not yet documented. Will populate after codebase mapping or first phase.
39
+ ```
40
+
41
+ ### Conventions Section
42
+ ```
43
+ <!-- GSD:conventions-start source:CONVENTIONS.md -->
44
+ ## Conventions
45
+
46
+ {{conventions_content}}
47
+ <!-- GSD:conventions-end -->
48
+ ```
49
+
50
+ **Fallback text:**
51
+ ```
52
+ Conventions not yet established. Will populate as patterns emerge during development.
53
+ ```
54
+
55
+ ### Architecture Section
56
+ ```
57
+ <!-- GSD:architecture-start source:ARCHITECTURE.md -->
58
+ ## Architecture
59
+
60
+ {{architecture_content}}
61
+ <!-- GSD:architecture-end -->
62
+ ```
63
+
64
+ **Fallback text:**
65
+ ```
66
+ Architecture not yet mapped. Follow existing patterns found in the codebase.
67
+ ```
68
+
69
+ ### Workflow Enforcement Section
70
+ ```
71
+ <!-- CAP:workflow-start source:CAP 7.0 auto-trigger contract -->
72
+ ## CAP Workflow
73
+
74
+ Code-First: build first, extract structure from `@cap-feature` and `@cap-todo` tags. The slash commands (`/cap:brainstorm`, `/cap:prototype`, `/cap:iterate`, `/cap:test`, `/cap:review`) exist for explicit power-user invocation, but in normal use Claude should recognize the workflow moment and invoke the matching Skill — or simply do the work directly when the change is small.
75
+
76
+ **Auto-trigger contract — invoke the matching CAP Skill when:**
77
+
78
+ | Situation | Skill |
79
+ |-----------|------|
80
+ | User describes a new feature without a FEATURE-MAP.md entry ("we need X / let's add Y") | `cap:brainstorm` |
81
+ | Feature in state `planned`, user says "build / implement it" | `cap:prototype` |
82
+ | Feature in state `prototyped` with open `@cap-todo` tags, user says "refine / iterate / keep going" | `cap:iterate` |
83
+ | Feature has code but not yet `tested` | `cap:test` |
84
+ | Feature in state `tested`, user says "review / ready to ship" | `cap:review` |
85
+ | User reports a bug or unexpected behavior | `cap:debug` |
86
+ | User asks "where are we / what's the status" | `cap:status` (or `cap-curator` STATUS mode) |
87
+
88
+ **Do NOT invoke a Skill when:**
89
+ - The change is a one-line edit, typo, or trivial refactor — just edit
90
+ - The user explicitly says "skip cap / just do it"
91
+ - The work is exploratory chat, not yet a feature
92
+ - The user is in a Frontend Sprint (see below)
93
+
94
+ ### Frontend Sprint Pattern (Phase-1 / Phase-2)
95
+
96
+ UI work has a different shape: fast tweaks where agent ceremony costs more than the edit. Two-phase pattern, no slash command needed.
97
+
98
+ **Phase 1 — Free Edit Sprint** (stay out of the way):
99
+ Triggers — file is `*.tsx/*.jsx/*.css/*.scss`, OR user asks for visual changes (padding, color, spacing, hover, animation, layout), OR rapid back-and-forth (3+ edits same file), OR user says "schnell / quick / probieren".
100
+ → Edit directly. No Skill invocation. No tag pressure. No research gate.
101
+
102
+ **Phase 2 — Catch-up** (auto-invoke at sprint end):
103
+ Triggers — user says "fertig / passt / aufräumen / commit ready", OR shifts topic away from visual.
104
+ → Invoke `cap:annotate` (retroactive tags) + `cap:test` sequentially. Optionally suggest `/cap:save`.
105
+
106
+ ### Multi-User Workflow (optional, only if the project has multiple contributors)
107
+
108
+ Projects with role-split contributors (e.g. frontend ↔ backend) can drive Skill behavior off `.cap/SESSION.json:activeUser`. Detection order: explicit `--user=` flag → `git config user.email` → ask once + persist.
109
+
110
+ For each user role, document in this CLAUDE.md:
111
+ - **Owns** (file globs, packages, layers)
112
+ - **Skill priorities** (Skills to lean on)
113
+ - **Do NOT auto-invoke for this user** (Skills out of scope)
114
+ - **Do NOT push to this user** (topics out of scope)
115
+
116
+ **Handoff snapshots** between users are first-class: `cap-historian` MODE: SAVE writes a snapshot with frontmatter:
117
+ ```yaml
118
+ handoff_to: <recipient>
119
+ handoff_from: <sender>
120
+ handoff_date: <ISO timestamp>
121
+ feature: F-XXX
122
+ phase: <next-phase>
123
+ files_changed: [list]
124
+ open_acs: [list]
125
+ exit_notes: |
126
+ What's done and what's open.
127
+ ```
128
+ The recipient's next `cap:start` surfaces the unconsumed handoff via `cap-historian` MODE: CONTINUE. Handoff is consumed implicitly once the recipient writes a follow-up snapshot or runs a state-changing Skill on the same feature.
129
+
130
+ Skip this section entirely for single-contributor projects.
131
+
132
+ **Macro-agents (`cap-historian`, `cap-curator`, `cap-architect`, `cap-migrator`) are spawned via Task() when the user wants a step back** — architecture review, snapshot/fork, stakeholder report, or migration. They are not slash commands.
133
+
134
+ Tag annotations matter: every feature implementation must carry `@cap-feature(feature:F-NNN)` plus `@cap-todo(ac:F-NNN/AC-N)` for each AC. Without tags, the Feature Map drifts from reality.
135
+ <!-- CAP:workflow-end -->
136
+ ```
137
+
138
+ ### Profile Section (Placeholder Only)
139
+ ```
140
+ <!-- GSD:profile-start -->
141
+ ## Developer Profile
142
+
143
+ > Profile not yet configured. Run `/gsd:profile-user` to generate your developer profile.
144
+ > This section is managed by `generate-claude-profile` — do not edit manually.
145
+ <!-- GSD:profile-end -->
146
+ ```
147
+
148
+ **Note:** This section is NOT managed by `generate-claude-md`. It is managed exclusively
149
+ by `generate-claude-profile`. The placeholder above is only used when creating a new
150
+ CLAUDE.md file and no profile section exists yet.
151
+
152
+ ---
153
+
154
+ ## Section Ordering
155
+
156
+ 1. **Project** — Identity and purpose (what this project is)
157
+ 2. **Stack** — Technology choices (what tools are used)
158
+ 3. **Conventions** — Code patterns and rules (how code is written)
159
+ 4. **Architecture** — System structure (how components fit together)
160
+ 5. **Workflow Enforcement** — Default GSD entry points for file-changing work
161
+ 6. **Profile** — Developer behavioral preferences (how to interact)
162
+
163
+ ## Marker Format
164
+
165
+ - Start: `<!-- GSD:{name}-start source:{file} -->`
166
+ - End: `<!-- GSD:{name}-end -->`
167
+ - Source attribute enables targeted updates when source files change
168
+ - Partial match on start marker (without closing `-->`) for detection
169
+
170
+ ## Fallback Behavior
171
+
172
+ When a source file is missing, fallback text provides Claude-actionable guidance:
173
+ - Guides Claude's behavior in the absence of data
174
+ - Not placeholder ads or "missing" notices
175
+ - Each fallback tells Claude what to do, not just what's absent
@@ -0,0 +1,255 @@
1
+ # Architecture Template
2
+
3
+ Template for `.planning/codebase/ARCHITECTURE.md` - captures conceptual code organization.
4
+
5
+ **Purpose:** Document how the code is organized at a conceptual level. Complements STRUCTURE.md (which shows physical file locations).
6
+
7
+ ---
8
+
9
+ ## File Template
10
+
11
+ ```markdown
12
+ # Architecture
13
+
14
+ **Analysis Date:** [YYYY-MM-DD]
15
+
16
+ ## Pattern Overview
17
+
18
+ **Overall:** [Pattern name: e.g., "Monolithic CLI", "Serverless API", "Full-stack MVC"]
19
+
20
+ **Key Characteristics:**
21
+ - [Characteristic 1: e.g., "Single executable"]
22
+ - [Characteristic 2: e.g., "Stateless request handling"]
23
+ - [Characteristic 3: e.g., "Event-driven"]
24
+
25
+ ## Layers
26
+
27
+ [Describe the conceptual layers and their responsibilities]
28
+
29
+ **[Layer Name]:**
30
+ - Purpose: [What this layer does]
31
+ - Contains: [Types of code: e.g., "route handlers", "business logic"]
32
+ - Depends on: [What it uses: e.g., "data layer only"]
33
+ - Used by: [What uses it: e.g., "API routes"]
34
+
35
+ **[Layer Name]:**
36
+ - Purpose: [What this layer does]
37
+ - Contains: [Types of code]
38
+ - Depends on: [What it uses]
39
+ - Used by: [What uses it]
40
+
41
+ ## Data Flow
42
+
43
+ [Describe the typical request/execution lifecycle]
44
+
45
+ **[Flow Name] (e.g., "HTTP Request", "CLI Command", "Event Processing"):**
46
+
47
+ 1. [Entry point: e.g., "User runs command"]
48
+ 2. [Processing step: e.g., "Router matches path"]
49
+ 3. [Processing step: e.g., "Controller validates input"]
50
+ 4. [Processing step: e.g., "Service executes logic"]
51
+ 5. [Output: e.g., "Response returned"]
52
+
53
+ **State Management:**
54
+ - [How state is handled: e.g., "Stateless - no persistent state", "Database per request", "In-memory cache"]
55
+
56
+ ## Key Abstractions
57
+
58
+ [Core concepts/patterns used throughout the codebase]
59
+
60
+ **[Abstraction Name]:**
61
+ - Purpose: [What it represents]
62
+ - Examples: [e.g., "UserService, ProjectService"]
63
+ - Pattern: [e.g., "Singleton", "Factory", "Repository"]
64
+
65
+ **[Abstraction Name]:**
66
+ - Purpose: [What it represents]
67
+ - Examples: [Concrete examples]
68
+ - Pattern: [Pattern used]
69
+
70
+ ## Entry Points
71
+
72
+ [Where execution begins]
73
+
74
+ **[Entry Point]:**
75
+ - Location: [Brief: e.g., "src/index.ts", "API Gateway triggers"]
76
+ - Triggers: [What invokes it: e.g., "CLI invocation", "HTTP request"]
77
+ - Responsibilities: [What it does: e.g., "Parse args, route to command"]
78
+
79
+ ## Error Handling
80
+
81
+ **Strategy:** [How errors are handled: e.g., "Exception bubbling to top-level handler", "Per-route error middleware"]
82
+
83
+ **Patterns:**
84
+ - [Pattern: e.g., "try/catch at controller level"]
85
+ - [Pattern: e.g., "Error codes returned to user"]
86
+
87
+ ## Cross-Cutting Concerns
88
+
89
+ [Aspects that affect multiple layers]
90
+
91
+ **Logging:**
92
+ - [Approach: e.g., "Winston logger, injected per-request"]
93
+
94
+ **Validation:**
95
+ - [Approach: e.g., "Zod schemas at API boundary"]
96
+
97
+ **Authentication:**
98
+ - [Approach: e.g., "JWT middleware on protected routes"]
99
+
100
+ ---
101
+
102
+ *Architecture analysis: [date]*
103
+ *Update when major patterns change*
104
+ ```
105
+
106
+ <good_examples>
107
+ ```markdown
108
+ # Architecture
109
+
110
+ **Analysis Date:** 2025-01-20
111
+
112
+ ## Pattern Overview
113
+
114
+ **Overall:** CLI Application with Plugin System
115
+
116
+ **Key Characteristics:**
117
+ - Single executable with subcommands
118
+ - Plugin-based extensibility
119
+ - File-based state (no database)
120
+ - Synchronous execution model
121
+
122
+ ## Layers
123
+
124
+ **Command Layer:**
125
+ - Purpose: Parse user input and route to appropriate handler
126
+ - Contains: Command definitions, argument parsing, help text
127
+ - Location: `src/commands/*.ts`
128
+ - Depends on: Service layer for business logic
129
+ - Used by: CLI entry point (`src/index.ts`)
130
+
131
+ **Service Layer:**
132
+ - Purpose: Core business logic
133
+ - Contains: FileService, TemplateService, InstallService
134
+ - Location: `src/services/*.ts`
135
+ - Depends on: File system utilities, external tools
136
+ - Used by: Command handlers
137
+
138
+ **Utility Layer:**
139
+ - Purpose: Shared helpers and abstractions
140
+ - Contains: File I/O wrappers, path resolution, string formatting
141
+ - Location: `src/utils/*.ts`
142
+ - Depends on: Node.js built-ins only
143
+ - Used by: Service layer
144
+
145
+ ## Data Flow
146
+
147
+ **CLI Command Execution:**
148
+
149
+ 1. User runs: `gsd new-project`
150
+ 2. Commander parses args and flags
151
+ 3. Command handler invoked (`src/commands/new-project.ts`)
152
+ 4. Handler calls service methods (`src/services/project.ts` → `create()`)
153
+ 5. Service reads templates, processes files, writes output
154
+ 6. Results logged to console
155
+ 7. Process exits with status code
156
+
157
+ **State Management:**
158
+ - File-based: All state lives in `.planning/` directory
159
+ - No persistent in-memory state
160
+ - Each command execution is independent
161
+
162
+ ## Key Abstractions
163
+
164
+ **Service:**
165
+ - Purpose: Encapsulate business logic for a domain
166
+ - Examples: `src/services/file.ts`, `src/services/template.ts`, `src/services/project.ts`
167
+ - Pattern: Singleton-like (imported as modules, not instantiated)
168
+
169
+ **Command:**
170
+ - Purpose: CLI command definition
171
+ - Examples: `src/commands/new-project.ts`, `src/commands/plan-phase.ts`
172
+ - Pattern: Commander.js command registration
173
+
174
+ **Template:**
175
+ - Purpose: Reusable document structures
176
+ - Examples: PROJECT.md, PLAN.md templates
177
+ - Pattern: Markdown files with substitution variables
178
+
179
+ ## Entry Points
180
+
181
+ **CLI Entry:**
182
+ - Location: `src/index.ts`
183
+ - Triggers: User runs `gsd <command>`
184
+ - Responsibilities: Register commands, parse args, display help
185
+
186
+ **Commands:**
187
+ - Location: `src/commands/*.ts`
188
+ - Triggers: Matched command from CLI
189
+ - Responsibilities: Validate input, call services, format output
190
+
191
+ ## Error Handling
192
+
193
+ **Strategy:** Throw exceptions, catch at command level, log and exit
194
+
195
+ **Patterns:**
196
+ - Services throw Error with descriptive messages
197
+ - Command handlers catch, log error to stderr, exit(1)
198
+ - Validation errors shown before execution (fail fast)
199
+
200
+ ## Cross-Cutting Concerns
201
+
202
+ **Logging:**
203
+ - Console.log for normal output
204
+ - Console.error for errors
205
+ - Chalk for colored output
206
+
207
+ **Validation:**
208
+ - Zod schemas for config file parsing
209
+ - Manual validation in command handlers
210
+ - Fail fast on invalid input
211
+
212
+ **File Operations:**
213
+ - FileService abstraction over fs-extra
214
+ - All paths validated before operations
215
+ - Atomic writes (temp file + rename)
216
+
217
+ ---
218
+
219
+ *Architecture analysis: 2025-01-20*
220
+ *Update when major patterns change*
221
+ ```
222
+ </good_examples>
223
+
224
+ <guidelines>
225
+ **What belongs in ARCHITECTURE.md:**
226
+ - Overall architectural pattern (monolith, microservices, layered, etc.)
227
+ - Conceptual layers and their relationships
228
+ - Data flow / request lifecycle
229
+ - Key abstractions and patterns
230
+ - Entry points
231
+ - Error handling strategy
232
+ - Cross-cutting concerns (logging, auth, validation)
233
+
234
+ **What does NOT belong here:**
235
+ - Exhaustive file listings (that's STRUCTURE.md)
236
+ - Technology choices (that's STACK.md)
237
+ - Line-by-line code walkthrough (defer to code reading)
238
+ - Implementation details of specific features
239
+
240
+ **File paths ARE welcome:**
241
+ Include file paths as concrete examples of abstractions. Use backtick formatting: `src/services/user.ts`. This makes the architecture document actionable for Claude when planning.
242
+
243
+ **When filling this template:**
244
+ - Read main entry points (index, server, main)
245
+ - Identify layers by reading imports/dependencies
246
+ - Trace a typical request/command execution
247
+ - Note recurring patterns (services, controllers, repositories)
248
+ - Keep descriptions conceptual, not mechanical
249
+
250
+ **Useful for phase planning when:**
251
+ - Adding new features (where does it fit in the layers?)
252
+ - Refactoring (understanding current patterns)
253
+ - Identifying where to add code (which layer handles X?)
254
+ - Understanding dependencies between components
255
+ </guidelines>