@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,703 @@
1
+ /**
2
+ * Bootspring Agent Command
3
+ * Work with specialized AI agents
4
+ *
5
+ * @package bootspring
6
+ * @module cli/agent
7
+ */
8
+
9
+ import * as utils from '../core/utils';
10
+ import * as telemetry from '../core/telemetry';
11
+ import * as auth from '../core/auth';
12
+
13
+ // =============================================================================
14
+ // Types
15
+ // =============================================================================
16
+
17
+ /**
18
+ * Agent definition
19
+ */
20
+ export interface Agent {
21
+ name: string;
22
+ category: string;
23
+ description: string;
24
+ expertise: string[];
25
+ triggers: string[];
26
+ }
27
+
28
+ /**
29
+ * Agent map
30
+ */
31
+ export type AgentMap = Record<string, Agent>;
32
+
33
+ /**
34
+ * Agent access result
35
+ */
36
+ interface AgentAccessResult {
37
+ allowed: boolean;
38
+ requiredTier?: string | undefined;
39
+ }
40
+
41
+ /**
42
+ * Agent context result from API
43
+ */
44
+ interface AgentContextResult {
45
+ context?: string | undefined;
46
+ name?: string | undefined;
47
+ error?: 'upgrade_required' | 'auth_required' | undefined;
48
+ requiredTier?: string | undefined;
49
+ }
50
+
51
+ /**
52
+ * Tier enforcement module interface
53
+ */
54
+ interface TierEnforcementModule {
55
+ AGENT_TIERS: Record<string, string>;
56
+ checkAgentAccess: (agentId: string) => AgentAccessResult;
57
+ getTier: () => string;
58
+ getUpgradePrompt: (featureName: string, requiredTier: string) => string;
59
+ }
60
+
61
+ /**
62
+ * API client module interface
63
+ */
64
+ interface ApiClientModule {
65
+ getAgentContext: (agentId: string) => Promise<AgentContextResult>;
66
+ }
67
+
68
+ // =============================================================================
69
+ // Module imports (JavaScript modules)
70
+ // =============================================================================
71
+
72
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
73
+ const tierEnforcement = require('../../core/tier-enforcement') as TierEnforcementModule;
74
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
75
+ const api = require('../../core/api-client') as ApiClientModule;
76
+
77
+ const { AGENT_TIERS, checkAgentAccess: canAccessAgent } = tierEnforcement;
78
+
79
+ // =============================================================================
80
+ // Helper Functions
81
+ // =============================================================================
82
+
83
+ /**
84
+ * Track agent invocation via telemetry
85
+ */
86
+ function trackAgentInvocation(agentId: string, topic: string | null = null): void {
87
+ try {
88
+ telemetry.emitEvent('agent.invoked', {
89
+ agent: agentId,
90
+ topic: topic ? topic.substring(0, 100) : null, // Truncate for privacy
91
+ timestamp: new Date().toISOString()
92
+ });
93
+ } catch {
94
+ // Telemetry should never break the command
95
+ }
96
+ }
97
+
98
+ /**
99
+ * Fetch agent context from API (thin client model)
100
+ * Agent context is not bundled locally - must be fetched from API
101
+ */
102
+ async function fetchAgentContext(agentId: string): Promise<AgentContextResult | null> {
103
+ if (!auth.isAuthenticated()) {
104
+ return null;
105
+ }
106
+
107
+ try {
108
+ const response = await api.getAgentContext(agentId);
109
+ return response;
110
+ } catch (error) {
111
+ const err = error as { status?: number; requiredTier?: string };
112
+ if (err.status === 403) {
113
+ // Tier not sufficient - will be handled by canAccessAgent
114
+ return { error: 'upgrade_required', requiredTier: err.requiredTier };
115
+ }
116
+ if (err.status === 401) {
117
+ return { error: 'auth_required' };
118
+ }
119
+ // Network error or other issue
120
+ return null;
121
+ }
122
+ }
123
+
124
+ // =============================================================================
125
+ // Agent Definitions
126
+ // =============================================================================
127
+
128
+ /**
129
+ * All available agents
130
+ */
131
+ export const AGENTS: AgentMap = {
132
+ 'database-expert': {
133
+ name: 'Database Expert',
134
+ category: 'Backend',
135
+ description: 'Specializes in database design, queries, migrations, and optimization',
136
+ expertise: ['SQL', 'NoSQL', 'Prisma', 'Drizzle', 'PostgreSQL', 'MongoDB'],
137
+ triggers: ['database', 'schema', 'migration', 'query', 'prisma', 'sql']
138
+ },
139
+ 'security-expert': {
140
+ name: 'Security Expert',
141
+ category: 'Security',
142
+ description: 'Focuses on application security, OWASP, authentication, and authorization',
143
+ expertise: ['OWASP', 'Authentication', 'Authorization', 'Input Validation', 'XSS', 'CSRF'],
144
+ triggers: ['security', 'auth', 'owasp', 'vulnerability', 'xss', 'csrf', 'injection']
145
+ },
146
+ 'frontend-expert': {
147
+ name: 'Frontend Expert',
148
+ category: 'Frontend',
149
+ description: 'Expert in React, Next.js, UI components, and modern frontend patterns',
150
+ expertise: ['React', 'Next.js', 'TypeScript', 'Tailwind', 'Components', 'State Management'],
151
+ triggers: ['component', 'react', 'frontend', 'ui', 'tailwind', 'css', 'styling']
152
+ },
153
+ 'backend-expert': {
154
+ name: 'Backend Expert',
155
+ category: 'Backend',
156
+ description: 'Specializes in server-side development, APIs, and business logic',
157
+ expertise: ['Node.js', 'APIs', 'Server Actions', 'Middleware', 'Business Logic'],
158
+ triggers: ['api', 'backend', 'server', 'endpoint', 'route', 'middleware']
159
+ },
160
+ 'api-expert': {
161
+ name: 'API Expert',
162
+ category: 'Backend',
163
+ description: 'Focuses on API design, REST, GraphQL, and integration patterns',
164
+ expertise: ['REST', 'GraphQL', 'tRPC', 'OpenAPI', 'Webhooks', 'Integration'],
165
+ triggers: ['api', 'rest', 'graphql', 'trpc', 'webhook', 'endpoint']
166
+ },
167
+ 'testing-expert': {
168
+ name: 'Testing Expert',
169
+ category: 'Quality',
170
+ description: 'Expert in testing strategies, test frameworks, and quality assurance',
171
+ expertise: ['Unit Testing', 'Integration Testing', 'E2E', 'Vitest', 'Jest', 'Playwright'],
172
+ triggers: ['test', 'testing', 'jest', 'vitest', 'playwright', 'coverage']
173
+ },
174
+ 'performance-expert': {
175
+ name: 'Performance Expert',
176
+ category: 'DevOps',
177
+ description: 'Specializes in performance optimization, caching, and monitoring',
178
+ expertise: ['Optimization', 'Caching', 'Profiling', 'Core Web Vitals', 'Load Testing'],
179
+ triggers: ['performance', 'optimize', 'cache', 'slow', 'speed', 'profiling']
180
+ },
181
+ 'devops-expert': {
182
+ name: 'DevOps Expert',
183
+ category: 'DevOps',
184
+ description: 'Focuses on deployment, CI/CD, infrastructure, and monitoring',
185
+ expertise: ['CI/CD', 'Docker', 'Kubernetes', 'Monitoring', 'Infrastructure'],
186
+ triggers: ['deploy', 'ci', 'cd', 'docker', 'kubernetes', 'infrastructure']
187
+ },
188
+ 'ui-ux-expert': {
189
+ name: 'UI/UX Expert',
190
+ category: 'Frontend',
191
+ description: 'Expert in user interface design, user experience, and accessibility',
192
+ expertise: ['Design Systems', 'Accessibility', 'Responsive Design', 'Animation'],
193
+ triggers: ['ui', 'ux', 'design', 'accessibility', 'a11y', 'responsive']
194
+ },
195
+ 'architecture-expert': {
196
+ name: 'Architecture Expert',
197
+ category: 'Backend',
198
+ description: 'Specializes in system architecture, design patterns, and scalability',
199
+ expertise: ['System Design', 'Design Patterns', 'Microservices', 'Scalability'],
200
+ triggers: ['architecture', 'design', 'pattern', 'scalability', 'structure']
201
+ },
202
+ 'code-review-expert': {
203
+ name: 'Code Review Expert',
204
+ category: 'Quality',
205
+ description: 'Focuses on code quality, best practices, and constructive feedback',
206
+ expertise: ['Code Quality', 'Best Practices', 'Refactoring', 'Clean Code'],
207
+ triggers: ['review', 'refactor', 'quality', 'clean', 'improve']
208
+ },
209
+ 'vercel-expert': {
210
+ name: 'Vercel Expert',
211
+ category: 'DevOps',
212
+ description: 'Expert in Vercel deployment, serverless, and edge functions',
213
+ expertise: ['Vercel', 'Serverless', 'Edge Functions', 'ISR', 'Deployment'],
214
+ triggers: ['vercel', 'serverless', 'edge', 'deployment', 'hosting']
215
+ },
216
+ 'business-strategy-expert': {
217
+ name: 'Business Strategy Expert',
218
+ category: 'Business',
219
+ description: 'Specializes in business model design, market analysis, and strategic planning',
220
+ expertise: ['Business Models', 'Market Analysis', 'Competitive Strategy', 'Go-to-Market', 'Unit Economics'],
221
+ triggers: ['business', 'strategy', 'market', 'model', 'gtm', 'positioning']
222
+ },
223
+ 'financial-expert': {
224
+ name: 'Financial Expert',
225
+ category: 'Business',
226
+ description: 'Expert in financial modeling, projections, and startup finance',
227
+ expertise: ['Financial Modeling', 'Revenue Projections', 'Unit Economics', 'Cash Flow', 'Budgeting'],
228
+ triggers: ['financial', 'finance', 'revenue', 'projection', 'budget', 'cash', 'model']
229
+ },
230
+ 'fundraising-expert': {
231
+ name: 'Fundraising Expert',
232
+ category: 'Business',
233
+ description: 'Specializes in investor relations, pitch decks, and fundraising strategy',
234
+ expertise: ['Pitch Decks', 'Investor Relations', 'Term Sheets', 'Due Diligence', 'Fundraising Strategy'],
235
+ triggers: ['fundraise', 'investor', 'pitch', 'deck', 'seed', 'series', 'vc', 'angel']
236
+ },
237
+ 'private-equity-expert': {
238
+ name: 'Private Equity Expert',
239
+ category: 'Business',
240
+ description: 'Expert in PE/VC dynamics, valuation, and deal structuring',
241
+ expertise: ['Valuation', 'Deal Structure', 'Cap Tables', 'Term Sheets', 'Exit Strategy'],
242
+ triggers: ['pe', 'equity', 'valuation', 'cap table', 'term sheet', 'dilution']
243
+ },
244
+ 'investor-relations-expert': {
245
+ name: 'Investor Relations Expert',
246
+ category: 'Business',
247
+ description: 'Specializes in investor communications, reporting, and stakeholder management',
248
+ expertise: ['Investor Updates', 'Board Management', 'KPI Reporting', 'Stakeholder Communication'],
249
+ triggers: ['investor', 'board', 'update', 'reporting', 'stakeholder']
250
+ },
251
+ 'legal-expert': {
252
+ name: 'Legal Expert',
253
+ category: 'Business',
254
+ description: 'Expert in startup legal matters, contracts, and compliance',
255
+ expertise: ['Terms of Service', 'Privacy Policy', 'Contracts', 'IP', 'Compliance', 'GDPR'],
256
+ triggers: ['legal', 'terms', 'privacy', 'contract', 'compliance', 'gdpr', 'ip']
257
+ },
258
+ 'marketing-expert': {
259
+ name: 'Marketing Expert',
260
+ category: 'Business',
261
+ description: 'Specializes in digital marketing, content strategy, and brand building',
262
+ expertise: ['Content Marketing', 'SEO', 'Social Media', 'Email Marketing', 'Brand Strategy'],
263
+ triggers: ['marketing', 'content', 'seo', 'social', 'brand', 'campaign']
264
+ },
265
+ 'sales-expert': {
266
+ name: 'Sales Expert',
267
+ category: 'Business',
268
+ description: 'Expert in sales strategy, pipeline management, and customer acquisition',
269
+ expertise: ['Sales Strategy', 'Pipeline Management', 'CRM', 'Lead Generation', 'Closing'],
270
+ triggers: ['sales', 'pipeline', 'lead', 'crm', 'close', 'deal', 'prospect']
271
+ },
272
+ 'growth-expert': {
273
+ name: 'Growth Expert',
274
+ category: 'Business',
275
+ description: 'Specializes in growth hacking, metrics, and user acquisition',
276
+ expertise: ['Growth Hacking', 'User Acquisition', 'Retention', 'Viral Loops', 'A/B Testing'],
277
+ triggers: ['growth', 'acquisition', 'retention', 'viral', 'metrics', 'experiment']
278
+ },
279
+ 'operations-expert': {
280
+ name: 'Operations Expert',
281
+ category: 'Business',
282
+ description: 'Expert in operational efficiency, processes, and team management',
283
+ expertise: ['Process Design', 'Team Management', 'Hiring', 'OKRs', 'Operational Efficiency'],
284
+ triggers: ['operations', 'ops', 'process', 'team', 'hiring', 'okr', 'efficiency']
285
+ },
286
+ 'competitive-analysis-expert': {
287
+ name: 'Competitive Analysis Expert',
288
+ category: 'Business',
289
+ description: 'Specializes in market research, competitor analysis, and positioning',
290
+ expertise: ['Competitor Analysis', 'Market Research', 'SWOT', 'Positioning', 'Differentiation'],
291
+ triggers: ['competitive', 'competitor', 'analysis', 'market', 'swot', 'positioning']
292
+ },
293
+ 'partnerships-expert': {
294
+ name: 'Partnerships Expert',
295
+ category: 'Business',
296
+ description: 'Expert in partnership development, BD, and strategic alliances',
297
+ expertise: ['Partnership Development', 'Business Development', 'Strategic Alliances', 'Channel Partners'],
298
+ triggers: ['partnership', 'partner', 'bd', 'alliance', 'channel', 'integration']
299
+ },
300
+ 'railway-expert': {
301
+ name: 'Railway Expert',
302
+ category: 'DevOps',
303
+ description: 'Expert in Railway deployment, databases, and infrastructure',
304
+ expertise: ['Railway', 'PostgreSQL', 'Redis', 'Deployment', 'Scaling'],
305
+ triggers: ['railway', 'deploy', 'postgres', 'redis', 'infrastructure']
306
+ },
307
+ 'monitoring-expert': {
308
+ name: 'Monitoring Expert',
309
+ category: 'DevOps',
310
+ description: 'Specializes in observability, logging, metrics, and alerting',
311
+ expertise: ['Observability', 'Logging', 'Metrics', 'Alerting', 'APM', 'Sentry', 'Datadog'],
312
+ triggers: ['monitoring', 'logging', 'metrics', 'alerts', 'observability', 'sentry']
313
+ },
314
+ 'research-expert': {
315
+ name: 'Research Expert',
316
+ category: 'Research',
317
+ description: 'Expert in market research, user research, and data analysis',
318
+ expertise: ['Market Research', 'User Research', 'Surveys', 'Interviews', 'Data Analysis'],
319
+ triggers: ['research', 'survey', 'interview', 'user research', 'market research']
320
+ },
321
+ 'data-modeling-expert': {
322
+ name: 'Data Modeling Expert',
323
+ category: 'Research',
324
+ description: 'Specializes in data architecture, ERD design, and schema optimization',
325
+ expertise: ['ERD Design', 'Schema Design', 'Normalization', 'Indexing', 'Data Architecture'],
326
+ triggers: ['data model', 'erd', 'schema', 'entity', 'relationship', 'normalization']
327
+ },
328
+ 'payment-expert': {
329
+ name: 'Payment Expert',
330
+ category: 'Integration',
331
+ description: 'Expert in payment processing, Stripe integration, and subscription billing',
332
+ expertise: ['Stripe', 'Subscriptions', 'Billing', 'Webhooks', 'Checkout', 'Payment Processing'],
333
+ triggers: ['payment', 'stripe', 'subscription', 'billing', 'checkout', 'invoice']
334
+ },
335
+ 'ai-integration-expert': {
336
+ name: 'AI Integration Expert',
337
+ category: 'Integration',
338
+ description: 'Specializes in AI/LLM integration, Anthropic Claude, and AI SDK',
339
+ expertise: ['Claude API', 'AI SDK', 'Streaming', 'Tool Use', 'RAG', 'Embeddings'],
340
+ triggers: ['ai', 'llm', 'claude', 'anthropic', 'openai', 'streaming', 'embedding']
341
+ },
342
+ 'email-expert': {
343
+ name: 'Email Expert',
344
+ category: 'Integration',
345
+ description: 'Expert in email integration, Resend, and transactional emails',
346
+ expertise: ['Resend', 'React Email', 'Transactional Email', 'Templates', 'Email Delivery'],
347
+ triggers: ['email', 'resend', 'sendgrid', 'template', 'notification', 'transactional']
348
+ },
349
+ 'auth-expert': {
350
+ name: 'Auth Expert',
351
+ category: 'Integration',
352
+ description: 'Specializes in authentication, Clerk, NextAuth, and session management',
353
+ expertise: ['Clerk', 'NextAuth', 'OAuth', 'JWT', 'Session Management', 'RBAC'],
354
+ triggers: ['auth', 'authentication', 'login', 'session', 'oauth', 'clerk', 'nextauth']
355
+ },
356
+ 'content-expert': {
357
+ name: 'Content Expert',
358
+ category: 'Content',
359
+ description: 'Expert in technical writing, documentation, blogs, marketing copy, and content strategy',
360
+ expertise: ['Technical Writing', 'Documentation', 'Blog Posts', 'Release Notes', 'README', 'API Docs', 'SEO', 'Content Strategy'],
361
+ triggers: ['content', 'writing', 'documentation', 'docs', 'blog', 'readme', 'changelog', 'copy', 'article', 'marketing']
362
+ },
363
+ 'product-expert': {
364
+ name: 'Product Expert',
365
+ category: 'Product',
366
+ description: 'Expert in product management, roadmapping, feature prioritization, and user research',
367
+ expertise: ['Product Strategy', 'Roadmapping', 'Feature Prioritization', 'User Research', 'PRDs', 'OKRs', 'Metrics', 'Product-Market Fit'],
368
+ triggers: ['product', 'roadmap', 'feature', 'prioritization', 'prd', 'requirements', 'user research', 'okr', 'metrics', 'backlog']
369
+ },
370
+ 'mobile-expert': {
371
+ name: 'Mobile Expert',
372
+ category: 'Mobile',
373
+ description: 'Expert in mobile development with React Native, Flutter, iOS, and Android',
374
+ expertise: ['React Native', 'Flutter', 'iOS', 'Android', 'Mobile Architecture', 'App Store', 'Push Notifications', 'Offline-First'],
375
+ triggers: ['mobile', 'react native', 'flutter', 'ios', 'android', 'app', 'native', 'swift', 'kotlin', 'expo']
376
+ },
377
+ 'infrastructure-expert': {
378
+ name: 'Infrastructure Expert',
379
+ category: 'DevOps',
380
+ description: 'Expert in cloud infrastructure, Terraform, Kubernetes, and DevOps practices',
381
+ expertise: ['AWS', 'GCP', 'Azure', 'Terraform', 'Kubernetes', 'Docker', 'CI/CD', 'Infrastructure-as-Code', 'Cloud Architecture'],
382
+ triggers: ['infrastructure', 'cloud', 'aws', 'gcp', 'terraform', 'kubernetes', 'k8s', 'docker', 'devops', 'iac']
383
+ }
384
+ };
385
+
386
+ // =============================================================================
387
+ // Command Functions
388
+ // =============================================================================
389
+
390
+ /**
391
+ * List all available agents
392
+ */
393
+ export function listAgents(): void {
394
+ const userTier = tierEnforcement.getTier();
395
+
396
+ console.log(`
397
+ ${utils.COLORS.cyan}${utils.COLORS.bold}\u26a1 Bootspring Agents${utils.COLORS.reset}
398
+ ${utils.COLORS.dim}Specialized AI expertise on demand${utils.COLORS.reset}
399
+ ${utils.COLORS.dim}Your tier: ${userTier}${utils.COLORS.reset}
400
+ `);
401
+
402
+ // Group by category
403
+ const categories: Record<string, Array<Agent & { id: string }>> = {};
404
+ for (const [id, agent] of Object.entries(AGENTS)) {
405
+ if (!categories[agent.category]) {
406
+ categories[agent.category] = [];
407
+ }
408
+ const categoryGroup = categories[agent.category];
409
+ if (categoryGroup) {
410
+ categoryGroup.push({ id, ...agent });
411
+ }
412
+ }
413
+
414
+ let accessibleCount = 0;
415
+ let lockedCount = 0;
416
+
417
+ for (const [category, agents] of Object.entries(categories)) {
418
+ console.log(`${utils.COLORS.bold}${category}${utils.COLORS.reset}`);
419
+ for (const agent of agents) {
420
+ const access = canAccessAgent(agent.id);
421
+ const tierBadge = AGENT_TIERS[agent.id]
422
+ ? ` ${utils.COLORS.yellow}[${AGENT_TIERS[agent.id]}]${utils.COLORS.reset}`
423
+ : '';
424
+ const lockIcon = access.allowed ? '' : ` ${utils.COLORS.red}\ud83d\udd12${utils.COLORS.reset}`;
425
+
426
+ if (access.allowed) {
427
+ accessibleCount++;
428
+ } else {
429
+ lockedCount++;
430
+ }
431
+
432
+ console.log(` ${utils.COLORS.cyan}${agent.id}${utils.COLORS.reset}${tierBadge}${lockIcon}`);
433
+ console.log(` ${utils.COLORS.dim}${agent.description}${utils.COLORS.reset}`);
434
+ }
435
+ console.log();
436
+ }
437
+
438
+ utils.print.dim(`${accessibleCount} agents available, ${lockedCount} locked`);
439
+ utils.print.dim('Use "bootspring agent show <name>" for details');
440
+ }
441
+
442
+ /**
443
+ * Show agent details
444
+ */
445
+ export function showAgent(agentId: string): void {
446
+ const agent = AGENTS[agentId];
447
+
448
+ if (!agent) {
449
+ utils.print.error(`Agent not found: ${agentId}`);
450
+ utils.print.dim('Use "bootspring agent list" to see available agents');
451
+ return;
452
+ }
453
+
454
+ console.log(`
455
+ ${utils.COLORS.cyan}${utils.COLORS.bold}\u26a1 ${agent.name}${utils.COLORS.reset}
456
+ ${utils.COLORS.dim}Category: ${agent.category}${utils.COLORS.reset}
457
+
458
+ ${utils.COLORS.bold}Description${utils.COLORS.reset}
459
+ ${agent.description}
460
+
461
+ ${utils.COLORS.bold}Expertise${utils.COLORS.reset}
462
+ ${agent.expertise.map(e => ` ${utils.COLORS.green}\u25cf${utils.COLORS.reset} ${e}`).join('\n')}
463
+
464
+ ${utils.COLORS.bold}Trigger Keywords${utils.COLORS.reset}
465
+ ${agent.triggers.map(t => ` ${utils.COLORS.dim}${t}${utils.COLORS.reset}`).join(', ')}
466
+
467
+ ${utils.COLORS.bold}Usage${utils.COLORS.reset}
468
+ bootspring agent invoke ${agentId} --topic "your question"
469
+ `);
470
+ }
471
+
472
+ /**
473
+ * Invoke an agent
474
+ */
475
+ export async function invokeAgent(agentId: string, args: string[]): Promise<void> {
476
+ const agent = AGENTS[agentId];
477
+
478
+ if (!agent) {
479
+ utils.print.error(`Agent not found: ${agentId}`);
480
+ utils.print.dim('Use "bootspring agent list" to see available agents');
481
+ return;
482
+ }
483
+
484
+ // Check authentication first
485
+ if (!auth.isAuthenticated()) {
486
+ console.log(`
487
+ ${utils.COLORS.yellow}${utils.COLORS.bold}\u26a1 ${agent.name}${utils.COLORS.reset}
488
+ ${utils.COLORS.red}Authentication required${utils.COLORS.reset}
489
+
490
+ ${utils.COLORS.dim}Agent context is served from the API. Please log in:${utils.COLORS.reset}
491
+ ${utils.COLORS.cyan}bootspring auth login${utils.COLORS.reset}
492
+ `);
493
+ return;
494
+ }
495
+
496
+ // Check tier access (client-side check for UX, server enforces)
497
+ const access = canAccessAgent(agentId);
498
+ if (!access.allowed) {
499
+ console.log(`
500
+ ${utils.COLORS.yellow}${utils.COLORS.bold}\u26a1 ${agent.name}${utils.COLORS.reset}
501
+ ${utils.COLORS.red}This agent requires ${access.requiredTier ?? 'pro'} tier or higher.${utils.COLORS.reset}
502
+ `);
503
+ console.log(tierEnforcement.getUpgradePrompt(agent.name, access.requiredTier ?? 'pro'));
504
+ return;
505
+ }
506
+
507
+ const isMCP = utils.isMCPContext();
508
+ const parsedArgs = utils.parseArgs(args);
509
+ const topic = (parsedArgs.topic as string) ?? args.filter(a => !a.startsWith('--')).join(' ');
510
+
511
+ // Track agent invocation
512
+ trackAgentInvocation(agentId, topic || null);
513
+
514
+ console.log(`
515
+ ${utils.COLORS.cyan}${utils.COLORS.bold}\u26a1 ${agent.name}${utils.COLORS.reset}
516
+ ${utils.COLORS.dim}${agent.description}${utils.COLORS.reset}
517
+ `);
518
+
519
+ // Fetch agent context from API (thin client - no local content)
520
+ const spinner = utils.createSpinner('Loading agent context...');
521
+ spinner.start();
522
+
523
+ const contextResult = await fetchAgentContext(agentId);
524
+
525
+ if (!contextResult) {
526
+ spinner.fail('Failed to load agent context');
527
+ console.log(`${utils.COLORS.dim}Check your internet connection and try again.${utils.COLORS.reset}`);
528
+ return;
529
+ }
530
+
531
+ if (contextResult.error === 'upgrade_required') {
532
+ spinner.fail('Upgrade required');
533
+ console.log(tierEnforcement.getUpgradePrompt(agent.name, contextResult.requiredTier ?? 'pro'));
534
+ return;
535
+ }
536
+
537
+ if (contextResult.error === 'auth_required') {
538
+ spinner.fail('Authentication required');
539
+ console.log(`${utils.COLORS.dim}Run: bootspring auth login${utils.COLORS.reset}`);
540
+ return;
541
+ }
542
+
543
+ spinner.succeed('Agent context loaded');
544
+
545
+ // In MCP mode, output the context for the AI to use
546
+ if (isMCP) {
547
+ console.log(`\n${utils.COLORS.bold}Agent Context:${utils.COLORS.reset}\n`);
548
+ console.log(contextResult.context ?? '');
549
+ return;
550
+ }
551
+
552
+ // CLI mode - show context and guidance
553
+ console.log(`\n${utils.COLORS.bold}Agent Context:${utils.COLORS.reset}`);
554
+ console.log(`${utils.COLORS.dim}\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500${utils.COLORS.reset}`);
555
+
556
+ // Show truncated context in CLI mode
557
+ const contextLines = (contextResult.context ?? '').split('\n');
558
+ const previewLines = contextLines.slice(0, 20);
559
+ console.log(previewLines.join('\n'));
560
+
561
+ if (contextLines.length > 20) {
562
+ console.log(`\n${utils.COLORS.dim}... (${contextLines.length - 20} more lines)${utils.COLORS.reset}`);
563
+ }
564
+
565
+ console.log(`${utils.COLORS.dim}\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500${utils.COLORS.reset}`);
566
+
567
+ if (topic) {
568
+ console.log(`\n${utils.COLORS.bold}Your topic:${utils.COLORS.reset} "${topic}"
569
+ ${utils.COLORS.dim}Use this context with your AI assistant for the topic above.${utils.COLORS.reset}
570
+ `);
571
+ }
572
+
573
+ console.log(`
574
+ ${utils.COLORS.bold}Usage:${utils.COLORS.reset}
575
+ Copy the context above and use it with your AI assistant.
576
+
577
+ ${utils.COLORS.yellow}${utils.COLORS.bold}Enhanced Mode${utils.COLORS.reset}
578
+ ${utils.COLORS.dim}With MCP integration, agents activate automatically.${utils.COLORS.reset}
579
+ ${utils.COLORS.cyan}bootspring mcp start${utils.COLORS.reset}
580
+ `);
581
+ }
582
+
583
+ /**
584
+ * Search for agents by keyword
585
+ */
586
+ export function searchAgents(query: string): void {
587
+ const queryLower = query.toLowerCase();
588
+
589
+ const matches = Object.entries(AGENTS).filter(([id, agent]) => {
590
+ return id.includes(queryLower) ||
591
+ agent.name.toLowerCase().includes(queryLower) ||
592
+ agent.description.toLowerCase().includes(queryLower) ||
593
+ agent.expertise.some(e => e.toLowerCase().includes(queryLower)) ||
594
+ agent.triggers.some(t => t.includes(queryLower));
595
+ });
596
+
597
+ if (matches.length === 0) {
598
+ utils.print.warning(`No agents found matching "${query}"`);
599
+ utils.print.dim('Use "bootspring agent list" to see all agents');
600
+ return;
601
+ }
602
+
603
+ console.log(`
604
+ ${utils.COLORS.cyan}${utils.COLORS.bold}\u26a1 Agent Search: "${query}"${utils.COLORS.reset}
605
+ `);
606
+
607
+ for (const [id, agent] of matches) {
608
+ console.log(` ${utils.COLORS.cyan}${id}${utils.COLORS.reset} - ${agent.description}`);
609
+ }
610
+
611
+ console.log();
612
+ utils.print.dim(`${matches.length} agents found`);
613
+ }
614
+
615
+ /**
616
+ * Show agent help
617
+ */
618
+ function showHelp(): void {
619
+ console.log(`
620
+ ${utils.COLORS.cyan}${utils.COLORS.bold}\u26a1 Bootspring Agent${utils.COLORS.reset}
621
+ ${utils.COLORS.dim}Work with specialized AI agents${utils.COLORS.reset}
622
+
623
+ ${utils.COLORS.bold}Usage:${utils.COLORS.reset}
624
+ bootspring agent <command> [args]
625
+
626
+ ${utils.COLORS.bold}Commands:${utils.COLORS.reset}
627
+ ${utils.COLORS.cyan}list${utils.COLORS.reset} List all available agents
628
+ ${utils.COLORS.cyan}show${utils.COLORS.reset} <name> Show agent details
629
+ ${utils.COLORS.cyan}invoke${utils.COLORS.reset} <name> Invoke an agent
630
+ ${utils.COLORS.cyan}search${utils.COLORS.reset} <query> Search for agents
631
+
632
+ ${utils.COLORS.bold}Examples:${utils.COLORS.reset}
633
+ bootspring agent list
634
+ bootspring agent show security-expert
635
+ bootspring agent invoke database-expert --topic "optimize queries"
636
+ bootspring agent search performance
637
+ `);
638
+ }
639
+
640
+ // =============================================================================
641
+ // Main Entry Point
642
+ // =============================================================================
643
+
644
+ /**
645
+ * Run agent command
646
+ */
647
+ export async function run(args: string[]): Promise<void> {
648
+ const subcommand = args[0] ?? 'list';
649
+ const subargs = args.slice(1);
650
+
651
+ switch (subcommand) {
652
+ case 'list':
653
+ case 'ls':
654
+ listAgents();
655
+ break;
656
+
657
+ case 'show':
658
+ case 'info':
659
+ if (!subargs[0]) {
660
+ utils.print.error('Please specify an agent name');
661
+ utils.print.dim('Usage: bootspring agent show <name>');
662
+ return;
663
+ }
664
+ showAgent(subargs[0]);
665
+ break;
666
+
667
+ case 'invoke':
668
+ case 'use':
669
+ case 'call':
670
+ if (!subargs[0]) {
671
+ utils.print.error('Please specify an agent name');
672
+ utils.print.dim('Usage: bootspring agent invoke <name> --topic "your question"');
673
+ return;
674
+ }
675
+ await invokeAgent(subargs[0], subargs.slice(1));
676
+ break;
677
+
678
+ case 'search':
679
+ case 'find':
680
+ if (!subargs[0]) {
681
+ utils.print.error('Please specify a search query');
682
+ utils.print.dim('Usage: bootspring agent search <query>');
683
+ return;
684
+ }
685
+ searchAgents(subargs.join(' '));
686
+ break;
687
+
688
+ case 'help':
689
+ case '-h':
690
+ case '--help':
691
+ showHelp();
692
+ break;
693
+
694
+ default:
695
+ // Check if it's an agent name (shortcut for show)
696
+ if (AGENTS[subcommand]) {
697
+ showAgent(subcommand);
698
+ } else {
699
+ utils.print.error(`Unknown subcommand: ${subcommand}`);
700
+ showHelp();
701
+ }
702
+ }
703
+ }