@undeemed/get-shit-done-codex 1.20.3 → 1.20.8

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 (68) hide show
  1. package/README.md +13 -3
  2. package/agents/gsd-codebase-mapper.md +3 -0
  3. package/agents/gsd-debugger.md +3 -0
  4. package/agents/gsd-executor.md +52 -2
  5. package/agents/gsd-integration-checker.md +20 -0
  6. package/agents/gsd-phase-researcher.md +96 -4
  7. package/agents/gsd-plan-checker.md +125 -3
  8. package/agents/gsd-planner.md +38 -3
  9. package/agents/gsd-project-researcher.md +3 -0
  10. package/agents/gsd-research-synthesizer.md +3 -0
  11. package/agents/gsd-roadmapper.md +3 -0
  12. package/agents/gsd-verifier.md +25 -8
  13. package/commands/gsd/add-phase.md +6 -2
  14. package/commands/gsd/add-todo.md +6 -1
  15. package/commands/gsd/audit-milestone.md +1 -7
  16. package/commands/gsd/check-todos.md +6 -2
  17. package/commands/gsd/debug.md +3 -1
  18. package/commands/gsd/discuss-phase.md +1 -5
  19. package/commands/gsd/execute-phase.md +1 -2
  20. package/commands/gsd/insert-phase.md +1 -2
  21. package/commands/gsd/list-phase-assumptions.md +1 -5
  22. package/commands/gsd/new-milestone.md +1 -8
  23. package/commands/gsd/pause-work.md +4 -1
  24. package/commands/gsd/plan-milestone-gaps.md +1 -7
  25. package/commands/gsd/quick.md +2 -1
  26. package/commands/gsd/remove-phase.md +1 -2
  27. package/commands/gsd/research-phase.md +17 -15
  28. package/commands/gsd/verify-work.md +1 -2
  29. package/get-shit-done/bin/gsd-tools.cjs +168 -4858
  30. package/get-shit-done/bin/lib/commands.cjs +556 -0
  31. package/get-shit-done/bin/lib/config.cjs +162 -0
  32. package/get-shit-done/bin/lib/core.cjs +398 -0
  33. package/get-shit-done/bin/lib/frontmatter.cjs +299 -0
  34. package/get-shit-done/bin/lib/init.cjs +694 -0
  35. package/get-shit-done/bin/lib/milestone.cjs +215 -0
  36. package/get-shit-done/bin/lib/phase.cjs +873 -0
  37. package/get-shit-done/bin/lib/roadmap.cjs +298 -0
  38. package/get-shit-done/bin/lib/state.cjs +490 -0
  39. package/get-shit-done/bin/lib/template.cjs +222 -0
  40. package/get-shit-done/bin/lib/verify.cjs +772 -0
  41. package/get-shit-done/references/checkpoints.md +1 -0
  42. package/get-shit-done/templates/VALIDATION.md +104 -0
  43. package/get-shit-done/templates/config.json +2 -1
  44. package/get-shit-done/templates/phase-prompt.md +2 -0
  45. package/get-shit-done/templates/roadmap.md +1 -1
  46. package/get-shit-done/templates/summary.md +2 -0
  47. package/get-shit-done/workflows/audit-milestone.md +63 -8
  48. package/get-shit-done/workflows/complete-milestone.md +26 -0
  49. package/get-shit-done/workflows/diagnose-issues.md +1 -1
  50. package/get-shit-done/workflows/discuss-phase.md +68 -13
  51. package/get-shit-done/workflows/execute-phase.md +54 -9
  52. package/get-shit-done/workflows/execute-plan.md +17 -13
  53. package/get-shit-done/workflows/map-codebase.md +32 -44
  54. package/get-shit-done/workflows/new-milestone.md +16 -7
  55. package/get-shit-done/workflows/new-project.md +34 -31
  56. package/get-shit-done/workflows/plan-milestone-gaps.md +23 -5
  57. package/get-shit-done/workflows/plan-phase.md +106 -76
  58. package/get-shit-done/workflows/progress.md +14 -26
  59. package/get-shit-done/workflows/quick.md +24 -15
  60. package/get-shit-done/workflows/research-phase.md +10 -11
  61. package/get-shit-done/workflows/settings.md +16 -3
  62. package/get-shit-done/workflows/transition.md +5 -0
  63. package/get-shit-done/workflows/verify-work.md +11 -12
  64. package/hooks/dist/gsd-context-monitor.js +122 -0
  65. package/hooks/dist/gsd-statusline.js +17 -0
  66. package/package.json +18 -2
  67. package/scripts/build-hooks.js +1 -0
  68. package/get-shit-done/bin/gsd-tools.test.cjs +0 -2273
@@ -0,0 +1,215 @@
1
+ /**
2
+ * Milestone — Milestone and requirements lifecycle operations
3
+ */
4
+
5
+ const fs = require('fs');
6
+ const path = require('path');
7
+ const { output, error } = require('./core.cjs');
8
+ const { extractFrontmatter } = require('./frontmatter.cjs');
9
+
10
+ function cmdRequirementsMarkComplete(cwd, reqIdsRaw, raw) {
11
+ if (!reqIdsRaw || reqIdsRaw.length === 0) {
12
+ error('requirement IDs required. Usage: requirements mark-complete REQ-01,REQ-02 or REQ-01 REQ-02');
13
+ }
14
+
15
+ // Accept comma-separated, space-separated, or bracket-wrapped: [REQ-01, REQ-02]
16
+ const reqIds = reqIdsRaw
17
+ .join(' ')
18
+ .replace(/[\[\]]/g, '')
19
+ .split(/[,\s]+/)
20
+ .map(r => r.trim())
21
+ .filter(Boolean);
22
+
23
+ if (reqIds.length === 0) {
24
+ error('no valid requirement IDs found');
25
+ }
26
+
27
+ const reqPath = path.join(cwd, '.planning', 'REQUIREMENTS.md');
28
+ if (!fs.existsSync(reqPath)) {
29
+ output({ updated: false, reason: 'REQUIREMENTS.md not found', ids: reqIds }, raw, 'no requirements file');
30
+ return;
31
+ }
32
+
33
+ let reqContent = fs.readFileSync(reqPath, 'utf-8');
34
+ const updated = [];
35
+ const notFound = [];
36
+
37
+ for (const reqId of reqIds) {
38
+ let found = false;
39
+
40
+ // Update checkbox: - [ ] **REQ-ID** → - [x] **REQ-ID**
41
+ const checkboxPattern = new RegExp(`(-\\s*\\[)[ ](\\]\\s*\\*\\*${reqId}\\*\\*)`, 'gi');
42
+ if (checkboxPattern.test(reqContent)) {
43
+ reqContent = reqContent.replace(checkboxPattern, '$1x$2');
44
+ found = true;
45
+ }
46
+
47
+ // Update traceability table: | REQ-ID | Phase N | Pending | → | REQ-ID | Phase N | Complete |
48
+ const tablePattern = new RegExp(`(\\|\\s*${reqId}\\s*\\|[^|]+\\|)\\s*Pending\\s*(\\|)`, 'gi');
49
+ if (tablePattern.test(reqContent)) {
50
+ // Re-read since test() advances lastIndex for global regex
51
+ reqContent = reqContent.replace(
52
+ new RegExp(`(\\|\\s*${reqId}\\s*\\|[^|]+\\|)\\s*Pending\\s*(\\|)`, 'gi'),
53
+ '$1 Complete $2'
54
+ );
55
+ found = true;
56
+ }
57
+
58
+ if (found) {
59
+ updated.push(reqId);
60
+ } else {
61
+ notFound.push(reqId);
62
+ }
63
+ }
64
+
65
+ if (updated.length > 0) {
66
+ fs.writeFileSync(reqPath, reqContent, 'utf-8');
67
+ }
68
+
69
+ output({
70
+ updated: updated.length > 0,
71
+ marked_complete: updated,
72
+ not_found: notFound,
73
+ total: reqIds.length,
74
+ }, raw, `${updated.length}/${reqIds.length} requirements marked complete`);
75
+ }
76
+
77
+ function cmdMilestoneComplete(cwd, version, options, raw) {
78
+ if (!version) {
79
+ error('version required for milestone complete (e.g., v1.0)');
80
+ }
81
+
82
+ const roadmapPath = path.join(cwd, '.planning', 'ROADMAP.md');
83
+ const reqPath = path.join(cwd, '.planning', 'REQUIREMENTS.md');
84
+ const statePath = path.join(cwd, '.planning', 'STATE.md');
85
+ const milestonesPath = path.join(cwd, '.planning', 'MILESTONES.md');
86
+ const archiveDir = path.join(cwd, '.planning', 'milestones');
87
+ const phasesDir = path.join(cwd, '.planning', 'phases');
88
+ const today = new Date().toISOString().split('T')[0];
89
+ const milestoneName = options.name || version;
90
+
91
+ // Ensure archive directory exists
92
+ fs.mkdirSync(archiveDir, { recursive: true });
93
+
94
+ // Gather stats from phases
95
+ let phaseCount = 0;
96
+ let totalPlans = 0;
97
+ let totalTasks = 0;
98
+ const accomplishments = [];
99
+
100
+ try {
101
+ const entries = fs.readdirSync(phasesDir, { withFileTypes: true });
102
+ const dirs = entries.filter(e => e.isDirectory()).map(e => e.name).sort();
103
+
104
+ for (const dir of dirs) {
105
+ phaseCount++;
106
+ const phaseFiles = fs.readdirSync(path.join(phasesDir, dir));
107
+ const plans = phaseFiles.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md');
108
+ const summaries = phaseFiles.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');
109
+ totalPlans += plans.length;
110
+
111
+ // Extract one-liners from summaries
112
+ for (const s of summaries) {
113
+ try {
114
+ const content = fs.readFileSync(path.join(phasesDir, dir, s), 'utf-8');
115
+ const fm = extractFrontmatter(content);
116
+ if (fm['one-liner']) {
117
+ accomplishments.push(fm['one-liner']);
118
+ }
119
+ // Count tasks
120
+ const taskMatches = content.match(/##\s*Task\s*\d+/gi) || [];
121
+ totalTasks += taskMatches.length;
122
+ } catch {}
123
+ }
124
+ }
125
+ } catch {}
126
+
127
+ // Archive ROADMAP.md
128
+ if (fs.existsSync(roadmapPath)) {
129
+ const roadmapContent = fs.readFileSync(roadmapPath, 'utf-8');
130
+ fs.writeFileSync(path.join(archiveDir, `${version}-ROADMAP.md`), roadmapContent, 'utf-8');
131
+ }
132
+
133
+ // Archive REQUIREMENTS.md
134
+ if (fs.existsSync(reqPath)) {
135
+ const reqContent = fs.readFileSync(reqPath, 'utf-8');
136
+ const archiveHeader = `# Requirements Archive: ${version} ${milestoneName}\n\n**Archived:** ${today}\n**Status:** SHIPPED\n\nFor current requirements, see \`.planning/REQUIREMENTS.md\`.\n\n---\n\n`;
137
+ fs.writeFileSync(path.join(archiveDir, `${version}-REQUIREMENTS.md`), archiveHeader + reqContent, 'utf-8');
138
+ }
139
+
140
+ // Archive audit file if exists
141
+ const auditFile = path.join(cwd, '.planning', `${version}-MILESTONE-AUDIT.md`);
142
+ if (fs.existsSync(auditFile)) {
143
+ fs.renameSync(auditFile, path.join(archiveDir, `${version}-MILESTONE-AUDIT.md`));
144
+ }
145
+
146
+ // Create/append MILESTONES.md entry
147
+ const accomplishmentsList = accomplishments.map(a => `- ${a}`).join('\n');
148
+ const milestoneEntry = `## ${version} ${milestoneName} (Shipped: ${today})\n\n**Phases completed:** ${phaseCount} phases, ${totalPlans} plans, ${totalTasks} tasks\n\n**Key accomplishments:**\n${accomplishmentsList || '- (none recorded)'}\n\n---\n\n`;
149
+
150
+ if (fs.existsSync(milestonesPath)) {
151
+ const existing = fs.readFileSync(milestonesPath, 'utf-8');
152
+ fs.writeFileSync(milestonesPath, existing + '\n' + milestoneEntry, 'utf-8');
153
+ } else {
154
+ fs.writeFileSync(milestonesPath, `# Milestones\n\n${milestoneEntry}`, 'utf-8');
155
+ }
156
+
157
+ // Update STATE.md
158
+ if (fs.existsSync(statePath)) {
159
+ let stateContent = fs.readFileSync(statePath, 'utf-8');
160
+ stateContent = stateContent.replace(
161
+ /(\*\*Status:\*\*\s*).*/,
162
+ `$1${version} milestone complete`
163
+ );
164
+ stateContent = stateContent.replace(
165
+ /(\*\*Last Activity:\*\*\s*).*/,
166
+ `$1${today}`
167
+ );
168
+ stateContent = stateContent.replace(
169
+ /(\*\*Last Activity Description:\*\*\s*).*/,
170
+ `$1${version} milestone completed and archived`
171
+ );
172
+ fs.writeFileSync(statePath, stateContent, 'utf-8');
173
+ }
174
+
175
+ // Archive phase directories if requested
176
+ let phasesArchived = false;
177
+ if (options.archivePhases) {
178
+ try {
179
+ const phaseArchiveDir = path.join(archiveDir, `${version}-phases`);
180
+ fs.mkdirSync(phaseArchiveDir, { recursive: true });
181
+
182
+ const phaseEntries = fs.readdirSync(phasesDir, { withFileTypes: true });
183
+ const phaseDirNames = phaseEntries.filter(e => e.isDirectory()).map(e => e.name);
184
+ for (const dir of phaseDirNames) {
185
+ fs.renameSync(path.join(phasesDir, dir), path.join(phaseArchiveDir, dir));
186
+ }
187
+ phasesArchived = phaseDirNames.length > 0;
188
+ } catch {}
189
+ }
190
+
191
+ const result = {
192
+ version,
193
+ name: milestoneName,
194
+ date: today,
195
+ phases: phaseCount,
196
+ plans: totalPlans,
197
+ tasks: totalTasks,
198
+ accomplishments,
199
+ archived: {
200
+ roadmap: fs.existsSync(path.join(archiveDir, `${version}-ROADMAP.md`)),
201
+ requirements: fs.existsSync(path.join(archiveDir, `${version}-REQUIREMENTS.md`)),
202
+ audit: fs.existsSync(path.join(archiveDir, `${version}-MILESTONE-AUDIT.md`)),
203
+ phases: phasesArchived,
204
+ },
205
+ milestones_updated: true,
206
+ state_updated: fs.existsSync(statePath),
207
+ };
208
+
209
+ output(result, raw);
210
+ }
211
+
212
+ module.exports = {
213
+ cmdRequirementsMarkComplete,
214
+ cmdMilestoneComplete,
215
+ };