@ktpartners/dgs-platform 2.7.4 → 2.8.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.
- package/CHANGELOG.md +25 -0
- package/agents/dgs-executor.md +0 -52
- package/deliver-great-systems/bin/dgs-tools.cjs +66 -10
- package/deliver-great-systems/bin/lib/commands.cjs +1 -8
- package/deliver-great-systems/bin/lib/config.cjs +9 -90
- package/deliver-great-systems/bin/lib/context.cjs +2 -2
- package/deliver-great-systems/bin/lib/context.test.cjs +100 -100
- package/deliver-great-systems/bin/lib/core.cjs +17 -57
- package/deliver-great-systems/bin/lib/core.test.cjs +166 -170
- package/deliver-great-systems/bin/lib/docs.cjs +3 -3
- package/deliver-great-systems/bin/lib/docs.test.cjs +14 -7
- package/deliver-great-systems/bin/lib/execution.cjs +2 -2
- package/deliver-great-systems/bin/lib/execution.test.cjs +65 -67
- package/deliver-great-systems/bin/lib/ideas.cjs +4 -4
- package/deliver-great-systems/bin/lib/ideas.test.cjs +45 -44
- package/deliver-great-systems/bin/lib/init.cjs +9 -4
- package/deliver-great-systems/bin/lib/init.test.cjs +242 -175
- package/deliver-great-systems/bin/lib/jobs.cjs +1 -1
- package/deliver-great-systems/bin/lib/jobs.test.cjs +203 -202
- package/deliver-great-systems/bin/lib/migration.cjs +256 -281
- package/deliver-great-systems/bin/lib/migration.test.cjs +385 -440
- package/deliver-great-systems/bin/lib/milestone.cjs +1 -1
- package/deliver-great-systems/bin/lib/overlap.cjs +4 -4
- package/deliver-great-systems/bin/lib/overlap.test.cjs +45 -44
- package/deliver-great-systems/bin/lib/path-audit.test.cjs +16 -22
- package/deliver-great-systems/bin/lib/paths.cjs +60 -59
- package/deliver-great-systems/bin/lib/paths.test.cjs +192 -225
- package/deliver-great-systems/bin/lib/phase.cjs +5 -4
- package/deliver-great-systems/bin/lib/projects.cjs +8 -8
- package/deliver-great-systems/bin/lib/projects.test.cjs +75 -74
- package/deliver-great-systems/bin/lib/repos.cjs +94 -230
- package/deliver-great-systems/bin/lib/repos.test.cjs +84 -75
- package/deliver-great-systems/bin/lib/search.cjs +4 -4
- package/deliver-great-systems/bin/lib/specs.cjs +2 -2
- package/deliver-great-systems/bin/lib/sync.cjs +1 -1
- package/deliver-great-systems/bin/lib/template.cjs +3 -3
- package/deliver-great-systems/bin/lib/test-helpers.cjs +59 -162
- package/deliver-great-systems/bin/lib/verify.cjs +3 -3
- package/deliver-great-systems/references/planning-config.md +7 -8
- package/deliver-great-systems/workflows/add-tests.md +1 -1
- package/deliver-great-systems/workflows/approve-spec.md +1 -11
- package/deliver-great-systems/workflows/complete-milestone.md +2 -2
- package/deliver-great-systems/workflows/consolidate-ideas.md +1 -1
- package/deliver-great-systems/workflows/create-milestone-job.md +2 -2
- package/deliver-great-systems/workflows/discuss-phase.md +2 -2
- package/deliver-great-systems/workflows/execute-phase.md +63 -4
- package/deliver-great-systems/workflows/execute-plan.md +0 -51
- package/deliver-great-systems/workflows/find-related-ideas.md +1 -1
- package/deliver-great-systems/workflows/help.md +25 -58
- package/deliver-great-systems/workflows/init-product.md +14 -451
- package/deliver-great-systems/workflows/map-codebase.md +109 -0
- package/deliver-great-systems/workflows/new-project.md +0 -1
- package/deliver-great-systems/workflows/quick.md +6 -7
- package/deliver-great-systems/workflows/run-job.md +56 -0
- package/deliver-great-systems/workflows/settings.md +30 -0
- package/package.json +5 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<purpose>
|
|
2
|
-
Initialize a v2 multi-project product folder. Creates REPOS.md, PROJECTS.md, discovers repos. Handles fresh install
|
|
2
|
+
Initialize a v2 multi-project product folder. Creates REPOS.md, PROJECTS.md, discovers repos. Handles fresh install and already-initialized cases.
|
|
3
3
|
</purpose>
|
|
4
4
|
|
|
5
5
|
<context_tier>lite</context_tier>
|
|
6
6
|
|
|
7
7
|
<process>
|
|
8
8
|
|
|
9
|
-
## 0. Load Context
|
|
9
|
+
## 0. Load Context
|
|
10
10
|
|
|
11
11
|
Load project context via tier system:
|
|
12
12
|
```bash
|
|
@@ -15,86 +15,6 @@ TIER_FILES=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" contex
|
|
|
15
15
|
|
|
16
16
|
Use `TIER_FILES` JSON `files` array for project context (PROJECT.md, STATE.md, config.json).
|
|
17
17
|
|
|
18
|
-
Run layout detection:
|
|
19
|
-
```bash
|
|
20
|
-
LAYOUT_RESULT=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs repos detect-layout --raw)
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
Parse the JSON response to get the `suggested` field (`'root'` or `'dotplanning'`).
|
|
24
|
-
|
|
25
|
-
If the response indicates an existing layout is already configured (e.g., `v1_detected`, `already_initialized`, or existing `.planning/` directory), skip the layout prompt and proceed directly to Step 1 with `LAYOUT_MODE` unset. The v1/v2 handlers in Steps 3-4 will handle those cases.
|
|
26
|
-
|
|
27
|
-
For fresh repos only, present the layout choice using AskUserQuestion:
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
AskUserQuestion([{
|
|
31
|
-
question: "How should DGS organize planning files in this repo?",
|
|
32
|
-
header: "Repository Layout",
|
|
33
|
-
multiSelect: false,
|
|
34
|
-
options: [
|
|
35
|
-
{ label: "Root mode — planning files at repo root", description: "For dedicated planning repos where all files are DGS artifacts" },
|
|
36
|
-
{ label: ".planning/ mode — planning files in subdirectory", description: "For repos that also contain source code" }
|
|
37
|
-
]
|
|
38
|
-
}])
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Pre-select the option matching `suggested` from the detection result.
|
|
42
|
-
|
|
43
|
-
If user selects "Root mode": set `LAYOUT_MODE="root"`, proceed to Step 0a (namespace warning).
|
|
44
|
-
If user selects ".planning/ mode": set `LAYOUT_MODE="dotplanning"`, skip Step 0a, proceed to Step 1 (Get Product Name).
|
|
45
|
-
|
|
46
|
-
## 0a. Namespace Warning (root-mode only)
|
|
47
|
-
|
|
48
|
-
This step only runs if `LAYOUT_MODE="root"`.
|
|
49
|
-
|
|
50
|
-
Display warning:
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
54
|
-
DGS ► ROOT MODE WARNING
|
|
55
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
56
|
-
|
|
57
|
-
Warning: Root-mode assumes this entire repo is for DGS.
|
|
58
|
-
Don't use this in a repo with existing source code.
|
|
59
|
-
|
|
60
|
-
DGS will create the following directories at the repo root:
|
|
61
|
-
- phases/
|
|
62
|
-
- ideas/ (pending, rejected, done)
|
|
63
|
-
- specs/
|
|
64
|
-
- docs/product/
|
|
65
|
-
- jobs/ (when needed)
|
|
66
|
-
|
|
67
|
-
And these files:
|
|
68
|
-
- PROJECT.md
|
|
69
|
-
- ROADMAP.md
|
|
70
|
-
- REPOS.md
|
|
71
|
-
- PROJECTS.md
|
|
72
|
-
- dgs.config.json
|
|
73
|
-
- .gitignore (created or updated)
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
Use AskUserQuestion for blocking confirmation:
|
|
77
|
-
|
|
78
|
-
```
|
|
79
|
-
AskUserQuestion([{
|
|
80
|
-
question: "Proceed with root-mode setup?",
|
|
81
|
-
header: "Confirm",
|
|
82
|
-
multiSelect: false,
|
|
83
|
-
options: [
|
|
84
|
-
{ label: "Yes, proceed", description: "Create DGS planning structure at repo root" },
|
|
85
|
-
{ label: "Cancel", description: "Exit without creating anything" }
|
|
86
|
-
]
|
|
87
|
-
}])
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
If user selects "Cancel":
|
|
91
|
-
```
|
|
92
|
-
Setup cancelled. Run `/dgs:init-product` again to restart.
|
|
93
|
-
```
|
|
94
|
-
Exit.
|
|
95
|
-
|
|
96
|
-
If user selects "Yes, proceed": continue to Step 1 (Get Product Name).
|
|
97
|
-
|
|
98
18
|
## 1. Get Product Name
|
|
99
19
|
|
|
100
20
|
If `$ARGUMENTS` contains a product name, use it.
|
|
@@ -106,350 +26,13 @@ What would you like to name this product? (e.g., "my-saas-app", "mobile-platform
|
|
|
106
26
|
|
|
107
27
|
## 2. Run Init Product
|
|
108
28
|
|
|
109
|
-
If `LAYOUT_MODE` is `"root"`, pass the `--layout root` flag:
|
|
110
|
-
|
|
111
29
|
```bash
|
|
112
|
-
RESULT=$(node
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
If `LAYOUT_MODE` is `"dotplanning"` or unset, use the existing command without the flag (unchanged behavior):
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
RESULT=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs repos init-product "$PRODUCT_NAME" --raw)
|
|
30
|
+
RESULT=$(node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs repos init-product "$PRODUCT_NAME" --raw)
|
|
119
31
|
```
|
|
120
32
|
|
|
121
33
|
Parse JSON response. Route to the appropriate handler based on the response shape.
|
|
122
34
|
|
|
123
|
-
## 3. Handle
|
|
124
|
-
|
|
125
|
-
If response contains `v1_detected: true`:
|
|
126
|
-
|
|
127
|
-
```
|
|
128
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
129
|
-
DGS ► INIT PRODUCT
|
|
130
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
131
|
-
|
|
132
|
-
Existing v1 DGS setup detected (project: "{project_name}").
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
Use AskUserQuestion:
|
|
136
|
-
- header: "Migration"
|
|
137
|
-
- question: "Migrate '{project_name}' to v2 multi-project mode? This moves your planning files into a project subfolder. A backup git tag is created before any changes."
|
|
138
|
-
- options:
|
|
139
|
-
- "Migrate to v2" — Move planning files to project subfolder, enable multi-project
|
|
140
|
-
- "Keep v1 mode" — No changes, v1 continues working (permanent, won't ask again)
|
|
141
|
-
|
|
142
|
-
**If "Migrate to v2":**
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
MIGRATE_RESULT=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs repos migrate "{slug}" --raw)
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
Parse JSON. If `migrated: true`:
|
|
149
|
-
|
|
150
|
-
```
|
|
151
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
152
|
-
DGS ► MIGRATION COMPLETE ✓
|
|
153
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
154
|
-
|
|
155
|
-
Project "{project_name}" migrated to v2.
|
|
156
|
-
|
|
157
|
-
Files moved: {files_moved}
|
|
158
|
-
Backup tag: dgs-pre-v2-migration
|
|
159
|
-
Current project: {slug}
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
**Configure Base Branch (after migration):**
|
|
163
|
-
|
|
164
|
-
Prompt the user for their code repo base branch:
|
|
165
|
-
|
|
166
|
-
```
|
|
167
|
-
AskUserQuestion([{
|
|
168
|
-
question: "What is the base branch for your code repos? (e.g., main, develop, dev)",
|
|
169
|
-
header: "Git Configuration",
|
|
170
|
-
multiSelect: false,
|
|
171
|
-
freeform: true,
|
|
172
|
-
placeholder: ""
|
|
173
|
-
}])
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
Always ask — no auto-detection, no default pre-fill. The user types the branch name explicitly.
|
|
177
|
-
|
|
178
|
-
After receiving the answer, write to config:
|
|
179
|
-
```bash
|
|
180
|
-
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs config-set git.base_branch "$USER_ANSWER"
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
If the user provides an empty answer or skips, do NOT write anything — the default `main` from config-ensure-section already provides the fallback.
|
|
184
|
-
|
|
185
|
-
**Configure Workflow Discipline:**
|
|
186
|
-
|
|
187
|
-
Read the CLAUDE.md template:
|
|
188
|
-
```bash
|
|
189
|
-
CLAUDE_TEMPLATE=$(cat ~/.claude/deliver-great-systems/templates/claude-md.md)
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
Use AskUserQuestion:
|
|
193
|
-
```
|
|
194
|
-
AskUserQuestion([{
|
|
195
|
-
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.",
|
|
196
|
-
header: "Workflow Discipline",
|
|
197
|
-
multiSelect: false,
|
|
198
|
-
options: [
|
|
199
|
-
{ label: "Yes (Recommended)", description: "Creates CLAUDE.md with DGS command routing rules" },
|
|
200
|
-
{ label: "No", description: "Skip — no CLAUDE.md created" }
|
|
201
|
-
]
|
|
202
|
-
}])
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
**If "Yes":**
|
|
206
|
-
|
|
207
|
-
Check if `./CLAUDE.md` already exists in the project root (cwd):
|
|
208
|
-
|
|
209
|
-
- **If CLAUDE.md does NOT exist:** Create `./CLAUDE.md` with DGS section delimiters wrapping the template content:
|
|
210
|
-
|
|
211
|
-
```
|
|
212
|
-
<!-- DGS:BEGIN — managed by deliver-great-systems, do not edit this section manually -->
|
|
213
|
-
{CLAUDE_TEMPLATE content}
|
|
214
|
-
<!-- DGS:END -->
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
- **If CLAUDE.md ALREADY exists:** Read existing content. Check if it already contains `<!-- DGS:BEGIN`.
|
|
218
|
-
- If DGS section already present: replace everything between `<!-- DGS:BEGIN` and `<!-- DGS:END -->` (inclusive) with the latest template version (idempotent update).
|
|
219
|
-
- If no DGS section: append to the end of the file, separated by a blank line:
|
|
220
|
-
|
|
221
|
-
```
|
|
222
|
-
{existing CLAUDE.md content}
|
|
223
|
-
|
|
224
|
-
<!-- DGS:BEGIN — managed by deliver-great-systems, do not edit this section manually -->
|
|
225
|
-
{CLAUDE_TEMPLATE content}
|
|
226
|
-
<!-- DGS:END -->
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
Set config:
|
|
230
|
-
```bash
|
|
231
|
-
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs config-set workflow.discipline true
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
Display: `Workflow discipline enabled — CLAUDE.md added.`
|
|
235
|
-
|
|
236
|
-
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).
|
|
237
|
-
|
|
238
|
-
**If "No":**
|
|
239
|
-
|
|
240
|
-
Set config:
|
|
241
|
-
```bash
|
|
242
|
-
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs config-set workflow.discipline false
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
Display: `Skipped.`
|
|
246
|
-
|
|
247
|
-
Do NOT create or modify CLAUDE.md. Do NOT add CLAUDE.md to any commit.
|
|
248
|
-
|
|
249
|
-
**Configure Workflow Preferences (Round 1 — Core settings):**
|
|
250
|
-
|
|
251
|
-
```
|
|
252
|
-
AskUserQuestion([
|
|
253
|
-
{
|
|
254
|
-
header: "Mode",
|
|
255
|
-
question: "How do you want to work?",
|
|
256
|
-
multiSelect: false,
|
|
257
|
-
options: [
|
|
258
|
-
{ label: "YOLO (Recommended)", description: "Auto-approve, just execute" },
|
|
259
|
-
{ label: "Interactive", description: "Confirm at each step" }
|
|
260
|
-
]
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
header: "Depth",
|
|
264
|
-
question: "How thorough should planning be?",
|
|
265
|
-
multiSelect: false,
|
|
266
|
-
options: [
|
|
267
|
-
{ label: "Quick", description: "Ship fast (3-5 phases, 1-3 plans each)" },
|
|
268
|
-
{ label: "Standard", description: "Balanced scope and speed (5-8 phases, 3-5 plans each)" },
|
|
269
|
-
{ label: "Comprehensive", description: "Thorough coverage (8-12 phases, 5-10 plans each)" }
|
|
270
|
-
]
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
header: "Git Tracking",
|
|
274
|
-
question: "Commit planning docs to git?",
|
|
275
|
-
multiSelect: false,
|
|
276
|
-
options: [
|
|
277
|
-
{ label: "Yes (Recommended)", description: "Planning docs tracked in version control" },
|
|
278
|
-
{ label: "No", description: "Keep planning docs local-only (add to .gitignore)" }
|
|
279
|
-
]
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
header: "Branching",
|
|
283
|
-
question: "Git branching strategy?",
|
|
284
|
-
multiSelect: false,
|
|
285
|
-
options: [
|
|
286
|
-
{ label: "None (Recommended)", description: "Commit to current branch (fine for single projects)" },
|
|
287
|
-
{ label: "Per Phase", description: "Branch per phase, review before merging" },
|
|
288
|
-
{ label: "Per Milestone", description: "Branch per project, merge all at end (for parallel projects)" }
|
|
289
|
-
]
|
|
290
|
-
}
|
|
291
|
-
])
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
**Configure Workflow Preferences (Round 2 — Agents):**
|
|
295
|
-
|
|
296
|
-
```
|
|
297
|
-
AskUserQuestion([
|
|
298
|
-
{
|
|
299
|
-
header: "AI Models",
|
|
300
|
-
question: "Which AI models for planning agents?",
|
|
301
|
-
multiSelect: false,
|
|
302
|
-
options: [
|
|
303
|
-
{ label: "Balanced (Recommended)", description: "Sonnet for most agents — good quality/cost ratio" },
|
|
304
|
-
{ label: "Quality", description: "Opus for research/roadmap — higher cost, deeper analysis" },
|
|
305
|
-
{ label: "Budget", description: "Haiku where possible — fastest, lowest cost" }
|
|
306
|
-
]
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
header: "Research",
|
|
310
|
-
question: "Research before planning each phase? (adds tokens/time)",
|
|
311
|
-
multiSelect: false,
|
|
312
|
-
options: [
|
|
313
|
-
{ label: "Yes (Recommended)", description: "Investigate domain, find patterns, surface gotchas" },
|
|
314
|
-
{ label: "No", description: "Plan directly from requirements" }
|
|
315
|
-
]
|
|
316
|
-
},
|
|
317
|
-
{
|
|
318
|
-
header: "Plan Check",
|
|
319
|
-
question: "Verify plans will achieve their goals? (adds tokens/time)",
|
|
320
|
-
multiSelect: false,
|
|
321
|
-
options: [
|
|
322
|
-
{ label: "Yes (Recommended)", description: "Catch gaps before execution starts" },
|
|
323
|
-
{ label: "No", description: "Execute plans without verification" }
|
|
324
|
-
]
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
header: "Verifier",
|
|
328
|
-
question: "Verify work satisfies requirements after each phase? (adds tokens/time)",
|
|
329
|
-
multiSelect: false,
|
|
330
|
-
options: [
|
|
331
|
-
{ label: "Yes (Recommended)", description: "Confirm deliverables match phase goals" },
|
|
332
|
-
{ label: "No", description: "Trust execution, skip verification" }
|
|
333
|
-
]
|
|
334
|
-
}
|
|
335
|
-
])
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
**Write config.json** with all values collected above:
|
|
339
|
-
|
|
340
|
-
```json
|
|
341
|
-
{
|
|
342
|
-
"mode": "yolo|interactive",
|
|
343
|
-
"depth": "quick|standard|comprehensive",
|
|
344
|
-
"parallelization": true,
|
|
345
|
-
"commit_docs": true|false,
|
|
346
|
-
"model_profile": "quality|balanced|budget",
|
|
347
|
-
"workflow": {
|
|
348
|
-
"research": true|false,
|
|
349
|
-
"plan_check": true|false,
|
|
350
|
-
"verifier": true|false,
|
|
351
|
-
"nyquist_validation": true,
|
|
352
|
-
"auto_advance": false,
|
|
353
|
-
"discipline": true|false
|
|
354
|
-
},
|
|
355
|
-
"git": {
|
|
356
|
-
"branching_strategy": "none|phase|milestone",
|
|
357
|
-
"base_branch": "[from earlier question]",
|
|
358
|
-
"sync_push": "prompt",
|
|
359
|
-
"sync_pull": "prompt"
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
Smart defaults (not asked): `parallelization: true`, `auto_advance: false`, `nyquist_validation: true`.
|
|
365
|
-
|
|
366
|
-
**If commit_docs = No:** Add the planning root directory to `.gitignore`.
|
|
367
|
-
|
|
368
|
-
**Commit config:**
|
|
369
|
-
|
|
370
|
-
```bash
|
|
371
|
-
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "chore: add product config" --files ${config_path}
|
|
372
|
-
```
|
|
373
|
-
|
|
374
|
-
**Branch name preview:** If `branching_strategy` is not `"none"`, show:
|
|
375
|
-
```
|
|
376
|
-
Branch names will look like: dgs/{project-slug}/phase-03-auth
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
**Commit migrated files:**
|
|
380
|
-
|
|
381
|
-
```bash
|
|
382
|
-
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "docs: migrate product to v2 multi-project" --files .planning/REPOS.md .planning/PROJECTS.md dgs.config.json CLAUDE.md
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
Only include CLAUDE.md in the --files list if workflow discipline was enabled (user answered Yes).
|
|
386
|
-
|
|
387
|
-
```
|
|
388
|
-
───────────────────────────────────────────────────────────────
|
|
389
|
-
|
|
390
|
-
## ▶ Next Up
|
|
391
|
-
|
|
392
|
-
**Create another project** or start working
|
|
393
|
-
|
|
394
|
-
`/dgs:new-project` — add a second project
|
|
395
|
-
`/dgs:progress` — see current status
|
|
396
|
-
|
|
397
|
-
<sub>`/clear` first → fresh context window</sub>
|
|
398
|
-
|
|
399
|
-
───────────────────────────────────────────────────────────────
|
|
400
|
-
```
|
|
401
|
-
|
|
402
|
-
If migration fails (error response):
|
|
403
|
-
|
|
404
|
-
```
|
|
405
|
-
Migration failed: {error_message}
|
|
406
|
-
|
|
407
|
-
Your v1 setup is unchanged (rollback applied automatically).
|
|
408
|
-
Backup tag 'dgs-pre-v2-migration' was created before the attempt.
|
|
409
|
-
|
|
410
|
-
To retry: `/dgs:init-product`
|
|
411
|
-
To continue with v1: No action needed — v1 works as before.
|
|
412
|
-
```
|
|
413
|
-
|
|
414
|
-
Exit.
|
|
415
|
-
|
|
416
|
-
**If "Keep v1 mode":**
|
|
417
|
-
|
|
418
|
-
```bash
|
|
419
|
-
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs config-set v1_decline_migration true
|
|
420
|
-
```
|
|
421
|
-
|
|
422
|
-
```
|
|
423
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
424
|
-
DGS ► INIT PRODUCT
|
|
425
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
426
|
-
|
|
427
|
-
v1 mode preserved. Your DGS setup continues to work unchanged.
|
|
428
|
-
|
|
429
|
-
This choice is permanent — you won't be prompted again.
|
|
430
|
-
To continue using DGS, run `/dgs:new-project` as usual.
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
Exit.
|
|
434
|
-
|
|
435
|
-
## 3a. Handle v1 Declined (previously declined migration)
|
|
436
|
-
|
|
437
|
-
If response contains `v1_declined: true`:
|
|
438
|
-
|
|
439
|
-
```
|
|
440
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
441
|
-
DGS ► INIT PRODUCT
|
|
442
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
443
|
-
|
|
444
|
-
v1 mode is active (migration was previously declined).
|
|
445
|
-
Your DGS setup continues to work unchanged.
|
|
446
|
-
|
|
447
|
-
To continue: `/dgs:new-project`
|
|
448
|
-
```
|
|
449
|
-
|
|
450
|
-
Exit.
|
|
451
|
-
|
|
452
|
-
## 4. Handle Already Initialized
|
|
35
|
+
## 3. Handle Already Initialized
|
|
453
36
|
|
|
454
37
|
If response contains an error about already initialized:
|
|
455
38
|
|
|
@@ -466,7 +49,7 @@ To see existing projects: `/dgs:list-projects`
|
|
|
466
49
|
|
|
467
50
|
Exit.
|
|
468
51
|
|
|
469
|
-
##
|
|
52
|
+
## 4. Handle Fresh Install Success
|
|
470
53
|
|
|
471
54
|
If response contains `initialized: true`:
|
|
472
55
|
|
|
@@ -492,7 +75,7 @@ For each repo in `repos` array:
|
|
|
492
75
|
- {repo.name} ({repo.path})
|
|
493
76
|
```
|
|
494
77
|
|
|
495
|
-
|
|
78
|
+
Display:
|
|
496
79
|
```
|
|
497
80
|
Created:
|
|
498
81
|
- REPOS.md
|
|
@@ -500,25 +83,11 @@ Created:
|
|
|
500
83
|
- ideas/ (pending, rejected, done)
|
|
501
84
|
- specs/
|
|
502
85
|
- docs/product/
|
|
503
|
-
-
|
|
86
|
+
- config.json
|
|
504
87
|
- review-keys.json
|
|
505
88
|
- .gitignore
|
|
506
89
|
```
|
|
507
90
|
|
|
508
|
-
If standard .planning/ mode (existing behavior), display:
|
|
509
|
-
```
|
|
510
|
-
Created:
|
|
511
|
-
- .planning/REPOS.md
|
|
512
|
-
- .planning/PROJECTS.md
|
|
513
|
-
- .planning/ideas/ (pending, rejected, done)
|
|
514
|
-
- .planning/specs/
|
|
515
|
-
- .planning/docs/product/
|
|
516
|
-
- dgs.config.json (updated)
|
|
517
|
-
- .planning/review-keys.json
|
|
518
|
-
```
|
|
519
|
-
|
|
520
|
-
If `gitignore_synced` is true in the response (standard mode only), also show: ` - .gitignore (synced)`
|
|
521
|
-
|
|
522
91
|
**b2. Configure Base Branch:**
|
|
523
92
|
|
|
524
93
|
Prompt the user for their code repo base branch:
|
|
@@ -537,7 +106,7 @@ Always ask — no auto-detection, no default pre-fill. The user types the branch
|
|
|
537
106
|
|
|
538
107
|
After receiving the answer, write to config:
|
|
539
108
|
```bash
|
|
540
|
-
node
|
|
109
|
+
node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs config-set git.base_branch "$USER_ANSWER"
|
|
541
110
|
```
|
|
542
111
|
|
|
543
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.
|
|
@@ -546,7 +115,7 @@ If the user provides an empty answer or skips, do NOT write anything — the def
|
|
|
546
115
|
|
|
547
116
|
Read the CLAUDE.md template:
|
|
548
117
|
```bash
|
|
549
|
-
CLAUDE_TEMPLATE=$(cat
|
|
118
|
+
CLAUDE_TEMPLATE=$(cat /Users/adrian/.claude/deliver-great-systems/templates/claude-md.md)
|
|
550
119
|
```
|
|
551
120
|
|
|
552
121
|
Use AskUserQuestion:
|
|
@@ -588,7 +157,7 @@ Check if `./CLAUDE.md` already exists in the project root (cwd):
|
|
|
588
157
|
|
|
589
158
|
Set config:
|
|
590
159
|
```bash
|
|
591
|
-
node
|
|
160
|
+
node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs config-set workflow.discipline true
|
|
592
161
|
```
|
|
593
162
|
|
|
594
163
|
Display: `Workflow discipline enabled — CLAUDE.md added.`
|
|
@@ -599,7 +168,7 @@ Add `CLAUDE.md` to the commit file list for the init commit that follows (the `d
|
|
|
599
168
|
|
|
600
169
|
Set config:
|
|
601
170
|
```bash
|
|
602
|
-
node
|
|
171
|
+
node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs config-set workflow.discipline false
|
|
603
172
|
```
|
|
604
173
|
|
|
605
174
|
Display: `Skipped.`
|
|
@@ -728,7 +297,7 @@ Smart defaults (not asked): `parallelization: true`, `auto_advance: false`, `nyq
|
|
|
728
297
|
**Commit config:**
|
|
729
298
|
|
|
730
299
|
```bash
|
|
731
|
-
node
|
|
300
|
+
node /Users/adrian/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "chore: add product config" --files ${config_path}
|
|
732
301
|
```
|
|
733
302
|
|
|
734
303
|
**Branch name preview:** If `branching_strategy` is not `"none"`, show:
|
|
@@ -738,16 +307,10 @@ Branch names will look like: dgs/{project-slug}/phase-03-auth
|
|
|
738
307
|
|
|
739
308
|
**b7. Commit initialized files:**
|
|
740
309
|
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
```bash
|
|
744
|
-
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "docs: initialize product ${product_name} (root layout)" --files REPOS.md PROJECTS.md dgs.config.json .gitignore CLAUDE.md
|
|
745
|
-
```
|
|
746
|
-
|
|
747
|
-
For standard .planning/ mode, use the existing commit:
|
|
310
|
+
Use the `files_created` array from the init response to build the commit file list:
|
|
748
311
|
|
|
749
312
|
```bash
|
|
750
|
-
node
|
|
313
|
+
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
|
|
751
314
|
```
|
|
752
315
|
|
|
753
316
|
Only include CLAUDE.md in the --files list if workflow discipline was enabled (user answered Yes).
|
|
@@ -4,6 +4,8 @@ Orchestrate parallel codebase mapper agents to analyze registered repos and prod
|
|
|
4
4
|
Supports two modes:
|
|
5
5
|
- **Refresh mode** (default): Clears all per-repo subdirectories and unified files, then remaps everything from scratch.
|
|
6
6
|
- **Update mode** (`--only <repo-name>`): Clears only the targeted repo's subdirectory, re-maps it, then regenerates all unified files.
|
|
7
|
+
- **Auto mode** (`--auto`): Checks git history since last map. Skips if no changes, narrows to single repo if only one changed.
|
|
8
|
+
- **Force mode** (`--force`): Bypasses staleness gate, always remaps.
|
|
7
9
|
|
|
8
10
|
Each agent has fresh context, explores a specific focus area for a specific repo, and **writes documents directly**. The orchestrator only receives confirmation + line counts, then writes a summary.
|
|
9
11
|
|
|
@@ -49,6 +51,15 @@ Load planning-tier context files:
|
|
|
49
51
|
TIER_FILES=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" context load-tier planning --raw 2>/dev/null)
|
|
50
52
|
```
|
|
51
53
|
|
|
54
|
+
**Parse workflow-level flags from command arguments:**
|
|
55
|
+
|
|
56
|
+
These flags are parsed directly from the command arguments (NOT forwarded to the init CLI tool -- they are workflow-level flags):
|
|
57
|
+
|
|
58
|
+
- `--auto`: Set `auto_mode=true`. Present when invoked by the job orchestrator.
|
|
59
|
+
- `--force`: Set `force_remap=true`. Bypasses staleness gate even in auto mode.
|
|
60
|
+
|
|
61
|
+
Both default to false if not present in arguments.
|
|
62
|
+
|
|
52
63
|
**Mode determination:**
|
|
53
64
|
- `mode === "refresh"`: Default. Clear everything, remap all repos.
|
|
54
65
|
- `mode === "update"`: `--only` was used. Clear and remap only the targeted repo, then regenerate unified files.
|
|
@@ -83,6 +94,103 @@ No repos registered. Run /dgs:add-repo to register your first repo.
|
|
|
83
94
|
|
|
84
95
|
End workflow.
|
|
85
96
|
|
|
97
|
+
Continue to staleness_check.
|
|
98
|
+
</step>
|
|
99
|
+
|
|
100
|
+
<step name="staleness_check">
|
|
101
|
+
Determine whether remapping is necessary based on git history since the last map.
|
|
102
|
+
|
|
103
|
+
**Gate bypass conditions (skip this step entirely, proceed to check_existing):**
|
|
104
|
+
- `force_remap` is true (--force flag was set)
|
|
105
|
+
- `auto_mode` is false (interactive invocation -- always remap)
|
|
106
|
+
|
|
107
|
+
**Find the last map timestamp:**
|
|
108
|
+
|
|
109
|
+
Look for the most recent date from existing codebase docs:
|
|
110
|
+
- Per-repo docs: grep for `**Analysis Date:** YYYY-MM-DD` on line 3 of files in `${codebase_dir}/<repo>/`
|
|
111
|
+
- Unified docs: grep for `<!-- Synthesized: YYYY-MM-DD` on line 1 of files in `${codebase_dir}/`
|
|
112
|
+
- If no codebase docs exist at all: proceed normally (first run)
|
|
113
|
+
|
|
114
|
+
Take the most recent date found across all docs as `last_map_date`.
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Find most recent Analysis Date or Synthesized date from codebase docs
|
|
118
|
+
LAST_DATE=""
|
|
119
|
+
|
|
120
|
+
# Check per-repo docs
|
|
121
|
+
for repo_dir in ${codebase_dir}/*/; do
|
|
122
|
+
if [ -d "$repo_dir" ]; then
|
|
123
|
+
for doc in "$repo_dir"*.md; do
|
|
124
|
+
DATE=$(grep -oP '(?<=\*\*Analysis Date:\*\* )\d{4}-\d{2}-\d{2}' "$doc" 2>/dev/null | head -1)
|
|
125
|
+
[ -n "$DATE" ] && [ "$DATE" \> "$LAST_DATE" ] && LAST_DATE="$DATE"
|
|
126
|
+
done
|
|
127
|
+
fi
|
|
128
|
+
done
|
|
129
|
+
|
|
130
|
+
# Check unified docs (top-level codebase dir)
|
|
131
|
+
for doc in ${codebase_dir}/*.md; do
|
|
132
|
+
# Try Synthesized header format
|
|
133
|
+
DATE=$(grep -oP '(?<=Synthesized: )\d{4}-\d{2}-\d{2}' "$doc" 2>/dev/null | head -1)
|
|
134
|
+
[ -n "$DATE" ] && [ "$DATE" \> "$LAST_DATE" ] && LAST_DATE="$DATE"
|
|
135
|
+
# Try Analysis Date format (single-repo projects may have this at top level)
|
|
136
|
+
DATE=$(grep -oP '(?<=\*\*Analysis Date:\*\* )\d{4}-\d{2}-\d{2}' "$doc" 2>/dev/null | head -1)
|
|
137
|
+
[ -n "$DATE" ] && [ "$DATE" \> "$LAST_DATE" ] && LAST_DATE="$DATE"
|
|
138
|
+
done
|
|
139
|
+
|
|
140
|
+
if [ -z "$LAST_DATE" ]; then
|
|
141
|
+
echo "No existing codebase docs found. Proceeding with full map."
|
|
142
|
+
# Continue to check_existing
|
|
143
|
+
fi
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
If `LAST_DATE` is empty, proceed to check_existing (first run).
|
|
147
|
+
|
|
148
|
+
**Check git history for meaningful changes since last map:**
|
|
149
|
+
|
|
150
|
+
For each repo in `valid_repos`, run git log to find changed files:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
CHANGED_REPOS=""
|
|
154
|
+
for repo in ${valid_repos}; do
|
|
155
|
+
REPO_PATH="${repos[$repo].path}" # Get repo path from init JSON
|
|
156
|
+
|
|
157
|
+
# Get files changed since last map date
|
|
158
|
+
CHANGED_FILES=$(cd "$REPO_PATH" && git log --oneline --since="$LAST_DATE" --name-only --pretty=format: | sort -u | grep -v '^$')
|
|
159
|
+
|
|
160
|
+
# Filter out non-meaningful files
|
|
161
|
+
MEANINGFUL=$(echo "$CHANGED_FILES" | grep -v -E '(package-lock\.json|yarn\.lock|pnpm-lock\.yaml|\.gitignore|\.gitattributes|STATE\.md|ROADMAP\.md|REQUIREMENTS\.md|PROJECTS\.md|REPOS\.md|PROJECT\.md|config\.json|config\.local\.json)' | grep -v '^$')
|
|
162
|
+
|
|
163
|
+
if [ -n "$MEANINGFUL" ]; then
|
|
164
|
+
CHANGED_REPOS="$CHANGED_REPOS $repo"
|
|
165
|
+
fi
|
|
166
|
+
done
|
|
167
|
+
|
|
168
|
+
# Trim leading space
|
|
169
|
+
CHANGED_REPOS=$(echo "$CHANGED_REPOS" | xargs)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Decision logic:**
|
|
173
|
+
|
|
174
|
+
Count repos in CHANGED_REPOS:
|
|
175
|
+
|
|
176
|
+
- **No changed repos (CHANGED_REPOS is empty):** Log skip and exit workflow with SUCCESS:
|
|
177
|
+
```
|
|
178
|
+
[AUTO-RESOLVE] Codebase docs up to date (no meaningful changes since ${LAST_DATE}). Skipping remap.
|
|
179
|
+
```
|
|
180
|
+
End workflow (clean exit, not error).
|
|
181
|
+
|
|
182
|
+
- **Exactly 1 changed repo:** Auto-narrow to that repo. Update `mode` to "update" and set `only_repo` to the changed repo name. Log:
|
|
183
|
+
```
|
|
184
|
+
[AUTO-RESOLVE] Only ${changed_repo} changed since last map. Narrowing to --only ${changed_repo}.
|
|
185
|
+
```
|
|
186
|
+
Continue to check_existing with updated mode/only_repo.
|
|
187
|
+
|
|
188
|
+
- **2+ changed repos:** Proceed with full remap (no changes to mode/only_repo). Log:
|
|
189
|
+
```
|
|
190
|
+
[AUTO-RESOLVE] Multiple repos changed since last map. Proceeding with full remap.
|
|
191
|
+
```
|
|
192
|
+
Continue to check_existing.
|
|
193
|
+
|
|
86
194
|
Continue to check_existing.
|
|
87
195
|
</step>
|
|
88
196
|
|
|
@@ -618,4 +726,5 @@ End workflow.
|
|
|
618
726
|
- End-of-run summary with success/fail counts
|
|
619
727
|
- Mode-aware cleanup (refresh wipes all, update wipes only target repo)
|
|
620
728
|
- Cross-repo analysis generated for 2+ repos (CROSS-REPO.md)
|
|
729
|
+
- Staleness gate skips remap in --auto mode when no meaningful changes since last map
|
|
621
730
|
</success_criteria>
|