@ktpartners/dgs-platform 2.9.0 → 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 (166) hide show
  1. package/CHANGELOG.md +197 -0
  2. package/README.md +34 -2
  3. package/agents/dgs-executor.md +124 -3
  4. package/agents/dgs-idea-researcher.md +447 -0
  5. package/agents/dgs-plan-checker.md +61 -3
  6. package/agents/dgs-planner.md +51 -8
  7. package/bin/install.js +44 -0
  8. package/commands/dgs/abandon-quick.md +28 -0
  9. package/commands/dgs/add-tests.md +2 -2
  10. package/commands/dgs/audit-milestone.md +4 -3
  11. package/commands/dgs/capture-principle.md +11 -11
  12. package/commands/dgs/cleanup.md +2 -2
  13. package/commands/dgs/complete-milestone.md +11 -11
  14. package/commands/dgs/complete-quick.md +28 -0
  15. package/commands/dgs/create-milestone-job.md +2 -2
  16. package/commands/dgs/debug.md +3 -3
  17. package/commands/dgs/develop-idea.md +1 -1
  18. package/commands/dgs/diff-report.md +124 -0
  19. package/commands/dgs/fast.md +3 -1
  20. package/commands/dgs/health.md +1 -1
  21. package/commands/dgs/map-codebase.md +6 -6
  22. package/commands/dgs/new-milestone.md +5 -5
  23. package/commands/dgs/new-project.md +8 -21
  24. package/commands/dgs/package-scan.md +43 -0
  25. package/commands/dgs/plan-milestone-gaps.md +1 -1
  26. package/commands/dgs/progress.md +3 -3
  27. package/commands/dgs/quick-abandon.md +8 -0
  28. package/commands/dgs/quick-complete.md +8 -0
  29. package/commands/dgs/quick.md +10 -3
  30. package/commands/dgs/research-idea.md +3 -2
  31. package/commands/dgs/research-phase.md +3 -3
  32. package/commands/dgs/switch-project.md +14 -1
  33. package/commands/dgs/write-spec.md +3 -3
  34. package/deliver-great-systems/bin/dgs-tools.cjs +401 -32
  35. package/deliver-great-systems/bin/lib/audit-tolerance.cjs +77 -0
  36. package/deliver-great-systems/bin/lib/audit-tolerance.test.cjs +101 -0
  37. package/deliver-great-systems/bin/lib/commands.cjs +626 -46
  38. package/deliver-great-systems/bin/lib/commands.test.cjs +451 -0
  39. package/deliver-great-systems/bin/lib/commit-verify.test.cjs +236 -0
  40. package/deliver-great-systems/bin/lib/config.cjs +80 -6
  41. package/deliver-great-systems/bin/lib/config.test.cjs +309 -0
  42. package/deliver-great-systems/bin/lib/context.cjs +120 -0
  43. package/deliver-great-systems/bin/lib/core.cjs +35 -14
  44. package/deliver-great-systems/bin/lib/core.test.cjs +79 -1
  45. package/deliver-great-systems/bin/lib/execution.cjs +49 -17
  46. package/deliver-great-systems/bin/lib/fast-routing.cjs +199 -0
  47. package/deliver-great-systems/bin/lib/fast-routing.test.cjs +108 -0
  48. package/deliver-great-systems/bin/lib/final-commit-precondition.test.cjs +87 -0
  49. package/deliver-great-systems/bin/lib/fixtures/package-scan/bundler-audit-gemfile.json +21 -0
  50. package/deliver-great-systems/bin/lib/fixtures/package-scan/gate-parity-expected.md +186 -0
  51. package/deliver-great-systems/bin/lib/fixtures/package-scan/gate-parity-runresult.json +235 -0
  52. package/deliver-great-systems/bin/lib/fixtures/package-scan/govulncheck-import.json +3 -0
  53. package/deliver-great-systems/bin/lib/fixtures/package-scan/npm-audit-v10.json +37 -0
  54. package/deliver-great-systems/bin/lib/fixtures/package-scan/osv-clean.json +3 -0
  55. package/deliver-great-systems/bin/lib/fixtures/package-scan/osv-vulns.json +77 -0
  56. package/deliver-great-systems/bin/lib/fixtures/package-scan/pip-audit-requirements.json +28 -0
  57. package/deliver-great-systems/bin/lib/fixtures/package-scan/snyk-lodash.json +30 -0
  58. package/deliver-great-systems/bin/lib/fixtures/package-scan/snyk-workspaces.json +55 -0
  59. package/deliver-great-systems/bin/lib/flat-migration.test.cjs +396 -0
  60. package/deliver-great-systems/bin/lib/frontmatter.cjs +1 -1
  61. package/deliver-great-systems/bin/lib/governance.cjs +211 -0
  62. package/deliver-great-systems/bin/lib/governance.test.cjs +339 -0
  63. package/deliver-great-systems/bin/lib/health-untracked-phase.test.cjs +269 -0
  64. package/deliver-great-systems/bin/lib/ideas.cjs +206 -91
  65. package/deliver-great-systems/bin/lib/ideas.test.cjs +244 -1
  66. package/deliver-great-systems/bin/lib/init.cjs +357 -61
  67. package/deliver-great-systems/bin/lib/init.test.cjs +625 -8
  68. package/deliver-great-systems/bin/lib/jobs.cjs +131 -25
  69. package/deliver-great-systems/bin/lib/jobs.test.cjs +193 -74
  70. package/deliver-great-systems/bin/lib/migration.cjs +409 -1
  71. package/deliver-great-systems/bin/lib/migration.test.cjs +158 -1
  72. package/deliver-great-systems/bin/lib/milestone.cjs +154 -31
  73. package/deliver-great-systems/bin/lib/milestone.test.cjs +203 -0
  74. package/deliver-great-systems/bin/lib/package-adapters.cjs +530 -0
  75. package/deliver-great-systems/bin/lib/package-adapters.test.cjs +618 -0
  76. package/deliver-great-systems/bin/lib/package-ecosystems.cjs +350 -0
  77. package/deliver-great-systems/bin/lib/package-ecosystems.test.cjs +348 -0
  78. package/deliver-great-systems/bin/lib/package-runner.cjs +199 -0
  79. package/deliver-great-systems/bin/lib/package-runner.test.cjs +198 -0
  80. package/deliver-great-systems/bin/lib/package-scan-provenance.cjs +56 -0
  81. package/deliver-great-systems/bin/lib/package-scan-provenance.test.cjs +103 -0
  82. package/deliver-great-systems/bin/lib/package-scan-report.cjs +1140 -0
  83. package/deliver-great-systems/bin/lib/package-scan-report.test.cjs +1963 -0
  84. package/deliver-great-systems/bin/lib/package-scan-skill.cjs +96 -0
  85. package/deliver-great-systems/bin/lib/package-scan-skill.test.cjs +136 -0
  86. package/deliver-great-systems/bin/lib/package-scan.cjs +919 -0
  87. package/deliver-great-systems/bin/lib/package-scan.test.cjs +2147 -0
  88. package/deliver-great-systems/bin/lib/phase.cjs +146 -3
  89. package/deliver-great-systems/bin/lib/phase.test.cjs +420 -0
  90. package/deliver-great-systems/bin/lib/plan-number-validity.test.cjs +48 -0
  91. package/deliver-great-systems/bin/lib/projects.cjs +65 -10
  92. package/deliver-great-systems/bin/lib/projects.test.cjs +198 -2
  93. package/deliver-great-systems/bin/lib/quick.cjs +739 -0
  94. package/deliver-great-systems/bin/lib/quick.test.cjs +730 -0
  95. package/deliver-great-systems/bin/lib/repos.cjs +37 -13
  96. package/deliver-great-systems/bin/lib/review.cjs +1821 -0
  97. package/deliver-great-systems/bin/lib/roadmap.cjs +34 -13
  98. package/deliver-great-systems/bin/lib/specs.cjs +3 -81
  99. package/deliver-great-systems/bin/lib/state-transition-gate.test.cjs +160 -0
  100. package/deliver-great-systems/bin/lib/state.cjs +147 -55
  101. package/deliver-great-systems/bin/lib/summary-frontmatter.cjs +54 -0
  102. package/deliver-great-systems/bin/lib/summary-frontmatter.test.cjs +78 -0
  103. package/deliver-great-systems/bin/lib/sweep-scope.test.cjs +263 -0
  104. package/deliver-great-systems/bin/lib/sync.cjs +75 -0
  105. package/deliver-great-systems/bin/lib/verify.cjs +198 -7
  106. package/deliver-great-systems/bin/lib/verify.test.cjs +82 -0
  107. package/deliver-great-systems/bin/lib/wave-0-template-rename.test.cjs +40 -0
  108. package/deliver-great-systems/bin/lib/worktrees.cjs +790 -0
  109. package/deliver-great-systems/bin/lib/worktrees.test.cjs +963 -0
  110. package/deliver-great-systems/references/agent-step-reliability.md +60 -0
  111. package/deliver-great-systems/references/conflict-resolution.md +4 -0
  112. package/deliver-great-systems/references/context-tiers.md +4 -0
  113. package/deliver-great-systems/references/package-scan-config.md +151 -0
  114. package/deliver-great-systems/references/questioning.md +0 -30
  115. package/deliver-great-systems/references/spec-review-loop.md +1 -2
  116. package/deliver-great-systems/references/workflow-conventions.md +29 -0
  117. package/deliver-great-systems/skills/dgs-tests/package-scan.md +44 -0
  118. package/deliver-great-systems/templates/REVIEW.md +35 -0
  119. package/deliver-great-systems/templates/VALIDATION.md +1 -1
  120. package/deliver-great-systems/templates/claude-md.md +27 -0
  121. package/deliver-great-systems/templates/package-scan-report.md +108 -0
  122. package/deliver-great-systems/templates/project.md +6 -170
  123. package/deliver-great-systems/templates/summary.md +3 -1
  124. package/deliver-great-systems/workflows/abandon-quick.md +89 -0
  125. package/deliver-great-systems/workflows/add-idea.md +3 -3
  126. package/deliver-great-systems/workflows/add-phase.md +5 -0
  127. package/deliver-great-systems/workflows/add-tests.md +14 -0
  128. package/deliver-great-systems/workflows/add-todo.md +1 -0
  129. package/deliver-great-systems/workflows/approve-spec.md +25 -4
  130. package/deliver-great-systems/workflows/audit-milestone.md +66 -10
  131. package/deliver-great-systems/workflows/audit-phase.md +15 -5
  132. package/deliver-great-systems/workflows/cancel-job.md +2 -2
  133. package/deliver-great-systems/workflows/check-todos.md +2 -3
  134. package/deliver-great-systems/workflows/codereview.md +103 -9
  135. package/deliver-great-systems/workflows/complete-milestone.md +218 -24
  136. package/deliver-great-systems/workflows/complete-quick.md +106 -0
  137. package/deliver-great-systems/workflows/consolidate-ideas.md +1 -1
  138. package/deliver-great-systems/workflows/create-milestone-job.md +4 -4
  139. package/deliver-great-systems/workflows/develop-idea.md +11 -11
  140. package/deliver-great-systems/workflows/diagnose-issues.md +14 -0
  141. package/deliver-great-systems/workflows/discuss-idea.md +1 -1
  142. package/deliver-great-systems/workflows/discuss-phase.md +3 -2
  143. package/deliver-great-systems/workflows/execute-phase.md +209 -33
  144. package/deliver-great-systems/workflows/execute-plan.md +22 -22
  145. package/deliver-great-systems/workflows/help.md +53 -20
  146. package/deliver-great-systems/workflows/import-spec.md +65 -7
  147. package/deliver-great-systems/workflows/init-product.md +45 -167
  148. package/deliver-great-systems/workflows/new-milestone.md +140 -33
  149. package/deliver-great-systems/workflows/new-project.md +60 -331
  150. package/deliver-great-systems/workflows/package-scan.md +59 -0
  151. package/deliver-great-systems/workflows/plan-phase.md +79 -1
  152. package/deliver-great-systems/workflows/progress-all.md +133 -0
  153. package/deliver-great-systems/workflows/quick-abandon.md +89 -0
  154. package/deliver-great-systems/workflows/quick-complete.md +106 -0
  155. package/deliver-great-systems/workflows/quick.md +328 -26
  156. package/deliver-great-systems/workflows/refine-spec.md +1 -1
  157. package/deliver-great-systems/workflows/research-idea.md +77 -139
  158. package/deliver-great-systems/workflows/resume-project.md +2 -2
  159. package/deliver-great-systems/workflows/run-job.md +29 -43
  160. package/deliver-great-systems/workflows/settings.md +13 -77
  161. package/deliver-great-systems/workflows/validate-phase.md +39 -1
  162. package/deliver-great-systems/workflows/verify-work.md +14 -0
  163. package/deliver-great-systems/workflows/write-spec.md +11 -13
  164. package/hooks/dist/dgs-enforce-discipline.js +196 -0
  165. package/package.json +1 -1
  166. package/scripts/build-hooks.js +1 -0
@@ -1,5 +1,5 @@
1
1
  <purpose>
2
- Initialize a new project through questioning and PROJECT.md creation. This is the most leveraged moment in any project deep questioning here means better plans, better execution, better outcomes. Run /dgs:new-milestone after to start your first milestone.
2
+ Initialize a new project as a thin skeleton (name + one-line placeholder). Projects are holders specs and milestones carry the real work. Run `/dgs:write-spec` next to capture what you're building, then `/dgs:new-milestone --auto <spec-id>` to start the first milestone.
3
3
  </purpose>
4
4
 
5
5
  <context_tier>planning</context_tier>
@@ -8,49 +8,6 @@ Initialize a new project through questioning and PROJECT.md creation. This is th
8
8
  Read all files referenced by the invoking prompt's execution_context before starting.
9
9
  </required_reading>
10
10
 
11
- <auto_mode>
12
- ## Auto Mode Detection
13
-
14
- Check if `--auto` flag is present in $ARGUMENTS.
15
-
16
- **If auto mode:**
17
- - Skip brownfield mapping offer (assume greenfield)
18
- - Skip deep questioning (extract context from provided document)
19
- - Config: Use existing product config from init-product
20
- - After config: run Step 2b (parse spec), Step 2c (repo cross-check), write PROJECT.md
21
- - End with completion output directing to `/dgs:new-milestone --auto <spec-id>`
22
-
23
- **Document requirement:**
24
- Auto mode requires an idea document or spec reference — either:
25
- - File reference: `/dgs:new-project --auto @prd.md`
26
- - Pasted/written text in the prompt
27
- - Spec ID: `/dgs:new-project --auto <spec-id>`
28
- - Spec file path: `/dgs:new-project --auto @${project_root}/specs/X.md`
29
-
30
- If no document content provided, error:
31
-
32
- ```
33
- Error: --auto requires an idea document or spec reference.
34
-
35
- Usage:
36
- /dgs:new-project --auto @your-idea.md # From idea document
37
- /dgs:new-project --auto [paste or write idea] # From freeform text
38
- /dgs:new-project --auto <spec-id> # From finalized spec
39
- /dgs:new-project --auto @${project_root}/specs/X.md # From spec file path
40
-
41
- The argument should be an idea document, freeform text, or a finalized spec.
42
- ```
43
-
44
- **Spec-driven mode:**
45
-
46
- If the `--auto` argument references a spec file path or spec ID:
47
- 1. Read the spec file (either from the provided path or by looking up via `node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs specs list --status final`)
48
- 2. Validate the spec has `status: final` — if not, error: "Spec must be finalized before creating a project. Run /dgs:write-spec to complete it."
49
- 3. Enter spec-driven flow (Steps 2b-2c below) instead of the standard auto flow
50
-
51
- **Detection:** If the argument after `--auto` contains `spec-` or ends with `.md` and exists in `${project_root}/specs/`, treat it as a spec reference. Otherwise, treat as a freeform document (existing behavior).
52
- </auto_mode>
53
-
54
11
  <process>
55
12
 
56
13
  ## 1. Setup
@@ -58,10 +15,24 @@ If the `--auto` argument references a spec file path or spec ID:
58
15
  **MANDATORY FIRST STEP — Execute these checks before ANY user interaction:**
59
16
 
60
17
  ```bash
61
- INIT=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs init new-project)
18
+ # Extract the first non-flag token from $ARGUMENTS as the project slug/name.
19
+ # If none, fall back to legacy no-arg behaviour (resolves against current_project).
20
+ SLUG_ARG=""
21
+ for tok in $ARGUMENTS; do
22
+ case "$tok" in
23
+ --*) ;; # skip flags like --auto (handled later)
24
+ *) SLUG_ARG="$tok"; break ;;
25
+ esac
26
+ done
27
+
28
+ if [ -n "$SLUG_ARG" ]; then
29
+ INIT=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs init new-project "$SLUG_ARG")
30
+ else
31
+ INIT=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs init new-project)
32
+ fi
62
33
  ```
63
34
 
64
- Parse JSON for: `commit_docs`, `project_exists`, `has_codebase_map`, `planning_exists`, `has_existing_code`, `has_package_file`, `is_brownfield`, `needs_codebase_map`, `has_git`, `project_path`, `state_path`.
35
+ Parse JSON for: `commit_docs`, `project_exists`, `has_codebase_map`, `planning_exists`, `has_existing_code`, `has_package_file`, `is_brownfield`, `needs_codebase_map`, `has_git`, `project_path`, `state_path`, `requested_slug`, `current_project`.
65
36
 
66
37
  Load planning-tier context files:
67
38
 
@@ -69,7 +40,11 @@ Load planning-tier context files:
69
40
  TIER_FILES=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" context load-tier planning --raw 2>/dev/null)
70
41
  ```
71
42
 
72
- **If `project_exists` is true:** Error project already initialized. Use `/dgs:progress`.
43
+ **If `project_exists` is true:** A project already exists at `${project_path}`.
44
+ - If you intended to work on it: run `/dgs:progress` (or `/dgs:switch-project <slug>` if it differs from the active project).
45
+ - If you intended to create a *different* project: re-invoke as `/dgs:new-project <new-slug>` with a slug that doesn't yet exist.
46
+
47
+ Exit the command.
73
48
 
74
49
  **Config validation:** If `project_exists` is false, check that config has workflow preferences:
75
50
 
@@ -90,8 +65,6 @@ git init
90
65
 
91
66
  ## 2. Brownfield Offer
92
67
 
93
- **If auto mode:** Skip to Step 4 (assume greenfield, synthesize PROJECT.md from provided document).
94
-
95
68
  **If `needs_codebase_map` is true** (from init — existing code detected but no codebase map):
96
69
 
97
70
  Use AskUserQuestion:
@@ -109,300 +82,65 @@ Exit command.
109
82
 
110
83
  **If "Skip mapping" OR `needs_codebase_map` is false:** Continue to Step 3.
111
84
 
112
- ## 2a. Auto Mode Config (auto mode only)
113
-
114
- **If auto mode:** Use existing product config (set during `/dgs:init-product`). No config questions needed here.
115
-
116
- Proceed to Step 4 (skip Step 3).
117
-
118
- ## 2b. Spec-Driven Project Creation (spec-driven auto mode only)
119
-
120
- **Triggered when:** `--auto` argument references a spec file.
121
-
122
- ### Parse the Spec
123
-
124
- Read the spec file and extract:
125
- - **Title** → becomes project name (slugified for folder name)
126
- - **Problem** section → project description / core value
127
- - **Goals** section → project goals
128
- - **Non-Goals** section → out of scope
129
- - **Requirements** (P0/P1/P2) → requirements hypotheses for PROJECT.md
130
- - **User Stories** → inform requirement specificity
131
- - **Technical Considerations** → inform research/architecture
132
- - **"Repos likely touched"** or similar section → repos for cross-checking (Step 2c)
133
-
134
- ### Derive Project Name
135
-
136
- Extract from spec title. Slugify for the project folder name. Example: "Review Configuration System" → `review-configuration-system`.
137
-
138
- ### Write PROJECT.md
139
-
140
- Create `${project_path}` with standard template structure, but derived entirely from the spec:
141
-
142
- ```markdown
143
- # [Spec Title]
144
-
145
- ## Vision
146
-
147
- [Derived from spec Problem + Goals sections]
148
-
149
- ## Core Value
150
-
151
- [Extracted from the spec's Problem section — the ONE thing this solves]
152
-
153
- ## Source Spec
154
-
155
- `[relative path to spec file]`
156
-
157
- ## Requirements
158
-
159
- ### Validated
160
-
161
- (None yet — ship to validate)
162
-
163
- ### Active
164
-
165
- [Requirements derived from spec P0 + P1 sections, each as a checkbox item]
166
-
167
- ### Out of Scope
168
-
169
- [From spec Non-Goals + P2 requirements explicitly deferred]
170
-
171
- ## Key Decisions
172
-
173
- | Decision | Rationale | Outcome |
174
- |----------|-----------|---------|
175
- | Spec-driven creation | Auto-generated from [spec id] | — |
176
- ```
177
-
178
- **Important:** Transform spec requirements into standard DGS format:
179
- - Each spec requirement becomes a user-centric statement: "User can X"
180
- - Group by logical category
181
- - Do NOT copy verbatim — restructure for project planning context
182
- - Add a `Source spec: [path]` line to PROJECT.md (per user decision — reference, not copy)
183
-
184
- ### Commit and Continue
185
-
186
- Commit PROJECT.md, then proceed to Done.
187
-
188
- **Branch name preview:** After the project folder is created, if `branching_strategy` is not `"none"`, show:
189
- ```
190
- Branch names will look like: dgs/{project-slug}/phase-03-auth
191
- ```
192
-
193
- After PROJECT.md is committed, proceed to Step 5 (Done).
194
-
195
- ## 2c. Repo Cross-Check (spec-driven mode, v2 only)
196
-
197
- **Triggered when:** spec-driven mode AND v2 install (REPOS.md exists).
198
-
199
- ### Extract Repos from Spec
200
-
201
- Parse the spec body for a "Repos likely touched" or "Technical Considerations" section. Extract any repo names mentioned.
202
-
203
- ### Load Registered Repos
204
-
205
- ```bash
206
- REPOS_JSON=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs repos list --raw)
207
- ```
208
-
209
- Parse the JSON to get the list of registered repo names.
210
-
211
- ### Compare
212
-
213
- For each repo name mentioned in the spec:
214
- - If it exists in REPOS.md registered repos → OK (no action)
215
- - If NOT registered → add to unregistered list
216
-
217
- ### Handle Unregistered Repos
85
+ ## 3. Write PROJECT.md
218
86
 
219
- If any unregistered repos found, display a blocking warning:
87
+ **Reject `--auto`:**
220
88
 
221
- ```
222
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
223
- DGS ► REPO CHECK
224
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
89
+ Read `$ARGUMENTS`. If it contains `--auto` anywhere, print this error and exit:
225
90
 
226
- The spec references repos not registered with this product:
227
91
  ```
92
+ Error: --auto is no longer supported for /dgs:new-project.
228
93
 
229
- For EACH unregistered repo, use AskUserQuestion:
94
+ Projects are now thin holders. Create specs with /dgs:write-spec and run
95
+ milestones with /dgs:new-milestone --auto <spec-id>.
230
96
 
231
- ```
232
- AskUserQuestion([{
233
- question: "Repo '{repo_name}' is not registered. How should we handle it?",
234
- header: "Repo",
235
- multiSelect: false,
236
- options: [
237
- { label: "Continue", description: "Proceed without registering this repo" },
238
- { label: "Register existing", description: "Register an already-existing repo at this path" },
239
- { label: "Create + Register", description: "Create folder, git init, and register" },
240
- { label: "Cancel", description: "Stop project creation" }
241
- ]
242
- }])
97
+ Usage: /dgs:new-project [<name>]
243
98
  ```
244
99
 
245
- **Handle each choice:**
100
+ **Collect the project name:**
246
101
 
247
- - **Continue:** Skip this repo, proceed to next
248
- - **Register existing:** Ask for path (suggest `../{repo_name}`), then run:
249
- ```bash
250
- node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs repos add "{path}" --name "{repo_name}"
251
- ```
252
- - **Create + Register:**
253
- ```bash
254
- mkdir -p ../{repo_name}
255
- cd ../{repo_name} && git init
256
- node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs repos add "../{repo_name}" --name "{repo_name}"
257
- ```
258
- - **Cancel:** Stop project creation entirely with message: "Project creation cancelled. Resolve repo registration and try again."
102
+ Strip flags from `$ARGUMENTS`. If any non-flag tokens remain:
103
+ - First token is the slug (already passed to `init new-project` in Step 1).
104
+ - Remaining tokens, joined with spaces, are the human-readable name.
105
+ - If only the slug was supplied (no name tokens), use the slug verbatim as the name.
259
106
 
260
- After all repos handled, continue to Step 2b (or back to the standard flow).
107
+ Otherwise (no non-flag tokens in `$ARGUMENTS`), ask exactly ONE inline freeform question for the name. Per `references/questioning.md`'s `<freeform_rule>`, AskUserQuestion is NOT used for single freeform strings — just prompt inline and read the next user message.
261
108
 
262
- If no unregistered repos OR not v2: skip silently.
109
+ **Concrete implementation (the ONLY path — do not use AskUserQuestion here):**
263
110
 
264
- ## 3. Deep Questioning
265
-
266
- **If auto mode:** Skip (already handled in Step 2a). Extract project context from provided document instead and proceed to Step 4.
267
-
268
- **Display stage banner:**
111
+ Output the prompt verbatim:
269
112
 
270
113
  ```
271
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
272
- DGS ► QUESTIONING
273
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
274
- ```
275
-
276
- **Open the conversation:**
277
-
278
- Ask inline (freeform, NOT AskUserQuestion):
279
-
280
- "What do you want to build?"
281
-
282
- Wait for their response. This gives you the context needed to ask intelligent follow-up questions.
283
-
284
- **Follow the thread:**
285
-
286
- Based on what they said, ask follow-up questions that dig into their response. Use AskUserQuestion with options that probe what they mentioned — interpretations, clarifications, concrete examples.
287
-
288
- Keep following threads. Each answer opens new threads to explore. Ask about:
289
- - What excited them
290
- - What problem sparked this
291
- - What they mean by vague terms
292
- - What it would actually look like
293
- - What's already decided
294
-
295
- Consult `questioning.md` for techniques:
296
- - Challenge vagueness
297
- - Make abstract concrete
298
- - Surface assumptions
299
- - Find edges
300
- - Reveal motivation
301
-
302
- **Check context (background, not out loud):**
303
-
304
- As you go, mentally check the context checklist from `questioning.md`. If gaps remain, weave questions naturally. Don't suddenly switch to checklist mode.
305
-
306
- **Decision gate:**
307
-
308
- When you could write a clear PROJECT.md, use AskUserQuestion:
309
-
310
- - header: "Ready?"
311
- - question: "I think I understand what you're after. Ready to create PROJECT.md?"
312
- - options:
313
- - "Create PROJECT.md" — Let's move forward
314
- - "Keep exploring" — I want to share more / ask me more
315
-
316
- If "Keep exploring" — ask what they want to add, or identify gaps and probe naturally.
317
-
318
- Loop until "Create PROJECT.md" selected.
319
-
320
- ## 4. Write PROJECT.md
321
-
322
- **If auto mode:** Synthesize from provided document. No "Ready?" gate was shown — proceed directly to commit.
323
-
324
- Synthesize all context into `${project_path}` using the template from `templates/project.md`.
325
-
326
- **For greenfield projects:**
327
-
328
- Initialize requirements as hypotheses:
329
-
330
- ```markdown
331
- ## Requirements
332
-
333
- ### Validated
334
-
335
- (None yet — ship to validate)
336
-
337
- ### Active
338
-
339
- - [ ] [Requirement 1]
340
- - [ ] [Requirement 2]
341
- - [ ] [Requirement 3]
342
-
343
- ### Out of Scope
344
-
345
- - [Exclusion 1] — [why]
346
- - [Exclusion 2] — [why]
114
+ What should I name this project? (one freeform line)
347
115
  ```
348
116
 
349
- All Active requirements are hypotheses until shipped and validated.
350
-
351
- **For brownfield projects (codebase map exists):**
352
-
353
- Infer Validated requirements from existing code:
354
-
355
- 1. Read `${project_root}/codebase/ARCHITECTURE.md` and `STACK.md`
356
- 2. Identify what the codebase already does
357
- 3. These become the initial Validated set
117
+ Then wait for the user's next message and treat the full message content (trimmed) as the project name. Do not ask any follow-ups.
358
118
 
359
- ```markdown
360
- ## Requirements
119
+ **Slugify for folder:**
361
120
 
362
- ### Validated
121
+ If `$SLUG_ARG` was supplied in Step 1, the slug is already determined (init normalized it via `generateSlugInternal`). Otherwise slugify the collected name (lowercase, spaces→`-`, strip non-alphanumeric except `-`). Either way, `${project_path}` from the init output is the source of truth — write to it.
363
122
 
364
- - [Existing capability 1] existing
365
- - ✓ [Existing capability 2] — existing
366
- - ✓ [Existing capability 3] — existing
123
+ **Determine `${project_path}`** from init output (already set by `init new-project`).
367
124
 
368
- ### Active
125
+ **Write the thin skeleton:**
369
126
 
370
- - [ ] [New requirement 1]
371
- - [ ] [New requirement 2]
127
+ Write `${project_path}` with exactly:
372
128
 
373
- ### Out of Scope
374
-
375
- - [Exclusion 1] — [why]
376
129
  ```
130
+ # <Project Name>
377
131
 
378
- **Key Decisions:**
379
-
380
- Initialize with any decisions made during questioning:
381
-
382
- ```markdown
383
- ## Key Decisions
384
-
385
- | Decision | Rationale | Outcome |
386
- |----------|-----------|---------|
387
- | [Choice from questioning] | [Why] | — Pending |
388
- ```
389
-
390
- **Last updated footer:**
391
-
392
- ```markdown
393
- ---
394
- *Last updated: [date] after initialization*
132
+ <One-line purpose — fill in to anchor this project.>
395
133
  ```
396
134
 
397
- Do not compress. Capture everything gathered.
135
+ (newline at end of file; no other sections).
398
136
 
399
- **Commit PROJECT.md:**
137
+ **Commit:**
400
138
 
401
139
  ```bash
402
- node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "docs: initialize project" --push --files ${project_path}
140
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "docs: initialize project <name>" --push --files ${project_path}
403
141
  ```
404
142
 
405
- ## 5. Done
143
+ ## 4. Done
406
144
 
407
145
  Present completion summary:
408
146
 
@@ -419,41 +157,32 @@ Present completion summary:
419
157
 
420
158
  ## Next Up
421
159
 
422
- **Start your first milestone:**
160
+ **Capture what you're building as a spec:**
423
161
 
424
- `/dgs:new-milestone`
162
+ `/dgs:write-spec`
425
163
 
426
- <sub>`/clear` first - fresh context window</sub>
427
- ```
164
+ Once your spec is final, run `/dgs:new-milestone --auto <spec-id>` to start the first milestone.
428
165
 
429
- **If spec-driven mode**, add:
430
-
431
- ```
432
- **Created from spec:** {spec_id} -- "{spec_title}"
433
-
434
- **Start first milestone from this spec:**
435
-
436
- `/dgs:new-milestone --auto <spec-id>`
166
+ <sub>`/clear` first - fresh context window</sub>
437
167
  ```
438
168
 
439
169
  </process>
440
170
 
441
171
  <output>
442
172
 
443
- - `${project_path}`
173
+ - `${project_path}` — thin skeleton PROJECT.md (title + one-liner)
444
174
  - `${config_path}` (from init-product, not created here)
445
175
 
446
176
  </output>
447
177
 
448
178
  <success_criteria>
449
179
 
450
- - [ ] Planning root directory created
451
- - [ ] Git repo initialized
452
- - [ ] Brownfield detection completed
453
- - [ ] Deep questioning completed (threads followed, not rushed)
454
- - [ ] PROJECT.md captures full context -- **committed**
180
+ - [ ] Planning root directory created (or detected)
181
+ - [ ] Git repo initialized (if missing)
182
+ - [ ] Brownfield detection offered (if existing code detected)
183
+ - [ ] PROJECT.md created as thin skeleton (title + one-liner only) — **committed**
455
184
  - [ ] Product config validated
456
- - [ ] User knows next step is `/dgs:new-milestone`
185
+ - [ ] User knows next step is `/dgs:write-spec`
457
186
 
458
187
  **Atomic commits:** Each phase commits its artifacts immediately. If context is lost, artifacts persist.
459
188
 
@@ -0,0 +1,59 @@
1
+ <purpose>
2
+ Run the DGS package-dependency-scan pipeline: detect each repo's ecosystem, select a scan tool via the Snyk → OSV-Scanner → native cascade, invoke the tool per target, normalise findings into canonical `pkg-NNN` shape, write a markdown report with YAML frontmatter to the appropriate lifecycle-aware location, and commit it atomically.
3
+
4
+ The CLI (`dgs-tools package-scan`) is the orchestration surface; this workflow is the slash-command wrapper that invokes the CLI and surfaces the result back to the user.
5
+ </purpose>
6
+
7
+ <context_tier>none</context_tier>
8
+
9
+ <process>
10
+
11
+ <step name="run-scan" priority="first">
12
+ Invoke the package-scan CLI. This composes runScan (scan orchestration), writePackageScanReport (markdown + YAML emission), and an atomic `dgs-tools commit --files` (report committed to the planning repo).
13
+
14
+ ```bash
15
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs package-scan
16
+ ```
17
+
18
+ **Expected output (success):**
19
+ ```
20
+ Wrote {report-path} ({N} findings, tool: {tool-string}).
21
+ ```
22
+
23
+ Where `{tool-string}` is `snyk`, `osv-scanner`, `npm-audit`, `pip-audit`, `govulncheck`, `bundler-audit`, `mixed` (different repos used different tools), or `none` (no tool ran — e.g., all repos had no manifests).
24
+
25
+ **Expected output (pinned tool unavailable):**
26
+ ```
27
+ Scan failed: tool_unavailable_on_pin — Install {tool-name}...
28
+ ```
29
+ Exit code non-zero; no report written; no commit attempted.
30
+
31
+ **Expected output (commit failure, report still written):**
32
+ ```
33
+ Wrote {report-path} ({N} findings, tool: {tool-string}).
34
+ Commit failed (report still on disk at {path}): <stderr>
35
+ ```
36
+ Exit code 0 (scan itself succeeded); user can commit the report manually.
37
+
38
+ **Report placement** (resolved inside the CLI):
39
+ 1. Active phase (`config.local.json execution.active_context` points at a valid phase directory) → `{phase-dir}/{phase-number}-PACKAGE-SCAN.md`
40
+ 2. Active milestone (slug only) → `{planning-root}/milestones/v{X}.{Y}-PACKAGE-SCAN.md`
41
+ 3. No active context → `{planning-root}/PACKAGE-SCAN-{YYYY-MM-DD-HHmm}.md`
42
+
43
+ </step>
44
+
45
+ <step name="present-result">
46
+ Show the user the report path and a one-line summary:
47
+
48
+ - If exit code 0: `Report written to: {path} — {N} findings`. Suggest `cat {path}` to review.
49
+ - If exit code non-zero: surface the diagnostic and exit the workflow. The user's next action is documented in the scan's stderr (install hint, config fix, etc.).
50
+
51
+ </step>
52
+
53
+ </process>
54
+
55
+ <success_criteria>
56
+ - [ ] `dgs-tools package-scan` exits 0 OR exits non-zero with a documented diagnostic (pinned tool unavailable, setup error)
57
+ - [ ] On exit 0: a report file exists at the resolved path AND is committed (or reported as commit-failed with the report still on disk)
58
+ - [ ] User sees the report path and finding count
59
+ </success_criteria>
@@ -180,6 +180,23 @@ If `context_path` is not null, display: `Using phase context from: ${context_pat
180
180
 
181
181
  **If `context_path` is null (no CONTEXT.md exists):**
182
182
 
183
+ Before giving up on context, check if the current milestone was created from a spec. Read PROJECT.md and look for a `**Source Spec:**` line:
184
+
185
+ ```bash
186
+ PROJECT_MD="${project_root}/PROJECT.md"
187
+ SOURCE_SPEC=""
188
+ if [ -f "$PROJECT_MD" ]; then
189
+ SOURCE_SPEC=$(grep -oP '\*\*Source Spec:\*\*\s*`?\K[^`\s]+' "$PROJECT_MD" 2>/dev/null || true)
190
+ fi
191
+ ```
192
+
193
+ Resolve `SOURCE_SPEC` relative to the planning root. If it exists as a file, set `PRD_FILE` to that path and jump to step 3.5 (PRD Express Path) to auto-generate CONTEXT.md from the spec. Log:
194
+ ```
195
+ [AUTO-RESOLVE] No CONTEXT.md — found source spec in PROJECT.md, generating via PRD Express Path
196
+ ```
197
+
198
+ **If no source spec found (or file doesn't exist):**
199
+
183
200
  **If `NON_INTERACTIVE` is true:**
184
201
  Log: `[AUTO-RESOLVE] No CONTEXT.md — continuing with research and requirements only`
185
202
  Continue to step 5 (skip the AskUserQuestion entirely).
@@ -459,10 +476,70 @@ Task(
459
476
 
460
477
  ## 9. Handle Planner Return
461
478
 
462
- - **`## PLANNING COMPLETE`:** Display plan count. If `--skip-verify` or `plan_checker_enabled` is false (from init): skip to step 13. Otherwise: step 10.
479
+ - **`## PLANNING COMPLETE`:** Display plan count. **Then run Step 9.5
480
+ (orchestrator commit + verification) BEFORE proceeding.** If
481
+ `--skip-verify` or `plan_checker_enabled` is false (from init): skip
482
+ to step 13. Otherwise: step 10.
463
483
  - **`## CHECKPOINT REACHED`:** Present to user, get response, spawn continuation (step 12)
464
484
  - **`## PLANNING INCONCLUSIVE`:** Show attempts, offer: Add context / Retry / Manual
465
485
 
486
+ ## Step 9.5 Commit planner-created files (REL-01)
487
+
488
+ Per spec AGENT-01, the planner emits a `### Created Files` list under
489
+ `## PLANNING COMPLETE` rather than running the commit itself. This step
490
+ performs the commit in shell-loop control flow where it cannot be
491
+ silently skipped, and verifies every reported file appears in HEAD.
492
+
493
+ 1. **Parse the planner output** for the `### Created Files` markdown
494
+ bullet list. Tolerant parsing accepts any of these forms:
495
+ a. `### Created Files` header followed by a bulleted list (canonical)
496
+ b. `## Created Files` header (drift-tolerant)
497
+ c. A `created_files:` YAML block (drift-tolerant fallback)
498
+
499
+ Extract a string array of paths (one path per bullet, leading `- `
500
+ stripped). If no list is found OR the list is empty, exit the
501
+ workflow with exit-code label `plan-commit-incomplete` and the
502
+ user-facing message:
503
+
504
+ ```
505
+ [plan-commit-incomplete] Plan-phase failed: planner did not emit a
506
+ Created Files list. Working tree left for inspection.
507
+ To retry once the underlying issue is resolved:
508
+ /dgs:plan-phase {PHASE} --skip-research
509
+ ```
510
+
511
+ 2. **Compose the commit invocation** using `dgs-tools commit-verify-plan`:
512
+
513
+ ```bash
514
+ COMMIT_RESULT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" \
515
+ commit-verify-plan "docs(${padded_phase}): create phase plan" \
516
+ --files "${created_files[@]}" \
517
+ --extra-files "${roadmap_path}" \
518
+ --push --raw)
519
+ OK=$(echo "$COMMIT_RESULT" | jq -r '.ok')
520
+ ```
521
+
522
+ 3. **On `OK !== true`** — fail loudly per the spec's clauses (a)–(d)
523
+ (non-zero exit, working tree unchanged, 1–3 line user-facing
524
+ message, discoverable via `dgs-tools health`):
525
+
526
+ ```bash
527
+ EXIT_LABEL=$(echo "$COMMIT_RESULT" | jq -r '.exitLabel')
528
+ REASON=$(echo "$COMMIT_RESULT" | jq -r '.reason')
529
+ echo "[${EXIT_LABEL}] /dgs:plan-phase failed at the orchestrator commit step (reason: ${REASON})"
530
+ echo "[${EXIT_LABEL}] Working tree is left for inspection. To diagnose: 'git status' under ${phase_dir}/"
531
+ echo "[${EXIT_LABEL}] To retry once the underlying issue is resolved: /dgs:plan-phase ${PHASE} --skip-research"
532
+ exit 1
533
+ ```
534
+
535
+ 4. **On `OK === true` with `reason === 'skipped_commit_docs_false'`:**
536
+ log silently (`commit_docs config disabled — skipping commit step`)
537
+ and continue to step 10 / 13.
538
+
539
+ 5. **On `OK === true` with `reason === 'committed'`:** log
540
+ `Plans committed: ${HASH} (verified ${N} reported files)` and
541
+ continue to step 10 / 13.
542
+
466
543
  ## 10. Spawn dgs-plan-checker Agent
467
544
 
468
545
  ### Discover prior phase SUMMARYs for continuity context (GAP-02)
@@ -691,6 +768,7 @@ Verification: {Passed | Passed with override | Skipped}
691
768
  - [ ] Existing plans checked
692
769
  - [ ] dgs-planner spawned with CONTEXT.md + RESEARCH.md
693
770
  - [ ] Plans created (PLANNING COMPLETE or CHECKPOINT handled)
771
+ - [ ] Orchestrator commits planner-reported `created_files` via `dgs-tools commit-verify-plan` (REL-01); on mismatch, exits `plan-commit-incomplete` with working tree unchanged
694
772
  - [ ] dgs-plan-checker spawned with CONTEXT.md
695
773
  - [ ] Verification passed OR user override OR max iterations with user decision
696
774
  - [ ] User sees status between agent spawns