@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.
- package/README.md +107 -14
- package/bin/bootspring.js +166 -27
- package/cli/agent.js +189 -17
- package/cli/analyze.js +499 -0
- package/cli/audit.js +557 -0
- package/cli/auth.js +495 -38
- package/cli/billing.js +302 -0
- package/cli/build.js +695 -0
- package/cli/business.js +109 -26
- package/cli/checkpoint-utils.js +168 -0
- package/cli/checkpoint.js +639 -0
- package/cli/cloud-sync.js +447 -0
- package/cli/content.js +198 -0
- package/cli/context.js +1 -1
- package/cli/deploy.js +543 -0
- package/cli/fundraise.js +112 -50
- package/cli/github-cmd.js +435 -0
- package/cli/health.js +477 -0
- package/cli/init.js +84 -13
- package/cli/legal.js +107 -95
- package/cli/log.js +2 -2
- package/cli/loop.js +976 -73
- package/cli/manager.js +711 -0
- package/cli/metrics.js +480 -0
- package/cli/monitor.js +812 -0
- package/cli/onboard.js +521 -0
- package/cli/orchestrator.js +12 -24
- package/cli/prd.js +594 -0
- package/cli/preseed-start.js +1483 -0
- package/cli/preseed.js +2302 -0
- package/cli/project.js +436 -0
- package/cli/quality.js +233 -0
- package/cli/security.js +913 -0
- package/cli/seed.js +1441 -5
- package/cli/skill.js +273 -211
- package/cli/suggest.js +989 -0
- package/cli/switch.js +453 -0
- package/cli/visualize.js +527 -0
- package/cli/watch.js +769 -0
- package/cli/workspace.js +607 -0
- package/core/analyze-workflow.js +1134 -0
- package/core/api-client.js +535 -22
- package/core/audit-workflow.js +1350 -0
- package/core/build-orchestrator.js +480 -0
- package/core/build-state.js +577 -0
- package/core/checkpoint-engine.js +408 -0
- package/core/config.js +1109 -26
- package/core/context-loader.js +21 -1
- package/core/deploy-workflow.js +836 -0
- package/core/entitlements.js +93 -22
- package/core/github-sync.js +610 -0
- package/core/index.js +8 -1
- package/core/ingest.js +1111 -0
- package/core/metrics-engine.js +768 -0
- package/core/onboard-workflow.js +1007 -0
- package/core/preseed-workflow.js +934 -0
- package/core/preseed.js +1617 -0
- package/core/project-context.js +325 -0
- package/core/project-state.js +694 -0
- package/core/r2-sync.js +583 -0
- package/core/scaffold.js +525 -7
- package/core/session.js +258 -0
- package/core/task-extractor.js +758 -0
- package/core/telemetry.js +28 -6
- package/core/tier-enforcement.js +737 -0
- package/core/utils.js +38 -14
- package/generators/questionnaire.js +15 -12
- package/generators/sections/ai.js +7 -7
- package/generators/sections/content.js +300 -0
- package/generators/sections/index.js +3 -0
- package/generators/sections/plugins.js +7 -6
- package/generators/templates/build-planning.template.js +596 -0
- package/generators/templates/content.template.js +819 -0
- package/generators/templates/index.js +2 -1
- package/hooks/git-autopilot.js +1250 -0
- package/hooks/index.js +9 -0
- package/intelligence/agent-collab.js +2057 -0
- package/intelligence/auto-suggest.js +634 -0
- package/intelligence/content-gen.js +1589 -0
- package/intelligence/cross-project.js +1647 -0
- package/intelligence/index.js +184 -0
- package/intelligence/learning/insights.json +517 -7
- package/intelligence/learning/pattern-learner.js +1008 -14
- package/intelligence/memory/decision-tracker.js +1431 -31
- package/intelligence/memory/decisions.jsonl +0 -0
- package/intelligence/orchestrator.js +2896 -1
- package/intelligence/prd.js +92 -1
- package/intelligence/recommendation-weights.json +14 -2
- package/intelligence/recommendations.js +463 -9
- package/intelligence/workflow-composer.js +1451 -0
- package/marketplace/index.d.ts +324 -0
- package/marketplace/index.js +1921 -0
- package/mcp/contracts/mcp-contract.v1.json +342 -4
- package/mcp/registry.js +680 -3
- package/mcp/response-formatter.js +23 -0
- package/mcp/tools/assist-tool.js +78 -4
- package/mcp/tools/autopilot-tool.js +408 -0
- package/mcp/tools/content-tool.js +571 -0
- package/mcp/tools/dashboard-tool.js +251 -5
- package/mcp/tools/mvp-tool.js +344 -0
- package/mcp/tools/plugin-tool.js +23 -1
- package/mcp/tools/prd-tool.js +579 -0
- package/mcp/tools/seed-tool.js +447 -0
- package/mcp/tools/skill-tool.js +43 -14
- package/mcp/tools/suggest-tool.js +147 -0
- package/package.json +15 -6
- package/agents/README.md +0 -93
- package/agents/ai-integration-expert/context.md +0 -386
- package/agents/api-expert/context.md +0 -416
- package/agents/architecture-expert/context.md +0 -454
- package/agents/auth-expert/context.md +0 -399
- package/agents/backend-expert/context.md +0 -483
- package/agents/business-strategy-expert/context.md +0 -180
- package/agents/code-review-expert/context.md +0 -365
- package/agents/competitive-analysis-expert/context.md +0 -239
- package/agents/data-modeling-expert/context.md +0 -352
- package/agents/database-expert/context.md +0 -250
- package/agents/devops-expert/context.md +0 -446
- package/agents/email-expert/context.md +0 -379
- package/agents/financial-expert/context.md +0 -213
- package/agents/frontend-expert/context.md +0 -364
- package/agents/fundraising-expert/context.md +0 -257
- package/agents/growth-expert/context.md +0 -249
- package/agents/index.js +0 -140
- package/agents/investor-relations-expert/context.md +0 -266
- package/agents/legal-expert/context.md +0 -284
- package/agents/marketing-expert/context.md +0 -236
- package/agents/monitoring-expert/context.md +0 -362
- package/agents/operations-expert/context.md +0 -279
- package/agents/partnerships-expert/context.md +0 -286
- package/agents/payment-expert/context.md +0 -340
- package/agents/performance-expert/context.md +0 -377
- package/agents/private-equity-expert/context.md +0 -246
- package/agents/railway-expert/context.md +0 -284
- package/agents/research-expert/context.md +0 -245
- package/agents/sales-expert/context.md +0 -241
- package/agents/security-expert/context.md +0 -343
- package/agents/testing-expert/context.md +0 -414
- package/agents/ui-ux-expert/context.md +0 -448
- package/agents/vercel-expert/context.md +0 -426
- package/skills/index.js +0 -787
- package/skills/patterns/README.md +0 -163
- package/skills/patterns/ai/agents.md +0 -281
- package/skills/patterns/ai/claude.md +0 -138
- package/skills/patterns/ai/embeddings.md +0 -150
- package/skills/patterns/ai/rag.md +0 -266
- package/skills/patterns/ai/streaming.md +0 -170
- package/skills/patterns/ai/structured-output.md +0 -162
- package/skills/patterns/ai/tools.md +0 -154
- package/skills/patterns/analytics/tracking.md +0 -220
- package/skills/patterns/api/errors.md +0 -296
- package/skills/patterns/api/graphql.md +0 -440
- package/skills/patterns/api/middleware.md +0 -279
- package/skills/patterns/api/openapi.md +0 -285
- package/skills/patterns/api/rate-limiting.md +0 -231
- package/skills/patterns/api/route-handler.md +0 -217
- package/skills/patterns/api/server-action.md +0 -249
- package/skills/patterns/api/versioning.md +0 -443
- package/skills/patterns/api/webhooks.md +0 -247
- package/skills/patterns/auth/clerk.md +0 -132
- package/skills/patterns/auth/mfa.md +0 -313
- package/skills/patterns/auth/nextauth.md +0 -140
- package/skills/patterns/auth/oauth.md +0 -237
- package/skills/patterns/auth/rbac.md +0 -152
- package/skills/patterns/auth/session-management.md +0 -367
- package/skills/patterns/auth/session.md +0 -120
- package/skills/patterns/database/audit.md +0 -177
- package/skills/patterns/database/migrations.md +0 -177
- package/skills/patterns/database/pagination.md +0 -230
- package/skills/patterns/database/pooling.md +0 -357
- package/skills/patterns/database/prisma.md +0 -180
- package/skills/patterns/database/relations.md +0 -187
- package/skills/patterns/database/seeding.md +0 -246
- package/skills/patterns/database/soft-delete.md +0 -153
- package/skills/patterns/database/transactions.md +0 -162
- package/skills/patterns/deployment/ci-cd.md +0 -231
- package/skills/patterns/deployment/docker.md +0 -188
- package/skills/patterns/deployment/monitoring.md +0 -387
- package/skills/patterns/deployment/vercel.md +0 -160
- package/skills/patterns/email/resend.md +0 -143
- package/skills/patterns/email/templates.md +0 -245
- package/skills/patterns/email/transactional.md +0 -503
- package/skills/patterns/email/verification.md +0 -176
- package/skills/patterns/files/download.md +0 -243
- package/skills/patterns/files/upload.md +0 -239
- package/skills/patterns/i18n/nextintl.md +0 -188
- package/skills/patterns/logging/structured.md +0 -292
- package/skills/patterns/notifications/email-queue.md +0 -248
- package/skills/patterns/notifications/push.md +0 -279
- package/skills/patterns/payments/checkout.md +0 -303
- package/skills/patterns/payments/invoices.md +0 -287
- package/skills/patterns/payments/portal.md +0 -245
- package/skills/patterns/payments/stripe.md +0 -272
- package/skills/patterns/payments/subscriptions.md +0 -300
- package/skills/patterns/payments/usage.md +0 -279
- package/skills/patterns/performance/caching.md +0 -276
- package/skills/patterns/performance/code-splitting.md +0 -233
- package/skills/patterns/performance/edge.md +0 -254
- package/skills/patterns/performance/isr.md +0 -266
- package/skills/patterns/performance/lazy-loading.md +0 -281
- package/skills/patterns/realtime/sse.md +0 -327
- package/skills/patterns/realtime/websockets.md +0 -336
- package/skills/patterns/search/filtering.md +0 -329
- package/skills/patterns/search/fulltext.md +0 -260
- package/skills/patterns/security/audit-logging.md +0 -444
- package/skills/patterns/security/csrf.md +0 -234
- package/skills/patterns/security/headers.md +0 -252
- package/skills/patterns/security/sanitization.md +0 -258
- package/skills/patterns/security/secrets.md +0 -261
- package/skills/patterns/security/validation.md +0 -268
- package/skills/patterns/security/xss.md +0 -229
- package/skills/patterns/seo/metadata.md +0 -252
- package/skills/patterns/state/context.md +0 -349
- package/skills/patterns/state/react-query.md +0 -313
- package/skills/patterns/state/url-state.md +0 -482
- package/skills/patterns/state/zustand.md +0 -262
- package/skills/patterns/testing/api.md +0 -259
- package/skills/patterns/testing/component.md +0 -233
- package/skills/patterns/testing/coverage.md +0 -207
- package/skills/patterns/testing/fixtures.md +0 -225
- package/skills/patterns/testing/integration.md +0 -436
- package/skills/patterns/testing/mocking.md +0 -177
- package/skills/patterns/testing/playwright.md +0 -162
- package/skills/patterns/testing/snapshot.md +0 -175
- package/skills/patterns/testing/vitest.md +0 -307
- package/skills/patterns/ui/accordions.md +0 -395
- package/skills/patterns/ui/cards.md +0 -299
- package/skills/patterns/ui/dropdowns.md +0 -476
- package/skills/patterns/ui/empty-states.md +0 -320
- package/skills/patterns/ui/forms.md +0 -405
- package/skills/patterns/ui/inputs.md +0 -319
- package/skills/patterns/ui/layouts.md +0 -282
- package/skills/patterns/ui/loading.md +0 -291
- package/skills/patterns/ui/modals.md +0 -338
- package/skills/patterns/ui/navigation.md +0 -374
- package/skills/patterns/ui/tables.md +0 -407
- package/skills/patterns/ui/toasts.md +0 -300
- package/skills/patterns/ui/tooltips.md +0 -396
- package/skills/patterns/utils/dates.md +0 -435
- package/skills/patterns/utils/errors.md +0 -451
- package/skills/patterns/utils/formatting.md +0 -345
- package/skills/patterns/utils/validation.md +0 -434
- package/templates/bootspring.config.js +0 -83
- package/templates/business/business-model-canvas.md +0 -246
- package/templates/business/business-plan.md +0 -266
- package/templates/business/competitive-analysis.md +0 -312
- package/templates/fundraising/data-room-checklist.md +0 -300
- package/templates/fundraising/investor-research.md +0 -243
- package/templates/fundraising/pitch-deck-outline.md +0 -253
- package/templates/legal/gdpr-checklist.md +0 -339
- package/templates/legal/privacy-policy.md +0 -285
- package/templates/legal/terms-of-service.md +0 -222
- package/templates/mcp.json +0 -9
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Content Generation Tool
|
|
3
|
+
*
|
|
4
|
+
* Provides AI-assisted content generation via MCP:
|
|
5
|
+
* - Generate business and legal documents
|
|
6
|
+
* - Get AI enhancement prompts
|
|
7
|
+
* - Validate generated content
|
|
8
|
+
* - Track generation statistics
|
|
9
|
+
*
|
|
10
|
+
* @package bootspring
|
|
11
|
+
* @module mcp/tools/content-tool
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
function getToolDefinition() {
|
|
15
|
+
return {
|
|
16
|
+
name: 'bootspring_content',
|
|
17
|
+
description: 'Generate business and legal documents with AI assistance. Creates privacy policies, terms of service, READMEs, changelogs, API docs, business plans, and more using project context.',
|
|
18
|
+
inputSchema: {
|
|
19
|
+
type: 'object',
|
|
20
|
+
properties: {
|
|
21
|
+
action: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
enum: ['list', 'generate', 'preview', 'enhance', 'validate', 'stats', 'batch'],
|
|
24
|
+
description: 'Action to perform: list (show templates), generate (create document), preview (show without saving), enhance (get AI prompts), validate (check content), stats (generation statistics), batch (generate multiple)'
|
|
25
|
+
},
|
|
26
|
+
template: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
description: 'Template key (e.g., privacy-policy, terms-of-service, readme, changelog, api-documentation, business-plan)'
|
|
29
|
+
},
|
|
30
|
+
category: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
enum: ['legal', 'documentation', 'business', 'fundraising', 'security'],
|
|
33
|
+
description: 'Filter templates by category (for list action) or generate all in category (for batch action)'
|
|
34
|
+
},
|
|
35
|
+
section: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
description: 'Specific section to enhance (for enhance action)'
|
|
38
|
+
},
|
|
39
|
+
outputDir: {
|
|
40
|
+
type: 'string',
|
|
41
|
+
description: 'Output directory for generated files (default: docs/)'
|
|
42
|
+
},
|
|
43
|
+
filename: {
|
|
44
|
+
type: 'string',
|
|
45
|
+
description: 'Custom filename for generated document'
|
|
46
|
+
},
|
|
47
|
+
options: {
|
|
48
|
+
type: 'object',
|
|
49
|
+
description: 'Customization options (domain, jurisdiction, address, etc.)',
|
|
50
|
+
properties: {
|
|
51
|
+
domain: { type: 'string' },
|
|
52
|
+
jurisdiction: { type: 'string' },
|
|
53
|
+
address: { type: 'string' },
|
|
54
|
+
country: { type: 'string' }
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
required: ['action']
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function createHandler({ contentGen, config, format }) {
|
|
64
|
+
return async (args) => {
|
|
65
|
+
const { action, template, category, section, outputDir, filename, options } = args;
|
|
66
|
+
const cfg = config.load();
|
|
67
|
+
const projectRoot = cfg._projectRoot;
|
|
68
|
+
|
|
69
|
+
try {
|
|
70
|
+
switch (action) {
|
|
71
|
+
case 'list':
|
|
72
|
+
return handleList(contentGen, category, format);
|
|
73
|
+
|
|
74
|
+
case 'generate':
|
|
75
|
+
return handleGenerate(contentGen, template, { outputDir, filename, ...options }, format);
|
|
76
|
+
|
|
77
|
+
case 'preview':
|
|
78
|
+
return handlePreview(contentGen, template, options, format);
|
|
79
|
+
|
|
80
|
+
case 'enhance':
|
|
81
|
+
return handleEnhance(contentGen, template, section, format);
|
|
82
|
+
|
|
83
|
+
case 'validate':
|
|
84
|
+
return handleValidate(contentGen, template, projectRoot, format);
|
|
85
|
+
|
|
86
|
+
case 'stats':
|
|
87
|
+
return handleStats(contentGen, format);
|
|
88
|
+
|
|
89
|
+
case 'batch':
|
|
90
|
+
return handleBatch(contentGen, category, { outputDir, ...options }, format);
|
|
91
|
+
|
|
92
|
+
default:
|
|
93
|
+
return format.error(`Unknown action: ${action}`, [
|
|
94
|
+
'Valid actions: list, generate, preview, enhance, validate, stats, batch'
|
|
95
|
+
]);
|
|
96
|
+
}
|
|
97
|
+
} catch (error) {
|
|
98
|
+
return format.error(`Content generation failed: ${error.message}`);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* List available templates
|
|
105
|
+
*/
|
|
106
|
+
function handleList(contentGen, category, _format) {
|
|
107
|
+
const templates = contentGen.listTemplates({ category });
|
|
108
|
+
const categories = contentGen.getCategories();
|
|
109
|
+
|
|
110
|
+
if (templates.length === 0) {
|
|
111
|
+
return {
|
|
112
|
+
content: [{
|
|
113
|
+
type: 'text',
|
|
114
|
+
text: `## Document Templates
|
|
115
|
+
|
|
116
|
+
No templates found${category ? ` in category "${category}"` : ''}.
|
|
117
|
+
|
|
118
|
+
**Available Categories:** ${categories.join(', ')}
|
|
119
|
+
|
|
120
|
+
Use: \`bootspring_content\` action: "list" category: "legal"`
|
|
121
|
+
}]
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Group by category
|
|
126
|
+
const grouped = {};
|
|
127
|
+
for (const t of templates) {
|
|
128
|
+
if (!grouped[t.category]) {
|
|
129
|
+
grouped[t.category] = [];
|
|
130
|
+
}
|
|
131
|
+
grouped[t.category].push(t);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const sections = ['## Document Templates\n'];
|
|
135
|
+
|
|
136
|
+
for (const [cat, tmpls] of Object.entries(grouped)) {
|
|
137
|
+
sections.push(`### ${cat.charAt(0).toUpperCase() + cat.slice(1)}\n`);
|
|
138
|
+
|
|
139
|
+
for (const t of tmpls) {
|
|
140
|
+
const compliance = t.compliance.length > 0 ? ` [${t.compliance.join(', ')}]` : '';
|
|
141
|
+
const hasFile = t.hasTemplateFile ? ' (template file)' : '';
|
|
142
|
+
sections.push(`- **${t.key}** - ${t.description}${compliance}${hasFile}`);
|
|
143
|
+
}
|
|
144
|
+
sections.push('');
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
sections.push(`**Total:** ${templates.length} templates across ${Object.keys(grouped).length} categories`);
|
|
148
|
+
sections.push('');
|
|
149
|
+
sections.push('**Commands:**');
|
|
150
|
+
sections.push('- Generate: `bootspring_content` action: "generate" template: "privacy-policy"');
|
|
151
|
+
sections.push('- Preview: `bootspring_content` action: "preview" template: "readme"');
|
|
152
|
+
sections.push('- AI Help: `bootspring_content` action: "enhance" template: "business-plan"');
|
|
153
|
+
|
|
154
|
+
return {
|
|
155
|
+
content: [{
|
|
156
|
+
type: 'text',
|
|
157
|
+
text: sections.join('\n')
|
|
158
|
+
}]
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Generate a document
|
|
164
|
+
*/
|
|
165
|
+
function handleGenerate(contentGen, template, options, format) {
|
|
166
|
+
if (!template) {
|
|
167
|
+
return format.error('Template required', [
|
|
168
|
+
'Use template parameter to specify which document to generate',
|
|
169
|
+
'Run action: "list" to see available templates'
|
|
170
|
+
]);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const templateInfo = contentGen.getTemplate(template);
|
|
174
|
+
if (!templateInfo) {
|
|
175
|
+
const available = contentGen.listTemplates().map(t => t.key).join(', ');
|
|
176
|
+
return format.error(`Unknown template: ${template}`, [
|
|
177
|
+
`Available templates: ${available}`
|
|
178
|
+
]);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const result = contentGen.generateDocument(template, {
|
|
182
|
+
save: true,
|
|
183
|
+
outputDir: options.outputDir,
|
|
184
|
+
filename: options.filename,
|
|
185
|
+
context: options
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
if (!result.success) {
|
|
189
|
+
return format.error(`Generation failed: ${result.error}`);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const validationSummary = result.validation.valid
|
|
193
|
+
? 'Content validation passed'
|
|
194
|
+
: `Validation found ${result.validation.issues.length} issue(s)`;
|
|
195
|
+
|
|
196
|
+
const issues = result.validation.issues
|
|
197
|
+
.filter(i => i.severity === 'error' || i.severity === 'warning')
|
|
198
|
+
.map(i => ` - [${i.severity}] ${i.message}`)
|
|
199
|
+
.join('\n');
|
|
200
|
+
|
|
201
|
+
return {
|
|
202
|
+
content: [{
|
|
203
|
+
type: 'text',
|
|
204
|
+
text: `## Document Generated
|
|
205
|
+
|
|
206
|
+
**Template:** ${templateInfo.name}
|
|
207
|
+
**Category:** ${templateInfo.category}
|
|
208
|
+
**File:** ${result.outputPath}
|
|
209
|
+
**Sections:** ${result.sections}
|
|
210
|
+
|
|
211
|
+
### Validation
|
|
212
|
+
|
|
213
|
+
${validationSummary}
|
|
214
|
+
${issues ? `\n${issues}\n` : ''}
|
|
215
|
+
**Score:** ${result.validation.score}/100
|
|
216
|
+
|
|
217
|
+
### Next Steps
|
|
218
|
+
|
|
219
|
+
1. Review the generated document at \`${result.outputPath}\`
|
|
220
|
+
2. Use \`bootspring_content\` action: "enhance" template: "${template}" to get AI improvement prompts
|
|
221
|
+
3. Customize placeholders marked with \`[...]\`
|
|
222
|
+
|
|
223
|
+
${templateInfo.compliance?.length > 0 ? `\n**Compliance Notes:** This template includes ${templateInfo.compliance.join(', ')} provisions. Please review with legal counsel.` : ''}`
|
|
224
|
+
}]
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Preview document without saving
|
|
230
|
+
*/
|
|
231
|
+
function handlePreview(contentGen, template, options, format) {
|
|
232
|
+
if (!template) {
|
|
233
|
+
return format.error('Template required', [
|
|
234
|
+
'Use template parameter to specify which document to preview'
|
|
235
|
+
]);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const templateInfo = contentGen.getTemplate(template);
|
|
239
|
+
if (!templateInfo) {
|
|
240
|
+
return format.error(`Unknown template: ${template}`, [
|
|
241
|
+
'Run action: "list" to see available templates'
|
|
242
|
+
]);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
const result = contentGen.generateDocument(template, {
|
|
246
|
+
save: false,
|
|
247
|
+
context: options
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
if (!result.success) {
|
|
251
|
+
return format.error(`Preview failed: ${result.error}`);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// Truncate long content for preview
|
|
255
|
+
const maxLength = 4000;
|
|
256
|
+
const truncated = result.content.length > maxLength;
|
|
257
|
+
const previewContent = truncated
|
|
258
|
+
? result.content.slice(0, maxLength) + '\n\n... [Truncated for preview]'
|
|
259
|
+
: result.content;
|
|
260
|
+
|
|
261
|
+
return {
|
|
262
|
+
content: [{
|
|
263
|
+
type: 'text',
|
|
264
|
+
text: `## Preview: ${templateInfo.name}
|
|
265
|
+
|
|
266
|
+
**Sections:** ${result.sections}
|
|
267
|
+
**Length:** ${result.content.length} characters
|
|
268
|
+
**Validation Score:** ${result.validation.score}/100
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
${previewContent}
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
${truncated ? '\n*Content truncated. Generate to see full document.*\n' : ''}
|
|
277
|
+
**Commands:**
|
|
278
|
+
- Save: \`bootspring_content\` action: "generate" template: "${template}"
|
|
279
|
+
- AI Help: \`bootspring_content\` action: "enhance" template: "${template}"`
|
|
280
|
+
}]
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Get AI enhancement prompts
|
|
286
|
+
*/
|
|
287
|
+
function handleEnhance(contentGen, template, section, format) {
|
|
288
|
+
if (!template) {
|
|
289
|
+
return format.error('Template required', [
|
|
290
|
+
'Use template parameter to specify which document to enhance'
|
|
291
|
+
]);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const templateInfo = contentGen.getTemplate(template);
|
|
295
|
+
if (!templateInfo) {
|
|
296
|
+
return format.error(`Unknown template: ${template}`, [
|
|
297
|
+
'Run action: "list" to see available templates'
|
|
298
|
+
]);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
if (section) {
|
|
302
|
+
// Get specific section prompt
|
|
303
|
+
const result = contentGen.getEnhancementPrompt(template, section);
|
|
304
|
+
|
|
305
|
+
if (!result.success) {
|
|
306
|
+
return format.error(result.error);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return {
|
|
310
|
+
content: [{
|
|
311
|
+
type: 'text',
|
|
312
|
+
text: `## AI Enhancement Prompt
|
|
313
|
+
|
|
314
|
+
**Template:** ${templateInfo.name}
|
|
315
|
+
**Section:** ${section}
|
|
316
|
+
**Generic:** ${result.generic ? 'Yes (no specific prompt defined)' : 'No'}
|
|
317
|
+
|
|
318
|
+
### Prompt for AI
|
|
319
|
+
|
|
320
|
+
\`\`\`
|
|
321
|
+
${result.prompt}
|
|
322
|
+
\`\`\`
|
|
323
|
+
|
|
324
|
+
### Project Context Used
|
|
325
|
+
|
|
326
|
+
| Key | Value |
|
|
327
|
+
|-----|-------|
|
|
328
|
+
| Project Name | ${result.context.projectName} |
|
|
329
|
+
| Framework | ${result.context.framework} |
|
|
330
|
+
| Language | ${result.context.language} |
|
|
331
|
+
| Database | ${result.context.database || 'N/A'} |
|
|
332
|
+
| Hosting | ${result.context.hosting || 'N/A'} |
|
|
333
|
+
|
|
334
|
+
**Tip:** Copy this prompt and use it with your AI assistant to generate enhanced content for this section.`
|
|
335
|
+
}]
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// Get all section prompts
|
|
340
|
+
const result = contentGen.getAllEnhancementPrompts(template);
|
|
341
|
+
|
|
342
|
+
if (!result.success) {
|
|
343
|
+
return format.error(result.error);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
const sections = result.prompts.map(p => {
|
|
347
|
+
const status = p.generic ? '(generic)' : '(custom)';
|
|
348
|
+
return `- **${p.title}** ${status}`;
|
|
349
|
+
}).join('\n');
|
|
350
|
+
|
|
351
|
+
// Get the full document prompt
|
|
352
|
+
const fullPrompt = contentGen.getEnhancementPrompt(template);
|
|
353
|
+
|
|
354
|
+
return {
|
|
355
|
+
content: [{
|
|
356
|
+
type: 'text',
|
|
357
|
+
text: `## AI Enhancement Prompts
|
|
358
|
+
|
|
359
|
+
**Template:** ${result.templateName}
|
|
360
|
+
**Total Sections:** ${result.prompts.length}
|
|
361
|
+
|
|
362
|
+
### Available Section Prompts
|
|
363
|
+
|
|
364
|
+
${sections}
|
|
365
|
+
|
|
366
|
+
### Full Document Prompt
|
|
367
|
+
|
|
368
|
+
Use this prompt to generate the entire document with AI:
|
|
369
|
+
|
|
370
|
+
\`\`\`
|
|
371
|
+
${fullPrompt.prompt.slice(0, 2000)}${fullPrompt.prompt.length > 2000 ? '...' : ''}
|
|
372
|
+
\`\`\`
|
|
373
|
+
|
|
374
|
+
### Commands
|
|
375
|
+
|
|
376
|
+
- Get specific section: \`bootspring_content\` action: "enhance" template: "${template}" section: "executive-summary"
|
|
377
|
+
- Preview generated: \`bootspring_content\` action: "preview" template: "${template}"
|
|
378
|
+
|
|
379
|
+
**Tip:** Use these prompts with Claude or other AI assistants to create customized, high-quality content.`
|
|
380
|
+
}]
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Validate content
|
|
386
|
+
*/
|
|
387
|
+
function handleValidate(contentGen, template, projectRoot, format) {
|
|
388
|
+
const fs = require('fs');
|
|
389
|
+
const path = require('path');
|
|
390
|
+
|
|
391
|
+
if (!template) {
|
|
392
|
+
return format.error('Template required for validation', [
|
|
393
|
+
'Specify which template type to validate against'
|
|
394
|
+
]);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
const templateInfo = contentGen.getTemplate(template);
|
|
398
|
+
if (!templateInfo) {
|
|
399
|
+
return format.error(`Unknown template: ${template}`);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// Try to find existing document
|
|
403
|
+
const possiblePaths = [
|
|
404
|
+
path.join(projectRoot, 'docs', `${template}.md`),
|
|
405
|
+
path.join(projectRoot, `${template.toUpperCase()}.md`),
|
|
406
|
+
path.join(projectRoot, `${template}.md`)
|
|
407
|
+
];
|
|
408
|
+
|
|
409
|
+
let content = null;
|
|
410
|
+
let foundPath = null;
|
|
411
|
+
|
|
412
|
+
for (const p of possiblePaths) {
|
|
413
|
+
if (fs.existsSync(p)) {
|
|
414
|
+
content = fs.readFileSync(p, 'utf8');
|
|
415
|
+
foundPath = p;
|
|
416
|
+
break;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
if (!content) {
|
|
421
|
+
return format.warning(`No existing ${template} document found`, [
|
|
422
|
+
`Expected locations: ${possiblePaths.join(', ')}`,
|
|
423
|
+
`Generate one: bootspring_content action: "generate" template: "${template}"`
|
|
424
|
+
]);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
const validation = contentGen.validateContent(content, template);
|
|
428
|
+
|
|
429
|
+
const issuesList = validation.issues
|
|
430
|
+
.map(i => `- [${i.severity.toUpperCase()}] ${i.message}`)
|
|
431
|
+
.join('\n');
|
|
432
|
+
|
|
433
|
+
const statusIcon = validation.valid ? ' ' : ' ';
|
|
434
|
+
|
|
435
|
+
return {
|
|
436
|
+
content: [{
|
|
437
|
+
type: 'text',
|
|
438
|
+
text: `## Content Validation
|
|
439
|
+
|
|
440
|
+
${statusIcon} **Status:** ${validation.valid ? 'Valid' : 'Issues Found'}
|
|
441
|
+
**File:** ${foundPath}
|
|
442
|
+
**Template:** ${templateInfo.name}
|
|
443
|
+
**Score:** ${validation.score}/100
|
|
444
|
+
|
|
445
|
+
### Issues (${validation.issues.length})
|
|
446
|
+
|
|
447
|
+
${issuesList || 'No issues found.'}
|
|
448
|
+
|
|
449
|
+
### Recommendations
|
|
450
|
+
|
|
451
|
+
${validation.valid
|
|
452
|
+
? '- Document passes basic validation\n- Consider using AI enhancement for improvements\n- Have legal counsel review before publishing'
|
|
453
|
+
: '- Address the issues listed above\n- Use `bootspring_content action: "enhance"` for improvement prompts\n- Regenerate if needed'
|
|
454
|
+
}`
|
|
455
|
+
}]
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Show generation statistics
|
|
461
|
+
*/
|
|
462
|
+
function handleStats(contentGen, _format) {
|
|
463
|
+
const stats = contentGen.getStatistics();
|
|
464
|
+
|
|
465
|
+
const categoryStats = Object.entries(stats.byCategory)
|
|
466
|
+
.map(([cat, count]) => `| ${cat} | ${count} |`)
|
|
467
|
+
.join('\n');
|
|
468
|
+
|
|
469
|
+
const templateStats = Object.entries(stats.byTemplate)
|
|
470
|
+
.sort((a, b) => b[1] - a[1])
|
|
471
|
+
.slice(0, 10)
|
|
472
|
+
.map(([tmpl, count]) => `| ${tmpl} | ${count} |`)
|
|
473
|
+
.join('\n');
|
|
474
|
+
|
|
475
|
+
const recentDocs = stats.recentDocuments
|
|
476
|
+
.slice(-5)
|
|
477
|
+
.reverse()
|
|
478
|
+
.map(d => `- ${d.template} (${d.generatedAt.split('T')[0]})`)
|
|
479
|
+
.join('\n');
|
|
480
|
+
|
|
481
|
+
return {
|
|
482
|
+
content: [{
|
|
483
|
+
type: 'text',
|
|
484
|
+
text: `## Content Generation Statistics
|
|
485
|
+
|
|
486
|
+
**Total Documents Generated:** ${stats.totalGenerated}
|
|
487
|
+
**Last Generation:** ${stats.lastGeneration || 'Never'}
|
|
488
|
+
|
|
489
|
+
### By Category
|
|
490
|
+
|
|
491
|
+
| Category | Count |
|
|
492
|
+
|----------|-------|
|
|
493
|
+
${categoryStats || '| - | - |'}
|
|
494
|
+
|
|
495
|
+
### Top Templates
|
|
496
|
+
|
|
497
|
+
| Template | Count |
|
|
498
|
+
|----------|-------|
|
|
499
|
+
${templateStats || '| - | - |'}
|
|
500
|
+
|
|
501
|
+
### Recent Documents
|
|
502
|
+
|
|
503
|
+
${recentDocs || 'No documents generated yet.'}
|
|
504
|
+
|
|
505
|
+
### Commands
|
|
506
|
+
|
|
507
|
+
- Generate: \`bootspring_content\` action: "generate" template: "privacy-policy"
|
|
508
|
+
- List templates: \`bootspring_content\` action: "list"
|
|
509
|
+
- Batch generate: \`bootspring_content\` action: "batch" category: "legal"`
|
|
510
|
+
}]
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Batch generate documents by category
|
|
516
|
+
*/
|
|
517
|
+
function handleBatch(contentGen, category, options, format) {
|
|
518
|
+
if (!category) {
|
|
519
|
+
return format.error('Category required for batch generation', [
|
|
520
|
+
'Specify which category of documents to generate',
|
|
521
|
+
'Available: legal, documentation, business, fundraising, security'
|
|
522
|
+
]);
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
const templates = contentGen.listTemplates({ category });
|
|
526
|
+
|
|
527
|
+
if (templates.length === 0) {
|
|
528
|
+
return format.error(`No templates found in category: ${category}`, [
|
|
529
|
+
'Available categories: legal, documentation, business, fundraising, security'
|
|
530
|
+
]);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
const result = contentGen.generateByCategory(category, {
|
|
534
|
+
outputDir: options.outputDir,
|
|
535
|
+
context: options
|
|
536
|
+
});
|
|
537
|
+
|
|
538
|
+
const resultsList = result.results
|
|
539
|
+
.map(r => {
|
|
540
|
+
const icon = r.success ? ' ' : ' ';
|
|
541
|
+
return `${icon} ${r.template}: ${r.success ? r.outputPath : r.error}`;
|
|
542
|
+
})
|
|
543
|
+
.join('\n');
|
|
544
|
+
|
|
545
|
+
return {
|
|
546
|
+
content: [{
|
|
547
|
+
type: 'text',
|
|
548
|
+
text: `## Batch Generation Complete
|
|
549
|
+
|
|
550
|
+
**Category:** ${category}
|
|
551
|
+
**Generated:** ${result.generated}/${templates.length}
|
|
552
|
+
**Failed:** ${result.failed}
|
|
553
|
+
|
|
554
|
+
### Results
|
|
555
|
+
|
|
556
|
+
${resultsList}
|
|
557
|
+
|
|
558
|
+
### Next Steps
|
|
559
|
+
|
|
560
|
+
1. Review generated documents in your output directory
|
|
561
|
+
2. Use \`bootspring_content\` action: "enhance" for AI improvement prompts
|
|
562
|
+
3. Customize placeholders and project-specific details
|
|
563
|
+
4. Have appropriate experts review (legal for legal docs, etc.)`
|
|
564
|
+
}]
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
module.exports = {
|
|
569
|
+
getToolDefinition,
|
|
570
|
+
createHandler
|
|
571
|
+
};
|