@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.
Files changed (159) hide show
  1. package/bin/bootspring.js +5 -0
  2. package/cli/org.js +474 -0
  3. package/cli/preseed/index.js +16 -0
  4. package/cli/preseed/interactive.js +143 -0
  5. package/cli/preseed/templates.js +227 -0
  6. package/cli/preseed.js +9 -301
  7. package/cli/seed/builders/ai-context-builder.js +85 -0
  8. package/cli/seed/builders/index.js +13 -0
  9. package/cli/seed/builders/seed-builder.js +272 -0
  10. package/cli/seed/extractors/content-extractors.js +383 -0
  11. package/cli/seed/extractors/index.js +47 -0
  12. package/cli/seed/extractors/metadata-extractors.js +167 -0
  13. package/cli/seed/extractors/section-extractor.js +54 -0
  14. package/cli/seed/extractors/stack-extractors.js +228 -0
  15. package/cli/seed/index.js +18 -0
  16. package/cli/seed/utils/folder-structure.js +84 -0
  17. package/cli/seed/utils/index.js +11 -0
  18. package/cli/seed.js +23 -1074
  19. package/core/api-client.js +77 -0
  20. package/core/entitlements.js +36 -0
  21. package/core/organizations.js +223 -0
  22. package/core/policies.js +51 -6
  23. package/core/policy-matrix.js +303 -0
  24. package/core/project-context.js +1 -0
  25. package/dist/cli/index.d.ts +3 -0
  26. package/dist/cli/index.js +3220 -0
  27. package/dist/cli/index.js.map +1 -0
  28. package/dist/context-McpJQa_2.d.ts +5710 -0
  29. package/dist/core/index.d.ts +635 -0
  30. package/dist/core/index.js +2593 -0
  31. package/dist/core/index.js.map +1 -0
  32. package/dist/index-QqbeEiDm.d.ts +857 -0
  33. package/dist/index-UiYCgwiH.d.ts +174 -0
  34. package/dist/index.d.ts +453 -0
  35. package/dist/index.js +44228 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/mcp/index.d.ts +1 -0
  38. package/dist/mcp/index.js +41173 -0
  39. package/dist/mcp/index.js.map +1 -0
  40. package/generators/index.ts +82 -0
  41. package/intelligence/orchestrator/config/failure-signatures.js +48 -0
  42. package/intelligence/orchestrator/config/index.js +23 -0
  43. package/intelligence/orchestrator/config/pack-lifecycle.js +262 -0
  44. package/intelligence/orchestrator/config/phases.js +111 -0
  45. package/intelligence/orchestrator/config/remediation.js +150 -0
  46. package/intelligence/orchestrator/config/workflows.js +168 -0
  47. package/intelligence/orchestrator/core/index.js +16 -0
  48. package/intelligence/orchestrator/core/state-manager.js +88 -0
  49. package/intelligence/orchestrator/core/telemetry.js +24 -0
  50. package/intelligence/orchestrator/index.js +17 -0
  51. package/intelligence/orchestrator.js +17 -512
  52. package/mcp/contracts/mcp-contract.v1.json +1 -1
  53. package/package.json +16 -3
  54. package/src/cli/agent.ts +703 -0
  55. package/src/cli/analyze.ts +640 -0
  56. package/src/cli/audit.ts +707 -0
  57. package/src/cli/auth.ts +930 -0
  58. package/src/cli/billing.ts +364 -0
  59. package/src/cli/build.ts +1089 -0
  60. package/src/cli/business.ts +508 -0
  61. package/src/cli/checkpoint-utils.ts +236 -0
  62. package/src/cli/checkpoint.ts +757 -0
  63. package/src/cli/cloud-sync.ts +534 -0
  64. package/src/cli/content.ts +273 -0
  65. package/src/cli/context.ts +667 -0
  66. package/src/cli/dashboard.ts +133 -0
  67. package/src/cli/deploy.ts +704 -0
  68. package/src/cli/doctor.ts +480 -0
  69. package/src/cli/fundraise.ts +494 -0
  70. package/src/cli/generate.ts +346 -0
  71. package/src/cli/github-cmd.ts +566 -0
  72. package/src/cli/health.ts +599 -0
  73. package/src/cli/index.ts +113 -0
  74. package/src/cli/init.ts +838 -0
  75. package/src/cli/legal.ts +495 -0
  76. package/src/cli/log.ts +316 -0
  77. package/src/cli/loop.ts +1660 -0
  78. package/src/cli/manager.ts +878 -0
  79. package/src/cli/mcp.ts +275 -0
  80. package/src/cli/memory.ts +346 -0
  81. package/src/cli/metrics.ts +590 -0
  82. package/src/cli/monitor.ts +960 -0
  83. package/src/cli/mvp.ts +662 -0
  84. package/src/cli/onboard.ts +663 -0
  85. package/src/cli/orchestrator.ts +622 -0
  86. package/src/cli/plugin.ts +483 -0
  87. package/src/cli/prd.ts +671 -0
  88. package/src/cli/preseed-start.ts +1633 -0
  89. package/src/cli/preseed.ts +2434 -0
  90. package/src/cli/project.ts +526 -0
  91. package/src/cli/quality.ts +885 -0
  92. package/src/cli/security.ts +1079 -0
  93. package/src/cli/seed.ts +1224 -0
  94. package/src/cli/skill.ts +537 -0
  95. package/src/cli/suggest.ts +1225 -0
  96. package/src/cli/switch.ts +518 -0
  97. package/src/cli/task.ts +780 -0
  98. package/src/cli/telemetry.ts +172 -0
  99. package/src/cli/todo.ts +627 -0
  100. package/src/cli/types.ts +15 -0
  101. package/src/cli/update.ts +334 -0
  102. package/src/cli/visualize.ts +609 -0
  103. package/src/cli/watch.ts +895 -0
  104. package/src/cli/workspace.ts +709 -0
  105. package/src/core/action-recorder.ts +673 -0
  106. package/src/core/analyze-workflow.ts +1453 -0
  107. package/src/core/api-client.ts +1120 -0
  108. package/src/core/audit-workflow.ts +1681 -0
  109. package/src/core/auth.ts +471 -0
  110. package/src/core/build-orchestrator.ts +509 -0
  111. package/src/core/build-state.ts +621 -0
  112. package/src/core/checkpoint-engine.ts +482 -0
  113. package/src/core/config.ts +1285 -0
  114. package/src/core/context-loader.ts +694 -0
  115. package/src/core/context.ts +410 -0
  116. package/src/core/deploy-workflow.ts +1085 -0
  117. package/src/core/entitlements.ts +322 -0
  118. package/src/core/github-sync.ts +720 -0
  119. package/src/core/index.ts +981 -0
  120. package/src/core/ingest.ts +1186 -0
  121. package/src/core/metrics-engine.ts +886 -0
  122. package/src/core/mvp.ts +847 -0
  123. package/src/core/onboard-workflow.ts +1293 -0
  124. package/src/core/policies.ts +81 -0
  125. package/src/core/preseed-workflow.ts +1163 -0
  126. package/src/core/preseed.ts +1826 -0
  127. package/src/core/project-context.ts +380 -0
  128. package/src/core/project-state.ts +699 -0
  129. package/src/core/r2-sync.ts +691 -0
  130. package/src/core/scaffold.ts +1715 -0
  131. package/src/core/session.ts +286 -0
  132. package/src/core/task-extractor.ts +799 -0
  133. package/src/core/telemetry.ts +371 -0
  134. package/src/core/tier-enforcement.ts +737 -0
  135. package/src/core/utils.ts +437 -0
  136. package/src/index.ts +29 -0
  137. package/src/intelligence/agent-collab.ts +2376 -0
  138. package/src/intelligence/auto-suggest.ts +713 -0
  139. package/src/intelligence/content-gen.ts +1351 -0
  140. package/src/intelligence/cross-project.ts +1692 -0
  141. package/src/intelligence/git-memory.ts +529 -0
  142. package/src/intelligence/index.ts +318 -0
  143. package/src/intelligence/orchestrator.ts +534 -0
  144. package/src/intelligence/prd.ts +466 -0
  145. package/src/intelligence/recommendations.ts +982 -0
  146. package/src/intelligence/workflow-composer.ts +1472 -0
  147. package/src/mcp/capabilities.ts +233 -0
  148. package/src/mcp/index.ts +37 -0
  149. package/src/mcp/registry.ts +1268 -0
  150. package/src/mcp/response-formatter.ts +797 -0
  151. package/src/mcp/server.ts +240 -0
  152. package/src/types/agent.ts +69 -0
  153. package/src/types/config.ts +86 -0
  154. package/src/types/context.ts +77 -0
  155. package/src/types/index.ts +53 -0
  156. package/src/types/mcp.ts +91 -0
  157. package/src/types/skills.ts +47 -0
  158. package/src/types/workflow.ts +155 -0
  159. package/generators/index.js +0 -18
@@ -0,0 +1,346 @@
1
+ /**
2
+ * Bootspring Generate Command
3
+ * Generate and regenerate AI context files
4
+ *
5
+ * @package bootspring
6
+ * @module cli/generate
7
+ */
8
+
9
+ import * as path from 'path';
10
+ import * as config from '../core/config';
11
+ import * as context from '../core/context';
12
+ import * as utils from '../core/utils';
13
+ import type { LoadedConfig, ConfigInput } from '../core/config';
14
+ import type { ProjectContext, ValidationCheck } from '../core/context';
15
+
16
+ // =============================================================================
17
+ // Types
18
+ // =============================================================================
19
+
20
+ /**
21
+ * Git memory module interface
22
+ */
23
+ interface GitMemoryModule {
24
+ extractLearnings: (options: { limit: number; since: string; cwd: string }) => { learnings: unknown[] };
25
+ toCompactSummary: (learnings: unknown[], options: { maxItems: number }) => string;
26
+ }
27
+
28
+ /**
29
+ * Agents template module interface
30
+ */
31
+ interface AgentsTemplateModule {
32
+ generate: (cfg: LoadedConfig | ConfigInput) => string;
33
+ }
34
+
35
+ // =============================================================================
36
+ // Helper Functions
37
+ // =============================================================================
38
+
39
+ /**
40
+ * Generate CLAUDE.md content from config and project state
41
+ */
42
+ export function generateClaudeMd(cfg: LoadedConfig | ConfigInput, ctx: ProjectContext): string {
43
+ const date = utils.formatDate();
44
+
45
+ const sections: string[] = [];
46
+
47
+ // Header
48
+ sections.push(`# ${cfg.project?.name ?? 'Project'} - AI Context
49
+
50
+ **Generated by**: Bootspring v1.0.0
51
+ **Last Updated**: ${date}
52
+ **Status**: ${ctx.state.phase}
53
+ **Health**: ${ctx.state.health}
54
+
55
+ ---`);
56
+
57
+ // Project Overview
58
+ sections.push(`## Project Overview
59
+
60
+ ${cfg.project?.description ?? 'A modern web application built with Bootspring.'}
61
+
62
+ ---`);
63
+
64
+ // Tech Stack
65
+ sections.push(`## Tech Stack
66
+
67
+ | Component | Technology |
68
+ |-----------|------------|
69
+ | Framework | ${cfg.stack?.framework ?? 'unknown'} |
70
+ | Language | ${cfg.stack?.language ?? 'unknown'} |
71
+ | Database | ${cfg.stack?.database ?? 'unknown'} |
72
+ | Hosting | ${cfg.stack?.hosting ?? 'unknown'} |
73
+
74
+ ---`);
75
+
76
+ // Enabled Plugins
77
+ const plugins = cfg.plugins ?? {};
78
+ const enabledPlugins = Object.entries(plugins)
79
+ .filter(([_name, p]) => p && p.enabled !== false);
80
+
81
+ if (enabledPlugins.length > 0) {
82
+ const pluginSections = enabledPlugins.map(([name, plugin]) => {
83
+ const pluginData = plugin as { provider?: string; features?: string[] };
84
+ return `### ${name.charAt(0).toUpperCase() + name.slice(1)}
85
+ - **Provider**: ${pluginData.provider ?? 'default'}
86
+ - **Features**: ${(pluginData.features ?? []).join(', ') || 'default'}`;
87
+ });
88
+
89
+ sections.push(`## Enabled Plugins
90
+
91
+ ${pluginSections.join('\n\n')}
92
+
93
+ ---`);
94
+ }
95
+
96
+ // Bootspring Commands
97
+ sections.push(`## Bootspring Commands
98
+
99
+ Quick commands for your AI assistant:
100
+
101
+ ### Todo Management
102
+ \`\`\`bash
103
+ bootspring todo add "task" # Add a new todo
104
+ bootspring todo list # List all todos
105
+ bootspring todo done <id> # Mark as complete
106
+ bootspring todo clear # Clear completed
107
+ \`\`\`
108
+
109
+ ### Agents & Skills
110
+ \`\`\`bash
111
+ bootspring agent list # List available agents
112
+ bootspring agent invoke <n> # Get specialized help
113
+ bootspring skill search <q> # Find code patterns
114
+ bootspring skill show <name> # View a skill
115
+ \`\`\`
116
+
117
+ ### Project Tools
118
+ \`\`\`bash
119
+ bootspring dashboard # Start real-time dashboard
120
+ bootspring generate # Regenerate this context
121
+ bootspring quality pre-commit # Run quality checks
122
+ bootspring context validate # Validate project setup
123
+ \`\`\`
124
+
125
+ ---`);
126
+
127
+ // Project State
128
+ const issuesText = ctx.state.issues && ctx.state.issues.length > 0
129
+ ? `\n- **Issues**: ${ctx.state.issues.join(', ')}`
130
+ : '';
131
+
132
+ sections.push(`## Current State
133
+
134
+ - **Phase**: ${ctx.state.phase}
135
+ - **Health**: ${ctx.state.health}
136
+ - **Open Todos**: ${ctx.state.todos}${issuesText}
137
+
138
+ ---`);
139
+
140
+ // Git Info
141
+ if (ctx.git.initialized) {
142
+ sections.push(`## Git Repository
143
+
144
+ - **Branch**: ${ctx.git.branch ?? 'unknown'}
145
+ - **Remote**: ${ctx.git.hasRemote ? 'configured' : 'not configured'}
146
+
147
+ ---`);
148
+
149
+ // Extract git learnings
150
+ try {
151
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
152
+ const gitMemory = require('../../intelligence/git-memory') as GitMemoryModule;
153
+ const loadedCfg = cfg as LoadedConfig;
154
+ const { learnings } = gitMemory.extractLearnings({
155
+ limit: 30,
156
+ since: '2 months ago',
157
+ cwd: loadedCfg._projectRoot ?? process.cwd()
158
+ });
159
+
160
+ if (learnings && learnings.length > 0) {
161
+ const learningsSection = gitMemory.toCompactSummary(learnings, { maxItems: 12 });
162
+ sections.push(learningsSection + '\n---');
163
+ }
164
+ } catch {
165
+ // Git memory extraction failed silently
166
+ }
167
+ }
168
+
169
+ // Project Structure
170
+ sections.push(`## Project Structure
171
+
172
+ - **Structure Type**: ${ctx.files.structure}
173
+ - **Has TypeScript**: ${ctx.files.hasTsConfig ? 'yes' : 'no'}
174
+ - **Has Package.json**: ${ctx.files.hasPackageJson ? 'yes' : 'no'}
175
+
176
+ ---`);
177
+
178
+ // Development Guidelines
179
+ const language = cfg.stack?.language === 'typescript' ? 'TypeScript' : 'JavaScript';
180
+ sections.push(`## Development Guidelines
181
+
182
+ ### Code Style
183
+ - Use ${language} for all new code
184
+ - Follow existing naming conventions in the codebase
185
+ - Keep files focused and under 300 lines when possible
186
+
187
+ ### Best Practices
188
+ - Use Server Components by default (if Next.js)
189
+ - Prefer Server Actions over API routes for mutations
190
+ - Use Zod for all input validation
191
+ - Never expose API keys to client-side code
192
+ - Write tests for new features
193
+
194
+ ### Git Commits
195
+ - Use conventional commit format: \`feat:\`, \`fix:\`, \`docs:\`, \`refactor:\`
196
+ - Keep commits focused and atomic
197
+ - **Never add Co-Authored-By or AI attribution to commits**
198
+ - Never commit sensitive data or API keys
199
+
200
+ ---`);
201
+
202
+ // Custom Instructions
203
+ if (cfg.customInstructions) {
204
+ sections.push(`## Custom Instructions
205
+
206
+ ${cfg.customInstructions}
207
+
208
+ ---`);
209
+ }
210
+
211
+ // Footer
212
+ sections.push(`---
213
+
214
+ *Generated by [Bootspring](https://bootspring.com) - Development scaffolding with intelligence*
215
+ `);
216
+
217
+ return sections.join('\n\n');
218
+ }
219
+
220
+ // =============================================================================
221
+ // Main Entry Point
222
+ // =============================================================================
223
+
224
+ /**
225
+ * Run generate command
226
+ */
227
+ export async function run(args: string[]): Promise<void> {
228
+ const parsedArgs = utils.parseArgs(args);
229
+ const full = parsedArgs.full || parsedArgs.f;
230
+
231
+ console.log(`
232
+ ${utils.COLORS.cyan}${utils.COLORS.bold}\u26a1 Bootspring Generate${utils.COLORS.reset}
233
+ ${utils.COLORS.dim}Regenerating AI context...${utils.COLORS.reset}
234
+ `);
235
+
236
+ // Load config
237
+ const cfg = config.load();
238
+
239
+ if (!cfg._configPath) {
240
+ utils.print.error('No bootspring.config.js found');
241
+ utils.print.dim('Run "bootspring init" first to initialize your project');
242
+ return;
243
+ }
244
+
245
+ // Get context
246
+ const ctx = context.get({ config: cfg });
247
+
248
+ // Generate CLAUDE.md
249
+ const claudePath = path.join(cfg._projectRoot ?? process.cwd(), cfg.paths?.context ?? 'CLAUDE.md');
250
+ const spinner = utils.createSpinner('Generating CLAUDE.md').start();
251
+
252
+ try {
253
+ const content = generateClaudeMd(cfg, ctx);
254
+ utils.writeFile(claudePath, content);
255
+ spinner.succeed('Generated CLAUDE.md');
256
+ } catch (error) {
257
+ spinner.fail(`Failed to generate CLAUDE.md: ${error instanceof Error ? error.message : String(error)}`);
258
+ return;
259
+ }
260
+
261
+ // Generate todo.md if missing (required for 100% score)
262
+ const todoPath = path.join(cfg._projectRoot ?? process.cwd(), cfg.paths?.todo ?? 'todo.md');
263
+ if (!utils.fileExists(todoPath)) {
264
+ const todoSpinner = utils.createSpinner('Generating todo.md').start();
265
+ const todoContent = `# ${cfg.project?.name ?? 'Project'} - Todo List
266
+
267
+ > Last updated: ${utils.formatDate()}
268
+
269
+ ## In Progress
270
+
271
+ ## Pending
272
+
273
+ - [ ] Review generated context
274
+ - [ ] Configure environment variables
275
+
276
+ ## Completed
277
+
278
+ `;
279
+ utils.writeFile(todoPath, todoContent);
280
+ todoSpinner.succeed('Generated todo.md');
281
+ }
282
+
283
+ // Validate context
284
+ const validation = context.validate({ config: cfg });
285
+
286
+ console.log(`
287
+ ${utils.COLORS.bold}Context Validation${utils.COLORS.reset}
288
+ `);
289
+
290
+ for (const check of validation.checks) {
291
+ const icon = check.status === 'pass' ? utils.COLORS.green + '\u2713' :
292
+ check.status === 'fail' ? utils.COLORS.red + '\u2717' :
293
+ check.status === 'warn' ? utils.COLORS.yellow + '\u26a0' :
294
+ utils.COLORS.dim + '\u2139';
295
+ console.log(` ${icon}${utils.COLORS.reset} ${check.name}: ${utils.COLORS.dim}${check.message}${utils.COLORS.reset}`);
296
+ }
297
+
298
+ console.log(`
299
+ ${utils.COLORS.bold}Score:${utils.COLORS.reset} ${validation.score}/${validation.maxScore} (${validation.percentage}%)
300
+ `);
301
+
302
+ if (validation.valid) {
303
+ utils.print.success('Context is valid and ready for AI assistants');
304
+ } else {
305
+ utils.print.warning('Context has some issues - review the checks above');
306
+ }
307
+
308
+ // Full generation includes additional files
309
+ if (full) {
310
+ console.log(`\n${utils.COLORS.bold}Full Generation${utils.COLORS.reset}\n`);
311
+
312
+ // Generate .mcp.json if missing
313
+ const mcpPath = path.join(cfg._projectRoot ?? process.cwd(), '.mcp.json');
314
+ if (!utils.fileExists(mcpPath)) {
315
+ const mcpSpinner = utils.createSpinner('Generating .mcp.json').start();
316
+ const mcpConfig = {
317
+ mcpServers: {
318
+ bootspring: {
319
+ command: 'npx',
320
+ args: ['bootspring', 'mcp'],
321
+ env: {}
322
+ }
323
+ }
324
+ };
325
+ utils.writeFile(mcpPath, JSON.stringify(mcpConfig, null, 2));
326
+ mcpSpinner.succeed('Generated .mcp.json');
327
+ }
328
+
329
+ // Generate AGENTS.md for multi-tool compatibility
330
+ const agentsPath = path.join(cfg._projectRoot ?? process.cwd(), 'AGENTS.md');
331
+ const agentsSpinner = utils.createSpinner('Generating AGENTS.md').start();
332
+ try {
333
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
334
+ const agentsTemplate = require('../../generators/templates/agents.template') as AgentsTemplateModule;
335
+ const agentsContent = agentsTemplate.generate(cfg);
336
+ utils.writeFile(agentsPath, agentsContent);
337
+ agentsSpinner.succeed('Generated AGENTS.md (Codex, Cursor, Amp, Kilo)');
338
+ } catch (error) {
339
+ agentsSpinner.fail(`Failed to generate AGENTS.md: ${error instanceof Error ? error.message : String(error)}`);
340
+ }
341
+ }
342
+
343
+ console.log(`
344
+ ${utils.COLORS.dim}Tip: Run 'bootspring generate --full' to regenerate all files${utils.COLORS.reset}
345
+ `);
346
+ }