@ktpartners/dgs-platform 2.9.0 → 3.0.4
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 +82 -0
- package/README.md +26 -1
- package/agents/dgs-plan-checker.md +29 -3
- package/agents/dgs-planner.md +10 -0
- package/commands/dgs/abandon-quick.md +28 -0
- package/commands/dgs/add-tests.md +2 -2
- package/commands/dgs/audit-milestone.md +2 -2
- package/commands/dgs/capture-principle.md +11 -11
- package/commands/dgs/cleanup.md +2 -2
- package/commands/dgs/complete-milestone.md +11 -11
- package/commands/dgs/complete-quick.md +28 -0
- package/commands/dgs/create-milestone-job.md +2 -2
- package/commands/dgs/debug.md +3 -3
- package/commands/dgs/develop-idea.md +1 -1
- package/commands/dgs/fast.md +3 -1
- package/commands/dgs/health.md +1 -1
- package/commands/dgs/map-codebase.md +6 -6
- package/commands/dgs/new-milestone.md +5 -5
- package/commands/dgs/new-project.md +6 -6
- package/commands/dgs/plan-milestone-gaps.md +1 -1
- package/commands/dgs/progress.md +3 -3
- package/commands/dgs/quick-abandon.md +8 -0
- package/commands/dgs/quick-complete.md +8 -0
- package/commands/dgs/quick.md +10 -3
- package/commands/dgs/research-idea.md +2 -2
- package/commands/dgs/research-phase.md +3 -3
- package/commands/dgs/switch-project.md +1 -1
- package/commands/dgs/write-spec.md +3 -3
- package/deliver-great-systems/bin/dgs-tools.cjs +284 -30
- package/deliver-great-systems/bin/lib/commands.cjs +316 -31
- package/deliver-great-systems/bin/lib/commands.test.cjs +336 -0
- package/deliver-great-systems/bin/lib/config.cjs +39 -6
- package/deliver-great-systems/bin/lib/context.cjs +120 -0
- package/deliver-great-systems/bin/lib/core.cjs +28 -11
- package/deliver-great-systems/bin/lib/execution.cjs +49 -17
- package/deliver-great-systems/bin/lib/flat-migration.test.cjs +396 -0
- package/deliver-great-systems/bin/lib/ideas.cjs +206 -91
- package/deliver-great-systems/bin/lib/ideas.test.cjs +244 -1
- package/deliver-great-systems/bin/lib/init.cjs +306 -39
- package/deliver-great-systems/bin/lib/init.test.cjs +416 -6
- package/deliver-great-systems/bin/lib/jobs.cjs +124 -21
- package/deliver-great-systems/bin/lib/jobs.test.cjs +193 -74
- package/deliver-great-systems/bin/lib/migration.cjs +409 -1
- package/deliver-great-systems/bin/lib/migration.test.cjs +158 -1
- package/deliver-great-systems/bin/lib/milestone.cjs +54 -29
- package/deliver-great-systems/bin/lib/phase.cjs +128 -2
- package/deliver-great-systems/bin/lib/phase.test.cjs +420 -0
- package/deliver-great-systems/bin/lib/projects.cjs +28 -8
- package/deliver-great-systems/bin/lib/projects.test.cjs +86 -0
- package/deliver-great-systems/bin/lib/quick.cjs +584 -0
- package/deliver-great-systems/bin/lib/quick.test.cjs +596 -0
- package/deliver-great-systems/bin/lib/repos.cjs +25 -1
- package/deliver-great-systems/bin/lib/roadmap.cjs +34 -13
- package/deliver-great-systems/bin/lib/specs.cjs +3 -81
- package/deliver-great-systems/bin/lib/state-transition-gate.test.cjs +160 -0
- package/deliver-great-systems/bin/lib/state.cjs +142 -54
- package/deliver-great-systems/bin/lib/sync.cjs +75 -0
- package/deliver-great-systems/bin/lib/verify.cjs +80 -1
- package/deliver-great-systems/bin/lib/worktrees.cjs +764 -0
- package/deliver-great-systems/bin/lib/worktrees.test.cjs +887 -0
- package/deliver-great-systems/templates/claude-md.md +16 -0
- package/deliver-great-systems/workflows/abandon-quick.md +89 -0
- package/deliver-great-systems/workflows/add-idea.md +3 -3
- package/deliver-great-systems/workflows/add-tests.md +14 -0
- package/deliver-great-systems/workflows/add-todo.md +1 -0
- package/deliver-great-systems/workflows/approve-spec.md +25 -4
- package/deliver-great-systems/workflows/audit-phase.md +15 -5
- package/deliver-great-systems/workflows/cancel-job.md +1 -1
- package/deliver-great-systems/workflows/check-todos.md +2 -3
- package/deliver-great-systems/workflows/complete-milestone.md +197 -22
- package/deliver-great-systems/workflows/complete-quick.md +68 -0
- package/deliver-great-systems/workflows/consolidate-ideas.md +1 -1
- package/deliver-great-systems/workflows/create-milestone-job.md +4 -4
- package/deliver-great-systems/workflows/develop-idea.md +11 -11
- package/deliver-great-systems/workflows/diagnose-issues.md +14 -0
- package/deliver-great-systems/workflows/discuss-idea.md +1 -1
- package/deliver-great-systems/workflows/execute-phase.md +121 -32
- package/deliver-great-systems/workflows/execute-plan.md +12 -21
- package/deliver-great-systems/workflows/help.md +2 -2
- package/deliver-great-systems/workflows/init-product.md +2 -18
- package/deliver-great-systems/workflows/new-milestone.md +30 -24
- package/deliver-great-systems/workflows/progress-all.md +133 -0
- package/deliver-great-systems/workflows/quick-abandon.md +89 -0
- package/deliver-great-systems/workflows/quick-complete.md +68 -0
- package/deliver-great-systems/workflows/quick.md +152 -23
- package/deliver-great-systems/workflows/refine-spec.md +1 -1
- package/deliver-great-systems/workflows/research-idea.md +8 -8
- package/deliver-great-systems/workflows/resume-project.md +2 -2
- package/deliver-great-systems/workflows/run-job.md +8 -8
- package/deliver-great-systems/workflows/validate-phase.md +39 -1
- package/deliver-great-systems/workflows/verify-work.md +14 -0
- package/deliver-great-systems/workflows/write-spec.md +2 -2
- package/package.json +1 -1
|
@@ -46,12 +46,28 @@ When the request involves creating, modifying, or deleting code or configuration
|
|
|
46
46
|
- Route through `/dgs:debug`
|
|
47
47
|
- Example: "The tests started failing after yesterday's merge"
|
|
48
48
|
|
|
49
|
+
**Is there an active milestone?** Check if the work relates to the milestone scope.
|
|
50
|
+
- **Yes, related to milestone:** Route through `/dgs:quick` (milestone-context -- works in milestone worktree, no separate lifecycle)
|
|
51
|
+
- **Yes, but unrelated to milestone:** Route through `/dgs:quick --main` (product-level -- creates separate worktree off main)
|
|
52
|
+
- **No active milestone:** Route through `/dgs:quick` (product-level -- creates ephemeral worktree)
|
|
53
|
+
|
|
54
|
+
**Is it a trivial 1-line fix?** Route through `/dgs:fast` (always direct to main, zero overhead)
|
|
55
|
+
|
|
49
56
|
**When ambiguous, default to the smaller command.** Prefer `/dgs:fast` or `/dgs:quick` over `/dgs:execute-phase`.
|
|
50
57
|
|
|
51
58
|
Before invoking, mention briefly: "Small fix, routing through `/dgs:fast`." -- command name and short reason.
|
|
52
59
|
|
|
53
60
|
These routing rules apply whether the change is user-initiated or discovered by Claude during other work.
|
|
54
61
|
|
|
62
|
+
**Quick task lifecycle:**
|
|
63
|
+
- `/dgs:complete-quick` -- Merge quick work to main (rebase + merge + cleanup)
|
|
64
|
+
- `/dgs:abandon-quick` -- Discard quick work without merging
|
|
65
|
+
- These apply to product-level quicks only. Milestone-context quicks merge with the milestone.
|
|
66
|
+
|
|
67
|
+
**Quick outgrew its scope?** Do NOT try to promote a quick to a milestone. Complete it (`/dgs:complete-quick`) or abandon it (`/dgs:abandon-quick`), then start a proper milestone for the larger work.
|
|
68
|
+
|
|
69
|
+
**Need a product-level quick during milestone work?** Use `/dgs:quick --main "title"` to force a product-level quick that works off main, independent of the active milestone.
|
|
70
|
+
|
|
55
71
|
## 4. Override Requested? Acknowledge and Proceed
|
|
56
72
|
|
|
57
73
|
The user can bypass DGS routing by including one of these phrases in their request:
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
Abandon the active product-level quick task: remove worktree and branch without merging. All committed and uncommitted changes in the worktree are discarded.
|
|
3
|
+
|
|
4
|
+
Requires explicit confirmation before proceeding. This is destructive and cannot be undone.
|
|
5
|
+
</purpose>
|
|
6
|
+
|
|
7
|
+
<context_tier>none</context_tier>
|
|
8
|
+
|
|
9
|
+
<process>
|
|
10
|
+
|
|
11
|
+
**Step 1: Validate active quick**
|
|
12
|
+
|
|
13
|
+
Check for active product-level quick:
|
|
14
|
+
```bash
|
|
15
|
+
ACTIVE=$(node -e "
|
|
16
|
+
const q = require('$HOME/.claude/deliver-great-systems/bin/lib/quick.cjs');
|
|
17
|
+
const a = q.getActiveQuick(process.cwd());
|
|
18
|
+
process.stdout.write(JSON.stringify(a || { none: true }));
|
|
19
|
+
")
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Parse result. If `none` is true:
|
|
23
|
+
```
|
|
24
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
25
|
+
║ ERROR ║
|
|
26
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
27
|
+
|
|
28
|
+
No active product-level quick to abandon.
|
|
29
|
+
|
|
30
|
+
If working in a milestone context, changes are part of the milestone.
|
|
31
|
+
```
|
|
32
|
+
End workflow.
|
|
33
|
+
|
|
34
|
+
Extract `$SLUG` from result.
|
|
35
|
+
|
|
36
|
+
**Step 2: Confirm abandonment**
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
AskUserQuestion(
|
|
40
|
+
header: "Abandon Quick",
|
|
41
|
+
question: "Abandon quick '${SLUG}'? All uncommitted and committed changes will be lost.",
|
|
42
|
+
options: [
|
|
43
|
+
{ label: "Yes, abandon", description: "Remove worktree and branch — changes are lost" },
|
|
44
|
+
{ label: "No, keep", description: "Cancel — quick remains active" }
|
|
45
|
+
]
|
|
46
|
+
)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
If "No, keep": Display `Quick '${SLUG}' remains active.` End workflow.
|
|
50
|
+
|
|
51
|
+
**Step 3: Execute abandonment**
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
55
|
+
DGS ► ABANDONING QUICK
|
|
56
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
57
|
+
|
|
58
|
+
◆ Removing worktree and branch...
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
RESULT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" abandon-quick --confirmed 2>&1)
|
|
63
|
+
EXIT_CODE=$?
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Step 4: Display result**
|
|
67
|
+
|
|
68
|
+
**If exit code is 0 (success):**
|
|
69
|
+
```
|
|
70
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
71
|
+
DGS ► QUICK ABANDONED ✓
|
|
72
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
73
|
+
|
|
74
|
+
Quick '${SLUG}' abandoned. Worktree removed.
|
|
75
|
+
No changes merged to main.
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**If error:**
|
|
79
|
+
Display the error message from RESULT.
|
|
80
|
+
|
|
81
|
+
</process>
|
|
82
|
+
|
|
83
|
+
<success_criteria>
|
|
84
|
+
- [ ] Active product-level quick validated
|
|
85
|
+
- [ ] Confirmation required before abandonment
|
|
86
|
+
- [ ] Worktree and branch removed without merging
|
|
87
|
+
- [ ] active_context cleared
|
|
88
|
+
- [ ] No commits from quick branch appear on base_branch
|
|
89
|
+
</success_criteria>
|
|
@@ -33,7 +33,7 @@ Use `TIER_FILES` JSON `files` array for project context (PROJECT.md, STATE.md, c
|
|
|
33
33
|
|
|
34
34
|
<step name="ensure_directories">
|
|
35
35
|
```bash
|
|
36
|
-
mkdir -p ${project_root}/ideas
|
|
36
|
+
mkdir -p ${project_root}/ideas
|
|
37
37
|
```
|
|
38
38
|
</step>
|
|
39
39
|
|
|
@@ -72,7 +72,7 @@ Parse the JSON result to get `id`, `filename`, `path`.
|
|
|
72
72
|
|
|
73
73
|
<step name="git_commit">
|
|
74
74
|
```bash
|
|
75
|
-
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "ideas: add #${id} - ${title}" --push --files ${project_root}/ideas
|
|
75
|
+
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "ideas: add #${id} - ${title}" --push --files ${project_root}/ideas/${filename} ${project_root}/ideas/manifest.json
|
|
76
76
|
```
|
|
77
77
|
</step>
|
|
78
78
|
|
|
@@ -89,7 +89,7 @@ Nothing else -- no file path, no tags display, no next steps.
|
|
|
89
89
|
</process>
|
|
90
90
|
|
|
91
91
|
<success_criteria>
|
|
92
|
-
- [ ] Idea file exists in `ideas
|
|
92
|
+
- [ ] Idea file exists in `ideas/` with correct frontmatter
|
|
93
93
|
- [ ] Manifest updated with incremented next_id
|
|
94
94
|
- [ ] Git commit created
|
|
95
95
|
- [ ] Minimal confirmation displayed
|
|
@@ -66,6 +66,20 @@ This command works on completed phases. Run /dgs:execute-phase first.
|
|
|
66
66
|
```
|
|
67
67
|
Exit.
|
|
68
68
|
|
|
69
|
+
**Worktree-aware code directory resolution (resolveCodeContext):**
|
|
70
|
+
|
|
71
|
+
For each registered code repo, resolve the correct working directory. When a milestone or quick worktree is active, test generation must target the worktree directory, not the main checkout, so generated test files land in the correct location.
|
|
72
|
+
|
|
73
|
+
```javascript
|
|
74
|
+
// In the agent's execution context, use resolveCodeContext to determine the code directory:
|
|
75
|
+
const { resolveCodeContext } = require('./bin/lib/context.cjs');
|
|
76
|
+
const ctx = resolveCodeContext(planningRoot, repoName);
|
|
77
|
+
// ctx.type: 'main' | 'milestone' | 'quick'
|
|
78
|
+
// ctx.directory: absolute path to the correct working directory
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Use `ctx.directory` for all file operations within code repos.
|
|
82
|
+
|
|
69
83
|
Present banner:
|
|
70
84
|
```
|
|
71
85
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
@@ -143,16 +143,36 @@ Perform the approval state transition and audit trail update.
|
|
|
143
143
|
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs specs set-status --id "$SPEC_SLUG" --status final
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
-
2.
|
|
146
|
+
2. Mark source ideas as done (if any):
|
|
147
|
+
Read the spec file to extract `source_ideas` from frontmatter (array of idea filenames).
|
|
148
|
+
If `source_ideas` exists and is non-empty:
|
|
149
|
+
```bash
|
|
150
|
+
# For each source idea in the array:
|
|
151
|
+
for IDEA_FILE in ${SOURCE_IDEAS[@]}; do
|
|
152
|
+
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs ideas set-status --id "$IDEA_FILE" --status done 2>/dev/null || true
|
|
153
|
+
done
|
|
154
|
+
```
|
|
155
|
+
The `|| true` ensures silent skip if an idea is already done, consolidated, or not found (idempotent).
|
|
156
|
+
Track the idea file paths for inclusion in the commit.
|
|
157
|
+
|
|
158
|
+
3. Run `add-log-entry` to record the approval in the Refinement Log:
|
|
147
159
|
```bash
|
|
148
160
|
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs specs add-log-entry --id "$SPEC_SLUG" --date "$(date +%Y-%m-%d)" --version "$VERSION" --action Approved --summary "Spec approved after completeness validation"
|
|
149
161
|
```
|
|
150
162
|
|
|
151
|
-
|
|
163
|
+
4. Determine the spec filename from the validate output or Read step.
|
|
152
164
|
|
|
153
|
-
|
|
165
|
+
5. Commit the changes (include modified idea files):
|
|
154
166
|
```bash
|
|
155
|
-
|
|
167
|
+
# Build files list: spec + any modified idea files
|
|
168
|
+
COMMIT_FILES="$SPEC_FILE_PATH"
|
|
169
|
+
if [ -n "$SOURCE_IDEAS" ]; then
|
|
170
|
+
for IDEA_FILE in ${SOURCE_IDEAS[@]}; do
|
|
171
|
+
IDEA_PATH=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs ideas find --id "$IDEA_FILE" --raw 2>/dev/null | jq -r '.path // empty')
|
|
172
|
+
[ -n "$IDEA_PATH" ] && COMMIT_FILES="$COMMIT_FILES ${project_root}/${IDEA_PATH}"
|
|
173
|
+
done
|
|
174
|
+
fi
|
|
175
|
+
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "specs: approve $SPEC_ID v$VERSION" --push --files $COMMIT_FILES
|
|
156
176
|
```
|
|
157
177
|
</step>
|
|
158
178
|
|
|
@@ -180,5 +200,6 @@ Next steps:
|
|
|
180
200
|
- [ ] Validation errors block approval with clear messages
|
|
181
201
|
- [ ] Validation warnings allow user confirmation before proceeding
|
|
182
202
|
- [ ] Blocking open questions are detected and treated as errors
|
|
203
|
+
- [ ] Source ideas marked as done when spec has source_ideas in frontmatter
|
|
183
204
|
- [ ] Changes committed to git
|
|
184
205
|
</success_criteria>
|
|
@@ -51,15 +51,25 @@ REPOS_MD=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs repos list --r
|
|
|
51
51
|
|
|
52
52
|
Parse JSON for the list of registered repos with paths.
|
|
53
53
|
|
|
54
|
-
**Resolve test execution directory (v2 only):**
|
|
54
|
+
**Resolve test execution directory with resolveCodeContext (v2 only):**
|
|
55
55
|
|
|
56
56
|
If `dgs_mode` is `v2` and repos were detected from REPOS_MD:
|
|
57
57
|
|
|
58
58
|
1. Parse REPOS_MD JSON for the list of repos (each has `name` and `path`)
|
|
59
|
-
2.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
2. Determine the target repo name:
|
|
60
|
+
- If exactly 1 repo registered: use its name
|
|
61
|
+
- If multiple repos: check PLAN.md files in the phase for `<repos>` tags. Use the first repo name found. If no `<repos>` tag found, use the first registered repo's name.
|
|
62
|
+
3. **Resolve code context (worktree-aware):** Use resolveCodeContext to determine the correct working directory. When a milestone or quick worktree is active, the audit must examine code in the worktree directory, not the main checkout.
|
|
63
|
+
```javascript
|
|
64
|
+
const { resolveCodeContext } = require('./bin/lib/context.cjs');
|
|
65
|
+
const ctx = resolveCodeContext(planningRoot, repoName);
|
|
66
|
+
// ctx.type: 'main' | 'milestone' | 'quick'
|
|
67
|
+
// ctx.directory: absolute path to the correct working directory
|
|
68
|
+
```
|
|
69
|
+
Use `ctx.directory` as `TEST_CWD`.
|
|
70
|
+
4. If resolveCodeContext returns main type, fall back to resolving the repo path from REPOS_MD as before.
|
|
71
|
+
5. Resolve `TEST_CWD` to an absolute path: if the repo path is relative (starts with `../`), resolve it relative to `process.cwd()` / the current working directory.
|
|
72
|
+
6. Set `CWD_FLAG` to `--cwd "${TEST_CWD}"` if TEST_CWD was determined, otherwise set to empty string.
|
|
63
73
|
|
|
64
74
|
If `dgs_mode` is NOT `v2` or no repos detected: set `CWD_FLAG` to empty string (single-repo, no override needed).
|
|
65
75
|
|
|
@@ -130,7 +130,7 @@ Use AskUserQuestion:
|
|
|
130
130
|
<step name="execute_action">
|
|
131
131
|
**Work on it now:**
|
|
132
132
|
```bash
|
|
133
|
-
|
|
133
|
+
node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" todos set-status --id "[filename]" --status done
|
|
134
134
|
```
|
|
135
135
|
Update STATE.md todo count. Present problem/solution context. Begin work or ask how to proceed.
|
|
136
136
|
|
|
@@ -158,8 +158,7 @@ Re-run `init todos` to get updated count, then update STATE.md "### Pending Todo
|
|
|
158
158
|
If todo was moved to done/, commit the change:
|
|
159
159
|
|
|
160
160
|
```bash
|
|
161
|
-
|
|
162
|
-
node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit "docs: start work on todo - [title]" --files ${project_root}/todos/done/[filename] ${state_path}
|
|
161
|
+
node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit "docs: start work on todo - [title]" --files ${project_root}/todos/[filename] ${state_path}
|
|
163
162
|
```
|
|
164
163
|
|
|
165
164
|
Tool respects `commit_docs` config and gitignore automatically.
|
|
@@ -25,8 +25,8 @@ Read these AFTER running the initialize step, not before.
|
|
|
25
25
|
|
|
26
26
|
When a milestone completes:
|
|
27
27
|
|
|
28
|
-
1. Extract full milestone details to
|
|
29
|
-
2. Archive requirements to
|
|
28
|
+
1. Extract full milestone details to `milestones/v[X.Y]-ROADMAP.md`
|
|
29
|
+
2. Archive requirements to `milestones/v[X.Y]-REQUIREMENTS.md`
|
|
30
30
|
3. Update ROADMAP.md — replace milestone details with one-line summary
|
|
31
31
|
4. Delete REQUIREMENTS.md (fresh one for next milestone)
|
|
32
32
|
5. Perform full PROJECT.md evolution review
|
|
@@ -50,7 +50,7 @@ Load project context and resolve paths:
|
|
|
50
50
|
INIT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" init milestone-op)
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
Parse JSON for: `commit_docs`, `state_path`, `roadmap_path`, `project_path`, `requirements_path`, `phases_dir`, `archive_dir`, `project_root`, `phase_count`, `completed_phases`, `all_phases_complete`.
|
|
53
|
+
Parse JSON for: `commit_docs`, `state_path`, `roadmap_path`, `project_path`, `requirements_path`, `phases_dir`, `archive_dir`, `project_root`, `phase_count`, `completed_phases`, `all_phases_complete`, `milestone_slug`, `milestone_version`, `milestone_name`.
|
|
54
54
|
|
|
55
55
|
**Load verification tier context:**
|
|
56
56
|
|
|
@@ -65,6 +65,22 @@ Detect `JOB_MODE`:
|
|
|
65
65
|
- Check if `<job-mode>silent</job-mode>` is present in the invoking context
|
|
66
66
|
- Store as `JOB_MODE = true/false`
|
|
67
67
|
|
|
68
|
+
**Manual-only enforcement (CMP-01):**
|
|
69
|
+
|
|
70
|
+
If `JOB_MODE` is true OR `--auto` flag is present OR `--non-interactive` flag is present:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
74
|
+
║ ERROR ║
|
|
75
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
76
|
+
|
|
77
|
+
complete-milestone cannot run in automated/job mode.
|
|
78
|
+
Milestone completion requires manual oversight for conflict resolution.
|
|
79
|
+
|
|
80
|
+
**To fix:** Run `/dgs:complete-milestone` interactively.
|
|
81
|
+
```
|
|
82
|
+
**STOP.** Do not proceed. Exit the workflow.
|
|
83
|
+
|
|
68
84
|
</step>
|
|
69
85
|
|
|
70
86
|
<step name="verify_readiness">
|
|
@@ -169,6 +185,177 @@ Wait for confirmation.
|
|
|
169
185
|
|
|
170
186
|
</step>
|
|
171
187
|
|
|
188
|
+
<step name="rebase_and_merge_code_repos">
|
|
189
|
+
|
|
190
|
+
**Skip if:** No REPOS.md exists or no code repos registered. Log: `No code repos — skipping rebase and merge.`
|
|
191
|
+
|
|
192
|
+
**Check for active worktree:**
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
WORKTREE_LIST=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" worktrees list 2>/dev/null)
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Parse JSON. Find entry matching `milestone_slug`. If no worktree found:
|
|
199
|
+
|
|
200
|
+
<!-- LEGACY: One-time migration path for users upgrading mid-milestone.
|
|
201
|
+
This code path handles milestones started with the old branching model.
|
|
202
|
+
Can be removed in a future version once all users have upgraded. -->
|
|
203
|
+
|
|
204
|
+
**Legacy branch detection (mid-milestone upgrade):**
|
|
205
|
+
|
|
206
|
+
Before skipping code repo merge, check if a milestone branch exists in the main checkout without a worktree entry. This handles users who upgraded to the worktree model mid-milestone.
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
# Check for legacy milestone branches in each registered code repo
|
|
210
|
+
REPO_NAMES=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" repos list --names-only 2>/dev/null)
|
|
211
|
+
for REPO in $REPO_NAMES; do
|
|
212
|
+
REPO_PATH=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" repos resolve-path "$REPO" 2>/dev/null)
|
|
213
|
+
LEGACY_BRANCH=$(git -C "$REPO_PATH" branch --list "dgs/*${MILESTONE_SLUG}*" "milestone/${MILESTONE_SLUG}" "*-${MILESTONE_SLUG}" 2>/dev/null | head -1 | tr -d '* ')
|
|
214
|
+
done
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**If legacy branch found in any repo:**
|
|
218
|
+
|
|
219
|
+
Display: `Legacy milestone detected — merging without worktree.`
|
|
220
|
+
|
|
221
|
+
For each repo with a legacy branch:
|
|
222
|
+
1. Ensure on base branch: `git -C "$REPO_PATH" checkout ${BASE_BRANCH}`
|
|
223
|
+
2. Pull latest: `git -C "$REPO_PATH" pull --ff-only origin ${BASE_BRANCH}`
|
|
224
|
+
3. Rebase milestone branch: `git -C "$REPO_PATH" rebase ${BASE_BRANCH} ${LEGACY_BRANCH}`
|
|
225
|
+
- If conflicts: abort rebase and show manual instructions (same pattern as worktree flow)
|
|
226
|
+
4. Fast-forward merge: `git -C "$REPO_PATH" merge --ff-only ${LEGACY_BRANCH}`
|
|
227
|
+
5. Delete legacy branch: `git -C "$REPO_PATH" branch -d ${LEGACY_BRANCH}`
|
|
228
|
+
6. Push: `git -C "$REPO_PATH" push origin ${BASE_BRANCH}`
|
|
229
|
+
7. Skip worktree cleanup (no worktree exists)
|
|
230
|
+
|
|
231
|
+
Continue to gather_stats (skip the worktree-based merge flow below).
|
|
232
|
+
|
|
233
|
+
**If no legacy branch found either:**
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
No milestone worktree or legacy branch found for '${MILESTONE_SLUG}'.
|
|
237
|
+
No code repo merge needed — continuing with planning repo completion.
|
|
238
|
+
```
|
|
239
|
+
Skip to gather_stats.
|
|
240
|
+
|
|
241
|
+
**If worktree found:**
|
|
242
|
+
|
|
243
|
+
Display banner:
|
|
244
|
+
```
|
|
245
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
246
|
+
DGS ► MERGING CODE REPOS
|
|
247
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
**For each code repo in REPOS.md (sequentially):**
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
REPO_NAMES=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" repos list --names-only 2>/dev/null)
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
For each repo name:
|
|
257
|
+
|
|
258
|
+
1. **Check if repo is in the worktree state.** If not, skip (repo may not have been part of this milestone).
|
|
259
|
+
|
|
260
|
+
2. **Check if already merged.** The milestone branch may have already been merged for this repo in a prior run. Check if the branch still exists:
|
|
261
|
+
```bash
|
|
262
|
+
BRANCH_EXISTS=$(git -C "${MAIN_CHECKOUT}" branch --list "milestone/${MILESTONE_SLUG}" 2>/dev/null)
|
|
263
|
+
```
|
|
264
|
+
If branch does not exist, log `${REPO_NAME}: Already merged (branch deleted). Skipping.` and continue to next repo.
|
|
265
|
+
|
|
266
|
+
3. **Run rebaseAndMerge:**
|
|
267
|
+
```bash
|
|
268
|
+
MERGE_RESULT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" worktrees rebase-and-merge "${MILESTONE_SLUG}" --repo "${REPO_NAME}")
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
4. **Handle rebaseAndMerge result:**
|
|
272
|
+
|
|
273
|
+
**If `success: true`:**
|
|
274
|
+
```
|
|
275
|
+
✓ ${REPO_NAME}: Rebased and merged to ${BASE_BRANCH}
|
|
276
|
+
```
|
|
277
|
+
Continue to next repo.
|
|
278
|
+
|
|
279
|
+
**If `conflicted: true`:**
|
|
280
|
+
Display the `manualInstructions` from the result:
|
|
281
|
+
|
|
282
|
+
```
|
|
283
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
284
|
+
║ CHECKPOINT: Action Required ║
|
|
285
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
286
|
+
|
|
287
|
+
Rebase conflict in ${REPO_NAME}. Automatic resolution failed.
|
|
288
|
+
|
|
289
|
+
${MANUAL_INSTRUCTIONS}
|
|
290
|
+
|
|
291
|
+
──────────────────────────────────────────────────────────────
|
|
292
|
+
→ After resolving conflicts, re-run: /dgs:complete-milestone
|
|
293
|
+
──────────────────────────────────────────────────────────────
|
|
294
|
+
```
|
|
295
|
+
**STOP.** Do not proceed to the next repo or to archival. The user must resolve conflicts manually and re-run.
|
|
296
|
+
|
|
297
|
+
**If `success: false` (non-conflict error):**
|
|
298
|
+
```
|
|
299
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
300
|
+
║ ERROR ║
|
|
301
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
302
|
+
|
|
303
|
+
Merge failed for ${REPO_NAME}: ${ERROR}
|
|
304
|
+
|
|
305
|
+
**To fix:** Check the worktree state and re-run /dgs:complete-milestone
|
|
306
|
+
```
|
|
307
|
+
**STOP.**
|
|
308
|
+
|
|
309
|
+
**After all repos merged successfully:**
|
|
310
|
+
|
|
311
|
+
5. **Clean up worktree:**
|
|
312
|
+
```bash
|
|
313
|
+
node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" worktrees remove "${MILESTONE_SLUG}"
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
This removes:
|
|
317
|
+
- All worktree directories for this milestone
|
|
318
|
+
- Git worktree registrations
|
|
319
|
+
- Milestone branches
|
|
320
|
+
- active_context cleared to null
|
|
321
|
+
|
|
322
|
+
```
|
|
323
|
+
✓ Worktree cleanup complete for milestone '${MILESTONE_SLUG}'
|
|
324
|
+
✓ Active context cleared
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
6. **Continue to mark_planning_repo_complete.**
|
|
328
|
+
|
|
329
|
+
</step>
|
|
330
|
+
|
|
331
|
+
<step name="mark_planning_repo_complete">
|
|
332
|
+
|
|
333
|
+
**Guard:** This step only runs after ALL code repos have successfully merged in the rebase_and_merge_code_repos step. The sequential stop-on-failure behavior ensures that if any repo fails, the workflow stops before reaching this step.
|
|
334
|
+
|
|
335
|
+
Mark the planning repo's STATE.md as milestone-complete, commit, and push:
|
|
336
|
+
|
|
337
|
+
```
|
|
338
|
+
Marking milestone complete in planning repo...
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
MARK_RESULT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" state mark-milestone-complete --raw 2>&1)
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
Parse the result. If successful:
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit "docs(state): mark milestone ${MILESTONE_NAME} complete" --push --files "${STATE_PATH}"
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
```
|
|
352
|
+
✓ Planning repo marked complete and pushed.
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
If mark-milestone-complete fails, log a warning but continue to gather_stats (non-critical for the merge flow).
|
|
356
|
+
|
|
357
|
+
</step>
|
|
358
|
+
|
|
172
359
|
<step name="gather_stats">
|
|
173
360
|
|
|
174
361
|
Calculate milestone statistics:
|
|
@@ -420,7 +607,7 @@ ARCHIVE=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" milestone
|
|
|
420
607
|
```
|
|
421
608
|
|
|
422
609
|
The CLI handles:
|
|
423
|
-
- Creating
|
|
610
|
+
- Creating `milestones/` directory (planning root)
|
|
424
611
|
- Archiving ROADMAP.md to `milestones/v[X.Y]-ROADMAP.md`
|
|
425
612
|
- Archiving REQUIREMENTS.md to `milestones/v[X.Y]-REQUIREMENTS.md` with archive header
|
|
426
613
|
- Moving audit file to milestones if it exists
|
|
@@ -429,28 +616,16 @@ The CLI handles:
|
|
|
429
616
|
|
|
430
617
|
Extract from result: `version`, `date`, `phases`, `plans`, `tasks`, `accomplishments`, `archived`.
|
|
431
618
|
|
|
432
|
-
Verify: `✅ Milestone archived to
|
|
619
|
+
Verify: `✅ Milestone archived to milestones/`
|
|
433
620
|
|
|
434
|
-
**
|
|
435
|
-
- Log: `[AUTO-RESOLVE] Skipping phase archival in job mode`
|
|
436
|
-
- Keep phases in place (select "Skip" path automatically)
|
|
437
|
-
- Skip the AskUserQuestion below
|
|
438
|
-
|
|
439
|
-
**If `JOB_MODE` is false (default):**
|
|
621
|
+
**Phase archival (mandatory):** After milestone archival completes, archive phase directories. Phase directories are fully committed to git history, so they are always recoverable.
|
|
440
622
|
|
|
441
|
-
**Phase archival (optional):** After archival completes, ask the user:
|
|
442
|
-
|
|
443
|
-
AskUserQuestion(header="Archive Phases", question="Archive phase directories to milestones/?", options: "Yes — move to milestones/v[X.Y]-phases/" | "Skip — keep phases in place")
|
|
444
|
-
|
|
445
|
-
If "Yes": move phase directories to the milestone archive:
|
|
446
623
|
```bash
|
|
447
|
-
mkdir -p
|
|
624
|
+
mkdir -p milestones/v[X.Y]-phases
|
|
448
625
|
# For each phase directory in ${phases_dir}/:
|
|
449
|
-
mv ${phases_dir}/{phase-dir}
|
|
626
|
+
mv ${phases_dir}/{phase-dir} milestones/v[X.Y]-phases/
|
|
450
627
|
```
|
|
451
|
-
Verify: `✅ Phase directories archived to
|
|
452
|
-
|
|
453
|
-
If "Skip": Phase directories remain in `${phases_dir}/` as raw execution history. Use `/dgs:cleanup` later to archive retroactively.
|
|
628
|
+
Verify: `✅ Phase directories archived to milestones/v[X.Y]-phases/`
|
|
454
629
|
|
|
455
630
|
After archival, the AI still handles:
|
|
456
631
|
- Reorganizing ROADMAP.md with milestone grouping (requires judgment)
|
|
@@ -1211,7 +1386,7 @@ git push origin v[X.Y]
|
|
|
1211
1386
|
Commit milestone completion.
|
|
1212
1387
|
|
|
1213
1388
|
```bash
|
|
1214
|
-
node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit "chore: complete v[X.Y] milestone" --push --files
|
|
1389
|
+
node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit "chore: complete v[X.Y] milestone" --push --files milestones/v[X.Y]-ROADMAP.md milestones/v[X.Y]-REQUIREMENTS.md milestones/v[X.Y]-MILESTONE-AUDIT.md MILESTONES.md ${project_path} ${state_path}
|
|
1215
1390
|
```
|
|
1216
1391
|
```
|
|
1217
1392
|
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
Complete the active product-level quick task: rebase onto base_branch, fast-forward merge, push to remote, and clean up the worktree. Uses the shared rebaseAndMerge() flow from worktrees.cjs.
|
|
3
|
+
|
|
4
|
+
This workflow is only valid for product-level quicks. If the user is working in a milestone context, displays a clear error directing them to complete-milestone instead.
|
|
5
|
+
</purpose>
|
|
6
|
+
|
|
7
|
+
<context_tier>none</context_tier>
|
|
8
|
+
|
|
9
|
+
<process>
|
|
10
|
+
|
|
11
|
+
**Step 1: Validate and execute complete-quick**
|
|
12
|
+
|
|
13
|
+
Call the complete-quick CLI command which validates the active quick and executes the full flow:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
RESULT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" complete-quick 2>&1)
|
|
17
|
+
EXIT_CODE=$?
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**If exit code is non-zero** (error):
|
|
21
|
+
|
|
22
|
+
Check if error contains "No active product-level quick":
|
|
23
|
+
```
|
|
24
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
25
|
+
║ ERROR ║
|
|
26
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
27
|
+
|
|
28
|
+
No active product-level quick to complete.
|
|
29
|
+
|
|
30
|
+
If working in a milestone context, changes merge with the milestone.
|
|
31
|
+
Use: /dgs:complete-milestone
|
|
32
|
+
|
|
33
|
+
If you abandoned the quick, the worktree was already removed.
|
|
34
|
+
```
|
|
35
|
+
End workflow.
|
|
36
|
+
|
|
37
|
+
For other errors (including rebase conflicts), display the error message.
|
|
38
|
+
If the error contains manual resolution instructions, display them verbatim, then:
|
|
39
|
+
```
|
|
40
|
+
After resolving conflicts manually, re-run:
|
|
41
|
+
|
|
42
|
+
/dgs:complete-quick
|
|
43
|
+
```
|
|
44
|
+
End workflow.
|
|
45
|
+
|
|
46
|
+
**Step 2: Display success**
|
|
47
|
+
|
|
48
|
+
Parse JSON result from RESULT.
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
52
|
+
DGS ► QUICK COMPLETE ✓
|
|
53
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
54
|
+
|
|
55
|
+
Quick '${slug}' merged to main (${commits} commits).
|
|
56
|
+
Worktree cleaned up. Pushed to origin.
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
</process>
|
|
60
|
+
|
|
61
|
+
<success_criteria>
|
|
62
|
+
- [ ] Active product-level quick validated
|
|
63
|
+
- [ ] Rebase-before-merge flow executed via rebaseAndMerge()
|
|
64
|
+
- [ ] Worktree and branch cleaned up
|
|
65
|
+
- [ ] active_context cleared
|
|
66
|
+
- [ ] Success message includes commit count
|
|
67
|
+
- [ ] Conflict case shows manual resolution instructions
|
|
68
|
+
</success_criteria>
|
|
@@ -307,7 +307,7 @@ Write multi-line parameters (body, discussion, research) to temporary files usin
|
|
|
307
307
|
{
|
|
308
308
|
"id": 5,
|
|
309
309
|
"filename": "005-improve-api-resilience.md",
|
|
310
|
-
"path": "ideas/
|
|
310
|
+
"path": "ideas/005-improve-api-resilience.md",
|
|
311
311
|
"title": "Improve API resilience",
|
|
312
312
|
"consolidated_from": ["001", "003", "017"],
|
|
313
313
|
"moved_files": [
|