@m3hti/commit-genie 3.3.0 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/.claude/agents/gsd-codebase-mapper.md +764 -0
  2. package/.claude/agents/gsd-debugger.md +1246 -0
  3. package/.claude/agents/gsd-executor.md +469 -0
  4. package/.claude/agents/gsd-integration-checker.md +443 -0
  5. package/.claude/agents/gsd-phase-researcher.md +546 -0
  6. package/.claude/agents/gsd-plan-checker.md +690 -0
  7. package/.claude/agents/gsd-planner.md +1275 -0
  8. package/.claude/agents/gsd-project-researcher.md +621 -0
  9. package/.claude/agents/gsd-research-synthesizer.md +239 -0
  10. package/.claude/agents/gsd-roadmapper.md +642 -0
  11. package/.claude/agents/gsd-verifier.md +573 -0
  12. package/.claude/commands/gsd/add-phase.md +43 -0
  13. package/.claude/commands/gsd/add-tests.md +41 -0
  14. package/.claude/commands/gsd/add-todo.md +47 -0
  15. package/.claude/commands/gsd/audit-milestone.md +36 -0
  16. package/.claude/commands/gsd/check-todos.md +45 -0
  17. package/.claude/commands/gsd/cleanup.md +18 -0
  18. package/.claude/commands/gsd/complete-milestone.md +136 -0
  19. package/.claude/commands/gsd/debug.md +167 -0
  20. package/.claude/commands/gsd/discuss-phase.md +83 -0
  21. package/.claude/commands/gsd/execute-phase.md +41 -0
  22. package/.claude/commands/gsd/health.md +22 -0
  23. package/.claude/commands/gsd/help.md +22 -0
  24. package/.claude/commands/gsd/insert-phase.md +32 -0
  25. package/.claude/commands/gsd/join-discord.md +18 -0
  26. package/.claude/commands/gsd/list-phase-assumptions.md +46 -0
  27. package/.claude/commands/gsd/map-codebase.md +71 -0
  28. package/.claude/commands/gsd/new-milestone.md +44 -0
  29. package/.claude/commands/gsd/new-project.md +42 -0
  30. package/.claude/commands/gsd/new-project.md.bak +1041 -0
  31. package/.claude/commands/gsd/pause-work.md +38 -0
  32. package/.claude/commands/gsd/plan-milestone-gaps.md +34 -0
  33. package/.claude/commands/gsd/plan-phase.md +45 -0
  34. package/.claude/commands/gsd/progress.md +24 -0
  35. package/.claude/commands/gsd/quick.md +41 -0
  36. package/.claude/commands/gsd/reapply-patches.md +110 -0
  37. package/.claude/commands/gsd/remove-phase.md +31 -0
  38. package/.claude/commands/gsd/research-phase.md +189 -0
  39. package/.claude/commands/gsd/resume-work.md +40 -0
  40. package/.claude/commands/gsd/set-profile.md +34 -0
  41. package/.claude/commands/gsd/settings.md +36 -0
  42. package/.claude/commands/gsd/update.md +37 -0
  43. package/.claude/commands/gsd/verify-work.md +38 -0
  44. package/.claude/get-shit-done/VERSION +1 -0
  45. package/.claude/get-shit-done/bin/gsd-tools.cjs +588 -0
  46. package/.claude/get-shit-done/bin/lib/commands.cjs +553 -0
  47. package/.claude/get-shit-done/bin/lib/config.cjs +162 -0
  48. package/.claude/get-shit-done/bin/lib/core.cjs +411 -0
  49. package/.claude/get-shit-done/bin/lib/frontmatter.cjs +299 -0
  50. package/.claude/get-shit-done/bin/lib/init.cjs +710 -0
  51. package/.claude/get-shit-done/bin/lib/milestone.cjs +216 -0
  52. package/.claude/get-shit-done/bin/lib/phase.cjs +871 -0
  53. package/.claude/get-shit-done/bin/lib/roadmap.cjs +298 -0
  54. package/.claude/get-shit-done/bin/lib/state.cjs +679 -0
  55. package/.claude/get-shit-done/bin/lib/template.cjs +222 -0
  56. package/.claude/get-shit-done/bin/lib/verify.cjs +773 -0
  57. package/.claude/get-shit-done/references/checkpoints.md +776 -0
  58. package/.claude/get-shit-done/references/continuation-format.md +249 -0
  59. package/.claude/get-shit-done/references/decimal-phase-calculation.md +65 -0
  60. package/.claude/get-shit-done/references/git-integration.md +248 -0
  61. package/.claude/get-shit-done/references/git-planning-commit.md +38 -0
  62. package/.claude/get-shit-done/references/model-profile-resolution.md +34 -0
  63. package/.claude/get-shit-done/references/model-profiles.md +92 -0
  64. package/.claude/get-shit-done/references/phase-argument-parsing.md +61 -0
  65. package/.claude/get-shit-done/references/planning-config.md +196 -0
  66. package/.claude/get-shit-done/references/questioning.md +145 -0
  67. package/.claude/get-shit-done/references/tdd.md +263 -0
  68. package/.claude/get-shit-done/references/ui-brand.md +160 -0
  69. package/.claude/get-shit-done/references/verification-patterns.md +612 -0
  70. package/.claude/get-shit-done/templates/DEBUG.md +164 -0
  71. package/.claude/get-shit-done/templates/UAT.md +247 -0
  72. package/.claude/get-shit-done/templates/VALIDATION.md +76 -0
  73. package/.claude/get-shit-done/templates/codebase/architecture.md +255 -0
  74. package/.claude/get-shit-done/templates/codebase/concerns.md +310 -0
  75. package/.claude/get-shit-done/templates/codebase/conventions.md +307 -0
  76. package/.claude/get-shit-done/templates/codebase/integrations.md +280 -0
  77. package/.claude/get-shit-done/templates/codebase/stack.md +186 -0
  78. package/.claude/get-shit-done/templates/codebase/structure.md +285 -0
  79. package/.claude/get-shit-done/templates/codebase/testing.md +480 -0
  80. package/.claude/get-shit-done/templates/config.json +37 -0
  81. package/.claude/get-shit-done/templates/context.md +283 -0
  82. package/.claude/get-shit-done/templates/continue-here.md +78 -0
  83. package/.claude/get-shit-done/templates/debug-subagent-prompt.md +91 -0
  84. package/.claude/get-shit-done/templates/discovery.md +146 -0
  85. package/.claude/get-shit-done/templates/milestone-archive.md +123 -0
  86. package/.claude/get-shit-done/templates/milestone.md +115 -0
  87. package/.claude/get-shit-done/templates/phase-prompt.md +569 -0
  88. package/.claude/get-shit-done/templates/planner-subagent-prompt.md +117 -0
  89. package/.claude/get-shit-done/templates/project.md +184 -0
  90. package/.claude/get-shit-done/templates/requirements.md +231 -0
  91. package/.claude/get-shit-done/templates/research-project/ARCHITECTURE.md +204 -0
  92. package/.claude/get-shit-done/templates/research-project/FEATURES.md +147 -0
  93. package/.claude/get-shit-done/templates/research-project/PITFALLS.md +200 -0
  94. package/.claude/get-shit-done/templates/research-project/STACK.md +120 -0
  95. package/.claude/get-shit-done/templates/research-project/SUMMARY.md +170 -0
  96. package/.claude/get-shit-done/templates/research.md +552 -0
  97. package/.claude/get-shit-done/templates/retrospective.md +54 -0
  98. package/.claude/get-shit-done/templates/roadmap.md +202 -0
  99. package/.claude/get-shit-done/templates/state.md +176 -0
  100. package/.claude/get-shit-done/templates/summary-complex.md +59 -0
  101. package/.claude/get-shit-done/templates/summary-minimal.md +41 -0
  102. package/.claude/get-shit-done/templates/summary-standard.md +48 -0
  103. package/.claude/get-shit-done/templates/summary.md +248 -0
  104. package/.claude/get-shit-done/templates/user-setup.md +311 -0
  105. package/.claude/get-shit-done/templates/verification-report.md +322 -0
  106. package/.claude/get-shit-done/workflows/add-phase.md +111 -0
  107. package/.claude/get-shit-done/workflows/add-tests.md +350 -0
  108. package/.claude/get-shit-done/workflows/add-todo.md +157 -0
  109. package/.claude/get-shit-done/workflows/audit-milestone.md +297 -0
  110. package/.claude/get-shit-done/workflows/check-todos.md +176 -0
  111. package/.claude/get-shit-done/workflows/cleanup.md +152 -0
  112. package/.claude/get-shit-done/workflows/complete-milestone.md +763 -0
  113. package/.claude/get-shit-done/workflows/diagnose-issues.md +219 -0
  114. package/.claude/get-shit-done/workflows/discovery-phase.md +289 -0
  115. package/.claude/get-shit-done/workflows/discuss-phase.md +542 -0
  116. package/.claude/get-shit-done/workflows/execute-phase.md +449 -0
  117. package/.claude/get-shit-done/workflows/execute-plan.md +448 -0
  118. package/.claude/get-shit-done/workflows/health.md +156 -0
  119. package/.claude/get-shit-done/workflows/help.md +489 -0
  120. package/.claude/get-shit-done/workflows/insert-phase.md +129 -0
  121. package/.claude/get-shit-done/workflows/list-phase-assumptions.md +178 -0
  122. package/.claude/get-shit-done/workflows/map-codebase.md +315 -0
  123. package/.claude/get-shit-done/workflows/new-milestone.md +382 -0
  124. package/.claude/get-shit-done/workflows/new-project.md +1116 -0
  125. package/.claude/get-shit-done/workflows/pause-work.md +122 -0
  126. package/.claude/get-shit-done/workflows/plan-milestone-gaps.md +274 -0
  127. package/.claude/get-shit-done/workflows/plan-phase.md +569 -0
  128. package/.claude/get-shit-done/workflows/progress.md +381 -0
  129. package/.claude/get-shit-done/workflows/quick.md +453 -0
  130. package/.claude/get-shit-done/workflows/remove-phase.md +154 -0
  131. package/.claude/get-shit-done/workflows/research-phase.md +73 -0
  132. package/.claude/get-shit-done/workflows/resume-project.md +306 -0
  133. package/.claude/get-shit-done/workflows/set-profile.md +80 -0
  134. package/.claude/get-shit-done/workflows/settings.md +213 -0
  135. package/.claude/get-shit-done/workflows/transition.md +544 -0
  136. package/.claude/get-shit-done/workflows/update.md +219 -0
  137. package/.claude/get-shit-done/workflows/verify-phase.md +242 -0
  138. package/.claude/get-shit-done/workflows/verify-work.md +569 -0
  139. package/.claude/gsd-file-manifest.json +144 -0
  140. package/.claude/hooks/gsd-check-update.js +62 -0
  141. package/.claude/hooks/gsd-context-monitor.js +122 -0
  142. package/.claude/hooks/gsd-statusline.js +108 -0
  143. package/.claude/package.json +1 -0
  144. package/.claude/settings.json +49 -0
  145. package/dist/commands/generate.d.ts.map +1 -1
  146. package/dist/commands/generate.js +18 -8
  147. package/dist/commands/generate.js.map +1 -1
  148. package/dist/services/analyzerService.d.ts.map +1 -1
  149. package/dist/services/analyzerService.js +10 -0
  150. package/dist/services/analyzerService.js.map +1 -1
  151. package/package.json +1 -1
@@ -0,0 +1,871 @@
1
+ /**
2
+ * Phase — Phase CRUD, query, and lifecycle operations
3
+ */
4
+
5
+ const fs = require('fs');
6
+ const path = require('path');
7
+ const { escapeRegex, normalizePhaseName, comparePhaseNum, findPhaseInternal, getArchivedPhaseDirs, generateSlugInternal, output, error } = require('./core.cjs');
8
+ const { extractFrontmatter } = require('./frontmatter.cjs');
9
+ const { writeStateMd } = require('./state.cjs');
10
+
11
+ function cmdPhasesList(cwd, options, raw) {
12
+ const phasesDir = path.join(cwd, '.planning', 'phases');
13
+ const { type, phase, includeArchived } = options;
14
+
15
+ // If no phases directory, return empty
16
+ if (!fs.existsSync(phasesDir)) {
17
+ if (type) {
18
+ output({ files: [], count: 0 }, raw, '');
19
+ } else {
20
+ output({ directories: [], count: 0 }, raw, '');
21
+ }
22
+ return;
23
+ }
24
+
25
+ try {
26
+ // Get all phase directories
27
+ const entries = fs.readdirSync(phasesDir, { withFileTypes: true });
28
+ let dirs = entries.filter(e => e.isDirectory()).map(e => e.name);
29
+
30
+ // Include archived phases if requested
31
+ if (includeArchived) {
32
+ const archived = getArchivedPhaseDirs(cwd);
33
+ for (const a of archived) {
34
+ dirs.push(`${a.name} [${a.milestone}]`);
35
+ }
36
+ }
37
+
38
+ // Sort numerically (handles integers, decimals, letter-suffix, hybrids)
39
+ dirs.sort((a, b) => comparePhaseNum(a, b));
40
+
41
+ // If filtering by phase number
42
+ if (phase) {
43
+ const normalized = normalizePhaseName(phase);
44
+ const match = dirs.find(d => d.startsWith(normalized));
45
+ if (!match) {
46
+ output({ files: [], count: 0, phase_dir: null, error: 'Phase not found' }, raw, '');
47
+ return;
48
+ }
49
+ dirs = [match];
50
+ }
51
+
52
+ // If listing files of a specific type
53
+ if (type) {
54
+ const files = [];
55
+ for (const dir of dirs) {
56
+ const dirPath = path.join(phasesDir, dir);
57
+ const dirFiles = fs.readdirSync(dirPath);
58
+
59
+ let filtered;
60
+ if (type === 'plans') {
61
+ filtered = dirFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md');
62
+ } else if (type === 'summaries') {
63
+ filtered = dirFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');
64
+ } else {
65
+ filtered = dirFiles;
66
+ }
67
+
68
+ files.push(...filtered.sort());
69
+ }
70
+
71
+ const result = {
72
+ files,
73
+ count: files.length,
74
+ phase_dir: phase ? dirs[0].replace(/^\d+(?:\.\d+)*-?/, '') : null,
75
+ };
76
+ output(result, raw, files.join('\n'));
77
+ return;
78
+ }
79
+
80
+ // Default: list directories
81
+ output({ directories: dirs, count: dirs.length }, raw, dirs.join('\n'));
82
+ } catch (e) {
83
+ error('Failed to list phases: ' + e.message);
84
+ }
85
+ }
86
+
87
+ function cmdPhaseNextDecimal(cwd, basePhase, raw) {
88
+ const phasesDir = path.join(cwd, '.planning', 'phases');
89
+ const normalized = normalizePhaseName(basePhase);
90
+
91
+ // Check if phases directory exists
92
+ if (!fs.existsSync(phasesDir)) {
93
+ output(
94
+ {
95
+ found: false,
96
+ base_phase: normalized,
97
+ next: `${normalized}.1`,
98
+ existing: [],
99
+ },
100
+ raw,
101
+ `${normalized}.1`
102
+ );
103
+ return;
104
+ }
105
+
106
+ try {
107
+ const entries = fs.readdirSync(phasesDir, { withFileTypes: true });
108
+ const dirs = entries.filter(e => e.isDirectory()).map(e => e.name);
109
+
110
+ // Check if base phase exists
111
+ const baseExists = dirs.some(d => d.startsWith(normalized + '-') || d === normalized);
112
+
113
+ // Find existing decimal phases for this base
114
+ const decimalPattern = new RegExp(`^${normalized}\\.(\\d+)`);
115
+ const existingDecimals = [];
116
+
117
+ for (const dir of dirs) {
118
+ const match = dir.match(decimalPattern);
119
+ if (match) {
120
+ existingDecimals.push(`${normalized}.${match[1]}`);
121
+ }
122
+ }
123
+
124
+ // Sort numerically
125
+ existingDecimals.sort((a, b) => comparePhaseNum(a, b));
126
+
127
+ // Calculate next decimal
128
+ let nextDecimal;
129
+ if (existingDecimals.length === 0) {
130
+ nextDecimal = `${normalized}.1`;
131
+ } else {
132
+ const lastDecimal = existingDecimals[existingDecimals.length - 1];
133
+ const lastNum = parseInt(lastDecimal.split('.')[1], 10);
134
+ nextDecimal = `${normalized}.${lastNum + 1}`;
135
+ }
136
+
137
+ output(
138
+ {
139
+ found: baseExists,
140
+ base_phase: normalized,
141
+ next: nextDecimal,
142
+ existing: existingDecimals,
143
+ },
144
+ raw,
145
+ nextDecimal
146
+ );
147
+ } catch (e) {
148
+ error('Failed to calculate next decimal phase: ' + e.message);
149
+ }
150
+ }
151
+
152
+ function cmdFindPhase(cwd, phase, raw) {
153
+ if (!phase) {
154
+ error('phase identifier required');
155
+ }
156
+
157
+ const phasesDir = path.join(cwd, '.planning', 'phases');
158
+ const normalized = normalizePhaseName(phase);
159
+
160
+ const notFound = { found: false, directory: null, phase_number: null, phase_name: null, plans: [], summaries: [] };
161
+
162
+ try {
163
+ const entries = fs.readdirSync(phasesDir, { withFileTypes: true });
164
+ const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort((a, b) => comparePhaseNum(a, b));
165
+
166
+ const match = dirs.find(d => d.startsWith(normalized));
167
+ if (!match) {
168
+ output(notFound, raw, '');
169
+ return;
170
+ }
171
+
172
+ const dirMatch = match.match(/^(\d+[A-Z]?(?:\.\d+)*)-?(.*)/i);
173
+ const phaseNumber = dirMatch ? dirMatch[1] : normalized;
174
+ const phaseName = dirMatch && dirMatch[2] ? dirMatch[2] : null;
175
+
176
+ const phaseDir = path.join(phasesDir, match);
177
+ const phaseFiles = fs.readdirSync(phaseDir);
178
+ const plans = phaseFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md').sort();
179
+ const summaries = phaseFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md').sort();
180
+
181
+ const result = {
182
+ found: true,
183
+ directory: path.join('.planning', 'phases', match),
184
+ phase_number: phaseNumber,
185
+ phase_name: phaseName,
186
+ plans,
187
+ summaries,
188
+ };
189
+
190
+ output(result, raw, result.directory);
191
+ } catch {
192
+ output(notFound, raw, '');
193
+ }
194
+ }
195
+
196
+ function cmdPhasePlanIndex(cwd, phase, raw) {
197
+ if (!phase) {
198
+ error('phase required for phase-plan-index');
199
+ }
200
+
201
+ const phasesDir = path.join(cwd, '.planning', 'phases');
202
+ const normalized = normalizePhaseName(phase);
203
+
204
+ // Find phase directory
205
+ let phaseDir = null;
206
+ let phaseDirName = null;
207
+ try {
208
+ const entries = fs.readdirSync(phasesDir, { withFileTypes: true });
209
+ const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort((a, b) => comparePhaseNum(a, b));
210
+ const match = dirs.find(d => d.startsWith(normalized));
211
+ if (match) {
212
+ phaseDir = path.join(phasesDir, match);
213
+ phaseDirName = match;
214
+ }
215
+ } catch {
216
+ // phases dir doesn't exist
217
+ }
218
+
219
+ if (!phaseDir) {
220
+ output({ phase: normalized, error: 'Phase not found', plans: [], waves: {}, incomplete: [], has_checkpoints: false }, raw);
221
+ return;
222
+ }
223
+
224
+ // Get all files in phase directory
225
+ const phaseFiles = fs.readdirSync(phaseDir);
226
+ const planFiles = phaseFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md').sort();
227
+ const summaryFiles = phaseFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');
228
+
229
+ // Build set of plan IDs with summaries
230
+ const completedPlanIds = new Set(
231
+ summaryFiles.map(s => s.replace('-SUMMARY.md', '').replace('SUMMARY.md', ''))
232
+ );
233
+
234
+ const plans = [];
235
+ const waves = {};
236
+ const incomplete = [];
237
+ let hasCheckpoints = false;
238
+
239
+ for (const planFile of planFiles) {
240
+ const planId = planFile.replace('-PLAN.md', '').replace('PLAN.md', '');
241
+ const planPath = path.join(phaseDir, planFile);
242
+ const content = fs.readFileSync(planPath, 'utf-8');
243
+ const fm = extractFrontmatter(content);
244
+
245
+ // Count tasks (## Task N patterns)
246
+ const taskMatches = content.match(/##\s*Task\s*\d+/gi) || [];
247
+ const taskCount = taskMatches.length;
248
+
249
+ // Parse wave as integer
250
+ const wave = parseInt(fm.wave, 10) || 1;
251
+
252
+ // Parse autonomous (default true if not specified)
253
+ let autonomous = true;
254
+ if (fm.autonomous !== undefined) {
255
+ autonomous = fm.autonomous === 'true' || fm.autonomous === true;
256
+ }
257
+
258
+ if (!autonomous) {
259
+ hasCheckpoints = true;
260
+ }
261
+
262
+ // Parse files-modified
263
+ let filesModified = [];
264
+ if (fm['files-modified']) {
265
+ filesModified = Array.isArray(fm['files-modified']) ? fm['files-modified'] : [fm['files-modified']];
266
+ }
267
+
268
+ const hasSummary = completedPlanIds.has(planId);
269
+ if (!hasSummary) {
270
+ incomplete.push(planId);
271
+ }
272
+
273
+ const plan = {
274
+ id: planId,
275
+ wave,
276
+ autonomous,
277
+ objective: fm.objective || null,
278
+ files_modified: filesModified,
279
+ task_count: taskCount,
280
+ has_summary: hasSummary,
281
+ };
282
+
283
+ plans.push(plan);
284
+
285
+ // Group by wave
286
+ const waveKey = String(wave);
287
+ if (!waves[waveKey]) {
288
+ waves[waveKey] = [];
289
+ }
290
+ waves[waveKey].push(planId);
291
+ }
292
+
293
+ const result = {
294
+ phase: normalized,
295
+ plans,
296
+ waves,
297
+ incomplete,
298
+ has_checkpoints: hasCheckpoints,
299
+ };
300
+
301
+ output(result, raw);
302
+ }
303
+
304
+ function cmdPhaseAdd(cwd, description, raw) {
305
+ if (!description) {
306
+ error('description required for phase add');
307
+ }
308
+
309
+ const roadmapPath = path.join(cwd, '.planning', 'ROADMAP.md');
310
+ if (!fs.existsSync(roadmapPath)) {
311
+ error('ROADMAP.md not found');
312
+ }
313
+
314
+ const content = fs.readFileSync(roadmapPath, 'utf-8');
315
+ const slug = generateSlugInternal(description);
316
+
317
+ // Find highest integer phase number
318
+ const phasePattern = /#{2,4}\s*Phase\s+(\d+)[A-Z]?(?:\.\d+)*:/gi;
319
+ let maxPhase = 0;
320
+ let m;
321
+ while ((m = phasePattern.exec(content)) !== null) {
322
+ const num = parseInt(m[1], 10);
323
+ if (num > maxPhase) maxPhase = num;
324
+ }
325
+
326
+ const newPhaseNum = maxPhase + 1;
327
+ const paddedNum = String(newPhaseNum).padStart(2, '0');
328
+ const dirName = `${paddedNum}-${slug}`;
329
+ const dirPath = path.join(cwd, '.planning', 'phases', dirName);
330
+
331
+ // Create directory with .gitkeep so git tracks empty folders
332
+ fs.mkdirSync(dirPath, { recursive: true });
333
+ fs.writeFileSync(path.join(dirPath, '.gitkeep'), '');
334
+
335
+ // Build phase entry
336
+ const phaseEntry = `\n### Phase ${newPhaseNum}: ${description}\n\n**Goal:** [To be planned]\n**Requirements**: TBD\n**Depends on:** Phase ${maxPhase}\n**Plans:** 0 plans\n\nPlans:\n- [ ] TBD (run /gsd:plan-phase ${newPhaseNum} to break down)\n`;
337
+
338
+ // Find insertion point: before last "---" or at end
339
+ let updatedContent;
340
+ const lastSeparator = content.lastIndexOf('\n---');
341
+ if (lastSeparator > 0) {
342
+ updatedContent = content.slice(0, lastSeparator) + phaseEntry + content.slice(lastSeparator);
343
+ } else {
344
+ updatedContent = content + phaseEntry;
345
+ }
346
+
347
+ fs.writeFileSync(roadmapPath, updatedContent, 'utf-8');
348
+
349
+ const result = {
350
+ phase_number: newPhaseNum,
351
+ padded: paddedNum,
352
+ name: description,
353
+ slug,
354
+ directory: `.planning/phases/${dirName}`,
355
+ };
356
+
357
+ output(result, raw, paddedNum);
358
+ }
359
+
360
+ function cmdPhaseInsert(cwd, afterPhase, description, raw) {
361
+ if (!afterPhase || !description) {
362
+ error('after-phase and description required for phase insert');
363
+ }
364
+
365
+ const roadmapPath = path.join(cwd, '.planning', 'ROADMAP.md');
366
+ if (!fs.existsSync(roadmapPath)) {
367
+ error('ROADMAP.md not found');
368
+ }
369
+
370
+ const content = fs.readFileSync(roadmapPath, 'utf-8');
371
+ const slug = generateSlugInternal(description);
372
+
373
+ // Normalize input then strip leading zeros for flexible matching
374
+ const normalizedAfter = normalizePhaseName(afterPhase);
375
+ const unpadded = normalizedAfter.replace(/^0+/, '');
376
+ const afterPhaseEscaped = unpadded.replace(/\./g, '\\.');
377
+ const targetPattern = new RegExp(`#{2,4}\\s*Phase\\s+0*${afterPhaseEscaped}:`, 'i');
378
+ if (!targetPattern.test(content)) {
379
+ error(`Phase ${afterPhase} not found in ROADMAP.md`);
380
+ }
381
+
382
+ // Calculate next decimal using existing logic
383
+ const phasesDir = path.join(cwd, '.planning', 'phases');
384
+ const normalizedBase = normalizePhaseName(afterPhase);
385
+ let existingDecimals = [];
386
+
387
+ try {
388
+ const entries = fs.readdirSync(phasesDir, { withFileTypes: true });
389
+ const dirs = entries.filter(e => e.isDirectory()).map(e => e.name);
390
+ const decimalPattern = new RegExp(`^${normalizedBase}\\.(\\d+)`);
391
+ for (const dir of dirs) {
392
+ const dm = dir.match(decimalPattern);
393
+ if (dm) existingDecimals.push(parseInt(dm[1], 10));
394
+ }
395
+ } catch {}
396
+
397
+ const nextDecimal = existingDecimals.length === 0 ? 1 : Math.max(...existingDecimals) + 1;
398
+ const decimalPhase = `${normalizedBase}.${nextDecimal}`;
399
+ const dirName = `${decimalPhase}-${slug}`;
400
+ const dirPath = path.join(cwd, '.planning', 'phases', dirName);
401
+
402
+ // Create directory with .gitkeep so git tracks empty folders
403
+ fs.mkdirSync(dirPath, { recursive: true });
404
+ fs.writeFileSync(path.join(dirPath, '.gitkeep'), '');
405
+
406
+ // Build phase entry
407
+ const phaseEntry = `\n### Phase ${decimalPhase}: ${description} (INSERTED)\n\n**Goal:** [Urgent work - to be planned]\n**Requirements**: TBD\n**Depends on:** Phase ${afterPhase}\n**Plans:** 0 plans\n\nPlans:\n- [ ] TBD (run /gsd:plan-phase ${decimalPhase} to break down)\n`;
408
+
409
+ // Insert after the target phase section
410
+ const headerPattern = new RegExp(`(#{2,4}\\s*Phase\\s+0*${afterPhaseEscaped}:[^\\n]*\\n)`, 'i');
411
+ const headerMatch = content.match(headerPattern);
412
+ if (!headerMatch) {
413
+ error(`Could not find Phase ${afterPhase} header`);
414
+ }
415
+
416
+ const headerIdx = content.indexOf(headerMatch[0]);
417
+ const afterHeader = content.slice(headerIdx + headerMatch[0].length);
418
+ const nextPhaseMatch = afterHeader.match(/\n#{2,4}\s+Phase\s+\d/i);
419
+
420
+ let insertIdx;
421
+ if (nextPhaseMatch) {
422
+ insertIdx = headerIdx + headerMatch[0].length + nextPhaseMatch.index;
423
+ } else {
424
+ insertIdx = content.length;
425
+ }
426
+
427
+ const updatedContent = content.slice(0, insertIdx) + phaseEntry + content.slice(insertIdx);
428
+ fs.writeFileSync(roadmapPath, updatedContent, 'utf-8');
429
+
430
+ const result = {
431
+ phase_number: decimalPhase,
432
+ after_phase: afterPhase,
433
+ name: description,
434
+ slug,
435
+ directory: `.planning/phases/${dirName}`,
436
+ };
437
+
438
+ output(result, raw, decimalPhase);
439
+ }
440
+
441
+ function cmdPhaseRemove(cwd, targetPhase, options, raw) {
442
+ if (!targetPhase) {
443
+ error('phase number required for phase remove');
444
+ }
445
+
446
+ const roadmapPath = path.join(cwd, '.planning', 'ROADMAP.md');
447
+ const phasesDir = path.join(cwd, '.planning', 'phases');
448
+ const force = options.force || false;
449
+
450
+ if (!fs.existsSync(roadmapPath)) {
451
+ error('ROADMAP.md not found');
452
+ }
453
+
454
+ // Normalize the target
455
+ const normalized = normalizePhaseName(targetPhase);
456
+ const isDecimal = targetPhase.includes('.');
457
+
458
+ // Find and validate target directory
459
+ let targetDir = null;
460
+ try {
461
+ const entries = fs.readdirSync(phasesDir, { withFileTypes: true });
462
+ const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort((a, b) => comparePhaseNum(a, b));
463
+ targetDir = dirs.find(d => d.startsWith(normalized + '-') || d === normalized);
464
+ } catch {}
465
+
466
+ // Check for executed work (SUMMARY.md files)
467
+ if (targetDir && !force) {
468
+ const targetPath = path.join(phasesDir, targetDir);
469
+ const files = fs.readdirSync(targetPath);
470
+ const summaries = files.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');
471
+ if (summaries.length > 0) {
472
+ error(`Phase ${targetPhase} has ${summaries.length} executed plan(s). Use --force to remove anyway.`);
473
+ }
474
+ }
475
+
476
+ // Delete target directory
477
+ if (targetDir) {
478
+ fs.rmSync(path.join(phasesDir, targetDir), { recursive: true, force: true });
479
+ }
480
+
481
+ // Renumber subsequent phases
482
+ const renamedDirs = [];
483
+ const renamedFiles = [];
484
+
485
+ if (isDecimal) {
486
+ // Decimal removal: renumber sibling decimals (e.g., removing 06.2 → 06.3 becomes 06.2)
487
+ const baseParts = normalized.split('.');
488
+ const baseInt = baseParts[0];
489
+ const removedDecimal = parseInt(baseParts[1], 10);
490
+
491
+ try {
492
+ const entries = fs.readdirSync(phasesDir, { withFileTypes: true });
493
+ const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort((a, b) => comparePhaseNum(a, b));
494
+
495
+ // Find sibling decimals with higher numbers
496
+ const decPattern = new RegExp(`^${baseInt}\\.(\\d+)-(.+)$`);
497
+ const toRename = [];
498
+ for (const dir of dirs) {
499
+ const dm = dir.match(decPattern);
500
+ if (dm && parseInt(dm[1], 10) > removedDecimal) {
501
+ toRename.push({ dir, oldDecimal: parseInt(dm[1], 10), slug: dm[2] });
502
+ }
503
+ }
504
+
505
+ // Sort descending to avoid conflicts
506
+ toRename.sort((a, b) => b.oldDecimal - a.oldDecimal);
507
+
508
+ for (const item of toRename) {
509
+ const newDecimal = item.oldDecimal - 1;
510
+ const oldPhaseId = `${baseInt}.${item.oldDecimal}`;
511
+ const newPhaseId = `${baseInt}.${newDecimal}`;
512
+ const newDirName = `${baseInt}.${newDecimal}-${item.slug}`;
513
+
514
+ // Rename directory
515
+ fs.renameSync(path.join(phasesDir, item.dir), path.join(phasesDir, newDirName));
516
+ renamedDirs.push({ from: item.dir, to: newDirName });
517
+
518
+ // Rename files inside
519
+ const dirFiles = fs.readdirSync(path.join(phasesDir, newDirName));
520
+ for (const f of dirFiles) {
521
+ // Files may have phase prefix like "06.2-01-PLAN.md"
522
+ if (f.includes(oldPhaseId)) {
523
+ const newFileName = f.replace(oldPhaseId, newPhaseId);
524
+ fs.renameSync(
525
+ path.join(phasesDir, newDirName, f),
526
+ path.join(phasesDir, newDirName, newFileName)
527
+ );
528
+ renamedFiles.push({ from: f, to: newFileName });
529
+ }
530
+ }
531
+ }
532
+ } catch {}
533
+
534
+ } else {
535
+ // Integer removal: renumber all subsequent integer phases
536
+ const removedInt = parseInt(normalized, 10);
537
+
538
+ try {
539
+ const entries = fs.readdirSync(phasesDir, { withFileTypes: true });
540
+ const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort((a, b) => comparePhaseNum(a, b));
541
+
542
+ // Collect directories that need renumbering (integer phases > removed, and their decimals/letters)
543
+ const toRename = [];
544
+ for (const dir of dirs) {
545
+ const dm = dir.match(/^(\d+)([A-Z])?(?:\.(\d+))?-(.+)$/i);
546
+ if (!dm) continue;
547
+ const dirInt = parseInt(dm[1], 10);
548
+ if (dirInt > removedInt) {
549
+ toRename.push({
550
+ dir,
551
+ oldInt: dirInt,
552
+ letter: dm[2] ? dm[2].toUpperCase() : '',
553
+ decimal: dm[3] ? parseInt(dm[3], 10) : null,
554
+ slug: dm[4],
555
+ });
556
+ }
557
+ }
558
+
559
+ // Sort descending to avoid conflicts
560
+ toRename.sort((a, b) => {
561
+ if (a.oldInt !== b.oldInt) return b.oldInt - a.oldInt;
562
+ return (b.decimal || 0) - (a.decimal || 0);
563
+ });
564
+
565
+ for (const item of toRename) {
566
+ const newInt = item.oldInt - 1;
567
+ const newPadded = String(newInt).padStart(2, '0');
568
+ const oldPadded = String(item.oldInt).padStart(2, '0');
569
+ const letterSuffix = item.letter || '';
570
+ const decimalSuffix = item.decimal !== null ? `.${item.decimal}` : '';
571
+ const oldPrefix = `${oldPadded}${letterSuffix}${decimalSuffix}`;
572
+ const newPrefix = `${newPadded}${letterSuffix}${decimalSuffix}`;
573
+ const newDirName = `${newPrefix}-${item.slug}`;
574
+
575
+ // Rename directory
576
+ fs.renameSync(path.join(phasesDir, item.dir), path.join(phasesDir, newDirName));
577
+ renamedDirs.push({ from: item.dir, to: newDirName });
578
+
579
+ // Rename files inside
580
+ const dirFiles = fs.readdirSync(path.join(phasesDir, newDirName));
581
+ for (const f of dirFiles) {
582
+ if (f.startsWith(oldPrefix)) {
583
+ const newFileName = newPrefix + f.slice(oldPrefix.length);
584
+ fs.renameSync(
585
+ path.join(phasesDir, newDirName, f),
586
+ path.join(phasesDir, newDirName, newFileName)
587
+ );
588
+ renamedFiles.push({ from: f, to: newFileName });
589
+ }
590
+ }
591
+ }
592
+ } catch {}
593
+ }
594
+
595
+ // Update ROADMAP.md
596
+ let roadmapContent = fs.readFileSync(roadmapPath, 'utf-8');
597
+
598
+ // Remove the target phase section
599
+ const targetEscaped = escapeRegex(targetPhase);
600
+ const sectionPattern = new RegExp(
601
+ `\\n?#{2,4}\\s*Phase\\s+${targetEscaped}\\s*:[\\s\\S]*?(?=\\n#{2,4}\\s+Phase\\s+\\d|$)`,
602
+ 'i'
603
+ );
604
+ roadmapContent = roadmapContent.replace(sectionPattern, '');
605
+
606
+ // Remove from phase list (checkbox)
607
+ const checkboxPattern = new RegExp(`\\n?-\\s*\\[[ x]\\]\\s*.*Phase\\s+${targetEscaped}[:\\s][^\\n]*`, 'gi');
608
+ roadmapContent = roadmapContent.replace(checkboxPattern, '');
609
+
610
+ // Remove from progress table
611
+ const tableRowPattern = new RegExp(`\\n?\\|\\s*${targetEscaped}\\.?\\s[^|]*\\|[^\\n]*`, 'gi');
612
+ roadmapContent = roadmapContent.replace(tableRowPattern, '');
613
+
614
+ // Renumber references in ROADMAP for subsequent phases
615
+ if (!isDecimal) {
616
+ const removedInt = parseInt(normalized, 10);
617
+
618
+ // Collect all integer phases > removedInt
619
+ const maxPhase = 99; // reasonable upper bound
620
+ for (let oldNum = maxPhase; oldNum > removedInt; oldNum--) {
621
+ const newNum = oldNum - 1;
622
+ const oldStr = String(oldNum);
623
+ const newStr = String(newNum);
624
+ const oldPad = oldStr.padStart(2, '0');
625
+ const newPad = newStr.padStart(2, '0');
626
+
627
+ // Phase headings: ## Phase 18: or ### Phase 18: → ## Phase 17: or ### Phase 17:
628
+ roadmapContent = roadmapContent.replace(
629
+ new RegExp(`(#{2,4}\\s*Phase\\s+)${oldStr}(\\s*:)`, 'gi'),
630
+ `$1${newStr}$2`
631
+ );
632
+
633
+ // Checkbox items: - [ ] **Phase 18:** → - [ ] **Phase 17:**
634
+ roadmapContent = roadmapContent.replace(
635
+ new RegExp(`(Phase\\s+)${oldStr}([:\\s])`, 'g'),
636
+ `$1${newStr}$2`
637
+ );
638
+
639
+ // Plan references: 18-01 → 17-01
640
+ roadmapContent = roadmapContent.replace(
641
+ new RegExp(`${oldPad}-(\\d{2})`, 'g'),
642
+ `${newPad}-$1`
643
+ );
644
+
645
+ // Table rows: | 18. → | 17.
646
+ roadmapContent = roadmapContent.replace(
647
+ new RegExp(`(\\|\\s*)${oldStr}\\.\\s`, 'g'),
648
+ `$1${newStr}. `
649
+ );
650
+
651
+ // Depends on references
652
+ roadmapContent = roadmapContent.replace(
653
+ new RegExp(`(Depends on:\\*\\*\\s*Phase\\s+)${oldStr}\\b`, 'gi'),
654
+ `$1${newStr}`
655
+ );
656
+ }
657
+ }
658
+
659
+ fs.writeFileSync(roadmapPath, roadmapContent, 'utf-8');
660
+
661
+ // Update STATE.md phase count
662
+ const statePath = path.join(cwd, '.planning', 'STATE.md');
663
+ if (fs.existsSync(statePath)) {
664
+ let stateContent = fs.readFileSync(statePath, 'utf-8');
665
+ // Update "Total Phases" field
666
+ const totalPattern = /(\*\*Total Phases:\*\*\s*)(\d+)/;
667
+ const totalMatch = stateContent.match(totalPattern);
668
+ if (totalMatch) {
669
+ const oldTotal = parseInt(totalMatch[2], 10);
670
+ stateContent = stateContent.replace(totalPattern, `$1${oldTotal - 1}`);
671
+ }
672
+ // Update "Phase: X of Y" pattern
673
+ const ofPattern = /(\bof\s+)(\d+)(\s*(?:\(|phases?))/i;
674
+ const ofMatch = stateContent.match(ofPattern);
675
+ if (ofMatch) {
676
+ const oldTotal = parseInt(ofMatch[2], 10);
677
+ stateContent = stateContent.replace(ofPattern, `$1${oldTotal - 1}$3`);
678
+ }
679
+ writeStateMd(statePath, stateContent, cwd);
680
+ }
681
+
682
+ const result = {
683
+ removed: targetPhase,
684
+ directory_deleted: targetDir || null,
685
+ renamed_directories: renamedDirs,
686
+ renamed_files: renamedFiles,
687
+ roadmap_updated: true,
688
+ state_updated: fs.existsSync(statePath),
689
+ };
690
+
691
+ output(result, raw);
692
+ }
693
+
694
+ function cmdPhaseComplete(cwd, phaseNum, raw) {
695
+ if (!phaseNum) {
696
+ error('phase number required for phase complete');
697
+ }
698
+
699
+ const roadmapPath = path.join(cwd, '.planning', 'ROADMAP.md');
700
+ const statePath = path.join(cwd, '.planning', 'STATE.md');
701
+ const phasesDir = path.join(cwd, '.planning', 'phases');
702
+ const normalized = normalizePhaseName(phaseNum);
703
+ const today = new Date().toISOString().split('T')[0];
704
+
705
+ // Verify phase info
706
+ const phaseInfo = findPhaseInternal(cwd, phaseNum);
707
+ if (!phaseInfo) {
708
+ error(`Phase ${phaseNum} not found`);
709
+ }
710
+
711
+ const planCount = phaseInfo.plans.length;
712
+ const summaryCount = phaseInfo.summaries.length;
713
+
714
+ // Update ROADMAP.md: mark phase complete
715
+ if (fs.existsSync(roadmapPath)) {
716
+ let roadmapContent = fs.readFileSync(roadmapPath, 'utf-8');
717
+
718
+ // Checkbox: - [ ] Phase N: → - [x] Phase N: (...completed DATE)
719
+ const checkboxPattern = new RegExp(
720
+ `(-\\s*\\[)[ ](\\]\\s*.*Phase\\s+${escapeRegex(phaseNum)}[:\\s][^\\n]*)`,
721
+ 'i'
722
+ );
723
+ roadmapContent = roadmapContent.replace(checkboxPattern, `$1x$2 (completed ${today})`);
724
+
725
+ // Progress table: update Status to Complete, add date
726
+ const phaseEscaped = escapeRegex(phaseNum);
727
+ const tablePattern = new RegExp(
728
+ `(\\|\\s*${phaseEscaped}\\.?\\s[^|]*\\|[^|]*\\|)\\s*[^|]*(\\|)\\s*[^|]*(\\|)`,
729
+ 'i'
730
+ );
731
+ roadmapContent = roadmapContent.replace(
732
+ tablePattern,
733
+ `$1 Complete $2 ${today} $3`
734
+ );
735
+
736
+ // Update plan count in phase section
737
+ const planCountPattern = new RegExp(
738
+ `(#{2,4}\\s*Phase\\s+${phaseEscaped}[\\s\\S]*?\\*\\*Plans:\\*\\*\\s*)[^\\n]+`,
739
+ 'i'
740
+ );
741
+ roadmapContent = roadmapContent.replace(
742
+ planCountPattern,
743
+ `$1${summaryCount}/${planCount} plans complete`
744
+ );
745
+
746
+ fs.writeFileSync(roadmapPath, roadmapContent, 'utf-8');
747
+
748
+ // Update REQUIREMENTS.md traceability for this phase's requirements
749
+ const reqPath = path.join(cwd, '.planning', 'REQUIREMENTS.md');
750
+ if (fs.existsSync(reqPath)) {
751
+ // Extract Requirements line from roadmap for this phase
752
+ const reqMatch = roadmapContent.match(
753
+ new RegExp(`Phase\\s+${escapeRegex(phaseNum)}[\\s\\S]*?\\*\\*Requirements:\\*\\*\\s*([^\\n]+)`, 'i')
754
+ );
755
+
756
+ if (reqMatch) {
757
+ const reqIds = reqMatch[1].replace(/[\[\]]/g, '').split(/[,\s]+/).map(r => r.trim()).filter(Boolean);
758
+ let reqContent = fs.readFileSync(reqPath, 'utf-8');
759
+
760
+ for (const reqId of reqIds) {
761
+ const reqEscaped = escapeRegex(reqId);
762
+ // Update checkbox: - [ ] **REQ-ID** → - [x] **REQ-ID**
763
+ reqContent = reqContent.replace(
764
+ new RegExp(`(-\\s*\\[)[ ](\\]\\s*\\*\\*${reqEscaped}\\*\\*)`, 'gi'),
765
+ '$1x$2'
766
+ );
767
+ // Update traceability table: | REQ-ID | Phase N | Pending | → | REQ-ID | Phase N | Complete |
768
+ reqContent = reqContent.replace(
769
+ new RegExp(`(\\|\\s*${reqEscaped}\\s*\\|[^|]+\\|)\\s*Pending\\s*(\\|)`, 'gi'),
770
+ '$1 Complete $2'
771
+ );
772
+ }
773
+
774
+ fs.writeFileSync(reqPath, reqContent, 'utf-8');
775
+ }
776
+ }
777
+ }
778
+
779
+ // Find next phase
780
+ let nextPhaseNum = null;
781
+ let nextPhaseName = null;
782
+ let isLastPhase = true;
783
+
784
+ try {
785
+ const entries = fs.readdirSync(phasesDir, { withFileTypes: true });
786
+ const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort((a, b) => comparePhaseNum(a, b));
787
+
788
+ // Find the next phase directory after current
789
+ for (const dir of dirs) {
790
+ const dm = dir.match(/^(\d+[A-Z]?(?:\.\d+)*)-?(.*)/i);
791
+ if (dm) {
792
+ if (comparePhaseNum(dm[1], phaseNum) > 0) {
793
+ nextPhaseNum = dm[1];
794
+ nextPhaseName = dm[2] || null;
795
+ isLastPhase = false;
796
+ break;
797
+ }
798
+ }
799
+ }
800
+ } catch {}
801
+
802
+ // Update STATE.md
803
+ if (fs.existsSync(statePath)) {
804
+ let stateContent = fs.readFileSync(statePath, 'utf-8');
805
+
806
+ // Update Current Phase
807
+ stateContent = stateContent.replace(
808
+ /(\*\*Current Phase:\*\*\s*).*/,
809
+ `$1${nextPhaseNum || phaseNum}`
810
+ );
811
+
812
+ // Update Current Phase Name
813
+ if (nextPhaseName) {
814
+ stateContent = stateContent.replace(
815
+ /(\*\*Current Phase Name:\*\*\s*).*/,
816
+ `$1${nextPhaseName.replace(/-/g, ' ')}`
817
+ );
818
+ }
819
+
820
+ // Update Status
821
+ stateContent = stateContent.replace(
822
+ /(\*\*Status:\*\*\s*).*/,
823
+ `$1${isLastPhase ? 'Milestone complete' : 'Ready to plan'}`
824
+ );
825
+
826
+ // Update Current Plan
827
+ stateContent = stateContent.replace(
828
+ /(\*\*Current Plan:\*\*\s*).*/,
829
+ `$1Not started`
830
+ );
831
+
832
+ // Update Last Activity
833
+ stateContent = stateContent.replace(
834
+ /(\*\*Last Activity:\*\*\s*).*/,
835
+ `$1${today}`
836
+ );
837
+
838
+ // Update Last Activity Description
839
+ stateContent = stateContent.replace(
840
+ /(\*\*Last Activity Description:\*\*\s*).*/,
841
+ `$1Phase ${phaseNum} complete${nextPhaseNum ? `, transitioned to Phase ${nextPhaseNum}` : ''}`
842
+ );
843
+
844
+ writeStateMd(statePath, stateContent, cwd);
845
+ }
846
+
847
+ const result = {
848
+ completed_phase: phaseNum,
849
+ phase_name: phaseInfo.phase_name,
850
+ plans_executed: `${summaryCount}/${planCount}`,
851
+ next_phase: nextPhaseNum,
852
+ next_phase_name: nextPhaseName,
853
+ is_last_phase: isLastPhase,
854
+ date: today,
855
+ roadmap_updated: fs.existsSync(roadmapPath),
856
+ state_updated: fs.existsSync(statePath),
857
+ };
858
+
859
+ output(result, raw);
860
+ }
861
+
862
+ module.exports = {
863
+ cmdPhasesList,
864
+ cmdPhaseNextDecimal,
865
+ cmdFindPhase,
866
+ cmdPhasePlanIndex,
867
+ cmdPhaseAdd,
868
+ cmdPhaseInsert,
869
+ cmdPhaseRemove,
870
+ cmdPhaseComplete,
871
+ };