@ktpartners/dgs-platform 2.8.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.
Files changed (94) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/README.md +41 -13
  3. package/agents/dgs-plan-checker.md +29 -3
  4. package/agents/dgs-planner.md +10 -0
  5. package/commands/dgs/abandon-quick.md +28 -0
  6. package/commands/dgs/add-tests.md +2 -2
  7. package/commands/dgs/audit-milestone.md +2 -2
  8. package/commands/dgs/capture-principle.md +11 -11
  9. package/commands/dgs/cleanup.md +2 -2
  10. package/commands/dgs/complete-milestone.md +11 -11
  11. package/commands/dgs/complete-quick.md +28 -0
  12. package/commands/dgs/create-milestone-job.md +2 -2
  13. package/commands/dgs/debug.md +3 -3
  14. package/commands/dgs/develop-idea.md +1 -1
  15. package/commands/dgs/fast.md +3 -1
  16. package/commands/dgs/health.md +1 -1
  17. package/commands/dgs/map-codebase.md +6 -6
  18. package/commands/dgs/new-milestone.md +5 -5
  19. package/commands/dgs/new-project.md +6 -6
  20. package/commands/dgs/plan-milestone-gaps.md +1 -1
  21. package/commands/dgs/progress.md +3 -3
  22. package/commands/dgs/quick-abandon.md +8 -0
  23. package/commands/dgs/quick-complete.md +8 -0
  24. package/commands/dgs/quick.md +10 -3
  25. package/commands/dgs/research-idea.md +2 -2
  26. package/commands/dgs/research-phase.md +3 -3
  27. package/commands/dgs/switch-project.md +1 -1
  28. package/commands/dgs/write-spec.md +3 -3
  29. package/deliver-great-systems/bin/dgs-tools.cjs +284 -30
  30. package/deliver-great-systems/bin/lib/commands.cjs +316 -31
  31. package/deliver-great-systems/bin/lib/commands.test.cjs +336 -0
  32. package/deliver-great-systems/bin/lib/config.cjs +39 -6
  33. package/deliver-great-systems/bin/lib/context.cjs +120 -0
  34. package/deliver-great-systems/bin/lib/core.cjs +28 -11
  35. package/deliver-great-systems/bin/lib/execution.cjs +49 -17
  36. package/deliver-great-systems/bin/lib/flat-migration.test.cjs +396 -0
  37. package/deliver-great-systems/bin/lib/ideas.cjs +206 -91
  38. package/deliver-great-systems/bin/lib/ideas.test.cjs +244 -1
  39. package/deliver-great-systems/bin/lib/init.cjs +306 -39
  40. package/deliver-great-systems/bin/lib/init.test.cjs +416 -6
  41. package/deliver-great-systems/bin/lib/jobs.cjs +124 -21
  42. package/deliver-great-systems/bin/lib/jobs.test.cjs +193 -74
  43. package/deliver-great-systems/bin/lib/migration.cjs +409 -1
  44. package/deliver-great-systems/bin/lib/migration.test.cjs +158 -1
  45. package/deliver-great-systems/bin/lib/milestone.cjs +54 -29
  46. package/deliver-great-systems/bin/lib/phase.cjs +128 -2
  47. package/deliver-great-systems/bin/lib/phase.test.cjs +420 -0
  48. package/deliver-great-systems/bin/lib/projects.cjs +28 -8
  49. package/deliver-great-systems/bin/lib/projects.test.cjs +86 -0
  50. package/deliver-great-systems/bin/lib/quick.cjs +584 -0
  51. package/deliver-great-systems/bin/lib/quick.test.cjs +596 -0
  52. package/deliver-great-systems/bin/lib/repos.cjs +25 -1
  53. package/deliver-great-systems/bin/lib/roadmap.cjs +34 -13
  54. package/deliver-great-systems/bin/lib/specs.cjs +3 -81
  55. package/deliver-great-systems/bin/lib/state-transition-gate.test.cjs +160 -0
  56. package/deliver-great-systems/bin/lib/state.cjs +142 -54
  57. package/deliver-great-systems/bin/lib/sync.cjs +75 -0
  58. package/deliver-great-systems/bin/lib/verify.cjs +80 -1
  59. package/deliver-great-systems/bin/lib/worktrees.cjs +764 -0
  60. package/deliver-great-systems/bin/lib/worktrees.test.cjs +887 -0
  61. package/deliver-great-systems/templates/claude-md.md +16 -0
  62. package/deliver-great-systems/workflows/abandon-quick.md +89 -0
  63. package/deliver-great-systems/workflows/add-idea.md +3 -3
  64. package/deliver-great-systems/workflows/add-tests.md +14 -0
  65. package/deliver-great-systems/workflows/add-todo.md +1 -0
  66. package/deliver-great-systems/workflows/approve-spec.md +25 -4
  67. package/deliver-great-systems/workflows/audit-phase.md +15 -5
  68. package/deliver-great-systems/workflows/cancel-job.md +1 -1
  69. package/deliver-great-systems/workflows/check-todos.md +2 -3
  70. package/deliver-great-systems/workflows/complete-milestone.md +197 -22
  71. package/deliver-great-systems/workflows/complete-quick.md +68 -0
  72. package/deliver-great-systems/workflows/consolidate-ideas.md +1 -1
  73. package/deliver-great-systems/workflows/create-milestone-job.md +4 -4
  74. package/deliver-great-systems/workflows/develop-idea.md +11 -11
  75. package/deliver-great-systems/workflows/diagnose-issues.md +14 -0
  76. package/deliver-great-systems/workflows/discuss-idea.md +1 -1
  77. package/deliver-great-systems/workflows/execute-phase.md +121 -32
  78. package/deliver-great-systems/workflows/execute-plan.md +12 -21
  79. package/deliver-great-systems/workflows/help.md +33 -29
  80. package/deliver-great-systems/workflows/init-product.md +2 -18
  81. package/deliver-great-systems/workflows/new-milestone.md +40 -24
  82. package/deliver-great-systems/workflows/new-project.md +22 -680
  83. package/deliver-great-systems/workflows/progress-all.md +133 -0
  84. package/deliver-great-systems/workflows/quick-abandon.md +89 -0
  85. package/deliver-great-systems/workflows/quick-complete.md +68 -0
  86. package/deliver-great-systems/workflows/quick.md +152 -23
  87. package/deliver-great-systems/workflows/refine-spec.md +1 -1
  88. package/deliver-great-systems/workflows/research-idea.md +8 -8
  89. package/deliver-great-systems/workflows/resume-project.md +2 -2
  90. package/deliver-great-systems/workflows/run-job.md +8 -8
  91. package/deliver-great-systems/workflows/validate-phase.md +39 -1
  92. package/deliver-great-systems/workflows/verify-work.md +14 -0
  93. package/deliver-great-systems/workflows/write-spec.md +2 -2
  94. package/package.json +1 -1
@@ -293,7 +293,7 @@ Loop through steps starting from `nextStepIndex`.
293
293
 
294
294
  **Mid-workflow push (after phase-completing steps):**
295
295
 
296
- After a step completes successfully, check if the step's command is a phase-completing workflow: `execute-phase`, `verify-work`, `audit-phase`, `audit-milestone`, `plan-phase`, `plan-milestone-gaps`, or `complete-milestone`.
296
+ After a step completes successfully, check if the step's command is a phase-completing workflow: `execute-phase`, `verify-work`, `audit-phase`, `audit-milestone`, `plan-phase`, `plan-milestone-gaps`, `validate-phase`, or `complete-milestone`.
297
297
 
298
298
  If so, and `sync_push` is not `"off"` and `cadence_push` is true:
299
299
  ```bash
@@ -359,11 +359,11 @@ After an `audit-milestone` step completes successfully, check the audit outcome.
359
359
 
360
360
  Note: --no-check jobs never trigger this code path because they have no audit-milestone step. The `check: false` header means no `audit-milestone` step is generated by `generateMilestoneSteps`, so handle_audit_result is never reached.
361
361
 
362
- Note: The original complete-milestone step (if present) remains at its position after the original
363
- audit step. Gap-fix steps (including re-audit) are inserted between the original audit step and
364
- complete-milestone. When the re-audit passes, the loop naturally reaches complete-milestone.
365
- If the re-audit finds MORE gaps, another cycle inserts steps after THAT re-audit, further
366
- deferring complete-milestone. This is correct -- complete-milestone only runs after a clean audit.
362
+ Note: audit-milestone is the last step of milestone jobs. complete-milestone is never
363
+ auto-run because it requires manual intervention (branch review, tag push, merge conflict
364
+ resolution). After audit passes, the job ends and the user runs /dgs:complete-milestone
365
+ manually. Gap-fix steps are inserted after the original audit step; when a re-audit passes,
366
+ the job completes and the user still runs complete-milestone manually.
367
367
 
368
368
  1. **Read audit status:**
369
369
  ```bash
@@ -378,9 +378,9 @@ deferring complete-milestone. This is correct -- complete-milestone only runs af
378
378
  ```
379
379
  - If `GAP_FIX_CYCLE == 0` (audit passed first time): Display clean banner:
380
380
  ```
381
- Audit passed -- no gaps found. Proceeding to complete milestone.
381
+ Audit passed -- no gaps found. Run /dgs:complete-milestone manually to archive.
382
382
  ```
383
- - Continue to the next step (should be `complete-milestone`).
383
+ - Job completes after this step. User runs /dgs:complete-milestone manually when ready.
384
384
 
385
385
  3. **If `gaps_found`:**
386
386
 
@@ -12,6 +12,14 @@ Audit Nyquist validation gaps for a completed phase. Generate missing tests. Upd
12
12
 
13
13
  ## 0. Initialize
14
14
 
15
+ **Parse `--scaffold` flag:**
16
+
17
+ ```
18
+ Parse `--scaffold` flag from PHASE_ARG (e.g., `/dgs:validate-phase 16 --scaffold`).
19
+ Set `SCAFFOLD_MODE = true` if `--scaffold` is present, `false` otherwise.
20
+ Strip `--scaffold` from PHASE_ARG before passing to `init phase-op`.
21
+ ```
22
+
15
23
  ```bash
16
24
  INIT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" init phase-op "${PHASE_ARG}")
17
25
  if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
@@ -83,10 +91,14 @@ Classify each requirement:
83
91
 
84
92
  Build: `{ task_id, requirement, gap_type, suggested_test_path, suggested_command }`
85
93
 
86
- No gaps skip to Step 6, set `nyquist_compliant: true`.
94
+ **Scaffold mode:** If `SCAFFOLD_MODE` is true, override all gap statuses to `PENDING_REVIEW` (not MISSING, not manual-only -- a distinct scaffold status meaning "gap identified but not yet triaged").
95
+
96
+ No gaps → skip to Step 6, set `nyquist_compliant: true`. In scaffold mode, this still produces a VALIDATION.md (with all requirements COVERED or PENDING_REVIEW).
87
97
 
88
98
  ## 4. Present Gap Plan
89
99
 
100
+ **Scaffold mode:** If `SCAFFOLD_MODE` is true, skip this step entirely (do not call AskUserQuestion). Proceed directly to Step 6.
101
+
90
102
  Call AskUserQuestion with gap table and options:
91
103
  1. "Fix all gaps" → Step 5
92
104
  2. "Skip — mark manual-only" → add to Manual-Only, Step 6
@@ -94,6 +106,8 @@ Call AskUserQuestion with gap table and options:
94
106
 
95
107
  ## 5. Spawn dgs-nyquist-auditor
96
108
 
109
+ **Scaffold mode:** If `SCAFFOLD_MODE` is true, skip this step entirely (do not spawn auditor). Proceed directly to Step 6.
110
+
97
111
  ```
98
112
  Task(
99
113
  prompt="Read ~/.claude/agents/dgs-nyquist-auditor.md for instructions.\n\n" +
@@ -114,6 +128,8 @@ Handle return:
114
128
 
115
129
  ## 6. Generate/Update VALIDATION.md
116
130
 
131
+ **Scaffold mode:** If `SCAFFOLD_MODE` is true, always use the State B (create) flow regardless of existing VALIDATION.md state. Gaps are marked as `PENDING_REVIEW` in the Per-Task Map.
132
+
117
133
  **State B (create):**
118
134
  1. Read template from `~/.claude/deliver-great-systems/templates/VALIDATION.md`
119
135
  2. Fill: frontmatter, Test Infrastructure, Per-Task Map, Manual-Only, Sign-Off
@@ -134,6 +150,15 @@ Handle return:
134
150
 
135
151
  ## 7. Commit
136
152
 
153
+ **Scaffold mode:** If `SCAFFOLD_MODE` is true:
154
+ - Only commit VALIDATION.md (no test files -- none were generated)
155
+ - Commit message: `docs(phase-${PHASE}): scaffold Nyquist validation`
156
+ - Use: `node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit-docs "docs(phase-${PHASE}): scaffold Nyquist validation"`
157
+ - Do NOT run the `git add {test_files}` / `git commit -m "test(..."` block
158
+ - Skip to Step 8
159
+
160
+ **Non-scaffold mode:**
161
+
137
162
  ```bash
138
163
  git add {test_files}
139
164
  git commit -m "test(phase-${PHASE}): add Nyquist validation tests"
@@ -143,6 +168,14 @@ node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit-docs "docs(p
143
168
 
144
169
  ## 8. Results + Routing
145
170
 
171
+ **Scaffold mode:** If `SCAFFOLD_MODE` is true, display scaffold-specific output and exit:
172
+ ```
173
+ DGS > PHASE {N} VALIDATION SCAFFOLDED
174
+ {M} requirements mapped, {K} gaps pending review.
175
+ > Fill gaps: /dgs:validate-phase {N}
176
+ ```
177
+ Display `/clear` reminder. Skip the Compliant/Partial output below.
178
+
146
179
  **Compliant:**
147
180
  ```
148
181
  DGS > PHASE {N} IS NYQUIST-COMPLIANT
@@ -174,4 +207,9 @@ Display `/clear` reminder.
174
207
  - [ ] VALIDATION.md created or updated
175
208
  - [ ] Test files committed separately
176
209
  - [ ] Results with routing presented
210
+ - [ ] --scaffold flag parsed and controls Steps 4-8
211
+ - [ ] Scaffold mode skips interactive gap plan (Step 4) and auditor (Step 5)
212
+ - [ ] Scaffold mode marks gaps as PENDING_REVIEW
213
+ - [ ] Scaffold mode commits docs-only with scaffold commit message
214
+ - [ ] Scaffold mode displays scaffold-specific results banner
177
215
  </success_criteria>
@@ -63,6 +63,20 @@ REPOS_MD=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" repos li
63
63
  ```
64
64
 
65
65
  Parse JSON for the list of registered repos with paths.
66
+
67
+ **Worktree-aware code directory resolution (resolveCodeContext):**
68
+
69
+ For each registered code repo, resolve the correct working directory. When a milestone or quick worktree is active, code operations must target the worktree directory, not the main checkout.
70
+
71
+ ```javascript
72
+ // In the agent's execution context, use resolveCodeContext to determine the code directory:
73
+ const { resolveCodeContext } = require('./bin/lib/context.cjs');
74
+ const ctx = resolveCodeContext(planningRoot, repoName);
75
+ // ctx.type: 'main' | 'milestone' | 'quick'
76
+ // ctx.directory: absolute path to the correct working directory
77
+ ```
78
+
79
+ Use `ctx.directory` (or the repo's main checkout path when no worktree is active) for all file reading, test execution, and code verification operations. Do NOT hardcode repo paths from REPOS.md when a worktree may be active.
66
80
  </step>
67
81
 
68
82
  <step name="check_active_session">
@@ -103,8 +103,8 @@ Then proceed normally. Only show this tip when ALL selected ideas lack enrichmen
103
103
  **Load supporting documents** from each selected idea's `docs/` directory:
104
104
 
105
105
  For each selected idea:
106
- a. Derive the idea's docs path: `${project_root}/ideas/pending/{idea_slug}/docs/` where `idea_slug` is derived from the idea filename (strip numeric prefix and .md suffix, e.g., `005-retry-logic.md` -> `retry-logic`).
107
- Alternative path: check if ideas use a flat structure where docs are at `${project_root}/docs/ideas/pending/{slug}-*.md`.
106
+ a. Derive the idea's docs path: `${project_root}/docs/ideas/{idea_slug}/` where `idea_slug` is derived from the idea filename (strip numeric prefix and .md suffix, e.g., `005-retry-logic.md` -> `retry-logic`).
107
+ Alternative path: check for research docs at `${project_root}/docs/ideas/{slug}-*.md`.
108
108
  b. If the docs/ directory exists, list all files in it:
109
109
  ```bash
110
110
  ls "${IDEA_DOCS_DIR}/" 2>/dev/null
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "bugs": {
9
9
  "url": "https://github.com/KT-Partners-Ltd/dgs-platform-docs/issues"
10
10
  },
11
- "version": "2.8.0",
11
+ "version": "3.0.4",
12
12
  "description": "Deliver Great Systems Platform — A meta-prompting, context engineering and spec-driven development system for Claude Code and Gemini by KT Partners.",
13
13
  "bin": {
14
14
  "dgs": "bin/install.js"