@girardmedia/bootspring 2.0.21 → 2.0.22

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 (147) hide show
  1. package/cli/preseed/index.js +16 -0
  2. package/cli/preseed/interactive.js +143 -0
  3. package/cli/preseed/templates.js +227 -0
  4. package/cli/seed/builders/ai-context-builder.js +85 -0
  5. package/cli/seed/builders/index.js +13 -0
  6. package/cli/seed/builders/seed-builder.js +272 -0
  7. package/cli/seed/extractors/content-extractors.js +383 -0
  8. package/cli/seed/extractors/index.js +47 -0
  9. package/cli/seed/extractors/metadata-extractors.js +167 -0
  10. package/cli/seed/extractors/section-extractor.js +54 -0
  11. package/cli/seed/extractors/stack-extractors.js +228 -0
  12. package/cli/seed/index.js +18 -0
  13. package/cli/seed/utils/folder-structure.js +84 -0
  14. package/cli/seed/utils/index.js +11 -0
  15. package/dist/cli/index.d.ts +3 -0
  16. package/dist/cli/index.js +3220 -0
  17. package/dist/cli/index.js.map +1 -0
  18. package/dist/context-McpJQa_2.d.ts +5710 -0
  19. package/dist/core/index.d.ts +635 -0
  20. package/dist/core/index.js +2593 -0
  21. package/dist/core/index.js.map +1 -0
  22. package/dist/index-QqbeEiDm.d.ts +857 -0
  23. package/dist/index-UiYCgwiH.d.ts +174 -0
  24. package/dist/index.d.ts +453 -0
  25. package/dist/index.js +44228 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/mcp/index.d.ts +1 -0
  28. package/dist/mcp/index.js +41173 -0
  29. package/dist/mcp/index.js.map +1 -0
  30. package/generators/index.ts +82 -0
  31. package/intelligence/orchestrator/config/failure-signatures.js +48 -0
  32. package/intelligence/orchestrator/config/index.js +20 -0
  33. package/intelligence/orchestrator/config/phases.js +111 -0
  34. package/intelligence/orchestrator/config/remediation.js +150 -0
  35. package/intelligence/orchestrator/config/workflows.js +168 -0
  36. package/intelligence/orchestrator/core/index.js +16 -0
  37. package/intelligence/orchestrator/core/state-manager.js +88 -0
  38. package/intelligence/orchestrator/core/telemetry.js +24 -0
  39. package/intelligence/orchestrator/index.js +17 -0
  40. package/mcp/contracts/mcp-contract.v1.json +1 -1
  41. package/package.json +16 -3
  42. package/src/cli/agent.ts +703 -0
  43. package/src/cli/analyze.ts +640 -0
  44. package/src/cli/audit.ts +707 -0
  45. package/src/cli/auth.ts +930 -0
  46. package/src/cli/billing.ts +364 -0
  47. package/src/cli/build.ts +1089 -0
  48. package/src/cli/business.ts +508 -0
  49. package/src/cli/checkpoint-utils.ts +236 -0
  50. package/src/cli/checkpoint.ts +757 -0
  51. package/src/cli/cloud-sync.ts +534 -0
  52. package/src/cli/content.ts +273 -0
  53. package/src/cli/context.ts +667 -0
  54. package/src/cli/dashboard.ts +133 -0
  55. package/src/cli/deploy.ts +704 -0
  56. package/src/cli/doctor.ts +480 -0
  57. package/src/cli/fundraise.ts +494 -0
  58. package/src/cli/generate.ts +346 -0
  59. package/src/cli/github-cmd.ts +566 -0
  60. package/src/cli/health.ts +599 -0
  61. package/src/cli/index.ts +113 -0
  62. package/src/cli/init.ts +838 -0
  63. package/src/cli/legal.ts +495 -0
  64. package/src/cli/log.ts +316 -0
  65. package/src/cli/loop.ts +1660 -0
  66. package/src/cli/manager.ts +878 -0
  67. package/src/cli/mcp.ts +275 -0
  68. package/src/cli/memory.ts +346 -0
  69. package/src/cli/metrics.ts +590 -0
  70. package/src/cli/monitor.ts +960 -0
  71. package/src/cli/mvp.ts +662 -0
  72. package/src/cli/onboard.ts +663 -0
  73. package/src/cli/orchestrator.ts +622 -0
  74. package/src/cli/plugin.ts +483 -0
  75. package/src/cli/prd.ts +671 -0
  76. package/src/cli/preseed-start.ts +1633 -0
  77. package/src/cli/preseed.ts +2434 -0
  78. package/src/cli/project.ts +526 -0
  79. package/src/cli/quality.ts +885 -0
  80. package/src/cli/security.ts +1079 -0
  81. package/src/cli/seed.ts +1224 -0
  82. package/src/cli/skill.ts +537 -0
  83. package/src/cli/suggest.ts +1225 -0
  84. package/src/cli/switch.ts +518 -0
  85. package/src/cli/task.ts +780 -0
  86. package/src/cli/telemetry.ts +172 -0
  87. package/src/cli/todo.ts +627 -0
  88. package/src/cli/types.ts +15 -0
  89. package/src/cli/update.ts +334 -0
  90. package/src/cli/visualize.ts +609 -0
  91. package/src/cli/watch.ts +895 -0
  92. package/src/cli/workspace.ts +709 -0
  93. package/src/core/action-recorder.ts +673 -0
  94. package/src/core/analyze-workflow.ts +1453 -0
  95. package/src/core/api-client.ts +1120 -0
  96. package/src/core/audit-workflow.ts +1681 -0
  97. package/src/core/auth.ts +471 -0
  98. package/src/core/build-orchestrator.ts +509 -0
  99. package/src/core/build-state.ts +621 -0
  100. package/src/core/checkpoint-engine.ts +482 -0
  101. package/src/core/config.ts +1285 -0
  102. package/src/core/context-loader.ts +694 -0
  103. package/src/core/context.ts +410 -0
  104. package/src/core/deploy-workflow.ts +1085 -0
  105. package/src/core/entitlements.ts +322 -0
  106. package/src/core/github-sync.ts +720 -0
  107. package/src/core/index.ts +981 -0
  108. package/src/core/ingest.ts +1186 -0
  109. package/src/core/metrics-engine.ts +886 -0
  110. package/src/core/mvp.ts +847 -0
  111. package/src/core/onboard-workflow.ts +1293 -0
  112. package/src/core/policies.ts +81 -0
  113. package/src/core/preseed-workflow.ts +1163 -0
  114. package/src/core/preseed.ts +1826 -0
  115. package/src/core/project-context.ts +380 -0
  116. package/src/core/project-state.ts +699 -0
  117. package/src/core/r2-sync.ts +691 -0
  118. package/src/core/scaffold.ts +1715 -0
  119. package/src/core/session.ts +286 -0
  120. package/src/core/task-extractor.ts +799 -0
  121. package/src/core/telemetry.ts +371 -0
  122. package/src/core/tier-enforcement.ts +737 -0
  123. package/src/core/utils.ts +437 -0
  124. package/src/index.ts +29 -0
  125. package/src/intelligence/agent-collab.ts +2376 -0
  126. package/src/intelligence/auto-suggest.ts +713 -0
  127. package/src/intelligence/content-gen.ts +1351 -0
  128. package/src/intelligence/cross-project.ts +1692 -0
  129. package/src/intelligence/git-memory.ts +529 -0
  130. package/src/intelligence/index.ts +318 -0
  131. package/src/intelligence/orchestrator.ts +534 -0
  132. package/src/intelligence/prd.ts +466 -0
  133. package/src/intelligence/recommendations.ts +982 -0
  134. package/src/intelligence/workflow-composer.ts +1472 -0
  135. package/src/mcp/capabilities.ts +233 -0
  136. package/src/mcp/index.ts +37 -0
  137. package/src/mcp/registry.ts +1268 -0
  138. package/src/mcp/response-formatter.ts +797 -0
  139. package/src/mcp/server.ts +240 -0
  140. package/src/types/agent.ts +69 -0
  141. package/src/types/config.ts +86 -0
  142. package/src/types/context.ts +77 -0
  143. package/src/types/index.ts +53 -0
  144. package/src/types/mcp.ts +91 -0
  145. package/src/types/skills.ts +47 -0
  146. package/src/types/workflow.ts +155 -0
  147. package/generators/index.js +0 -18
@@ -0,0 +1,286 @@
1
+ /**
2
+ * Bootspring Session Manager
3
+ *
4
+ * Manages the current project session context linked to bootspring.com API.
5
+ * This tracks which project the CLI is currently working with.
6
+ *
7
+ * @package bootspring
8
+ * @module core/session
9
+ */
10
+
11
+ import * as fs from 'fs';
12
+ import * as path from 'path';
13
+ import * as os from 'os';
14
+
15
+ export const BOOTSPRING_DIR = path.join(os.homedir(), '.bootspring');
16
+ export const SESSION_FILE = path.join(BOOTSPRING_DIR, 'session.json');
17
+ export const LOCAL_CONFIG_NAME = '.bootspring.json';
18
+
19
+ /**
20
+ * Project info structure
21
+ */
22
+ export interface ProjectInfo {
23
+ id: string;
24
+ name: string;
25
+ slug?: string | undefined;
26
+ lastUsed?: string | undefined;
27
+ [key: string]: unknown;
28
+ }
29
+
30
+ /**
31
+ * Session data structure
32
+ */
33
+ export interface SessionData {
34
+ project?: ProjectInfo;
35
+ recentProjects?: ProjectInfo[];
36
+ updatedAt?: string;
37
+ [key: string]: unknown;
38
+ }
39
+
40
+ /**
41
+ * Local config structure
42
+ */
43
+ export interface LocalConfig {
44
+ projectId?: string | undefined;
45
+ projectName?: string | undefined;
46
+ projectSlug?: string | undefined;
47
+ createdAt?: string | undefined;
48
+ _path?: string | undefined;
49
+ _dir?: string | undefined;
50
+ _fromJsConfig?: boolean | undefined;
51
+ [key: string]: unknown;
52
+ }
53
+
54
+ /**
55
+ * Effective project with source info
56
+ */
57
+ export interface EffectiveProject extends ProjectInfo {
58
+ source: 'local' | 'session';
59
+ _localConfig?: LocalConfig;
60
+ }
61
+
62
+ /**
63
+ * Session state for display
64
+ */
65
+ export interface SessionState {
66
+ hasSession: boolean;
67
+ project: EffectiveProject | null;
68
+ source: 'local' | 'session' | null;
69
+ hasLocalConfig: boolean;
70
+ localConfigPath?: string | undefined;
71
+ recentProjects: ProjectInfo[];
72
+ lastUpdated: string | null;
73
+ }
74
+
75
+ /**
76
+ * Ensure ~/.bootspring directory exists
77
+ */
78
+ export function ensureDir(): void {
79
+ if (!fs.existsSync(BOOTSPRING_DIR)) {
80
+ fs.mkdirSync(BOOTSPRING_DIR, { recursive: true, mode: 0o700 });
81
+ }
82
+ }
83
+
84
+ /**
85
+ * Get current session data
86
+ */
87
+ export function getSession(): SessionData | null {
88
+ try {
89
+ if (fs.existsSync(SESSION_FILE)) {
90
+ return JSON.parse(fs.readFileSync(SESSION_FILE, 'utf-8')) as SessionData;
91
+ }
92
+ } catch {
93
+ // Ignore read errors
94
+ }
95
+ return null;
96
+ }
97
+
98
+ /**
99
+ * Save session data
100
+ */
101
+ export function saveSession(session: SessionData): void {
102
+ ensureDir();
103
+ const data = {
104
+ ...session,
105
+ updatedAt: new Date().toISOString()
106
+ };
107
+ fs.writeFileSync(SESSION_FILE, JSON.stringify(data, null, 2));
108
+ }
109
+
110
+ /**
111
+ * Clear session
112
+ */
113
+ export function clearSession(): void {
114
+ try {
115
+ if (fs.existsSync(SESSION_FILE)) {
116
+ fs.unlinkSync(SESSION_FILE);
117
+ }
118
+ } catch {
119
+ // Ignore delete errors
120
+ }
121
+ }
122
+
123
+ /**
124
+ * Get current project context
125
+ */
126
+ export function getCurrentProject(): ProjectInfo | null {
127
+ const session = getSession();
128
+ return session?.project || null;
129
+ }
130
+
131
+ /**
132
+ * Set current project context
133
+ */
134
+ export function setCurrentProject(project: ProjectInfo): void {
135
+ const session = getSession() || {};
136
+ session.project = project;
137
+ saveSession(session);
138
+ }
139
+
140
+ /**
141
+ * Get recent projects
142
+ */
143
+ export function getRecentProjects(): ProjectInfo[] {
144
+ const session = getSession();
145
+ return session?.recentProjects || [];
146
+ }
147
+
148
+ /**
149
+ * Add to recent projects
150
+ */
151
+ export function addRecentProject(project: ProjectInfo): void {
152
+ const session = getSession() || {};
153
+ const recent = session.recentProjects || [];
154
+
155
+ // Remove if already exists
156
+ const filtered = recent.filter(p => p.id !== project.id);
157
+
158
+ // Add to front
159
+ filtered.unshift({
160
+ id: project.id,
161
+ name: project.name,
162
+ slug: project.slug,
163
+ lastUsed: new Date().toISOString()
164
+ });
165
+
166
+ // Keep only last 10
167
+ session.recentProjects = filtered.slice(0, 10);
168
+ saveSession(session);
169
+ }
170
+
171
+ /**
172
+ * Check if a local .bootspring.json or bootspring.config.js exists in cwd or ancestors
173
+ */
174
+ export function findLocalConfig(startDir?: string): LocalConfig | null {
175
+ let dir = startDir || process.cwd();
176
+
177
+ // Walk up to 10 directories
178
+ for (let i = 0; i < 10; i++) {
179
+ // First check for .bootspring.json
180
+ const jsonConfigPath = path.join(dir, LOCAL_CONFIG_NAME);
181
+ if (fs.existsSync(jsonConfigPath)) {
182
+ try {
183
+ const config = JSON.parse(fs.readFileSync(jsonConfigPath, 'utf-8')) as LocalConfig;
184
+ return {
185
+ ...config,
186
+ _path: jsonConfigPath,
187
+ _dir: dir
188
+ };
189
+ } catch {
190
+ // Continue to check other config files
191
+ }
192
+ }
193
+
194
+ // Also check for bootspring.config.js with projectId
195
+ const jsConfigPath = path.join(dir, 'bootspring.config.js');
196
+ if (fs.existsSync(jsConfigPath)) {
197
+ try {
198
+ // Clear require cache to get fresh config
199
+ delete require.cache[require.resolve(jsConfigPath)];
200
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
201
+ const config = require(jsConfigPath) as Record<string, unknown>;
202
+ if (config.projectId) {
203
+ const project = config.project as Record<string, unknown> | undefined;
204
+ return {
205
+ projectId: config.projectId as string,
206
+ projectName: (project?.name || config.name || 'Unknown') as string,
207
+ projectSlug: project?.slug as string | undefined,
208
+ _path: jsConfigPath,
209
+ _dir: dir,
210
+ _fromJsConfig: true
211
+ };
212
+ }
213
+ } catch {
214
+ // Continue searching
215
+ }
216
+ }
217
+
218
+ const parent = path.dirname(dir);
219
+ if (parent === dir) break;
220
+ dir = parent;
221
+ }
222
+
223
+ return null;
224
+ }
225
+
226
+ /**
227
+ * Get effective project context (local config > session)
228
+ */
229
+ export function getEffectiveProject(): EffectiveProject | null {
230
+ // First check for local .bootspring.json
231
+ const local = findLocalConfig();
232
+ if (local?.projectId) {
233
+ return {
234
+ id: local.projectId,
235
+ name: local.projectName || 'Unknown',
236
+ slug: local.projectSlug,
237
+ source: 'local',
238
+ _localConfig: local
239
+ };
240
+ }
241
+
242
+ // Fall back to session
243
+ const sessionProject = getCurrentProject();
244
+ if (sessionProject) {
245
+ return {
246
+ ...sessionProject,
247
+ source: 'session'
248
+ };
249
+ }
250
+
251
+ return null;
252
+ }
253
+
254
+ /**
255
+ * Create a local .bootspring.json file
256
+ */
257
+ export function createLocalConfig(dir: string, project: ProjectInfo): string {
258
+ const configPath = path.join(dir, LOCAL_CONFIG_NAME);
259
+ const config: LocalConfig = {
260
+ projectId: project.id,
261
+ projectName: project.name,
262
+ projectSlug: project.slug,
263
+ createdAt: new Date().toISOString()
264
+ };
265
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
266
+ return configPath;
267
+ }
268
+
269
+ /**
270
+ * Get full session state for display
271
+ */
272
+ export function getSessionState(): SessionState {
273
+ const session = getSession();
274
+ const effective = getEffectiveProject();
275
+ const local = findLocalConfig();
276
+
277
+ return {
278
+ hasSession: !!session,
279
+ project: effective,
280
+ source: effective?.source || null,
281
+ hasLocalConfig: !!local,
282
+ localConfigPath: local?._path,
283
+ recentProjects: session?.recentProjects || [],
284
+ lastUpdated: session?.updatedAt || null
285
+ };
286
+ }