@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,157 @@
1
+ <purpose>
2
+ Update an existing idea's fields (title, body, tags) interactively, or append a timestamped note via the --note flag. Enables idea refinement over time without losing the original capture.
3
+ </purpose>
4
+
5
+ <context_tier>lite</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="load_context" priority="first">
14
+ Load project context via tier system:
15
+
16
+ ```bash
17
+ TIER_FILES=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" context load-tier lite --raw 2>/dev/null)
18
+ ```
19
+
20
+ Use `TIER_FILES` JSON `files` array for project context (PROJECT.md, STATE.md, config.json).
21
+ </step>
22
+
23
+ <step name="parse_arguments">
24
+ Parse the arguments string:
25
+
26
+ - Extract idea ID: first positional argument, or `--id N`
27
+ - Check for `--note "text"` flag
28
+
29
+ Examples:
30
+ - `/dgs:update-idea 42` -> id=42, no note
31
+ - `/dgs:update-idea 42 --note "This could also solve X"` -> id=42, note="This could also solve X"
32
+ - `/dgs:update-idea --id 42 --note "Revisited this"` -> id=42, note="Revisited this"
33
+
34
+ If no ID provided, list pending ideas and prompt user to select one:
35
+
36
+ ```bash
37
+ PENDING=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs ideas list --state pending --raw)
38
+ ```
39
+
40
+ Parse the JSON `ideas` array. If empty, display:
41
+ ```
42
+ No pending ideas to update. Run /dgs:add-idea to capture one.
43
+ ```
44
+ Exit.
45
+
46
+ If ideas exist, display them as a numbered list and use AskUserQuestion:
47
+ - header: "Select Idea"
48
+ - question: "Which idea would you like to update?"
49
+ - Provide the numbered idea options
50
+
51
+ Extract the selected idea's ID.
52
+ </step>
53
+
54
+ <step name="find_idea">
55
+ Look up the idea by ID across all states:
56
+
57
+ ```bash
58
+ LIST=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs ideas list --raw)
59
+ ```
60
+
61
+ Parse JSON, find the idea by ID. If not found:
62
+ ```
63
+ Idea #${id} not found.
64
+ ```
65
+ Exit.
66
+
67
+ Note the idea's current state, title, tags, and body for display.
68
+ </step>
69
+
70
+ <step name="branch_note_or_interactive">
71
+ **If `--note` flag is present:** Go to step "append_note".
72
+ **Otherwise:** Go to step "interactive_update".
73
+ </step>
74
+
75
+ <step name="append_note">
76
+ Append a timestamped note to the idea (per IDEAS-05):
77
+
78
+ ```bash
79
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs ideas append-note --id "${id}" --note "${noteText}" --raw
80
+ ```
81
+
82
+ Parse JSON result to confirm success. Go to step "git_commit".
83
+ </step>
84
+
85
+ <step name="interactive_update">
86
+ Show the user what currently exists for the idea:
87
+
88
+ ```
89
+ ## Idea #${id}: ${title}
90
+
91
+ **Tags:** ${tags.join(", ") || "none"}
92
+ **State:** ${state}
93
+
94
+ ${body}
95
+ ```
96
+
97
+ Use AskUserQuestion to ask which field to change:
98
+ - header: "Update Idea #${id}"
99
+ - question: "Which field would you like to update?"
100
+ - options: "Title", "Body", "Tags"
101
+
102
+ Based on selection, use AskUserQuestion to prompt for the new value:
103
+
104
+ **Title:** "Enter new title:" (show current as reference)
105
+ **Body:** "Enter new body text:" (show current as reference)
106
+ **Tags:** "Enter new tags (comma-separated):" (show current as reference)
107
+
108
+ Then call:
109
+ ```bash
110
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs ideas update --id "${id}" --field "${field}" --value "${newValue}" --raw
111
+ ```
112
+
113
+ Parse JSON result to confirm success. Go to step "git_commit".
114
+ </step>
115
+
116
+ <step name="git_commit">
117
+ Determine the file path from the update/append-note result.
118
+
119
+ Find the idea file to get the current path:
120
+ ```bash
121
+ LIST=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs ideas list --raw)
122
+ ```
123
+
124
+ Parse to find the idea's state and filename, then commit:
125
+
126
+ ```bash
127
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "ideas: update #${id} - ${field}" --files ${path}
128
+ ```
129
+
130
+ For note appends, use:
131
+ ```bash
132
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "ideas: add note to #${id}" --files ${path}
133
+ ```
134
+ </step>
135
+
136
+ <step name="confirm">
137
+ Display minimal confirmation:
138
+
139
+ For note append:
140
+ ```
141
+ Note added to Idea #${id}.
142
+ ```
143
+
144
+ For field update:
145
+ ```
146
+ Idea #${id} updated.
147
+ ```
148
+ </step>
149
+
150
+ </process>
151
+
152
+ <success_criteria>
153
+ - [ ] Idea file updated with new field value or appended note
154
+ - [ ] Updated timestamp in frontmatter
155
+ - [ ] Git commit created
156
+ - [ ] Minimal confirmation
157
+ </success_criteria>
@@ -0,0 +1,242 @@
1
+ <purpose>
2
+ Check for DGS updates via npm, display changelog for versions between installed and latest, obtain user confirmation, and execute clean installation with cache clearing.
3
+ </purpose>
4
+
5
+ <context_tier>none</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="get_installed_version">
14
+ Detect whether DGS is installed locally or globally by checking both locations and validating install integrity:
15
+
16
+ ```bash
17
+ # Check local first (takes priority only if valid)
18
+ # Detect runtime config directory (supports Claude, OpenCode, Gemini)
19
+ LOCAL_VERSION_FILE="" LOCAL_MARKER_FILE="" LOCAL_DIR=""
20
+ for dir in .claude .config/opencode .opencode .gemini; do
21
+ if [ -f "./$dir/deliver-great-systems/VERSION" ]; then
22
+ LOCAL_VERSION_FILE="./$dir/deliver-great-systems/VERSION"
23
+ LOCAL_MARKER_FILE="./$dir/deliver-great-systems/workflows/update.md"
24
+ LOCAL_DIR="$(cd "./$dir" 2>/dev/null && pwd)"
25
+ break
26
+ fi
27
+ done
28
+ GLOBAL_VERSION_FILE="" GLOBAL_MARKER_FILE="" GLOBAL_DIR=""
29
+ for dir in .claude .config/opencode .opencode .gemini; do
30
+ if [ -f "$HOME/$dir/deliver-great-systems/VERSION" ]; then
31
+ GLOBAL_VERSION_FILE="$HOME/$dir/deliver-great-systems/VERSION"
32
+ GLOBAL_MARKER_FILE="$HOME/$dir/deliver-great-systems/workflows/update.md"
33
+ GLOBAL_DIR="$(cd "$HOME/$dir" 2>/dev/null && pwd)"
34
+ break
35
+ fi
36
+ done
37
+
38
+ # Only treat as LOCAL if the resolved paths differ (prevents misdetection when CWD=$HOME)
39
+ IS_LOCAL=false
40
+ if [ -n "$LOCAL_VERSION_FILE" ] && [ -f "$LOCAL_VERSION_FILE" ] && [ -f "$LOCAL_MARKER_FILE" ] && grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+' "$LOCAL_VERSION_FILE"; then
41
+ if [ -z "$GLOBAL_DIR" ] || [ "$LOCAL_DIR" != "$GLOBAL_DIR" ]; then
42
+ IS_LOCAL=true
43
+ fi
44
+ fi
45
+
46
+ if [ "$IS_LOCAL" = true ]; then
47
+ cat "$LOCAL_VERSION_FILE"
48
+ echo "LOCAL"
49
+ elif [ -n "$GLOBAL_VERSION_FILE" ] && [ -f "$GLOBAL_VERSION_FILE" ] && [ -f "$GLOBAL_MARKER_FILE" ] && grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+' "$GLOBAL_VERSION_FILE"; then
50
+ cat "$GLOBAL_VERSION_FILE"
51
+ echo "GLOBAL"
52
+ else
53
+ echo "UNKNOWN"
54
+ fi
55
+ ```
56
+
57
+ Parse output:
58
+ - If last line is "LOCAL": local install is valid; installed version is first line; use `--local`
59
+ - If last line is "GLOBAL": local missing/invalid, global install is valid; installed version is first line; use `--global`
60
+ - If "UNKNOWN": proceed to install step (treat as version 0.0.0)
61
+
62
+ **If VERSION file missing:**
63
+ ```
64
+ ## DGS Update
65
+
66
+ **Installed version:** Unknown
67
+
68
+ Your installation doesn't include version tracking.
69
+
70
+ Running fresh install...
71
+ ```
72
+
73
+ Proceed to install step (treat as version 0.0.0 for comparison).
74
+ </step>
75
+
76
+ <step name="check_latest_version">
77
+ Check npm for latest version:
78
+
79
+ ```bash
80
+ npm view @ktpartners/dgs-platform version 2>/dev/null
81
+ ```
82
+
83
+ **If npm check fails:**
84
+ ```
85
+ Couldn't check for updates (offline or npm unavailable).
86
+
87
+ To update manually: `npx -y @ktpartners/dgs-platform@latest --global`
88
+ ```
89
+
90
+ Exit.
91
+ </step>
92
+
93
+ <step name="compare_versions">
94
+ Compare installed vs latest:
95
+
96
+ **If installed == latest:**
97
+ ```
98
+ ## DGS Update
99
+
100
+ **Installed:** X.Y.Z
101
+ **Latest:** X.Y.Z
102
+
103
+ You're already on the latest version.
104
+ ```
105
+
106
+ Exit.
107
+
108
+ **If installed > latest:**
109
+ ```
110
+ ## DGS Update
111
+
112
+ **Installed:** X.Y.Z
113
+ **Latest:** A.B.C
114
+
115
+ You're ahead of the latest release (development version?).
116
+ ```
117
+
118
+ Exit.
119
+ </step>
120
+
121
+ <step name="show_changes_and_confirm">
122
+ **If update available**, fetch and show what's new BEFORE updating:
123
+
124
+ 1. Fetch changelog from GitHub raw URL
125
+ 2. Extract entries between installed and latest versions
126
+ 3. Display preview and ask for confirmation:
127
+
128
+ ```
129
+ ## DGS Update Available
130
+
131
+ **Installed:** 1.5.10
132
+ **Latest:** 1.5.15
133
+
134
+ ### What's New
135
+ ────────────────────────────────────────────────────────────
136
+
137
+ ## [1.5.15] - 2026-01-20
138
+
139
+ ### Added
140
+ - Feature X
141
+
142
+ ## [1.5.14] - 2026-01-18
143
+
144
+ ### Fixed
145
+ - Bug fix Y
146
+
147
+ ────────────────────────────────────────────────────────────
148
+
149
+ ⚠️ **Note:** The installer performs a clean install of DGS folders:
150
+ - `commands/dgs/` will be wiped and replaced
151
+ - `deliver-great-systems/` will be wiped and replaced
152
+ - `agents/dgs-*` files will be replaced
153
+
154
+ (Paths are relative to your install location: `~/.claude/` for global, `./.claude/` for local)
155
+
156
+ Your custom files in other locations are preserved:
157
+ - Custom commands not in `commands/dgs/` ✓
158
+ - Custom agents not prefixed with `dgs-` ✓
159
+ - Custom hooks ✓
160
+ - Your CLAUDE.md files ✓
161
+
162
+ If you've modified any DGS files directly, they'll be automatically backed up to `dgs-local-patches/` and can be reapplied with `/dgs:reapply-patches` after the update.
163
+ ```
164
+
165
+ Use AskUserQuestion:
166
+ - Question: "Proceed with update?"
167
+ - Options:
168
+ - "Yes, update now"
169
+ - "No, cancel"
170
+
171
+ **If user cancels:** Exit.
172
+ </step>
173
+
174
+ <step name="run_update">
175
+ Run the update using the install type detected in step 1:
176
+
177
+ **If LOCAL install:**
178
+ ```bash
179
+ npx -y @ktpartners/dgs-platform@latest --local
180
+ ```
181
+
182
+ **If GLOBAL install (or unknown):**
183
+ ```bash
184
+ npx -y @ktpartners/dgs-platform@latest --global
185
+ ```
186
+
187
+ Capture output. If install fails, show error and exit.
188
+
189
+ Clear the update cache so statusline indicator disappears:
190
+
191
+ ```bash
192
+ # Clear update cache across all runtime directories
193
+ for dir in .claude .config/opencode .opencode .gemini; do
194
+ rm -f "./$dir/cache/dgs-update-check.json"
195
+ rm -f "$HOME/$dir/cache/dgs-update-check.json"
196
+ done
197
+ ```
198
+
199
+ The SessionStart hook (`dgs-check-update.js`) writes to the detected runtime's cache directory, so all paths must be cleared to prevent stale update indicators.
200
+ </step>
201
+
202
+ <step name="display_result">
203
+ Format completion message (changelog was already shown in confirmation step):
204
+
205
+ ```
206
+ ╔═══════════════════════════════════════════════════════════╗
207
+ ║ DGS Updated: v1.5.10 → v1.5.15 ║
208
+ ╚═══════════════════════════════════════════════════════════╝
209
+
210
+ ⚠️ Restart Claude Code to pick up the new commands.
211
+
212
+ [View full changelog](https://github.com/glittercowboy/deliver-great-systems/blob/main/CHANGELOG.md)
213
+ ```
214
+ </step>
215
+
216
+
217
+ <step name="check_local_patches">
218
+ After update completes, check if the installer detected and backed up any locally modified files:
219
+
220
+ Check for dgs-local-patches/backup-meta.json in the config directory.
221
+
222
+ **If patches found:**
223
+
224
+ ```
225
+ Local patches were backed up before the update.
226
+ Run /dgs:reapply-patches to merge your modifications into the new version.
227
+ ```
228
+
229
+ **If no patches:** Continue normally.
230
+ </step>
231
+ </process>
232
+
233
+ <success_criteria>
234
+ - [ ] Installed version read correctly
235
+ - [ ] Latest version checked via npm
236
+ - [ ] Update skipped if already current
237
+ - [ ] Changelog fetched and displayed BEFORE update
238
+ - [ ] Clean install warning shown
239
+ - [ ] User confirmation obtained
240
+ - [ ] Update executed successfully
241
+ - [ ] Restart reminder shown
242
+ </success_criteria>
@@ -0,0 +1,177 @@
1
+ <purpose>
2
+ Audit Nyquist validation gaps for a completed phase. Generate missing tests. Update VALIDATION.md.
3
+ </purpose>
4
+
5
+ <context_tier>verification</context_tier>
6
+
7
+ <required_reading>
8
+ @~/.claude/deliver-great-systems/references/ui-brand.md
9
+ </required_reading>
10
+
11
+ <process>
12
+
13
+ ## 0. Initialize
14
+
15
+ ```bash
16
+ INIT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" init phase-op "${PHASE_ARG}")
17
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
18
+ ```
19
+
20
+ Parse: `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`.
21
+
22
+ **Load verification tier context:**
23
+
24
+ ```bash
25
+ TIER_FILES=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" context load-tier verification --phase "${PHASE_ARG}" --raw 2>/dev/null)
26
+ ```
27
+
28
+ This provides all execution-tier files plus VERIFICATION.md and UAT*.md. Keep operational reads of PLAN files for test auditing.
29
+
30
+ ```bash
31
+ AUDITOR_MODEL=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" resolve-model dgs-nyquist-auditor --raw)
32
+ NYQUIST_CFG=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" config get workflow.nyquist_validation --raw)
33
+ ```
34
+
35
+ If `NYQUIST_CFG` is `false`: exit with "Nyquist validation is disabled. Enable via /dgs:settings."
36
+
37
+ Display banner: `DGS > VALIDATE PHASE {N}: {name}`
38
+
39
+ ## 1. Detect Input State
40
+
41
+ ```bash
42
+ VALIDATION_FILE=$(ls "${PHASE_DIR}"/*-VALIDATION.md 2>/dev/null | head -1)
43
+ SUMMARY_FILES=$(ls "${PHASE_DIR}"/*-SUMMARY.md 2>/dev/null)
44
+ ```
45
+
46
+ - **State A** (`VALIDATION_FILE` non-empty): Audit existing
47
+ - **State B** (`VALIDATION_FILE` empty, `SUMMARY_FILES` non-empty): Reconstruct from artifacts
48
+ - **State C** (`SUMMARY_FILES` empty): Exit — "Phase {N} not executed. Run /dgs:execute-phase {N} first."
49
+
50
+ ## 2. Discovery
51
+
52
+ ### 2a. Read Phase Artifacts
53
+
54
+ Read all PLAN and SUMMARY files. Extract: task lists, requirement IDs, key-files changed, verify blocks.
55
+
56
+ ### 2b. Build Requirement-to-Task Map
57
+
58
+ Per task: `{ task_id, plan_id, wave, requirement_ids, has_automated_command }`
59
+
60
+ ### 2c. Detect Test Infrastructure
61
+
62
+ State A: Parse from existing VALIDATION.md Test Infrastructure table.
63
+ State B: Filesystem scan:
64
+
65
+ ```bash
66
+ find . -name "pytest.ini" -o -name "jest.config.*" -o -name "vitest.config.*" -o -name "pyproject.toml" 2>/dev/null | head -10
67
+ find . \( -name "*.test.*" -o -name "*.spec.*" -o -name "test_*" \) -not -path "*/node_modules/*" 2>/dev/null | head -40
68
+ ```
69
+
70
+ ### 2d. Cross-Reference
71
+
72
+ Match each requirement to existing tests by filename, imports, test descriptions. Record: requirement → test_file → status.
73
+
74
+ ## 3. Gap Analysis
75
+
76
+ Classify each requirement:
77
+
78
+ | Status | Criteria |
79
+ |--------|----------|
80
+ | COVERED | Test exists, targets behavior, runs green |
81
+ | PARTIAL | Test exists, failing or incomplete |
82
+ | MISSING | No test found |
83
+
84
+ Build: `{ task_id, requirement, gap_type, suggested_test_path, suggested_command }`
85
+
86
+ No gaps → skip to Step 6, set `nyquist_compliant: true`.
87
+
88
+ ## 4. Present Gap Plan
89
+
90
+ Call AskUserQuestion with gap table and options:
91
+ 1. "Fix all gaps" → Step 5
92
+ 2. "Skip — mark manual-only" → add to Manual-Only, Step 6
93
+ 3. "Cancel" → exit
94
+
95
+ ## 5. Spawn dgs-nyquist-auditor
96
+
97
+ ```
98
+ Task(
99
+ prompt="Read ~/.claude/agents/dgs-nyquist-auditor.md for instructions.\n\n" +
100
+ "<files_to_read>{PLAN, SUMMARY, impl files, VALIDATION.md}</files_to_read>" +
101
+ "<gaps>{gap list}</gaps>" +
102
+ "<test_infrastructure>{framework, config, commands}</test_infrastructure>" +
103
+ "<constraints>Never modify impl files. Max 3 debug iterations. Escalate impl bugs.</constraints>",
104
+ subagent_type="dgs-nyquist-auditor",
105
+ model="{AUDITOR_MODEL}",
106
+ description="Fill validation gaps for Phase {N}"
107
+ )
108
+ ```
109
+
110
+ Handle return:
111
+ - `## GAPS FILLED` → record tests + map updates, Step 6
112
+ - `## PARTIAL` → record resolved, move escalated to manual-only, Step 6
113
+ - `## ESCALATE` → move all to manual-only, Step 6
114
+
115
+ ## 6. Generate/Update VALIDATION.md
116
+
117
+ **State B (create):**
118
+ 1. Read template from `~/.claude/deliver-great-systems/templates/VALIDATION.md`
119
+ 2. Fill: frontmatter, Test Infrastructure, Per-Task Map, Manual-Only, Sign-Off
120
+ 3. Write to `${PHASE_DIR}/${PADDED_PHASE}-VALIDATION.md`
121
+
122
+ **State A (update):**
123
+ 1. Update Per-Task Map statuses, add escalated to Manual-Only, update frontmatter
124
+ 2. Append audit trail:
125
+
126
+ ```markdown
127
+ ## Validation Audit {date}
128
+ | Metric | Count |
129
+ |--------|-------|
130
+ | Gaps found | {N} |
131
+ | Resolved | {M} |
132
+ | Escalated | {K} |
133
+ ```
134
+
135
+ ## 7. Commit
136
+
137
+ ```bash
138
+ git add {test_files}
139
+ git commit -m "test(phase-${PHASE}): add Nyquist validation tests"
140
+
141
+ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit-docs "docs(phase-${PHASE}): add/update validation strategy"
142
+ ```
143
+
144
+ ## 8. Results + Routing
145
+
146
+ **Compliant:**
147
+ ```
148
+ DGS > PHASE {N} IS NYQUIST-COMPLIANT
149
+ All requirements have automated verification.
150
+ ▶ Next: /dgs:audit-milestone
151
+ ```
152
+
153
+ **Partial:**
154
+ ```
155
+ DGS > PHASE {N} VALIDATED (PARTIAL)
156
+ {M} automated, {K} manual-only.
157
+ ▶ Retry: /dgs:validate-phase {N}
158
+ ```
159
+
160
+ Display `/clear` reminder.
161
+
162
+ </process>
163
+
164
+ <success_criteria>
165
+ - [ ] Nyquist config checked (exit if disabled)
166
+ - [ ] Input state detected (A/B/C)
167
+ - [ ] State C exits cleanly
168
+ - [ ] PLAN/SUMMARY files read, requirement map built
169
+ - [ ] Test infrastructure detected
170
+ - [ ] Gaps classified (COVERED/PARTIAL/MISSING)
171
+ - [ ] User gate with gap table
172
+ - [ ] Auditor spawned with complete context
173
+ - [ ] All three return formats handled
174
+ - [ ] VALIDATION.md created or updated
175
+ - [ ] Test files committed separately
176
+ - [ ] Results with routing presented
177
+ </success_criteria>