@ktpartners/dgs-platform 3.4.2 → 3.5.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 (44) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +2 -0
  3. package/agents/dgs-codebase-cross-analyzer.md +1 -1
  4. package/agents/dgs-codebase-mapper.md +1 -1
  5. package/agents/dgs-codebase-synthesizer.md +1 -1
  6. package/agents/dgs-phase-researcher.md +1 -1
  7. package/bin/install.js +12 -2
  8. package/deliver-great-systems/bin/dgs-tools.cjs +7 -1
  9. package/deliver-great-systems/bin/lib/commands.cjs +66 -29
  10. package/deliver-great-systems/bin/lib/commands.test.cjs +221 -1
  11. package/deliver-great-systems/bin/lib/context.cjs +6 -6
  12. package/deliver-great-systems/bin/lib/context.test.cjs +9 -9
  13. package/deliver-great-systems/bin/lib/core.cjs +199 -9
  14. package/deliver-great-systems/bin/lib/core.test.cjs +242 -0
  15. package/deliver-great-systems/bin/lib/execution.cjs +7 -0
  16. package/deliver-great-systems/bin/lib/governance.cjs +7 -7
  17. package/deliver-great-systems/bin/lib/init.cjs +25 -17
  18. package/deliver-great-systems/bin/lib/init.test.cjs +69 -10
  19. package/deliver-great-systems/bin/lib/jobs.cjs +16 -10
  20. package/deliver-great-systems/bin/lib/jobs.test.cjs +17 -1
  21. package/deliver-great-systems/bin/lib/migration.test.cjs +8 -0
  22. package/deliver-great-systems/bin/lib/milestone-archival.test.cjs +186 -0
  23. package/deliver-great-systems/bin/lib/milestone.cjs +168 -37
  24. package/deliver-great-systems/bin/lib/milestone.test.cjs +113 -1
  25. package/deliver-great-systems/bin/lib/path-audit.test.cjs +128 -0
  26. package/deliver-great-systems/bin/lib/paths.cjs +1 -2
  27. package/deliver-great-systems/bin/lib/paths.test.cjs +3 -4
  28. package/deliver-great-systems/bin/lib/phase-versioned.test.cjs +134 -0
  29. package/deliver-great-systems/bin/lib/phase.cjs +60 -7
  30. package/deliver-great-systems/bin/lib/phase.test.cjs +168 -1
  31. package/deliver-great-systems/bin/lib/projects.test.cjs +38 -0
  32. package/deliver-great-systems/bin/lib/repos.cjs +8 -4
  33. package/deliver-great-systems/bin/lib/repos.test.cjs +6 -2
  34. package/deliver-great-systems/bin/lib/roadmap.cjs +9 -6
  35. package/deliver-great-systems/bin/lib/state-snapshot.test.cjs +134 -0
  36. package/deliver-great-systems/bin/lib/state.cjs +173 -26
  37. package/deliver-great-systems/templates/milestone-archive.md +1 -1
  38. package/deliver-great-systems/templates/roadmap.md +12 -10
  39. package/deliver-great-systems/workflows/abandon-milestone.md +8 -1
  40. package/deliver-great-systems/workflows/abandon-quick.md +1 -1
  41. package/deliver-great-systems/workflows/new-milestone.md +46 -12
  42. package/deliver-great-systems/workflows/quick-abandon.md +1 -1
  43. package/deliver-great-systems/workflows/quick.md +3 -3
  44. package/package.json +3 -2
@@ -63,7 +63,7 @@ All subsequent steps use these resolved paths. Never reference PROJECT.md, STATE
63
63
  ## 1. Load Context
64
64
 
65
65
  - Read `${project_path}` (existing project, validated requirements, decisions)
66
- - Read `${product_milestones_path}` (product-level MILESTONES.md — authoritative record of what shipped across ALL projects in this product; used here for global version and phase continuity) — if `${product_milestones_exists}` is false, this is the first milestone in the product; skip and use defaults
66
+ - Read `${product_milestones_path}` (product-level MILESTONES.md — authoritative record of what shipped across ALL projects in this product; used here for the global version sequence phase numbering is NOT global, it restarts per milestone (see Step 10)) — if `${product_milestones_exists}` is false, this is the first milestone in the product; skip and use defaults
67
67
  - Optionally read `${project_root}/MILESTONES.md` (per-project shipped record) for project-specific context if it exists — do NOT use it for version or phase numbering, which are global across the product
68
68
  - Read `${state_path}` (pending todos, blockers) — if file does not exist, will be created in Step 5
69
69
  - Check for `${project_root}/MILESTONE-CONTEXT.md` (from /dgs:discuss-milestone)
@@ -112,9 +112,19 @@ The verb implements, in this exact canonical order:
112
112
  `adhoc_base_ref`. Any repo failure → ROLLBACK.
113
113
  4. **Confirm marker on the worktree entry (ADH-04 mirror).** Verify the entry
114
114
  now carries `adhoc:true` and `adhoc_base_ref`. If absent → ROLLBACK.
115
- 5. **Commit STATE.md with `adhoc:true` (ADH-04 primary).** Write the milestone
116
- fields (name, `vX.Y`, status) PLUS `adhoc: true` to STATE.md frontmatter (the
117
- `state set-adhoc` helper) and commit it. Commit failure → ROLLBACK.
115
+ 5. **Seed planning scaffolding + commit STATE.md & ROADMAP.md (ADH-04 primary).**
116
+ In ONE atomic commit the verb now also folds in the planning scaffolding that
117
+ lets a hand-added phase flow through discuss/plan/execute-phase:
118
+ - (5a) Write the milestone fields (name, `vX.Y`, status) PLUS `adhoc: true` AND
119
+ `current_milestone: vX.Y` (the authoritative version signal — see the
120
+ Sole setters note) to STATE.md frontmatter.
121
+ - (5b) Seed an `## Active Milestone: vX.Y` section into ROADMAP.md (idempotent)
122
+ terminated by a `---` anchor so `/dgs:add-phase` can extend it.
123
+ - (5c) Create the versioned phases directory `phases/<version>/` so the
124
+ version-aware resolver routes the first `add-phase` into it (restart-at-1
125
+ `01-<slug>`), with no requirements/roadmapper ceremony.
126
+ - (5d) Stage STATE.md AND ROADMAP.md and commit. Commit failure → ROLLBACK
127
+ (the three artifacts are rolled back together).
118
128
  6. **Set `execution.active_context` LAST (ADH-03).**
119
129
  `config-local-set execution.active_context {slug}` — set ONLY after steps 2–5
120
130
  succeed, so `detectQuickMode` never observes a half-created milestone (no leak
@@ -122,12 +132,18 @@ The verb implements, in this exact canonical order:
122
132
 
123
133
  **ROLLBACK (ADH-18) — undo in reverse, only this invocation's artifacts:**
124
134
  1. `active_context` is set last, so a pre-step-6 failure never set it.
125
- 2. Reset the just-made STATE.md commit if step 5 committed.
126
- 3. Remove created worktrees: `worktrees remove {slug} --force` (also nulls
135
+ 2. Drop the seeded versioned dir `phases/<version>/` (it is untracked, so a
136
+ commit-reset alone never removes it).
137
+ 3. If step 5 committed: reset the just-made STATE.md + ROADMAP.md commit (reverts
138
+ both `current_milestone` and the Active Milestone section). If the failure hit
139
+ the PRE-commit window (5c/5d): restore STATE.md + ROADMAP.md from HEAD so the
140
+ on-disk `current_milestone` + roadmap section never survive.
141
+ 4. Remove created worktrees: `worktrees remove {slug} --force` (also nulls
127
142
  `active_context`).
128
- 4. Delete the base ref: `git -C <planning_root> update-ref -d refs/dgs/adhoc/{slug}/base`.
129
- 5. Print an actionable error naming what was rolled back; exit non-zero.
130
- Leave NO residue — no ref, no worktree entry, no marker, `active_context` unset.
143
+ 5. Delete the base ref: `git -C <planning_root> update-ref -d refs/dgs/adhoc/{slug}/base`.
144
+ 6. Print an actionable error naming what was rolled back; exit non-zero.
145
+ Leave NO residue — no versioned dir, no roadmap section, no `current_milestone`,
146
+ no ref, no worktree entry, no marker, `active_context` unset.
131
147
 
132
148
  **On success — ADH-22 advisory.** The verb prints:
133
149
  "Advisory: while this ad-hoc milestone is active, any product-level (`--main`)
@@ -250,6 +266,10 @@ Status: Defining requirements
250
266
  Last activity: [today] — Milestone v[X.Y] started (from spec [spec-id])
251
267
  ```
252
268
 
269
+ Also write the structured frontmatter field `current_milestone: v[X.Y]` into STATE.md frontmatter (the chosen version, validated against `^v\d+\.\d+$` — e.g. `current_milestone: v25.0`). This is the authoritative structured version signal that resolveMilestoneVersion reads.
270
+
271
+ > **Sole setters:** `current_milestone` is the authoritative structured version signal. The new-milestone flow, `init.cjs`, AND `milestone create-adhoc` are the SOLE setters of this field — no other command sets or clears it. Only ever write a grammar-valid `v[X.Y]` value; never write an out-of-grammar value.
272
+
253
273
  ### Commit
254
274
 
255
275
  ```bash
@@ -398,6 +418,10 @@ Status: Defining requirements
398
418
  Last activity: [today] — Milestone v[X.Y] started
399
419
  ```
400
420
 
421
+ Also write the structured frontmatter field `current_milestone: v[X.Y]` into STATE.md frontmatter (the chosen version, validated against `^v\d+\.\d+$` — e.g. `current_milestone: v25.0`). This is the authoritative structured version signal that resolveMilestoneVersion reads.
422
+
423
+ > **Sole setters:** `current_milestone` is the authoritative structured version signal. The new-milestone flow, `init.cjs`, AND `milestone create-adhoc` are the SOLE setters of this field — no other command sets or clears it. Only ever write a grammar-valid `v[X.Y]` value; never write an out-of-grammar value.
424
+
401
425
  Keep Accumulated Context section from previous milestone.
402
426
 
403
427
  ## 6. Cleanup and Commit
@@ -604,7 +628,7 @@ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "docs: define mile
604
628
  ◆ Spawning roadmapper...
605
629
  ```
606
630
 
607
- **Starting phase number:** Read `${product_milestones_path}` for last phase number (phase numbers are global across the product the next phase continues the sequence from the most recent milestone shipped in any project). Continue from there (e.g., v23.0 ended at phase 148 v23.1 starts at phase 149). If `${product_milestones_exists}` is false (first milestone in the product): start phase numbering at 1.
631
+ **Starting phase number:** Phase numbering restarts at 1 for every milestone (written zero-padded as `01`). The new milestone's phases live in its own `phases/<version>/` directory, so numbers are scoped to this milestone do NOT read MILESTONES.md for phase continuity (versions stay global; phase numbers do not).
608
632
 
609
633
  ```
610
634
  Task(prompt="
@@ -622,7 +646,7 @@ Task(prompt="
622
646
 
623
647
  <instructions>
624
648
  Create roadmap for milestone v[X.Y]:
625
- 1. Start phase numbering from [N]
649
+ 1. Start phase numbering at 1 (zero-padded `01`)
626
650
  2. Derive phases from THIS MILESTONE's requirements only
627
651
  3. Map every requirement to exactly one phase
628
652
  4. Derive 2-5 success criteria per phase (observable user behaviors)
@@ -673,6 +697,16 @@ Success criteria:
673
697
  node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs commit "docs: create milestone v[X.Y] roadmap ([N] phases)" --push --files ${roadmap_path} ${state_path} ${project_root}/REQUIREMENTS.md
674
698
  ```
675
699
 
700
+ ### Create the versioned phases directory
701
+
702
+ Materialise the milestone's own active-phases directory so the version-aware resolver and add-phase land in it (only the new-milestone flow creates a versioned directory):
703
+
704
+ ```bash
705
+ node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs phase init-versioned-dir --raw
706
+ ```
707
+
708
+ This fails loud (non-zero, remediation message) if `current_milestone` is undeterminable — it never writes `phases/v1.0/`. It is idempotent (re-running is a safe no-op).
709
+
676
710
  ## 10.5. Overlap Check (v2 only)
677
711
 
678
712
  If v2 install (PROJECTS.md or REPOS.md exists in the planning root):
@@ -745,7 +779,7 @@ Also: `/dgs:plan-phase [N]` — skip discussion, plan directly
745
779
  - [ ] dgs-roadmapper spawned with phase numbering context
746
780
  - [ ] Roadmap files written immediately (not draft)
747
781
  - [ ] User feedback incorporated (if any)
748
- - [ ] ROADMAP.md phases continue from previous milestone
782
+ - [ ] ROADMAP.md phase numbering restarts at 01 for this milestone
749
783
  - [ ] All commits made (if planning docs committed)
750
784
  - [ ] User knows next step: `/dgs:discuss-phase [N]`
751
785
  - [ ] Auto mode: spec parsed and validated (status: final)
@@ -13,7 +13,7 @@ Requires explicit confirmation before proceeding. This is destructive and cannot
13
13
  Check for active product-level quick:
14
14
  ```bash
15
15
  ACTIVE=$(node -e "
16
- const q = require('$HOME/.claude/deliver-great-systems/bin/lib/quick.cjs');
16
+ const q = require(process.env.HOME + '/.claude/deliver-great-systems/bin/lib/quick.cjs');
17
17
  const a = q.getActiveQuick(process.cwd());
18
18
  process.stdout.write(JSON.stringify(a || { none: true }));
19
19
  ")
@@ -97,7 +97,7 @@ Detect whether this is a product-level or milestone-context quick:
97
97
 
98
98
  ```bash
99
99
  QUICK_DETECT=$(node -e "
100
- const q = require('$HOME/.claude/deliver-great-systems/bin/lib/quick.cjs');
100
+ const q = require(process.env.HOME + '/.claude/deliver-great-systems/bin/lib/quick.cjs');
101
101
  const r = q.detectQuickMode(process.cwd(), ${FORCE_MAIN:-false});
102
102
  process.stdout.write(JSON.stringify(r));
103
103
  ")
@@ -113,7 +113,7 @@ Check the one-active-quick guard and create worktree:
113
113
 
114
114
  ```bash
115
115
  QUICK_START=$(node -e "
116
- const q = require('$HOME/.claude/deliver-great-systems/bin/lib/quick.cjs');
116
+ const q = require(process.env.HOME + '/.claude/deliver-great-systems/bin/lib/quick.cjs');
117
117
  const r = q.startProductQuick(process.cwd(), '${DESCRIPTION}', ${QUICK_MODE_FLAG ? \"'\" + QUICK_MODE_FLAG + \"'\" : 'null'});
118
118
  process.stdout.write(JSON.stringify(r));
119
119
  ")
@@ -158,7 +158,7 @@ QUICK_REPO_CWD=$(node -e "
158
158
  const path = require('path');
159
159
  const localPath = path.join(process.cwd(), 'config.local.json');
160
160
  const local = JSON.parse(fs.readFileSync(localPath, 'utf-8'));
161
- const { loadConfig } = require('$HOME/.claude/deliver-great-systems/bin/lib/core.cjs');
161
+ const { loadConfig } = require(process.env.HOME + '/.claude/deliver-great-systems/bin/lib/core.cjs');
162
162
  const cfg = loadConfig(process.cwd());
163
163
  const proj = cfg.current_project;
164
164
  const wt = (local.projects && local.projects[proj] && local.projects[proj].worktrees && local.projects[proj].worktrees['${MILESTONE_SLUG}']) || {};
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": "3.4.2",
11
+ "version": "3.5.0",
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"
@@ -57,6 +57,7 @@
57
57
  "scripts": {
58
58
  "build:hooks": "node scripts/build-hooks.js",
59
59
  "prepublishOnly": "npm run build:hooks",
60
- "test": "node --test tests/*.test.cjs"
60
+ "test": "node --test tests/*.test.cjs deliver-great-systems/bin/lib/*.test.cjs",
61
+ "test:lib": "node --test deliver-great-systems/bin/lib/*.test.cjs"
61
62
  }
62
63
  }