@ktpartners/dgs-platform 3.0.4 → 3.3.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 (115) hide show
  1. package/CHANGELOG.md +115 -0
  2. package/README.md +8 -1
  3. package/agents/dgs-executor.md +124 -3
  4. package/agents/dgs-idea-researcher.md +447 -0
  5. package/agents/dgs-plan-checker.md +32 -0
  6. package/agents/dgs-planner.md +41 -8
  7. package/bin/install.js +44 -0
  8. package/commands/dgs/audit-milestone.md +2 -1
  9. package/commands/dgs/diff-report.md +124 -0
  10. package/commands/dgs/new-project.md +8 -21
  11. package/commands/dgs/package-scan.md +43 -0
  12. package/commands/dgs/research-idea.md +1 -0
  13. package/commands/dgs/switch-project.md +13 -0
  14. package/deliver-great-systems/bin/dgs-tools.cjs +120 -5
  15. package/deliver-great-systems/bin/lib/audit-tolerance.cjs +77 -0
  16. package/deliver-great-systems/bin/lib/audit-tolerance.test.cjs +101 -0
  17. package/deliver-great-systems/bin/lib/commands.cjs +311 -16
  18. package/deliver-great-systems/bin/lib/commands.test.cjs +115 -0
  19. package/deliver-great-systems/bin/lib/commit-verify.test.cjs +236 -0
  20. package/deliver-great-systems/bin/lib/config.cjs +41 -0
  21. package/deliver-great-systems/bin/lib/config.test.cjs +309 -0
  22. package/deliver-great-systems/bin/lib/core.cjs +7 -3
  23. package/deliver-great-systems/bin/lib/core.test.cjs +79 -1
  24. package/deliver-great-systems/bin/lib/fast-routing.cjs +199 -0
  25. package/deliver-great-systems/bin/lib/fast-routing.test.cjs +108 -0
  26. package/deliver-great-systems/bin/lib/final-commit-precondition.test.cjs +87 -0
  27. package/deliver-great-systems/bin/lib/fixtures/package-scan/bundler-audit-gemfile.json +21 -0
  28. package/deliver-great-systems/bin/lib/fixtures/package-scan/gate-parity-expected.md +186 -0
  29. package/deliver-great-systems/bin/lib/fixtures/package-scan/gate-parity-runresult.json +235 -0
  30. package/deliver-great-systems/bin/lib/fixtures/package-scan/govulncheck-import.json +3 -0
  31. package/deliver-great-systems/bin/lib/fixtures/package-scan/npm-audit-v10.json +37 -0
  32. package/deliver-great-systems/bin/lib/fixtures/package-scan/osv-clean.json +3 -0
  33. package/deliver-great-systems/bin/lib/fixtures/package-scan/osv-vulns.json +77 -0
  34. package/deliver-great-systems/bin/lib/fixtures/package-scan/pip-audit-requirements.json +28 -0
  35. package/deliver-great-systems/bin/lib/fixtures/package-scan/snyk-lodash.json +30 -0
  36. package/deliver-great-systems/bin/lib/fixtures/package-scan/snyk-workspaces.json +55 -0
  37. package/deliver-great-systems/bin/lib/frontmatter.cjs +1 -1
  38. package/deliver-great-systems/bin/lib/governance.cjs +211 -0
  39. package/deliver-great-systems/bin/lib/governance.test.cjs +339 -0
  40. package/deliver-great-systems/bin/lib/health-untracked-phase.test.cjs +269 -0
  41. package/deliver-great-systems/bin/lib/init.cjs +56 -27
  42. package/deliver-great-systems/bin/lib/init.test.cjs +212 -5
  43. package/deliver-great-systems/bin/lib/jobs.cjs +7 -4
  44. package/deliver-great-systems/bin/lib/milestone.cjs +101 -3
  45. package/deliver-great-systems/bin/lib/milestone.test.cjs +203 -0
  46. package/deliver-great-systems/bin/lib/package-adapters.cjs +530 -0
  47. package/deliver-great-systems/bin/lib/package-adapters.test.cjs +618 -0
  48. package/deliver-great-systems/bin/lib/package-ecosystems.cjs +350 -0
  49. package/deliver-great-systems/bin/lib/package-ecosystems.test.cjs +348 -0
  50. package/deliver-great-systems/bin/lib/package-runner.cjs +199 -0
  51. package/deliver-great-systems/bin/lib/package-runner.test.cjs +198 -0
  52. package/deliver-great-systems/bin/lib/package-scan-provenance.cjs +56 -0
  53. package/deliver-great-systems/bin/lib/package-scan-provenance.test.cjs +103 -0
  54. package/deliver-great-systems/bin/lib/package-scan-report.cjs +1140 -0
  55. package/deliver-great-systems/bin/lib/package-scan-report.test.cjs +1963 -0
  56. package/deliver-great-systems/bin/lib/package-scan-skill.cjs +96 -0
  57. package/deliver-great-systems/bin/lib/package-scan-skill.test.cjs +136 -0
  58. package/deliver-great-systems/bin/lib/package-scan.cjs +919 -0
  59. package/deliver-great-systems/bin/lib/package-scan.test.cjs +2147 -0
  60. package/deliver-great-systems/bin/lib/phase.cjs +18 -1
  61. package/deliver-great-systems/bin/lib/plan-number-validity.test.cjs +48 -0
  62. package/deliver-great-systems/bin/lib/projects.cjs +38 -3
  63. package/deliver-great-systems/bin/lib/projects.test.cjs +112 -2
  64. package/deliver-great-systems/bin/lib/quick.cjs +178 -23
  65. package/deliver-great-systems/bin/lib/quick.test.cjs +138 -4
  66. package/deliver-great-systems/bin/lib/repos.cjs +12 -12
  67. package/deliver-great-systems/bin/lib/review.cjs +1821 -0
  68. package/deliver-great-systems/bin/lib/state.cjs +7 -3
  69. package/deliver-great-systems/bin/lib/summary-frontmatter.cjs +54 -0
  70. package/deliver-great-systems/bin/lib/summary-frontmatter.test.cjs +78 -0
  71. package/deliver-great-systems/bin/lib/sweep-scope.test.cjs +263 -0
  72. package/deliver-great-systems/bin/lib/verify.cjs +118 -6
  73. package/deliver-great-systems/bin/lib/verify.test.cjs +82 -0
  74. package/deliver-great-systems/bin/lib/wave-0-template-rename.test.cjs +40 -0
  75. package/deliver-great-systems/bin/lib/worktrees.cjs +27 -1
  76. package/deliver-great-systems/bin/lib/worktrees.test.cjs +76 -0
  77. package/deliver-great-systems/references/agent-step-reliability.md +60 -0
  78. package/deliver-great-systems/references/conflict-resolution.md +4 -0
  79. package/deliver-great-systems/references/context-tiers.md +4 -0
  80. package/deliver-great-systems/references/package-scan-config.md +151 -0
  81. package/deliver-great-systems/references/questioning.md +0 -30
  82. package/deliver-great-systems/references/spec-review-loop.md +1 -2
  83. package/deliver-great-systems/references/workflow-conventions.md +29 -0
  84. package/deliver-great-systems/skills/dgs-tests/package-scan.md +44 -0
  85. package/deliver-great-systems/templates/REVIEW.md +35 -0
  86. package/deliver-great-systems/templates/VALIDATION.md +1 -1
  87. package/deliver-great-systems/templates/claude-md.md +11 -0
  88. package/deliver-great-systems/templates/package-scan-report.md +108 -0
  89. package/deliver-great-systems/templates/project.md +6 -170
  90. package/deliver-great-systems/templates/summary.md +3 -1
  91. package/deliver-great-systems/workflows/add-phase.md +5 -0
  92. package/deliver-great-systems/workflows/audit-milestone.md +66 -10
  93. package/deliver-great-systems/workflows/cancel-job.md +1 -1
  94. package/deliver-great-systems/workflows/codereview.md +103 -9
  95. package/deliver-great-systems/workflows/complete-milestone.md +26 -7
  96. package/deliver-great-systems/workflows/complete-quick.md +40 -2
  97. package/deliver-great-systems/workflows/discuss-phase.md +3 -2
  98. package/deliver-great-systems/workflows/execute-phase.md +89 -2
  99. package/deliver-great-systems/workflows/execute-plan.md +10 -1
  100. package/deliver-great-systems/workflows/help.md +51 -18
  101. package/deliver-great-systems/workflows/import-spec.md +65 -7
  102. package/deliver-great-systems/workflows/init-product.md +46 -152
  103. package/deliver-great-systems/workflows/new-milestone.md +115 -14
  104. package/deliver-great-systems/workflows/new-project.md +60 -331
  105. package/deliver-great-systems/workflows/package-scan.md +59 -0
  106. package/deliver-great-systems/workflows/plan-phase.md +79 -1
  107. package/deliver-great-systems/workflows/quick-complete.md +40 -2
  108. package/deliver-great-systems/workflows/quick.md +183 -10
  109. package/deliver-great-systems/workflows/research-idea.md +80 -142
  110. package/deliver-great-systems/workflows/run-job.md +21 -35
  111. package/deliver-great-systems/workflows/settings.md +13 -77
  112. package/deliver-great-systems/workflows/write-spec.md +9 -11
  113. package/hooks/dist/dgs-enforce-discipline.js +196 -0
  114. package/package.json +1 -1
  115. package/scripts/build-hooks.js +1 -0
@@ -88,51 +88,15 @@ Created:
88
88
  - .gitignore
89
89
  ```
90
90
 
91
- **b2. Configure Base Branch:**
91
+ **b2. Configure Workflow Discipline (non-interactive):**
92
92
 
93
- Prompt the user for their code repo base branch:
94
-
95
- ```
96
- AskUserQuestion([{
97
- question: "What is the base branch for your code repos? (e.g., main, develop, dev)",
98
- header: "Git Configuration",
99
- multiSelect: false,
100
- freeform: true,
101
- placeholder: ""
102
- }])
103
- ```
104
-
105
- Always ask — no auto-detection, no default pre-fill. The user types the branch name explicitly.
106
-
107
- After receiving the answer, write to config:
108
- ```bash
109
- node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs config-set git.base_branch "$USER_ANSWER"
110
- ```
111
-
112
- If the user provides an empty answer or skips, do NOT write anything — the default `main` from config-ensure-section already provides the fallback.
113
-
114
- **b3. Configure Workflow Discipline:**
93
+ Workflow discipline is always enabled by default — it adds a CLAUDE.md file that routes code changes through `/dgs:*` commands for traceability and atomic commits. Read-only operations (searching, tests, git log) stay unrestricted. Users can disable later via `/dgs:settings`.
115
94
 
116
95
  Read the CLAUDE.md template:
117
96
  ```bash
118
97
  CLAUDE_TEMPLATE=$(cat /Users/adrian/.claude/deliver-great-systems/templates/claude-md.md)
119
98
  ```
120
99
 
121
- Use AskUserQuestion:
122
- ```
123
- AskUserQuestion([{
124
- question: "Enable workflow discipline? This adds a CLAUDE.md file that routes code changes through /dgs:* commands for traceability and atomic commits. Read-only operations (searching, tests, git log) stay unrestricted.",
125
- header: "Workflow Discipline",
126
- multiSelect: false,
127
- options: [
128
- { label: "Yes (Recommended)", description: "Creates CLAUDE.md with DGS command routing rules" },
129
- { label: "No", description: "Skip — no CLAUDE.md created" }
130
- ]
131
- }])
132
- ```
133
-
134
- **If "Yes":**
135
-
136
100
  Check if `./CLAUDE.md` already exists in the project root (cwd):
137
101
 
138
102
  - **If CLAUDE.md does NOT exist:** Create `./CLAUDE.md` with DGS section delimiters wrapping the template content:
@@ -162,142 +126,72 @@ node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs config-set wo
162
126
 
163
127
  Display: `Workflow discipline enabled — CLAUDE.md added.`
164
128
 
165
- Add `CLAUDE.md` to the commit file list for the init commit that follows (the `dgs-tools.cjs commit` call at the end of the flow).
129
+ CLAUDE.md is always included in the init commit file list (b4 below).
166
130
 
167
- **If "No":**
131
+ **b3. Apply Recommended Defaults (non-interactive):**
132
+
133
+ All other recommended defaults (`model_profile=balanced`, `commit_docs=true`, `workflow.research=true`, `workflow.plan_check=true`, `workflow.verifier=true`, `git.base_branch=main`) are already applied by `repos init-product` in step 2 — they live in `config.cjs`'s hardcoded defaults and are merged with any per-user overrides from `~/.dgs/defaults.json` (saved via `/dgs:settings save-as-defaults`). The three keys below are the only ones the underlying init does not pre-populate, so they are set explicitly here:
168
134
 
169
- Set config:
170
135
  ```bash
171
- node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs config-set workflow.discipline false
136
+ node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs config-set mode yolo
137
+ node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs config-set granularity standard
138
+ node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs config-set workflow.codereview true
172
139
  ```
173
140
 
174
- Display: `Skipped.`
141
+ Commit the applied defaults:
142
+ ```bash
143
+ node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "chore: apply recommended defaults" --files ${config_path}
144
+ ```
175
145
 
176
- Do NOT create or modify CLAUDE.md. Do NOT add CLAUDE.md to any commit.
146
+ **b4. Commit initialized files:**
177
147
 
178
- **b4. Configure Workflow Preferences (Round 1Core settings):**
148
+ Extract the `scaffolded_files` array from the init response (`RESULT` captured in step 2) and pass those paths to the commit step alongside the explicitly-named files. The `scaffolded_files` array is the AGENT-13 contract field it lists every path `cmdReposInitProduct` guaranteed on disk that the caller MUST commit (today the array contains the per-directory keep-files written under `specs/`, `docs/product/`, and `quick/`; future scaffold additions automatically flow through without workflow edits):
179
149
 
180
- ```
181
- AskUserQuestion([
182
- {
183
- header: "Mode",
184
- question: "How do you want to work?",
185
- multiSelect: false,
186
- options: [
187
- { label: "YOLO (Recommended)", description: "Auto-approve, just execute" },
188
- { label: "Interactive", description: "Confirm at each step" }
189
- ]
190
- },
191
- {
192
- header: "Depth",
193
- question: "How thorough should planning be?",
194
- multiSelect: false,
195
- options: [
196
- { label: "Quick", description: "Ship fast (3-5 phases, 1-3 plans each)" },
197
- { label: "Standard", description: "Balanced scope and speed (5-8 phases, 3-5 plans each)" },
198
- { label: "Comprehensive", description: "Thorough coverage (8-12 phases, 5-10 plans each)" }
199
- ]
200
- },
201
- {
202
- header: "Git Tracking",
203
- question: "Commit planning docs to git?",
204
- multiSelect: false,
205
- options: [
206
- { label: "Yes (Recommended)", description: "Planning docs tracked in version control" },
207
- { label: "No", description: "Keep planning docs local-only (add to .gitignore)" }
208
- ]
209
- }
210
- ])
150
+ ```bash
151
+ # AGENT-13: consume scaffolded_files from cmdReposInitProduct (per references/workflow-conventions.md)
152
+ SCAFFOLDED=$(printf '%s' "$RESULT" | jq -r '.scaffolded_files[]?' | tr '\n' ' ')
153
+ node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "docs: initialize product ${product_name}" --files REPOS.md PROJECTS.md config.json .gitignore CLAUDE.md ${SCAFFOLDED}
211
154
  ```
212
155
 
213
- **b5. Configure Workflow Preferences (Round 2Agents):**
156
+ CLAUDE.md is always included (workflow discipline is now always enabled by default see b2). The `${SCAFFOLDED}` token is unquoted intentionally so word-splitting expands the multiple paths into separate `--files` arguments.
214
157
 
215
- ```
216
- AskUserQuestion([
217
- {
218
- header: "AI Models",
219
- question: "Which AI models for planning agents?",
220
- multiSelect: false,
221
- options: [
222
- { label: "Balanced (Recommended)", description: "Sonnet for most agents — good quality/cost ratio" },
223
- { label: "Quality", description: "Opus for research/roadmap — higher cost, deeper analysis" },
224
- { label: "Budget", description: "Haiku where possible — fastest, lowest cost" }
225
- ]
226
- },
227
- {
228
- header: "Research",
229
- question: "Research before planning each phase? (adds tokens/time)",
230
- multiSelect: false,
231
- options: [
232
- { label: "Yes (Recommended)", description: "Investigate domain, find patterns, surface gotchas" },
233
- { label: "No", description: "Plan directly from requirements" }
234
- ]
235
- },
236
- {
237
- header: "Plan Check",
238
- question: "Verify plans will achieve their goals? (adds tokens/time)",
239
- multiSelect: false,
240
- options: [
241
- { label: "Yes (Recommended)", description: "Catch gaps before execution starts" },
242
- { label: "No", description: "Execute plans without verification" }
243
- ]
244
- },
245
- {
246
- header: "Verifier",
247
- question: "Verify work satisfies requirements after each phase? (adds tokens/time)",
248
- multiSelect: false,
249
- options: [
250
- { label: "Yes (Recommended)", description: "Confirm deliverables match phase goals" },
251
- { label: "No", description: "Trust execution, skip verification" }
252
- ]
253
- }
254
- ])
255
- ```
158
+ **b5. Display Defaults Summary:**
159
+
160
+ After commits land, print a summary block listing every applied setting and the recommended next step:
256
161
 
257
- **b6. Write config.json** with all values collected above:
258
-
259
- ```json
260
- {
261
- "mode": "yolo|interactive",
262
- "depth": "quick|standard|comprehensive",
263
- "parallelization": true,
264
- "commit_docs": true|false,
265
- "model_profile": "quality|balanced|budget",
266
- "workflow": {
267
- "research": true|false,
268
- "plan_check": true|false,
269
- "verifier": true|false,
270
- "nyquist_validation": true,
271
- "auto_advance": false,
272
- "discipline": true|false
273
- },
274
- "git": {
275
- "base_branch": "[from earlier question]",
276
- "sync_push": "auto",
277
- "sync_pull": "auto"
278
- }
279
- }
280
162
  ```
163
+ ───────────────────────────────────────────────────────────────
281
164
 
282
- Smart defaults (not asked): `parallelization: true`, `auto_advance: false`, `nyquist_validation: true`.
165
+ ## Defaults Applied
283
166
 
284
- **If commit_docs = No:** Add the planning root directory to `.gitignore`.
167
+ The following recommended settings were applied automatically:
285
168
 
286
- **Commit config:**
169
+ | Setting | Value |
170
+ |----------------------------|------------|
171
+ | mode | yolo |
172
+ | granularity | standard |
173
+ | commit_docs | true |
174
+ | model_profile | balanced |
175
+ | workflow.research | true |
176
+ | workflow.plan_check | true |
177
+ | workflow.verifier | true |
178
+ | workflow.codereview | true |
179
+ | workflow.discipline | true |
180
+ | git.base_branch | main |
287
181
 
288
- ```bash
289
- node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "chore: add product config" --files ${config_path}
290
- ```
182
+ Change any of them with `/dgs:settings`.
291
183
 
292
- **b7. Commit initialized files:**
184
+ ## Recommended Next Step — Upload Product-Context Docs
293
185
 
294
- Use the `files_created` array from the init response to build the commit file list:
186
+ `/dgs:add-doc PRODUCT-SUMMARY.md` *what the product is, who it serves, key constraints*
187
+ `/dgs:add-doc ARCHITECTURE.md` *module boundaries, data flow, tech choices, security model*
295
188
 
296
- ```bash
297
- node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "docs: initialize product ${product_name}" --files REPOS.md PROJECTS.md config.json .gitignore CLAUDE.md
189
+ Drop the file path, or paste/attach the file when prompted. These give every downstream workflow (research, planning, review) the context to do its job.
190
+
191
+ Don't have these docs yet? Skip for now — you can run `/dgs:add-doc` anytime later. (A guided "answer questions to generate" path is on the roadmap.)
298
192
  ```
299
193
 
300
- Only include CLAUDE.md in the --files list if workflow discipline was enabled (user answered Yes).
194
+ The summary is informational only no commits, no config writes.
301
195
 
302
196
  **c. Route to next step:**
303
197
 
@@ -50,7 +50,7 @@ The spec must have status: final.
50
50
  INIT=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs init new-milestone)
51
51
  ```
52
52
 
53
- Extract from init JSON: `researcher_model`, `synthesizer_model`, `roadmapper_model`, `commit_docs`, `research_enabled`, `current_milestone`, `current_milestone_name`, `project_exists`, `roadmap_exists`, `state_exists`, `project_path`, `roadmap_path`, `state_path`, `current_project`, `project_root`.
53
+ Extract from init JSON: `researcher_model`, `synthesizer_model`, `roadmapper_model`, `commit_docs`, `research_enabled`, `current_milestone`, `current_milestone_name`, `project_exists`, `roadmap_exists`, `state_exists`, `project_path`, `roadmap_path`, `state_path`, `product_milestones_path`, `product_milestones_exists`, `current_project`, `project_root`.
54
54
 
55
55
  Load planning-tier context files:
56
56
 
@@ -63,7 +63,8 @@ All subsequent steps use these resolved paths. Never reference PROJECT.md, STATE
63
63
  ## 1. Load Context
64
64
 
65
65
  - Read `${project_path}` (existing project, validated requirements, decisions)
66
- - Read `${project_root}/MILESTONES.md` (what shipped previously) — if file does not exist, this is the first milestone; skip and use defaults
66
+ - Read `${product_milestones_path}` (product-level MILESTONES.md — authoritative record of what shipped across ALL projects in this product; used here for global version and phase continuity) — if `${product_milestones_exists}` is false, this is the first milestone in the product; skip and use defaults
67
+ - Optionally read `${project_root}/MILESTONES.md` (per-project shipped record) for project-specific context if it exists — do NOT use it for version or phase numbering, which are global across the product
67
68
  - Read `${state_path}` (pending todos, blockers) — if file does not exist, will be created in Step 5
68
69
  - Check for `${project_root}/MILESTONE-CONTEXT.md` (from /dgs:discuss-milestone)
69
70
 
@@ -83,7 +84,37 @@ Read the spec file and extract:
83
84
 
84
85
  ### Determine Milestone Version
85
86
 
86
- Parse `${project_root}/MILESTONES.md` for last version. If no MILESTONES.md exists (first milestone): default to v1.0 (auto mode: use v1.0 without asking). Suggest next version automatically (e.g., v1.0 v1.1, or v2.0 for major). In auto mode, use the minor bump without asking.
87
+ Parse `${product_milestones_path}` for last version (versions are global across the product a new milestone in project A continues the sequence from milestones shipped in any sibling project).
88
+
89
+ **Compute candidates:**
90
+ - If `${product_milestones_exists}` is false (first milestone in the product): the version is fixed at `v1.0` — skip the question below.
91
+ - Otherwise, last version is `vX.Y`:
92
+ - Minor candidate: `v[X].[Y+1]` (e.g. v1.3 → v1.4)
93
+ - Major candidate: `v[X+1].0` (e.g. v1.3 → v2.0)
94
+
95
+ **Derive recommendation from the spec's Problem and Goals sections:**
96
+ - Recommend **major** if content signals a breaking change, rewrite, replacement, migration, deprecation, or removal of a major capability.
97
+ - Otherwise recommend **minor**.
98
+
99
+ Compose a one-sentence reason for the recommendation (e.g. "Adds notification features without changing existing contracts" or "Replaces legacy auth with OIDC, deprecating session-token storage").
100
+
101
+ **Confirm with the user** via AskUserQuestion (auto mode no longer hardcodes minor — version is the one gate auto mode still surfaces, because a wrong major/minor call is hard to undo and the spec content alone is insufficient signal):
102
+
103
+ ```
104
+ AskUserQuestion(
105
+ header: "Version",
106
+ question: "Which version for this milestone? Recommendation: v[recommended] (${recommended_kind}) — ${reason}.",
107
+ options: [
108
+ { label: "v[recommended] — ${recommended_kind} (recommended)", description: "${reason}" },
109
+ { label: "v[other] — ${other_kind}", description: "${other_kind_brief_description}" },
110
+ { label: "Custom", description: "Enter a version manually" }
111
+ ]
112
+ )
113
+ ```
114
+
115
+ If the user selects "Custom", prompt for manual entry and validate it parses as `vX.Y`.
116
+
117
+ The chosen `vX.Y` is used for PROJECT.md, STATE.md, and commit messages throughout the rest of the auto-mode flow.
87
118
 
88
119
  ### Repo Cross-Check (v2 only)
89
120
 
@@ -109,10 +140,18 @@ AskUserQuestion([{
109
140
  }])
110
141
  ```
111
142
 
112
- Handle each choice identically to new-project's repo cross-check:
113
- - **Continue:** Skip, proceed
114
- - **Register existing:** Ask path, run `repos add`
115
- - **Create + Register:** `mkdir -p`, `git init`, `repos add`
143
+ For each unregistered repo, handle the user's choice:
144
+ - **Continue:** Skip this repo, proceed to next
145
+ - **Register existing:** Ask for path (suggest `../{repo_name}`), then run:
146
+ ```bash
147
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs repos add "{path}" --name "{repo_name}"
148
+ ```
149
+ - **Create + Register:**
150
+ ```bash
151
+ mkdir -p ../{repo_name}
152
+ cd ../{repo_name} && git init
153
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs repos add "../{repo_name}" --name "{repo_name}"
154
+ ```
116
155
  - **Cancel:** Stop with message: "Milestone creation cancelled. Resolve repo registration and try again."
117
156
 
118
157
  If no unregistered repos OR not v2: skip silently.
@@ -180,6 +219,40 @@ Skip Steps 2-6 (questioning, version determination, update, cleanup) — they're
180
219
  - Step 10.5 (Overlap Check): Run as usual
181
220
  - Step 11 (Done): Show source spec in completion output
182
221
 
222
+ ## 1c. Migrate Historical Quick Directories
223
+
224
+ One-time migration for projects with quick dirs accumulated from before per-milestone archival.
225
+
226
+ Check if `${project_root}/quick/` exists and contains any directories (beyond HISTORY.md):
227
+
228
+ ```bash
229
+ QUICK_DIR="${project_root}/quick"
230
+ if [ -d "$QUICK_DIR" ]; then
231
+ QUICK_DIRS=$(ls -d "$QUICK_DIR"/*/ 2>/dev/null | wc -l)
232
+ fi
233
+ ```
234
+
235
+ If directories exist (count > 0):
236
+
237
+ 1. Create `milestones/historical-quick/` in the planning root
238
+ 2. Move ALL directories from `${project_root}/quick/` into `milestones/historical-quick/`
239
+ 3. Do NOT move HISTORY.md (it is a file, not a directory -- the glob naturally skips it)
240
+ 4. Do NOT move other plain files in quick/
241
+ 5. Log: `Migrated {N} historical quick directories to milestones/historical-quick/`
242
+
243
+ ```bash
244
+ PLAN_ROOT=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs paths planning-root --raw)
245
+ HIST_DIR="$PLAN_ROOT/milestones/historical-quick"
246
+ mkdir -p "$HIST_DIR"
247
+ for d in "$QUICK_DIR"/*/; do
248
+ [ -d "$d" ] && mv "$d" "$HIST_DIR/"
249
+ done
250
+ ```
251
+
252
+ If no directories exist: skip silently (no output needed).
253
+
254
+ This is idempotent -- once dirs are moved, subsequent runs find nothing to migrate.
255
+
183
256
  ## 2. Gather Milestone Goals
184
257
 
185
258
  **If `${project_root}/MILESTONE-CONTEXT.md` exists:**
@@ -193,10 +266,37 @@ Skip Steps 2-6 (questioning, version determination, update, cleanup) — they're
193
266
 
194
267
  ## 3. Determine Milestone Version
195
268
 
196
- - Parse last version from `${project_root}/MILESTONES.md`
197
- - If no MILESTONES.md exists (first milestone): default to v1.0 and suggest it to user
198
- - Suggest next version (v1.0 → v1.1, or v2.0 for major)
199
- - Confirm with user
269
+ Parse last version from `${product_milestones_path}` (product-level — versions are global across all projects in the product).
270
+
271
+ **Compute candidates:**
272
+ - If `${product_milestones_exists}` is false (first milestone in the product): the version is fixed at `v1.0` — skip the question below.
273
+ - Otherwise, last version is `vX.Y`:
274
+ - Minor candidate: `v[X].[Y+1]` (e.g. v1.3 → v1.4)
275
+ - Major candidate: `v[X+1].0` (e.g. v1.3 → v2.0)
276
+
277
+ **Derive recommendation from the milestone goals gathered in Step 2:**
278
+ - Recommend **major** if the goals signal a breaking change, rewrite, replacement, migration, deprecation, or removal of a major capability.
279
+ - Otherwise recommend **minor**.
280
+
281
+ Compose a one-sentence reason for the recommendation (e.g. "Adds notification features without changing existing contracts" or "Replaces legacy auth with OIDC, deprecating session-token storage").
282
+
283
+ **Confirm with the user** via AskUserQuestion:
284
+
285
+ ```
286
+ AskUserQuestion(
287
+ header: "Version",
288
+ question: "Which version for this milestone? Recommendation: v[recommended] (${recommended_kind}) — ${reason}.",
289
+ options: [
290
+ { label: "v[recommended] — ${recommended_kind} (recommended)", description: "${reason}" },
291
+ { label: "v[other] — ${other_kind}", description: "${other_kind_brief_description}" },
292
+ { label: "Custom", description: "Enter a version manually" }
293
+ ]
294
+ )
295
+ ```
296
+
297
+ If the user selects "Custom", prompt for manual entry and validate it parses as `vX.Y`.
298
+
299
+ The chosen `vX.Y` is used for PROJECT.md, STATE.md, and commit messages throughout the rest of the workflow.
200
300
 
201
301
  ## 4. Update PROJECT.md
202
302
 
@@ -422,7 +522,7 @@ If "adjust": Return to scoping.
422
522
 
423
523
  **Commit requirements:**
424
524
  ```bash
425
- node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "docs: define milestone v[X.Y] requirements" --push --files ${project_root}/REQUIREMENTS.md
525
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "docs: define milestone v[X.Y] requirements" --push --files ${project_root}/REQUIREMENTS.md config.json
426
526
  ```
427
527
 
428
528
  ## 10. Create Roadmap
@@ -435,7 +535,7 @@ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "docs: define mile
435
535
  ◆ Spawning roadmapper...
436
536
  ```
437
537
 
438
- **Starting phase number:** Read `${project_root}/MILESTONES.md` for last phase number. Continue from there (v1.0 ended at phase 5v1.1 starts at phase 6). If no MILESTONES.md exists (first milestone): start phase numbering at 1.
538
+ **Starting phase number:** Read `${product_milestones_path}` for last phase number (phase numbers are global across the product — the next phase continues the sequence from the most recent milestone shipped in any project). Continue from there (e.g., v23.0 ended at phase 148v23.1 starts at phase 149). If `${product_milestones_exists}` is false (first milestone in the product): start phase numbering at 1.
439
539
 
440
540
  ```
441
541
  Task(prompt="
@@ -445,7 +545,7 @@ Task(prompt="
445
545
  - ${project_root}/REQUIREMENTS.md
446
546
  - ${project_root}/research/SUMMARY.md (if exists)
447
547
  - ${config_path}
448
- - ${project_root}/MILESTONES.md
548
+ - ${product_milestones_path}
449
549
  - ${project_root}/docs/product/ARCHITECTURE.md (Target architecture, if exists)
450
550
  - ${project_root}/docs/product/PRODUCT-SUMMARY.md (Product summary, if exists)
451
551
  </files_to_read>
@@ -585,6 +685,7 @@ Also: `/dgs:plan-phase [N]` — skip discussion, plan directly
585
685
  - [ ] Auto mode: repo cross-check completed (if v2)
586
686
  - [ ] Auto mode: one milestone per spec enforced
587
687
  - [ ] Auto mode: spec milestones field updated with link-milestone call
688
+ - [ ] Both modes: version selection presented as AskUserQuestion with minor/major candidates and a recommendation derived from spec/goals content (auto mode included — version is the one gate auto mode still surfaces)
588
689
 
589
690
  **Atomic commits:** Each phase commits its artifacts immediately.
590
691
  </success_criteria>