@girardmedia/bootspring 2.0.21 → 2.0.23
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/bin/bootspring.js +5 -0
- package/cli/org.js +474 -0
- package/cli/preseed/index.js +16 -0
- package/cli/preseed/interactive.js +143 -0
- package/cli/preseed/templates.js +227 -0
- package/cli/preseed.js +9 -301
- package/cli/seed/builders/ai-context-builder.js +85 -0
- package/cli/seed/builders/index.js +13 -0
- package/cli/seed/builders/seed-builder.js +272 -0
- package/cli/seed/extractors/content-extractors.js +383 -0
- package/cli/seed/extractors/index.js +47 -0
- package/cli/seed/extractors/metadata-extractors.js +167 -0
- package/cli/seed/extractors/section-extractor.js +54 -0
- package/cli/seed/extractors/stack-extractors.js +228 -0
- package/cli/seed/index.js +18 -0
- package/cli/seed/utils/folder-structure.js +84 -0
- package/cli/seed/utils/index.js +11 -0
- package/cli/seed.js +23 -1074
- package/core/api-client.js +77 -0
- package/core/entitlements.js +36 -0
- package/core/organizations.js +223 -0
- package/core/policies.js +51 -6
- package/core/policy-matrix.js +303 -0
- package/core/project-context.js +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +3220 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/context-McpJQa_2.d.ts +5710 -0
- package/dist/core/index.d.ts +635 -0
- package/dist/core/index.js +2593 -0
- package/dist/core/index.js.map +1 -0
- package/dist/index-QqbeEiDm.d.ts +857 -0
- package/dist/index-UiYCgwiH.d.ts +174 -0
- package/dist/index.d.ts +453 -0
- package/dist/index.js +44228 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.js +41173 -0
- package/dist/mcp/index.js.map +1 -0
- package/generators/index.ts +82 -0
- package/intelligence/orchestrator/config/failure-signatures.js +48 -0
- package/intelligence/orchestrator/config/index.js +23 -0
- package/intelligence/orchestrator/config/pack-lifecycle.js +262 -0
- package/intelligence/orchestrator/config/phases.js +111 -0
- package/intelligence/orchestrator/config/remediation.js +150 -0
- package/intelligence/orchestrator/config/workflows.js +168 -0
- package/intelligence/orchestrator/core/index.js +16 -0
- package/intelligence/orchestrator/core/state-manager.js +88 -0
- package/intelligence/orchestrator/core/telemetry.js +24 -0
- package/intelligence/orchestrator/index.js +17 -0
- package/intelligence/orchestrator.js +17 -512
- package/mcp/contracts/mcp-contract.v1.json +1 -1
- package/package.json +16 -3
- package/src/cli/agent.ts +703 -0
- package/src/cli/analyze.ts +640 -0
- package/src/cli/audit.ts +707 -0
- package/src/cli/auth.ts +930 -0
- package/src/cli/billing.ts +364 -0
- package/src/cli/build.ts +1089 -0
- package/src/cli/business.ts +508 -0
- package/src/cli/checkpoint-utils.ts +236 -0
- package/src/cli/checkpoint.ts +757 -0
- package/src/cli/cloud-sync.ts +534 -0
- package/src/cli/content.ts +273 -0
- package/src/cli/context.ts +667 -0
- package/src/cli/dashboard.ts +133 -0
- package/src/cli/deploy.ts +704 -0
- package/src/cli/doctor.ts +480 -0
- package/src/cli/fundraise.ts +494 -0
- package/src/cli/generate.ts +346 -0
- package/src/cli/github-cmd.ts +566 -0
- package/src/cli/health.ts +599 -0
- package/src/cli/index.ts +113 -0
- package/src/cli/init.ts +838 -0
- package/src/cli/legal.ts +495 -0
- package/src/cli/log.ts +316 -0
- package/src/cli/loop.ts +1660 -0
- package/src/cli/manager.ts +878 -0
- package/src/cli/mcp.ts +275 -0
- package/src/cli/memory.ts +346 -0
- package/src/cli/metrics.ts +590 -0
- package/src/cli/monitor.ts +960 -0
- package/src/cli/mvp.ts +662 -0
- package/src/cli/onboard.ts +663 -0
- package/src/cli/orchestrator.ts +622 -0
- package/src/cli/plugin.ts +483 -0
- package/src/cli/prd.ts +671 -0
- package/src/cli/preseed-start.ts +1633 -0
- package/src/cli/preseed.ts +2434 -0
- package/src/cli/project.ts +526 -0
- package/src/cli/quality.ts +885 -0
- package/src/cli/security.ts +1079 -0
- package/src/cli/seed.ts +1224 -0
- package/src/cli/skill.ts +537 -0
- package/src/cli/suggest.ts +1225 -0
- package/src/cli/switch.ts +518 -0
- package/src/cli/task.ts +780 -0
- package/src/cli/telemetry.ts +172 -0
- package/src/cli/todo.ts +627 -0
- package/src/cli/types.ts +15 -0
- package/src/cli/update.ts +334 -0
- package/src/cli/visualize.ts +609 -0
- package/src/cli/watch.ts +895 -0
- package/src/cli/workspace.ts +709 -0
- package/src/core/action-recorder.ts +673 -0
- package/src/core/analyze-workflow.ts +1453 -0
- package/src/core/api-client.ts +1120 -0
- package/src/core/audit-workflow.ts +1681 -0
- package/src/core/auth.ts +471 -0
- package/src/core/build-orchestrator.ts +509 -0
- package/src/core/build-state.ts +621 -0
- package/src/core/checkpoint-engine.ts +482 -0
- package/src/core/config.ts +1285 -0
- package/src/core/context-loader.ts +694 -0
- package/src/core/context.ts +410 -0
- package/src/core/deploy-workflow.ts +1085 -0
- package/src/core/entitlements.ts +322 -0
- package/src/core/github-sync.ts +720 -0
- package/src/core/index.ts +981 -0
- package/src/core/ingest.ts +1186 -0
- package/src/core/metrics-engine.ts +886 -0
- package/src/core/mvp.ts +847 -0
- package/src/core/onboard-workflow.ts +1293 -0
- package/src/core/policies.ts +81 -0
- package/src/core/preseed-workflow.ts +1163 -0
- package/src/core/preseed.ts +1826 -0
- package/src/core/project-context.ts +380 -0
- package/src/core/project-state.ts +699 -0
- package/src/core/r2-sync.ts +691 -0
- package/src/core/scaffold.ts +1715 -0
- package/src/core/session.ts +286 -0
- package/src/core/task-extractor.ts +799 -0
- package/src/core/telemetry.ts +371 -0
- package/src/core/tier-enforcement.ts +737 -0
- package/src/core/utils.ts +437 -0
- package/src/index.ts +29 -0
- package/src/intelligence/agent-collab.ts +2376 -0
- package/src/intelligence/auto-suggest.ts +713 -0
- package/src/intelligence/content-gen.ts +1351 -0
- package/src/intelligence/cross-project.ts +1692 -0
- package/src/intelligence/git-memory.ts +529 -0
- package/src/intelligence/index.ts +318 -0
- package/src/intelligence/orchestrator.ts +534 -0
- package/src/intelligence/prd.ts +466 -0
- package/src/intelligence/recommendations.ts +982 -0
- package/src/intelligence/workflow-composer.ts +1472 -0
- package/src/mcp/capabilities.ts +233 -0
- package/src/mcp/index.ts +37 -0
- package/src/mcp/registry.ts +1268 -0
- package/src/mcp/response-formatter.ts +797 -0
- package/src/mcp/server.ts +240 -0
- package/src/types/agent.ts +69 -0
- package/src/types/config.ts +86 -0
- package/src/types/context.ts +77 -0
- package/src/types/index.ts +53 -0
- package/src/types/mcp.ts +91 -0
- package/src/types/skills.ts +47 -0
- package/src/types/workflow.ts +155 -0
- package/generators/index.js +0 -18
package/src/cli/build.ts
ADDED
|
@@ -0,0 +1,1089 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bootspring Build Command
|
|
3
|
+
*
|
|
4
|
+
* Dedicated build management commands:
|
|
5
|
+
* - status: Check build progress
|
|
6
|
+
* - pause: Pause the build loop
|
|
7
|
+
* - resume: Resume the build loop
|
|
8
|
+
* - task: Show current task
|
|
9
|
+
* - skip: Skip current task
|
|
10
|
+
* - plan: View full plan
|
|
11
|
+
* - reset: Reset build state
|
|
12
|
+
*
|
|
13
|
+
* @package bootspring
|
|
14
|
+
* @command build
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import * as path from 'path';
|
|
18
|
+
import * as fs from 'fs';
|
|
19
|
+
|
|
20
|
+
// Type interfaces for JS modules
|
|
21
|
+
interface Config {
|
|
22
|
+
_projectRoot: string;
|
|
23
|
+
apiBase?: string | undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface ConfigModule {
|
|
27
|
+
load(): Config;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface UtilsModule {
|
|
31
|
+
parseArgs(args: string[]): ParsedArgs;
|
|
32
|
+
createSpinner(text: string): Spinner;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface ParsedArgs {
|
|
36
|
+
_: string[];
|
|
37
|
+
[key: string]: string | boolean | string[] | undefined;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface Spinner {
|
|
41
|
+
start(): Spinner;
|
|
42
|
+
stop(): void;
|
|
43
|
+
succeed(text: string): void;
|
|
44
|
+
fail(text: string): void;
|
|
45
|
+
info(text: string): void;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface BuildTask {
|
|
49
|
+
id: string;
|
|
50
|
+
title: string;
|
|
51
|
+
description?: string | undefined;
|
|
52
|
+
phase?: string | undefined;
|
|
53
|
+
source?: string | undefined;
|
|
54
|
+
sourceSection?: string | undefined;
|
|
55
|
+
status: string;
|
|
56
|
+
estimatedComplexity?: string | undefined;
|
|
57
|
+
acceptanceCriteria?: string[] | undefined;
|
|
58
|
+
dependencies?: string[] | undefined;
|
|
59
|
+
error?: string | undefined;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface BuildStateData {
|
|
63
|
+
projectName: string;
|
|
64
|
+
status: string;
|
|
65
|
+
currentPhase: string;
|
|
66
|
+
implementationQueue: BuildTask[];
|
|
67
|
+
loopSession?: {
|
|
68
|
+
sessionId?: string | undefined;
|
|
69
|
+
} | undefined;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface BuildStats {
|
|
73
|
+
progress: number;
|
|
74
|
+
completed: number;
|
|
75
|
+
pending: number;
|
|
76
|
+
inProgress: number;
|
|
77
|
+
blocked: number;
|
|
78
|
+
skipped: number;
|
|
79
|
+
total: number;
|
|
80
|
+
completedPercent: number;
|
|
81
|
+
mvpProgress: number;
|
|
82
|
+
mvpComplete: boolean;
|
|
83
|
+
iteration: number;
|
|
84
|
+
maxIterations: number;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
interface BuildStateModule {
|
|
88
|
+
load(projectRoot: string): BuildStateData | null;
|
|
89
|
+
getStats(projectRoot: string): BuildStats;
|
|
90
|
+
getNextTask(projectRoot: string): BuildTask | null;
|
|
91
|
+
updateProgress(projectRoot: string, taskId: string, status: string, options?: { error?: string }): void;
|
|
92
|
+
pause(projectRoot: string): void;
|
|
93
|
+
resume(projectRoot: string): void;
|
|
94
|
+
reset(projectRoot: string): void;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
interface BuildOrchestratorInstance {
|
|
98
|
+
initialize(): Promise<{ success: boolean; error?: string; taskCount?: number }>;
|
|
99
|
+
generateTaskPrompt(task: BuildTask): string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
interface BuildOrchestratorClass {
|
|
103
|
+
new (projectRoot: string): BuildOrchestratorInstance;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
interface LoopModule {
|
|
107
|
+
setStopSignal(projectRoot: string): void;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
interface LoopState {
|
|
111
|
+
active: boolean;
|
|
112
|
+
noCommit?: boolean | undefined;
|
|
113
|
+
noPush?: boolean | undefined;
|
|
114
|
+
currentTaskId?: string | undefined;
|
|
115
|
+
lastTaskCompletedAt?: string | undefined;
|
|
116
|
+
startedAt?: string | undefined;
|
|
117
|
+
pausedAt?: string | undefined;
|
|
118
|
+
resumedAt?: string | undefined;
|
|
119
|
+
completedAt?: string | undefined;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
interface CommitResult {
|
|
123
|
+
committed: boolean;
|
|
124
|
+
pushed: boolean;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const config = require('../core/config') as ConfigModule;
|
|
128
|
+
const utils = require('../core/utils') as UtilsModule;
|
|
129
|
+
const buildState = require('../core/build-state') as BuildStateModule;
|
|
130
|
+
const { BuildOrchestrator } = require('../core/build-orchestrator') as { BuildOrchestrator: BuildOrchestratorClass };
|
|
131
|
+
|
|
132
|
+
// Colors
|
|
133
|
+
const c = {
|
|
134
|
+
reset: '\x1b[0m',
|
|
135
|
+
bold: '\x1b[1m',
|
|
136
|
+
dim: '\x1b[2m',
|
|
137
|
+
green: '\x1b[32m',
|
|
138
|
+
blue: '\x1b[34m',
|
|
139
|
+
yellow: '\x1b[33m',
|
|
140
|
+
cyan: '\x1b[36m',
|
|
141
|
+
red: '\x1b[31m',
|
|
142
|
+
magenta: '\x1b[35m'
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Main run function - Interactive by default
|
|
147
|
+
*/
|
|
148
|
+
export async function run(args: string[]): Promise<void> {
|
|
149
|
+
const parsedArgs = utils.parseArgs(args);
|
|
150
|
+
const subcommand = parsedArgs._[0];
|
|
151
|
+
|
|
152
|
+
const cfg = config.load();
|
|
153
|
+
const projectRoot = cfg._projectRoot;
|
|
154
|
+
|
|
155
|
+
// If no subcommand, run interactive mode
|
|
156
|
+
if (!subcommand) {
|
|
157
|
+
return interactiveBuild(projectRoot, parsedArgs);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Advanced users can use subcommands directly
|
|
161
|
+
switch (subcommand) {
|
|
162
|
+
case 'status':
|
|
163
|
+
return showBuildStatus(projectRoot, parsedArgs);
|
|
164
|
+
|
|
165
|
+
case 'pause':
|
|
166
|
+
return pauseBuildLoop(projectRoot);
|
|
167
|
+
|
|
168
|
+
case 'stop':
|
|
169
|
+
return gracefulStop(projectRoot);
|
|
170
|
+
|
|
171
|
+
case 'resume':
|
|
172
|
+
case 'continue':
|
|
173
|
+
return resumeBuildLoop(projectRoot);
|
|
174
|
+
|
|
175
|
+
case 'task':
|
|
176
|
+
return showCurrentTask(projectRoot, parsedArgs);
|
|
177
|
+
|
|
178
|
+
case 'skip':
|
|
179
|
+
return skipCurrentTask(projectRoot, parsedArgs);
|
|
180
|
+
|
|
181
|
+
case 'plan':
|
|
182
|
+
return showPlan(projectRoot);
|
|
183
|
+
|
|
184
|
+
case 'reset':
|
|
185
|
+
return resetBuild(projectRoot, parsedArgs);
|
|
186
|
+
|
|
187
|
+
case 'next':
|
|
188
|
+
return buildNextTask(projectRoot, parsedArgs);
|
|
189
|
+
|
|
190
|
+
case 'done':
|
|
191
|
+
case 'complete':
|
|
192
|
+
return markTaskDone(projectRoot, parsedArgs);
|
|
193
|
+
|
|
194
|
+
case 'loop':
|
|
195
|
+
case 'all':
|
|
196
|
+
return buildLoop(projectRoot, parsedArgs);
|
|
197
|
+
|
|
198
|
+
case 'help':
|
|
199
|
+
case '-h':
|
|
200
|
+
case '--help':
|
|
201
|
+
return showHelp();
|
|
202
|
+
|
|
203
|
+
default:
|
|
204
|
+
console.log(`${c.red}Unknown subcommand: ${subcommand}${c.reset}`);
|
|
205
|
+
showHelp();
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Interactive build mode - guides user through options
|
|
211
|
+
*/
|
|
212
|
+
async function interactiveBuild(projectRoot: string, args: ParsedArgs = { _: [] }): Promise<void> {
|
|
213
|
+
const state = buildState.load(projectRoot);
|
|
214
|
+
|
|
215
|
+
console.log(`
|
|
216
|
+
${c.cyan}${c.bold}Bootspring Build${c.reset}
|
|
217
|
+
`);
|
|
218
|
+
|
|
219
|
+
// No build state - offer to initialize
|
|
220
|
+
if (!state) {
|
|
221
|
+
console.log(`${c.yellow}No build found.${c.reset}
|
|
222
|
+
|
|
223
|
+
This will:
|
|
224
|
+
1. Extract tasks from your seed documents
|
|
225
|
+
2. Create a build plan in /planning
|
|
226
|
+
3. Guide you through building your MVP
|
|
227
|
+
|
|
228
|
+
`);
|
|
229
|
+
|
|
230
|
+
const answer = await askQuestion('Initialize build from seed docs? [Y/n] ');
|
|
231
|
+
|
|
232
|
+
if (answer.toLowerCase() === 'n') {
|
|
233
|
+
console.log(`\n${c.dim}Run 'bootspring preseed start' first if you haven't set up seed docs.${c.reset}\n`);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// Initialize build
|
|
238
|
+
const orchestrator = new BuildOrchestrator(projectRoot);
|
|
239
|
+
const spinner = utils.createSpinner('Analyzing seed documents...').start();
|
|
240
|
+
|
|
241
|
+
const result = await orchestrator.initialize();
|
|
242
|
+
|
|
243
|
+
if (!result.success) {
|
|
244
|
+
spinner.fail(result.error || 'Unknown error');
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
spinner.succeed(`Found ${result.taskCount} tasks to build`);
|
|
249
|
+
console.log('');
|
|
250
|
+
|
|
251
|
+
// Continue to show options
|
|
252
|
+
return interactiveBuild(projectRoot, args);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Show current progress
|
|
256
|
+
const stats = buildState.getStats(projectRoot);
|
|
257
|
+
const nextTask = buildState.getNextTask(projectRoot);
|
|
258
|
+
|
|
259
|
+
// Progress bar
|
|
260
|
+
const barWidth = 30;
|
|
261
|
+
const filled = Math.round((stats.progress / 100) * barWidth);
|
|
262
|
+
const bar = '█'.repeat(filled) + '░'.repeat(barWidth - filled);
|
|
263
|
+
const progressColor = stats.progress === 100 ? c.green : stats.progress > 50 ? c.cyan : c.yellow;
|
|
264
|
+
|
|
265
|
+
console.log(`${c.bold}${state.projectName}${c.reset}
|
|
266
|
+
|
|
267
|
+
Progress: [${progressColor}${bar}${c.reset}] ${stats.progress}%
|
|
268
|
+
Tasks: ${c.green}${stats.completed}${c.reset} done, ${stats.pending} remaining
|
|
269
|
+
Phase: ${formatPhaseName(state.currentPhase)}
|
|
270
|
+
`);
|
|
271
|
+
|
|
272
|
+
// All done!
|
|
273
|
+
if (!nextTask) {
|
|
274
|
+
if (stats.completed === stats.total) {
|
|
275
|
+
console.log(`${c.green}${c.bold}All tasks complete! Your MVP is ready.${c.reset}
|
|
276
|
+
|
|
277
|
+
Next steps:
|
|
278
|
+
${c.cyan}npm run dev${c.reset} Start development server
|
|
279
|
+
${c.cyan}npm run build${c.reset} Build for production
|
|
280
|
+
${c.cyan}bootspring deploy${c.reset} Deploy to production
|
|
281
|
+
`);
|
|
282
|
+
} else {
|
|
283
|
+
console.log(`${c.yellow}No pending tasks available.${c.reset}
|
|
284
|
+
Some tasks may be blocked. Run ${c.cyan}bootspring build status${c.reset} for details.
|
|
285
|
+
`);
|
|
286
|
+
}
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// Show next task
|
|
291
|
+
console.log(`${c.bold}Next Task:${c.reset}
|
|
292
|
+
${nextTask.title}
|
|
293
|
+
${c.dim}${nextTask.source || ''}${c.reset}
|
|
294
|
+
`);
|
|
295
|
+
|
|
296
|
+
// Show options
|
|
297
|
+
console.log(`${c.bold}What would you like to do?${c.reset}
|
|
298
|
+
|
|
299
|
+
${c.cyan}1${c.reset} Start this task (shows prompt for Claude Code)
|
|
300
|
+
${c.cyan}2${c.reset} Loop all tasks (autonomous - runs Claude until complete)
|
|
301
|
+
${c.cyan}3${c.reset} View task details
|
|
302
|
+
${c.cyan}4${c.reset} Skip this task
|
|
303
|
+
${c.cyan}5${c.reset} View full plan
|
|
304
|
+
${c.cyan}q${c.reset} Quit
|
|
305
|
+
`);
|
|
306
|
+
|
|
307
|
+
const choice = await askQuestion('Choose [1-5, q]: ');
|
|
308
|
+
|
|
309
|
+
switch (choice.trim()) {
|
|
310
|
+
case '1':
|
|
311
|
+
case '':
|
|
312
|
+
return buildNextTask(projectRoot, args);
|
|
313
|
+
|
|
314
|
+
case '2':
|
|
315
|
+
return buildLoop(projectRoot, args);
|
|
316
|
+
|
|
317
|
+
case '3':
|
|
318
|
+
showCurrentTask(projectRoot, { _: [], prompt: true });
|
|
319
|
+
console.log('');
|
|
320
|
+
return interactiveBuild(projectRoot, args);
|
|
321
|
+
|
|
322
|
+
case '4': {
|
|
323
|
+
const reason = await askQuestion('Skip reason (optional): ');
|
|
324
|
+
skipCurrentTask(projectRoot, { _: [], reason: reason || 'Skipped by user' });
|
|
325
|
+
return interactiveBuild(projectRoot, args);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
case '5':
|
|
329
|
+
showPlan(projectRoot);
|
|
330
|
+
return interactiveBuild(projectRoot, args);
|
|
331
|
+
|
|
332
|
+
case 'q':
|
|
333
|
+
case 'Q':
|
|
334
|
+
console.log(`\n${c.dim}Run 'bootspring build' anytime to continue.${c.reset}\n`);
|
|
335
|
+
return;
|
|
336
|
+
|
|
337
|
+
default:
|
|
338
|
+
console.log(`${c.yellow}Invalid choice. Please try again.${c.reset}\n`);
|
|
339
|
+
return interactiveBuild(projectRoot, args);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Build the next task - writes to CURRENT_TASK.md for Claude Code
|
|
345
|
+
*/
|
|
346
|
+
async function buildNextTask(projectRoot: string, _args: ParsedArgs = { _: [] }): Promise<void> {
|
|
347
|
+
const state = buildState.load(projectRoot);
|
|
348
|
+
|
|
349
|
+
if (!state) {
|
|
350
|
+
console.log(`${c.yellow}No build state found. Run 'bootspring build' to start.${c.reset}`);
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
const nextTask = buildState.getNextTask(projectRoot);
|
|
355
|
+
|
|
356
|
+
if (!nextTask) {
|
|
357
|
+
console.log(`${c.green}All tasks complete!${c.reset}`);
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// Mark task as in progress
|
|
362
|
+
buildState.updateProgress(projectRoot, nextTask.id, 'in_progress');
|
|
363
|
+
|
|
364
|
+
console.log(`
|
|
365
|
+
${c.green}${c.bold}✓ Task ${nextTask.id} now in progress${c.reset}
|
|
366
|
+
|
|
367
|
+
${c.bold}Task:${c.reset} ${nextTask.title}
|
|
368
|
+
${c.bold}Phase:${c.reset} ${nextTask.phase || 'MVP'}
|
|
369
|
+
${c.bold}Source:${c.reset} ${nextTask.source || 'PRD.md'}
|
|
370
|
+
|
|
371
|
+
${c.cyan}${c.bold}Tell Claude Code:${c.reset}
|
|
372
|
+
"Read planning/TASK_QUEUE.md, find ${nextTask.id}, and implement it"
|
|
373
|
+
|
|
374
|
+
${c.dim}When done, run: bootspring build done${c.reset}
|
|
375
|
+
`);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Generate a prompt for Claude Code to execute
|
|
381
|
+
*/
|
|
382
|
+
function _generateTaskPrompt(task: BuildTask, _projectRoot: string): string {
|
|
383
|
+
const lines: string[] = [];
|
|
384
|
+
|
|
385
|
+
lines.push(`**Objective:** ${task.title}`);
|
|
386
|
+
lines.push('');
|
|
387
|
+
|
|
388
|
+
if (task.description) {
|
|
389
|
+
lines.push('**Description:**');
|
|
390
|
+
lines.push(task.description);
|
|
391
|
+
lines.push('');
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
if (task.acceptanceCriteria && task.acceptanceCriteria.length > 0) {
|
|
395
|
+
lines.push('**Acceptance Criteria:**');
|
|
396
|
+
task.acceptanceCriteria.forEach(ac => {
|
|
397
|
+
lines.push(`- [ ] ${ac}`);
|
|
398
|
+
});
|
|
399
|
+
lines.push('');
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
if (task.sourceSection) {
|
|
403
|
+
lines.push(`**Source:** ${task.source} - ${task.sourceSection}`);
|
|
404
|
+
lines.push('');
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
lines.push('**Instructions:**');
|
|
408
|
+
lines.push('1. Implement the task as described above');
|
|
409
|
+
lines.push('2. Ensure all acceptance criteria are met');
|
|
410
|
+
lines.push('3. Test your implementation');
|
|
411
|
+
lines.push('4. When done, run: bootspring build done');
|
|
412
|
+
|
|
413
|
+
return lines.join('\n');
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Mark current task as done and auto-queue next
|
|
418
|
+
*/
|
|
419
|
+
async function markTaskDone(projectRoot: string, _args: ParsedArgs = { _: [] }): Promise<void> {
|
|
420
|
+
const state = buildState.load(projectRoot);
|
|
421
|
+
|
|
422
|
+
if (!state) {
|
|
423
|
+
console.log(`${c.yellow}No build state found.${c.reset}`);
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
// Find in-progress task
|
|
428
|
+
const inProgressTask = state.implementationQueue.find(t => t.status === 'in_progress');
|
|
429
|
+
|
|
430
|
+
if (!inProgressTask) {
|
|
431
|
+
console.log(`${c.yellow}No task currently in progress.${c.reset}`);
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// Mark as complete
|
|
436
|
+
buildState.updateProgress(projectRoot, inProgressTask.id, 'completed');
|
|
437
|
+
|
|
438
|
+
console.log(`${c.green}✓${c.reset} Completed: ${c.bold}${inProgressTask.title}${c.reset}`);
|
|
439
|
+
|
|
440
|
+
// Check if loop mode is active - if so, commit and push
|
|
441
|
+
const loopState = loadLoopState(projectRoot);
|
|
442
|
+
if (loopState && loopState.active) {
|
|
443
|
+
await commitAndPush(projectRoot, inProgressTask, {
|
|
444
|
+
noCommit: loopState.noCommit,
|
|
445
|
+
noPush: loopState.noPush
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// Get stats
|
|
450
|
+
const stats = buildState.getStats(projectRoot);
|
|
451
|
+
console.log(`${c.dim}Progress: ${stats.completed}/${stats.total} tasks (${Math.round(stats.completedPercent)}%)${c.reset}`);
|
|
452
|
+
|
|
453
|
+
// Auto-queue next task
|
|
454
|
+
const nextTask = buildState.getNextTask(projectRoot);
|
|
455
|
+
|
|
456
|
+
if (nextTask) {
|
|
457
|
+
// Mark as in progress
|
|
458
|
+
buildState.updateProgress(projectRoot, nextTask.id, 'in_progress');
|
|
459
|
+
|
|
460
|
+
// Update loop state with new task
|
|
461
|
+
if (loopState && loopState.active) {
|
|
462
|
+
saveLoopState(projectRoot, {
|
|
463
|
+
...loopState,
|
|
464
|
+
currentTaskId: nextTask.id,
|
|
465
|
+
lastTaskCompletedAt: new Date().toISOString()
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
console.log(`
|
|
470
|
+
${c.cyan}${c.bold}▶ Next: ${nextTask.title}${c.reset} (${nextTask.id})
|
|
471
|
+
|
|
472
|
+
${c.bold}Continue building:${c.reset} Read planning/TASK_QUEUE.md, implement ${nextTask.id}
|
|
473
|
+
${c.dim}Then run: bootspring build done${c.reset}
|
|
474
|
+
`);
|
|
475
|
+
} else {
|
|
476
|
+
// Clear loop state - build complete
|
|
477
|
+
if (loopState && loopState.active) {
|
|
478
|
+
saveLoopState(projectRoot, {
|
|
479
|
+
...loopState,
|
|
480
|
+
active: false,
|
|
481
|
+
completedAt: new Date().toISOString()
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
console.log(`
|
|
486
|
+
${c.green}${c.bold}🎉 MVP BUILD COMPLETE!${c.reset}
|
|
487
|
+
|
|
488
|
+
All ${stats.total} tasks finished. Your MVP is ready.
|
|
489
|
+
|
|
490
|
+
${c.bold}Next steps:${c.reset}
|
|
491
|
+
1. Review the generated code
|
|
492
|
+
2. Run tests: ${c.cyan}npm test${c.reset}
|
|
493
|
+
3. Deploy: ${c.cyan}bootspring deploy${c.reset}
|
|
494
|
+
`);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Build loop - autonomous task execution with commit/push after each task
|
|
500
|
+
*
|
|
501
|
+
* Usage:
|
|
502
|
+
* bootspring build loop # Start/resume the loop
|
|
503
|
+
* bootspring build loop --no-push # Commit but don't push
|
|
504
|
+
* bootspring build loop --no-commit # No git operations
|
|
505
|
+
*/
|
|
506
|
+
async function buildLoop(projectRoot: string, args: ParsedArgs = { _: [] }): Promise<void> {
|
|
507
|
+
const state = buildState.load(projectRoot);
|
|
508
|
+
|
|
509
|
+
if (!state) {
|
|
510
|
+
console.log(`${c.yellow}No build state found. Run 'bootspring seed synthesize' first.${c.reset}`);
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
const stats = buildState.getStats(projectRoot);
|
|
515
|
+
const noCommit = args['no-commit'] || args.noCommit;
|
|
516
|
+
const noPush = args['no-push'] || args.noPush || noCommit;
|
|
517
|
+
|
|
518
|
+
// Check for in-progress task (crash recovery)
|
|
519
|
+
const inProgress = state.implementationQueue.find(t => t.status === 'in_progress');
|
|
520
|
+
|
|
521
|
+
if (inProgress) {
|
|
522
|
+
console.log(`
|
|
523
|
+
${c.yellow}${c.bold}⚠ Resuming from crash${c.reset}
|
|
524
|
+
|
|
525
|
+
Found in-progress task: ${c.cyan}${inProgress.title}${c.reset} (${inProgress.id})
|
|
526
|
+
|
|
527
|
+
${c.dim}This task was in progress when the loop stopped.
|
|
528
|
+
Continue implementing it, then run 'bootspring build done'.${c.reset}
|
|
529
|
+
`);
|
|
530
|
+
} else {
|
|
531
|
+
// Queue next task
|
|
532
|
+
const nextTask = buildState.getNextTask(projectRoot);
|
|
533
|
+
if (!nextTask) {
|
|
534
|
+
console.log(`${c.green}${c.bold}🎉 All tasks complete!${c.reset}`);
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
buildState.updateProgress(projectRoot, nextTask.id, 'in_progress');
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
const currentTask = state.implementationQueue.find(t => t.status === 'in_progress')
|
|
541
|
+
|| buildState.getNextTask(projectRoot);
|
|
542
|
+
|
|
543
|
+
console.log(`
|
|
544
|
+
${c.cyan}${c.bold}⚡ Bootspring Build Loop${c.reset}
|
|
545
|
+
|
|
546
|
+
${c.bold}Current Task:${c.reset} ${currentTask?.title || 'None'} (${currentTask?.id || '-'})
|
|
547
|
+
${c.bold}Progress:${c.reset} ${stats.completed}/${stats.total} tasks (${Math.round(stats.completedPercent)}%)
|
|
548
|
+
${c.bold}Git Mode:${c.reset} ${noCommit ? 'Disabled' : noPush ? 'Commit only' : 'Commit + Push'}
|
|
549
|
+
|
|
550
|
+
${c.bold}Workflow:${c.reset}
|
|
551
|
+
1. Read planning/TASK_QUEUE.md, find ${currentTask?.id || 'current task'}
|
|
552
|
+
2. Implement the task
|
|
553
|
+
3. Run: ${c.cyan}bootspring build done${c.reset}${!noCommit ? `
|
|
554
|
+
(Auto-commits: "feat(${currentTask?.id}): ${currentTask?.title?.slice(0, 40) || 'task'}...")${!noPush ? `
|
|
555
|
+
(Auto-pushes to origin)` : ''}` : ''}
|
|
556
|
+
4. Continue to next task...
|
|
557
|
+
|
|
558
|
+
${c.dim}Press Ctrl+C to stop. Run 'bootspring build loop' to resume.${c.reset}
|
|
559
|
+
`);
|
|
560
|
+
|
|
561
|
+
// Save loop state for crash recovery
|
|
562
|
+
saveLoopState(projectRoot, {
|
|
563
|
+
active: true,
|
|
564
|
+
startedAt: new Date().toISOString(),
|
|
565
|
+
noCommit: noCommit as boolean | undefined,
|
|
566
|
+
noPush: noPush as boolean | undefined
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Save loop state for crash recovery
|
|
572
|
+
*/
|
|
573
|
+
function saveLoopState(projectRoot: string, state: LoopState): void {
|
|
574
|
+
const loopFile = path.join(projectRoot, '.bootspring', 'loop-state.json');
|
|
575
|
+
const dir = path.dirname(loopFile);
|
|
576
|
+
if (!fs.existsSync(dir)) {
|
|
577
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
578
|
+
}
|
|
579
|
+
fs.writeFileSync(loopFile, JSON.stringify(state, null, 2));
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* Load loop state
|
|
584
|
+
*/
|
|
585
|
+
function loadLoopState(projectRoot: string): LoopState | null {
|
|
586
|
+
const loopFile = path.join(projectRoot, '.bootspring', 'loop-state.json');
|
|
587
|
+
if (fs.existsSync(loopFile)) {
|
|
588
|
+
try {
|
|
589
|
+
return JSON.parse(fs.readFileSync(loopFile, 'utf-8')) as LoopState;
|
|
590
|
+
} catch {
|
|
591
|
+
return null;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
return null;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Clear loop state (used when stopping or completing)
|
|
599
|
+
*/
|
|
600
|
+
function _clearLoopState(projectRoot: string): void {
|
|
601
|
+
const loopFile = path.join(projectRoot, '.bootspring', 'loop-state.json');
|
|
602
|
+
if (fs.existsSync(loopFile)) {
|
|
603
|
+
fs.unlinkSync(loopFile);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Commit and push changes for a completed task
|
|
609
|
+
*/
|
|
610
|
+
async function commitAndPush(projectRoot: string, task: BuildTask, options: { noCommit?: boolean | undefined; noPush?: boolean | undefined } = {}): Promise<CommitResult> {
|
|
611
|
+
const { noCommit, noPush } = options;
|
|
612
|
+
|
|
613
|
+
if (noCommit) return { committed: false, pushed: false };
|
|
614
|
+
|
|
615
|
+
const { execSync } = require('child_process');
|
|
616
|
+
|
|
617
|
+
try {
|
|
618
|
+
// Check if there are changes to commit
|
|
619
|
+
const status = execSync('git status --porcelain', { cwd: projectRoot, encoding: 'utf-8' }) as string;
|
|
620
|
+
if (!status.trim()) {
|
|
621
|
+
console.log(`${c.dim}No changes to commit${c.reset}`);
|
|
622
|
+
return { committed: false, pushed: false };
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
// Stage all changes
|
|
626
|
+
execSync('git add -A', { cwd: projectRoot });
|
|
627
|
+
|
|
628
|
+
// Create commit message
|
|
629
|
+
const shortTitle = task.title.length > 50 ? task.title.slice(0, 47) + '...' : task.title;
|
|
630
|
+
const commitMsg = `feat(${task.id}): ${shortTitle}
|
|
631
|
+
|
|
632
|
+
Task: ${task.title}
|
|
633
|
+
Phase: ${task.phase || 'MVP'}
|
|
634
|
+
Source: ${task.source || 'planning'}
|
|
635
|
+
|
|
636
|
+
Acceptance Criteria:
|
|
637
|
+
${(task.acceptanceCriteria || []).map(ac => `- [x] ${ac}`).join('\n')}
|
|
638
|
+
|
|
639
|
+
Built with Bootspring autonomous loop.`;
|
|
640
|
+
|
|
641
|
+
// Commit
|
|
642
|
+
execSync(`git commit -m "${commitMsg.replace(/"/g, '\\"')}"`, { cwd: projectRoot });
|
|
643
|
+
console.log(`${c.green}✓${c.reset} Committed: ${c.bold}${task.id}${c.reset}`);
|
|
644
|
+
|
|
645
|
+
if (noPush) {
|
|
646
|
+
return { committed: true, pushed: false };
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
// Push
|
|
650
|
+
try {
|
|
651
|
+
execSync('git push', { cwd: projectRoot, stdio: 'pipe' });
|
|
652
|
+
console.log(`${c.green}✓${c.reset} Pushed to origin`);
|
|
653
|
+
return { committed: true, pushed: true };
|
|
654
|
+
} catch (pushError) {
|
|
655
|
+
console.log(`${c.yellow}⚠${c.reset} Push failed (commit saved locally): ${(pushError as Error).message}`);
|
|
656
|
+
return { committed: true, pushed: false };
|
|
657
|
+
}
|
|
658
|
+
} catch (error) {
|
|
659
|
+
console.log(`${c.yellow}⚠${c.reset} Git operation failed: ${(error as Error).message}`);
|
|
660
|
+
return { committed: false, pushed: false };
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* Ask a question and get user input
|
|
666
|
+
*/
|
|
667
|
+
function askQuestion(question: string): Promise<string> {
|
|
668
|
+
const readline = require('readline');
|
|
669
|
+
const rl = readline.createInterface({
|
|
670
|
+
input: process.stdin,
|
|
671
|
+
output: process.stdout
|
|
672
|
+
});
|
|
673
|
+
|
|
674
|
+
return new Promise(resolve => {
|
|
675
|
+
rl.question(question, (answer: string) => {
|
|
676
|
+
rl.close();
|
|
677
|
+
resolve(answer);
|
|
678
|
+
});
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* Show build status
|
|
684
|
+
*/
|
|
685
|
+
function showBuildStatus(projectRoot: string, _args: ParsedArgs = { _: [] }): void {
|
|
686
|
+
const state = buildState.load(projectRoot);
|
|
687
|
+
|
|
688
|
+
if (!state) {
|
|
689
|
+
console.log(`
|
|
690
|
+
${c.cyan}${c.bold}Build Status${c.reset}
|
|
691
|
+
|
|
692
|
+
${c.yellow}No build state found.${c.reset}
|
|
693
|
+
Run ${c.cyan}bootspring seed build${c.reset} to initialize the build system.
|
|
694
|
+
`);
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
const stats = buildState.getStats(projectRoot);
|
|
699
|
+
|
|
700
|
+
// Status icon
|
|
701
|
+
const statusIcon: Record<string, string> = {
|
|
702
|
+
pending: `${c.dim}○${c.reset}`,
|
|
703
|
+
in_progress: `${c.green}●${c.reset}`,
|
|
704
|
+
paused: `${c.yellow}◐${c.reset}`,
|
|
705
|
+
completed: `${c.green}✓${c.reset}`,
|
|
706
|
+
failed: `${c.red}✗${c.reset}`
|
|
707
|
+
};
|
|
708
|
+
const icon = statusIcon[state.status] || '?';
|
|
709
|
+
|
|
710
|
+
// Progress bar
|
|
711
|
+
const barWidth = 40;
|
|
712
|
+
const filled = Math.round((stats.progress / 100) * barWidth);
|
|
713
|
+
const bar = '█'.repeat(filled) + '░'.repeat(barWidth - filled);
|
|
714
|
+
const progressColor = stats.progress === 100 ? c.green :
|
|
715
|
+
stats.progress > 50 ? c.cyan : c.yellow;
|
|
716
|
+
|
|
717
|
+
console.log(`
|
|
718
|
+
${c.cyan}${c.bold}Build Status${c.reset}
|
|
719
|
+
|
|
720
|
+
${c.bold}Project:${c.reset} ${state.projectName}
|
|
721
|
+
${c.bold}Status:${c.reset} ${icon} ${state.status}
|
|
722
|
+
${c.bold}Phase:${c.reset} ${formatPhaseName(state.currentPhase)}
|
|
723
|
+
|
|
724
|
+
${c.bold}Progress${c.reset}
|
|
725
|
+
[${progressColor}${bar}${c.reset}] ${stats.progress}%
|
|
726
|
+
|
|
727
|
+
${c.bold}Tasks${c.reset}
|
|
728
|
+
Total: ${stats.total}
|
|
729
|
+
Completed: ${c.green}${stats.completed}${c.reset}
|
|
730
|
+
In Progress: ${c.cyan}${stats.inProgress}${c.reset}
|
|
731
|
+
Pending: ${stats.pending}
|
|
732
|
+
Blocked: ${c.red}${stats.blocked}${c.reset}
|
|
733
|
+
Skipped: ${c.dim}${stats.skipped}${c.reset}
|
|
734
|
+
|
|
735
|
+
${c.bold}MVP Progress${c.reset}
|
|
736
|
+
${stats.mvpProgress}% complete ${stats.mvpComplete ? `${c.green}✓ MVP Complete${c.reset}` : ''}
|
|
737
|
+
|
|
738
|
+
${c.bold}Loop Session${c.reset}
|
|
739
|
+
Iteration: ${stats.iteration}/${stats.maxIterations}
|
|
740
|
+
Session ID: ${c.dim}${state.loopSession?.sessionId || 'N/A'}${c.reset}
|
|
741
|
+
`);
|
|
742
|
+
|
|
743
|
+
// Show next actions
|
|
744
|
+
showNextActions(state, stats);
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* Show suggested next actions
|
|
749
|
+
*/
|
|
750
|
+
function showNextActions(state: BuildStateData, _stats: BuildStats): void {
|
|
751
|
+
console.log(`${c.bold}Next Actions:${c.reset}`);
|
|
752
|
+
|
|
753
|
+
if (state.status === 'paused') {
|
|
754
|
+
console.log(` ${c.cyan}1.${c.reset} Resume building → ${c.dim}bootspring build resume${c.reset}`);
|
|
755
|
+
console.log(` ${c.cyan}2.${c.reset} View current task → ${c.dim}bootspring build task${c.reset}`);
|
|
756
|
+
console.log(` ${c.cyan}3.${c.reset} View full plan → ${c.dim}bootspring build plan${c.reset}`);
|
|
757
|
+
} else if (state.status === 'completed') {
|
|
758
|
+
console.log(` ${c.green}Build complete!${c.reset} All tasks have been finished.`);
|
|
759
|
+
console.log(` ${c.cyan}1.${c.reset} View summary → ${c.dim}bootspring build plan${c.reset}`);
|
|
760
|
+
console.log(` ${c.cyan}2.${c.reset} Deploy → ${c.dim}bootspring deploy${c.reset}`);
|
|
761
|
+
} else if (state.status === 'failed') {
|
|
762
|
+
console.log(` ${c.red}Build failed.${c.reset} Review errors and resume.`);
|
|
763
|
+
console.log(` ${c.cyan}1.${c.reset} View current task → ${c.dim}bootspring build task${c.reset}`);
|
|
764
|
+
console.log(` ${c.cyan}2.${c.reset} Skip blocked task → ${c.dim}bootspring build skip${c.reset}`);
|
|
765
|
+
console.log(` ${c.cyan}3.${c.reset} Reset build → ${c.dim}bootspring build reset${c.reset}`);
|
|
766
|
+
} else if (state.status === 'in_progress') {
|
|
767
|
+
console.log(` ${c.cyan}Build in progress...${c.reset}`);
|
|
768
|
+
console.log(` ${c.cyan}1.${c.reset} Pause building → ${c.dim}bootspring build pause${c.reset}`);
|
|
769
|
+
console.log(` ${c.cyan}2.${c.reset} View current task → ${c.dim}bootspring build task${c.reset}`);
|
|
770
|
+
} else {
|
|
771
|
+
console.log(` ${c.cyan}1.${c.reset} Start building → ${c.dim}bootspring seed build --loop${c.reset}`);
|
|
772
|
+
console.log(` ${c.cyan}2.${c.reset} View current task → ${c.dim}bootspring build task${c.reset}`);
|
|
773
|
+
console.log(` ${c.cyan}3.${c.reset} View full plan → ${c.dim}bootspring build plan${c.reset}`);
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
console.log('');
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* Pause the build loop
|
|
781
|
+
*/
|
|
782
|
+
function pauseBuildLoop(projectRoot: string): void {
|
|
783
|
+
const state = buildState.load(projectRoot);
|
|
784
|
+
|
|
785
|
+
if (!state) {
|
|
786
|
+
console.log(`${c.yellow}No build state found.${c.reset}`);
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
if (state.status !== 'in_progress') {
|
|
791
|
+
console.log(`${c.yellow}Build is not running (status: ${state.status})${c.reset}`);
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
buildState.pause(projectRoot);
|
|
796
|
+
|
|
797
|
+
// Update loop state to inactive
|
|
798
|
+
const loopState = loadLoopState(projectRoot);
|
|
799
|
+
if (loopState) {
|
|
800
|
+
saveLoopState(projectRoot, {
|
|
801
|
+
...loopState,
|
|
802
|
+
active: false,
|
|
803
|
+
pausedAt: new Date().toISOString()
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
console.log(`
|
|
808
|
+
${c.green}Build paused.${c.reset}
|
|
809
|
+
|
|
810
|
+
Resume with: ${c.cyan}bootspring build resume${c.reset}
|
|
811
|
+
`);
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
/**
|
|
815
|
+
* Resume the build loop
|
|
816
|
+
*/
|
|
817
|
+
function resumeBuildLoop(projectRoot: string): void {
|
|
818
|
+
const state = buildState.load(projectRoot);
|
|
819
|
+
|
|
820
|
+
if (!state) {
|
|
821
|
+
console.log(`${c.yellow}No build state found.${c.reset}`);
|
|
822
|
+
console.log(`Initialize with: ${c.cyan}bootspring seed build${c.reset}`);
|
|
823
|
+
return;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
if (state.status === 'completed') {
|
|
827
|
+
console.log(`${c.green}Build is already complete!${c.reset}`);
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
if (state.status !== 'paused' && state.status !== 'pending') {
|
|
832
|
+
console.log(`${c.yellow}Build status: ${state.status}${c.reset}`);
|
|
833
|
+
console.log('Cannot resume from this state.');
|
|
834
|
+
return;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
buildState.resume(projectRoot);
|
|
838
|
+
|
|
839
|
+
// Restore loop state if it exists
|
|
840
|
+
const loopState = loadLoopState(projectRoot);
|
|
841
|
+
if (loopState) {
|
|
842
|
+
saveLoopState(projectRoot, {
|
|
843
|
+
...loopState,
|
|
844
|
+
active: true,
|
|
845
|
+
resumedAt: new Date().toISOString()
|
|
846
|
+
});
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
console.log(`
|
|
850
|
+
${c.green}Build resumed.${c.reset}
|
|
851
|
+
|
|
852
|
+
Continue with: ${c.cyan}bootspring build next${c.reset}
|
|
853
|
+
Or run loop: ${c.cyan}bootspring build loop${c.reset}
|
|
854
|
+
`);
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
/**
|
|
858
|
+
* Graceful stop - finish current task then pause
|
|
859
|
+
*/
|
|
860
|
+
function gracefulStop(projectRoot: string): void {
|
|
861
|
+
const loop = require('./loop') as LoopModule;
|
|
862
|
+
|
|
863
|
+
console.log(`
|
|
864
|
+
${c.yellow}${c.bold}Graceful stop requested${c.reset}
|
|
865
|
+
|
|
866
|
+
The loop will pause after the current task completes.
|
|
867
|
+
This ensures no work is interrupted mid-task.
|
|
868
|
+
|
|
869
|
+
${c.dim}Waiting for current task to finish...${c.reset}
|
|
870
|
+
`);
|
|
871
|
+
|
|
872
|
+
loop.setStopSignal(projectRoot);
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
/**
|
|
876
|
+
* Show current task
|
|
877
|
+
*/
|
|
878
|
+
function showCurrentTask(projectRoot: string, args: ParsedArgs = { _: [] }): void {
|
|
879
|
+
const state = buildState.load(projectRoot);
|
|
880
|
+
|
|
881
|
+
if (!state) {
|
|
882
|
+
console.log(`${c.yellow}No build state found.${c.reset}`);
|
|
883
|
+
return;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
const nextTask = buildState.getNextTask(projectRoot);
|
|
887
|
+
|
|
888
|
+
if (!nextTask) {
|
|
889
|
+
const stats = buildState.getStats(projectRoot);
|
|
890
|
+
|
|
891
|
+
if (stats.completed === stats.total) {
|
|
892
|
+
console.log(`
|
|
893
|
+
${c.green}${c.bold}All tasks complete!${c.reset}
|
|
894
|
+
|
|
895
|
+
${stats.completed} tasks have been completed.
|
|
896
|
+
`);
|
|
897
|
+
} else {
|
|
898
|
+
console.log(`
|
|
899
|
+
${c.yellow}No pending tasks available.${c.reset}
|
|
900
|
+
|
|
901
|
+
${c.bold}Summary:${c.reset}
|
|
902
|
+
Completed: ${stats.completed}
|
|
903
|
+
Blocked: ${stats.blocked}
|
|
904
|
+
Skipped: ${stats.skipped}
|
|
905
|
+
`);
|
|
906
|
+
}
|
|
907
|
+
return;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
console.log(`
|
|
911
|
+
${c.cyan}${c.bold}Current Task${c.reset}
|
|
912
|
+
|
|
913
|
+
${c.bold}ID:${c.reset} ${nextTask.id}
|
|
914
|
+
${c.bold}Title:${c.reset} ${nextTask.title}
|
|
915
|
+
${c.bold}Phase:${c.reset} ${formatPhaseName(nextTask.phase)}
|
|
916
|
+
${c.bold}Complexity:${c.reset} ${nextTask.estimatedComplexity || 'medium'}
|
|
917
|
+
${c.bold}Source:${c.reset} ${nextTask.source || 'Manual'} ${nextTask.sourceSection ? `(${nextTask.sourceSection})` : ''}
|
|
918
|
+
${c.bold}Status:${c.reset} ${nextTask.status}
|
|
919
|
+
`);
|
|
920
|
+
|
|
921
|
+
if (nextTask.description) {
|
|
922
|
+
console.log(`${c.bold}Description:${c.reset}
|
|
923
|
+
${nextTask.description}
|
|
924
|
+
`);
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
if (nextTask.acceptanceCriteria && nextTask.acceptanceCriteria.length > 0) {
|
|
928
|
+
console.log(`${c.bold}Acceptance Criteria:${c.reset}`);
|
|
929
|
+
nextTask.acceptanceCriteria.forEach((criteria, i) => {
|
|
930
|
+
console.log(` ${c.dim}${i + 1}.${c.reset} ${criteria}`);
|
|
931
|
+
});
|
|
932
|
+
console.log('');
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
if (nextTask.dependencies && nextTask.dependencies.length > 0) {
|
|
936
|
+
console.log(`${c.bold}Dependencies:${c.reset} ${nextTask.dependencies.join(', ')}`);
|
|
937
|
+
console.log('');
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
// Show prompt generation option
|
|
941
|
+
if (args.prompt) {
|
|
942
|
+
const orchestrator = new BuildOrchestrator(projectRoot);
|
|
943
|
+
const prompt = orchestrator.generateTaskPrompt(nextTask);
|
|
944
|
+
console.log(`${c.bold}Generated Prompt:${c.reset}`);
|
|
945
|
+
console.log(c.dim + '─'.repeat(60) + c.reset);
|
|
946
|
+
console.log(prompt);
|
|
947
|
+
console.log(c.dim + '─'.repeat(60) + c.reset);
|
|
948
|
+
} else {
|
|
949
|
+
console.log(`${c.dim}Use --prompt to generate AI prompt for this task${c.reset}`);
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
/**
|
|
954
|
+
* Skip current task
|
|
955
|
+
*/
|
|
956
|
+
function skipCurrentTask(projectRoot: string, args: ParsedArgs = { _: [] }): void {
|
|
957
|
+
const state = buildState.load(projectRoot);
|
|
958
|
+
|
|
959
|
+
if (!state) {
|
|
960
|
+
console.log(`${c.yellow}No build state found.${c.reset}`);
|
|
961
|
+
return;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
const nextTask = buildState.getNextTask(projectRoot);
|
|
965
|
+
|
|
966
|
+
if (!nextTask) {
|
|
967
|
+
console.log(`${c.yellow}No pending tasks to skip.${c.reset}`);
|
|
968
|
+
return;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
const reason = (args.reason as string | undefined) || args._[1] || 'Manually skipped';
|
|
972
|
+
|
|
973
|
+
buildState.updateProgress(projectRoot, nextTask.id, 'skipped', {
|
|
974
|
+
error: reason
|
|
975
|
+
});
|
|
976
|
+
|
|
977
|
+
console.log(`
|
|
978
|
+
${c.yellow}Skipped task: ${nextTask.title}${c.reset}
|
|
979
|
+
Reason: ${reason}
|
|
980
|
+
|
|
981
|
+
Next task: ${buildState.getNextTask(projectRoot)?.title || 'None remaining'}
|
|
982
|
+
`);
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
/**
|
|
986
|
+
* Show full plan
|
|
987
|
+
*/
|
|
988
|
+
function showPlan(projectRoot: string): void {
|
|
989
|
+
const planPath = path.join(projectRoot, 'planning', 'MASTER_PLAN.md');
|
|
990
|
+
|
|
991
|
+
if (!fs.existsSync(planPath)) {
|
|
992
|
+
console.log(`${c.yellow}No plan found.${c.reset}`);
|
|
993
|
+
console.log(`Initialize with: ${c.cyan}bootspring seed build${c.reset}`);
|
|
994
|
+
return;
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
const content = fs.readFileSync(planPath, 'utf-8');
|
|
998
|
+
|
|
999
|
+
// Print with formatting
|
|
1000
|
+
console.log(`
|
|
1001
|
+
${c.cyan}${c.bold}Master Plan${c.reset}
|
|
1002
|
+
${c.dim}${planPath}${c.reset}
|
|
1003
|
+
|
|
1004
|
+
${content}
|
|
1005
|
+
`);
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
/**
|
|
1009
|
+
* Reset build state
|
|
1010
|
+
*/
|
|
1011
|
+
function resetBuild(projectRoot: string, args: ParsedArgs = { _: [] }): void {
|
|
1012
|
+
const force = args.force || args.f;
|
|
1013
|
+
|
|
1014
|
+
const state = buildState.load(projectRoot);
|
|
1015
|
+
|
|
1016
|
+
if (!state) {
|
|
1017
|
+
console.log(`${c.yellow}No build state found.${c.reset}`);
|
|
1018
|
+
return;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
if (!force && state.status === 'in_progress') {
|
|
1022
|
+
console.log(`${c.yellow}Build is in progress. Use --force to reset.${c.reset}`);
|
|
1023
|
+
return;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
buildState.reset(projectRoot);
|
|
1027
|
+
|
|
1028
|
+
console.log(`
|
|
1029
|
+
${c.green}Build state reset.${c.reset}
|
|
1030
|
+
|
|
1031
|
+
Re-initialize with: ${c.cyan}bootspring seed build${c.reset}
|
|
1032
|
+
`);
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
/**
|
|
1036
|
+
* Format phase name for display
|
|
1037
|
+
*/
|
|
1038
|
+
function formatPhaseName(phase: string | undefined): string {
|
|
1039
|
+
if (!phase) return 'Unknown';
|
|
1040
|
+
|
|
1041
|
+
const names: Record<string, string> = {
|
|
1042
|
+
foundation: 'Foundation',
|
|
1043
|
+
mvp: 'MVP',
|
|
1044
|
+
launch: 'Launch',
|
|
1045
|
+
other: 'Other'
|
|
1046
|
+
};
|
|
1047
|
+
|
|
1048
|
+
return names[phase] || phase.charAt(0).toUpperCase() + phase.slice(1);
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
/**
|
|
1052
|
+
* Show help
|
|
1053
|
+
*/
|
|
1054
|
+
function showHelp(): void {
|
|
1055
|
+
console.log(`
|
|
1056
|
+
${c.cyan}${c.bold}Bootspring Build${c.reset}
|
|
1057
|
+
${c.dim}Task-driven build system for Claude Code${c.reset}
|
|
1058
|
+
|
|
1059
|
+
${c.bold}Quick Start:${c.reset}
|
|
1060
|
+
${c.cyan}bootspring build next${c.reset} Get next task and start building
|
|
1061
|
+
|
|
1062
|
+
${c.bold}Workflow:${c.reset}
|
|
1063
|
+
1. Run ${c.cyan}bootspring build next${c.reset} to get the next task
|
|
1064
|
+
2. Implement the task in your codebase
|
|
1065
|
+
3. Run ${c.cyan}bootspring build done${c.reset} when complete
|
|
1066
|
+
4. Repeat until MVP is complete
|
|
1067
|
+
|
|
1068
|
+
${c.bold}Commands:${c.reset}
|
|
1069
|
+
${c.cyan}bootspring build${c.reset} Start interactive build
|
|
1070
|
+
${c.cyan}bootspring build next${c.reset} Get next task (start here!)
|
|
1071
|
+
${c.cyan}bootspring build done${c.reset} Mark current task complete
|
|
1072
|
+
${c.cyan}bootspring build loop${c.reset} Start autonomous loop (commit+push each task)
|
|
1073
|
+
${c.cyan}bootspring build skip${c.reset} Skip current task
|
|
1074
|
+
${c.cyan}bootspring build stop${c.reset} Graceful stop (finish current task, then pause)
|
|
1075
|
+
${c.cyan}bootspring build status${c.reset} View detailed progress
|
|
1076
|
+
${c.cyan}bootspring build task${c.reset} View current task details
|
|
1077
|
+
${c.cyan}bootspring build plan${c.reset} View the full master plan
|
|
1078
|
+
${c.cyan}bootspring build reset${c.reset} Start over
|
|
1079
|
+
|
|
1080
|
+
${c.bold}Loop Options:${c.reset}
|
|
1081
|
+
${c.cyan}bootspring build loop${c.reset} Commit + push after each task
|
|
1082
|
+
${c.cyan}bootspring build loop --no-push${c.reset} Commit only (no push)
|
|
1083
|
+
${c.cyan}bootspring build loop --no-commit${c.reset} No git operations
|
|
1084
|
+
|
|
1085
|
+
${c.bold}Other Options:${c.reset}
|
|
1086
|
+
--prompt Show AI prompt for current task
|
|
1087
|
+
--force Force reset even if in progress
|
|
1088
|
+
`);
|
|
1089
|
+
}
|