ragarciaruben 1.20.7

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 (184) hide show
  1. package/.github/copilot-context/README.md +313 -0
  2. package/.github/copilot-context/agents/executor.agent.md +59 -0
  3. package/.github/copilot-context/agents/planner.agent.md +58 -0
  4. package/.github/copilot-context/agents/verifier.agent.md +68 -0
  5. package/.github/copilot-context/hooks/hooks.json +11 -0
  6. package/.github/copilot-context/hooks/inject-context.js +107 -0
  7. package/.github/copilot-context/instructions/architecture.instructions.md +33 -0
  8. package/.github/copilot-context/instructions/concerns.instructions.md +30 -0
  9. package/.github/copilot-context/instructions/conventions.instructions.md +25 -0
  10. package/.github/copilot-context/instructions/integrations.instructions.md +30 -0
  11. package/.github/copilot-context/instructions/stack.instructions.md +30 -0
  12. package/.github/copilot-context/instructions/structure.instructions.md +32 -0
  13. package/.github/copilot-context/instructions/testing.instructions.md +25 -0
  14. package/.github/copilot-context/prompts/execute-phase.prompt.md +148 -0
  15. package/.github/copilot-context/prompts/map-codebase.prompt.md +115 -0
  16. package/.github/copilot-context/prompts/new-project.prompt.md +85 -0
  17. package/.github/copilot-context/prompts/pause-work.prompt.md +104 -0
  18. package/.github/copilot-context/prompts/plan-phase.prompt.md +137 -0
  19. package/.github/copilot-context/prompts/progress.prompt.md +69 -0
  20. package/.github/copilot-context/prompts/resume-work.prompt.md +74 -0
  21. package/.github/copilot-context/prompts/sync-instructions.prompt.md +86 -0
  22. package/.github/copilot-context/prompts/verify-work.prompt.md +126 -0
  23. package/.github/copilot-context/skills/map-codebase/SKILL.md +49 -0
  24. package/.github/copilot-context/skills/project-history/SKILL.md +46 -0
  25. package/.github/copilot-instructions.md +68 -0
  26. package/.planning/PROJECT.md +61 -0
  27. package/.planning/REQUIREMENTS.md +70 -0
  28. package/.planning/ROADMAP.md +75 -0
  29. package/.planning/STATE.md +75 -0
  30. package/.planning/codebase/ARCHITECTURE.md +76 -0
  31. package/.planning/codebase/CONCERNS.md +102 -0
  32. package/.planning/codebase/CONVENTIONS.md +119 -0
  33. package/.planning/codebase/INTEGRATIONS.md +114 -0
  34. package/.planning/codebase/STACK.md +78 -0
  35. package/.planning/codebase/STRUCTURE.md +75 -0
  36. package/.planning/codebase/TESTING.md +157 -0
  37. package/.planning/continue-here.md +44 -0
  38. package/.vscode/settings.json +16 -0
  39. package/LICENSE +21 -0
  40. package/README.md +704 -0
  41. package/agents/gsd-codebase-mapper.md +764 -0
  42. package/agents/gsd-debugger.md +1246 -0
  43. package/agents/gsd-executor.md +469 -0
  44. package/agents/gsd-integration-checker.md +443 -0
  45. package/agents/gsd-phase-researcher.md +546 -0
  46. package/agents/gsd-plan-checker.md +690 -0
  47. package/agents/gsd-planner.md +1275 -0
  48. package/agents/gsd-project-researcher.md +621 -0
  49. package/agents/gsd-research-synthesizer.md +239 -0
  50. package/agents/gsd-roadmapper.md +642 -0
  51. package/agents/gsd-verifier.md +573 -0
  52. package/bin/install.js +2091 -0
  53. package/bin/setup-copilot-context.js +180 -0
  54. package/commands/gsd/add-phase.md +43 -0
  55. package/commands/gsd/add-tests.md +41 -0
  56. package/commands/gsd/add-todo.md +47 -0
  57. package/commands/gsd/audit-milestone.md +36 -0
  58. package/commands/gsd/check-todos.md +45 -0
  59. package/commands/gsd/cleanup.md +18 -0
  60. package/commands/gsd/complete-milestone.md +136 -0
  61. package/commands/gsd/debug.md +167 -0
  62. package/commands/gsd/discuss-phase.md +83 -0
  63. package/commands/gsd/execute-phase.md +41 -0
  64. package/commands/gsd/health.md +22 -0
  65. package/commands/gsd/help.md +22 -0
  66. package/commands/gsd/insert-phase.md +32 -0
  67. package/commands/gsd/join-discord.md +18 -0
  68. package/commands/gsd/list-phase-assumptions.md +46 -0
  69. package/commands/gsd/map-codebase.md +71 -0
  70. package/commands/gsd/new-milestone.md +44 -0
  71. package/commands/gsd/new-project.md +42 -0
  72. package/commands/gsd/new-project.md.bak +1041 -0
  73. package/commands/gsd/pause-work.md +38 -0
  74. package/commands/gsd/plan-milestone-gaps.md +34 -0
  75. package/commands/gsd/plan-phase.md +45 -0
  76. package/commands/gsd/progress.md +24 -0
  77. package/commands/gsd/quick.md +41 -0
  78. package/commands/gsd/reapply-patches.md +110 -0
  79. package/commands/gsd/remove-phase.md +31 -0
  80. package/commands/gsd/research-phase.md +189 -0
  81. package/commands/gsd/resume-work.md +40 -0
  82. package/commands/gsd/set-profile.md +34 -0
  83. package/commands/gsd/settings.md +36 -0
  84. package/commands/gsd/update.md +37 -0
  85. package/commands/gsd/verify-work.md +38 -0
  86. package/get-shit-done/bin/gsd-tools.cjs +585 -0
  87. package/get-shit-done/bin/lib/commands.cjs +553 -0
  88. package/get-shit-done/bin/lib/config.cjs +162 -0
  89. package/get-shit-done/bin/lib/core.cjs +411 -0
  90. package/get-shit-done/bin/lib/frontmatter.cjs +299 -0
  91. package/get-shit-done/bin/lib/init.cjs +710 -0
  92. package/get-shit-done/bin/lib/milestone.cjs +215 -0
  93. package/get-shit-done/bin/lib/phase.cjs +870 -0
  94. package/get-shit-done/bin/lib/roadmap.cjs +298 -0
  95. package/get-shit-done/bin/lib/state.cjs +521 -0
  96. package/get-shit-done/bin/lib/template.cjs +222 -0
  97. package/get-shit-done/bin/lib/verify.cjs +772 -0
  98. package/get-shit-done/references/checkpoints.md +776 -0
  99. package/get-shit-done/references/continuation-format.md +249 -0
  100. package/get-shit-done/references/decimal-phase-calculation.md +65 -0
  101. package/get-shit-done/references/git-integration.md +248 -0
  102. package/get-shit-done/references/git-planning-commit.md +38 -0
  103. package/get-shit-done/references/model-profile-resolution.md +34 -0
  104. package/get-shit-done/references/model-profiles.md +92 -0
  105. package/get-shit-done/references/phase-argument-parsing.md +61 -0
  106. package/get-shit-done/references/planning-config.md +196 -0
  107. package/get-shit-done/references/questioning.md +145 -0
  108. package/get-shit-done/references/tdd.md +263 -0
  109. package/get-shit-done/references/ui-brand.md +160 -0
  110. package/get-shit-done/references/verification-patterns.md +612 -0
  111. package/get-shit-done/templates/DEBUG.md +164 -0
  112. package/get-shit-done/templates/UAT.md +247 -0
  113. package/get-shit-done/templates/VALIDATION.md +76 -0
  114. package/get-shit-done/templates/codebase/architecture.md +255 -0
  115. package/get-shit-done/templates/codebase/concerns.md +310 -0
  116. package/get-shit-done/templates/codebase/conventions.md +307 -0
  117. package/get-shit-done/templates/codebase/integrations.md +280 -0
  118. package/get-shit-done/templates/codebase/stack.md +186 -0
  119. package/get-shit-done/templates/codebase/structure.md +285 -0
  120. package/get-shit-done/templates/codebase/testing.md +480 -0
  121. package/get-shit-done/templates/config.json +37 -0
  122. package/get-shit-done/templates/context.md +283 -0
  123. package/get-shit-done/templates/continue-here.md +78 -0
  124. package/get-shit-done/templates/debug-subagent-prompt.md +91 -0
  125. package/get-shit-done/templates/discovery.md +146 -0
  126. package/get-shit-done/templates/milestone-archive.md +123 -0
  127. package/get-shit-done/templates/milestone.md +115 -0
  128. package/get-shit-done/templates/phase-prompt.md +569 -0
  129. package/get-shit-done/templates/planner-subagent-prompt.md +117 -0
  130. package/get-shit-done/templates/project.md +184 -0
  131. package/get-shit-done/templates/requirements.md +231 -0
  132. package/get-shit-done/templates/research-project/ARCHITECTURE.md +204 -0
  133. package/get-shit-done/templates/research-project/FEATURES.md +147 -0
  134. package/get-shit-done/templates/research-project/PITFALLS.md +200 -0
  135. package/get-shit-done/templates/research-project/STACK.md +120 -0
  136. package/get-shit-done/templates/research-project/SUMMARY.md +170 -0
  137. package/get-shit-done/templates/research.md +552 -0
  138. package/get-shit-done/templates/retrospective.md +54 -0
  139. package/get-shit-done/templates/roadmap.md +202 -0
  140. package/get-shit-done/templates/state.md +176 -0
  141. package/get-shit-done/templates/summary-complex.md +59 -0
  142. package/get-shit-done/templates/summary-minimal.md +41 -0
  143. package/get-shit-done/templates/summary-standard.md +48 -0
  144. package/get-shit-done/templates/summary.md +248 -0
  145. package/get-shit-done/templates/user-setup.md +311 -0
  146. package/get-shit-done/templates/verification-report.md +322 -0
  147. package/get-shit-done/workflows/add-phase.md +111 -0
  148. package/get-shit-done/workflows/add-tests.md +350 -0
  149. package/get-shit-done/workflows/add-todo.md +157 -0
  150. package/get-shit-done/workflows/audit-milestone.md +297 -0
  151. package/get-shit-done/workflows/check-todos.md +176 -0
  152. package/get-shit-done/workflows/cleanup.md +152 -0
  153. package/get-shit-done/workflows/complete-milestone.md +763 -0
  154. package/get-shit-done/workflows/diagnose-issues.md +219 -0
  155. package/get-shit-done/workflows/discovery-phase.md +289 -0
  156. package/get-shit-done/workflows/discuss-phase.md +542 -0
  157. package/get-shit-done/workflows/execute-phase.md +449 -0
  158. package/get-shit-done/workflows/execute-plan.md +448 -0
  159. package/get-shit-done/workflows/health.md +156 -0
  160. package/get-shit-done/workflows/help.md +489 -0
  161. package/get-shit-done/workflows/insert-phase.md +129 -0
  162. package/get-shit-done/workflows/list-phase-assumptions.md +178 -0
  163. package/get-shit-done/workflows/map-codebase.md +315 -0
  164. package/get-shit-done/workflows/new-milestone.md +382 -0
  165. package/get-shit-done/workflows/new-project.md +1116 -0
  166. package/get-shit-done/workflows/pause-work.md +122 -0
  167. package/get-shit-done/workflows/plan-milestone-gaps.md +274 -0
  168. package/get-shit-done/workflows/plan-phase.md +569 -0
  169. package/get-shit-done/workflows/progress.md +381 -0
  170. package/get-shit-done/workflows/quick.md +453 -0
  171. package/get-shit-done/workflows/remove-phase.md +154 -0
  172. package/get-shit-done/workflows/research-phase.md +73 -0
  173. package/get-shit-done/workflows/resume-project.md +306 -0
  174. package/get-shit-done/workflows/set-profile.md +80 -0
  175. package/get-shit-done/workflows/settings.md +213 -0
  176. package/get-shit-done/workflows/transition.md +544 -0
  177. package/get-shit-done/workflows/update.md +219 -0
  178. package/get-shit-done/workflows/verify-phase.md +242 -0
  179. package/get-shit-done/workflows/verify-work.md +569 -0
  180. package/hooks/dist/gsd-check-update.js +62 -0
  181. package/hooks/dist/gsd-context-monitor.js +122 -0
  182. package/hooks/dist/gsd-statusline.js +108 -0
  183. package/package.json +54 -0
  184. package/scripts/build-hooks.js +43 -0
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: gsd:verify-work
3
+ description: Validate built features through conversational UAT
4
+ argument-hint: "[phase number, e.g., '4']"
5
+ allowed-tools:
6
+ - Read
7
+ - Bash
8
+ - Glob
9
+ - Grep
10
+ - Edit
11
+ - Write
12
+ - Task
13
+ ---
14
+ <objective>
15
+ Validate built features through conversational testing with persistent state.
16
+
17
+ Purpose: Confirm what Claude built actually works from user's perspective. One test at a time, plain text responses, no interrogation. When issues are found, automatically diagnose, plan fixes, and prepare for execution.
18
+
19
+ Output: {phase_num}-UAT.md tracking all test results. If issues found: diagnosed gaps, verified fix plans ready for /gsd:execute-phase
20
+ </objective>
21
+
22
+ <execution_context>
23
+ @~/.claude/get-shit-done/workflows/verify-work.md
24
+ @~/.claude/get-shit-done/templates/UAT.md
25
+ </execution_context>
26
+
27
+ <context>
28
+ Phase: $ARGUMENTS (optional)
29
+ - If provided: Test specific phase (e.g., "4")
30
+ - If not provided: Check for active sessions or prompt for phase
31
+
32
+ Context files are resolved inside the workflow (`init verify-work`) and delegated via `<files_to_read>` blocks.
33
+ </context>
34
+
35
+ <process>
36
+ Execute the verify-work workflow from @~/.claude/get-shit-done/workflows/verify-work.md end-to-end.
37
+ Preserve all workflow gates (session management, test presentation, diagnosis, fix planning, routing).
38
+ </process>
@@ -0,0 +1,585 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * GSD Tools — CLI utility for GSD workflow operations
5
+ *
6
+ * Replaces repetitive inline bash patterns across ~50 GSD command/workflow/agent files.
7
+ * Centralizes: config parsing, model resolution, phase lookup, git commits, summary verification.
8
+ *
9
+ * Usage: node gsd-tools.cjs <command> [args] [--raw]
10
+ *
11
+ * Atomic Commands:
12
+ * state load Load project config + state
13
+ * state update <field> <value> Update a STATE.md field
14
+ * state get [section] Get STATE.md content or section
15
+ * state patch --field val ... Batch update STATE.md fields
16
+ * resolve-model <agent-type> Get model for agent based on profile
17
+ * find-phase <phase> Find phase directory by number
18
+ * commit <message> [--files f1 f2] Commit planning docs
19
+ * verify-summary <path> Verify a SUMMARY.md file
20
+ * generate-slug <text> Convert text to URL-safe slug
21
+ * current-timestamp [format] Get timestamp (full|date|filename)
22
+ * list-todos [area] Count and enumerate pending todos
23
+ * verify-path-exists <path> Check file/directory existence
24
+ * config-ensure-section Initialize .planning/config.json
25
+ * history-digest Aggregate all SUMMARY.md data
26
+ * summary-extract <path> [--fields] Extract structured data from SUMMARY.md
27
+ * state-snapshot Structured parse of STATE.md
28
+ * phase-plan-index <phase> Index plans with waves and status
29
+ * websearch <query> Search web via Brave API (if configured)
30
+ * [--limit N] [--freshness day|week|month]
31
+ *
32
+ * Phase Operations:
33
+ * phase next-decimal <phase> Calculate next decimal phase number
34
+ * phase add <description> Append new phase to roadmap + create dir
35
+ * phase insert <after> <description> Insert decimal phase after existing
36
+ * phase remove <phase> [--force] Remove phase, renumber all subsequent
37
+ * phase complete <phase> Mark phase done, update state + roadmap
38
+ *
39
+ * Roadmap Operations:
40
+ * roadmap get-phase <phase> Extract phase section from ROADMAP.md
41
+ * roadmap analyze Full roadmap parse with disk status
42
+ * roadmap update-plan-progress <N> Update progress table row from disk (PLAN vs SUMMARY counts)
43
+ *
44
+ * Requirements Operations:
45
+ * requirements mark-complete <ids> Mark requirement IDs as complete in REQUIREMENTS.md
46
+ * Accepts: REQ-01,REQ-02 or REQ-01 REQ-02 or [REQ-01, REQ-02]
47
+ *
48
+ * Milestone Operations:
49
+ * milestone complete <version> Archive milestone, create MILESTONES.md
50
+ * [--name <name>]
51
+ * [--archive-phases] Move phase dirs to milestones/vX.Y-phases/
52
+ *
53
+ * Validation:
54
+ * validate consistency Check phase numbering, disk/roadmap sync
55
+ * validate health [--repair] Check .planning/ integrity, optionally repair
56
+ *
57
+ * Progress:
58
+ * progress [json|table|bar] Render progress in various formats
59
+ *
60
+ * Todos:
61
+ * todo complete <filename> Move todo from pending to completed
62
+ *
63
+ * Scaffolding:
64
+ * scaffold context --phase <N> Create CONTEXT.md template
65
+ * scaffold uat --phase <N> Create UAT.md template
66
+ * scaffold verification --phase <N> Create VERIFICATION.md template
67
+ * scaffold phase-dir --phase <N> Create phase directory
68
+ * --name <name>
69
+ *
70
+ * Frontmatter CRUD:
71
+ * frontmatter get <file> [--field k] Extract frontmatter as JSON
72
+ * frontmatter set <file> --field k Update single frontmatter field
73
+ * --value jsonVal
74
+ * frontmatter merge <file> Merge JSON into frontmatter
75
+ * --data '{json}'
76
+ * frontmatter validate <file> Validate required fields
77
+ * --schema plan|summary|verification
78
+ *
79
+ * Verification Suite:
80
+ * verify plan-structure <file> Check PLAN.md structure + tasks
81
+ * verify phase-completeness <phase> Check all plans have summaries
82
+ * verify references <file> Check @-refs + paths resolve
83
+ * verify commits <h1> [h2] ... Batch verify commit hashes
84
+ * verify artifacts <plan-file> Check must_haves.artifacts
85
+ * verify key-links <plan-file> Check must_haves.key_links
86
+ *
87
+ * Template Fill:
88
+ * template fill summary --phase N Create pre-filled SUMMARY.md
89
+ * [--plan M] [--name "..."]
90
+ * [--fields '{json}']
91
+ * template fill plan --phase N Create pre-filled PLAN.md
92
+ * [--plan M] [--type execute|tdd]
93
+ * [--wave N] [--fields '{json}']
94
+ * template fill verification Create pre-filled VERIFICATION.md
95
+ * --phase N [--fields '{json}']
96
+ *
97
+ * State Progression:
98
+ * state advance-plan Increment plan counter
99
+ * state record-metric --phase N Record execution metrics
100
+ * --plan M --duration Xmin
101
+ * [--tasks N] [--files N]
102
+ * state update-progress Recalculate progress bar
103
+ * state add-decision --summary "..." Add decision to STATE.md
104
+ * [--phase N] [--rationale "..."]
105
+ * [--summary-file path] [--rationale-file path]
106
+ * state add-blocker --text "..." Add blocker
107
+ * [--text-file path]
108
+ * state resolve-blocker --text "..." Remove blocker
109
+ * state record-session Update session continuity
110
+ * --stopped-at "..."
111
+ * [--resume-file path]
112
+ *
113
+ * Compound Commands (workflow-specific initialization):
114
+ * init execute-phase <phase> All context for execute-phase workflow
115
+ * init plan-phase <phase> All context for plan-phase workflow
116
+ * init new-project All context for new-project workflow
117
+ * init new-milestone All context for new-milestone workflow
118
+ * init quick <description> All context for quick workflow
119
+ * init resume All context for resume-project workflow
120
+ * init verify-work <phase> All context for verify-work workflow
121
+ * init phase-op <phase> Generic phase operation context
122
+ * init todos [area] All context for todo workflows
123
+ * init milestone-op All context for milestone operations
124
+ * init map-codebase All context for map-codebase workflow
125
+ * init progress All context for progress workflow
126
+ */
127
+
128
+ const fs = require('fs');
129
+ const path = require('path');
130
+ const { error } = require('./lib/core.cjs');
131
+ const state = require('./lib/state.cjs');
132
+ const phase = require('./lib/phase.cjs');
133
+ const roadmap = require('./lib/roadmap.cjs');
134
+ const verify = require('./lib/verify.cjs');
135
+ const config = require('./lib/config.cjs');
136
+ const template = require('./lib/template.cjs');
137
+ const milestone = require('./lib/milestone.cjs');
138
+ const commands = require('./lib/commands.cjs');
139
+ const init = require('./lib/init.cjs');
140
+ const frontmatter = require('./lib/frontmatter.cjs');
141
+
142
+ // ─── CLI Router ───────────────────────────────────────────────────────────────
143
+
144
+ async function main() {
145
+ const args = process.argv.slice(2);
146
+
147
+ // Optional cwd override for sandboxed subagents running outside project root.
148
+ let cwd = process.cwd();
149
+ const cwdEqArg = args.find(arg => arg.startsWith('--cwd='));
150
+ const cwdIdx = args.indexOf('--cwd');
151
+ if (cwdEqArg) {
152
+ const value = cwdEqArg.slice('--cwd='.length).trim();
153
+ if (!value) error('Missing value for --cwd');
154
+ args.splice(args.indexOf(cwdEqArg), 1);
155
+ cwd = path.resolve(value);
156
+ } else if (cwdIdx !== -1) {
157
+ const value = args[cwdIdx + 1];
158
+ if (!value || value.startsWith('--')) error('Missing value for --cwd');
159
+ args.splice(cwdIdx, 2);
160
+ cwd = path.resolve(value);
161
+ }
162
+
163
+ if (!fs.existsSync(cwd) || !fs.statSync(cwd).isDirectory()) {
164
+ error(`Invalid --cwd: ${cwd}`);
165
+ }
166
+
167
+ const rawIndex = args.indexOf('--raw');
168
+ const raw = rawIndex !== -1;
169
+ if (rawIndex !== -1) args.splice(rawIndex, 1);
170
+
171
+ const command = args[0];
172
+
173
+ if (!command) {
174
+ error('Usage: gsd-tools <command> [args] [--raw] [--cwd <path>]\nCommands: state, resolve-model, find-phase, commit, verify-summary, verify, frontmatter, template, generate-slug, current-timestamp, list-todos, verify-path-exists, config-ensure-section, init');
175
+ }
176
+
177
+ switch (command) {
178
+ case 'state': {
179
+ const subcommand = args[1];
180
+ if (subcommand === 'update') {
181
+ state.cmdStateUpdate(cwd, args[2], args[3]);
182
+ } else if (subcommand === 'get') {
183
+ state.cmdStateGet(cwd, args[2], raw);
184
+ } else if (subcommand === 'patch') {
185
+ const patches = {};
186
+ for (let i = 2; i < args.length; i += 2) {
187
+ const key = args[i].replace(/^--/, '');
188
+ const value = args[i + 1];
189
+ if (key && value !== undefined) {
190
+ patches[key] = value;
191
+ }
192
+ }
193
+ state.cmdStatePatch(cwd, patches, raw);
194
+ } else if (subcommand === 'advance-plan') {
195
+ state.cmdStateAdvancePlan(cwd, raw);
196
+ } else if (subcommand === 'record-metric') {
197
+ const phaseIdx = args.indexOf('--phase');
198
+ const planIdx = args.indexOf('--plan');
199
+ const durationIdx = args.indexOf('--duration');
200
+ const tasksIdx = args.indexOf('--tasks');
201
+ const filesIdx = args.indexOf('--files');
202
+ state.cmdStateRecordMetric(cwd, {
203
+ phase: phaseIdx !== -1 ? args[phaseIdx + 1] : null,
204
+ plan: planIdx !== -1 ? args[planIdx + 1] : null,
205
+ duration: durationIdx !== -1 ? args[durationIdx + 1] : null,
206
+ tasks: tasksIdx !== -1 ? args[tasksIdx + 1] : null,
207
+ files: filesIdx !== -1 ? args[filesIdx + 1] : null,
208
+ }, raw);
209
+ } else if (subcommand === 'update-progress') {
210
+ state.cmdStateUpdateProgress(cwd, raw);
211
+ } else if (subcommand === 'add-decision') {
212
+ const phaseIdx = args.indexOf('--phase');
213
+ const summaryIdx = args.indexOf('--summary');
214
+ const summaryFileIdx = args.indexOf('--summary-file');
215
+ const rationaleIdx = args.indexOf('--rationale');
216
+ const rationaleFileIdx = args.indexOf('--rationale-file');
217
+ state.cmdStateAddDecision(cwd, {
218
+ phase: phaseIdx !== -1 ? args[phaseIdx + 1] : null,
219
+ summary: summaryIdx !== -1 ? args[summaryIdx + 1] : null,
220
+ summary_file: summaryFileIdx !== -1 ? args[summaryFileIdx + 1] : null,
221
+ rationale: rationaleIdx !== -1 ? args[rationaleIdx + 1] : '',
222
+ rationale_file: rationaleFileIdx !== -1 ? args[rationaleFileIdx + 1] : null,
223
+ }, raw);
224
+ } else if (subcommand === 'add-blocker') {
225
+ const textIdx = args.indexOf('--text');
226
+ const textFileIdx = args.indexOf('--text-file');
227
+ state.cmdStateAddBlocker(cwd, {
228
+ text: textIdx !== -1 ? args[textIdx + 1] : null,
229
+ text_file: textFileIdx !== -1 ? args[textFileIdx + 1] : null,
230
+ }, raw);
231
+ } else if (subcommand === 'resolve-blocker') {
232
+ const textIdx = args.indexOf('--text');
233
+ state.cmdStateResolveBlocker(cwd, textIdx !== -1 ? args[textIdx + 1] : null, raw);
234
+ } else if (subcommand === 'record-session') {
235
+ const stoppedIdx = args.indexOf('--stopped-at');
236
+ const resumeIdx = args.indexOf('--resume-file');
237
+ state.cmdStateRecordSession(cwd, {
238
+ stopped_at: stoppedIdx !== -1 ? args[stoppedIdx + 1] : null,
239
+ resume_file: resumeIdx !== -1 ? args[resumeIdx + 1] : 'None',
240
+ }, raw);
241
+ } else {
242
+ state.cmdStateLoad(cwd, raw);
243
+ }
244
+ break;
245
+ }
246
+
247
+ case 'resolve-model': {
248
+ commands.cmdResolveModel(cwd, args[1], raw);
249
+ break;
250
+ }
251
+
252
+ case 'find-phase': {
253
+ phase.cmdFindPhase(cwd, args[1], raw);
254
+ break;
255
+ }
256
+
257
+ case 'commit': {
258
+ const amend = args.includes('--amend');
259
+ const message = args[1];
260
+ // Parse --files flag (collect args after --files, stopping at other flags)
261
+ const filesIndex = args.indexOf('--files');
262
+ const files = filesIndex !== -1 ? args.slice(filesIndex + 1).filter(a => !a.startsWith('--')) : [];
263
+ commands.cmdCommit(cwd, message, files, raw, amend);
264
+ break;
265
+ }
266
+
267
+ case 'verify-summary': {
268
+ const summaryPath = args[1];
269
+ const countIndex = args.indexOf('--check-count');
270
+ const checkCount = countIndex !== -1 ? parseInt(args[countIndex + 1], 10) : 2;
271
+ verify.cmdVerifySummary(cwd, summaryPath, checkCount, raw);
272
+ break;
273
+ }
274
+
275
+ case 'template': {
276
+ const subcommand = args[1];
277
+ if (subcommand === 'select') {
278
+ template.cmdTemplateSelect(cwd, args[2], raw);
279
+ } else if (subcommand === 'fill') {
280
+ const templateType = args[2];
281
+ const phaseIdx = args.indexOf('--phase');
282
+ const planIdx = args.indexOf('--plan');
283
+ const nameIdx = args.indexOf('--name');
284
+ const typeIdx = args.indexOf('--type');
285
+ const waveIdx = args.indexOf('--wave');
286
+ const fieldsIdx = args.indexOf('--fields');
287
+ template.cmdTemplateFill(cwd, templateType, {
288
+ phase: phaseIdx !== -1 ? args[phaseIdx + 1] : null,
289
+ plan: planIdx !== -1 ? args[planIdx + 1] : null,
290
+ name: nameIdx !== -1 ? args[nameIdx + 1] : null,
291
+ type: typeIdx !== -1 ? args[typeIdx + 1] : 'execute',
292
+ wave: waveIdx !== -1 ? args[waveIdx + 1] : '1',
293
+ fields: fieldsIdx !== -1 ? JSON.parse(args[fieldsIdx + 1]) : {},
294
+ }, raw);
295
+ } else {
296
+ error('Unknown template subcommand. Available: select, fill');
297
+ }
298
+ break;
299
+ }
300
+
301
+ case 'frontmatter': {
302
+ const subcommand = args[1];
303
+ const file = args[2];
304
+ if (subcommand === 'get') {
305
+ const fieldIdx = args.indexOf('--field');
306
+ frontmatter.cmdFrontmatterGet(cwd, file, fieldIdx !== -1 ? args[fieldIdx + 1] : null, raw);
307
+ } else if (subcommand === 'set') {
308
+ const fieldIdx = args.indexOf('--field');
309
+ const valueIdx = args.indexOf('--value');
310
+ frontmatter.cmdFrontmatterSet(cwd, file, fieldIdx !== -1 ? args[fieldIdx + 1] : null, valueIdx !== -1 ? args[valueIdx + 1] : undefined, raw);
311
+ } else if (subcommand === 'merge') {
312
+ const dataIdx = args.indexOf('--data');
313
+ frontmatter.cmdFrontmatterMerge(cwd, file, dataIdx !== -1 ? args[dataIdx + 1] : null, raw);
314
+ } else if (subcommand === 'validate') {
315
+ const schemaIdx = args.indexOf('--schema');
316
+ frontmatter.cmdFrontmatterValidate(cwd, file, schemaIdx !== -1 ? args[schemaIdx + 1] : null, raw);
317
+ } else {
318
+ error('Unknown frontmatter subcommand. Available: get, set, merge, validate');
319
+ }
320
+ break;
321
+ }
322
+
323
+ case 'verify': {
324
+ const subcommand = args[1];
325
+ if (subcommand === 'plan-structure') {
326
+ verify.cmdVerifyPlanStructure(cwd, args[2], raw);
327
+ } else if (subcommand === 'phase-completeness') {
328
+ verify.cmdVerifyPhaseCompleteness(cwd, args[2], raw);
329
+ } else if (subcommand === 'references') {
330
+ verify.cmdVerifyReferences(cwd, args[2], raw);
331
+ } else if (subcommand === 'commits') {
332
+ verify.cmdVerifyCommits(cwd, args.slice(2), raw);
333
+ } else if (subcommand === 'artifacts') {
334
+ verify.cmdVerifyArtifacts(cwd, args[2], raw);
335
+ } else if (subcommand === 'key-links') {
336
+ verify.cmdVerifyKeyLinks(cwd, args[2], raw);
337
+ } else {
338
+ error('Unknown verify subcommand. Available: plan-structure, phase-completeness, references, commits, artifacts, key-links');
339
+ }
340
+ break;
341
+ }
342
+
343
+ case 'generate-slug': {
344
+ commands.cmdGenerateSlug(args[1], raw);
345
+ break;
346
+ }
347
+
348
+ case 'current-timestamp': {
349
+ commands.cmdCurrentTimestamp(args[1] || 'full', raw);
350
+ break;
351
+ }
352
+
353
+ case 'list-todos': {
354
+ commands.cmdListTodos(cwd, args[1], raw);
355
+ break;
356
+ }
357
+
358
+ case 'verify-path-exists': {
359
+ commands.cmdVerifyPathExists(cwd, args[1], raw);
360
+ break;
361
+ }
362
+
363
+ case 'config-ensure-section': {
364
+ config.cmdConfigEnsureSection(cwd, raw);
365
+ break;
366
+ }
367
+
368
+ case 'config-set': {
369
+ config.cmdConfigSet(cwd, args[1], args[2], raw);
370
+ break;
371
+ }
372
+
373
+ case 'config-get': {
374
+ config.cmdConfigGet(cwd, args[1], raw);
375
+ break;
376
+ }
377
+
378
+ case 'history-digest': {
379
+ commands.cmdHistoryDigest(cwd, raw);
380
+ break;
381
+ }
382
+
383
+ case 'phases': {
384
+ const subcommand = args[1];
385
+ if (subcommand === 'list') {
386
+ const typeIndex = args.indexOf('--type');
387
+ const phaseIndex = args.indexOf('--phase');
388
+ const options = {
389
+ type: typeIndex !== -1 ? args[typeIndex + 1] : null,
390
+ phase: phaseIndex !== -1 ? args[phaseIndex + 1] : null,
391
+ includeArchived: args.includes('--include-archived'),
392
+ };
393
+ phase.cmdPhasesList(cwd, options, raw);
394
+ } else {
395
+ error('Unknown phases subcommand. Available: list');
396
+ }
397
+ break;
398
+ }
399
+
400
+ case 'roadmap': {
401
+ const subcommand = args[1];
402
+ if (subcommand === 'get-phase') {
403
+ roadmap.cmdRoadmapGetPhase(cwd, args[2], raw);
404
+ } else if (subcommand === 'analyze') {
405
+ roadmap.cmdRoadmapAnalyze(cwd, raw);
406
+ } else if (subcommand === 'update-plan-progress') {
407
+ roadmap.cmdRoadmapUpdatePlanProgress(cwd, args[2], raw);
408
+ } else {
409
+ error('Unknown roadmap subcommand. Available: get-phase, analyze, update-plan-progress');
410
+ }
411
+ break;
412
+ }
413
+
414
+ case 'requirements': {
415
+ const subcommand = args[1];
416
+ if (subcommand === 'mark-complete') {
417
+ milestone.cmdRequirementsMarkComplete(cwd, args.slice(2), raw);
418
+ } else {
419
+ error('Unknown requirements subcommand. Available: mark-complete');
420
+ }
421
+ break;
422
+ }
423
+
424
+ case 'phase': {
425
+ const subcommand = args[1];
426
+ if (subcommand === 'next-decimal') {
427
+ phase.cmdPhaseNextDecimal(cwd, args[2], raw);
428
+ } else if (subcommand === 'add') {
429
+ phase.cmdPhaseAdd(cwd, args.slice(2).join(' '), raw);
430
+ } else if (subcommand === 'insert') {
431
+ phase.cmdPhaseInsert(cwd, args[2], args.slice(3).join(' '), raw);
432
+ } else if (subcommand === 'remove') {
433
+ const forceFlag = args.includes('--force');
434
+ phase.cmdPhaseRemove(cwd, args[2], { force: forceFlag }, raw);
435
+ } else if (subcommand === 'complete') {
436
+ phase.cmdPhaseComplete(cwd, args[2], raw);
437
+ } else {
438
+ error('Unknown phase subcommand. Available: next-decimal, add, insert, remove, complete');
439
+ }
440
+ break;
441
+ }
442
+
443
+ case 'milestone': {
444
+ const subcommand = args[1];
445
+ if (subcommand === 'complete') {
446
+ const nameIndex = args.indexOf('--name');
447
+ const archivePhases = args.includes('--archive-phases');
448
+ // Collect --name value (everything after --name until next flag or end)
449
+ let milestoneName = null;
450
+ if (nameIndex !== -1) {
451
+ const nameArgs = [];
452
+ for (let i = nameIndex + 1; i < args.length; i++) {
453
+ if (args[i].startsWith('--')) break;
454
+ nameArgs.push(args[i]);
455
+ }
456
+ milestoneName = nameArgs.join(' ') || null;
457
+ }
458
+ milestone.cmdMilestoneComplete(cwd, args[2], { name: milestoneName, archivePhases }, raw);
459
+ } else {
460
+ error('Unknown milestone subcommand. Available: complete');
461
+ }
462
+ break;
463
+ }
464
+
465
+ case 'validate': {
466
+ const subcommand = args[1];
467
+ if (subcommand === 'consistency') {
468
+ verify.cmdValidateConsistency(cwd, raw);
469
+ } else if (subcommand === 'health') {
470
+ const repairFlag = args.includes('--repair');
471
+ verify.cmdValidateHealth(cwd, { repair: repairFlag }, raw);
472
+ } else {
473
+ error('Unknown validate subcommand. Available: consistency, health');
474
+ }
475
+ break;
476
+ }
477
+
478
+ case 'progress': {
479
+ const subcommand = args[1] || 'json';
480
+ commands.cmdProgressRender(cwd, subcommand, raw);
481
+ break;
482
+ }
483
+
484
+ case 'todo': {
485
+ const subcommand = args[1];
486
+ if (subcommand === 'complete') {
487
+ commands.cmdTodoComplete(cwd, args[2], raw);
488
+ } else {
489
+ error('Unknown todo subcommand. Available: complete');
490
+ }
491
+ break;
492
+ }
493
+
494
+ case 'scaffold': {
495
+ const scaffoldType = args[1];
496
+ const phaseIndex = args.indexOf('--phase');
497
+ const nameIndex = args.indexOf('--name');
498
+ const scaffoldOptions = {
499
+ phase: phaseIndex !== -1 ? args[phaseIndex + 1] : null,
500
+ name: nameIndex !== -1 ? args.slice(nameIndex + 1).join(' ') : null,
501
+ };
502
+ commands.cmdScaffold(cwd, scaffoldType, scaffoldOptions, raw);
503
+ break;
504
+ }
505
+
506
+ case 'init': {
507
+ const workflow = args[1];
508
+ switch (workflow) {
509
+ case 'execute-phase':
510
+ init.cmdInitExecutePhase(cwd, args[2], raw);
511
+ break;
512
+ case 'plan-phase':
513
+ init.cmdInitPlanPhase(cwd, args[2], raw);
514
+ break;
515
+ case 'new-project':
516
+ init.cmdInitNewProject(cwd, raw);
517
+ break;
518
+ case 'new-milestone':
519
+ init.cmdInitNewMilestone(cwd, raw);
520
+ break;
521
+ case 'quick':
522
+ init.cmdInitQuick(cwd, args.slice(2).join(' '), raw);
523
+ break;
524
+ case 'resume':
525
+ init.cmdInitResume(cwd, raw);
526
+ break;
527
+ case 'verify-work':
528
+ init.cmdInitVerifyWork(cwd, args[2], raw);
529
+ break;
530
+ case 'phase-op':
531
+ init.cmdInitPhaseOp(cwd, args[2], raw);
532
+ break;
533
+ case 'todos':
534
+ init.cmdInitTodos(cwd, args[2], raw);
535
+ break;
536
+ case 'milestone-op':
537
+ init.cmdInitMilestoneOp(cwd, raw);
538
+ break;
539
+ case 'map-codebase':
540
+ init.cmdInitMapCodebase(cwd, raw);
541
+ break;
542
+ case 'progress':
543
+ init.cmdInitProgress(cwd, raw);
544
+ break;
545
+ default:
546
+ error(`Unknown init workflow: ${workflow}\nAvailable: execute-phase, plan-phase, new-project, new-milestone, quick, resume, verify-work, phase-op, todos, milestone-op, map-codebase, progress`);
547
+ }
548
+ break;
549
+ }
550
+
551
+ case 'phase-plan-index': {
552
+ phase.cmdPhasePlanIndex(cwd, args[1], raw);
553
+ break;
554
+ }
555
+
556
+ case 'state-snapshot': {
557
+ state.cmdStateSnapshot(cwd, raw);
558
+ break;
559
+ }
560
+
561
+ case 'summary-extract': {
562
+ const summaryPath = args[1];
563
+ const fieldsIndex = args.indexOf('--fields');
564
+ const fields = fieldsIndex !== -1 ? args[fieldsIndex + 1].split(',') : null;
565
+ commands.cmdSummaryExtract(cwd, summaryPath, fields, raw);
566
+ break;
567
+ }
568
+
569
+ case 'websearch': {
570
+ const query = args[1];
571
+ const limitIdx = args.indexOf('--limit');
572
+ const freshnessIdx = args.indexOf('--freshness');
573
+ await commands.cmdWebsearch(query, {
574
+ limit: limitIdx !== -1 ? parseInt(args[limitIdx + 1], 10) : 10,
575
+ freshness: freshnessIdx !== -1 ? args[freshnessIdx + 1] : null,
576
+ }, raw);
577
+ break;
578
+ }
579
+
580
+ default:
581
+ error(`Unknown command: ${command}`);
582
+ }
583
+ }
584
+
585
+ main();