@girardmedia/bootspring 1.2.0 → 2.0.3

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 (253) hide show
  1. package/README.md +107 -14
  2. package/bin/bootspring.js +166 -27
  3. package/cli/agent.js +189 -17
  4. package/cli/analyze.js +499 -0
  5. package/cli/audit.js +557 -0
  6. package/cli/auth.js +495 -38
  7. package/cli/billing.js +302 -0
  8. package/cli/build.js +695 -0
  9. package/cli/business.js +109 -26
  10. package/cli/checkpoint-utils.js +168 -0
  11. package/cli/checkpoint.js +639 -0
  12. package/cli/cloud-sync.js +447 -0
  13. package/cli/content.js +198 -0
  14. package/cli/context.js +1 -1
  15. package/cli/deploy.js +543 -0
  16. package/cli/fundraise.js +112 -50
  17. package/cli/github-cmd.js +435 -0
  18. package/cli/health.js +477 -0
  19. package/cli/init.js +84 -13
  20. package/cli/legal.js +107 -95
  21. package/cli/log.js +2 -2
  22. package/cli/loop.js +976 -73
  23. package/cli/manager.js +711 -0
  24. package/cli/metrics.js +480 -0
  25. package/cli/monitor.js +812 -0
  26. package/cli/onboard.js +521 -0
  27. package/cli/orchestrator.js +12 -24
  28. package/cli/prd.js +594 -0
  29. package/cli/preseed-start.js +1483 -0
  30. package/cli/preseed.js +2302 -0
  31. package/cli/project.js +436 -0
  32. package/cli/quality.js +233 -0
  33. package/cli/security.js +913 -0
  34. package/cli/seed.js +1441 -5
  35. package/cli/skill.js +273 -211
  36. package/cli/suggest.js +989 -0
  37. package/cli/switch.js +453 -0
  38. package/cli/visualize.js +527 -0
  39. package/cli/watch.js +769 -0
  40. package/cli/workspace.js +607 -0
  41. package/core/analyze-workflow.js +1134 -0
  42. package/core/api-client.js +535 -22
  43. package/core/audit-workflow.js +1350 -0
  44. package/core/build-orchestrator.js +480 -0
  45. package/core/build-state.js +577 -0
  46. package/core/checkpoint-engine.js +408 -0
  47. package/core/config.js +1109 -26
  48. package/core/context-loader.js +21 -1
  49. package/core/deploy-workflow.js +836 -0
  50. package/core/entitlements.js +93 -22
  51. package/core/github-sync.js +610 -0
  52. package/core/index.js +8 -1
  53. package/core/ingest.js +1111 -0
  54. package/core/metrics-engine.js +768 -0
  55. package/core/onboard-workflow.js +1007 -0
  56. package/core/preseed-workflow.js +934 -0
  57. package/core/preseed.js +1617 -0
  58. package/core/project-context.js +325 -0
  59. package/core/project-state.js +694 -0
  60. package/core/r2-sync.js +583 -0
  61. package/core/scaffold.js +525 -7
  62. package/core/session.js +258 -0
  63. package/core/task-extractor.js +758 -0
  64. package/core/telemetry.js +28 -6
  65. package/core/tier-enforcement.js +737 -0
  66. package/core/utils.js +38 -14
  67. package/generators/questionnaire.js +15 -12
  68. package/generators/sections/ai.js +7 -7
  69. package/generators/sections/content.js +300 -0
  70. package/generators/sections/index.js +3 -0
  71. package/generators/sections/plugins.js +7 -6
  72. package/generators/templates/build-planning.template.js +596 -0
  73. package/generators/templates/content.template.js +819 -0
  74. package/generators/templates/index.js +2 -1
  75. package/hooks/git-autopilot.js +1250 -0
  76. package/hooks/index.js +9 -0
  77. package/intelligence/agent-collab.js +2057 -0
  78. package/intelligence/auto-suggest.js +634 -0
  79. package/intelligence/content-gen.js +1589 -0
  80. package/intelligence/cross-project.js +1647 -0
  81. package/intelligence/index.js +184 -0
  82. package/intelligence/learning/insights.json +517 -7
  83. package/intelligence/learning/pattern-learner.js +1008 -14
  84. package/intelligence/memory/decision-tracker.js +1431 -31
  85. package/intelligence/memory/decisions.jsonl +0 -0
  86. package/intelligence/orchestrator.js +2896 -1
  87. package/intelligence/prd.js +92 -1
  88. package/intelligence/recommendation-weights.json +14 -2
  89. package/intelligence/recommendations.js +463 -9
  90. package/intelligence/workflow-composer.js +1451 -0
  91. package/marketplace/index.d.ts +324 -0
  92. package/marketplace/index.js +1921 -0
  93. package/mcp/contracts/mcp-contract.v1.json +342 -4
  94. package/mcp/registry.js +680 -3
  95. package/mcp/response-formatter.js +23 -0
  96. package/mcp/tools/assist-tool.js +78 -4
  97. package/mcp/tools/autopilot-tool.js +408 -0
  98. package/mcp/tools/content-tool.js +571 -0
  99. package/mcp/tools/dashboard-tool.js +251 -5
  100. package/mcp/tools/mvp-tool.js +344 -0
  101. package/mcp/tools/plugin-tool.js +23 -1
  102. package/mcp/tools/prd-tool.js +579 -0
  103. package/mcp/tools/seed-tool.js +447 -0
  104. package/mcp/tools/skill-tool.js +43 -14
  105. package/mcp/tools/suggest-tool.js +147 -0
  106. package/package.json +15 -6
  107. package/agents/README.md +0 -93
  108. package/agents/ai-integration-expert/context.md +0 -386
  109. package/agents/api-expert/context.md +0 -416
  110. package/agents/architecture-expert/context.md +0 -454
  111. package/agents/auth-expert/context.md +0 -399
  112. package/agents/backend-expert/context.md +0 -483
  113. package/agents/business-strategy-expert/context.md +0 -180
  114. package/agents/code-review-expert/context.md +0 -365
  115. package/agents/competitive-analysis-expert/context.md +0 -239
  116. package/agents/data-modeling-expert/context.md +0 -352
  117. package/agents/database-expert/context.md +0 -250
  118. package/agents/devops-expert/context.md +0 -446
  119. package/agents/email-expert/context.md +0 -379
  120. package/agents/financial-expert/context.md +0 -213
  121. package/agents/frontend-expert/context.md +0 -364
  122. package/agents/fundraising-expert/context.md +0 -257
  123. package/agents/growth-expert/context.md +0 -249
  124. package/agents/index.js +0 -140
  125. package/agents/investor-relations-expert/context.md +0 -266
  126. package/agents/legal-expert/context.md +0 -284
  127. package/agents/marketing-expert/context.md +0 -236
  128. package/agents/monitoring-expert/context.md +0 -362
  129. package/agents/operations-expert/context.md +0 -279
  130. package/agents/partnerships-expert/context.md +0 -286
  131. package/agents/payment-expert/context.md +0 -340
  132. package/agents/performance-expert/context.md +0 -377
  133. package/agents/private-equity-expert/context.md +0 -246
  134. package/agents/railway-expert/context.md +0 -284
  135. package/agents/research-expert/context.md +0 -245
  136. package/agents/sales-expert/context.md +0 -241
  137. package/agents/security-expert/context.md +0 -343
  138. package/agents/testing-expert/context.md +0 -414
  139. package/agents/ui-ux-expert/context.md +0 -448
  140. package/agents/vercel-expert/context.md +0 -426
  141. package/skills/index.js +0 -787
  142. package/skills/patterns/README.md +0 -163
  143. package/skills/patterns/ai/agents.md +0 -281
  144. package/skills/patterns/ai/claude.md +0 -138
  145. package/skills/patterns/ai/embeddings.md +0 -150
  146. package/skills/patterns/ai/rag.md +0 -266
  147. package/skills/patterns/ai/streaming.md +0 -170
  148. package/skills/patterns/ai/structured-output.md +0 -162
  149. package/skills/patterns/ai/tools.md +0 -154
  150. package/skills/patterns/analytics/tracking.md +0 -220
  151. package/skills/patterns/api/errors.md +0 -296
  152. package/skills/patterns/api/graphql.md +0 -440
  153. package/skills/patterns/api/middleware.md +0 -279
  154. package/skills/patterns/api/openapi.md +0 -285
  155. package/skills/patterns/api/rate-limiting.md +0 -231
  156. package/skills/patterns/api/route-handler.md +0 -217
  157. package/skills/patterns/api/server-action.md +0 -249
  158. package/skills/patterns/api/versioning.md +0 -443
  159. package/skills/patterns/api/webhooks.md +0 -247
  160. package/skills/patterns/auth/clerk.md +0 -132
  161. package/skills/patterns/auth/mfa.md +0 -313
  162. package/skills/patterns/auth/nextauth.md +0 -140
  163. package/skills/patterns/auth/oauth.md +0 -237
  164. package/skills/patterns/auth/rbac.md +0 -152
  165. package/skills/patterns/auth/session-management.md +0 -367
  166. package/skills/patterns/auth/session.md +0 -120
  167. package/skills/patterns/database/audit.md +0 -177
  168. package/skills/patterns/database/migrations.md +0 -177
  169. package/skills/patterns/database/pagination.md +0 -230
  170. package/skills/patterns/database/pooling.md +0 -357
  171. package/skills/patterns/database/prisma.md +0 -180
  172. package/skills/patterns/database/relations.md +0 -187
  173. package/skills/patterns/database/seeding.md +0 -246
  174. package/skills/patterns/database/soft-delete.md +0 -153
  175. package/skills/patterns/database/transactions.md +0 -162
  176. package/skills/patterns/deployment/ci-cd.md +0 -231
  177. package/skills/patterns/deployment/docker.md +0 -188
  178. package/skills/patterns/deployment/monitoring.md +0 -387
  179. package/skills/patterns/deployment/vercel.md +0 -160
  180. package/skills/patterns/email/resend.md +0 -143
  181. package/skills/patterns/email/templates.md +0 -245
  182. package/skills/patterns/email/transactional.md +0 -503
  183. package/skills/patterns/email/verification.md +0 -176
  184. package/skills/patterns/files/download.md +0 -243
  185. package/skills/patterns/files/upload.md +0 -239
  186. package/skills/patterns/i18n/nextintl.md +0 -188
  187. package/skills/patterns/logging/structured.md +0 -292
  188. package/skills/patterns/notifications/email-queue.md +0 -248
  189. package/skills/patterns/notifications/push.md +0 -279
  190. package/skills/patterns/payments/checkout.md +0 -303
  191. package/skills/patterns/payments/invoices.md +0 -287
  192. package/skills/patterns/payments/portal.md +0 -245
  193. package/skills/patterns/payments/stripe.md +0 -272
  194. package/skills/patterns/payments/subscriptions.md +0 -300
  195. package/skills/patterns/payments/usage.md +0 -279
  196. package/skills/patterns/performance/caching.md +0 -276
  197. package/skills/patterns/performance/code-splitting.md +0 -233
  198. package/skills/patterns/performance/edge.md +0 -254
  199. package/skills/patterns/performance/isr.md +0 -266
  200. package/skills/patterns/performance/lazy-loading.md +0 -281
  201. package/skills/patterns/realtime/sse.md +0 -327
  202. package/skills/patterns/realtime/websockets.md +0 -336
  203. package/skills/patterns/search/filtering.md +0 -329
  204. package/skills/patterns/search/fulltext.md +0 -260
  205. package/skills/patterns/security/audit-logging.md +0 -444
  206. package/skills/patterns/security/csrf.md +0 -234
  207. package/skills/patterns/security/headers.md +0 -252
  208. package/skills/patterns/security/sanitization.md +0 -258
  209. package/skills/patterns/security/secrets.md +0 -261
  210. package/skills/patterns/security/validation.md +0 -268
  211. package/skills/patterns/security/xss.md +0 -229
  212. package/skills/patterns/seo/metadata.md +0 -252
  213. package/skills/patterns/state/context.md +0 -349
  214. package/skills/patterns/state/react-query.md +0 -313
  215. package/skills/patterns/state/url-state.md +0 -482
  216. package/skills/patterns/state/zustand.md +0 -262
  217. package/skills/patterns/testing/api.md +0 -259
  218. package/skills/patterns/testing/component.md +0 -233
  219. package/skills/patterns/testing/coverage.md +0 -207
  220. package/skills/patterns/testing/fixtures.md +0 -225
  221. package/skills/patterns/testing/integration.md +0 -436
  222. package/skills/patterns/testing/mocking.md +0 -177
  223. package/skills/patterns/testing/playwright.md +0 -162
  224. package/skills/patterns/testing/snapshot.md +0 -175
  225. package/skills/patterns/testing/vitest.md +0 -307
  226. package/skills/patterns/ui/accordions.md +0 -395
  227. package/skills/patterns/ui/cards.md +0 -299
  228. package/skills/patterns/ui/dropdowns.md +0 -476
  229. package/skills/patterns/ui/empty-states.md +0 -320
  230. package/skills/patterns/ui/forms.md +0 -405
  231. package/skills/patterns/ui/inputs.md +0 -319
  232. package/skills/patterns/ui/layouts.md +0 -282
  233. package/skills/patterns/ui/loading.md +0 -291
  234. package/skills/patterns/ui/modals.md +0 -338
  235. package/skills/patterns/ui/navigation.md +0 -374
  236. package/skills/patterns/ui/tables.md +0 -407
  237. package/skills/patterns/ui/toasts.md +0 -300
  238. package/skills/patterns/ui/tooltips.md +0 -396
  239. package/skills/patterns/utils/dates.md +0 -435
  240. package/skills/patterns/utils/errors.md +0 -451
  241. package/skills/patterns/utils/formatting.md +0 -345
  242. package/skills/patterns/utils/validation.md +0 -434
  243. package/templates/bootspring.config.js +0 -83
  244. package/templates/business/business-model-canvas.md +0 -246
  245. package/templates/business/business-plan.md +0 -266
  246. package/templates/business/competitive-analysis.md +0 -312
  247. package/templates/fundraising/data-room-checklist.md +0 -300
  248. package/templates/fundraising/investor-research.md +0 -243
  249. package/templates/fundraising/pitch-deck-outline.md +0 -253
  250. package/templates/legal/gdpr-checklist.md +0 -339
  251. package/templates/legal/privacy-policy.md +0 -285
  252. package/templates/legal/terms-of-service.md +0 -222
  253. package/templates/mcp.json +0 -9
package/cli/build.js ADDED
@@ -0,0 +1,695 @@
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
+ const path = require('path');
18
+ const fs = require('fs');
19
+ const config = require('../core/config');
20
+ const utils = require('../core/utils');
21
+ const buildState = require('../core/build-state');
22
+ const { BuildOrchestrator } = require('../core/build-orchestrator');
23
+
24
+ // Colors
25
+ const c = {
26
+ reset: '\x1b[0m',
27
+ bold: '\x1b[1m',
28
+ dim: '\x1b[2m',
29
+ green: '\x1b[32m',
30
+ blue: '\x1b[34m',
31
+ yellow: '\x1b[33m',
32
+ cyan: '\x1b[36m',
33
+ red: '\x1b[31m',
34
+ magenta: '\x1b[35m'
35
+ };
36
+
37
+ /**
38
+ * Main run function - Interactive by default
39
+ * @param {array} args - Command arguments
40
+ */
41
+ async function run(args) {
42
+ const parsedArgs = utils.parseArgs(args);
43
+ const subcommand = parsedArgs._[0];
44
+
45
+ const cfg = config.load();
46
+ const projectRoot = cfg._projectRoot;
47
+
48
+ // If no subcommand, run interactive mode
49
+ if (!subcommand) {
50
+ return interactiveBuild(projectRoot, parsedArgs);
51
+ }
52
+
53
+ // Advanced users can use subcommands directly
54
+ switch (subcommand) {
55
+ case 'status':
56
+ return showBuildStatus(projectRoot, parsedArgs);
57
+
58
+ case 'pause':
59
+ case 'stop':
60
+ return pauseBuildLoop(projectRoot);
61
+
62
+ case 'resume':
63
+ case 'continue':
64
+ return resumeBuildLoop(projectRoot);
65
+
66
+ case 'task':
67
+ return showCurrentTask(projectRoot, parsedArgs);
68
+
69
+ case 'skip':
70
+ return skipCurrentTask(projectRoot, parsedArgs);
71
+
72
+ case 'plan':
73
+ return showPlan(projectRoot);
74
+
75
+ case 'reset':
76
+ return resetBuild(projectRoot, parsedArgs);
77
+
78
+ case 'next':
79
+ return buildNextTask(projectRoot, parsedArgs);
80
+
81
+ case 'all':
82
+ return buildAll(projectRoot, parsedArgs);
83
+
84
+ case 'help':
85
+ case '-h':
86
+ case '--help':
87
+ return showHelp();
88
+
89
+ default:
90
+ console.log(`${c.red}Unknown subcommand: ${subcommand}${c.reset}`);
91
+ showHelp();
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Interactive build mode - guides user through options
97
+ */
98
+ async function interactiveBuild(projectRoot, args = {}) {
99
+ const readline = require('readline');
100
+ const state = buildState.load(projectRoot);
101
+
102
+ console.log(`
103
+ ${c.cyan}${c.bold}Bootspring Build${c.reset}
104
+ `);
105
+
106
+ // No build state - offer to initialize
107
+ if (!state) {
108
+ console.log(`${c.yellow}No build found.${c.reset}
109
+
110
+ This will:
111
+ 1. Extract tasks from your seed documents
112
+ 2. Create a build plan in /planning
113
+ 3. Guide you through building your MVP
114
+
115
+ `);
116
+
117
+ const answer = await askQuestion('Initialize build from seed docs? [Y/n] ');
118
+
119
+ if (answer.toLowerCase() === 'n') {
120
+ console.log(`\n${c.dim}Run 'bootspring preseed start' first if you haven't set up seed docs.${c.reset}\n`);
121
+ return;
122
+ }
123
+
124
+ // Initialize build
125
+ const { BuildOrchestrator } = require('../core/build-orchestrator');
126
+ const orchestrator = new BuildOrchestrator(projectRoot);
127
+ const spinner = utils.createSpinner('Analyzing seed documents...').start();
128
+
129
+ const result = await orchestrator.initialize();
130
+
131
+ if (!result.success) {
132
+ spinner.fail(result.error);
133
+ return;
134
+ }
135
+
136
+ spinner.succeed(`Found ${result.taskCount} tasks to build`);
137
+ console.log('');
138
+
139
+ // Continue to show options
140
+ return interactiveBuild(projectRoot, args);
141
+ }
142
+
143
+ // Show current progress
144
+ const stats = buildState.getStats(projectRoot);
145
+ const nextTask = buildState.getNextTask(projectRoot);
146
+
147
+ // Progress bar
148
+ const barWidth = 30;
149
+ const filled = Math.round((stats.progress / 100) * barWidth);
150
+ const bar = '█'.repeat(filled) + '░'.repeat(barWidth - filled);
151
+ const progressColor = stats.progress === 100 ? c.green : stats.progress > 50 ? c.cyan : c.yellow;
152
+
153
+ console.log(`${c.bold}${state.projectName}${c.reset}
154
+
155
+ Progress: [${progressColor}${bar}${c.reset}] ${stats.progress}%
156
+ Tasks: ${c.green}${stats.completed}${c.reset} done, ${stats.pending} remaining
157
+ Phase: ${formatPhaseName(state.currentPhase)}
158
+ `);
159
+
160
+ // All done!
161
+ if (!nextTask) {
162
+ if (stats.completed === stats.total) {
163
+ console.log(`${c.green}${c.bold}All tasks complete! Your MVP is ready.${c.reset}
164
+
165
+ Next steps:
166
+ ${c.cyan}npm run dev${c.reset} Start development server
167
+ ${c.cyan}npm run build${c.reset} Build for production
168
+ ${c.cyan}bootspring deploy${c.reset} Deploy to production
169
+ `);
170
+ } else {
171
+ console.log(`${c.yellow}No pending tasks available.${c.reset}
172
+ Some tasks may be blocked. Run ${c.cyan}bootspring build status${c.reset} for details.
173
+ `);
174
+ }
175
+ return;
176
+ }
177
+
178
+ // Show next task
179
+ console.log(`${c.bold}Next Task:${c.reset}
180
+ ${nextTask.title}
181
+ ${c.dim}${nextTask.source || ''}${c.reset}
182
+ `);
183
+
184
+ // Show options
185
+ console.log(`${c.bold}What would you like to do?${c.reset}
186
+
187
+ ${c.cyan}1${c.reset} Build this task
188
+ ${c.cyan}2${c.reset} Build all remaining tasks (autonomous)
189
+ ${c.cyan}3${c.reset} View task details
190
+ ${c.cyan}4${c.reset} Skip this task
191
+ ${c.cyan}5${c.reset} View full plan
192
+ ${c.cyan}q${c.reset} Quit
193
+ `);
194
+
195
+ const choice = await askQuestion('Choose [1-5, q]: ');
196
+
197
+ switch (choice.trim()) {
198
+ case '1':
199
+ case '':
200
+ return buildNextTask(projectRoot, args);
201
+
202
+ case '2':
203
+ return buildAll(projectRoot, args);
204
+
205
+ case '3':
206
+ showCurrentTask(projectRoot, { prompt: true });
207
+ console.log('');
208
+ return interactiveBuild(projectRoot, args);
209
+
210
+ case '4': {
211
+ const reason = await askQuestion('Skip reason (optional): ');
212
+ skipCurrentTask(projectRoot, { reason: reason || 'Skipped by user' });
213
+ return interactiveBuild(projectRoot, args);
214
+ }
215
+
216
+ case '5':
217
+ showPlan(projectRoot);
218
+ return interactiveBuild(projectRoot, args);
219
+
220
+ case 'q':
221
+ case 'Q':
222
+ console.log(`\n${c.dim}Run 'bootspring build' anytime to continue.${c.reset}\n`);
223
+ return;
224
+
225
+ default:
226
+ console.log(`${c.yellow}Invalid choice. Please try again.${c.reset}\n`);
227
+ return interactiveBuild(projectRoot, args);
228
+ }
229
+ }
230
+
231
+ /**
232
+ * Build the next task
233
+ */
234
+ async function buildNextTask(projectRoot, args = {}) {
235
+ const state = buildState.load(projectRoot);
236
+
237
+ if (!state) {
238
+ console.log(`${c.yellow}No build state found. Run 'bootspring build' to start.${c.reset}`);
239
+ return;
240
+ }
241
+
242
+ const nextTask = buildState.getNextTask(projectRoot);
243
+
244
+ if (!nextTask) {
245
+ console.log(`${c.green}No more tasks to build!${c.reset}`);
246
+ return;
247
+ }
248
+
249
+ console.log(`
250
+ ${c.cyan}${c.bold}Building: ${nextTask.title}${c.reset}
251
+ `);
252
+
253
+ // Start the loop for just one task - force to clear any stale session
254
+ const loop = require('./loop');
255
+ await loop.runLoop(projectRoot, {
256
+ source: 'build',
257
+ iterations: 1,
258
+ live: args.live,
259
+ verbose: args.verbose || args.v,
260
+ force: true // Always force to avoid "session already running" issues
261
+ });
262
+
263
+ // Show what's next
264
+ const readline = require('readline');
265
+ const updatedTask = buildState.getNextTask(projectRoot);
266
+
267
+ if (updatedTask) {
268
+ console.log(`
269
+ ${c.bold}Next task:${c.reset} ${updatedTask.title}
270
+ `);
271
+ const answer = await askQuestion('Continue to next task? [Y/n] ');
272
+
273
+ if (answer.toLowerCase() !== 'n') {
274
+ return buildNextTask(projectRoot, args);
275
+ }
276
+ }
277
+
278
+ console.log(`\n${c.dim}Run 'bootspring build' to continue later.${c.reset}\n`);
279
+ }
280
+
281
+ /**
282
+ * Build all remaining tasks
283
+ */
284
+ async function buildAll(projectRoot, args = {}) {
285
+ const state = buildState.load(projectRoot);
286
+
287
+ if (!state) {
288
+ console.log(`${c.yellow}No build state found. Run 'bootspring build' to start.${c.reset}`);
289
+ return;
290
+ }
291
+
292
+ const stats = buildState.getStats(projectRoot);
293
+
294
+ console.log(`
295
+ ${c.cyan}${c.bold}Building all ${stats.pending} remaining tasks...${c.reset}
296
+ ${c.dim}Press Ctrl+C to stop at any time${c.reset}
297
+ `);
298
+
299
+ // Start the full loop - force to clear any stale session
300
+ const loop = require('./loop');
301
+ await loop.runLoop(projectRoot, {
302
+ source: 'build',
303
+ iterations: args.iterations || 50,
304
+ live: args.live,
305
+ verbose: args.verbose || args.v,
306
+ force: true // Always force to avoid "session already running" issues
307
+ });
308
+ }
309
+
310
+ /**
311
+ * Ask a question and get user input
312
+ */
313
+ function askQuestion(question) {
314
+ const readline = require('readline');
315
+ const rl = readline.createInterface({
316
+ input: process.stdin,
317
+ output: process.stdout
318
+ });
319
+
320
+ return new Promise(resolve => {
321
+ rl.question(question, answer => {
322
+ rl.close();
323
+ resolve(answer);
324
+ });
325
+ });
326
+ }
327
+
328
+ /**
329
+ * Show build status
330
+ */
331
+ function showBuildStatus(projectRoot, args = {}) {
332
+ const state = buildState.load(projectRoot);
333
+
334
+ if (!state) {
335
+ console.log(`
336
+ ${c.cyan}${c.bold}Build Status${c.reset}
337
+
338
+ ${c.yellow}No build state found.${c.reset}
339
+ Run ${c.cyan}bootspring seed build${c.reset} to initialize the build system.
340
+ `);
341
+ return;
342
+ }
343
+
344
+ const stats = buildState.getStats(projectRoot);
345
+
346
+ // Status icon
347
+ const statusIcon = {
348
+ pending: `${c.dim}○${c.reset}`,
349
+ in_progress: `${c.green}●${c.reset}`,
350
+ paused: `${c.yellow}◐${c.reset}`,
351
+ completed: `${c.green}✓${c.reset}`,
352
+ failed: `${c.red}✗${c.reset}`
353
+ }[state.status] || '?';
354
+
355
+ // Progress bar
356
+ const barWidth = 40;
357
+ const filled = Math.round((stats.progress / 100) * barWidth);
358
+ const bar = '█'.repeat(filled) + '░'.repeat(barWidth - filled);
359
+ const progressColor = stats.progress === 100 ? c.green :
360
+ stats.progress > 50 ? c.cyan : c.yellow;
361
+
362
+ console.log(`
363
+ ${c.cyan}${c.bold}Build Status${c.reset}
364
+
365
+ ${c.bold}Project:${c.reset} ${state.projectName}
366
+ ${c.bold}Status:${c.reset} ${statusIcon} ${state.status}
367
+ ${c.bold}Phase:${c.reset} ${formatPhaseName(state.currentPhase)}
368
+
369
+ ${c.bold}Progress${c.reset}
370
+ [${progressColor}${bar}${c.reset}] ${stats.progress}%
371
+
372
+ ${c.bold}Tasks${c.reset}
373
+ Total: ${stats.total}
374
+ Completed: ${c.green}${stats.completed}${c.reset}
375
+ In Progress: ${c.cyan}${stats.inProgress}${c.reset}
376
+ Pending: ${stats.pending}
377
+ Blocked: ${c.red}${stats.blocked}${c.reset}
378
+ Skipped: ${c.dim}${stats.skipped}${c.reset}
379
+
380
+ ${c.bold}MVP Progress${c.reset}
381
+ ${stats.mvpProgress}% complete ${stats.mvpComplete ? `${c.green}✓ MVP Complete${c.reset}` : ''}
382
+
383
+ ${c.bold}Loop Session${c.reset}
384
+ Iteration: ${stats.iteration}/${stats.maxIterations}
385
+ Session ID: ${c.dim}${state.loopSession?.sessionId || 'N/A'}${c.reset}
386
+ `);
387
+
388
+ // Show next actions
389
+ showNextActions(state, stats);
390
+ }
391
+
392
+ /**
393
+ * Show suggested next actions
394
+ */
395
+ function showNextActions(state, stats) {
396
+ console.log(`${c.bold}Next Actions:${c.reset}`);
397
+
398
+ if (state.status === 'paused') {
399
+ console.log(` ${c.cyan}1.${c.reset} Resume building → ${c.dim}bootspring build resume${c.reset}`);
400
+ console.log(` ${c.cyan}2.${c.reset} View current task → ${c.dim}bootspring build task${c.reset}`);
401
+ console.log(` ${c.cyan}3.${c.reset} View full plan → ${c.dim}bootspring build plan${c.reset}`);
402
+ } else if (state.status === 'completed') {
403
+ console.log(` ${c.green}Build complete!${c.reset} All tasks have been finished.`);
404
+ console.log(` ${c.cyan}1.${c.reset} View summary → ${c.dim}bootspring build plan${c.reset}`);
405
+ console.log(` ${c.cyan}2.${c.reset} Deploy → ${c.dim}bootspring deploy${c.reset}`);
406
+ } else if (state.status === 'failed') {
407
+ console.log(` ${c.red}Build failed.${c.reset} Review errors and resume.`);
408
+ console.log(` ${c.cyan}1.${c.reset} View current task → ${c.dim}bootspring build task${c.reset}`);
409
+ console.log(` ${c.cyan}2.${c.reset} Skip blocked task → ${c.dim}bootspring build skip${c.reset}`);
410
+ console.log(` ${c.cyan}3.${c.reset} Reset build → ${c.dim}bootspring build reset${c.reset}`);
411
+ } else if (state.status === 'in_progress') {
412
+ console.log(` ${c.cyan}Build in progress...${c.reset}`);
413
+ console.log(` ${c.cyan}1.${c.reset} Pause building → ${c.dim}bootspring build pause${c.reset}`);
414
+ console.log(` ${c.cyan}2.${c.reset} View current task → ${c.dim}bootspring build task${c.reset}`);
415
+ } else {
416
+ console.log(` ${c.cyan}1.${c.reset} Start building → ${c.dim}bootspring seed build --loop${c.reset}`);
417
+ console.log(` ${c.cyan}2.${c.reset} View current task → ${c.dim}bootspring build task${c.reset}`);
418
+ console.log(` ${c.cyan}3.${c.reset} View full plan → ${c.dim}bootspring build plan${c.reset}`);
419
+ }
420
+
421
+ console.log('');
422
+ }
423
+
424
+ /**
425
+ * Pause the build loop
426
+ */
427
+ function pauseBuildLoop(projectRoot) {
428
+ const state = buildState.load(projectRoot);
429
+
430
+ if (!state) {
431
+ console.log(`${c.yellow}No build state found.${c.reset}`);
432
+ return;
433
+ }
434
+
435
+ if (state.status !== 'in_progress') {
436
+ console.log(`${c.yellow}Build is not running (status: ${state.status})${c.reset}`);
437
+ return;
438
+ }
439
+
440
+ buildState.pause(projectRoot);
441
+
442
+ console.log(`
443
+ ${c.green}Build paused.${c.reset}
444
+
445
+ Resume with: ${c.cyan}bootspring build resume${c.reset}
446
+ `);
447
+ }
448
+
449
+ /**
450
+ * Resume the build loop
451
+ */
452
+ function resumeBuildLoop(projectRoot) {
453
+ const state = buildState.load(projectRoot);
454
+
455
+ if (!state) {
456
+ console.log(`${c.yellow}No build state found.${c.reset}`);
457
+ console.log(`Initialize with: ${c.cyan}bootspring seed build${c.reset}`);
458
+ return;
459
+ }
460
+
461
+ if (state.status === 'completed') {
462
+ console.log(`${c.green}Build is already complete!${c.reset}`);
463
+ return;
464
+ }
465
+
466
+ if (state.status !== 'paused' && state.status !== 'pending') {
467
+ console.log(`${c.yellow}Build status: ${state.status}${c.reset}`);
468
+ console.log('Cannot resume from this state.');
469
+ return;
470
+ }
471
+
472
+ buildState.resume(projectRoot);
473
+
474
+ console.log(`
475
+ ${c.green}Build resumed.${c.reset}
476
+
477
+ To continue the build loop:
478
+ ${c.cyan}bootspring loop start --source=build${c.reset}
479
+
480
+ Or start fresh:
481
+ ${c.cyan}bootspring seed build --loop${c.reset}
482
+ `);
483
+ }
484
+
485
+ /**
486
+ * Show current task
487
+ */
488
+ function showCurrentTask(projectRoot, args = {}) {
489
+ const state = buildState.load(projectRoot);
490
+
491
+ if (!state) {
492
+ console.log(`${c.yellow}No build state found.${c.reset}`);
493
+ return;
494
+ }
495
+
496
+ const nextTask = buildState.getNextTask(projectRoot);
497
+
498
+ if (!nextTask) {
499
+ const stats = buildState.getStats(projectRoot);
500
+
501
+ if (stats.completed === stats.total) {
502
+ console.log(`
503
+ ${c.green}${c.bold}All tasks complete!${c.reset}
504
+
505
+ ${stats.completed} tasks have been completed.
506
+ `);
507
+ } else {
508
+ console.log(`
509
+ ${c.yellow}No pending tasks available.${c.reset}
510
+
511
+ ${c.bold}Summary:${c.reset}
512
+ Completed: ${stats.completed}
513
+ Blocked: ${stats.blocked}
514
+ Skipped: ${stats.skipped}
515
+ `);
516
+ }
517
+ return;
518
+ }
519
+
520
+ console.log(`
521
+ ${c.cyan}${c.bold}Current Task${c.reset}
522
+
523
+ ${c.bold}ID:${c.reset} ${nextTask.id}
524
+ ${c.bold}Title:${c.reset} ${nextTask.title}
525
+ ${c.bold}Phase:${c.reset} ${formatPhaseName(nextTask.phase)}
526
+ ${c.bold}Complexity:${c.reset} ${nextTask.estimatedComplexity || 'medium'}
527
+ ${c.bold}Source:${c.reset} ${nextTask.source || 'Manual'} ${nextTask.sourceSection ? `(${nextTask.sourceSection})` : ''}
528
+ ${c.bold}Status:${c.reset} ${nextTask.status}
529
+ `);
530
+
531
+ if (nextTask.description) {
532
+ console.log(`${c.bold}Description:${c.reset}
533
+ ${nextTask.description}
534
+ `);
535
+ }
536
+
537
+ if (nextTask.acceptanceCriteria && nextTask.acceptanceCriteria.length > 0) {
538
+ console.log(`${c.bold}Acceptance Criteria:${c.reset}`);
539
+ nextTask.acceptanceCriteria.forEach((criteria, i) => {
540
+ console.log(` ${c.dim}${i + 1}.${c.reset} ${criteria}`);
541
+ });
542
+ console.log('');
543
+ }
544
+
545
+ if (nextTask.dependencies && nextTask.dependencies.length > 0) {
546
+ console.log(`${c.bold}Dependencies:${c.reset} ${nextTask.dependencies.join(', ')}`);
547
+ console.log('');
548
+ }
549
+
550
+ // Show prompt generation option
551
+ if (args.prompt) {
552
+ const orchestrator = new BuildOrchestrator(projectRoot);
553
+ const prompt = orchestrator.generateTaskPrompt(nextTask);
554
+ console.log(`${c.bold}Generated Prompt:${c.reset}`);
555
+ console.log(c.dim + '─'.repeat(60) + c.reset);
556
+ console.log(prompt);
557
+ console.log(c.dim + '─'.repeat(60) + c.reset);
558
+ } else {
559
+ console.log(`${c.dim}Use --prompt to generate AI prompt for this task${c.reset}`);
560
+ }
561
+ }
562
+
563
+ /**
564
+ * Skip current task
565
+ */
566
+ function skipCurrentTask(projectRoot, args = {}) {
567
+ const state = buildState.load(projectRoot);
568
+
569
+ if (!state) {
570
+ console.log(`${c.yellow}No build state found.${c.reset}`);
571
+ return;
572
+ }
573
+
574
+ const nextTask = buildState.getNextTask(projectRoot);
575
+
576
+ if (!nextTask) {
577
+ console.log(`${c.yellow}No pending tasks to skip.${c.reset}`);
578
+ return;
579
+ }
580
+
581
+ const reason = args.reason || args._[1] || 'Manually skipped';
582
+
583
+ buildState.updateProgress(projectRoot, nextTask.id, 'skipped', {
584
+ error: reason
585
+ });
586
+
587
+ console.log(`
588
+ ${c.yellow}Skipped task: ${nextTask.title}${c.reset}
589
+ Reason: ${reason}
590
+
591
+ Next task: ${buildState.getNextTask(projectRoot)?.title || 'None remaining'}
592
+ `);
593
+ }
594
+
595
+ /**
596
+ * Show full plan
597
+ */
598
+ function showPlan(projectRoot) {
599
+ const planPath = path.join(projectRoot, 'planning', 'MASTER_PLAN.md');
600
+
601
+ if (!fs.existsSync(planPath)) {
602
+ console.log(`${c.yellow}No plan found.${c.reset}`);
603
+ console.log(`Initialize with: ${c.cyan}bootspring seed build${c.reset}`);
604
+ return;
605
+ }
606
+
607
+ const content = fs.readFileSync(planPath, 'utf-8');
608
+
609
+ // Print with formatting
610
+ console.log(`
611
+ ${c.cyan}${c.bold}Master Plan${c.reset}
612
+ ${c.dim}${planPath}${c.reset}
613
+
614
+ ${content}
615
+ `);
616
+ }
617
+
618
+ /**
619
+ * Reset build state
620
+ */
621
+ function resetBuild(projectRoot, args = {}) {
622
+ const force = args.force || args.f;
623
+
624
+ const state = buildState.load(projectRoot);
625
+
626
+ if (!state) {
627
+ console.log(`${c.yellow}No build state found.${c.reset}`);
628
+ return;
629
+ }
630
+
631
+ if (!force && state.status === 'in_progress') {
632
+ console.log(`${c.yellow}Build is in progress. Use --force to reset.${c.reset}`);
633
+ return;
634
+ }
635
+
636
+ buildState.reset(projectRoot);
637
+
638
+ console.log(`
639
+ ${c.green}Build state reset.${c.reset}
640
+
641
+ Re-initialize with: ${c.cyan}bootspring seed build${c.reset}
642
+ `);
643
+ }
644
+
645
+ /**
646
+ * Format phase name for display
647
+ */
648
+ function formatPhaseName(phase) {
649
+ if (!phase) return 'Unknown';
650
+
651
+ const names = {
652
+ foundation: 'Foundation',
653
+ mvp: 'MVP',
654
+ launch: 'Launch',
655
+ other: 'Other'
656
+ };
657
+
658
+ return names[phase] || phase.charAt(0).toUpperCase() + phase.slice(1);
659
+ }
660
+
661
+ /**
662
+ * Show help
663
+ */
664
+ function showHelp() {
665
+ console.log(`
666
+ ${c.cyan}${c.bold}Bootspring Build${c.reset}
667
+ ${c.dim}Interactive build system for your MVP${c.reset}
668
+
669
+ ${c.bold}Quick Start:${c.reset}
670
+ ${c.cyan}bootspring build${c.reset} Interactive mode (recommended)
671
+
672
+ ${c.bold}Advanced Commands:${c.reset}
673
+ ${c.cyan}bootspring build next${c.reset} Build next task
674
+ ${c.cyan}bootspring build all${c.reset} Build all tasks autonomously
675
+ ${c.cyan}bootspring build status${c.reset} View detailed progress
676
+ ${c.cyan}bootspring build task${c.reset} View current task details
677
+ ${c.cyan}bootspring build skip${c.reset} Skip current task
678
+ ${c.cyan}bootspring build plan${c.reset} View the full master plan
679
+ ${c.cyan}bootspring build pause${c.reset} Pause building
680
+ ${c.cyan}bootspring build reset${c.reset} Start over
681
+
682
+ ${c.bold}Options:${c.reset}
683
+ --prompt Show AI prompt for current task
684
+ --force Force reset even if in progress
685
+
686
+ ${c.bold}Workflow:${c.reset}
687
+ 1. Run ${c.cyan}bootspring build${c.reset}
688
+ 2. Choose to build one task or all tasks
689
+ 3. Review progress and continue
690
+
691
+ That's it! The system guides you through the rest.
692
+ `);
693
+ }
694
+
695
+ module.exports = { run };