@ktpartners/dgs-platform 2.6.2
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/LICENSE +38 -0
- package/README.md +851 -0
- package/agents/dgs-codebase-cross-analyzer.md +183 -0
- package/agents/dgs-codebase-mapper.md +782 -0
- package/agents/dgs-codebase-synthesizer.md +156 -0
- package/agents/dgs-debugger.md +1256 -0
- package/agents/dgs-executor.md +550 -0
- package/agents/dgs-integration-checker.md +481 -0
- package/agents/dgs-nyquist-auditor.md +178 -0
- package/agents/dgs-phase-researcher.md +563 -0
- package/agents/dgs-phase-verifier.md +450 -0
- package/agents/dgs-plan-checker.md +708 -0
- package/agents/dgs-planner.md +1324 -0
- package/agents/dgs-project-researcher.md +631 -0
- package/agents/dgs-research-synthesizer.md +249 -0
- package/agents/dgs-roadmapper.md +652 -0
- package/agents/dgs-verifier.md +607 -0
- package/bin/install.js +2073 -0
- package/commands/dgs/add-doc.md +45 -0
- package/commands/dgs/add-idea.md +38 -0
- package/commands/dgs/add-phase.md +43 -0
- package/commands/dgs/add-repo.md +54 -0
- package/commands/dgs/add-tests.md +41 -0
- package/commands/dgs/add-todo.md +47 -0
- package/commands/dgs/approve-spec.md +38 -0
- package/commands/dgs/audit-milestone.md +36 -0
- package/commands/dgs/audit-phase.md +37 -0
- package/commands/dgs/cancel-job.md +23 -0
- package/commands/dgs/capture-principle.md +143 -0
- package/commands/dgs/check-todos.md +45 -0
- package/commands/dgs/cleanup.md +18 -0
- package/commands/dgs/complete-milestone.md +136 -0
- package/commands/dgs/complete-project.md +70 -0
- package/commands/dgs/consolidate-ideas.md +50 -0
- package/commands/dgs/create-milestone-job.md +37 -0
- package/commands/dgs/debug.md +164 -0
- package/commands/dgs/develop-idea.md +53 -0
- package/commands/dgs/discuss-idea.md +41 -0
- package/commands/dgs/discuss-phase.md +83 -0
- package/commands/dgs/execute-phase.md +41 -0
- package/commands/dgs/fast.md +38 -0
- package/commands/dgs/find-related-ideas.md +43 -0
- package/commands/dgs/health.md +28 -0
- package/commands/dgs/help.md +22 -0
- package/commands/dgs/import-spec.md +36 -0
- package/commands/dgs/init-product.md +28 -0
- package/commands/dgs/insert-phase.md +32 -0
- package/commands/dgs/join-discord.md +18 -0
- package/commands/dgs/list-docs.md +40 -0
- package/commands/dgs/list-ideas.md +42 -0
- package/commands/dgs/list-jobs.md +22 -0
- package/commands/dgs/list-phase-assumptions.md +46 -0
- package/commands/dgs/list-projects.md +57 -0
- package/commands/dgs/list-specs.md +40 -0
- package/commands/dgs/map-codebase.md +92 -0
- package/commands/dgs/new-milestone.md +44 -0
- package/commands/dgs/new-project.md +42 -0
- package/commands/dgs/node-repair.md +26 -0
- package/commands/dgs/overlap-check.md +20 -0
- package/commands/dgs/pause-work.md +38 -0
- package/commands/dgs/plan-milestone-gaps.md +34 -0
- package/commands/dgs/plan-phase.md +44 -0
- package/commands/dgs/progress.md +24 -0
- package/commands/dgs/quick.md +41 -0
- package/commands/dgs/reactivate-project.md +70 -0
- package/commands/dgs/reapply-patches.md +110 -0
- package/commands/dgs/refine-spec.md +38 -0
- package/commands/dgs/reject-idea.md +43 -0
- package/commands/dgs/remove-doc.md +44 -0
- package/commands/dgs/remove-phase.md +31 -0
- package/commands/dgs/remove-repo.md +69 -0
- package/commands/dgs/research-idea.md +43 -0
- package/commands/dgs/research-phase.md +189 -0
- package/commands/dgs/restore-idea.md +45 -0
- package/commands/dgs/resume-work.md +40 -0
- package/commands/dgs/rollback-job.md +24 -0
- package/commands/dgs/run-job.md +35 -0
- package/commands/dgs/search.md +40 -0
- package/commands/dgs/set-profile.md +34 -0
- package/commands/dgs/settings.md +38 -0
- package/commands/dgs/switch-project.md +58 -0
- package/commands/dgs/undo-consolidation.md +42 -0
- package/commands/dgs/update-idea.md +44 -0
- package/commands/dgs/update.md +37 -0
- package/commands/dgs/validate-phase.md +35 -0
- package/commands/dgs/verify-work.md +39 -0
- package/commands/dgs/write-spec.md +49 -0
- package/deliver-great-systems/.planning/phases/09-backend-wiring-and-error-handling/09-01-SUMMARY.md +84 -0
- package/deliver-great-systems/.planning/phases/09-backend-wiring-and-error-handling/09-02-SUMMARY.md +86 -0
- package/deliver-great-systems/.planning/phases/10-v1-to-v2-migration-flow/10-01-SUMMARY.md +85 -0
- package/deliver-great-systems/bin/dgs-tools.cjs +1444 -0
- package/deliver-great-systems/bin/lib/auto-test.cjs +1365 -0
- package/deliver-great-systems/bin/lib/commands.cjs +570 -0
- package/deliver-great-systems/bin/lib/config.cjs +417 -0
- package/deliver-great-systems/bin/lib/conflict-agent.cjs +1063 -0
- package/deliver-great-systems/bin/lib/conflict-agent.test.cjs +554 -0
- package/deliver-great-systems/bin/lib/context.cjs +929 -0
- package/deliver-great-systems/bin/lib/context.test.cjs +693 -0
- package/deliver-great-systems/bin/lib/core.cjs +744 -0
- package/deliver-great-systems/bin/lib/core.test.cjs +822 -0
- package/deliver-great-systems/bin/lib/docs.cjs +919 -0
- package/deliver-great-systems/bin/lib/docs.test.cjs +211 -0
- package/deliver-great-systems/bin/lib/execution.cjs +705 -0
- package/deliver-great-systems/bin/lib/execution.test.cjs +1472 -0
- package/deliver-great-systems/bin/lib/frontmatter.cjs +324 -0
- package/deliver-great-systems/bin/lib/ideas.cjs +1406 -0
- package/deliver-great-systems/bin/lib/ideas.test.cjs +1417 -0
- package/deliver-great-systems/bin/lib/identity.cjs +125 -0
- package/deliver-great-systems/bin/lib/init.cjs +1114 -0
- package/deliver-great-systems/bin/lib/init.test.cjs +1271 -0
- package/deliver-great-systems/bin/lib/jobs.cjs +2015 -0
- package/deliver-great-systems/bin/lib/jobs.test.cjs +2619 -0
- package/deliver-great-systems/bin/lib/merge-conflicts.cjs +654 -0
- package/deliver-great-systems/bin/lib/merge-conflicts.test.cjs +370 -0
- package/deliver-great-systems/bin/lib/migration.cjs +352 -0
- package/deliver-great-systems/bin/lib/migration.test.cjs +582 -0
- package/deliver-great-systems/bin/lib/milestone.cjs +243 -0
- package/deliver-great-systems/bin/lib/overlap.cjs +437 -0
- package/deliver-great-systems/bin/lib/overlap.test.cjs +747 -0
- package/deliver-great-systems/bin/lib/path-audit.test.cjs +384 -0
- package/deliver-great-systems/bin/lib/paths.cjs +144 -0
- package/deliver-great-systems/bin/lib/paths.test.cjs +486 -0
- package/deliver-great-systems/bin/lib/phase.cjs +910 -0
- package/deliver-great-systems/bin/lib/projects.cjs +691 -0
- package/deliver-great-systems/bin/lib/projects.test.cjs +871 -0
- package/deliver-great-systems/bin/lib/repos.cjs +1432 -0
- package/deliver-great-systems/bin/lib/repos.test.cjs +1882 -0
- package/deliver-great-systems/bin/lib/roadmap.cjs +305 -0
- package/deliver-great-systems/bin/lib/search.cjs +570 -0
- package/deliver-great-systems/bin/lib/specs.cjs +1303 -0
- package/deliver-great-systems/bin/lib/state.cjs +893 -0
- package/deliver-great-systems/bin/lib/template.cjs +228 -0
- package/deliver-great-systems/bin/lib/test-helpers.cjs +291 -0
- package/deliver-great-systems/bin/lib/verify.cjs +796 -0
- package/deliver-great-systems/references/checkpoints.md +776 -0
- package/deliver-great-systems/references/conflict-resolution.md +66 -0
- package/deliver-great-systems/references/context-tiers.md +166 -0
- package/deliver-great-systems/references/continuation-format.md +249 -0
- package/deliver-great-systems/references/decimal-phase-calculation.md +67 -0
- package/deliver-great-systems/references/git-integration.md +250 -0
- package/deliver-great-systems/references/git-planning-commit.md +40 -0
- package/deliver-great-systems/references/model-profile-resolution.md +36 -0
- package/deliver-great-systems/references/model-profiles.md +95 -0
- package/deliver-great-systems/references/phase-argument-parsing.md +61 -0
- package/deliver-great-systems/references/planning-config.md +224 -0
- package/deliver-great-systems/references/questioning.md +162 -0
- package/deliver-great-systems/references/spec-review-loop.md +177 -0
- package/deliver-great-systems/references/tdd.md +265 -0
- package/deliver-great-systems/references/ui-brand.md +160 -0
- package/deliver-great-systems/references/verification-patterns.md +612 -0
- package/deliver-great-systems/templates/DEBUG.md +166 -0
- package/deliver-great-systems/templates/UAT.md +251 -0
- package/deliver-great-systems/templates/VALIDATION.md +95 -0
- package/deliver-great-systems/templates/claude-md.md +74 -0
- package/deliver-great-systems/templates/codebase/architecture.md +257 -0
- package/deliver-great-systems/templates/codebase/concerns.md +312 -0
- package/deliver-great-systems/templates/codebase/conventions.md +309 -0
- package/deliver-great-systems/templates/codebase/integrations.md +282 -0
- package/deliver-great-systems/templates/codebase/stack.md +188 -0
- package/deliver-great-systems/templates/codebase/structure.md +287 -0
- package/deliver-great-systems/templates/codebase/testing.md +482 -0
- package/deliver-great-systems/templates/config.json +38 -0
- package/deliver-great-systems/templates/context.md +354 -0
- package/deliver-great-systems/templates/continue-here.md +80 -0
- package/deliver-great-systems/templates/debug-subagent-prompt.md +93 -0
- package/deliver-great-systems/templates/discovery.md +148 -0
- package/deliver-great-systems/templates/milestone-archive.md +125 -0
- package/deliver-great-systems/templates/milestone.md +117 -0
- package/deliver-great-systems/templates/phase-prompt.md +615 -0
- package/deliver-great-systems/templates/planner-subagent-prompt.md +119 -0
- package/deliver-great-systems/templates/project.md +186 -0
- package/deliver-great-systems/templates/requirements.md +233 -0
- package/deliver-great-systems/templates/research-project/ARCHITECTURE.md +206 -0
- package/deliver-great-systems/templates/research-project/FEATURES.md +149 -0
- package/deliver-great-systems/templates/research-project/PITFALLS.md +202 -0
- package/deliver-great-systems/templates/research-project/STACK.md +122 -0
- package/deliver-great-systems/templates/research-project/SUMMARY.md +172 -0
- package/deliver-great-systems/templates/research.md +554 -0
- package/deliver-great-systems/templates/retrospective.md +54 -0
- package/deliver-great-systems/templates/roadmap.md +204 -0
- package/deliver-great-systems/templates/state.md +178 -0
- package/deliver-great-systems/templates/summary-complex.md +59 -0
- package/deliver-great-systems/templates/summary-minimal.md +41 -0
- package/deliver-great-systems/templates/summary-standard.md +48 -0
- package/deliver-great-systems/templates/summary.md +253 -0
- package/deliver-great-systems/templates/user-setup.md +313 -0
- package/deliver-great-systems/templates/verification-report.md +324 -0
- package/deliver-great-systems/workflows/add-doc.md +151 -0
- package/deliver-great-systems/workflows/add-idea.md +96 -0
- package/deliver-great-systems/workflows/add-phase.md +120 -0
- package/deliver-great-systems/workflows/add-tests.md +359 -0
- package/deliver-great-systems/workflows/add-todo.md +162 -0
- package/deliver-great-systems/workflows/approve-spec.md +194 -0
- package/deliver-great-systems/workflows/audit-milestone.md +364 -0
- package/deliver-great-systems/workflows/audit-phase.md +462 -0
- package/deliver-great-systems/workflows/cancel-job.md +108 -0
- package/deliver-great-systems/workflows/check-todos.md +181 -0
- package/deliver-great-systems/workflows/cleanup.md +247 -0
- package/deliver-great-systems/workflows/codereview.md +526 -0
- package/deliver-great-systems/workflows/complete-milestone.md +1298 -0
- package/deliver-great-systems/workflows/consolidate-ideas.md +365 -0
- package/deliver-great-systems/workflows/create-milestone-job.md +177 -0
- package/deliver-great-systems/workflows/develop-idea.md +544 -0
- package/deliver-great-systems/workflows/diagnose-issues.md +231 -0
- package/deliver-great-systems/workflows/discovery-phase.md +301 -0
- package/deliver-great-systems/workflows/discuss-idea.md +263 -0
- package/deliver-great-systems/workflows/discuss-phase.md +733 -0
- package/deliver-great-systems/workflows/execute-phase.md +571 -0
- package/deliver-great-systems/workflows/execute-plan.md +592 -0
- package/deliver-great-systems/workflows/find-related-ideas.md +271 -0
- package/deliver-great-systems/workflows/health.md +173 -0
- package/deliver-great-systems/workflows/help.md +997 -0
- package/deliver-great-systems/workflows/import-spec.md +381 -0
- package/deliver-great-systems/workflows/init-product.md +767 -0
- package/deliver-great-systems/workflows/insert-phase.md +138 -0
- package/deliver-great-systems/workflows/list-docs.md +119 -0
- package/deliver-great-systems/workflows/list-ideas.md +154 -0
- package/deliver-great-systems/workflows/list-jobs.md +89 -0
- package/deliver-great-systems/workflows/list-phase-assumptions.md +192 -0
- package/deliver-great-systems/workflows/list-specs.md +101 -0
- package/deliver-great-systems/workflows/map-codebase.md +621 -0
- package/deliver-great-systems/workflows/new-milestone.md +591 -0
- package/deliver-great-systems/workflows/new-project.md +1113 -0
- package/deliver-great-systems/workflows/node-repair.md +94 -0
- package/deliver-great-systems/workflows/overlap-check.md +86 -0
- package/deliver-great-systems/workflows/pause-work.md +134 -0
- package/deliver-great-systems/workflows/plan-milestone-gaps.md +306 -0
- package/deliver-great-systems/workflows/plan-phase.md +698 -0
- package/deliver-great-systems/workflows/progress.md +386 -0
- package/deliver-great-systems/workflows/quick.md +845 -0
- package/deliver-great-systems/workflows/refine-spec.md +275 -0
- package/deliver-great-systems/workflows/reject-idea.md +109 -0
- package/deliver-great-systems/workflows/remove-doc.md +117 -0
- package/deliver-great-systems/workflows/remove-phase.md +163 -0
- package/deliver-great-systems/workflows/research-idea.md +325 -0
- package/deliver-great-systems/workflows/research-phase.md +81 -0
- package/deliver-great-systems/workflows/restore-idea.md +101 -0
- package/deliver-great-systems/workflows/resume-project.md +311 -0
- package/deliver-great-systems/workflows/rollback-job.md +130 -0
- package/deliver-great-systems/workflows/run-job.md +498 -0
- package/deliver-great-systems/workflows/search.md +130 -0
- package/deliver-great-systems/workflows/set-profile.md +83 -0
- package/deliver-great-systems/workflows/settings.md +470 -0
- package/deliver-great-systems/workflows/transition.md +563 -0
- package/deliver-great-systems/workflows/undo-consolidation.md +155 -0
- package/deliver-great-systems/workflows/update-idea.md +157 -0
- package/deliver-great-systems/workflows/update.md +242 -0
- package/deliver-great-systems/workflows/validate-phase.md +177 -0
- package/deliver-great-systems/workflows/verify-phase.md +253 -0
- package/deliver-great-systems/workflows/verify-work.md +671 -0
- package/deliver-great-systems/workflows/write-spec.md +450 -0
- package/hooks/dist/dgs-check-update.js +62 -0
- package/hooks/dist/dgs-context-monitor.js +141 -0
- package/hooks/dist/dgs-statusline.js +115 -0
- package/package.json +60 -0
- package/scripts/build-hooks.js +43 -0
|
@@ -0,0 +1,1298 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
|
|
3
|
+
Mark a shipped version (v1.0, v1.1, v2.0) as complete. Creates historical record in MILESTONES.md, performs full PROJECT.md evolution review, reorganizes ROADMAP.md with milestone groupings, and tags the release in git.
|
|
4
|
+
|
|
5
|
+
</purpose>
|
|
6
|
+
|
|
7
|
+
<context_tier>verification</context_tier>
|
|
8
|
+
|
|
9
|
+
<required_reading>
|
|
10
|
+
|
|
11
|
+
1. templates/milestone.md
|
|
12
|
+
2. templates/milestone-archive.md
|
|
13
|
+
3. references/conflict-resolution.md
|
|
14
|
+
|
|
15
|
+
NOTE: Items below use variables resolved by `init milestone-op` in the initialize step.
|
|
16
|
+
Read these AFTER running the initialize step, not before.
|
|
17
|
+
|
|
18
|
+
4. `${roadmap_path}` (from init milestone-op)
|
|
19
|
+
5. `${requirements_path}` (from init milestone-op)
|
|
20
|
+
6. `${project_path}` (from init milestone-op)
|
|
21
|
+
|
|
22
|
+
</required_reading>
|
|
23
|
+
|
|
24
|
+
<archival_behavior>
|
|
25
|
+
|
|
26
|
+
When a milestone completes:
|
|
27
|
+
|
|
28
|
+
1. Extract full milestone details to `${project_root}/milestones/v[X.Y]-ROADMAP.md`
|
|
29
|
+
2. Archive requirements to `${project_root}/milestones/v[X.Y]-REQUIREMENTS.md`
|
|
30
|
+
3. Update ROADMAP.md — replace milestone details with one-line summary
|
|
31
|
+
4. Delete REQUIREMENTS.md (fresh one for next milestone)
|
|
32
|
+
5. Perform full PROJECT.md evolution review
|
|
33
|
+
6. Offer to create next milestone inline
|
|
34
|
+
|
|
35
|
+
**Context Efficiency:** Archives keep ROADMAP.md constant-size and REQUIREMENTS.md milestone-scoped.
|
|
36
|
+
|
|
37
|
+
**ROADMAP archive** uses `templates/milestone-archive.md` — includes milestone header (status, phases, date), full phase details, milestone summary (decisions, issues, tech debt).
|
|
38
|
+
|
|
39
|
+
**REQUIREMENTS archive** contains all requirements marked complete with outcomes, traceability table with final status, notes on changed requirements.
|
|
40
|
+
|
|
41
|
+
</archival_behavior>
|
|
42
|
+
|
|
43
|
+
<process>
|
|
44
|
+
|
|
45
|
+
<step name="initialize" priority="first">
|
|
46
|
+
|
|
47
|
+
Load project context and resolve paths:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
INIT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" init milestone-op)
|
|
51
|
+
```
|
|
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`.
|
|
54
|
+
|
|
55
|
+
**Load verification tier context:**
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
LAST_PHASE=$(echo "$completed_phases" | tail -1)
|
|
59
|
+
TIER_FILES=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" context load-tier verification --phase "${LAST_PHASE}" --raw 2>/dev/null)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
This provides all execution-tier files plus VERIFICATION.md and UAT*.md for the last phase. Keep the operational reads of ROADMAP, REQUIREMENTS (used for archival, not just context).
|
|
63
|
+
|
|
64
|
+
Detect `JOB_MODE`:
|
|
65
|
+
- Check if `<job-mode>silent</job-mode>` is present in the invoking context
|
|
66
|
+
- Store as `JOB_MODE = true/false`
|
|
67
|
+
|
|
68
|
+
</step>
|
|
69
|
+
|
|
70
|
+
<step name="verify_readiness">
|
|
71
|
+
|
|
72
|
+
**Use `roadmap analyze` for comprehensive readiness check:**
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
ROADMAP=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" roadmap analyze)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
This returns all phases with plan/summary counts and disk status. Use this to verify:
|
|
79
|
+
- Which phases belong to this milestone?
|
|
80
|
+
- All phases complete (all plans have summaries)? Check `disk_status === 'complete'` for each.
|
|
81
|
+
- `progress_percent` should be 100%.
|
|
82
|
+
|
|
83
|
+
**Requirements completion check (REQUIRED before presenting):**
|
|
84
|
+
|
|
85
|
+
Parse REQUIREMENTS.md traceability table:
|
|
86
|
+
- Count total v1 requirements vs checked-off (`[x]`) requirements
|
|
87
|
+
- Identify any non-Complete rows in the traceability table
|
|
88
|
+
|
|
89
|
+
Present:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
Milestone: [Name, e.g., "v1.0 MVP"]
|
|
93
|
+
|
|
94
|
+
Includes:
|
|
95
|
+
- Phase 1: Foundation (2/2 plans complete)
|
|
96
|
+
- Phase 2: Authentication (2/2 plans complete)
|
|
97
|
+
- Phase 3: Core Features (3/3 plans complete)
|
|
98
|
+
- Phase 4: Polish (1/1 plan complete)
|
|
99
|
+
|
|
100
|
+
Total: {phase_count} phases, {total_plans} plans, all complete
|
|
101
|
+
Requirements: {N}/{M} v1 requirements checked off
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**If requirements incomplete** (N < M):
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
⚠ Unchecked Requirements:
|
|
108
|
+
|
|
109
|
+
- [ ] {REQ-ID}: {description} (Phase {X})
|
|
110
|
+
- [ ] {REQ-ID}: {description} (Phase {Y})
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**If `JOB_MODE` is true:**
|
|
114
|
+
- Log: `[AUTO-RESOLVE] {N}/{M} requirements checked -- proceeding with known gaps`
|
|
115
|
+
- Note incomplete requirements in MILESTONES.md under `### Known Gaps`
|
|
116
|
+
- Skip to gather_stats (do not prompt)
|
|
117
|
+
|
|
118
|
+
**If `JOB_MODE` is false (default):**
|
|
119
|
+
|
|
120
|
+
MUST present 3 options:
|
|
121
|
+
1. **Proceed anyway** — mark milestone complete with known gaps
|
|
122
|
+
2. **Run audit first** — `/dgs:audit-milestone` to assess gap severity
|
|
123
|
+
3. **Abort** — return to development
|
|
124
|
+
|
|
125
|
+
If user selects "Proceed anyway": note incomplete requirements in MILESTONES.md under `### Known Gaps` with REQ-IDs and descriptions.
|
|
126
|
+
|
|
127
|
+
<config-check>
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
cat ${config_path} 2>/dev/null
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
</config-check>
|
|
134
|
+
|
|
135
|
+
<if mode="yolo">
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
⚡ Auto-approved: Milestone scope verification
|
|
139
|
+
[Show breakdown summary without prompting]
|
|
140
|
+
Proceeding to stats gathering...
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Proceed to gather_stats.
|
|
144
|
+
|
|
145
|
+
</if>
|
|
146
|
+
|
|
147
|
+
<if mode="job-mode">
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
[AUTO-RESOLVE] Milestone scope verified in job mode
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Proceed to gather_stats.
|
|
154
|
+
|
|
155
|
+
</if>
|
|
156
|
+
|
|
157
|
+
<if mode="interactive" OR="custom with gates.confirm_milestone_scope true">
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
Ready to mark this milestone as shipped?
|
|
161
|
+
(yes / wait / adjust scope)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Wait for confirmation.
|
|
165
|
+
- "adjust scope": Ask which phases to include.
|
|
166
|
+
- "wait": Stop, user returns when ready.
|
|
167
|
+
|
|
168
|
+
</if>
|
|
169
|
+
|
|
170
|
+
</step>
|
|
171
|
+
|
|
172
|
+
<step name="gather_stats">
|
|
173
|
+
|
|
174
|
+
Calculate milestone statistics:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
git log --oneline --grep="feat(" | head -20
|
|
178
|
+
git diff --stat FIRST_COMMIT..LAST_COMMIT | tail -1
|
|
179
|
+
find . -name "*.swift" -o -name "*.ts" -o -name "*.py" | xargs wc -l 2>/dev/null
|
|
180
|
+
git log --format="%ai" FIRST_COMMIT | tail -1
|
|
181
|
+
git log --format="%ai" LAST_COMMIT | head -1
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Present:
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
Milestone Stats:
|
|
188
|
+
- Phases: [X-Y]
|
|
189
|
+
- Plans: [Z] total
|
|
190
|
+
- Tasks: [N] total (from phase summaries)
|
|
191
|
+
- Files modified: [M]
|
|
192
|
+
- Lines of code: [LOC] [language]
|
|
193
|
+
- Timeline: [Days] days ([Start] → [End])
|
|
194
|
+
- Git range: feat(XX-XX) → feat(YY-YY)
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
</step>
|
|
198
|
+
|
|
199
|
+
<step name="extract_accomplishments">
|
|
200
|
+
|
|
201
|
+
Extract one-liners from SUMMARY.md files using summary-extract:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
# For each phase in milestone, extract one-liner
|
|
205
|
+
for summary in ${project_root}/phases/*-*/*-SUMMARY.md; do
|
|
206
|
+
node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" summary-extract "$summary" --fields one_liner | jq -r '.one_liner'
|
|
207
|
+
done
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Extract 4-6 key accomplishments. Present:
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
Key accomplishments for this milestone:
|
|
214
|
+
1. [Achievement from phase 1]
|
|
215
|
+
2. [Achievement from phase 2]
|
|
216
|
+
3. [Achievement from phase 3]
|
|
217
|
+
4. [Achievement from phase 4]
|
|
218
|
+
5. [Achievement from phase 5]
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
</step>
|
|
222
|
+
|
|
223
|
+
<step name="create_milestone_entry">
|
|
224
|
+
|
|
225
|
+
**Note:** MILESTONES.md entry is now created automatically by `dgs-tools milestone complete` in the archive_milestone step. The entry includes version, date, phase/plan/task counts, and accomplishments extracted from SUMMARY.md files.
|
|
226
|
+
|
|
227
|
+
If additional details are needed (e.g., user-provided "Delivered" summary, git range, LOC stats), add them manually after the CLI creates the base entry.
|
|
228
|
+
|
|
229
|
+
</step>
|
|
230
|
+
|
|
231
|
+
<step name="evolve_project_full_review">
|
|
232
|
+
|
|
233
|
+
Full PROJECT.md evolution review at milestone completion.
|
|
234
|
+
|
|
235
|
+
Read all phase summaries:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
cat ${project_root}/phases/*-*/*-SUMMARY.md
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
**Full review checklist:**
|
|
242
|
+
|
|
243
|
+
1. **"What This Is" accuracy:**
|
|
244
|
+
- Compare current description to what was built
|
|
245
|
+
- Update if product has meaningfully changed
|
|
246
|
+
|
|
247
|
+
2. **Core Value check:**
|
|
248
|
+
- Still the right priority? Did shipping reveal a different core value?
|
|
249
|
+
- Update if the ONE thing has shifted
|
|
250
|
+
|
|
251
|
+
3. **Requirements audit:**
|
|
252
|
+
|
|
253
|
+
**Validated section:**
|
|
254
|
+
- All Active requirements shipped this milestone → Move to Validated
|
|
255
|
+
- Format: `- ✓ [Requirement] — v[X.Y]`
|
|
256
|
+
|
|
257
|
+
**Active section:**
|
|
258
|
+
- Remove requirements moved to Validated
|
|
259
|
+
- Add new requirements for next milestone
|
|
260
|
+
- Keep unaddressed requirements
|
|
261
|
+
|
|
262
|
+
**Out of Scope audit:**
|
|
263
|
+
- Review each item — reasoning still valid?
|
|
264
|
+
- Remove irrelevant items
|
|
265
|
+
- Add requirements invalidated during milestone
|
|
266
|
+
|
|
267
|
+
4. **Context update:**
|
|
268
|
+
- Current codebase state (LOC, tech stack)
|
|
269
|
+
- User feedback themes (if any)
|
|
270
|
+
- Known issues or technical debt
|
|
271
|
+
|
|
272
|
+
5. **Key Decisions audit:**
|
|
273
|
+
- Extract all decisions from milestone phase summaries
|
|
274
|
+
- Add to Key Decisions table with outcomes
|
|
275
|
+
- Mark ✓ Good, ⚠️ Revisit, or — Pending
|
|
276
|
+
|
|
277
|
+
6. **Constraints check:**
|
|
278
|
+
- Any constraints changed during development? Update as needed
|
|
279
|
+
|
|
280
|
+
Update PROJECT.md inline. Update "Last updated" footer:
|
|
281
|
+
|
|
282
|
+
```markdown
|
|
283
|
+
---
|
|
284
|
+
*Last updated: [date] after v[X.Y] milestone*
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
**Example full evolution (v1.0 → v1.1 prep):**
|
|
288
|
+
|
|
289
|
+
Before:
|
|
290
|
+
|
|
291
|
+
```markdown
|
|
292
|
+
## What This Is
|
|
293
|
+
|
|
294
|
+
A real-time collaborative whiteboard for remote teams.
|
|
295
|
+
|
|
296
|
+
## Core Value
|
|
297
|
+
|
|
298
|
+
Real-time sync that feels instant.
|
|
299
|
+
|
|
300
|
+
## Requirements
|
|
301
|
+
|
|
302
|
+
### Validated
|
|
303
|
+
|
|
304
|
+
(None yet — ship to validate)
|
|
305
|
+
|
|
306
|
+
### Active
|
|
307
|
+
|
|
308
|
+
- [ ] Canvas drawing tools
|
|
309
|
+
- [ ] Real-time sync < 500ms
|
|
310
|
+
- [ ] User authentication
|
|
311
|
+
- [ ] Export to PNG
|
|
312
|
+
|
|
313
|
+
### Out of Scope
|
|
314
|
+
|
|
315
|
+
- Mobile app — web-first approach
|
|
316
|
+
- Video chat — use external tools
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
After v1.0:
|
|
320
|
+
|
|
321
|
+
```markdown
|
|
322
|
+
## What This Is
|
|
323
|
+
|
|
324
|
+
A real-time collaborative whiteboard for remote teams with instant sync and drawing tools.
|
|
325
|
+
|
|
326
|
+
## Core Value
|
|
327
|
+
|
|
328
|
+
Real-time sync that feels instant.
|
|
329
|
+
|
|
330
|
+
## Requirements
|
|
331
|
+
|
|
332
|
+
### Validated
|
|
333
|
+
|
|
334
|
+
- ✓ Canvas drawing tools — v1.0
|
|
335
|
+
- ✓ Real-time sync < 500ms — v1.0 (achieved 200ms avg)
|
|
336
|
+
- ✓ User authentication — v1.0
|
|
337
|
+
|
|
338
|
+
### Active
|
|
339
|
+
|
|
340
|
+
- [ ] Export to PNG
|
|
341
|
+
- [ ] Undo/redo history
|
|
342
|
+
- [ ] Shape tools (rectangles, circles)
|
|
343
|
+
|
|
344
|
+
### Out of Scope
|
|
345
|
+
|
|
346
|
+
- Mobile app — web-first approach, PWA works well
|
|
347
|
+
- Video chat — use external tools
|
|
348
|
+
- Offline mode — real-time is core value
|
|
349
|
+
|
|
350
|
+
## Context
|
|
351
|
+
|
|
352
|
+
Shipped v1.0 with 2,400 LOC TypeScript.
|
|
353
|
+
Tech stack: Next.js, Supabase, Canvas API.
|
|
354
|
+
Initial user testing showed demand for shape tools.
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
**Step complete when:**
|
|
358
|
+
|
|
359
|
+
- [ ] "What This Is" reviewed and updated if needed
|
|
360
|
+
- [ ] Core Value verified as still correct
|
|
361
|
+
- [ ] All shipped requirements moved to Validated
|
|
362
|
+
- [ ] New requirements added to Active for next milestone
|
|
363
|
+
- [ ] Out of Scope reasoning audited
|
|
364
|
+
- [ ] Context updated with current state
|
|
365
|
+
- [ ] All milestone decisions added to Key Decisions
|
|
366
|
+
- [ ] "Last updated" footer reflects milestone completion
|
|
367
|
+
|
|
368
|
+
</step>
|
|
369
|
+
|
|
370
|
+
<step name="reorganize_roadmap">
|
|
371
|
+
|
|
372
|
+
Update `${roadmap_path}` — group completed milestone phases:
|
|
373
|
+
|
|
374
|
+
```markdown
|
|
375
|
+
# Roadmap: [Project Name]
|
|
376
|
+
|
|
377
|
+
## Milestones
|
|
378
|
+
|
|
379
|
+
- ✅ **v1.0 MVP** — Phases 1-4 (shipped YYYY-MM-DD)
|
|
380
|
+
- 🚧 **v1.1 Security** — Phases 5-6 (in progress)
|
|
381
|
+
- 📋 **v2.0 Redesign** — Phases 7-10 (planned)
|
|
382
|
+
|
|
383
|
+
## Phases
|
|
384
|
+
|
|
385
|
+
<details>
|
|
386
|
+
<summary>✅ v1.0 MVP (Phases 1-4) — SHIPPED YYYY-MM-DD</summary>
|
|
387
|
+
|
|
388
|
+
- [x] Phase 1: Foundation (2/2 plans) — completed YYYY-MM-DD
|
|
389
|
+
- [x] Phase 2: Authentication (2/2 plans) — completed YYYY-MM-DD
|
|
390
|
+
- [x] Phase 3: Core Features (3/3 plans) — completed YYYY-MM-DD
|
|
391
|
+
- [x] Phase 4: Polish (1/1 plan) — completed YYYY-MM-DD
|
|
392
|
+
|
|
393
|
+
</details>
|
|
394
|
+
|
|
395
|
+
### 🚧 v[Next] [Name] (In Progress / Planned)
|
|
396
|
+
|
|
397
|
+
- [ ] Phase 5: [Name] ([N] plans)
|
|
398
|
+
- [ ] Phase 6: [Name] ([N] plans)
|
|
399
|
+
|
|
400
|
+
## Progress
|
|
401
|
+
|
|
402
|
+
| Phase | Milestone | Plans Complete | Status | Completed |
|
|
403
|
+
| ----------------- | --------- | -------------- | ----------- | ---------- |
|
|
404
|
+
| 1. Foundation | v1.0 | 2/2 | Complete | YYYY-MM-DD |
|
|
405
|
+
| 2. Authentication | v1.0 | 2/2 | Complete | YYYY-MM-DD |
|
|
406
|
+
| 3. Core Features | v1.0 | 3/3 | Complete | YYYY-MM-DD |
|
|
407
|
+
| 4. Polish | v1.0 | 1/1 | Complete | YYYY-MM-DD |
|
|
408
|
+
| 5. Security Audit | v1.1 | 0/1 | Not started | - |
|
|
409
|
+
| 6. Hardening | v1.1 | 0/2 | Not started | - |
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
</step>
|
|
413
|
+
|
|
414
|
+
<step name="archive_milestone">
|
|
415
|
+
|
|
416
|
+
**Delegate archival to dgs-tools:**
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
ARCHIVE=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" milestone complete "v[X.Y]" --name "[Milestone Name]")
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
The CLI handles:
|
|
423
|
+
- Creating `${project_root}/milestones/` directory
|
|
424
|
+
- Archiving ROADMAP.md to `milestones/v[X.Y]-ROADMAP.md`
|
|
425
|
+
- Archiving REQUIREMENTS.md to `milestones/v[X.Y]-REQUIREMENTS.md` with archive header
|
|
426
|
+
- Moving audit file to milestones if it exists
|
|
427
|
+
- Creating/appending MILESTONES.md entry with accomplishments from SUMMARY.md files
|
|
428
|
+
- Updating STATE.md (status, last activity)
|
|
429
|
+
|
|
430
|
+
Extract from result: `version`, `date`, `phases`, `plans`, `tasks`, `accomplishments`, `archived`.
|
|
431
|
+
|
|
432
|
+
Verify: `✅ Milestone archived to ${project_root}/milestones/`
|
|
433
|
+
|
|
434
|
+
**If `JOB_MODE` is true:**
|
|
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):**
|
|
440
|
+
|
|
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
|
+
```bash
|
|
447
|
+
mkdir -p ${project_root}/milestones/v[X.Y]-phases
|
|
448
|
+
# For each phase directory in ${phases_dir}/:
|
|
449
|
+
mv ${phases_dir}/{phase-dir} ${project_root}/milestones/v[X.Y]-phases/
|
|
450
|
+
```
|
|
451
|
+
Verify: `✅ Phase directories archived to ${project_root}/milestones/v[X.Y]-phases/`
|
|
452
|
+
|
|
453
|
+
If "Skip": Phase directories remain in `${phases_dir}/` as raw execution history. Use `/dgs:cleanup` later to archive retroactively.
|
|
454
|
+
|
|
455
|
+
After archival, the AI still handles:
|
|
456
|
+
- Reorganizing ROADMAP.md with milestone grouping (requires judgment)
|
|
457
|
+
- Full PROJECT.md evolution review (requires understanding)
|
|
458
|
+
- Deleting original ROADMAP.md and REQUIREMENTS.md
|
|
459
|
+
- These are NOT fully delegated because they require AI interpretation of content
|
|
460
|
+
|
|
461
|
+
</step>
|
|
462
|
+
|
|
463
|
+
<step name="reorganize_roadmap_and_delete_originals">
|
|
464
|
+
|
|
465
|
+
After `milestone complete` has archived, reorganize ROADMAP.md with milestone groupings, then delete originals:
|
|
466
|
+
|
|
467
|
+
**Reorganize ROADMAP.md** — group completed milestone phases:
|
|
468
|
+
|
|
469
|
+
```markdown
|
|
470
|
+
# Roadmap: [Project Name]
|
|
471
|
+
|
|
472
|
+
## Milestones
|
|
473
|
+
|
|
474
|
+
- ✅ **v1.0 MVP** — Phases 1-4 (shipped YYYY-MM-DD)
|
|
475
|
+
- 🚧 **v1.1 Security** — Phases 5-6 (in progress)
|
|
476
|
+
|
|
477
|
+
## Phases
|
|
478
|
+
|
|
479
|
+
<details>
|
|
480
|
+
<summary>✅ v1.0 MVP (Phases 1-4) — SHIPPED YYYY-MM-DD</summary>
|
|
481
|
+
|
|
482
|
+
- [x] Phase 1: Foundation (2/2 plans) — completed YYYY-MM-DD
|
|
483
|
+
- [x] Phase 2: Authentication (2/2 plans) — completed YYYY-MM-DD
|
|
484
|
+
|
|
485
|
+
</details>
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
**Then delete originals:**
|
|
489
|
+
|
|
490
|
+
```bash
|
|
491
|
+
rm ${roadmap_path}
|
|
492
|
+
rm ${project_root}/REQUIREMENTS.md
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
</step>
|
|
496
|
+
|
|
497
|
+
<step name="write_retrospective">
|
|
498
|
+
|
|
499
|
+
**Append to living retrospective:**
|
|
500
|
+
|
|
501
|
+
Check for existing retrospective:
|
|
502
|
+
```bash
|
|
503
|
+
ls .planning/RETROSPECTIVE.md 2>/dev/null
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
**If exists:** Read the file, append new milestone section before the "## Cross-Milestone Trends" section.
|
|
507
|
+
|
|
508
|
+
**If doesn't exist:** Create from template at `~/.claude/deliver-great-systems/templates/retrospective.md`.
|
|
509
|
+
|
|
510
|
+
**Gather retrospective data:**
|
|
511
|
+
|
|
512
|
+
1. From SUMMARY.md files: Extract key deliverables, one-liners, tech decisions
|
|
513
|
+
2. From VERIFICATION.md files: Extract verification scores, gaps found
|
|
514
|
+
3. From UAT.md files: Extract test results, issues found
|
|
515
|
+
4. From git log: Count commits, calculate timeline
|
|
516
|
+
5. From the milestone work: Reflect on what worked and what didn't
|
|
517
|
+
|
|
518
|
+
**Write the milestone section:**
|
|
519
|
+
|
|
520
|
+
```markdown
|
|
521
|
+
## Milestone: v{version} — {name}
|
|
522
|
+
|
|
523
|
+
**Shipped:** {date}
|
|
524
|
+
**Phases:** {phase_count} | **Plans:** {plan_count}
|
|
525
|
+
|
|
526
|
+
### What Was Built
|
|
527
|
+
{Extract from SUMMARY.md one-liners}
|
|
528
|
+
|
|
529
|
+
### What Worked
|
|
530
|
+
{Patterns that led to smooth execution}
|
|
531
|
+
|
|
532
|
+
### What Was Inefficient
|
|
533
|
+
{Missed opportunities, rework, bottlenecks}
|
|
534
|
+
|
|
535
|
+
### Patterns Established
|
|
536
|
+
{New conventions discovered during this milestone}
|
|
537
|
+
|
|
538
|
+
### Key Lessons
|
|
539
|
+
{Specific, actionable takeaways}
|
|
540
|
+
|
|
541
|
+
### Cost Observations
|
|
542
|
+
- Model mix: {X}% opus, {Y}% sonnet, {Z}% haiku
|
|
543
|
+
- Sessions: {count}
|
|
544
|
+
- Notable: {efficiency observation}
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
**Update cross-milestone trends:**
|
|
548
|
+
|
|
549
|
+
If the "## Cross-Milestone Trends" section exists, update the tables with new data from this milestone.
|
|
550
|
+
|
|
551
|
+
**Commit:**
|
|
552
|
+
```bash
|
|
553
|
+
node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit "docs: update retrospective for v${VERSION}" --files .planning/RETROSPECTIVE.md
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
</step>
|
|
557
|
+
|
|
558
|
+
<step name="update_state">
|
|
559
|
+
|
|
560
|
+
Most STATE.md updates were handled by `milestone complete`, but verify and update remaining fields:
|
|
561
|
+
|
|
562
|
+
**Project Reference:**
|
|
563
|
+
|
|
564
|
+
```markdown
|
|
565
|
+
## Project Reference
|
|
566
|
+
|
|
567
|
+
See: ${project_path} (updated [today])
|
|
568
|
+
|
|
569
|
+
**Core value:** [Current core value from PROJECT.md]
|
|
570
|
+
**Current focus:** [Next milestone or "Planning next milestone"]
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
**Accumulated Context:**
|
|
574
|
+
- Clear decisions summary (full log in PROJECT.md)
|
|
575
|
+
- Clear resolved blockers
|
|
576
|
+
- Keep open blockers for next milestone
|
|
577
|
+
|
|
578
|
+
</step>
|
|
579
|
+
|
|
580
|
+
<step name="handle_branches">
|
|
581
|
+
|
|
582
|
+
Check branching strategy and offer merge options.
|
|
583
|
+
|
|
584
|
+
Use the INIT from the initialize step (already loaded). Extract `branching_strategy`, `phase_branch_template`, `milestone_branch_template`, `commit_docs`, and `current_project` from init JSON.
|
|
585
|
+
|
|
586
|
+
If branching config is not in milestone-op init, load from config:
|
|
587
|
+
```bash
|
|
588
|
+
cat ${config_path} 2>/dev/null
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
Extract `base_branch` from init JSON (defaults to `"main"` if not set). This is the integration target for all merge operations on code repos.
|
|
592
|
+
|
|
593
|
+
Extract `current_project` from init JSON. This is the project slug used for scoped branch discovery.
|
|
594
|
+
|
|
595
|
+
```bash
|
|
596
|
+
PROJECT_SLUG="${current_project}" # from init JSON
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
**If "none":** Skip to git_tag.
|
|
600
|
+
|
|
601
|
+
**For "phase" strategy:**
|
|
602
|
+
|
|
603
|
+
```bash
|
|
604
|
+
if [ -n "$PROJECT_SLUG" ]; then
|
|
605
|
+
# Project-scoped: only find branches for this project
|
|
606
|
+
PHASE_BRANCHES=$(git branch --list "dgs/${PROJECT_SLUG}/*" 2>/dev/null | sed 's/^\*//' | tr -d ' ')
|
|
607
|
+
else
|
|
608
|
+
# Legacy: use template prefix
|
|
609
|
+
BRANCH_PREFIX=$(echo "$PHASE_BRANCH_TEMPLATE" | sed 's/{.*//')
|
|
610
|
+
PHASE_BRANCHES=$(git branch --list "${BRANCH_PREFIX}*" 2>/dev/null | sed 's/^\*//' | tr -d ' ')
|
|
611
|
+
fi
|
|
612
|
+
echo "Branch discovery: project=$PROJECT_SLUG, found=$(echo "$PHASE_BRANCHES" | wc -w | tr -d ' ') branches"
|
|
613
|
+
echo "Matched branches: $PHASE_BRANCHES"
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
**For "milestone" strategy:**
|
|
617
|
+
|
|
618
|
+
```bash
|
|
619
|
+
if [ -n "$PROJECT_SLUG" ]; then
|
|
620
|
+
# Project-scoped: only find branches for this project
|
|
621
|
+
MILESTONE_BRANCH=$(git branch --list "dgs/${PROJECT_SLUG}/*" 2>/dev/null | sed 's/^\*//' | tr -d ' ' | head -1)
|
|
622
|
+
else
|
|
623
|
+
# Legacy: use template prefix
|
|
624
|
+
BRANCH_PREFIX=$(echo "$MILESTONE_BRANCH_TEMPLATE" | sed 's/{.*//')
|
|
625
|
+
MILESTONE_BRANCH=$(git branch --list "${BRANCH_PREFIX}*" 2>/dev/null | sed 's/^\*//' | tr -d ' ' | head -1)
|
|
626
|
+
fi
|
|
627
|
+
echo "Branch discovery: project=$PROJECT_SLUG, found=$(echo "$MILESTONE_BRANCH" | wc -w | tr -d ' ') branches"
|
|
628
|
+
echo "Matched branches: $MILESTONE_BRANCH"
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
**If no branches found:** Skip to git_tag.
|
|
632
|
+
|
|
633
|
+
**If `JOB_MODE` is true:**
|
|
634
|
+
- Log: `[AUTO-RESOLVE] Keeping branches for manual handling in job mode`
|
|
635
|
+
- Skip all branch operations (select "Keep branches" path automatically)
|
|
636
|
+
- Skip to git_tag
|
|
637
|
+
|
|
638
|
+
**If `JOB_MODE` is false (default):**
|
|
639
|
+
|
|
640
|
+
**If branches exist:**
|
|
641
|
+
|
|
642
|
+
**Pre-check: verify base branch exists in all code repos before starting merge:**
|
|
643
|
+
|
|
644
|
+
```bash
|
|
645
|
+
BASE_BRANCH="${base_branch}" # from init JSON, defaults to "main"
|
|
646
|
+
|
|
647
|
+
# If REPOS.md exists, verify base branch in all code repos
|
|
648
|
+
if [ -f "$REPOS_PATH" ]; then
|
|
649
|
+
for repo in $REPO_PATHS; do
|
|
650
|
+
git -C "$repo" fetch origin "$BASE_BRANCH" 2>/dev/null || true
|
|
651
|
+
if ! git -C "$repo" rev-parse --verify "$BASE_BRANCH" >/dev/null 2>&1 && \
|
|
652
|
+
! git -C "$repo" rev-parse --verify "origin/$BASE_BRANCH" >/dev/null 2>&1; then
|
|
653
|
+
echo "Error: Base branch '$BASE_BRANCH' does not exist in repo at $repo"
|
|
654
|
+
echo "Configure git.base_branch in ${config_path} or create the branch first."
|
|
655
|
+
exit 1
|
|
656
|
+
fi
|
|
657
|
+
done
|
|
658
|
+
fi
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
```
|
|
662
|
+
## Git Branches Detected
|
|
663
|
+
|
|
664
|
+
Branching strategy: {phase/milestone}
|
|
665
|
+
Base branch: {BASE_BRANCH}
|
|
666
|
+
Branches: {list}
|
|
667
|
+
|
|
668
|
+
Options:
|
|
669
|
+
1. **Merge to {BASE_BRANCH}** — Merge branch(es) to {BASE_BRANCH}
|
|
670
|
+
2. **Delete without merging** — Already merged or not needed
|
|
671
|
+
3. **Keep branches** — Leave for manual handling
|
|
672
|
+
```
|
|
673
|
+
|
|
674
|
+
AskUserQuestion with options: Squash merge (Recommended), Merge with history, Delete without merging, Keep branches.
|
|
675
|
+
|
|
676
|
+
**Squash merge:**
|
|
677
|
+
|
|
678
|
+
```bash
|
|
679
|
+
CURRENT_BRANCH=$(git branch --show-current)
|
|
680
|
+
git fetch origin "$BASE_BRANCH" 2>/dev/null || true
|
|
681
|
+
git checkout "$BASE_BRANCH"
|
|
682
|
+
|
|
683
|
+
# Initialize cascading context for sequential phase merges
|
|
684
|
+
LEARNINGS_FILE=$(mktemp)
|
|
685
|
+
echo '{}' > "$LEARNINGS_FILE"
|
|
686
|
+
ALL_SEMANTIC_WARNINGS=()
|
|
687
|
+
TOTAL_RESOLVED=0
|
|
688
|
+
TOTAL_ESCALATED=0
|
|
689
|
+
BRANCHES_MERGED=0
|
|
690
|
+
|
|
691
|
+
if [ "$BRANCHING_STRATEGY" = "phase" ]; then
|
|
692
|
+
for branch in $PHASE_BRANCHES; do
|
|
693
|
+
if ! git merge --squash "$branch"; then
|
|
694
|
+
# Merge has conflicts -- run conflict resolution agent
|
|
695
|
+
# Extract phase number from branch name
|
|
696
|
+
PHASE_NUM=$(echo "$branch" | sed -n 's/.*phase-\([0-9][0-9]*\).*/\1/p')
|
|
697
|
+
PHASE_DIR=""
|
|
698
|
+
if [ -n "$PHASE_NUM" ]; then
|
|
699
|
+
PHASE_DIR=$(ls -d ${phases_dir}/${PHASE_NUM}-* 2>/dev/null | head -1)
|
|
700
|
+
fi
|
|
701
|
+
|
|
702
|
+
RESOLVE_RESULT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" conflict-agent run --phase-dir "$PHASE_DIR" --learnings "$LEARNINGS_FILE")
|
|
703
|
+
|
|
704
|
+
# Parse JSON result
|
|
705
|
+
RESOLVED_COUNT=$(echo "$RESOLVE_RESULT" | jq -r '.resolved_count // 0')
|
|
706
|
+
ESCALATED_COUNT=$(echo "$RESOLVE_RESULT" | jq -r '.escalated_count // 0')
|
|
707
|
+
VERIFIED=$(echo "$RESOLVE_RESULT" | jq -r '.verified // false')
|
|
708
|
+
SEMANTIC_COUNT=$(echo "$RESOLVE_RESULT" | jq -r '.semantic_warnings // 0')
|
|
709
|
+
REPORT_PATH=$(echo "$RESOLVE_RESULT" | jq -r '.report_path // ""')
|
|
710
|
+
|
|
711
|
+
TOTAL_RESOLVED=$((TOTAL_RESOLVED + RESOLVED_COUNT))
|
|
712
|
+
|
|
713
|
+
if [ "$ESCALATED_COUNT" -gt 0 ]; then
|
|
714
|
+
# Run escalation protocol per references/conflict-resolution.md
|
|
715
|
+
STILL_CONFLICTED=$(git diff --name-only --diff-filter=U)
|
|
716
|
+
|
|
717
|
+
for FILE in $STILL_CONFLICTED; do
|
|
718
|
+
RETRY_COUNT=0
|
|
719
|
+
FILE_RESOLVED=false
|
|
720
|
+
|
|
721
|
+
while [ "$RETRY_COUNT" -lt 2 ] && [ "$FILE_RESOLVED" = "false" ]; do
|
|
722
|
+
CONTEXT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" merge-conflicts context "$FILE" --phase-dir "$PHASE_DIR")
|
|
723
|
+
|
|
724
|
+
# Present escalated conflict to user
|
|
725
|
+
echo "## Escalated Conflict: $FILE"
|
|
726
|
+
echo ""
|
|
727
|
+
echo "**Reason:** $(echo "$CONTEXT" | jq -r '.hunks[0].reasoning // "Divergent changes requiring manual review"')"
|
|
728
|
+
echo "**Type:** $(echo "$CONTEXT" | jq -r '.hunks[0].type // "UNKNOWN"') | **Confidence:** $(echo "$CONTEXT" | jq -r '.hunks[0].confidence // "LOW"')"
|
|
729
|
+
echo ""
|
|
730
|
+
echo "### Ours (current branch):"
|
|
731
|
+
echo "$(echo "$CONTEXT" | jq -r '.hunks[0].ours // "No ours content"')"
|
|
732
|
+
echo ""
|
|
733
|
+
echo "### Theirs (merging branch):"
|
|
734
|
+
echo "$(echo "$CONTEXT" | jq -r '.hunks[0].theirs // "No theirs content"')"
|
|
735
|
+
echo ""
|
|
736
|
+
echo "### Plan Context:"
|
|
737
|
+
echo "$(echo "$CONTEXT" | jq -r '(.plan_context // []) | map(.task_name + " (" + .plan + ")") | join(", ") // "No plan context available"')"
|
|
738
|
+
echo ""
|
|
739
|
+
echo "### All Hunk Reasoning:"
|
|
740
|
+
echo "$(echo "$CONTEXT" | jq -r '(.hunks // []) | map(.type + " [" + .confidence + "]: " + .reasoning) | join("\n") // "No hunk analysis available"')"
|
|
741
|
+
echo ""
|
|
742
|
+
echo "Options:"
|
|
743
|
+
echo "1. **Accept** proposed resolution"
|
|
744
|
+
echo "2. **Reject with hint** -- provide guidance for retry"
|
|
745
|
+
echo "3. **Abort this file** -- skip, leave unresolved"
|
|
746
|
+
|
|
747
|
+
# AskUserQuestion: Accept / Reject with hint / Abort
|
|
748
|
+
# On Accept: apply proposed resolution
|
|
749
|
+
# On Reject with hint: capture hint, retry
|
|
750
|
+
# On Abort: take theirs or abort merge for this branch
|
|
751
|
+
|
|
752
|
+
case "$USER_CHOICE" in
|
|
753
|
+
accept)
|
|
754
|
+
RETRY_RESULT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" conflict-agent resolve-file "$FILE" --phase-dir "$PHASE_DIR")
|
|
755
|
+
git add "$FILE"
|
|
756
|
+
FILE_RESOLVED=true
|
|
757
|
+
TOTAL_RESOLVED=$((TOTAL_RESOLVED + 1))
|
|
758
|
+
;;
|
|
759
|
+
reject)
|
|
760
|
+
RETRY_COUNT=$((RETRY_COUNT + 1))
|
|
761
|
+
RETRY_RESULT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" conflict-agent resolve-file "$FILE" --phase-dir "$PHASE_DIR" --hint "$USER_HINT")
|
|
762
|
+
# Check if resolved
|
|
763
|
+
if ! grep -q '^<\{7\}' "$FILE" 2>/dev/null; then
|
|
764
|
+
git add "$FILE"
|
|
765
|
+
FILE_RESOLVED=true
|
|
766
|
+
TOTAL_RESOLVED=$((TOTAL_RESOLVED + 1))
|
|
767
|
+
fi
|
|
768
|
+
;;
|
|
769
|
+
abort)
|
|
770
|
+
TOTAL_ESCALATED=$((TOTAL_ESCALATED + 1))
|
|
771
|
+
git checkout --theirs "$FILE" && git add "$FILE"
|
|
772
|
+
FILE_RESOLVED=true
|
|
773
|
+
;;
|
|
774
|
+
esac
|
|
775
|
+
done
|
|
776
|
+
|
|
777
|
+
# Max retries exhausted -- abort this file
|
|
778
|
+
if [ "$FILE_RESOLVED" = "false" ]; then
|
|
779
|
+
TOTAL_ESCALATED=$((TOTAL_ESCALATED + 1))
|
|
780
|
+
git merge --abort
|
|
781
|
+
echo "Aborted merge for branch $branch after 2 failed retries on $FILE"
|
|
782
|
+
continue 2 # Skip to next branch
|
|
783
|
+
fi
|
|
784
|
+
done
|
|
785
|
+
fi
|
|
786
|
+
|
|
787
|
+
if [ "$VERIFIED" = "false" ]; then
|
|
788
|
+
# Post-resolution verification failed
|
|
789
|
+
echo "## Post-Resolution Verification Failed"
|
|
790
|
+
echo ""
|
|
791
|
+
echo "$(echo "$RESOLVE_RESULT" | jq -r '.verification_errors // [] | join("\n")')"
|
|
792
|
+
echo ""
|
|
793
|
+
echo "Options:"
|
|
794
|
+
echo "1. **Proceed anyway** -- commit despite test failures"
|
|
795
|
+
echo "2. **Abort merge** -- git merge --abort, skip this branch"
|
|
796
|
+
|
|
797
|
+
# AskUserQuestion: Proceed / Abort
|
|
798
|
+
# On Abort: git merge --abort; continue
|
|
799
|
+
fi
|
|
800
|
+
fi
|
|
801
|
+
|
|
802
|
+
# Strip planning root from staging if commit_docs is false
|
|
803
|
+
if [ "$COMMIT_DOCS" = "false" ]; then
|
|
804
|
+
git reset HEAD ${project_root}/ 2>/dev/null || true
|
|
805
|
+
fi
|
|
806
|
+
git commit -m "feat: $branch for v[X.Y]"
|
|
807
|
+
|
|
808
|
+
# Extract and accumulate learnings for cascading context
|
|
809
|
+
if [ -n "$RESOLVE_RESULT" ]; then
|
|
810
|
+
NEW_LEARNINGS=$(echo "$RESOLVE_RESULT" | jq -r '.learnings // {}')
|
|
811
|
+
if [ "$NEW_LEARNINGS" != "{}" ] && [ "$NEW_LEARNINGS" != "null" ]; then
|
|
812
|
+
EXISTING_LEARNINGS=$(cat "$LEARNINGS_FILE")
|
|
813
|
+
# Merge: accumulate files_resolved, strategies_used, domain_changes, increment phase_merges_completed
|
|
814
|
+
MERGED=$(echo "$EXISTING_LEARNINGS" "$NEW_LEARNINGS" | jq -s '
|
|
815
|
+
if (.[0] | type) == "object" and (.[0] | has("files_resolved")) then
|
|
816
|
+
{
|
|
817
|
+
files_resolved: ((.[0].files_resolved // []) + (.[1].files_resolved // [])),
|
|
818
|
+
strategies_used: ((.[0].strategies_used // []) + (.[1].strategies_used // [])),
|
|
819
|
+
domain_changes: ((.[0].domain_changes // {}) * (.[1].domain_changes // {})),
|
|
820
|
+
phase_merges_completed: ((.[0].phase_merges_completed // 0) + (.[1].phase_merges_completed // 0))
|
|
821
|
+
}
|
|
822
|
+
else
|
|
823
|
+
.[1]
|
|
824
|
+
end
|
|
825
|
+
')
|
|
826
|
+
echo "$MERGED" > "$LEARNINGS_FILE"
|
|
827
|
+
fi
|
|
828
|
+
fi
|
|
829
|
+
|
|
830
|
+
BRANCHES_MERGED=$((BRANCHES_MERGED + 1))
|
|
831
|
+
done
|
|
832
|
+
fi
|
|
833
|
+
|
|
834
|
+
if [ "$BRANCHING_STRATEGY" = "milestone" ]; then
|
|
835
|
+
if ! git merge --squash "$MILESTONE_BRANCH"; then
|
|
836
|
+
# Merge has conflicts -- run conflict resolution agent
|
|
837
|
+
PHASE_DIR=$(ls -d ${phases_dir}/*/ 2>/dev/null | tail -1)
|
|
838
|
+
|
|
839
|
+
RESOLVE_RESULT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" conflict-agent run --phase-dir "$PHASE_DIR")
|
|
840
|
+
RESOLVED_COUNT=$(echo "$RESOLVE_RESULT" | jq -r '.resolved_count // 0')
|
|
841
|
+
ESCALATED_COUNT=$(echo "$RESOLVE_RESULT" | jq -r '.escalated_count // 0')
|
|
842
|
+
VERIFIED=$(echo "$RESOLVE_RESULT" | jq -r '.verified // false')
|
|
843
|
+
|
|
844
|
+
TOTAL_RESOLVED=$((TOTAL_RESOLVED + RESOLVED_COUNT))
|
|
845
|
+
|
|
846
|
+
if [ "$ESCALATED_COUNT" -gt 0 ]; then
|
|
847
|
+
# Run escalation protocol (same as phase strategy above)
|
|
848
|
+
STILL_CONFLICTED=$(git diff --name-only --diff-filter=U)
|
|
849
|
+
for FILE in $STILL_CONFLICTED; do
|
|
850
|
+
RETRY_COUNT=0
|
|
851
|
+
FILE_RESOLVED=false
|
|
852
|
+
|
|
853
|
+
while [ "$RETRY_COUNT" -lt 2 ] && [ "$FILE_RESOLVED" = "false" ]; do
|
|
854
|
+
CONTEXT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" merge-conflicts context "$FILE" --phase-dir "$PHASE_DIR")
|
|
855
|
+
echo "## Escalated Conflict: $FILE"
|
|
856
|
+
echo "**Reason:** $(echo "$CONTEXT" | jq -r '.hunks[0].reasoning // "Divergent changes requiring manual review"')"
|
|
857
|
+
echo "**Type:** $(echo "$CONTEXT" | jq -r '.hunks[0].type // "UNKNOWN"') | **Confidence:** $(echo "$CONTEXT" | jq -r '.hunks[0].confidence // "LOW"')"
|
|
858
|
+
echo "Options: 1. Accept 2. Reject with hint 3. Abort this file"
|
|
859
|
+
|
|
860
|
+
case "$USER_CHOICE" in
|
|
861
|
+
accept)
|
|
862
|
+
RETRY_RESULT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" conflict-agent resolve-file "$FILE" --phase-dir "$PHASE_DIR")
|
|
863
|
+
git add "$FILE"
|
|
864
|
+
FILE_RESOLVED=true
|
|
865
|
+
TOTAL_RESOLVED=$((TOTAL_RESOLVED + 1))
|
|
866
|
+
;;
|
|
867
|
+
reject)
|
|
868
|
+
RETRY_COUNT=$((RETRY_COUNT + 1))
|
|
869
|
+
RETRY_RESULT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" conflict-agent resolve-file "$FILE" --phase-dir "$PHASE_DIR" --hint "$USER_HINT")
|
|
870
|
+
if ! grep -q '^<\{7\}' "$FILE" 2>/dev/null; then
|
|
871
|
+
git add "$FILE"
|
|
872
|
+
FILE_RESOLVED=true
|
|
873
|
+
TOTAL_RESOLVED=$((TOTAL_RESOLVED + 1))
|
|
874
|
+
fi
|
|
875
|
+
;;
|
|
876
|
+
abort)
|
|
877
|
+
TOTAL_ESCALATED=$((TOTAL_ESCALATED + 1))
|
|
878
|
+
git checkout --theirs "$FILE" && git add "$FILE"
|
|
879
|
+
FILE_RESOLVED=true
|
|
880
|
+
;;
|
|
881
|
+
esac
|
|
882
|
+
done
|
|
883
|
+
|
|
884
|
+
if [ "$FILE_RESOLVED" = "false" ]; then
|
|
885
|
+
TOTAL_ESCALATED=$((TOTAL_ESCALATED + 1))
|
|
886
|
+
git merge --abort
|
|
887
|
+
echo "Aborted merge for $MILESTONE_BRANCH after 2 failed retries on $FILE"
|
|
888
|
+
break
|
|
889
|
+
fi
|
|
890
|
+
done
|
|
891
|
+
fi
|
|
892
|
+
|
|
893
|
+
if [ "$VERIFIED" = "false" ]; then
|
|
894
|
+
echo "## Post-Resolution Verification Failed"
|
|
895
|
+
echo "Options: 1. Proceed anyway 2. Abort merge"
|
|
896
|
+
fi
|
|
897
|
+
fi
|
|
898
|
+
|
|
899
|
+
# Strip planning root from staging if commit_docs is false
|
|
900
|
+
if [ "$COMMIT_DOCS" = "false" ]; then
|
|
901
|
+
git reset HEAD ${project_root}/ 2>/dev/null || true
|
|
902
|
+
fi
|
|
903
|
+
git commit -m "feat: $MILESTONE_BRANCH for v[X.Y]"
|
|
904
|
+
BRANCHES_MERGED=$((BRANCHES_MERGED + 1))
|
|
905
|
+
fi
|
|
906
|
+
|
|
907
|
+
# Display semantic conflict warnings after all branch merges
|
|
908
|
+
if [ "$SEMANTIC_COUNT" -gt 0 ] || [ ${#ALL_SEMANTIC_WARNINGS[@]} -gt 0 ]; then
|
|
909
|
+
echo ""
|
|
910
|
+
echo "## Semantic Conflict Warnings"
|
|
911
|
+
echo ""
|
|
912
|
+
echo "The following files were modified by multiple branches and may have semantic conflicts"
|
|
913
|
+
echo "even though they merged cleanly. Consider integration testing these areas:"
|
|
914
|
+
echo ""
|
|
915
|
+
# List files with domain descriptions from resolution reports
|
|
916
|
+
fi
|
|
917
|
+
|
|
918
|
+
# Display final conflict resolution summary
|
|
919
|
+
echo ""
|
|
920
|
+
echo "Conflict Resolution Complete:"
|
|
921
|
+
echo "- $BRANCHES_MERGED branches merged"
|
|
922
|
+
echo "- $TOTAL_RESOLVED total conflicts resolved"
|
|
923
|
+
echo "- $TOTAL_ESCALATED conflicts escalated to user"
|
|
924
|
+
echo "- $SEMANTIC_COUNT semantic warnings emitted"
|
|
925
|
+
if [ -n "$REPORT_PATH" ]; then
|
|
926
|
+
echo "- Report: $REPORT_PATH"
|
|
927
|
+
fi
|
|
928
|
+
|
|
929
|
+
# Clean up
|
|
930
|
+
rm -f "$LEARNINGS_FILE"
|
|
931
|
+
|
|
932
|
+
git checkout "$CURRENT_BRANCH"
|
|
933
|
+
```
|
|
934
|
+
|
|
935
|
+
**Merge with history:**
|
|
936
|
+
|
|
937
|
+
```bash
|
|
938
|
+
CURRENT_BRANCH=$(git branch --show-current)
|
|
939
|
+
git fetch origin "$BASE_BRANCH" 2>/dev/null || true
|
|
940
|
+
git checkout "$BASE_BRANCH"
|
|
941
|
+
|
|
942
|
+
# Initialize cascading context for sequential phase merges
|
|
943
|
+
LEARNINGS_FILE=$(mktemp)
|
|
944
|
+
echo '{}' > "$LEARNINGS_FILE"
|
|
945
|
+
ALL_SEMANTIC_WARNINGS=()
|
|
946
|
+
TOTAL_RESOLVED=0
|
|
947
|
+
TOTAL_ESCALATED=0
|
|
948
|
+
BRANCHES_MERGED=0
|
|
949
|
+
|
|
950
|
+
if [ "$BRANCHING_STRATEGY" = "phase" ]; then
|
|
951
|
+
for branch in $PHASE_BRANCHES; do
|
|
952
|
+
if ! git merge --no-ff --no-commit "$branch"; then
|
|
953
|
+
# Merge has conflicts -- run conflict resolution agent
|
|
954
|
+
PHASE_NUM=$(echo "$branch" | sed -n 's/.*phase-\([0-9][0-9]*\).*/\1/p')
|
|
955
|
+
PHASE_DIR=""
|
|
956
|
+
if [ -n "$PHASE_NUM" ]; then
|
|
957
|
+
PHASE_DIR=$(ls -d ${phases_dir}/${PHASE_NUM}-* 2>/dev/null | head -1)
|
|
958
|
+
fi
|
|
959
|
+
|
|
960
|
+
RESOLVE_RESULT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" conflict-agent run --phase-dir "$PHASE_DIR" --learnings "$LEARNINGS_FILE")
|
|
961
|
+
|
|
962
|
+
RESOLVED_COUNT=$(echo "$RESOLVE_RESULT" | jq -r '.resolved_count // 0')
|
|
963
|
+
ESCALATED_COUNT=$(echo "$RESOLVE_RESULT" | jq -r '.escalated_count // 0')
|
|
964
|
+
VERIFIED=$(echo "$RESOLVE_RESULT" | jq -r '.verified // false')
|
|
965
|
+
SEMANTIC_COUNT=$(echo "$RESOLVE_RESULT" | jq -r '.semantic_warnings // 0')
|
|
966
|
+
REPORT_PATH=$(echo "$RESOLVE_RESULT" | jq -r '.report_path // ""')
|
|
967
|
+
|
|
968
|
+
TOTAL_RESOLVED=$((TOTAL_RESOLVED + RESOLVED_COUNT))
|
|
969
|
+
|
|
970
|
+
if [ "$ESCALATED_COUNT" -gt 0 ]; then
|
|
971
|
+
# Run escalation protocol per references/conflict-resolution.md
|
|
972
|
+
STILL_CONFLICTED=$(git diff --name-only --diff-filter=U)
|
|
973
|
+
|
|
974
|
+
for FILE in $STILL_CONFLICTED; do
|
|
975
|
+
RETRY_COUNT=0
|
|
976
|
+
FILE_RESOLVED=false
|
|
977
|
+
|
|
978
|
+
while [ "$RETRY_COUNT" -lt 2 ] && [ "$FILE_RESOLVED" = "false" ]; do
|
|
979
|
+
CONTEXT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" merge-conflicts context "$FILE" --phase-dir "$PHASE_DIR")
|
|
980
|
+
|
|
981
|
+
echo "## Escalated Conflict: $FILE"
|
|
982
|
+
echo "**Reason:** $(echo "$CONTEXT" | jq -r '.hunks[0].reasoning // "Divergent changes requiring manual review"')"
|
|
983
|
+
echo "**Type:** $(echo "$CONTEXT" | jq -r '.hunks[0].type // "UNKNOWN"') | **Confidence:** $(echo "$CONTEXT" | jq -r '.hunks[0].confidence // "LOW"')"
|
|
984
|
+
echo "Options: 1. Accept 2. Reject with hint 3. Abort this file"
|
|
985
|
+
|
|
986
|
+
case "$USER_CHOICE" in
|
|
987
|
+
accept)
|
|
988
|
+
RETRY_RESULT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" conflict-agent resolve-file "$FILE" --phase-dir "$PHASE_DIR")
|
|
989
|
+
git add "$FILE"
|
|
990
|
+
FILE_RESOLVED=true
|
|
991
|
+
TOTAL_RESOLVED=$((TOTAL_RESOLVED + 1))
|
|
992
|
+
;;
|
|
993
|
+
reject)
|
|
994
|
+
RETRY_COUNT=$((RETRY_COUNT + 1))
|
|
995
|
+
RETRY_RESULT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" conflict-agent resolve-file "$FILE" --phase-dir "$PHASE_DIR" --hint "$USER_HINT")
|
|
996
|
+
if ! grep -q '^<\{7\}' "$FILE" 2>/dev/null; then
|
|
997
|
+
git add "$FILE"
|
|
998
|
+
FILE_RESOLVED=true
|
|
999
|
+
TOTAL_RESOLVED=$((TOTAL_RESOLVED + 1))
|
|
1000
|
+
fi
|
|
1001
|
+
;;
|
|
1002
|
+
abort)
|
|
1003
|
+
TOTAL_ESCALATED=$((TOTAL_ESCALATED + 1))
|
|
1004
|
+
git checkout --theirs "$FILE" && git add "$FILE"
|
|
1005
|
+
FILE_RESOLVED=true
|
|
1006
|
+
;;
|
|
1007
|
+
esac
|
|
1008
|
+
done
|
|
1009
|
+
|
|
1010
|
+
if [ "$FILE_RESOLVED" = "false" ]; then
|
|
1011
|
+
TOTAL_ESCALATED=$((TOTAL_ESCALATED + 1))
|
|
1012
|
+
git merge --abort
|
|
1013
|
+
echo "Aborted merge for branch $branch after 2 failed retries on $FILE"
|
|
1014
|
+
continue 2
|
|
1015
|
+
fi
|
|
1016
|
+
done
|
|
1017
|
+
fi
|
|
1018
|
+
|
|
1019
|
+
if [ "$VERIFIED" = "false" ]; then
|
|
1020
|
+
echo "## Post-Resolution Verification Failed"
|
|
1021
|
+
echo "Options: 1. Proceed anyway 2. Abort merge"
|
|
1022
|
+
fi
|
|
1023
|
+
fi
|
|
1024
|
+
|
|
1025
|
+
# Strip planning root from staging if commit_docs is false
|
|
1026
|
+
if [ "$COMMIT_DOCS" = "false" ]; then
|
|
1027
|
+
git reset HEAD ${project_root}/ 2>/dev/null || true
|
|
1028
|
+
fi
|
|
1029
|
+
git commit -m "Merge branch '$branch' for v[X.Y]"
|
|
1030
|
+
|
|
1031
|
+
# Extract and accumulate learnings for cascading context
|
|
1032
|
+
if [ -n "$RESOLVE_RESULT" ]; then
|
|
1033
|
+
NEW_LEARNINGS=$(echo "$RESOLVE_RESULT" | jq -r '.learnings // {}')
|
|
1034
|
+
if [ "$NEW_LEARNINGS" != "{}" ] && [ "$NEW_LEARNINGS" != "null" ]; then
|
|
1035
|
+
EXISTING_LEARNINGS=$(cat "$LEARNINGS_FILE")
|
|
1036
|
+
# Merge: accumulate files_resolved, strategies_used, domain_changes, increment phase_merges_completed
|
|
1037
|
+
MERGED=$(echo "$EXISTING_LEARNINGS" "$NEW_LEARNINGS" | jq -s '
|
|
1038
|
+
if (.[0] | type) == "object" and (.[0] | has("files_resolved")) then
|
|
1039
|
+
{
|
|
1040
|
+
files_resolved: ((.[0].files_resolved // []) + (.[1].files_resolved // [])),
|
|
1041
|
+
strategies_used: ((.[0].strategies_used // []) + (.[1].strategies_used // [])),
|
|
1042
|
+
domain_changes: ((.[0].domain_changes // {}) * (.[1].domain_changes // {})),
|
|
1043
|
+
phase_merges_completed: ((.[0].phase_merges_completed // 0) + (.[1].phase_merges_completed // 0))
|
|
1044
|
+
}
|
|
1045
|
+
else
|
|
1046
|
+
.[1]
|
|
1047
|
+
end
|
|
1048
|
+
')
|
|
1049
|
+
echo "$MERGED" > "$LEARNINGS_FILE"
|
|
1050
|
+
fi
|
|
1051
|
+
fi
|
|
1052
|
+
|
|
1053
|
+
BRANCHES_MERGED=$((BRANCHES_MERGED + 1))
|
|
1054
|
+
done
|
|
1055
|
+
fi
|
|
1056
|
+
|
|
1057
|
+
if [ "$BRANCHING_STRATEGY" = "milestone" ]; then
|
|
1058
|
+
if ! git merge --no-ff --no-commit "$MILESTONE_BRANCH"; then
|
|
1059
|
+
# Merge has conflicts -- run conflict resolution agent
|
|
1060
|
+
PHASE_DIR=$(ls -d ${phases_dir}/*/ 2>/dev/null | tail -1)
|
|
1061
|
+
|
|
1062
|
+
RESOLVE_RESULT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" conflict-agent run --phase-dir "$PHASE_DIR")
|
|
1063
|
+
RESOLVED_COUNT=$(echo "$RESOLVE_RESULT" | jq -r '.resolved_count // 0')
|
|
1064
|
+
ESCALATED_COUNT=$(echo "$RESOLVE_RESULT" | jq -r '.escalated_count // 0')
|
|
1065
|
+
VERIFIED=$(echo "$RESOLVE_RESULT" | jq -r '.verified // false')
|
|
1066
|
+
|
|
1067
|
+
TOTAL_RESOLVED=$((TOTAL_RESOLVED + RESOLVED_COUNT))
|
|
1068
|
+
|
|
1069
|
+
if [ "$ESCALATED_COUNT" -gt 0 ]; then
|
|
1070
|
+
STILL_CONFLICTED=$(git diff --name-only --diff-filter=U)
|
|
1071
|
+
for FILE in $STILL_CONFLICTED; do
|
|
1072
|
+
RETRY_COUNT=0
|
|
1073
|
+
FILE_RESOLVED=false
|
|
1074
|
+
|
|
1075
|
+
while [ "$RETRY_COUNT" -lt 2 ] && [ "$FILE_RESOLVED" = "false" ]; do
|
|
1076
|
+
CONTEXT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" merge-conflicts context "$FILE" --phase-dir "$PHASE_DIR")
|
|
1077
|
+
echo "## Escalated Conflict: $FILE"
|
|
1078
|
+
echo "**Reason:** $(echo "$CONTEXT" | jq -r '.hunks[0].reasoning // "Divergent changes requiring manual review"')"
|
|
1079
|
+
echo "**Type:** $(echo "$CONTEXT" | jq -r '.hunks[0].type // "UNKNOWN"') | **Confidence:** $(echo "$CONTEXT" | jq -r '.hunks[0].confidence // "LOW"')"
|
|
1080
|
+
echo "Options: 1. Accept 2. Reject with hint 3. Abort this file"
|
|
1081
|
+
|
|
1082
|
+
case "$USER_CHOICE" in
|
|
1083
|
+
accept)
|
|
1084
|
+
RETRY_RESULT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" conflict-agent resolve-file "$FILE" --phase-dir "$PHASE_DIR")
|
|
1085
|
+
git add "$FILE"
|
|
1086
|
+
FILE_RESOLVED=true
|
|
1087
|
+
TOTAL_RESOLVED=$((TOTAL_RESOLVED + 1))
|
|
1088
|
+
;;
|
|
1089
|
+
reject)
|
|
1090
|
+
RETRY_COUNT=$((RETRY_COUNT + 1))
|
|
1091
|
+
RETRY_RESULT=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" conflict-agent resolve-file "$FILE" --phase-dir "$PHASE_DIR" --hint "$USER_HINT")
|
|
1092
|
+
if ! grep -q '^<\{7\}' "$FILE" 2>/dev/null; then
|
|
1093
|
+
git add "$FILE"
|
|
1094
|
+
FILE_RESOLVED=true
|
|
1095
|
+
TOTAL_RESOLVED=$((TOTAL_RESOLVED + 1))
|
|
1096
|
+
fi
|
|
1097
|
+
;;
|
|
1098
|
+
abort)
|
|
1099
|
+
TOTAL_ESCALATED=$((TOTAL_ESCALATED + 1))
|
|
1100
|
+
git checkout --theirs "$FILE" && git add "$FILE"
|
|
1101
|
+
FILE_RESOLVED=true
|
|
1102
|
+
;;
|
|
1103
|
+
esac
|
|
1104
|
+
done
|
|
1105
|
+
|
|
1106
|
+
if [ "$FILE_RESOLVED" = "false" ]; then
|
|
1107
|
+
TOTAL_ESCALATED=$((TOTAL_ESCALATED + 1))
|
|
1108
|
+
git merge --abort
|
|
1109
|
+
echo "Aborted merge for $MILESTONE_BRANCH after 2 failed retries on $FILE"
|
|
1110
|
+
break
|
|
1111
|
+
fi
|
|
1112
|
+
done
|
|
1113
|
+
fi
|
|
1114
|
+
|
|
1115
|
+
if [ "$VERIFIED" = "false" ]; then
|
|
1116
|
+
echo "## Post-Resolution Verification Failed"
|
|
1117
|
+
echo "Options: 1. Proceed anyway 2. Abort merge"
|
|
1118
|
+
fi
|
|
1119
|
+
fi
|
|
1120
|
+
|
|
1121
|
+
# Strip planning root from staging if commit_docs is false
|
|
1122
|
+
if [ "$COMMIT_DOCS" = "false" ]; then
|
|
1123
|
+
git reset HEAD ${project_root}/ 2>/dev/null || true
|
|
1124
|
+
fi
|
|
1125
|
+
git commit -m "Merge branch '$MILESTONE_BRANCH' for v[X.Y]"
|
|
1126
|
+
BRANCHES_MERGED=$((BRANCHES_MERGED + 1))
|
|
1127
|
+
fi
|
|
1128
|
+
|
|
1129
|
+
# Display semantic conflict warnings after all branch merges
|
|
1130
|
+
if [ "$SEMANTIC_COUNT" -gt 0 ] || [ ${#ALL_SEMANTIC_WARNINGS[@]} -gt 0 ]; then
|
|
1131
|
+
echo ""
|
|
1132
|
+
echo "## Semantic Conflict Warnings"
|
|
1133
|
+
echo ""
|
|
1134
|
+
echo "The following files were modified by multiple branches and may have semantic conflicts"
|
|
1135
|
+
echo "even though they merged cleanly. Consider integration testing these areas:"
|
|
1136
|
+
echo ""
|
|
1137
|
+
fi
|
|
1138
|
+
|
|
1139
|
+
# Display final conflict resolution summary
|
|
1140
|
+
echo ""
|
|
1141
|
+
echo "Conflict Resolution Complete:"
|
|
1142
|
+
echo "- $BRANCHES_MERGED branches merged"
|
|
1143
|
+
echo "- $TOTAL_RESOLVED total conflicts resolved"
|
|
1144
|
+
echo "- $TOTAL_ESCALATED conflicts escalated to user"
|
|
1145
|
+
echo "- $SEMANTIC_COUNT semantic warnings emitted"
|
|
1146
|
+
if [ -n "$REPORT_PATH" ]; then
|
|
1147
|
+
echo "- Report: $REPORT_PATH"
|
|
1148
|
+
fi
|
|
1149
|
+
|
|
1150
|
+
# Clean up
|
|
1151
|
+
rm -f "$LEARNINGS_FILE"
|
|
1152
|
+
|
|
1153
|
+
git checkout "$CURRENT_BRANCH"
|
|
1154
|
+
```
|
|
1155
|
+
|
|
1156
|
+
**Delete without merging:**
|
|
1157
|
+
|
|
1158
|
+
```bash
|
|
1159
|
+
if [ "$BRANCHING_STRATEGY" = "phase" ]; then
|
|
1160
|
+
for branch in $PHASE_BRANCHES; do
|
|
1161
|
+
git branch -d "$branch" 2>/dev/null || git branch -D "$branch"
|
|
1162
|
+
done
|
|
1163
|
+
fi
|
|
1164
|
+
|
|
1165
|
+
if [ "$BRANCHING_STRATEGY" = "milestone" ]; then
|
|
1166
|
+
git branch -d "$MILESTONE_BRANCH" 2>/dev/null || git branch -D "$MILESTONE_BRANCH"
|
|
1167
|
+
fi
|
|
1168
|
+
```
|
|
1169
|
+
|
|
1170
|
+
**Keep branches:** Report "Branches preserved for manual handling"
|
|
1171
|
+
|
|
1172
|
+
</step>
|
|
1173
|
+
|
|
1174
|
+
<step name="git_tag">
|
|
1175
|
+
|
|
1176
|
+
Create git tag:
|
|
1177
|
+
|
|
1178
|
+
```bash
|
|
1179
|
+
git tag -a v[X.Y] -m "v[X.Y] [Name]
|
|
1180
|
+
|
|
1181
|
+
Delivered: [One sentence]
|
|
1182
|
+
|
|
1183
|
+
Key accomplishments:
|
|
1184
|
+
- [Item 1]
|
|
1185
|
+
- [Item 2]
|
|
1186
|
+
- [Item 3]
|
|
1187
|
+
|
|
1188
|
+
See ${project_root}/MILESTONES.md for full details."
|
|
1189
|
+
```
|
|
1190
|
+
|
|
1191
|
+
Confirm: "Tagged: v[X.Y]"
|
|
1192
|
+
|
|
1193
|
+
**If `JOB_MODE` is true:**
|
|
1194
|
+
- Log: `[AUTO-RESOLVE] Skipping tag push in job mode`
|
|
1195
|
+
- Do not push tag
|
|
1196
|
+
- Skip to git_commit_milestone
|
|
1197
|
+
|
|
1198
|
+
**If `JOB_MODE` is false (default):**
|
|
1199
|
+
|
|
1200
|
+
Ask: "Push tag to remote? (y/n)"
|
|
1201
|
+
|
|
1202
|
+
If yes:
|
|
1203
|
+
```bash
|
|
1204
|
+
git push origin v[X.Y]
|
|
1205
|
+
```
|
|
1206
|
+
|
|
1207
|
+
</step>
|
|
1208
|
+
|
|
1209
|
+
<step name="git_commit_milestone">
|
|
1210
|
+
|
|
1211
|
+
Commit milestone completion.
|
|
1212
|
+
|
|
1213
|
+
```bash
|
|
1214
|
+
node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" commit "chore: complete v[X.Y] milestone" --files ${project_root}/milestones/v[X.Y]-ROADMAP.md ${project_root}/milestones/v[X.Y]-REQUIREMENTS.md ${project_root}/v[X.Y]-MILESTONE-AUDIT.md ${project_root}/MILESTONES.md ${project_path} ${state_path}
|
|
1215
|
+
```
|
|
1216
|
+
```
|
|
1217
|
+
|
|
1218
|
+
Confirm: "Committed: chore: complete v[X.Y] milestone"
|
|
1219
|
+
|
|
1220
|
+
</step>
|
|
1221
|
+
|
|
1222
|
+
<step name="offer_next">
|
|
1223
|
+
|
|
1224
|
+
```
|
|
1225
|
+
✅ Milestone v[X.Y] [Name] complete
|
|
1226
|
+
|
|
1227
|
+
Shipped:
|
|
1228
|
+
- [N] phases ([M] plans, [P] tasks)
|
|
1229
|
+
- [One sentence of what shipped]
|
|
1230
|
+
|
|
1231
|
+
Archived:
|
|
1232
|
+
- milestones/v[X.Y]-ROADMAP.md
|
|
1233
|
+
- milestones/v[X.Y]-REQUIREMENTS.md
|
|
1234
|
+
|
|
1235
|
+
Summary: ${project_root}/MILESTONES.md
|
|
1236
|
+
Tag: v[X.Y]
|
|
1237
|
+
|
|
1238
|
+
---
|
|
1239
|
+
|
|
1240
|
+
## ▶ Next Up
|
|
1241
|
+
|
|
1242
|
+
**Start Next Milestone** — questioning → research → requirements → roadmap
|
|
1243
|
+
|
|
1244
|
+
`/dgs:new-milestone`
|
|
1245
|
+
|
|
1246
|
+
<sub>`/clear` first → fresh context window</sub>
|
|
1247
|
+
|
|
1248
|
+
---
|
|
1249
|
+
```
|
|
1250
|
+
|
|
1251
|
+
</step>
|
|
1252
|
+
|
|
1253
|
+
</process>
|
|
1254
|
+
|
|
1255
|
+
<milestone_naming>
|
|
1256
|
+
|
|
1257
|
+
**Version conventions:**
|
|
1258
|
+
- **v1.0** — Initial MVP
|
|
1259
|
+
- **v1.1, v1.2** — Minor updates, new features, fixes
|
|
1260
|
+
- **v2.0, v3.0** — Major rewrites, breaking changes, new direction
|
|
1261
|
+
|
|
1262
|
+
**Names:** Short 1-2 words (v1.0 MVP, v1.1 Security, v1.2 Performance, v2.0 Redesign).
|
|
1263
|
+
|
|
1264
|
+
</milestone_naming>
|
|
1265
|
+
|
|
1266
|
+
<what_qualifies>
|
|
1267
|
+
|
|
1268
|
+
**Create milestones for:** Initial release, public releases, major feature sets shipped, before archiving planning.
|
|
1269
|
+
|
|
1270
|
+
**Don't create milestones for:** Every phase completion (too granular), work in progress, internal dev iterations (unless truly shipped).
|
|
1271
|
+
|
|
1272
|
+
Heuristic: "Is this deployed/usable/shipped?" If yes → milestone. If no → keep working.
|
|
1273
|
+
|
|
1274
|
+
</what_qualifies>
|
|
1275
|
+
|
|
1276
|
+
<success_criteria>
|
|
1277
|
+
|
|
1278
|
+
Milestone completion is successful when:
|
|
1279
|
+
|
|
1280
|
+
- [ ] MILESTONES.md entry created with stats and accomplishments
|
|
1281
|
+
- [ ] PROJECT.md full evolution review completed
|
|
1282
|
+
- [ ] All shipped requirements moved to Validated in PROJECT.md
|
|
1283
|
+
- [ ] Key Decisions updated with outcomes
|
|
1284
|
+
- [ ] ROADMAP.md reorganized with milestone grouping
|
|
1285
|
+
- [ ] Roadmap archive created (milestones/v[X.Y]-ROADMAP.md)
|
|
1286
|
+
- [ ] Requirements archive created (milestones/v[X.Y]-REQUIREMENTS.md)
|
|
1287
|
+
- [ ] REQUIREMENTS.md deleted (fresh for next milestone)
|
|
1288
|
+
- [ ] STATE.md updated with fresh project reference
|
|
1289
|
+
- [ ] Git tag created (v[X.Y])
|
|
1290
|
+
- [ ] Milestone commit made (includes archive files and deletion)
|
|
1291
|
+
- [ ] Requirements completion checked against REQUIREMENTS.md traceability table
|
|
1292
|
+
- [ ] Incomplete requirements surfaced with proceed/audit/abort options
|
|
1293
|
+
- [ ] Known gaps recorded in MILESTONES.md if user proceeded with incomplete requirements
|
|
1294
|
+
- [ ] RETROSPECTIVE.md updated with milestone section
|
|
1295
|
+
- [ ] Cross-milestone trends updated
|
|
1296
|
+
- [ ] User knows next step (/dgs:new-milestone)
|
|
1297
|
+
|
|
1298
|
+
</success_criteria>
|