@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.
- package/cli/preseed/index.js +16 -0
- package/cli/preseed/interactive.js +143 -0
- package/cli/preseed/templates.js +227 -0
- 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/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 +20 -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/mcp/contracts/mcp-contract.v1.json +1 -1
- package/package.json +16 -3
- package/src/cli/agent.ts +703 -0
- package/src/cli/analyze.ts +640 -0
- package/src/cli/audit.ts +707 -0
- package/src/cli/auth.ts +930 -0
- package/src/cli/billing.ts +364 -0
- package/src/cli/build.ts +1089 -0
- package/src/cli/business.ts +508 -0
- package/src/cli/checkpoint-utils.ts +236 -0
- package/src/cli/checkpoint.ts +757 -0
- package/src/cli/cloud-sync.ts +534 -0
- package/src/cli/content.ts +273 -0
- package/src/cli/context.ts +667 -0
- package/src/cli/dashboard.ts +133 -0
- package/src/cli/deploy.ts +704 -0
- package/src/cli/doctor.ts +480 -0
- package/src/cli/fundraise.ts +494 -0
- package/src/cli/generate.ts +346 -0
- package/src/cli/github-cmd.ts +566 -0
- package/src/cli/health.ts +599 -0
- package/src/cli/index.ts +113 -0
- package/src/cli/init.ts +838 -0
- package/src/cli/legal.ts +495 -0
- package/src/cli/log.ts +316 -0
- package/src/cli/loop.ts +1660 -0
- package/src/cli/manager.ts +878 -0
- package/src/cli/mcp.ts +275 -0
- package/src/cli/memory.ts +346 -0
- package/src/cli/metrics.ts +590 -0
- package/src/cli/monitor.ts +960 -0
- package/src/cli/mvp.ts +662 -0
- package/src/cli/onboard.ts +663 -0
- package/src/cli/orchestrator.ts +622 -0
- package/src/cli/plugin.ts +483 -0
- package/src/cli/prd.ts +671 -0
- package/src/cli/preseed-start.ts +1633 -0
- package/src/cli/preseed.ts +2434 -0
- package/src/cli/project.ts +526 -0
- package/src/cli/quality.ts +885 -0
- package/src/cli/security.ts +1079 -0
- package/src/cli/seed.ts +1224 -0
- package/src/cli/skill.ts +537 -0
- package/src/cli/suggest.ts +1225 -0
- package/src/cli/switch.ts +518 -0
- package/src/cli/task.ts +780 -0
- package/src/cli/telemetry.ts +172 -0
- package/src/cli/todo.ts +627 -0
- package/src/cli/types.ts +15 -0
- package/src/cli/update.ts +334 -0
- package/src/cli/visualize.ts +609 -0
- package/src/cli/watch.ts +895 -0
- package/src/cli/workspace.ts +709 -0
- package/src/core/action-recorder.ts +673 -0
- package/src/core/analyze-workflow.ts +1453 -0
- package/src/core/api-client.ts +1120 -0
- package/src/core/audit-workflow.ts +1681 -0
- package/src/core/auth.ts +471 -0
- package/src/core/build-orchestrator.ts +509 -0
- package/src/core/build-state.ts +621 -0
- package/src/core/checkpoint-engine.ts +482 -0
- package/src/core/config.ts +1285 -0
- package/src/core/context-loader.ts +694 -0
- package/src/core/context.ts +410 -0
- package/src/core/deploy-workflow.ts +1085 -0
- package/src/core/entitlements.ts +322 -0
- package/src/core/github-sync.ts +720 -0
- package/src/core/index.ts +981 -0
- package/src/core/ingest.ts +1186 -0
- package/src/core/metrics-engine.ts +886 -0
- package/src/core/mvp.ts +847 -0
- package/src/core/onboard-workflow.ts +1293 -0
- package/src/core/policies.ts +81 -0
- package/src/core/preseed-workflow.ts +1163 -0
- package/src/core/preseed.ts +1826 -0
- package/src/core/project-context.ts +380 -0
- package/src/core/project-state.ts +699 -0
- package/src/core/r2-sync.ts +691 -0
- package/src/core/scaffold.ts +1715 -0
- package/src/core/session.ts +286 -0
- package/src/core/task-extractor.ts +799 -0
- package/src/core/telemetry.ts +371 -0
- package/src/core/tier-enforcement.ts +737 -0
- package/src/core/utils.ts +437 -0
- package/src/index.ts +29 -0
- package/src/intelligence/agent-collab.ts +2376 -0
- package/src/intelligence/auto-suggest.ts +713 -0
- package/src/intelligence/content-gen.ts +1351 -0
- package/src/intelligence/cross-project.ts +1692 -0
- package/src/intelligence/git-memory.ts +529 -0
- package/src/intelligence/index.ts +318 -0
- package/src/intelligence/orchestrator.ts +534 -0
- package/src/intelligence/prd.ts +466 -0
- package/src/intelligence/recommendations.ts +982 -0
- package/src/intelligence/workflow-composer.ts +1472 -0
- package/src/mcp/capabilities.ts +233 -0
- package/src/mcp/index.ts +37 -0
- package/src/mcp/registry.ts +1268 -0
- package/src/mcp/response-formatter.ts +797 -0
- package/src/mcp/server.ts +240 -0
- package/src/types/agent.ts +69 -0
- package/src/types/config.ts +86 -0
- package/src/types/context.ts +77 -0
- package/src/types/index.ts +53 -0
- package/src/types/mcp.ts +91 -0
- package/src/types/skills.ts +47 -0
- package/src/types/workflow.ts +155 -0
- package/generators/index.js +0 -18
package/src/cli/legal.ts
ADDED
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bootspring Legal Command
|
|
3
|
+
* Legal documents and compliance tools
|
|
4
|
+
*
|
|
5
|
+
* @package bootspring
|
|
6
|
+
* @command legal
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import * as fs from 'fs';
|
|
10
|
+
import * as path from 'path';
|
|
11
|
+
|
|
12
|
+
// Type interfaces for JS modules
|
|
13
|
+
interface Colors {
|
|
14
|
+
reset: string;
|
|
15
|
+
bold: string;
|
|
16
|
+
dim: string;
|
|
17
|
+
cyan: string;
|
|
18
|
+
green: string;
|
|
19
|
+
yellow: string;
|
|
20
|
+
red: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface PrintModule {
|
|
24
|
+
error(msg: string): void;
|
|
25
|
+
dim(msg: string): void;
|
|
26
|
+
warning(msg: string): void;
|
|
27
|
+
success(msg: string): void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface Spinner {
|
|
31
|
+
start(): Spinner;
|
|
32
|
+
stop(): void;
|
|
33
|
+
succeed(text: string): void;
|
|
34
|
+
fail(text: string): void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface UtilsModule {
|
|
38
|
+
COLORS: Colors;
|
|
39
|
+
print: PrintModule;
|
|
40
|
+
createSpinner(text: string): Spinner;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface AuthModule {
|
|
44
|
+
isAuthenticated(): boolean;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface ApiModule {
|
|
48
|
+
getTemplate(category: string, templateFile: string): Promise<TemplateResponse>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface TemplateResponse {
|
|
52
|
+
content: string;
|
|
53
|
+
error?: string | undefined;
|
|
54
|
+
message?: string | undefined;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface FetchTemplateResult {
|
|
58
|
+
content?: string | undefined;
|
|
59
|
+
error?: string | undefined;
|
|
60
|
+
message?: string | undefined;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
interface Template {
|
|
64
|
+
name: string;
|
|
65
|
+
file: string;
|
|
66
|
+
output: string;
|
|
67
|
+
description: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
interface FailedTemplate {
|
|
71
|
+
name: string;
|
|
72
|
+
error: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
interface ProjectConfig {
|
|
76
|
+
projectName?: string | undefined;
|
|
77
|
+
name?: string | undefined;
|
|
78
|
+
domain?: string | undefined;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const utils = require('../core/utils') as UtilsModule;
|
|
82
|
+
const api = require('../core/api-client') as ApiModule;
|
|
83
|
+
const auth = require('../core/auth') as AuthModule;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Output directory for legal docs
|
|
87
|
+
*/
|
|
88
|
+
const OUTPUT_DIR = 'legal';
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Available legal templates
|
|
92
|
+
*/
|
|
93
|
+
const TEMPLATES: Record<string, Template> = {
|
|
94
|
+
terms: {
|
|
95
|
+
name: 'Terms of Service',
|
|
96
|
+
file: 'terms-of-service.md',
|
|
97
|
+
output: 'TERMS_OF_SERVICE.md',
|
|
98
|
+
description: 'Website/app terms of service template'
|
|
99
|
+
},
|
|
100
|
+
privacy: {
|
|
101
|
+
name: 'Privacy Policy',
|
|
102
|
+
file: 'privacy-policy.md',
|
|
103
|
+
output: 'PRIVACY_POLICY.md',
|
|
104
|
+
description: 'Privacy policy with GDPR/CCPA considerations'
|
|
105
|
+
},
|
|
106
|
+
gdpr: {
|
|
107
|
+
name: 'GDPR Compliance Checklist',
|
|
108
|
+
file: 'gdpr-checklist.md',
|
|
109
|
+
output: 'GDPR_CHECKLIST.md',
|
|
110
|
+
description: 'GDPR compliance requirements checklist'
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Get project config if available
|
|
116
|
+
*/
|
|
117
|
+
function getProjectConfig(): ProjectConfig {
|
|
118
|
+
const configPath = path.join(process.cwd(), 'bootspring.config.js');
|
|
119
|
+
if (fs.existsSync(configPath)) {
|
|
120
|
+
try {
|
|
121
|
+
return require(configPath) as ProjectConfig;
|
|
122
|
+
} catch {
|
|
123
|
+
return {};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return {};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Replace template variables
|
|
131
|
+
*/
|
|
132
|
+
function processTemplate(content: string, config: ProjectConfig): string {
|
|
133
|
+
const projectName = config.projectName || config.name || path.basename(process.cwd());
|
|
134
|
+
const date = new Date().toISOString().split('T')[0] || '';
|
|
135
|
+
|
|
136
|
+
return content
|
|
137
|
+
.replace(/\{\{PROJECT_NAME\}\}/g, projectName)
|
|
138
|
+
.replace(/\{\{DATE\}\}/g, date)
|
|
139
|
+
.replace(/\{\{DOMAIN\}\}/g, config.domain || 'example.com');
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Fetch template content from API
|
|
144
|
+
*/
|
|
145
|
+
async function fetchTemplate(templateFile: string): Promise<FetchTemplateResult> {
|
|
146
|
+
if (!auth.isAuthenticated()) {
|
|
147
|
+
return { error: 'auth_required' };
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
try {
|
|
151
|
+
const response = await api.getTemplate('legal', templateFile);
|
|
152
|
+
return response;
|
|
153
|
+
} catch (error) {
|
|
154
|
+
const err = error as { status?: number; message?: string };
|
|
155
|
+
if (err.status === 401) {
|
|
156
|
+
return { error: 'auth_required' };
|
|
157
|
+
}
|
|
158
|
+
if (err.status === 403) {
|
|
159
|
+
return { error: 'upgrade_required' };
|
|
160
|
+
}
|
|
161
|
+
return { error: 'network_error', message: err.message };
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Initialize legal docs
|
|
167
|
+
*/
|
|
168
|
+
async function legalInit(): Promise<void> {
|
|
169
|
+
console.log(`
|
|
170
|
+
${utils.COLORS.cyan}${utils.COLORS.bold}⚡ Legal Documents${utils.COLORS.reset}
|
|
171
|
+
${utils.COLORS.dim}Initialize legal documents and compliance checklists${utils.COLORS.reset}
|
|
172
|
+
`);
|
|
173
|
+
|
|
174
|
+
// Check authentication
|
|
175
|
+
if (!auth.isAuthenticated()) {
|
|
176
|
+
utils.print.error('Authentication required');
|
|
177
|
+
console.log(`${utils.COLORS.dim}Run: bootspring auth login${utils.COLORS.reset}`);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const config = getProjectConfig();
|
|
182
|
+
const outputDir = path.join(process.cwd(), OUTPUT_DIR);
|
|
183
|
+
|
|
184
|
+
// Create output directory
|
|
185
|
+
if (!fs.existsSync(outputDir)) {
|
|
186
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const created: string[] = [];
|
|
190
|
+
const skipped: string[] = [];
|
|
191
|
+
const failed: FailedTemplate[] = [];
|
|
192
|
+
|
|
193
|
+
const spinner = utils.createSpinner('Loading templates...');
|
|
194
|
+
spinner.start();
|
|
195
|
+
|
|
196
|
+
// Create all legal templates
|
|
197
|
+
for (const [_key, template] of Object.entries(TEMPLATES)) {
|
|
198
|
+
const outputPath = path.join(outputDir, template.output);
|
|
199
|
+
|
|
200
|
+
if (fs.existsSync(outputPath)) {
|
|
201
|
+
skipped.push(template.name);
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const result = await fetchTemplate(template.file);
|
|
206
|
+
|
|
207
|
+
if (result.error) {
|
|
208
|
+
failed.push({ name: template.name, error: result.error });
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (result.content) {
|
|
213
|
+
const processed = processTemplate(result.content, config);
|
|
214
|
+
fs.writeFileSync(outputPath, processed);
|
|
215
|
+
created.push(template.name);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
spinner.stop();
|
|
220
|
+
|
|
221
|
+
if (created.length > 0) {
|
|
222
|
+
console.log(`${utils.COLORS.bold}Created:${utils.COLORS.reset}`);
|
|
223
|
+
for (const name of created) {
|
|
224
|
+
console.log(` ${utils.COLORS.green}✓${utils.COLORS.reset} ${name}`);
|
|
225
|
+
}
|
|
226
|
+
console.log();
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (skipped.length > 0) {
|
|
230
|
+
console.log(`${utils.COLORS.bold}Skipped (already exist):${utils.COLORS.reset}`);
|
|
231
|
+
for (const name of skipped) {
|
|
232
|
+
console.log(` ${utils.COLORS.dim}●${utils.COLORS.reset} ${name}`);
|
|
233
|
+
}
|
|
234
|
+
console.log();
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (failed.length > 0) {
|
|
238
|
+
console.log(`${utils.COLORS.bold}Failed:${utils.COLORS.reset}`);
|
|
239
|
+
for (const { name, error } of failed) {
|
|
240
|
+
console.log(` ${utils.COLORS.red}✗${utils.COLORS.reset} ${name} (${error})`);
|
|
241
|
+
}
|
|
242
|
+
console.log();
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
console.log(`${utils.COLORS.yellow}${utils.COLORS.bold}⚠ Disclaimer${utils.COLORS.reset}`);
|
|
246
|
+
console.log(`${utils.COLORS.dim}These templates are for guidance only. Consult a lawyer for your specific needs.${utils.COLORS.reset}`);
|
|
247
|
+
|
|
248
|
+
console.log(`\n${utils.COLORS.bold}Next Steps:${utils.COLORS.reset}`);
|
|
249
|
+
console.log(' 1. Edit templates with your company information');
|
|
250
|
+
console.log(` 2. Run ${utils.COLORS.cyan}bootspring agent invoke legal-expert${utils.COLORS.reset} for guidance`);
|
|
251
|
+
console.log(' 3. Have documents reviewed by legal counsel');
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Create a specific legal document
|
|
256
|
+
*/
|
|
257
|
+
async function legalCreate(templateKey: string): Promise<void> {
|
|
258
|
+
const template = TEMPLATES[templateKey];
|
|
259
|
+
|
|
260
|
+
if (!template) {
|
|
261
|
+
utils.print.error(`Unknown template: ${templateKey}`);
|
|
262
|
+
console.log(`\nAvailable templates: ${Object.keys(TEMPLATES).join(', ')}`);
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
console.log(`
|
|
267
|
+
${utils.COLORS.cyan}${utils.COLORS.bold}⚡ ${template.name}${utils.COLORS.reset}
|
|
268
|
+
${utils.COLORS.dim}${template.description}${utils.COLORS.reset}
|
|
269
|
+
`);
|
|
270
|
+
|
|
271
|
+
// Check authentication
|
|
272
|
+
if (!auth.isAuthenticated()) {
|
|
273
|
+
utils.print.error('Authentication required');
|
|
274
|
+
console.log(`${utils.COLORS.dim}Run: bootspring auth login${utils.COLORS.reset}`);
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const config = getProjectConfig();
|
|
279
|
+
const outputDir = path.join(process.cwd(), OUTPUT_DIR);
|
|
280
|
+
const outputPath = path.join(outputDir, template.output);
|
|
281
|
+
|
|
282
|
+
// Create output directory
|
|
283
|
+
if (!fs.existsSync(outputDir)) {
|
|
284
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
if (fs.existsSync(outputPath)) {
|
|
288
|
+
utils.print.warning(`File already exists: ${OUTPUT_DIR}/${template.output}`);
|
|
289
|
+
console.log(`Edit it directly or use ${utils.COLORS.cyan}bootspring legal show ${templateKey}${utils.COLORS.reset}`);
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const spinner = utils.createSpinner('Loading template...');
|
|
294
|
+
spinner.start();
|
|
295
|
+
|
|
296
|
+
const result = await fetchTemplate(template.file);
|
|
297
|
+
|
|
298
|
+
if (result.error === 'auth_required') {
|
|
299
|
+
spinner.fail('Authentication required');
|
|
300
|
+
console.log(`${utils.COLORS.dim}Run: bootspring auth login${utils.COLORS.reset}`);
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
if (result.error === 'upgrade_required') {
|
|
305
|
+
spinner.fail('Upgrade required');
|
|
306
|
+
console.log(`${utils.COLORS.dim}This template requires a Pro subscription.${utils.COLORS.reset}`);
|
|
307
|
+
console.log(`${utils.COLORS.dim}Run: bootspring billing upgrade${utils.COLORS.reset}`);
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
if (result.error) {
|
|
312
|
+
spinner.fail('Failed to load template');
|
|
313
|
+
console.log(`${utils.COLORS.dim}${result.message || 'Check your internet connection.'}${utils.COLORS.reset}`);
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
spinner.succeed('Template loaded');
|
|
318
|
+
|
|
319
|
+
if (result.content) {
|
|
320
|
+
const processed = processTemplate(result.content, config);
|
|
321
|
+
fs.writeFileSync(outputPath, processed);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
utils.print.success(`Created ${template.name}`);
|
|
325
|
+
console.log(`\nFile: ${utils.COLORS.cyan}${OUTPUT_DIR}/${template.output}${utils.COLORS.reset}`);
|
|
326
|
+
|
|
327
|
+
console.log(`\n${utils.COLORS.yellow}${utils.COLORS.bold}⚠ Disclaimer${utils.COLORS.reset}`);
|
|
328
|
+
console.log(`${utils.COLORS.dim}This template is for guidance only. Consult a lawyer.${utils.COLORS.reset}`);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Show status of legal documents
|
|
333
|
+
*/
|
|
334
|
+
function legalStatus(): void {
|
|
335
|
+
console.log(`
|
|
336
|
+
${utils.COLORS.cyan}${utils.COLORS.bold}⚡ Legal Documents Status${utils.COLORS.reset}
|
|
337
|
+
`);
|
|
338
|
+
|
|
339
|
+
const outputDir = path.join(process.cwd(), OUTPUT_DIR);
|
|
340
|
+
let found = 0;
|
|
341
|
+
const total = Object.keys(TEMPLATES).length;
|
|
342
|
+
|
|
343
|
+
for (const [key, template] of Object.entries(TEMPLATES)) {
|
|
344
|
+
const outputPath = path.join(outputDir, template.output);
|
|
345
|
+
const exists = fs.existsSync(outputPath);
|
|
346
|
+
|
|
347
|
+
if (exists) {
|
|
348
|
+
found++;
|
|
349
|
+
const stats = fs.statSync(outputPath);
|
|
350
|
+
const modified = stats.mtime.toISOString().split('T')[0] || '';
|
|
351
|
+
const size = Math.round(stats.size / 1024);
|
|
352
|
+
|
|
353
|
+
console.log(` ${utils.COLORS.green}✓${utils.COLORS.reset} ${template.name}`);
|
|
354
|
+
console.log(` ${utils.COLORS.dim}${OUTPUT_DIR}/${template.output} (${size}KB, modified ${modified})${utils.COLORS.reset}`);
|
|
355
|
+
} else {
|
|
356
|
+
console.log(` ${utils.COLORS.yellow}○${utils.COLORS.reset} ${template.name}`);
|
|
357
|
+
console.log(` ${utils.COLORS.dim}Not created - run: bootspring legal ${key}${utils.COLORS.reset}`);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
console.log();
|
|
362
|
+
console.log(`${utils.COLORS.bold}Progress:${utils.COLORS.reset} ${found}/${total} documents created`);
|
|
363
|
+
|
|
364
|
+
if (found < total) {
|
|
365
|
+
console.log(`\n${utils.COLORS.bold}Create Missing:${utils.COLORS.reset}`);
|
|
366
|
+
console.log(` ${utils.COLORS.cyan}bootspring legal init${utils.COLORS.reset} - Create all documents`);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Show a legal document
|
|
372
|
+
*/
|
|
373
|
+
function legalShow(templateKey: string): void {
|
|
374
|
+
const template = TEMPLATES[templateKey];
|
|
375
|
+
|
|
376
|
+
if (!template) {
|
|
377
|
+
utils.print.error(`Unknown template: ${templateKey}`);
|
|
378
|
+
console.log(`\nAvailable templates: ${Object.keys(TEMPLATES).join(', ')}`);
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
const outputPath = path.join(process.cwd(), OUTPUT_DIR, template.output);
|
|
383
|
+
|
|
384
|
+
if (!fs.existsSync(outputPath)) {
|
|
385
|
+
utils.print.warning(`${template.name} not created yet`);
|
|
386
|
+
console.log(`\nRun: ${utils.COLORS.cyan}bootspring legal ${templateKey}${utils.COLORS.reset}`);
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
const content = fs.readFileSync(outputPath, 'utf-8');
|
|
391
|
+
|
|
392
|
+
console.log(`
|
|
393
|
+
${utils.COLORS.cyan}${utils.COLORS.bold}⚡ ${template.name}${utils.COLORS.reset}
|
|
394
|
+
${utils.COLORS.dim}${OUTPUT_DIR}/${template.output}${utils.COLORS.reset}
|
|
395
|
+
`);
|
|
396
|
+
|
|
397
|
+
// Show first 50 lines as preview
|
|
398
|
+
const lines = content.split('\n').slice(0, 50);
|
|
399
|
+
console.log(lines.join('\n'));
|
|
400
|
+
|
|
401
|
+
if (content.split('\n').length > 50) {
|
|
402
|
+
console.log(`\n${utils.COLORS.dim}... (${content.split('\n').length - 50} more lines)${utils.COLORS.reset}`);
|
|
403
|
+
console.log(`${utils.COLORS.dim}Open the full file to see more${utils.COLORS.reset}`);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Show help
|
|
409
|
+
*/
|
|
410
|
+
function showHelp(): void {
|
|
411
|
+
console.log(`
|
|
412
|
+
${utils.COLORS.cyan}${utils.COLORS.bold}⚡ Bootspring Legal${utils.COLORS.reset}
|
|
413
|
+
${utils.COLORS.dim}Legal documents and compliance tools${utils.COLORS.reset}
|
|
414
|
+
|
|
415
|
+
${utils.COLORS.bold}Usage:${utils.COLORS.reset}
|
|
416
|
+
bootspring legal <command> [options]
|
|
417
|
+
|
|
418
|
+
${utils.COLORS.bold}Commands:${utils.COLORS.reset}
|
|
419
|
+
${utils.COLORS.cyan}init${utils.COLORS.reset} Initialize all legal documents
|
|
420
|
+
${utils.COLORS.cyan}terms${utils.COLORS.reset} Create terms of service
|
|
421
|
+
${utils.COLORS.cyan}privacy${utils.COLORS.reset} Create privacy policy
|
|
422
|
+
${utils.COLORS.cyan}gdpr${utils.COLORS.reset} Create GDPR compliance checklist
|
|
423
|
+
${utils.COLORS.cyan}status${utils.COLORS.reset} Show status of legal documents
|
|
424
|
+
${utils.COLORS.cyan}show${utils.COLORS.reset} <type> Preview a legal document
|
|
425
|
+
|
|
426
|
+
${utils.COLORS.bold}Examples:${utils.COLORS.reset}
|
|
427
|
+
bootspring legal init # Create all legal docs
|
|
428
|
+
bootspring legal terms # Create terms of service
|
|
429
|
+
bootspring legal privacy # Create privacy policy
|
|
430
|
+
bootspring legal gdpr # Create GDPR checklist
|
|
431
|
+
bootspring legal status # Check progress
|
|
432
|
+
bootspring legal show terms # Preview terms of service
|
|
433
|
+
|
|
434
|
+
${utils.COLORS.bold}Related Agent:${utils.COLORS.reset}
|
|
435
|
+
${utils.COLORS.cyan}legal-expert${utils.COLORS.reset} Contracts, compliance, and legal guidance
|
|
436
|
+
|
|
437
|
+
${utils.COLORS.yellow}${utils.COLORS.bold}Disclaimer:${utils.COLORS.reset}
|
|
438
|
+
${utils.COLORS.dim}These templates are for guidance only. Always consult with a qualified
|
|
439
|
+
attorney for your specific legal needs and jurisdiction.${utils.COLORS.reset}
|
|
440
|
+
`);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Run legal command
|
|
445
|
+
*/
|
|
446
|
+
export async function run(args: string[]): Promise<void> {
|
|
447
|
+
const subcommand = args[0] || 'help';
|
|
448
|
+
|
|
449
|
+
switch (subcommand) {
|
|
450
|
+
case 'init':
|
|
451
|
+
await legalInit();
|
|
452
|
+
break;
|
|
453
|
+
|
|
454
|
+
case 'terms':
|
|
455
|
+
case 'tos':
|
|
456
|
+
await legalCreate('terms');
|
|
457
|
+
break;
|
|
458
|
+
|
|
459
|
+
case 'privacy':
|
|
460
|
+
await legalCreate('privacy');
|
|
461
|
+
break;
|
|
462
|
+
|
|
463
|
+
case 'gdpr':
|
|
464
|
+
await legalCreate('gdpr');
|
|
465
|
+
break;
|
|
466
|
+
|
|
467
|
+
case 'status':
|
|
468
|
+
legalStatus();
|
|
469
|
+
break;
|
|
470
|
+
|
|
471
|
+
case 'show':
|
|
472
|
+
if (!args[1]) {
|
|
473
|
+
utils.print.error('Please specify a document type');
|
|
474
|
+
console.log(`Usage: ${utils.COLORS.cyan}bootspring legal show <terms|privacy|gdpr>${utils.COLORS.reset}`);
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
legalShow(args[1]);
|
|
478
|
+
break;
|
|
479
|
+
|
|
480
|
+
case 'help':
|
|
481
|
+
case '-h':
|
|
482
|
+
case '--help':
|
|
483
|
+
showHelp();
|
|
484
|
+
break;
|
|
485
|
+
|
|
486
|
+
default:
|
|
487
|
+
// Check if it's a template name
|
|
488
|
+
if (TEMPLATES[subcommand]) {
|
|
489
|
+
await legalCreate(subcommand);
|
|
490
|
+
} else {
|
|
491
|
+
utils.print.error(`Unknown subcommand: ${subcommand}`);
|
|
492
|
+
showHelp();
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|