gsd-opencode 1.10.2 → 1.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agents/gsd-codebase-mapper.md +29 -3
- package/agents/gsd-debugger.md +19 -21
- package/agents/gsd-executor.md +213 -528
- package/agents/gsd-integration-checker.md +20 -0
- package/agents/gsd-phase-researcher.md +189 -267
- package/agents/gsd-plan-checker.md +278 -279
- package/agents/gsd-planner.md +299 -490
- package/agents/gsd-project-researcher.md +103 -345
- package/agents/gsd-research-synthesizer.md +5 -22
- package/agents/gsd-roadmapper.md +43 -6
- package/agents/gsd-verifier.md +158 -377
- package/{lib → bin/dm/lib}/constants.js +10 -3
- package/{src → bin/dm/src}/commands/install.js +5 -4
- package/{src → bin/dm/src}/commands/uninstall.js +3 -1
- package/{src → bin/dm/src}/services/backup-manager.js +1 -1
- package/{src → bin/dm/src}/services/config.js +1 -1
- package/{src → bin/dm/src}/services/file-ops.js +20 -4
- package/{src → bin/dm/src}/services/health-checker.js +3 -1
- package/{src → bin/dm/src}/services/repair-service.js +3 -1
- package/{src → bin/dm/src}/services/settings.js +1 -1
- package/{src → bin/dm/src}/services/update-service.js +2 -2
- package/bin/gsd-install.js +0 -0
- package/bin/gsd.js +9 -9
- package/commands/gsd/gsd-add-phase.md +43 -0
- package/commands/gsd/gsd-add-todo.md +47 -0
- package/commands/gsd/gsd-audit-milestone.md +36 -0
- package/commands/gsd/gsd-check-todos.md +45 -0
- package/commands/gsd/gsd-cleanup.md +18 -0
- package/commands/gsd/{complete-milestone.md → gsd-complete-milestone.md} +1 -1
- package/commands/gsd/{debug.md → gsd-debug.md} +16 -21
- package/commands/gsd/{discuss-phase.md → gsd-discuss-phase.md} +6 -9
- package/commands/gsd/gsd-execute-phase.md +41 -0
- package/commands/gsd/gsd-health.md +22 -0
- package/commands/gsd/gsd-help.md +22 -0
- package/commands/gsd/gsd-insert-phase.md +32 -0
- package/commands/gsd/gsd-join-discord.md +18 -0
- package/commands/gsd/{list-phase-assumptions.md → gsd-list-phase-assumptions.md} +3 -7
- package/commands/gsd/{map-codebase.md → gsd-map-codebase.md} +3 -3
- package/commands/gsd/gsd-new-milestone.md +44 -0
- package/commands/gsd/gsd-new-project.md +42 -0
- package/commands/gsd/gsd-pause-work.md +38 -0
- package/commands/gsd/gsd-plan-milestone-gaps.md +34 -0
- package/commands/gsd/gsd-plan-phase.md +44 -0
- package/commands/gsd/gsd-progress.md +24 -0
- package/commands/gsd/gsd-quick.md +41 -0
- package/commands/gsd/gsd-reapply-patches.md +119 -0
- package/commands/gsd/gsd-remove-phase.md +31 -0
- package/commands/gsd/{research-phase.md → gsd-research-phase.md} +38 -49
- package/commands/gsd/{resume-work.md → gsd-resume-work.md} +2 -2
- package/commands/gsd/gsd-set-profile.md +34 -0
- package/commands/gsd/gsd-settings.md +36 -0
- package/commands/gsd/gsd-update.md +37 -0
- package/commands/gsd/gsd-verify-work.md +38 -0
- package/get-shit-done/bin/gsd-tools.cjs +553 -0
- package/get-shit-done/bin/gsd-tools.test.cjs +2346 -0
- package/get-shit-done/bin/lib/commands.cjs +556 -0
- package/get-shit-done/bin/lib/config.cjs +162 -0
- package/get-shit-done/bin/lib/core.cjs +377 -0
- package/get-shit-done/bin/lib/frontmatter.cjs +299 -0
- package/get-shit-done/bin/lib/init.cjs +694 -0
- package/get-shit-done/bin/lib/milestone.cjs +215 -0
- package/get-shit-done/bin/lib/phase.cjs +877 -0
- package/get-shit-done/bin/lib/roadmap.cjs +298 -0
- package/get-shit-done/bin/lib/state.cjs +490 -0
- package/get-shit-done/bin/lib/template.cjs +222 -0
- package/get-shit-done/bin/lib/verify.cjs +772 -0
- package/get-shit-done/references/checkpoints.md +62 -364
- package/get-shit-done/references/decimal-phase-calculation.md +65 -0
- package/get-shit-done/references/git-integration.md +10 -16
- package/get-shit-done/references/git-planning-commit.md +38 -0
- package/get-shit-done/references/model-profile-resolution.md +34 -0
- package/get-shit-done/references/model-profiles.md +54 -66
- package/get-shit-done/references/phase-argument-parsing.md +61 -0
- package/get-shit-done/references/planning-config.md +112 -10
- package/get-shit-done/references/questioning.md +4 -0
- package/get-shit-done/references/ui-brand.md +1 -1
- package/get-shit-done/templates/UAT.md +1 -1
- package/get-shit-done/templates/VALIDATION.md +104 -0
- package/get-shit-done/templates/codebase/structure.md +6 -6
- package/get-shit-done/templates/config.json +37 -0
- package/get-shit-done/templates/context.md +2 -10
- package/get-shit-done/templates/continue-here.md +6 -6
- package/get-shit-done/templates/debug-subagent-prompt.md +2 -2
- package/get-shit-done/templates/discovery.md +6 -6
- package/get-shit-done/templates/milestone-archive.md +3 -3
- package/get-shit-done/templates/phase-prompt.md +9 -7
- package/get-shit-done/templates/planner-subagent-prompt.md +6 -6
- package/get-shit-done/templates/research-project/ARCHITECTURE.md +1 -1
- package/get-shit-done/templates/research.md +29 -6
- package/get-shit-done/templates/roadmap.md +1 -1
- package/get-shit-done/templates/state.md +0 -30
- package/get-shit-done/templates/summary-complex.md +59 -0
- package/get-shit-done/templates/summary-minimal.md +41 -0
- package/get-shit-done/templates/summary-standard.md +48 -0
- package/get-shit-done/templates/summary.md +16 -37
- package/get-shit-done/templates/user-setup.md +1 -13
- package/get-shit-done/templates/verification-report.md +5 -5
- package/get-shit-done/workflows/add-phase.md +111 -0
- package/{commands/gsd → get-shit-done/workflows}/add-todo.md +24 -60
- package/{commands/gsd → get-shit-done/workflows}/audit-milestone.md +83 -63
- package/{commands/gsd → get-shit-done/workflows}/check-todos.md +21 -73
- package/get-shit-done/workflows/cleanup.md +152 -0
- package/get-shit-done/workflows/complete-milestone.md +251 -312
- package/get-shit-done/workflows/diagnose-issues.md +6 -31
- package/get-shit-done/workflows/discovery-phase.md +11 -11
- package/get-shit-done/workflows/discuss-phase.md +156 -49
- package/get-shit-done/workflows/execute-phase.md +238 -396
- package/get-shit-done/workflows/execute-plan.md +180 -1609
- package/get-shit-done/workflows/health.md +156 -0
- package/{commands/gsd → get-shit-done/workflows}/help.md +33 -35
- package/get-shit-done/workflows/insert-phase.md +129 -0
- package/get-shit-done/workflows/list-phase-assumptions.md +3 -3
- package/get-shit-done/workflows/map-codebase.md +73 -80
- package/get-shit-done/workflows/new-milestone.md +382 -0
- package/{commands/gsd → get-shit-done/workflows}/new-project.md +281 -234
- package/get-shit-done/workflows/oc-set-profile.md +320 -0
- package/{commands/gsd → get-shit-done/workflows}/pause-work.md +31 -43
- package/{commands/gsd → get-shit-done/workflows}/plan-milestone-gaps.md +29 -50
- package/get-shit-done/workflows/plan-phase.md +478 -0
- package/{commands/gsd → get-shit-done/workflows}/progress.md +64 -47
- package/get-shit-done/workflows/quick.md +453 -0
- package/get-shit-done/workflows/remove-phase.md +154 -0
- package/get-shit-done/workflows/research-phase.md +73 -0
- package/get-shit-done/workflows/resume-project.md +17 -26
- package/get-shit-done/workflows/set-profile.md +80 -0
- package/get-shit-done/workflows/settings.md +213 -0
- package/get-shit-done/workflows/transition.md +84 -104
- package/{commands/gsd → get-shit-done/workflows}/update.md +70 -28
- package/get-shit-done/workflows/verify-phase.md +106 -492
- package/get-shit-done/workflows/verify-work.md +26 -53
- package/package.json +7 -4
- package/rules/gsd-oc-work-hard.md +36 -0
- package/skills/gsd-oc-select-model/SKILL.md +348 -0
- package/skills/gsd-oc-select-model/scripts/select-models.cjs +268 -0
- package/agents/gsd-set-model.md +0 -287
- package/agents/gsd-set-profile.md +0 -239
- package/agents/gsd-settings.md +0 -749
- package/bin/install.js +0 -323
- package/commands/gsd/add-phase.md +0 -207
- package/commands/gsd/execute-phase.md +0 -339
- package/commands/gsd/insert-phase.md +0 -227
- package/commands/gsd/new-milestone.md +0 -721
- package/commands/gsd/plan-phase.md +0 -525
- package/commands/gsd/quick.md +0 -309
- package/commands/gsd/remove-phase.md +0 -349
- package/commands/gsd/set-model.md +0 -77
- package/commands/gsd/set-profile.md +0 -46
- package/commands/gsd/settings.md +0 -33
- package/commands/gsd/verify-work.md +0 -219
- package/commands/gsd/whats-new.md +0 -124
- /package/{src → bin/dm/src}/commands/check.js +0 -0
- /package/{src → bin/dm/src}/commands/config.js +0 -0
- /package/{src → bin/dm/src}/commands/list.js +0 -0
- /package/{src → bin/dm/src}/commands/repair.js +0 -0
- /package/{src → bin/dm/src}/commands/update.js +0 -0
- /package/{src → bin/dm/src}/services/manifest-manager.js +0 -0
- /package/{src → bin/dm/src}/services/migration-service.js +0 -0
- /package/{src → bin/dm/src}/services/scope-manager.js +0 -0
- /package/{src → bin/dm/src}/services/structure-detector.js +0 -0
- /package/{src → bin/dm/src}/utils/hash.js +0 -0
- /package/{src → bin/dm/src}/utils/interactive.js +0 -0
- /package/{src → bin/dm/src}/utils/logger.js +0 -0
- /package/{src → bin/dm/src}/utils/npm-registry.js +0 -0
- /package/{src → bin/dm/src}/utils/path-resolver.js +0 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Roadmap — Roadmap parsing and update operations
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const { normalizePhaseName, output, error, findPhaseInternal } = require('./core.cjs');
|
|
8
|
+
|
|
9
|
+
function cmdRoadmapGetPhase(cwd, phaseNum, raw) {
|
|
10
|
+
const roadmapPath = path.join(cwd, '.planning', 'ROADMAP.md');
|
|
11
|
+
|
|
12
|
+
if (!fs.existsSync(roadmapPath)) {
|
|
13
|
+
output({ found: false, error: 'ROADMAP.md not found' }, raw, '');
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
const content = fs.readFileSync(roadmapPath, 'utf-8');
|
|
19
|
+
|
|
20
|
+
// Escape special regex chars in phase number, handle decimal
|
|
21
|
+
const escapedPhase = phaseNum.replace(/\./g, '\\.');
|
|
22
|
+
|
|
23
|
+
// Match "## Phase X:", "### Phase X:", or "#### Phase X:" with optional name
|
|
24
|
+
const phasePattern = new RegExp(
|
|
25
|
+
`#{2,4}\\s*Phase\\s+${escapedPhase}:\\s*([^\\n]+)`,
|
|
26
|
+
'i'
|
|
27
|
+
);
|
|
28
|
+
const headerMatch = content.match(phasePattern);
|
|
29
|
+
|
|
30
|
+
if (!headerMatch) {
|
|
31
|
+
// Fallback: check if phase exists in summary list but missing detail section
|
|
32
|
+
const checklistPattern = new RegExp(
|
|
33
|
+
`-\\s*\\[[ x]\\]\\s*\\*\\*Phase\\s+${escapedPhase}:\\s*([^*]+)\\*\\*`,
|
|
34
|
+
'i'
|
|
35
|
+
);
|
|
36
|
+
const checklistMatch = content.match(checklistPattern);
|
|
37
|
+
|
|
38
|
+
if (checklistMatch) {
|
|
39
|
+
// Phase exists in summary but missing detail section - malformed ROADMAP
|
|
40
|
+
output({
|
|
41
|
+
found: false,
|
|
42
|
+
phase_number: phaseNum,
|
|
43
|
+
phase_name: checklistMatch[1].trim(),
|
|
44
|
+
error: 'malformed_roadmap',
|
|
45
|
+
message: `Phase ${phaseNum} exists in summary list but missing "### Phase ${phaseNum}:" detail section. ROADMAP.md needs both formats.`
|
|
46
|
+
}, raw, '');
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
output({ found: false, phase_number: phaseNum }, raw, '');
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const phaseName = headerMatch[1].trim();
|
|
55
|
+
const headerIndex = headerMatch.index;
|
|
56
|
+
|
|
57
|
+
// Find the end of this section (next ## or ### phase header, or end of file)
|
|
58
|
+
const restOfContent = content.slice(headerIndex);
|
|
59
|
+
const nextHeaderMatch = restOfContent.match(/\n#{2,4}\s+Phase\s+\d/i);
|
|
60
|
+
const sectionEnd = nextHeaderMatch
|
|
61
|
+
? headerIndex + nextHeaderMatch.index
|
|
62
|
+
: content.length;
|
|
63
|
+
|
|
64
|
+
const section = content.slice(headerIndex, sectionEnd).trim();
|
|
65
|
+
|
|
66
|
+
// Extract goal if present
|
|
67
|
+
const goalMatch = section.match(/\*\*Goal:\*\*\s*([^\n]+)/i);
|
|
68
|
+
const goal = goalMatch ? goalMatch[1].trim() : null;
|
|
69
|
+
|
|
70
|
+
// Extract success criteria as structured array
|
|
71
|
+
const criteriaMatch = section.match(/\*\*Success Criteria\*\*[^\n]*:\s*\n((?:\s*\d+\.\s*[^\n]+\n?)+)/i);
|
|
72
|
+
const success_criteria = criteriaMatch
|
|
73
|
+
? criteriaMatch[1].trim().split('\n').map(line => line.replace(/^\s*\d+\.\s*/, '').trim()).filter(Boolean)
|
|
74
|
+
: [];
|
|
75
|
+
|
|
76
|
+
output(
|
|
77
|
+
{
|
|
78
|
+
found: true,
|
|
79
|
+
phase_number: phaseNum,
|
|
80
|
+
phase_name: phaseName,
|
|
81
|
+
goal,
|
|
82
|
+
success_criteria,
|
|
83
|
+
section,
|
|
84
|
+
},
|
|
85
|
+
raw,
|
|
86
|
+
section
|
|
87
|
+
);
|
|
88
|
+
} catch (e) {
|
|
89
|
+
error('Failed to read ROADMAP.md: ' + e.message);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function cmdRoadmapAnalyze(cwd, raw) {
|
|
94
|
+
const roadmapPath = path.join(cwd, '.planning', 'ROADMAP.md');
|
|
95
|
+
|
|
96
|
+
if (!fs.existsSync(roadmapPath)) {
|
|
97
|
+
output({ error: 'ROADMAP.md not found', milestones: [], phases: [], current_phase: null }, raw);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const content = fs.readFileSync(roadmapPath, 'utf-8');
|
|
102
|
+
const phasesDir = path.join(cwd, '.planning', 'phases');
|
|
103
|
+
|
|
104
|
+
// Extract all phase headings: ## Phase N: Name or ### Phase N: Name
|
|
105
|
+
const phasePattern = /#{2,4}\s*Phase\s+(\d+(?:\.\d+)?)\s*:\s*([^\n]+)/gi;
|
|
106
|
+
const phases = [];
|
|
107
|
+
let match;
|
|
108
|
+
|
|
109
|
+
while ((match = phasePattern.exec(content)) !== null) {
|
|
110
|
+
const phaseNum = match[1];
|
|
111
|
+
const phaseName = match[2].replace(/\(INSERTED\)/i, '').trim();
|
|
112
|
+
|
|
113
|
+
// Extract goal from the section
|
|
114
|
+
const sectionStart = match.index;
|
|
115
|
+
const restOfContent = content.slice(sectionStart);
|
|
116
|
+
const nextHeader = restOfContent.match(/\n#{2,4}\s+Phase\s+\d/i);
|
|
117
|
+
const sectionEnd = nextHeader ? sectionStart + nextHeader.index : content.length;
|
|
118
|
+
const section = content.slice(sectionStart, sectionEnd);
|
|
119
|
+
|
|
120
|
+
const goalMatch = section.match(/\*\*Goal:\*\*\s*([^\n]+)/i);
|
|
121
|
+
const goal = goalMatch ? goalMatch[1].trim() : null;
|
|
122
|
+
|
|
123
|
+
const dependsMatch = section.match(/\*\*Depends on:\*\*\s*([^\n]+)/i);
|
|
124
|
+
const depends_on = dependsMatch ? dependsMatch[1].trim() : null;
|
|
125
|
+
|
|
126
|
+
// Check completion on disk
|
|
127
|
+
const normalized = normalizePhaseName(phaseNum);
|
|
128
|
+
let diskStatus = 'no_directory';
|
|
129
|
+
let planCount = 0;
|
|
130
|
+
let summaryCount = 0;
|
|
131
|
+
let hasContext = false;
|
|
132
|
+
let hasResearch = false;
|
|
133
|
+
|
|
134
|
+
try {
|
|
135
|
+
const entries = fs.readdirSync(phasesDir, { withFileTypes: true });
|
|
136
|
+
const dirs = entries.filter(e => e.isDirectory()).map(e => e.name);
|
|
137
|
+
const dirMatch = dirs.find(d => d.startsWith(normalized + '-') || d === normalized);
|
|
138
|
+
|
|
139
|
+
if (dirMatch) {
|
|
140
|
+
const phaseFiles = fs.readdirSync(path.join(phasesDir, dirMatch));
|
|
141
|
+
planCount = phaseFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md').length;
|
|
142
|
+
summaryCount = phaseFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md').length;
|
|
143
|
+
hasContext = phaseFiles.some(f => f.endsWith('-CONTEXT.md') || f === 'CONTEXT.md');
|
|
144
|
+
hasResearch = phaseFiles.some(f => f.endsWith('-RESEARCH.md') || f === 'RESEARCH.md');
|
|
145
|
+
|
|
146
|
+
if (summaryCount >= planCount && planCount > 0) diskStatus = 'complete';
|
|
147
|
+
else if (summaryCount > 0) diskStatus = 'partial';
|
|
148
|
+
else if (planCount > 0) diskStatus = 'planned';
|
|
149
|
+
else if (hasResearch) diskStatus = 'researched';
|
|
150
|
+
else if (hasContext) diskStatus = 'discussed';
|
|
151
|
+
else diskStatus = 'empty';
|
|
152
|
+
}
|
|
153
|
+
} catch {}
|
|
154
|
+
|
|
155
|
+
// Check ROADMAP checkbox status
|
|
156
|
+
const checkboxPattern = new RegExp(`-\\s*\\[(x| )\\]\\s*.*Phase\\s+${phaseNum.replace('.', '\\.')}`, 'i');
|
|
157
|
+
const checkboxMatch = content.match(checkboxPattern);
|
|
158
|
+
const roadmapComplete = checkboxMatch ? checkboxMatch[1] === 'x' : false;
|
|
159
|
+
|
|
160
|
+
phases.push({
|
|
161
|
+
number: phaseNum,
|
|
162
|
+
name: phaseName,
|
|
163
|
+
goal,
|
|
164
|
+
depends_on,
|
|
165
|
+
plan_count: planCount,
|
|
166
|
+
summary_count: summaryCount,
|
|
167
|
+
has_context: hasContext,
|
|
168
|
+
has_research: hasResearch,
|
|
169
|
+
disk_status: diskStatus,
|
|
170
|
+
roadmap_complete: roadmapComplete,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Extract milestone info
|
|
175
|
+
const milestones = [];
|
|
176
|
+
const milestonePattern = /##\s*(.*v(\d+\.\d+)[^(\n]*)/gi;
|
|
177
|
+
let mMatch;
|
|
178
|
+
while ((mMatch = milestonePattern.exec(content)) !== null) {
|
|
179
|
+
milestones.push({
|
|
180
|
+
heading: mMatch[1].trim(),
|
|
181
|
+
version: 'v' + mMatch[2],
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Find current and next phase
|
|
186
|
+
const currentPhase = phases.find(p => p.disk_status === 'planned' || p.disk_status === 'partial') || null;
|
|
187
|
+
const nextPhase = phases.find(p => p.disk_status === 'empty' || p.disk_status === 'no_directory' || p.disk_status === 'discussed' || p.disk_status === 'researched') || null;
|
|
188
|
+
|
|
189
|
+
// Aggregated stats
|
|
190
|
+
const totalPlans = phases.reduce((sum, p) => sum + p.plan_count, 0);
|
|
191
|
+
const totalSummaries = phases.reduce((sum, p) => sum + p.summary_count, 0);
|
|
192
|
+
const completedPhases = phases.filter(p => p.disk_status === 'complete').length;
|
|
193
|
+
|
|
194
|
+
// Detect phases in summary list without detail sections (malformed ROADMAP)
|
|
195
|
+
const checklistPattern = /-\s*\[[ x]\]\s*\*\*Phase\s+(\d+(?:\.\d+)?)/gi;
|
|
196
|
+
const checklistPhases = new Set();
|
|
197
|
+
let checklistMatch;
|
|
198
|
+
while ((checklistMatch = checklistPattern.exec(content)) !== null) {
|
|
199
|
+
checklistPhases.add(checklistMatch[1]);
|
|
200
|
+
}
|
|
201
|
+
const detailPhases = new Set(phases.map(p => p.number));
|
|
202
|
+
const missingDetails = [...checklistPhases].filter(p => !detailPhases.has(p));
|
|
203
|
+
|
|
204
|
+
const result = {
|
|
205
|
+
milestones,
|
|
206
|
+
phases,
|
|
207
|
+
phase_count: phases.length,
|
|
208
|
+
completed_phases: completedPhases,
|
|
209
|
+
total_plans: totalPlans,
|
|
210
|
+
total_summaries: totalSummaries,
|
|
211
|
+
progress_percent: totalPlans > 0 ? Math.round((totalSummaries / totalPlans) * 100) : 0,
|
|
212
|
+
current_phase: currentPhase ? currentPhase.number : null,
|
|
213
|
+
next_phase: nextPhase ? nextPhase.number : null,
|
|
214
|
+
missing_phase_details: missingDetails.length > 0 ? missingDetails : null,
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
output(result, raw);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function cmdRoadmapUpdatePlanProgress(cwd, phaseNum, raw) {
|
|
221
|
+
if (!phaseNum) {
|
|
222
|
+
error('phase number required for roadmap update-plan-progress');
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const roadmapPath = path.join(cwd, '.planning', 'ROADMAP.md');
|
|
226
|
+
|
|
227
|
+
const phaseInfo = findPhaseInternal(cwd, phaseNum);
|
|
228
|
+
if (!phaseInfo) {
|
|
229
|
+
error(`Phase ${phaseNum} not found`);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const planCount = phaseInfo.plans.length;
|
|
233
|
+
const summaryCount = phaseInfo.summaries.length;
|
|
234
|
+
|
|
235
|
+
if (planCount === 0) {
|
|
236
|
+
output({ updated: false, reason: 'No plans found', plan_count: 0, summary_count: 0 }, raw, 'no plans');
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const isComplete = summaryCount >= planCount;
|
|
241
|
+
const status = isComplete ? 'Complete' : summaryCount > 0 ? 'In Progress' : 'Planned';
|
|
242
|
+
const today = new Date().toISOString().split('T')[0];
|
|
243
|
+
|
|
244
|
+
if (!fs.existsSync(roadmapPath)) {
|
|
245
|
+
output({ updated: false, reason: 'ROADMAP.md not found', plan_count: planCount, summary_count: summaryCount }, raw, 'no roadmap');
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
let roadmapContent = fs.readFileSync(roadmapPath, 'utf-8');
|
|
250
|
+
const phaseEscaped = phaseNum.replace('.', '\\.');
|
|
251
|
+
|
|
252
|
+
// Progress table row: update Plans column (summaries/plans) and Status column
|
|
253
|
+
const tablePattern = new RegExp(
|
|
254
|
+
`(\\|\\s*${phaseEscaped}\\.?\\s[^|]*\\|)[^|]*(\\|)\\s*[^|]*(\\|)\\s*[^|]*(\\|)`,
|
|
255
|
+
'i'
|
|
256
|
+
);
|
|
257
|
+
const dateField = isComplete ? ` ${today} ` : ' ';
|
|
258
|
+
roadmapContent = roadmapContent.replace(
|
|
259
|
+
tablePattern,
|
|
260
|
+
`$1 ${summaryCount}/${planCount} $2 ${status.padEnd(11)}$3${dateField}$4`
|
|
261
|
+
);
|
|
262
|
+
|
|
263
|
+
// Update plan count in phase detail section
|
|
264
|
+
const planCountPattern = new RegExp(
|
|
265
|
+
`(#{2,4}\\s*Phase\\s+${phaseEscaped}[\\s\\S]*?\\*\\*Plans:\\*\\*\\s*)[^\\n]+`,
|
|
266
|
+
'i'
|
|
267
|
+
);
|
|
268
|
+
const planCountText = isComplete
|
|
269
|
+
? `${summaryCount}/${planCount} plans complete`
|
|
270
|
+
: `${summaryCount}/${planCount} plans executed`;
|
|
271
|
+
roadmapContent = roadmapContent.replace(planCountPattern, `$1${planCountText}`);
|
|
272
|
+
|
|
273
|
+
// If complete: check checkbox
|
|
274
|
+
if (isComplete) {
|
|
275
|
+
const checkboxPattern = new RegExp(
|
|
276
|
+
`(-\\s*\\[)[ ](\\]\\s*.*Phase\\s+${phaseEscaped}[:\\s][^\\n]*)`,
|
|
277
|
+
'i'
|
|
278
|
+
);
|
|
279
|
+
roadmapContent = roadmapContent.replace(checkboxPattern, `$1x$2 (completed ${today})`);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
fs.writeFileSync(roadmapPath, roadmapContent, 'utf-8');
|
|
283
|
+
|
|
284
|
+
output({
|
|
285
|
+
updated: true,
|
|
286
|
+
phase: phaseNum,
|
|
287
|
+
plan_count: planCount,
|
|
288
|
+
summary_count: summaryCount,
|
|
289
|
+
status,
|
|
290
|
+
complete: isComplete,
|
|
291
|
+
}, raw, `${summaryCount}/${planCount} ${status}`);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
module.exports = {
|
|
295
|
+
cmdRoadmapGetPhase,
|
|
296
|
+
cmdRoadmapAnalyze,
|
|
297
|
+
cmdRoadmapUpdatePlanProgress,
|
|
298
|
+
};
|