@bhargavvc/sdd-cc 1.30.1 → 1.35.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 (242) hide show
  1. package/README.ja-JP.md +144 -110
  2. package/README.ko-KR.md +143 -107
  3. package/README.md +183 -112
  4. package/README.pt-BR.md +90 -52
  5. package/README.zh-CN.md +141 -101
  6. package/agents/sdd-advisor-researcher.md +23 -0
  7. package/agents/sdd-ai-researcher.md +133 -0
  8. package/agents/sdd-code-fixer.md +516 -0
  9. package/agents/sdd-code-reviewer.md +355 -0
  10. package/agents/sdd-codebase-mapper.md +3 -3
  11. package/agents/sdd-debugger.md +17 -5
  12. package/agents/sdd-doc-verifier.md +201 -0
  13. package/agents/sdd-doc-writer.md +602 -0
  14. package/agents/sdd-domain-researcher.md +153 -0
  15. package/agents/sdd-eval-auditor.md +164 -0
  16. package/agents/sdd-eval-planner.md +154 -0
  17. package/agents/sdd-executor.md +87 -4
  18. package/agents/sdd-framework-selector.md +160 -0
  19. package/agents/sdd-intel-updater.md +314 -0
  20. package/agents/sdd-nyquist-auditor.md +1 -1
  21. package/agents/sdd-phase-researcher.md +71 -4
  22. package/agents/sdd-plan-checker.md +100 -6
  23. package/agents/sdd-planner.md +145 -206
  24. package/agents/sdd-project-researcher.md +25 -2
  25. package/agents/sdd-research-synthesizer.md +3 -3
  26. package/agents/sdd-roadmapper.md +6 -6
  27. package/agents/sdd-security-auditor.md +128 -0
  28. package/agents/sdd-ui-auditor.md +43 -3
  29. package/agents/sdd-ui-checker.md +5 -5
  30. package/agents/sdd-ui-researcher.md +27 -4
  31. package/agents/sdd-user-profiler.md +2 -2
  32. package/agents/sdd-verifier.md +142 -22
  33. package/bin/install.js +2145 -545
  34. package/commands/sdd/add-backlog.md +5 -5
  35. package/commands/sdd/add-tests.md +2 -2
  36. package/commands/sdd/ai-integration-phase.md +36 -0
  37. package/commands/sdd/analyze-dependencies.md +34 -0
  38. package/commands/sdd/audit-fix.md +33 -0
  39. package/commands/sdd/autonomous.md +7 -2
  40. package/commands/sdd/cleanup.md +5 -0
  41. package/commands/sdd/code-review-fix.md +52 -0
  42. package/commands/sdd/code-review.md +55 -0
  43. package/commands/sdd/complete-milestone.md +6 -6
  44. package/commands/sdd/debug.md +22 -9
  45. package/commands/sdd/discuss-phase.md +7 -2
  46. package/commands/sdd/do.md +1 -1
  47. package/commands/sdd/docs-update.md +48 -0
  48. package/commands/sdd/eval-review.md +32 -0
  49. package/commands/sdd/execute-phase.md +4 -0
  50. package/commands/sdd/explore.md +27 -0
  51. package/commands/sdd/fast.md +2 -2
  52. package/commands/sdd/from-sdd2.md +45 -0
  53. package/commands/sdd/help.md +2 -0
  54. package/commands/sdd/import.md +36 -0
  55. package/commands/sdd/intel.md +179 -0
  56. package/commands/sdd/join-discord.md +2 -1
  57. package/commands/sdd/manager.md +1 -0
  58. package/commands/sdd/map-codebase.md +3 -3
  59. package/commands/sdd/new-milestone.md +1 -1
  60. package/commands/sdd/new-project.md +5 -1
  61. package/commands/sdd/new-workspace.md +1 -1
  62. package/commands/sdd/next.md +2 -0
  63. package/commands/sdd/plan-milestone-gaps.md +2 -2
  64. package/commands/sdd/plan-phase.md +6 -1
  65. package/commands/sdd/plant-seed.md +1 -1
  66. package/commands/sdd/profile-user.md +1 -1
  67. package/commands/sdd/quick.md +5 -3
  68. package/commands/sdd/reapply-patches.md +230 -42
  69. package/commands/sdd/research-phase.md +3 -3
  70. package/commands/sdd/review-backlog.md +1 -0
  71. package/commands/sdd/review.md +6 -3
  72. package/commands/sdd/scan.md +26 -0
  73. package/commands/sdd/secure-phase.md +35 -0
  74. package/commands/sdd/ship.md +1 -1
  75. package/commands/sdd/thread.md +5 -5
  76. package/commands/sdd/undo.md +34 -0
  77. package/commands/sdd/verify-work.md +1 -1
  78. package/commands/sdd/workstreams.md +17 -11
  79. package/hooks/dist/sdd-check-update.js +33 -8
  80. package/hooks/dist/sdd-context-monitor.js +17 -8
  81. package/hooks/dist/sdd-phase-boundary.sh +27 -0
  82. package/hooks/dist/sdd-prompt-guard.js +1 -0
  83. package/hooks/dist/sdd-read-guard.js +82 -0
  84. package/hooks/dist/sdd-session-state.sh +33 -0
  85. package/hooks/dist/sdd-statusline.js +137 -15
  86. package/hooks/dist/sdd-validate-commit.sh +47 -0
  87. package/hooks/dist/sdd-workflow-guard.js +4 -4
  88. package/hooks/sdd-check-update.js +139 -0
  89. package/hooks/sdd-context-monitor.js +165 -0
  90. package/hooks/sdd-phase-boundary.sh +27 -0
  91. package/hooks/sdd-prompt-guard.js +97 -0
  92. package/hooks/sdd-read-guard.js +82 -0
  93. package/hooks/sdd-session-state.sh +33 -0
  94. package/hooks/sdd-statusline.js +241 -0
  95. package/hooks/sdd-validate-commit.sh +47 -0
  96. package/hooks/sdd-workflow-guard.js +94 -0
  97. package/package.json +3 -3
  98. package/scripts/build-hooks.js +18 -7
  99. package/scripts/prompt-injection-scan.sh +1 -0
  100. package/scripts/rebrand-gsd-to-sdd.sh +221 -220
  101. package/scripts/run-tests.cjs +5 -1
  102. package/scripts/sync-upstream.sh +1 -1
  103. package/sdd/bin/lib/commands.cjs +79 -17
  104. package/sdd/bin/lib/config.cjs +90 -48
  105. package/sdd/bin/lib/core.cjs +452 -87
  106. package/sdd/bin/lib/docs.cjs +267 -0
  107. package/sdd/bin/lib/frontmatter.cjs +381 -336
  108. package/sdd/bin/lib/init.cjs +110 -16
  109. package/sdd/bin/lib/intel.cjs +660 -0
  110. package/sdd/bin/lib/learnings.cjs +378 -0
  111. package/sdd/bin/lib/milestone.cjs +42 -11
  112. package/sdd/bin/lib/model-profiles.cjs +17 -15
  113. package/sdd/bin/lib/phase.cjs +367 -288
  114. package/sdd/bin/lib/profile-output.cjs +106 -10
  115. package/sdd/bin/lib/roadmap.cjs +146 -115
  116. package/sdd/bin/lib/schema-detect.cjs +238 -0
  117. package/sdd/bin/lib/sdd2-import.cjs +511 -0
  118. package/sdd/bin/lib/security.cjs +124 -3
  119. package/sdd/bin/lib/state.cjs +648 -264
  120. package/sdd/bin/lib/template.cjs +8 -4
  121. package/sdd/bin/lib/verify.cjs +209 -28
  122. package/sdd/bin/lib/workstream.cjs +7 -3
  123. package/sdd/bin/sdd-tools.cjs +184 -12
  124. package/sdd/contexts/dev.md +21 -0
  125. package/sdd/contexts/research.md +22 -0
  126. package/sdd/contexts/review.md +22 -0
  127. package/sdd/references/agent-contracts.md +79 -0
  128. package/sdd/references/ai-evals.md +156 -0
  129. package/sdd/references/ai-frameworks.md +186 -0
  130. package/sdd/references/artifact-types.md +113 -0
  131. package/sdd/references/common-bug-patterns.md +114 -0
  132. package/sdd/references/context-budget.md +49 -0
  133. package/sdd/references/continuation-format.md +25 -25
  134. package/sdd/references/domain-probes.md +125 -0
  135. package/sdd/references/few-shot-examples/plan-checker.md +73 -0
  136. package/sdd/references/few-shot-examples/verifier.md +109 -0
  137. package/sdd/references/gate-prompts.md +100 -0
  138. package/sdd/references/gates.md +70 -0
  139. package/sdd/references/git-integration.md +1 -1
  140. package/sdd/references/ios-scaffold.md +123 -0
  141. package/sdd/references/model-profile-resolution.md +2 -0
  142. package/sdd/references/model-profiles.md +24 -18
  143. package/sdd/references/planner-gap-closure.md +62 -0
  144. package/sdd/references/planner-reviews.md +39 -0
  145. package/sdd/references/planner-revision.md +87 -0
  146. package/sdd/references/planning-config.md +252 -0
  147. package/sdd/references/revision-loop.md +97 -0
  148. package/sdd/references/thinking-models-debug.md +44 -0
  149. package/sdd/references/thinking-models-execution.md +50 -0
  150. package/sdd/references/thinking-models-planning.md +62 -0
  151. package/sdd/references/thinking-models-research.md +50 -0
  152. package/sdd/references/thinking-models-verification.md +55 -0
  153. package/sdd/references/thinking-partner.md +96 -0
  154. package/sdd/references/ui-brand.md +4 -4
  155. package/sdd/references/universal-anti-patterns.md +63 -0
  156. package/sdd/references/verification-overrides.md +227 -0
  157. package/sdd/references/workstream-flag.md +56 -3
  158. package/sdd/templates/AI-SPEC.md +246 -0
  159. package/sdd/templates/DEBUG.md +1 -1
  160. package/sdd/templates/SECURITY.md +61 -0
  161. package/sdd/templates/UAT.md +4 -4
  162. package/sdd/templates/VALIDATION.md +4 -4
  163. package/sdd/templates/claude-md.md +32 -9
  164. package/sdd/templates/config.json +4 -0
  165. package/sdd/templates/debug-subagent-prompt.md +1 -1
  166. package/sdd/templates/dev-preferences.md +1 -1
  167. package/sdd/templates/discovery.md +2 -2
  168. package/sdd/templates/phase-prompt.md +1 -1
  169. package/sdd/templates/planner-subagent-prompt.md +3 -3
  170. package/sdd/templates/project.md +1 -1
  171. package/sdd/templates/research.md +1 -1
  172. package/sdd/templates/state.md +2 -2
  173. package/sdd/workflows/add-phase.md +8 -8
  174. package/sdd/workflows/add-tests.md +12 -9
  175. package/sdd/workflows/add-todo.md +5 -3
  176. package/sdd/workflows/ai-integration-phase.md +284 -0
  177. package/sdd/workflows/analyze-dependencies.md +96 -0
  178. package/sdd/workflows/audit-fix.md +157 -0
  179. package/sdd/workflows/audit-milestone.md +11 -11
  180. package/sdd/workflows/audit-uat.md +2 -2
  181. package/sdd/workflows/autonomous.md +195 -27
  182. package/sdd/workflows/check-todos.md +12 -10
  183. package/sdd/workflows/cleanup.md +2 -0
  184. package/sdd/workflows/code-review-fix.md +497 -0
  185. package/sdd/workflows/code-review.md +515 -0
  186. package/sdd/workflows/complete-milestone.md +56 -22
  187. package/sdd/workflows/diagnose-issues.md +10 -3
  188. package/sdd/workflows/discovery-phase.md +5 -3
  189. package/sdd/workflows/discuss-phase-assumptions.md +24 -6
  190. package/sdd/workflows/discuss-phase-power.md +291 -0
  191. package/sdd/workflows/discuss-phase.md +173 -21
  192. package/sdd/workflows/do.md +23 -21
  193. package/sdd/workflows/docs-update.md +1155 -0
  194. package/sdd/workflows/eval-review.md +155 -0
  195. package/sdd/workflows/execute-phase.md +594 -38
  196. package/sdd/workflows/execute-plan.md +67 -96
  197. package/sdd/workflows/explore.md +139 -0
  198. package/sdd/workflows/fast.md +5 -5
  199. package/sdd/workflows/forensics.md +2 -2
  200. package/sdd/workflows/health.md +4 -4
  201. package/sdd/workflows/help.md +122 -119
  202. package/sdd/workflows/import.md +276 -0
  203. package/sdd/workflows/inbox.md +387 -0
  204. package/sdd/workflows/insert-phase.md +7 -7
  205. package/sdd/workflows/list-phase-assumptions.md +4 -4
  206. package/sdd/workflows/list-workspaces.md +2 -2
  207. package/sdd/workflows/manager.md +35 -32
  208. package/sdd/workflows/map-codebase.md +7 -5
  209. package/sdd/workflows/milestone-summary.md +2 -2
  210. package/sdd/workflows/new-milestone.md +17 -9
  211. package/sdd/workflows/new-project.md +50 -25
  212. package/sdd/workflows/new-workspace.md +7 -5
  213. package/sdd/workflows/next.md +67 -11
  214. package/sdd/workflows/note.md +9 -7
  215. package/sdd/workflows/pause-work.md +75 -12
  216. package/sdd/workflows/plan-milestone-gaps.md +8 -8
  217. package/sdd/workflows/plan-phase.md +294 -42
  218. package/sdd/workflows/plant-seed.md +6 -3
  219. package/sdd/workflows/pr-branch.md +42 -14
  220. package/sdd/workflows/profile-user.md +9 -7
  221. package/sdd/workflows/progress.md +45 -45
  222. package/sdd/workflows/quick.md +195 -47
  223. package/sdd/workflows/remove-phase.md +6 -6
  224. package/sdd/workflows/remove-workspace.md +3 -1
  225. package/sdd/workflows/research-phase.md +2 -2
  226. package/sdd/workflows/resume-project.md +12 -12
  227. package/sdd/workflows/review.md +109 -9
  228. package/sdd/workflows/scan.md +102 -0
  229. package/sdd/workflows/secure-phase.md +166 -0
  230. package/sdd/workflows/session-report.md +2 -2
  231. package/sdd/workflows/settings.md +38 -12
  232. package/sdd/workflows/ship.md +21 -9
  233. package/sdd/workflows/stats.md +1 -1
  234. package/sdd/workflows/transition.md +23 -23
  235. package/sdd/workflows/ui-phase.md +15 -7
  236. package/sdd/workflows/ui-review.md +29 -4
  237. package/sdd/workflows/undo.md +314 -0
  238. package/sdd/workflows/update.md +171 -20
  239. package/sdd/workflows/validate-phase.md +6 -4
  240. package/sdd/workflows/verify-phase.md +210 -6
  241. package/sdd/workflows/verify-work.md +83 -9
  242. package/sdd/commands/sdd/workstreams.md +0 -63
@@ -48,7 +48,7 @@ X/Y plans complete (Z%)
48
48
  - **Project age:** N days
49
49
  ```
50
50
 
51
- If no `.planning/` directory exists, inform the user to run `/sdd:new-project` first.
51
+ If no `.planning/` directory exists, inform the user to run `/sdd-new-project` first.
52
52
  </step>
53
53
 
54
54
  </process>
@@ -2,15 +2,15 @@
2
2
 
3
3
  **This is an INTERNAL workflow — NOT a user-facing command.**
4
4
 
5
- There is no `/sdd:transition` command. This workflow is invoked automatically by
5
+ There is no `/sdd-transition` command. This workflow is invoked automatically by
6
6
  `execute-phase` during auto-advance, or inline by the orchestrator after phase
7
- verification. Users should never be told to run `/sdd:transition`.
7
+ verification. Users should never be told to run `/sdd-transition`.
8
8
 
9
9
  **Valid user commands for phase progression:**
10
- - `/sdd:discuss-phase {N}` — discuss a phase before planning
11
- - `/sdd:plan-phase {N}` — plan a phase
12
- - `/sdd:execute-phase {N}` — execute a phase
13
- - `/sdd:progress` — see roadmap progress
10
+ - `/sdd-discuss-phase {N}` — discuss a phase before planning
11
+ - `/sdd-plan-phase {N}` — plan a phase
12
+ - `/sdd-execute-phase {N}` — execute a phase
13
+ - `/sdd-progress` — see roadmap progress
14
14
 
15
15
  </internal_workflow>
16
16
 
@@ -93,7 +93,7 @@ Append to the completion confirmation message (regardless of mode):
93
93
  Outstanding verification items in this phase:
94
94
  {list filenames}
95
95
 
96
- These will carry forward as debt. Review: `/sdd:audit-uat`
96
+ These will carry forward as debt. Review: `/sdd-audit-uat`
97
97
  ```
98
98
 
99
99
  This does NOT block transition — it ensures the user sees the debt before confirming.
@@ -446,7 +446,7 @@ Next: Phase [X+1] — [Name]
446
446
  ⚡ Auto-continuing: Plan Phase [X+1] in detail
447
447
  ```
448
448
 
449
- Exit skill and invoke SlashCommand("/sdd:plan-phase [X+1] --auto ${SDD_WS}")
449
+ Exit skill and invoke SlashCommand("/sdd-plan-phase [X+1] --auto ${SDD_WS}")
450
450
 
451
451
  **If CONTEXT.md does NOT exist:**
452
452
 
@@ -458,7 +458,7 @@ Next: Phase [X+1] — [Name]
458
458
  ⚡ Auto-continuing: Discuss Phase [X+1] first
459
459
  ```
460
460
 
461
- Exit skill and invoke SlashCommand("/sdd:discuss-phase [X+1] --auto ${SDD_WS}")
461
+ Exit skill and invoke SlashCommand("/sdd-discuss-phase [X+1] --auto ${SDD_WS}")
462
462
 
463
463
  </if>
464
464
 
@@ -475,15 +475,15 @@ Exit skill and invoke SlashCommand("/sdd:discuss-phase [X+1] --auto ${SDD_WS}")
475
475
 
476
476
  **Phase [X+1]: [Name]** — [Goal from ROADMAP.md]
477
477
 
478
- `/sdd:discuss-phase [X+1] ${SDD_WS}` — gather context and clarify approach
478
+ `/clear` then:
479
479
 
480
- <sub>`/clear` first fresh context window</sub>
480
+ `/sdd-discuss-phase [X+1] ${SDD_WS}` gather context and clarify approach
481
481
 
482
482
  ---
483
483
 
484
484
  **Also available:**
485
- - `/sdd:plan-phase [X+1] ${SDD_WS}` — skip discussion, plan directly
486
- - `/sdd:research-phase [X+1] ${SDD_WS}` — investigate unknowns
485
+ - `/sdd-plan-phase [X+1] ${SDD_WS}` — skip discussion, plan directly
486
+ - `/sdd-research-phase [X+1] ${SDD_WS}` — investigate unknowns
487
487
 
488
488
  ---
489
489
  ```
@@ -500,15 +500,15 @@ Exit skill and invoke SlashCommand("/sdd:discuss-phase [X+1] --auto ${SDD_WS}")
500
500
  **Phase [X+1]: [Name]** — [Goal from ROADMAP.md]
501
501
  <sub>✓ Context gathered, ready to plan</sub>
502
502
 
503
- `/sdd:plan-phase [X+1] ${SDD_WS}`
503
+ `/clear` then:
504
504
 
505
- <sub>`/clear` first → fresh context window</sub>
505
+ `/sdd-plan-phase [X+1] ${SDD_WS}`
506
506
 
507
507
  ---
508
508
 
509
509
  **Also available:**
510
- - `/sdd:discuss-phase [X+1] ${SDD_WS}` — revisit context
511
- - `/sdd:research-phase [X+1] ${SDD_WS}` — investigate unknowns
510
+ - `/sdd-discuss-phase [X+1] ${SDD_WS}` — revisit context
511
+ - `/sdd-research-phase [X+1] ${SDD_WS}` — investigate unknowns
512
512
 
513
513
  ---
514
514
  ```
@@ -554,18 +554,18 @@ This workstream's phases are complete. Other workstreams are still active:
554
554
 
555
555
  Archive this workstream:
556
556
 
557
- `/sdd:workstreams complete {current_ws_name} ${SDD_WS}`
557
+ `/sdd-workstreams complete {current_ws_name} ${SDD_WS}`
558
558
 
559
559
  See overall milestone progress:
560
560
 
561
- `/sdd:workstreams progress ${SDD_WS}`
561
+ `/sdd-workstreams progress ${SDD_WS}`
562
562
 
563
563
  <sub>Milestone completion will be available once all workstreams finish.</sub>
564
564
 
565
565
  ---
566
566
  ```
567
567
 
568
- Do NOT suggest `/sdd:complete-milestone` or `/sdd:new-milestone`.
568
+ Do NOT suggest `/sdd-complete-milestone` or `/sdd-new-milestone`.
569
569
  Do NOT auto-invoke any further slash commands.
570
570
 
571
571
  **Stop here.** The user must explicitly decide what to do next.
@@ -593,7 +593,7 @@ Phase {X} marked complete.
593
593
  ⚡ Auto-continuing: Complete milestone and archive
594
594
  ```
595
595
 
596
- Exit skill and invoke SlashCommand("/sdd:complete-milestone {version} ${SDD_WS}")
596
+ Exit skill and invoke SlashCommand("/sdd-complete-milestone {version} ${SDD_WS}")
597
597
 
598
598
  </if>
599
599
 
@@ -610,9 +610,9 @@ Exit skill and invoke SlashCommand("/sdd:complete-milestone {version} ${SDD_WS}"
610
610
 
611
611
  **Complete Milestone {version}** — archive and prepare for next
612
612
 
613
- `/sdd:complete-milestone {version} ${SDD_WS}`
613
+ `/clear` then:
614
614
 
615
- <sub>`/clear` first → fresh context window</sub>
615
+ `/sdd-complete-milestone {version} ${SDD_WS}`
616
616
 
617
617
  ---
618
618
 
@@ -44,11 +44,11 @@ UI_ENABLED=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" config-get workflow.ui_p
44
44
 
45
45
  **If `UI_ENABLED` is `false`:**
46
46
  ```
47
- UI phase is disabled in config. Enable via /sdd:settings.
47
+ UI phase is disabled in config. Enable via /sdd-settings.
48
48
  ```
49
49
  Exit workflow.
50
50
 
51
- **If `planning_exists` is false:** Error — run `/sdd:new-project` first.
51
+ **If `planning_exists` is false:** Error — run `/sdd-new-project` first.
52
52
 
53
53
  ## 2. Parse and Validate Phase
54
54
 
@@ -65,7 +65,7 @@ PHASE_INFO=$(node "$HOME/.claude/sdd/bin/sdd-tools.cjs" roadmap get-phase "${PHA
65
65
  **If `has_context` is false:**
66
66
  ```
67
67
  No CONTEXT.md found for Phase {N}.
68
- Recommended: run /sdd:discuss-phase {N} first to capture design preferences.
68
+ Recommended: run /sdd-discuss-phase {N} first to capture design preferences.
69
69
  Continuing without user decisions — UI researcher will ask all questions.
70
70
  ```
71
71
  Continue (non-blocking).
@@ -83,6 +83,8 @@ Continue (non-blocking).
83
83
  UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1)
84
84
  ```
85
85
 
86
+
87
+ **Text mode (`workflow.text_mode: true` in config or `--text` flag):** Set `TEXT_MODE=true` if `--text` is present in `$ARGUMENTS` OR `text_mode` from init JSON is `true`. When TEXT_MODE is active, replace every `AskUserQuestion` call with a plain-text numbered list and ask the user to type their choice number. This is required for non-Claude runtimes (OpenAI Codex, Gemini CLI, etc.) where `AskUserQuestion` is not available.
86
88
  **If exists:** Use AskUserQuestion:
87
89
  - header: "Existing UI-SPEC"
88
90
  - question: "UI-SPEC.md already exists for Phase {N}. What would you like to do?"
@@ -120,7 +122,7 @@ Answer: "What visual and interaction contracts does this phase need?"
120
122
  - {state_path} (Project State)
121
123
  - {roadmap_path} (Roadmap)
122
124
  - {requirements_path} (Requirements)
123
- - {context_path} (USER DECISIONS from /sdd:discuss-phase)
125
+ - {context_path} (USER DECISIONS from /sdd-discuss-phase)
124
126
  - {research_path} (Technical Research — stack decisions)
125
127
  </files_to_read>
126
128
 
@@ -238,7 +240,7 @@ Max revision iterations reached. Remaining issues:
238
240
 
239
241
  Options:
240
242
  1. Force approve — proceed with current UI-SPEC (FLAGs become accepted)
241
- 2. Edit manually — open UI-SPEC.md in editor, re-run /sdd:ui-phase
243
+ 2. Edit manually — open UI-SPEC.md in editor, re-run /sdd-ui-phase
242
244
  3. Abandon — exit without approving
243
245
  ```
244
246
 
@@ -261,11 +263,17 @@ Dimensions: 6/6 passed
261
263
 
262
264
  ## ▶ Next Up
263
265
 
266
+ {If CONTEXT.md exists for this phase:}
264
267
  **Plan Phase {N}** — planner will use UI-SPEC.md as design context
265
268
 
266
- `/sdd:plan-phase {N}`
269
+ `/clear` then: `/sdd-plan-phase {N}`
270
+
271
+ {If CONTEXT.md does NOT exist:}
272
+ **Discuss Phase {N}** — gather implementation context before planning
273
+
274
+ `/clear` then: `/sdd-discuss-phase {N}`
267
275
 
268
- <sub>/clear first fresh context window</sub>
276
+ (or `/sdd-plan-phase {N}` to skip discussion)
269
277
 
270
278
  ───────────────────────────────────────────────────────────────
271
279
  ```
@@ -42,8 +42,10 @@ UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1)
42
42
  UI_REVIEW_FILE=$(ls "${PHASE_DIR}"/*-UI-REVIEW.md 2>/dev/null | head -1)
43
43
  ```
44
44
 
45
- **If `SUMMARY_FILES` empty:** Exit — "Phase {N} not executed. Run /sdd:execute-phase {N} first."
45
+ **If `SUMMARY_FILES` empty:** Exit — "Phase {N} not executed. Run /sdd-execute-phase {N} first."
46
46
 
47
+
48
+ **Text mode (`workflow.text_mode: true` in config or `--text` flag):** Set `TEXT_MODE=true` if `--text` is present in `$ARGUMENTS` OR `text_mode` from init JSON is `true`. When TEXT_MODE is active, replace every `AskUserQuestion` call with a plain-text numbered list and ask the user to type their choice number. This is required for non-Claude runtimes (OpenAI Codex, Gemini CLI, etc.) where `AskUserQuestion` is not available.
47
49
  **If `UI_REVIEW_FILE` non-empty:** Use AskUserQuestion:
48
50
  - header: "Existing UI Review"
49
51
  - question: "UI-REVIEW.md already exists for Phase {N}."
@@ -138,14 +140,37 @@ Full review: {path to UI-REVIEW.md}
138
140
 
139
141
  ## ▶ Next
140
142
 
141
- - `/sdd:verify-work {N}` UAT testing
142
- - `/sdd:plan-phase {N+1}` — plan next phase
143
+ `/clear` then one of:
144
+
145
+ - `/sdd-verify-work {N}` — UAT testing
146
+ - `/sdd-plan-phase {N+1}` — plan next phase
143
147
 
144
- <sub>/clear first fresh context window</sub>
148
+ - `/sdd-verify-work {N}` UAT testing
149
+ - `/sdd-plan-phase {N+1}` — plan next phase
145
150
 
146
151
  ───────────────────────────────────────────────────────────────
147
152
  ```
148
153
 
154
+ ## Automated UI Verification (when Playwright-MCP is available)
155
+
156
+ If `mcp__playwright__*` tools are accessible in this session:
157
+
158
+ 1. Navigate to each UI component described in the phase's UI-SPEC.md using
159
+ `mcp__playwright__navigate` (or equivalent Playwright-MCP tool).
160
+ 2. Take a screenshot of each component using `mcp__playwright__screenshot`.
161
+ 3. Compare against the spec's visual requirements — dimensions, color palette,
162
+ layout, spacing scale, and typography.
163
+ 4. Report any dimension, color, or layout discrepancies automatically as
164
+ additional findings within the relevant pillar section of UI-REVIEW.md.
165
+ 5. Flag items that require human judgment (brand feel, content tone) as
166
+ `needs_human_review: true` in the findings — these are surfaced to the user
167
+ separately after the automated pass completes.
168
+
169
+ If Playwright-MCP is not available in this session, this section is skipped
170
+ entirely. The audit falls back to the standard code-only review described above.
171
+ No configuration change is required — the availability of `mcp__playwright__*`
172
+ tools is detected at runtime.
173
+
149
174
  ## 5. Commit (if configured)
150
175
 
151
176
  ```bash
@@ -0,0 +1,314 @@
1
+ <purpose>
2
+ Safe git revert workflow. Rolls back SDD phase or plan commits using the phase manifest with dependency checks and a confirmation gate. Uses git revert --no-commit (NEVER git reset) to preserve history.
3
+ </purpose>
4
+
5
+ <required_reading>
6
+ @~/.claude/sdd/references/ui-brand.md
7
+ @~/.claude/sdd/references/gate-prompts.md
8
+ </required_reading>
9
+
10
+ <process>
11
+
12
+ <step name="banner" priority="first">
13
+ Display the stage banner:
14
+
15
+ ```
16
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
17
+ SDD ► UNDO
18
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
19
+ ```
20
+ </step>
21
+
22
+ <step name="parse_arguments">
23
+ Parse $ARGUMENTS for the undo mode:
24
+
25
+ - `--last N` → MODE=last, COUNT=N (integer, default 10 if N missing)
26
+ - `--phase NN` → MODE=phase, TARGET_PHASE=NN (two-digit phase number)
27
+ - `--plan NN-MM` → MODE=plan, TARGET_PLAN=NN-MM (phase-plan ID)
28
+
29
+ If no valid argument is provided, display usage and exit:
30
+
31
+ ```
32
+ Usage: /sdd-undo --last N | --phase NN | --plan NN-MM
33
+
34
+ Modes:
35
+ --last N Show last N SDD commits for interactive selection
36
+ --phase NN Revert all commits for phase NN
37
+ --plan NN-MM Revert all commits for plan NN-MM
38
+
39
+ Examples:
40
+ /sdd-undo --last 5
41
+ /sdd-undo --phase 03
42
+ /sdd-undo --plan 03-02
43
+ ```
44
+ </step>
45
+
46
+ <step name="gather_commits">
47
+ Based on MODE, gather candidate commits.
48
+
49
+ **MODE=last:**
50
+
51
+ Run:
52
+ ```bash
53
+ git log --oneline --no-merges -${COUNT}
54
+ ```
55
+
56
+ Filter for SDD conventional commits matching `type(scope): message` pattern (e.g., `feat(04-01):`, `docs(03):`, `fix(02-03):`).
57
+
58
+ Display a numbered list of matching commits:
59
+ ```
60
+ Recent SDD commits:
61
+ 1. abc1234 feat(04-01): implement auth endpoint
62
+ 2. def5678 docs(03-02): complete plan summary
63
+ 3. ghi9012 fix(02-03): correct validation logic
64
+ ```
65
+
66
+
67
+ **Text mode (`workflow.text_mode: true` in config or `--text` flag):** Set `TEXT_MODE=true` if `--text` is present in `$ARGUMENTS` OR `text_mode` from init JSON is `true`. When TEXT_MODE is active, replace every `AskUserQuestion` call with a plain-text numbered list and ask the user to type their choice number. This is required for non-Claude runtimes (OpenAI Codex, Gemini CLI, etc.) where `AskUserQuestion` is not available.
68
+ Use AskUserQuestion to ask:
69
+ - question: "Which commits to revert? Enter numbers (e.g., 1,3) or 'all'"
70
+ - header: "Select"
71
+
72
+ Parse the user's selection into COMMITS list.
73
+
74
+ ---
75
+
76
+ **MODE=phase:**
77
+
78
+ Read `.planning/.phase-manifest.json` if it exists.
79
+
80
+ If the file exists and `manifest.phases?.[TARGET_PHASE]?.commits` is a non-empty array:
81
+ - Use `manifest.phases[TARGET_PHASE].commits` entries as COMMITS (each entry is a commit hash)
82
+
83
+ If the file does not exist, or `manifest.phases?.[TARGET_PHASE]` is missing:
84
+ - Display: "Manifest has no entry for phase ${TARGET_PHASE} (or file missing), falling back to git log search"
85
+ - Fallback: run git log and filter for the target phase scope:
86
+ ```bash
87
+ git log --oneline --no-merges --all | grep -E "\(0*${TARGET_PHASE}(-[0-9]+)?\):" | head -50
88
+ ```
89
+ - Use matching commits as COMMITS
90
+
91
+ ---
92
+
93
+ **MODE=plan:**
94
+
95
+ Run:
96
+ ```bash
97
+ git log --oneline --no-merges --all | grep -E "\(${TARGET_PLAN}\)" | head -50
98
+ ```
99
+
100
+ Use matching commits as COMMITS.
101
+
102
+ ---
103
+
104
+ **Empty check:**
105
+
106
+ If COMMITS is empty after gathering:
107
+ ```
108
+ No commits found for ${MODE} ${TARGET}. Nothing to revert.
109
+ ```
110
+ Exit cleanly.
111
+ </step>
112
+
113
+ <step name="dependency_check">
114
+ **Applies when MODE=phase or MODE=plan.**
115
+
116
+ Skip this step entirely for MODE=last.
117
+
118
+ ---
119
+
120
+ **MODE=phase:**
121
+
122
+ Read `.planning/ROADMAP.md` inline.
123
+
124
+ Search for phases that list a dependency on the target phase. Look for patterns like:
125
+ - "Depends on: Phase ${TARGET_PHASE}"
126
+ - "Depends on: ${TARGET_PHASE}"
127
+ - "depends_on: [${TARGET_PHASE}]"
128
+
129
+ For each dependent phase N found:
130
+ 1. Check if `.planning/phases/${N}-*/` directory exists
131
+ 2. If directory exists, check for any PLAN.md or SUMMARY.md files inside it
132
+
133
+ If any downstream phase has started work, collect warnings:
134
+ ```
135
+ ⚠ Downstream dependency detected:
136
+ Phase ${N} depends on Phase ${TARGET_PHASE} and has started work.
137
+ ```
138
+
139
+ ---
140
+
141
+ **MODE=plan:**
142
+
143
+ Extract the phase number from TARGET_PLAN (the NN part of NN-MM). Extract the plan number (the MM part).
144
+
145
+ Look for later plans in the same phase directory (`.planning/phases/${NN}-*/`). For each later plan (plans with number > MM):
146
+ 1. Read the later plan's PLAN.md
147
+ 2. Check if its `<files>` sections or `consumes` fields reference outputs from the target plan
148
+
149
+ If any later plan references the target plan's outputs, collect warnings:
150
+ ```
151
+ ⚠ Intra-phase dependency detected:
152
+ Plan ${LATER_PLAN} in phase ${NN} references outputs from plan ${TARGET_PLAN}.
153
+ ```
154
+
155
+ ---
156
+
157
+ If any warnings exist (from either mode):
158
+ - Display all warnings
159
+ - Use AskUserQuestion with approve-revise-abort pattern:
160
+ - question: "Downstream work depends on the target being reverted. Proceed anyway?"
161
+ - header: "Confirm"
162
+ - options: Proceed | Abort
163
+
164
+ If user selects "Abort": exit with "Revert cancelled. No changes made."
165
+ </step>
166
+
167
+ <step name="confirm_revert">
168
+ Display the confirmation gate using approve-revise-abort pattern from gate-prompts.md.
169
+
170
+ Show:
171
+ ```
172
+ The following commits will be reverted (in reverse chronological order):
173
+
174
+ {hash} — {message}
175
+ {hash} — {message}
176
+ ...
177
+
178
+ Total: {N} commit(s) to revert
179
+ ```
180
+
181
+ Use AskUserQuestion:
182
+ - question: "Proceed with revert?"
183
+ - header: "Approve?"
184
+ - options: Approve | Abort
185
+
186
+ If "Abort": display "Revert cancelled. No changes made." and exit.
187
+ If "Approve": ask for a reason:
188
+
189
+ ```
190
+ AskUserQuestion(
191
+ header: "Reason",
192
+ question: "Brief reason for the revert (used in commit message):",
193
+ options: []
194
+ )
195
+ ```
196
+
197
+ Store the response as REVERT_REASON. Continue to execute_revert.
198
+ </step>
199
+
200
+ <step name="execute_revert">
201
+ **HARD CONSTRAINT: Use git revert --no-commit. NEVER use git reset (except for conflict cleanup as documented below).**
202
+
203
+ **Dirty-tree guard (run first, before any revert):**
204
+
205
+ Run `git status --porcelain`. If the output is non-empty, display the dirty files and abort:
206
+ ```
207
+ Working tree has uncommitted changes. Commit or stash them before running /sdd-undo.
208
+ ```
209
+ Exit immediately — do not proceed to any revert operations.
210
+
211
+ ---
212
+
213
+ Sort COMMITS in reverse chronological order (newest first). If commits came from git log (already newest-first), they are already in correct order.
214
+
215
+ For each commit hash in COMMITS:
216
+ ```bash
217
+ git revert --no-commit ${HASH}
218
+ ```
219
+
220
+ If any revert fails (merge conflict or error):
221
+ 1. Display the error message
222
+ 2. Run cleanup — handle both first-call and mid-sequence cases:
223
+ ```bash
224
+ # Try git revert --abort first (works if this is the first failed revert)
225
+ git revert --abort 2>/dev/null
226
+ # If prior --no-commit reverts already staged cleanly before this failure,
227
+ # revert --abort may be a no-op. Clean up staged and working tree changes:
228
+ git reset HEAD 2>/dev/null
229
+ git restore . 2>/dev/null
230
+ ```
231
+ 3. Display:
232
+ ```
233
+ ╔══════════════════════════════════════════════════════════════╗
234
+ ║ ERROR ║
235
+ ╚══════════════════════════════════════════════════════════════╝
236
+
237
+ Revert failed on commit ${HASH}.
238
+ Likely cause: merge conflict with subsequent changes.
239
+
240
+ **To fix:** Resolve the conflict manually or revert commits individually.
241
+ All pending reverts have been aborted — working tree is clean.
242
+ ```
243
+ 4. Exit with error.
244
+
245
+ After all reverts are staged successfully, create a single commit:
246
+
247
+ For MODE=phase:
248
+ ```bash
249
+ git commit -m "revert(${TARGET_PHASE}): undo phase ${TARGET_PHASE} — ${REVERT_REASON}"
250
+ ```
251
+
252
+ For MODE=plan:
253
+ ```bash
254
+ git commit -m "revert(${TARGET_PLAN}): undo plan ${TARGET_PLAN} — ${REVERT_REASON}"
255
+ ```
256
+
257
+ For MODE=last:
258
+ ```bash
259
+ git commit -m "revert: undo ${N} selected commits — ${REVERT_REASON}"
260
+ ```
261
+ </step>
262
+
263
+ <step name="summary">
264
+ Display the completion banner:
265
+
266
+ ```
267
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
268
+ SDD ► UNDO COMPLETE ✓
269
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
270
+ ```
271
+
272
+ Show summary:
273
+ ```
274
+ ✓ ${N} commit(s) reverted
275
+ ✓ Single revert commit created: ${REVERT_HASH}
276
+ ```
277
+
278
+ Show next steps:
279
+ ```
280
+ ───────────────────────────────────────────────────────────────
281
+
282
+ ## ▶ Next Up
283
+
284
+ **Review state** — verify project is in expected state after revert
285
+
286
+ /clear then:
287
+
288
+ /sdd-progress
289
+
290
+ ───────────────────────────────────────────────────────────────
291
+
292
+ **Also available:**
293
+ - `/sdd-execute-phase ${PHASE}` — re-execute if needed
294
+ - `/sdd-undo --last 1` — undo the revert itself if something went wrong
295
+
296
+ ───────────────────────────────────────────────────────────────
297
+ ```
298
+ </step>
299
+
300
+ </process>
301
+
302
+ <success_criteria>
303
+ - [ ] Arguments parsed correctly for all three modes
304
+ - [ ] --phase mode reads .planning/.phase-manifest.json using manifest.phases[TARGET_PHASE].commits
305
+ - [ ] --phase mode falls back to git log if manifest entry missing
306
+ - [ ] Dependency check warns when downstream phases have started (MODE=phase)
307
+ - [ ] Dependency check warns when later plans reference target plan outputs (MODE=plan)
308
+ - [ ] Dirty-tree guard aborts if working tree has uncommitted changes
309
+ - [ ] Confirmation gate shown before any revert execution
310
+ - [ ] Reverts use git revert --no-commit in reverse chronological order
311
+ - [ ] Single commit created after all reverts staged
312
+ - [ ] Error handling cleans up both first-call and mid-sequence conflict cases
313
+ - [ ] git reset --hard is NEVER used anywhere in this workflow
314
+ </success_criteria>