@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
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bootspring Business Command
|
|
3
|
+
* Business planning and strategy tools
|
|
4
|
+
*
|
|
5
|
+
* @package bootspring
|
|
6
|
+
* @command business
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import * as fs from 'fs';
|
|
10
|
+
import * as path from 'path';
|
|
11
|
+
|
|
12
|
+
// Type interfaces for JS modules
|
|
13
|
+
interface UtilsModule {
|
|
14
|
+
COLORS: Colors;
|
|
15
|
+
print: PrintModule;
|
|
16
|
+
createSpinner(text: string): Spinner;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface Colors {
|
|
20
|
+
reset: string;
|
|
21
|
+
bold: string;
|
|
22
|
+
dim: string;
|
|
23
|
+
cyan: string;
|
|
24
|
+
green: string;
|
|
25
|
+
yellow: string;
|
|
26
|
+
red: string;
|
|
27
|
+
magenta: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface PrintModule {
|
|
31
|
+
success(msg: string): void;
|
|
32
|
+
error(msg: string): void;
|
|
33
|
+
warning(msg: string): void;
|
|
34
|
+
info(msg: string): void;
|
|
35
|
+
dim(msg: string): void;
|
|
36
|
+
debug(msg: string): void;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface Spinner {
|
|
40
|
+
start(): Spinner;
|
|
41
|
+
stop(): void;
|
|
42
|
+
succeed(text: string): void;
|
|
43
|
+
fail(text: string): void;
|
|
44
|
+
info(text: string): void;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface ProjectStateModule {
|
|
48
|
+
PROJECT_TYPES: Record<string, string>;
|
|
49
|
+
setProjectType(projectRoot: string, type: string, metadata?: Record<string, unknown>): unknown;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface CheckpointEngineModule {
|
|
53
|
+
syncCheckpoints(projectRoot: string, options?: { verbose?: boolean }): void;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface ApiModule {
|
|
57
|
+
getTemplate(category: string, file: string): Promise<{ content: string }>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
interface AuthModule {
|
|
61
|
+
isAuthenticated(): boolean;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface ApiError extends Error {
|
|
65
|
+
status?: number;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
interface TemplateResult {
|
|
69
|
+
content?: string | undefined;
|
|
70
|
+
error?: string | undefined;
|
|
71
|
+
message?: string | undefined;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface Template {
|
|
75
|
+
name: string;
|
|
76
|
+
file: string;
|
|
77
|
+
output: string;
|
|
78
|
+
description: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface ProjectConfig {
|
|
82
|
+
projectName?: string | undefined;
|
|
83
|
+
name?: string | undefined;
|
|
84
|
+
domain?: string | undefined;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const utils = require('../core/utils') as UtilsModule;
|
|
88
|
+
const projectState = require('../core/project-state') as ProjectStateModule;
|
|
89
|
+
const checkpointEngine = require('../core/checkpoint-engine') as CheckpointEngineModule;
|
|
90
|
+
const api = require('../core/api-client') as ApiModule;
|
|
91
|
+
const auth = require('../core/auth') as AuthModule;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Output directory for business docs
|
|
95
|
+
*/
|
|
96
|
+
const OUTPUT_DIR = 'planning';
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Available business templates
|
|
100
|
+
*/
|
|
101
|
+
const TEMPLATES: Record<string, Template> = {
|
|
102
|
+
plan: {
|
|
103
|
+
name: 'Business Plan',
|
|
104
|
+
file: 'business-plan.md',
|
|
105
|
+
output: 'BUSINESS_PLAN.md',
|
|
106
|
+
description: 'Comprehensive business plan template'
|
|
107
|
+
},
|
|
108
|
+
model: {
|
|
109
|
+
name: 'Business Model Canvas',
|
|
110
|
+
file: 'business-model-canvas.md',
|
|
111
|
+
output: 'BUSINESS_MODEL_CANVAS.md',
|
|
112
|
+
description: 'Visual business model framework'
|
|
113
|
+
},
|
|
114
|
+
competitors: {
|
|
115
|
+
name: 'Competitive Analysis',
|
|
116
|
+
file: 'competitive-analysis.md',
|
|
117
|
+
output: 'COMPETITIVE_ANALYSIS.md',
|
|
118
|
+
description: 'Competitor research and positioning'
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Get project config if available
|
|
124
|
+
*/
|
|
125
|
+
function getProjectConfig(): ProjectConfig {
|
|
126
|
+
const configPath = path.join(process.cwd(), 'bootspring.config.js');
|
|
127
|
+
if (fs.existsSync(configPath)) {
|
|
128
|
+
try {
|
|
129
|
+
return require(configPath) as ProjectConfig;
|
|
130
|
+
} catch {
|
|
131
|
+
return {};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return {};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Replace template variables
|
|
139
|
+
*/
|
|
140
|
+
function processTemplate(content: string, config: ProjectConfig): string {
|
|
141
|
+
const projectName = config.projectName || config.name || path.basename(process.cwd());
|
|
142
|
+
const date = new Date().toISOString().split('T')[0];
|
|
143
|
+
|
|
144
|
+
return content
|
|
145
|
+
.replace(/\{\{PROJECT_NAME\}\}/g, projectName)
|
|
146
|
+
.replace(/\{\{DATE\}\}/g, date || '')
|
|
147
|
+
.replace(/\{\{DOMAIN\}\}/g, config.domain || 'example.com');
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Fetch template content from API
|
|
152
|
+
*/
|
|
153
|
+
async function fetchTemplate(templateFile: string): Promise<TemplateResult> {
|
|
154
|
+
if (!auth.isAuthenticated()) {
|
|
155
|
+
return { error: 'auth_required' };
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
try {
|
|
159
|
+
const response = await api.getTemplate('business', templateFile);
|
|
160
|
+
return response;
|
|
161
|
+
} catch (error) {
|
|
162
|
+
const apiError = error as ApiError;
|
|
163
|
+
if (apiError.status === 401) {
|
|
164
|
+
return { error: 'auth_required' };
|
|
165
|
+
}
|
|
166
|
+
if (apiError.status === 403) {
|
|
167
|
+
return { error: 'upgrade_required' };
|
|
168
|
+
}
|
|
169
|
+
return { error: 'network_error', message: apiError.message };
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Initialize business planning docs
|
|
175
|
+
*/
|
|
176
|
+
async function businessInit(): Promise<void> {
|
|
177
|
+
console.log(`
|
|
178
|
+
${utils.COLORS.cyan}${utils.COLORS.bold}⚡ Business Planning${utils.COLORS.reset}
|
|
179
|
+
${utils.COLORS.dim}Initialize business planning documents${utils.COLORS.reset}
|
|
180
|
+
`);
|
|
181
|
+
|
|
182
|
+
// Check authentication
|
|
183
|
+
if (!auth.isAuthenticated()) {
|
|
184
|
+
utils.print.error('Authentication required');
|
|
185
|
+
console.log(`${utils.COLORS.dim}Run: bootspring auth login${utils.COLORS.reset}`);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const config = getProjectConfig();
|
|
190
|
+
const outputDir = path.join(process.cwd(), OUTPUT_DIR);
|
|
191
|
+
|
|
192
|
+
// Create output directory
|
|
193
|
+
if (!fs.existsSync(outputDir)) {
|
|
194
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const created: string[] = [];
|
|
198
|
+
const skipped: string[] = [];
|
|
199
|
+
const failed: Array<{ name: string; error: string }> = [];
|
|
200
|
+
|
|
201
|
+
const spinner = utils.createSpinner('Loading templates...');
|
|
202
|
+
spinner.start();
|
|
203
|
+
|
|
204
|
+
// Create all business templates
|
|
205
|
+
for (const [_key, template] of Object.entries(TEMPLATES)) {
|
|
206
|
+
const outputPath = path.join(outputDir, template.output);
|
|
207
|
+
|
|
208
|
+
if (fs.existsSync(outputPath)) {
|
|
209
|
+
skipped.push(template.name);
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const result = await fetchTemplate(template.file);
|
|
214
|
+
|
|
215
|
+
if (result.error) {
|
|
216
|
+
failed.push({ name: template.name, error: result.error });
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const processed = processTemplate(result.content || '', config);
|
|
221
|
+
fs.writeFileSync(outputPath, processed);
|
|
222
|
+
created.push(template.name);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
spinner.stop();
|
|
226
|
+
|
|
227
|
+
if (created.length > 0) {
|
|
228
|
+
console.log(`${utils.COLORS.bold}Created:${utils.COLORS.reset}`);
|
|
229
|
+
for (const name of created) {
|
|
230
|
+
console.log(` ${utils.COLORS.green}✓${utils.COLORS.reset} ${name}`);
|
|
231
|
+
}
|
|
232
|
+
console.log();
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (skipped.length > 0) {
|
|
236
|
+
console.log(`${utils.COLORS.bold}Skipped (already exist):${utils.COLORS.reset}`);
|
|
237
|
+
for (const name of skipped) {
|
|
238
|
+
console.log(` ${utils.COLORS.dim}●${utils.COLORS.reset} ${name}`);
|
|
239
|
+
}
|
|
240
|
+
console.log();
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (failed.length > 0) {
|
|
244
|
+
console.log(`${utils.COLORS.bold}Failed:${utils.COLORS.reset}`);
|
|
245
|
+
for (const { name, error } of failed) {
|
|
246
|
+
console.log(` ${utils.COLORS.red}✗${utils.COLORS.reset} ${name} (${error})`);
|
|
247
|
+
}
|
|
248
|
+
console.log();
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Auto-tag project as business type
|
|
252
|
+
try {
|
|
253
|
+
const businessType = projectState.PROJECT_TYPES.BUSINESS || 'business';
|
|
254
|
+
projectState.setProjectType(process.cwd(), businessType, {
|
|
255
|
+
autoTagged: true,
|
|
256
|
+
taggedBy: 'business-init'
|
|
257
|
+
});
|
|
258
|
+
checkpointEngine.syncCheckpoints(process.cwd(), { verbose: false });
|
|
259
|
+
utils.print.success('Project tagged as business type');
|
|
260
|
+
} catch (err) {
|
|
261
|
+
utils.print.debug(`Auto-tagging failed: ${(err as Error).message}`);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
console.log(`${utils.COLORS.bold}Next Steps:${utils.COLORS.reset}`);
|
|
265
|
+
console.log(` 1. Edit ${utils.COLORS.cyan}${OUTPUT_DIR}/BUSINESS_PLAN.md${utils.COLORS.reset}`);
|
|
266
|
+
console.log(` 2. Run ${utils.COLORS.cyan}bootspring agent invoke business-strategy-expert${utils.COLORS.reset}`);
|
|
267
|
+
console.log(` 3. Run ${utils.COLORS.cyan}bootspring business status${utils.COLORS.reset} to check progress`);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Create or edit a specific business document
|
|
272
|
+
*/
|
|
273
|
+
async function businessCreate(templateKey: string): Promise<void> {
|
|
274
|
+
const template = TEMPLATES[templateKey];
|
|
275
|
+
|
|
276
|
+
if (!template) {
|
|
277
|
+
utils.print.error(`Unknown template: ${templateKey}`);
|
|
278
|
+
console.log(`\nAvailable templates: ${Object.keys(TEMPLATES).join(', ')}`);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
console.log(`
|
|
283
|
+
${utils.COLORS.cyan}${utils.COLORS.bold}⚡ ${template.name}${utils.COLORS.reset}
|
|
284
|
+
${utils.COLORS.dim}${template.description}${utils.COLORS.reset}
|
|
285
|
+
`);
|
|
286
|
+
|
|
287
|
+
// Check authentication
|
|
288
|
+
if (!auth.isAuthenticated()) {
|
|
289
|
+
utils.print.error('Authentication required');
|
|
290
|
+
console.log(`${utils.COLORS.dim}Run: bootspring auth login${utils.COLORS.reset}`);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const config = getProjectConfig();
|
|
295
|
+
const outputDir = path.join(process.cwd(), OUTPUT_DIR);
|
|
296
|
+
const outputPath = path.join(outputDir, template.output);
|
|
297
|
+
|
|
298
|
+
// Create output directory
|
|
299
|
+
if (!fs.existsSync(outputDir)) {
|
|
300
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if (fs.existsSync(outputPath)) {
|
|
304
|
+
utils.print.warning(`File already exists: ${OUTPUT_DIR}/${template.output}`);
|
|
305
|
+
console.log(`Edit it directly or use ${utils.COLORS.cyan}bootspring business show ${templateKey}${utils.COLORS.reset}`);
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
const spinner = utils.createSpinner('Loading template...');
|
|
310
|
+
spinner.start();
|
|
311
|
+
|
|
312
|
+
const result = await fetchTemplate(template.file);
|
|
313
|
+
|
|
314
|
+
if (result.error === 'auth_required') {
|
|
315
|
+
spinner.fail('Authentication required');
|
|
316
|
+
console.log(`${utils.COLORS.dim}Run: bootspring auth login${utils.COLORS.reset}`);
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (result.error === 'upgrade_required') {
|
|
321
|
+
spinner.fail('Upgrade required');
|
|
322
|
+
console.log(`${utils.COLORS.dim}This template requires a Pro subscription.${utils.COLORS.reset}`);
|
|
323
|
+
console.log(`${utils.COLORS.dim}Run: bootspring billing upgrade${utils.COLORS.reset}`);
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
if (result.error) {
|
|
328
|
+
spinner.fail('Failed to load template');
|
|
329
|
+
console.log(`${utils.COLORS.dim}${result.message || 'Check your internet connection.'}${utils.COLORS.reset}`);
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
spinner.succeed('Template loaded');
|
|
334
|
+
|
|
335
|
+
const processed = processTemplate(result.content || '', config);
|
|
336
|
+
fs.writeFileSync(outputPath, processed);
|
|
337
|
+
|
|
338
|
+
utils.print.success(`Created ${template.name}`);
|
|
339
|
+
console.log(`\nFile: ${utils.COLORS.cyan}${OUTPUT_DIR}/${template.output}${utils.COLORS.reset}`);
|
|
340
|
+
console.log(`\n${utils.COLORS.bold}Next Steps:${utils.COLORS.reset}`);
|
|
341
|
+
console.log(' 1. Open and edit the document');
|
|
342
|
+
console.log(' 2. Use AI agents for assistance:');
|
|
343
|
+
console.log(` ${utils.COLORS.cyan}bootspring agent invoke business-strategy-expert${utils.COLORS.reset}`);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Show status of business documents
|
|
348
|
+
*/
|
|
349
|
+
function businessStatus(): void {
|
|
350
|
+
console.log(`
|
|
351
|
+
${utils.COLORS.cyan}${utils.COLORS.bold}⚡ Business Planning Status${utils.COLORS.reset}
|
|
352
|
+
`);
|
|
353
|
+
|
|
354
|
+
const outputDir = path.join(process.cwd(), OUTPUT_DIR);
|
|
355
|
+
let found = 0;
|
|
356
|
+
const total = Object.keys(TEMPLATES).length;
|
|
357
|
+
|
|
358
|
+
for (const [key, template] of Object.entries(TEMPLATES)) {
|
|
359
|
+
const outputPath = path.join(outputDir, template.output);
|
|
360
|
+
const exists = fs.existsSync(outputPath);
|
|
361
|
+
|
|
362
|
+
if (exists) {
|
|
363
|
+
found++;
|
|
364
|
+
const stats = fs.statSync(outputPath);
|
|
365
|
+
const modified = stats.mtime.toISOString().split('T')[0];
|
|
366
|
+
const size = Math.round(stats.size / 1024);
|
|
367
|
+
|
|
368
|
+
console.log(` ${utils.COLORS.green}✓${utils.COLORS.reset} ${template.name}`);
|
|
369
|
+
console.log(` ${utils.COLORS.dim}${OUTPUT_DIR}/${template.output} (${size}KB, modified ${modified})${utils.COLORS.reset}`);
|
|
370
|
+
} else {
|
|
371
|
+
console.log(` ${utils.COLORS.yellow}○${utils.COLORS.reset} ${template.name}`);
|
|
372
|
+
console.log(` ${utils.COLORS.dim}Not created - run: bootspring business ${key}${utils.COLORS.reset}`);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
console.log();
|
|
377
|
+
console.log(`${utils.COLORS.bold}Progress:${utils.COLORS.reset} ${found}/${total} documents created`);
|
|
378
|
+
|
|
379
|
+
if (found < total) {
|
|
380
|
+
console.log(`\n${utils.COLORS.bold}Create Missing:${utils.COLORS.reset}`);
|
|
381
|
+
console.log(` ${utils.COLORS.cyan}bootspring business init${utils.COLORS.reset} - Create all documents`);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Show a business document
|
|
387
|
+
*/
|
|
388
|
+
function businessShow(templateKey: string): void {
|
|
389
|
+
const template = TEMPLATES[templateKey];
|
|
390
|
+
|
|
391
|
+
if (!template) {
|
|
392
|
+
utils.print.error(`Unknown template: ${templateKey}`);
|
|
393
|
+
console.log(`\nAvailable templates: ${Object.keys(TEMPLATES).join(', ')}`);
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
const outputPath = path.join(process.cwd(), OUTPUT_DIR, template.output);
|
|
398
|
+
|
|
399
|
+
if (!fs.existsSync(outputPath)) {
|
|
400
|
+
utils.print.warning(`${template.name} not created yet`);
|
|
401
|
+
console.log(`\nRun: ${utils.COLORS.cyan}bootspring business ${templateKey}${utils.COLORS.reset}`);
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
const content = fs.readFileSync(outputPath, 'utf-8');
|
|
406
|
+
|
|
407
|
+
console.log(`
|
|
408
|
+
${utils.COLORS.cyan}${utils.COLORS.bold}⚡ ${template.name}${utils.COLORS.reset}
|
|
409
|
+
${utils.COLORS.dim}${OUTPUT_DIR}/${template.output}${utils.COLORS.reset}
|
|
410
|
+
`);
|
|
411
|
+
|
|
412
|
+
// Show first 50 lines as preview
|
|
413
|
+
const lines = content.split('\n').slice(0, 50);
|
|
414
|
+
console.log(lines.join('\n'));
|
|
415
|
+
|
|
416
|
+
if (content.split('\n').length > 50) {
|
|
417
|
+
console.log(`\n${utils.COLORS.dim}... (${content.split('\n').length - 50} more lines)${utils.COLORS.reset}`);
|
|
418
|
+
console.log(`${utils.COLORS.dim}Open the full file to see more${utils.COLORS.reset}`);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Show help
|
|
424
|
+
*/
|
|
425
|
+
function showHelp(): void {
|
|
426
|
+
console.log(`
|
|
427
|
+
${utils.COLORS.cyan}${utils.COLORS.bold}⚡ Bootspring Business${utils.COLORS.reset}
|
|
428
|
+
${utils.COLORS.dim}Business planning and strategy tools${utils.COLORS.reset}
|
|
429
|
+
|
|
430
|
+
${utils.COLORS.bold}Usage:${utils.COLORS.reset}
|
|
431
|
+
bootspring business <command> [options]
|
|
432
|
+
|
|
433
|
+
${utils.COLORS.bold}Commands:${utils.COLORS.reset}
|
|
434
|
+
${utils.COLORS.cyan}init${utils.COLORS.reset} Initialize all business planning documents
|
|
435
|
+
${utils.COLORS.cyan}plan${utils.COLORS.reset} Create business plan
|
|
436
|
+
${utils.COLORS.cyan}model${utils.COLORS.reset} Create business model canvas
|
|
437
|
+
${utils.COLORS.cyan}competitors${utils.COLORS.reset} Create competitive analysis
|
|
438
|
+
${utils.COLORS.cyan}status${utils.COLORS.reset} Show status of business documents
|
|
439
|
+
${utils.COLORS.cyan}show${utils.COLORS.reset} <type> Preview a business document
|
|
440
|
+
|
|
441
|
+
${utils.COLORS.bold}Examples:${utils.COLORS.reset}
|
|
442
|
+
bootspring business init # Create all business docs
|
|
443
|
+
bootspring business plan # Create business plan
|
|
444
|
+
bootspring business competitors # Create competitive analysis
|
|
445
|
+
bootspring business status # Check progress
|
|
446
|
+
bootspring business show plan # Preview business plan
|
|
447
|
+
|
|
448
|
+
${utils.COLORS.bold}Related Agents:${utils.COLORS.reset}
|
|
449
|
+
${utils.COLORS.cyan}business-strategy-expert${utils.COLORS.reset} Strategy and positioning
|
|
450
|
+
${utils.COLORS.cyan}financial-expert${utils.COLORS.reset} Financial modeling
|
|
451
|
+
${utils.COLORS.cyan}competitive-analysis-expert${utils.COLORS.reset} Market research
|
|
452
|
+
${utils.COLORS.cyan}marketing-expert${utils.COLORS.reset} Go-to-market strategy
|
|
453
|
+
`);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Run business command
|
|
458
|
+
*/
|
|
459
|
+
export async function run(args: string[]): Promise<void> {
|
|
460
|
+
const subcommand = args[0] || 'help';
|
|
461
|
+
|
|
462
|
+
switch (subcommand) {
|
|
463
|
+
case 'init':
|
|
464
|
+
await businessInit();
|
|
465
|
+
break;
|
|
466
|
+
|
|
467
|
+
case 'plan':
|
|
468
|
+
await businessCreate('plan');
|
|
469
|
+
break;
|
|
470
|
+
|
|
471
|
+
case 'model':
|
|
472
|
+
await businessCreate('model');
|
|
473
|
+
break;
|
|
474
|
+
|
|
475
|
+
case 'competitors':
|
|
476
|
+
case 'competitive':
|
|
477
|
+
await businessCreate('competitors');
|
|
478
|
+
break;
|
|
479
|
+
|
|
480
|
+
case 'status':
|
|
481
|
+
businessStatus();
|
|
482
|
+
break;
|
|
483
|
+
|
|
484
|
+
case 'show':
|
|
485
|
+
if (!args[1]) {
|
|
486
|
+
utils.print.error('Please specify a document type');
|
|
487
|
+
console.log(`Usage: ${utils.COLORS.cyan}bootspring business show <plan|model|competitors>${utils.COLORS.reset}`);
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
businessShow(args[1]);
|
|
491
|
+
break;
|
|
492
|
+
|
|
493
|
+
case 'help':
|
|
494
|
+
case '-h':
|
|
495
|
+
case '--help':
|
|
496
|
+
showHelp();
|
|
497
|
+
break;
|
|
498
|
+
|
|
499
|
+
default:
|
|
500
|
+
// Check if it's a template name
|
|
501
|
+
if (TEMPLATES[subcommand]) {
|
|
502
|
+
await businessCreate(subcommand);
|
|
503
|
+
} else {
|
|
504
|
+
utils.print.error(`Unknown subcommand: ${subcommand}`);
|
|
505
|
+
showHelp();
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|