@ktpartners/dgs-platform 2.6.2

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 (256) hide show
  1. package/LICENSE +38 -0
  2. package/README.md +851 -0
  3. package/agents/dgs-codebase-cross-analyzer.md +183 -0
  4. package/agents/dgs-codebase-mapper.md +782 -0
  5. package/agents/dgs-codebase-synthesizer.md +156 -0
  6. package/agents/dgs-debugger.md +1256 -0
  7. package/agents/dgs-executor.md +550 -0
  8. package/agents/dgs-integration-checker.md +481 -0
  9. package/agents/dgs-nyquist-auditor.md +178 -0
  10. package/agents/dgs-phase-researcher.md +563 -0
  11. package/agents/dgs-phase-verifier.md +450 -0
  12. package/agents/dgs-plan-checker.md +708 -0
  13. package/agents/dgs-planner.md +1324 -0
  14. package/agents/dgs-project-researcher.md +631 -0
  15. package/agents/dgs-research-synthesizer.md +249 -0
  16. package/agents/dgs-roadmapper.md +652 -0
  17. package/agents/dgs-verifier.md +607 -0
  18. package/bin/install.js +2073 -0
  19. package/commands/dgs/add-doc.md +45 -0
  20. package/commands/dgs/add-idea.md +38 -0
  21. package/commands/dgs/add-phase.md +43 -0
  22. package/commands/dgs/add-repo.md +54 -0
  23. package/commands/dgs/add-tests.md +41 -0
  24. package/commands/dgs/add-todo.md +47 -0
  25. package/commands/dgs/approve-spec.md +38 -0
  26. package/commands/dgs/audit-milestone.md +36 -0
  27. package/commands/dgs/audit-phase.md +37 -0
  28. package/commands/dgs/cancel-job.md +23 -0
  29. package/commands/dgs/capture-principle.md +143 -0
  30. package/commands/dgs/check-todos.md +45 -0
  31. package/commands/dgs/cleanup.md +18 -0
  32. package/commands/dgs/complete-milestone.md +136 -0
  33. package/commands/dgs/complete-project.md +70 -0
  34. package/commands/dgs/consolidate-ideas.md +50 -0
  35. package/commands/dgs/create-milestone-job.md +37 -0
  36. package/commands/dgs/debug.md +164 -0
  37. package/commands/dgs/develop-idea.md +53 -0
  38. package/commands/dgs/discuss-idea.md +41 -0
  39. package/commands/dgs/discuss-phase.md +83 -0
  40. package/commands/dgs/execute-phase.md +41 -0
  41. package/commands/dgs/fast.md +38 -0
  42. package/commands/dgs/find-related-ideas.md +43 -0
  43. package/commands/dgs/health.md +28 -0
  44. package/commands/dgs/help.md +22 -0
  45. package/commands/dgs/import-spec.md +36 -0
  46. package/commands/dgs/init-product.md +28 -0
  47. package/commands/dgs/insert-phase.md +32 -0
  48. package/commands/dgs/join-discord.md +18 -0
  49. package/commands/dgs/list-docs.md +40 -0
  50. package/commands/dgs/list-ideas.md +42 -0
  51. package/commands/dgs/list-jobs.md +22 -0
  52. package/commands/dgs/list-phase-assumptions.md +46 -0
  53. package/commands/dgs/list-projects.md +57 -0
  54. package/commands/dgs/list-specs.md +40 -0
  55. package/commands/dgs/map-codebase.md +92 -0
  56. package/commands/dgs/new-milestone.md +44 -0
  57. package/commands/dgs/new-project.md +42 -0
  58. package/commands/dgs/node-repair.md +26 -0
  59. package/commands/dgs/overlap-check.md +20 -0
  60. package/commands/dgs/pause-work.md +38 -0
  61. package/commands/dgs/plan-milestone-gaps.md +34 -0
  62. package/commands/dgs/plan-phase.md +44 -0
  63. package/commands/dgs/progress.md +24 -0
  64. package/commands/dgs/quick.md +41 -0
  65. package/commands/dgs/reactivate-project.md +70 -0
  66. package/commands/dgs/reapply-patches.md +110 -0
  67. package/commands/dgs/refine-spec.md +38 -0
  68. package/commands/dgs/reject-idea.md +43 -0
  69. package/commands/dgs/remove-doc.md +44 -0
  70. package/commands/dgs/remove-phase.md +31 -0
  71. package/commands/dgs/remove-repo.md +69 -0
  72. package/commands/dgs/research-idea.md +43 -0
  73. package/commands/dgs/research-phase.md +189 -0
  74. package/commands/dgs/restore-idea.md +45 -0
  75. package/commands/dgs/resume-work.md +40 -0
  76. package/commands/dgs/rollback-job.md +24 -0
  77. package/commands/dgs/run-job.md +35 -0
  78. package/commands/dgs/search.md +40 -0
  79. package/commands/dgs/set-profile.md +34 -0
  80. package/commands/dgs/settings.md +38 -0
  81. package/commands/dgs/switch-project.md +58 -0
  82. package/commands/dgs/undo-consolidation.md +42 -0
  83. package/commands/dgs/update-idea.md +44 -0
  84. package/commands/dgs/update.md +37 -0
  85. package/commands/dgs/validate-phase.md +35 -0
  86. package/commands/dgs/verify-work.md +39 -0
  87. package/commands/dgs/write-spec.md +49 -0
  88. package/deliver-great-systems/.planning/phases/09-backend-wiring-and-error-handling/09-01-SUMMARY.md +84 -0
  89. package/deliver-great-systems/.planning/phases/09-backend-wiring-and-error-handling/09-02-SUMMARY.md +86 -0
  90. package/deliver-great-systems/.planning/phases/10-v1-to-v2-migration-flow/10-01-SUMMARY.md +85 -0
  91. package/deliver-great-systems/bin/dgs-tools.cjs +1444 -0
  92. package/deliver-great-systems/bin/lib/auto-test.cjs +1365 -0
  93. package/deliver-great-systems/bin/lib/commands.cjs +570 -0
  94. package/deliver-great-systems/bin/lib/config.cjs +417 -0
  95. package/deliver-great-systems/bin/lib/conflict-agent.cjs +1063 -0
  96. package/deliver-great-systems/bin/lib/conflict-agent.test.cjs +554 -0
  97. package/deliver-great-systems/bin/lib/context.cjs +929 -0
  98. package/deliver-great-systems/bin/lib/context.test.cjs +693 -0
  99. package/deliver-great-systems/bin/lib/core.cjs +744 -0
  100. package/deliver-great-systems/bin/lib/core.test.cjs +822 -0
  101. package/deliver-great-systems/bin/lib/docs.cjs +919 -0
  102. package/deliver-great-systems/bin/lib/docs.test.cjs +211 -0
  103. package/deliver-great-systems/bin/lib/execution.cjs +705 -0
  104. package/deliver-great-systems/bin/lib/execution.test.cjs +1472 -0
  105. package/deliver-great-systems/bin/lib/frontmatter.cjs +324 -0
  106. package/deliver-great-systems/bin/lib/ideas.cjs +1406 -0
  107. package/deliver-great-systems/bin/lib/ideas.test.cjs +1417 -0
  108. package/deliver-great-systems/bin/lib/identity.cjs +125 -0
  109. package/deliver-great-systems/bin/lib/init.cjs +1114 -0
  110. package/deliver-great-systems/bin/lib/init.test.cjs +1271 -0
  111. package/deliver-great-systems/bin/lib/jobs.cjs +2015 -0
  112. package/deliver-great-systems/bin/lib/jobs.test.cjs +2619 -0
  113. package/deliver-great-systems/bin/lib/merge-conflicts.cjs +654 -0
  114. package/deliver-great-systems/bin/lib/merge-conflicts.test.cjs +370 -0
  115. package/deliver-great-systems/bin/lib/migration.cjs +352 -0
  116. package/deliver-great-systems/bin/lib/migration.test.cjs +582 -0
  117. package/deliver-great-systems/bin/lib/milestone.cjs +243 -0
  118. package/deliver-great-systems/bin/lib/overlap.cjs +437 -0
  119. package/deliver-great-systems/bin/lib/overlap.test.cjs +747 -0
  120. package/deliver-great-systems/bin/lib/path-audit.test.cjs +384 -0
  121. package/deliver-great-systems/bin/lib/paths.cjs +144 -0
  122. package/deliver-great-systems/bin/lib/paths.test.cjs +486 -0
  123. package/deliver-great-systems/bin/lib/phase.cjs +910 -0
  124. package/deliver-great-systems/bin/lib/projects.cjs +691 -0
  125. package/deliver-great-systems/bin/lib/projects.test.cjs +871 -0
  126. package/deliver-great-systems/bin/lib/repos.cjs +1432 -0
  127. package/deliver-great-systems/bin/lib/repos.test.cjs +1882 -0
  128. package/deliver-great-systems/bin/lib/roadmap.cjs +305 -0
  129. package/deliver-great-systems/bin/lib/search.cjs +570 -0
  130. package/deliver-great-systems/bin/lib/specs.cjs +1303 -0
  131. package/deliver-great-systems/bin/lib/state.cjs +893 -0
  132. package/deliver-great-systems/bin/lib/template.cjs +228 -0
  133. package/deliver-great-systems/bin/lib/test-helpers.cjs +291 -0
  134. package/deliver-great-systems/bin/lib/verify.cjs +796 -0
  135. package/deliver-great-systems/references/checkpoints.md +776 -0
  136. package/deliver-great-systems/references/conflict-resolution.md +66 -0
  137. package/deliver-great-systems/references/context-tiers.md +166 -0
  138. package/deliver-great-systems/references/continuation-format.md +249 -0
  139. package/deliver-great-systems/references/decimal-phase-calculation.md +67 -0
  140. package/deliver-great-systems/references/git-integration.md +250 -0
  141. package/deliver-great-systems/references/git-planning-commit.md +40 -0
  142. package/deliver-great-systems/references/model-profile-resolution.md +36 -0
  143. package/deliver-great-systems/references/model-profiles.md +95 -0
  144. package/deliver-great-systems/references/phase-argument-parsing.md +61 -0
  145. package/deliver-great-systems/references/planning-config.md +224 -0
  146. package/deliver-great-systems/references/questioning.md +162 -0
  147. package/deliver-great-systems/references/spec-review-loop.md +177 -0
  148. package/deliver-great-systems/references/tdd.md +265 -0
  149. package/deliver-great-systems/references/ui-brand.md +160 -0
  150. package/deliver-great-systems/references/verification-patterns.md +612 -0
  151. package/deliver-great-systems/templates/DEBUG.md +166 -0
  152. package/deliver-great-systems/templates/UAT.md +251 -0
  153. package/deliver-great-systems/templates/VALIDATION.md +95 -0
  154. package/deliver-great-systems/templates/claude-md.md +74 -0
  155. package/deliver-great-systems/templates/codebase/architecture.md +257 -0
  156. package/deliver-great-systems/templates/codebase/concerns.md +312 -0
  157. package/deliver-great-systems/templates/codebase/conventions.md +309 -0
  158. package/deliver-great-systems/templates/codebase/integrations.md +282 -0
  159. package/deliver-great-systems/templates/codebase/stack.md +188 -0
  160. package/deliver-great-systems/templates/codebase/structure.md +287 -0
  161. package/deliver-great-systems/templates/codebase/testing.md +482 -0
  162. package/deliver-great-systems/templates/config.json +38 -0
  163. package/deliver-great-systems/templates/context.md +354 -0
  164. package/deliver-great-systems/templates/continue-here.md +80 -0
  165. package/deliver-great-systems/templates/debug-subagent-prompt.md +93 -0
  166. package/deliver-great-systems/templates/discovery.md +148 -0
  167. package/deliver-great-systems/templates/milestone-archive.md +125 -0
  168. package/deliver-great-systems/templates/milestone.md +117 -0
  169. package/deliver-great-systems/templates/phase-prompt.md +615 -0
  170. package/deliver-great-systems/templates/planner-subagent-prompt.md +119 -0
  171. package/deliver-great-systems/templates/project.md +186 -0
  172. package/deliver-great-systems/templates/requirements.md +233 -0
  173. package/deliver-great-systems/templates/research-project/ARCHITECTURE.md +206 -0
  174. package/deliver-great-systems/templates/research-project/FEATURES.md +149 -0
  175. package/deliver-great-systems/templates/research-project/PITFALLS.md +202 -0
  176. package/deliver-great-systems/templates/research-project/STACK.md +122 -0
  177. package/deliver-great-systems/templates/research-project/SUMMARY.md +172 -0
  178. package/deliver-great-systems/templates/research.md +554 -0
  179. package/deliver-great-systems/templates/retrospective.md +54 -0
  180. package/deliver-great-systems/templates/roadmap.md +204 -0
  181. package/deliver-great-systems/templates/state.md +178 -0
  182. package/deliver-great-systems/templates/summary-complex.md +59 -0
  183. package/deliver-great-systems/templates/summary-minimal.md +41 -0
  184. package/deliver-great-systems/templates/summary-standard.md +48 -0
  185. package/deliver-great-systems/templates/summary.md +253 -0
  186. package/deliver-great-systems/templates/user-setup.md +313 -0
  187. package/deliver-great-systems/templates/verification-report.md +324 -0
  188. package/deliver-great-systems/workflows/add-doc.md +151 -0
  189. package/deliver-great-systems/workflows/add-idea.md +96 -0
  190. package/deliver-great-systems/workflows/add-phase.md +120 -0
  191. package/deliver-great-systems/workflows/add-tests.md +359 -0
  192. package/deliver-great-systems/workflows/add-todo.md +162 -0
  193. package/deliver-great-systems/workflows/approve-spec.md +194 -0
  194. package/deliver-great-systems/workflows/audit-milestone.md +364 -0
  195. package/deliver-great-systems/workflows/audit-phase.md +462 -0
  196. package/deliver-great-systems/workflows/cancel-job.md +108 -0
  197. package/deliver-great-systems/workflows/check-todos.md +181 -0
  198. package/deliver-great-systems/workflows/cleanup.md +247 -0
  199. package/deliver-great-systems/workflows/codereview.md +526 -0
  200. package/deliver-great-systems/workflows/complete-milestone.md +1298 -0
  201. package/deliver-great-systems/workflows/consolidate-ideas.md +365 -0
  202. package/deliver-great-systems/workflows/create-milestone-job.md +177 -0
  203. package/deliver-great-systems/workflows/develop-idea.md +544 -0
  204. package/deliver-great-systems/workflows/diagnose-issues.md +231 -0
  205. package/deliver-great-systems/workflows/discovery-phase.md +301 -0
  206. package/deliver-great-systems/workflows/discuss-idea.md +263 -0
  207. package/deliver-great-systems/workflows/discuss-phase.md +733 -0
  208. package/deliver-great-systems/workflows/execute-phase.md +571 -0
  209. package/deliver-great-systems/workflows/execute-plan.md +592 -0
  210. package/deliver-great-systems/workflows/find-related-ideas.md +271 -0
  211. package/deliver-great-systems/workflows/health.md +173 -0
  212. package/deliver-great-systems/workflows/help.md +997 -0
  213. package/deliver-great-systems/workflows/import-spec.md +381 -0
  214. package/deliver-great-systems/workflows/init-product.md +767 -0
  215. package/deliver-great-systems/workflows/insert-phase.md +138 -0
  216. package/deliver-great-systems/workflows/list-docs.md +119 -0
  217. package/deliver-great-systems/workflows/list-ideas.md +154 -0
  218. package/deliver-great-systems/workflows/list-jobs.md +89 -0
  219. package/deliver-great-systems/workflows/list-phase-assumptions.md +192 -0
  220. package/deliver-great-systems/workflows/list-specs.md +101 -0
  221. package/deliver-great-systems/workflows/map-codebase.md +621 -0
  222. package/deliver-great-systems/workflows/new-milestone.md +591 -0
  223. package/deliver-great-systems/workflows/new-project.md +1113 -0
  224. package/deliver-great-systems/workflows/node-repair.md +94 -0
  225. package/deliver-great-systems/workflows/overlap-check.md +86 -0
  226. package/deliver-great-systems/workflows/pause-work.md +134 -0
  227. package/deliver-great-systems/workflows/plan-milestone-gaps.md +306 -0
  228. package/deliver-great-systems/workflows/plan-phase.md +698 -0
  229. package/deliver-great-systems/workflows/progress.md +386 -0
  230. package/deliver-great-systems/workflows/quick.md +845 -0
  231. package/deliver-great-systems/workflows/refine-spec.md +275 -0
  232. package/deliver-great-systems/workflows/reject-idea.md +109 -0
  233. package/deliver-great-systems/workflows/remove-doc.md +117 -0
  234. package/deliver-great-systems/workflows/remove-phase.md +163 -0
  235. package/deliver-great-systems/workflows/research-idea.md +325 -0
  236. package/deliver-great-systems/workflows/research-phase.md +81 -0
  237. package/deliver-great-systems/workflows/restore-idea.md +101 -0
  238. package/deliver-great-systems/workflows/resume-project.md +311 -0
  239. package/deliver-great-systems/workflows/rollback-job.md +130 -0
  240. package/deliver-great-systems/workflows/run-job.md +498 -0
  241. package/deliver-great-systems/workflows/search.md +130 -0
  242. package/deliver-great-systems/workflows/set-profile.md +83 -0
  243. package/deliver-great-systems/workflows/settings.md +470 -0
  244. package/deliver-great-systems/workflows/transition.md +563 -0
  245. package/deliver-great-systems/workflows/undo-consolidation.md +155 -0
  246. package/deliver-great-systems/workflows/update-idea.md +157 -0
  247. package/deliver-great-systems/workflows/update.md +242 -0
  248. package/deliver-great-systems/workflows/validate-phase.md +177 -0
  249. package/deliver-great-systems/workflows/verify-phase.md +253 -0
  250. package/deliver-great-systems/workflows/verify-work.md +671 -0
  251. package/deliver-great-systems/workflows/write-spec.md +450 -0
  252. package/hooks/dist/dgs-check-update.js +62 -0
  253. package/hooks/dist/dgs-context-monitor.js +141 -0
  254. package/hooks/dist/dgs-statusline.js +115 -0
  255. package/package.json +60 -0
  256. package/scripts/build-hooks.js +43 -0
@@ -0,0 +1,194 @@
1
+ <purpose>
2
+ Approve a draft spec by running completeness validation (required sections, P0 requirements, blocking open questions), presenting warnings for optional sections, and transitioning to final status with an approved_date and Refinement Log entry. If the spec is already final, show an informational message and make no changes. This is the core approval pipeline for the `/dgs:approve-spec` command.
3
+ </purpose>
4
+
5
+ <context_tier>planning</context_tier>
6
+
7
+ <required_reading>
8
+ Read all files referenced by the invoking prompt's execution_context before starting.
9
+ </required_reading>
10
+
11
+ <process>
12
+
13
+ <step name="initialize" priority="first">
14
+ Load planning context:
15
+
16
+ ```bash
17
+ INIT=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs init milestone-op)
18
+ ```
19
+
20
+ Extract: `project_root`, `config_path` as needed by the workflow.
21
+
22
+ Load planning-tier context files (spec scope added after slug is parsed):
23
+
24
+ ```bash
25
+ TIER_FILES=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" context load-tier planning --raw 2>/dev/null)
26
+ ```
27
+ </step>
28
+
29
+ <step name="parse_arguments">
30
+ Extract the spec slug from `$ARGUMENTS`.
31
+
32
+ **Spec slug extraction:**
33
+ - The first positional argument is the spec slug (required).
34
+ - If no argument is provided, display an error and stop:
35
+ ```
36
+ Usage: /dgs:approve-spec <spec-slug>
37
+ ```
38
+ - Store the value as `SPEC_SLUG`.
39
+ </step>
40
+
41
+ <step name="load_and_check_status">
42
+ Find the spec and check whether it is already approved.
43
+
44
+ 1. Run the validate command to get validation results and spec identity:
45
+ ```bash
46
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs specs validate --id "$SPEC_SLUG"
47
+ ```
48
+ 2. Parse the JSON output to extract: `id`, `valid`, `errors`, `warnings`, `error_count`, `warning_count`.
49
+ 3. Also read the spec file directly using the Read tool to check the current `status` and `version` from frontmatter.
50
+
51
+ **Already-final gate (APR-04):**
52
+ If the spec's status is already `final`, display an informational message:
53
+ ```
54
+ This spec is already approved (v{version}, approved {approved_date}).
55
+ No changes needed.
56
+ ```
57
+ Stop execution. Do NOT run further validation, do NOT modify any files.
58
+ </step>
59
+
60
+ <step name="load_spec_docs">
61
+ Load the spec's supporting documents for approval context.
62
+
63
+ 1. Derive the spec's docs directory:
64
+ Use the spec file path from the validate step to find docs/:
65
+ ```bash
66
+ SPEC_DOCS_DIR="$(dirname "${SPEC_FILE_PATH}")/docs"
67
+ ```
68
+ Or derive from spec slug: `${project_root}/specs/${SPEC_SLUG}/docs`
69
+
70
+ 2. If docs/ exists, read all files:
71
+ - **Text files** (.md, .txt, .json, .yaml, .yml): Read with Read tool
72
+ - **Image files** (.png, .jpg, .jpeg, .gif, .svg, .webp): Read with Read tool (multimodal). Cap at 5 images.
73
+ - **PDF files** (.pdf): Prefer .txt sidecar, fallback to 5 pages via Read tool
74
+ - **Other files**: skip silently
75
+ - If docs/ does not exist: silent skip
76
+ - If any file is unreadable: skip silently
77
+
78
+ These docs provide context for evaluating the spec's completeness during approval.
79
+ </step>
80
+
81
+ <step name="check_blocking_open_questions">
82
+ Read the spec file content and locate the `## Open Questions` section (if it exists).
83
+
84
+ Evaluate whether any open questions are blocking:
85
+ - Look for explicit markers first: `[BLOCKING]`, `(blocking)`, `[Unresolved]`
86
+ - Use judgment: questions describing fundamental uncertainties that make implementation impossible, or referencing missing decisions that affect P0 requirements, count as blocking.
87
+ - Questions about nice-to-haves, future scope, or already-deferred items are NOT blocking.
88
+
89
+ If blocking questions are found, add them to the errors list with clear descriptions:
90
+ ```
91
+ { code: 'BLOCKING_QUESTION', message: 'Blocking open question: <summary of the question>' }
92
+ ```
93
+ </step>
94
+
95
+ <step name="error_gate">
96
+ Combine errors from the validate command (step 3) with any blocking open questions (step 4).
97
+
98
+ If total errors > 0:
99
+ - Display all errors with clear formatting:
100
+ ```
101
+ ## Approval Blocked
102
+
103
+ The following issues must be resolved before this spec can be approved:
104
+
105
+ - [error message 1]
106
+ - [error message 2]
107
+ ...
108
+
109
+ Run /dgs:refine-spec <spec-slug> to address these issues.
110
+ ```
111
+ - Stop execution. Do NOT proceed to approval.
112
+
113
+ This enforces APR-02.
114
+ </step>
115
+
116
+ <step name="warning_gate">
117
+ **Check for roadmap linkage:**
118
+
119
+ Read the spec's frontmatter for a `milestones` field (array of milestone references). If the field is empty, null, or absent, add an informational warning to the warnings list:
120
+
121
+ ```
122
+ - This spec has no roadmap linkage (no milestones field). Consider linking it to a milestone for implementation tracking.
123
+ ```
124
+
125
+ This is a warning, not a blocker. It runs after structural validation so it appears alongside other warnings in this gate.
126
+
127
+ If warnings exist (from validate command output, plus any roadmap linkage warning added above):
128
+ - Display each warning clearly:
129
+ ```
130
+ ## Approval Warnings
131
+
132
+ The following items need attention:
133
+
134
+ - [warning message 1]
135
+ - [warning message 2]
136
+ ```
137
+ - Ask the user using AskUserQuestion: "Approve this spec despite these warnings? (yes/no)"
138
+ - If the user declines (answers "no", "n", or "cancel"):
139
+ - Suggest running `/dgs:refine-spec <spec-slug>` to address them.
140
+ - Stop execution.
141
+ - If the user confirms (answers "yes", "y", or any affirmative): proceed to approval.
142
+
143
+ If no warnings exist: proceed directly to approval.
144
+
145
+ This enforces APR-03.
146
+ </step>
147
+
148
+ <step name="execute_approval">
149
+ Perform the approval state transition and audit trail update.
150
+
151
+ 1. Run `set-status` to transition to final (this auto-sets `approved_date`):
152
+ ```bash
153
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs specs set-status --id "$SPEC_SLUG" --status final
154
+ ```
155
+
156
+ 2. Run `add-log-entry` to record the approval in the Refinement Log:
157
+ ```bash
158
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs specs add-log-entry --id "$SPEC_SLUG" --date "$(date +%Y-%m-%d)" --version "$VERSION" --action Approved --summary "Spec approved after completeness validation"
159
+ ```
160
+
161
+ 3. Determine the spec filename from the validate output or Read step.
162
+
163
+ 4. Commit the changes:
164
+ ```bash
165
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "specs: approve $SPEC_ID v$VERSION" --files "$SPEC_FILE_PATH"
166
+ ```
167
+ </step>
168
+
169
+ <step name="confirmation">
170
+ Display the approval confirmation:
171
+
172
+ ```
173
+ Spec approved: {title} (v{version})
174
+ ```
175
+
176
+ Suggest next steps:
177
+
178
+ ```
179
+ Next steps:
180
+ - Run /dgs:new-milestone to create a milestone from this spec
181
+ ```
182
+ </step>
183
+
184
+ </process>
185
+
186
+ <success_criteria>
187
+ - [ ] Draft spec transitions to final status with approved_date set
188
+ - [ ] Approval log entry added to Refinement Log
189
+ - [ ] Already-final specs show informational message with no changes
190
+ - [ ] Validation errors block approval with clear messages
191
+ - [ ] Validation warnings allow user confirmation before proceeding
192
+ - [ ] Blocking open questions are detected and treated as errors
193
+ - [ ] Changes committed to git
194
+ </success_criteria>
@@ -0,0 +1,364 @@
1
+ <purpose>
2
+ Verify milestone achieved its definition of done by aggregating phase verifications, checking cross-phase integration, and assessing requirements coverage. Reads existing VERIFICATION.md files (phases already verified during execute-phase), aggregates tech debt and deferred gaps, then spawns integration checker for cross-phase wiring.
3
+ </purpose>
4
+
5
+ <context_tier>verification</context_tier>
6
+
7
+ <required_reading>
8
+ Read all files referenced by the invoking prompt's execution_context before starting.
9
+ </required_reading>
10
+
11
+ <process>
12
+
13
+ ## 0. Initialize Milestone Context
14
+
15
+ ```bash
16
+ INIT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" init milestone-op)
17
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
18
+ ```
19
+
20
+ Extract from init JSON: `milestone_version`, `milestone_name`, `phase_count`, `completed_phases`, `commit_docs`.
21
+
22
+ **Load verification tier context:**
23
+
24
+ ```bash
25
+ LAST_PHASE=$(echo "$completed_phases" | tail -1)
26
+ TIER_FILES=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" context load-tier verification --phase "${LAST_PHASE}" --raw 2>/dev/null)
27
+ ```
28
+
29
+ This provides base verification context for the last phase. For cross-phase audit, the workflow still manually reads all phase VERIFICATION.md files in step 2 (the tier provides only the current phase's verification artifacts).
30
+
31
+ Resolve integration checker model:
32
+ ```bash
33
+ integration_checker_model=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" resolve-model dgs-integration-checker --raw)
34
+ ```
35
+
36
+ ## 1. Determine Milestone Scope
37
+
38
+ ```bash
39
+ # Get phases in milestone (sorted numerically, handles decimals)
40
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" phases list
41
+ ```
42
+
43
+ - Parse version from arguments or detect current from ROADMAP.md
44
+ - Identify all phase directories in scope
45
+ - Extract milestone definition of done from ROADMAP.md
46
+ - Extract requirements mapped to this milestone from REQUIREMENTS.md
47
+
48
+ ## 2. Read All Phase Verifications
49
+
50
+ For each phase directory, read the VERIFICATION.md:
51
+
52
+ ```bash
53
+ # For each phase, use find-phase to resolve the directory (handles archived phases)
54
+ PHASE_INFO=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" find-phase 01 --raw)
55
+ # Extract directory from JSON, then read VERIFICATION.md from that directory
56
+ # Repeat for each phase number from ROADMAP.md
57
+ ```
58
+
59
+ From each VERIFICATION.md, extract:
60
+ - **Status:** passed | gaps_found
61
+ - **Critical gaps:** (if any — these are blockers)
62
+ - **Non-critical gaps:** tech debt, deferred items, warnings
63
+ - **Anti-patterns found:** TODOs, stubs, placeholders
64
+ - **Requirements coverage:** which requirements satisfied/blocked
65
+
66
+ If a phase is missing VERIFICATION.md, flag it as "unverified phase" — this is a blocker.
67
+
68
+ ## 3. Spawn Integration Checker
69
+
70
+ With phase context collected:
71
+
72
+ Extract `MILESTONE_REQ_IDS` from REQUIREMENTS.md traceability table — all REQ-IDs assigned to phases in this milestone.
73
+
74
+ **Multi-repo resolution (REQUIRED before spawning):**
75
+
76
+ In multi-project setups, code lives in separate repos from the planning repo. The integration checker needs actual code repo paths to search for imports/exports.
77
+
78
+ ```bash
79
+ # Read REPOS.md from the planning root (product-level, not project-level)
80
+ REPOS_CONTENT=$(cat $(dirname "${project_root}")/REPOS.md 2>/dev/null || cat ${project_root}/REPOS.md 2>/dev/null || echo "")
81
+ ```
82
+
83
+ If REPOS.md exists and contains repo entries:
84
+ 1. Parse each repo row for name and path
85
+ 2. Resolve absolute paths: `realpath $(dirname "${project_root}")/{repo_path}`
86
+ 3. Include resolved paths in the integration checker prompt (see below)
87
+
88
+ If no REPOS.md exists (single-repo setup), skip this step — the integration checker will use its default `src/` search path.
89
+
90
+ ```
91
+ Task(
92
+ prompt="Check cross-phase integration and E2E flows.
93
+
94
+ Phases: {phase_dirs}
95
+ Phase exports: {from SUMMARYs}
96
+ API routes: {routes created}
97
+
98
+ {If REPOS.md exists and has entries:}
99
+ Repo Paths (from REPOS.md — search these directories for code instead of src/):
100
+ {For each repo: name: {name}, path: {resolved_absolute_path}}
101
+ {End if}
102
+
103
+ Milestone Requirements:
104
+ {MILESTONE_REQ_IDS — list each REQ-ID with description and assigned phase}
105
+
106
+ MUST map each integration finding to affected requirement IDs where applicable.
107
+
108
+ Verify cross-phase wiring and E2E user flows.",
109
+ subagent_type="dgs-integration-checker",
110
+ model="{integration_checker_model}"
111
+ )
112
+ ```
113
+
114
+ ## 4. Collect Results
115
+
116
+ Combine:
117
+ - Phase-level gaps and tech debt (from step 2)
118
+ - Integration checker's report (wiring gaps, broken flows)
119
+
120
+ ## 5. Check Requirements Coverage (3-Source Cross-Reference)
121
+
122
+ MUST cross-reference three independent sources for each requirement:
123
+
124
+ ### 5a. Parse REQUIREMENTS.md Traceability Table
125
+
126
+ Extract all REQ-IDs mapped to milestone phases from the traceability table:
127
+ - Requirement ID, description, assigned phase, current status, checked-off state (`[x]` vs `[ ]`)
128
+
129
+ ### 5b. Parse Phase VERIFICATION.md Requirements Tables
130
+
131
+ For each phase's VERIFICATION.md, extract the expanded requirements table:
132
+ - Requirement | Source Plan | Description | Status | Evidence
133
+ - Map each entry back to its REQ-ID
134
+
135
+ ### 5c. Extract SUMMARY.md Frontmatter Cross-Check
136
+
137
+ For each phase's SUMMARY.md, extract `requirements-completed` from YAML frontmatter:
138
+ ```bash
139
+ for summary in ${project_root}/phases/*-*/*-SUMMARY.md; do
140
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" summary-extract "$summary" --fields requirements_completed | jq -r '.requirements_completed'
141
+ done
142
+ ```
143
+
144
+ ### 5d. Status Determination Matrix
145
+
146
+ For each REQ-ID, determine status using all three sources:
147
+
148
+ | VERIFICATION.md Status | SUMMARY Frontmatter | REQUIREMENTS.md | → Final Status |
149
+ |------------------------|---------------------|-----------------|----------------|
150
+ | passed | listed | `[x]` | **satisfied** |
151
+ | passed | listed | `[ ]` | **satisfied** (update checkbox) |
152
+ | passed | missing | any | **partial** (verify manually) |
153
+ | gaps_found | any | any | **unsatisfied** |
154
+ | missing | listed | any | **partial** (verification gap) |
155
+ | missing | missing | any | **unsatisfied** |
156
+
157
+ ### 5e. FAIL Gate and Orphan Detection
158
+
159
+ **REQUIRED:** Any `unsatisfied` requirement MUST force `gaps_found` status on the milestone audit.
160
+
161
+ **Orphan detection:** Requirements present in REQUIREMENTS.md traceability table but absent from ALL phase VERIFICATION.md files MUST be flagged as orphaned. Orphaned requirements are treated as `unsatisfied` — they were assigned but never verified by any phase.
162
+
163
+ ## 5.5. Nyquist Compliance Discovery
164
+
165
+ Skip if `workflow.nyquist_validation` is explicitly `false` (absent = enabled).
166
+
167
+ ```bash
168
+ NYQUIST_CONFIG=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" config get workflow.nyquist_validation --raw 2>/dev/null)
169
+ ```
170
+
171
+ If `false`: skip entirely.
172
+
173
+ For each phase directory, check `*-VALIDATION.md`. If exists, parse frontmatter (`nyquist_compliant`, `wave_0_complete`).
174
+
175
+ Classify per phase:
176
+
177
+ | Status | Condition |
178
+ |--------|-----------|
179
+ | COMPLIANT | `nyquist_compliant: true` and all tasks green |
180
+ | PARTIAL | VALIDATION.md exists, `nyquist_compliant: false` or red/pending |
181
+ | MISSING | No VALIDATION.md |
182
+
183
+ Add to audit YAML: `nyquist: { compliant_phases, partial_phases, missing_phases, overall }`
184
+
185
+ Discovery only — never auto-calls `/dgs:validate-phase`.
186
+
187
+ ## 6. Aggregate into v{version}-MILESTONE-AUDIT.md
188
+
189
+ Create `${project_root}/v{version}-MILESTONE-AUDIT.md` with:
190
+
191
+ ```yaml
192
+ ---
193
+ milestone: {version}
194
+ audited: {timestamp}
195
+ status: passed | gaps_found | tech_debt
196
+ scores:
197
+ requirements: N/M
198
+ phases: N/M
199
+ integration: N/M
200
+ flows: N/M
201
+ gaps: # Critical blockers
202
+ requirements:
203
+ - id: "{REQ-ID}"
204
+ status: "unsatisfied | partial | orphaned"
205
+ phase: "{assigned phase}"
206
+ claimed_by_plans: ["{plan files that reference this requirement}"]
207
+ completed_by_plans: ["{plan files whose SUMMARY marks it complete}"]
208
+ verification_status: "passed | gaps_found | missing | orphaned"
209
+ evidence: "{specific evidence or lack thereof}"
210
+ integration: [...]
211
+ flows: [...]
212
+ tech_debt: # Non-critical, deferred
213
+ - phase: 01-auth
214
+ items:
215
+ - "TODO: add rate limiting"
216
+ - "Warning: no password strength validation"
217
+ - phase: 03-dashboard
218
+ items:
219
+ - "Deferred: mobile responsive layout"
220
+ ---
221
+ ```
222
+
223
+ Plus full markdown report with tables for requirements, phases, integration, tech debt.
224
+
225
+ **Status values:**
226
+ - `passed` — all requirements met, no critical gaps, minimal tech debt
227
+ - `gaps_found` — critical blockers exist
228
+ - `tech_debt` — no blockers but accumulated deferred items need review
229
+
230
+ ## 7. Present Results
231
+
232
+ Route by status (see `<offer_next>`).
233
+
234
+ </process>
235
+
236
+ <offer_next>
237
+ Output this markdown directly (not as a code block). Route based on status:
238
+
239
+ ---
240
+
241
+ **If passed:**
242
+
243
+ ## ✓ Milestone {version} — Audit Passed
244
+
245
+ **Score:** {N}/{M} requirements satisfied
246
+ **Report:** ${project_root}/v{version}-MILESTONE-AUDIT.md
247
+
248
+ All requirements covered. Cross-phase integration verified. E2E flows complete.
249
+
250
+ ───────────────────────────────────────────────────────────────
251
+
252
+ ## ▶ Next Up
253
+
254
+ **Complete milestone** — archive and tag
255
+
256
+ /dgs:complete-milestone {version}
257
+
258
+ <sub>/clear first → fresh context window</sub>
259
+
260
+ ───────────────────────────────────────────────────────────────
261
+
262
+ ---
263
+
264
+ **If gaps_found:**
265
+
266
+ ## ⚠ Milestone {version} — Gaps Found
267
+
268
+ **Score:** {N}/{M} requirements satisfied
269
+ **Report:** ${project_root}/v{version}-MILESTONE-AUDIT.md
270
+
271
+ ### Unsatisfied Requirements
272
+
273
+ {For each unsatisfied requirement:}
274
+ - **{REQ-ID}: {description}** (Phase {X})
275
+ - {reason}
276
+
277
+ ### Cross-Phase Issues
278
+
279
+ {For each integration gap:}
280
+ - **{from} → {to}:** {issue}
281
+
282
+ ### Broken Flows
283
+
284
+ {For each flow gap:}
285
+ - **{flow name}:** breaks at {step}
286
+
287
+ ### Nyquist Coverage
288
+
289
+ | Phase | VALIDATION.md | Compliant | Action |
290
+ |-------|---------------|-----------|--------|
291
+ | {phase} | exists/missing | true/false/partial | `/dgs:validate-phase {N}` |
292
+
293
+ Phases needing validation: run `/dgs:validate-phase {N}` for each flagged phase.
294
+
295
+ ───────────────────────────────────────────────────────────────
296
+
297
+ ## ▶ Next Up
298
+
299
+ **Plan gap closure** — create phases to complete milestone
300
+
301
+ /dgs:plan-milestone-gaps
302
+
303
+ <sub>/clear first → fresh context window</sub>
304
+
305
+ ───────────────────────────────────────────────────────────────
306
+
307
+ **Also available:**
308
+ - cat ${project_root}/v{version}-MILESTONE-AUDIT.md — see full report
309
+ - /dgs:complete-milestone {version} — proceed anyway (accept tech debt)
310
+
311
+ ───────────────────────────────────────────────────────────────
312
+
313
+ ---
314
+
315
+ **If tech_debt (no blockers but accumulated debt):**
316
+
317
+ ## ⚡ Milestone {version} — Tech Debt Review
318
+
319
+ **Score:** {N}/{M} requirements satisfied
320
+ **Report:** ${project_root}/v{version}-MILESTONE-AUDIT.md
321
+
322
+ All requirements met. No critical blockers. Accumulated tech debt needs review.
323
+
324
+ ### Tech Debt by Phase
325
+
326
+ {For each phase with debt:}
327
+ **Phase {X}: {name}**
328
+ - {item 1}
329
+ - {item 2}
330
+
331
+ ### Total: {N} items across {M} phases
332
+
333
+ ───────────────────────────────────────────────────────────────
334
+
335
+ ## ▶ Options
336
+
337
+ **A. Complete milestone** — accept debt, track in backlog
338
+
339
+ /dgs:complete-milestone {version}
340
+
341
+ **B. Plan cleanup phase** — address debt before completing
342
+
343
+ /dgs:plan-milestone-gaps
344
+
345
+ <sub>/clear first → fresh context window</sub>
346
+
347
+ ───────────────────────────────────────────────────────────────
348
+ </offer_next>
349
+
350
+ <success_criteria>
351
+ - [ ] Milestone scope identified
352
+ - [ ] All phase VERIFICATION.md files read
353
+ - [ ] SUMMARY.md `requirements-completed` frontmatter extracted for each phase
354
+ - [ ] REQUIREMENTS.md traceability table parsed for all milestone REQ-IDs
355
+ - [ ] 3-source cross-reference completed (VERIFICATION + SUMMARY + traceability)
356
+ - [ ] Orphaned requirements detected (in traceability but absent from all VERIFICATIONs)
357
+ - [ ] Tech debt and deferred gaps aggregated
358
+ - [ ] Integration checker spawned with milestone requirement IDs
359
+ - [ ] v{version}-MILESTONE-AUDIT.md created with structured requirement gap objects
360
+ - [ ] FAIL gate enforced — any unsatisfied requirement forces gaps_found status
361
+ - [ ] Nyquist compliance scanned for all milestone phases (if enabled)
362
+ - [ ] Missing VALIDATION.md phases flagged with validate-phase suggestion
363
+ - [ ] Results presented with actionable next steps
364
+ </success_criteria>