oneie 1.0.0 → 1.0.1

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/one/tools/cli.js DELETED
@@ -1,2275 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { Command } from 'commander';
4
- import { promises as fs } from 'fs';
5
- import path from 'path';
6
- import { fileURLToPath } from 'url';
7
- import process from 'process';
8
-
9
- const __filename = fileURLToPath(import.meta.url);
10
- const __dirname = path.dirname(__filename);
11
- const program = new Command();
12
-
13
- // Responsive Display Functions
14
- function getTerminalWidth() {
15
- // Check environment variable first, then stdout.columns, then default to 80
16
- return parseInt(process.env.COLUMNS) || process.stdout.columns || 80;
17
- }
18
-
19
- function createResponsiveLogo() {
20
- const width = getTerminalWidth();
21
-
22
- if (width < 70) {
23
- // Compact logo for small screens
24
- return `
25
- ╔══════════════════════════════════════════════════╗
26
- ║ ║
27
- ║ ██████ ███ ██ █████ 🎯 ONE ║
28
- ║ ██ ██ ████ ██ ██ Still Hiring ║
29
- ║ ██ ██ ██ ██ ██ █████ Humans? ║
30
- ║ ██ ██ ██ ████ ██ ║
31
- ║ ██████ ██ ███ █████ ATTRACT>CONVERT>GROW║
32
- ║ With AI Agents ║
33
- ║ https://one.ie/ ║
34
- ║ ║
35
- ╚══════════════════════════════════════════════════╝`;
36
- } else if (width < 120) {
37
- // Medium logo for standard screens
38
- return `
39
- ╔══════════════════════════════════════════════════════════════════╗
40
- ║ ║
41
- ║ ██████╗ ███╗ ██╗███████╗ 🎯 ONE Framework ║
42
- ║ ██╔═══██╗████╗ ██║██╔════╝ Still Hiring Humans? ║
43
- ║ ██║ ██║██╔██╗ ██║█████╗ ║
44
- ║ ██║ ██║██║╚██╗██║██╔══╝ ATTRACT > CONVERT > GROW ║
45
- ║ ╚██████╔╝██║ ╚████║███████╗ With AI Agents ║
46
- ║ ╚═════╝ ╚═╝ ╚═══╝╚══════╝ https://one.ie/ ║
47
- ║ ║
48
- ╚══════════════════════════════════════════════════════════════════╝`;
49
- } else {
50
- // Full logo for large screens
51
- return `
52
- ╔════════════════════════════════════════════════════════════════════╗
53
- ║ ║
54
- ║ ██████╗ ███╗ ██╗███████╗ ┌─────────────────────────┐ ║
55
- ║ ██╔═══██╗████╗ ██║██╔════╝ │ Still Hiring Humans? │ ║
56
- ║ ██║ ██║██╔██╗ ██║█████╗ │ │ ║
57
- ║ ██║ ██║██║╚██╗██║██╔══╝ └─────────────────────────┘ ║
58
- ║ ╚██████╔╝██║ ╚████║███████╗ 🎯 ATTRACT > CONVERT > GROW ║
59
- ║ ╚═════╝ ╚═╝ ╚═══╝╚══════╝ With AI Agents ║
60
- ║ https://one.ie/ ║
61
- ║ ║
62
- ╚════════════════════════════════════════════════════════════════════╝`;
63
- }
64
- }
65
-
66
- function createResponsiveMenu() {
67
- const width = getTerminalWidth();
68
-
69
- if (width < 70) {
70
- // Compact menu for small screens
71
- return `
72
- ┌─────────────────────────────────────────────────┐
73
- │ 🤝 JOIN AI AGENT TEAMS │
74
- ├─────────────────────────────────────────────────┤
75
- │ │
76
- │ 💼 TEAMS: │
77
- │ [1] 🔬 Research [2] 📝 Content │
78
- │ [3] 📈 Marketing [4] 💰 Sales │
79
- │ [5] 🤝 Service [6] 🎨 Design │
80
- │ [7] 🛠️ Engineering [8] 🎓 Education │
81
- │ [9] 🧠 Intelligence │
82
- │ │
83
- │ 🏗️ MENU: │
84
- │ [H] 👥 Humans [A] 🤖 Agents │
85
- │ [T] 🏢 Teams [t] 🛠️ Tools │
86
- │ [L] 📚 Stories [W] 🔄 Workflows │
87
- │ │
88
- │ 📚 STUDIO: │
89
- │ [i] 💡 Ideas [w] 📄 Stories │
90
- │ [P] 📊 Playbooks [B] 📖 Books │
91
- │ [D] 📋 Templates │
92
- │ │
93
- │ 🎯 MISSION: │
94
- │ [O] 🎭 Coordinate [M] 🧙 Tasks │
95
- │ [F] 🌊 Flows │
96
- │ │
97
- │ ℹ️ PLATFORM: │
98
- │ [?] ❓ Help [K] 📚 Knowledge │
99
- │ [S] 📈 Status [Q] 🚪 Exit │
100
- │ │
101
- └─────────────────────────────────────────────────┘`;
102
- } else {
103
- // Full menu for larger screens
104
- return `
105
- ┌─────────────────────────────────────────────────────────────────┐
106
- │ 🤝 JOIN EXPERT TEAMS OF AI AGENTS AND HUMANS │
107
- ├─────────────────────────────────────────────────────────────────┤
108
- │ │
109
- │ 💼 TEAMS: │
110
- │ [1] 🔬 Research - Deep insights & market intelligence │
111
- │ [2] 📝 Content - Stories, books & compelling copy │
112
- │ [3] 📈 Marketing - Viral growth & brand strategies │
113
- │ [4] 💰 Sales - Revenue acceleration & deal closing │
114
- │ [5] 🤝 Service - Customer success & experience design │
115
- │ [6] 🎨 Design - Beautiful interfaces & visual identity │
116
- │ [7] 🛠️ Engineering - Full-stack development & architecture │
117
- │ [8] 🎓 Education - Learning experiences & knowledge scale │
118
- │ [9] 🧠 Intelligence - Data science & predictive modeling │
119
- │ │
120
- │ 🏗️ MENU: │
121
- │ [H] 👥 Humans - Connect with our global community │
122
- │ [A] 🤖 Agents - 18 specialized AI personalities │
123
- │ [T] 🏢 Teams - Cross-functional collaboration hubs │
124
- │ [t] 🛠️ Tools - CLI, GitHub, shadcn/ui, Convex, IDE │
125
- │ [L] 📚 Listen to Stories - Tell stories │
126
- │ [W] 🔄 Workflows - Proven business methodologies │
127
- │ │
128
- │ 📚 STUDIO: │
129
- │ [i] 💡 What's Your Idea? - Capture creative vision │
130
- │ [w] 📄 Write a Story - Narratives & case studies │
131
- │ [P] 📊 Create a Playbook - Custom industry guides │
132
- │ [B] 📖 Publish a Book - Complete publications (PDF/EPUB) │
133
- │ [D] 📋 Use Template - Professional document frameworks │
134
- │ │
135
- │ 🎯 MISSION CONTROL: │
136
- │ [O] 🎭 Coordinate - Multi-agent coordination │
137
- │ [M] 🧙 Tasks - Direct task execution │
138
- │ [F] 🌊 Flows - Custom workflow creation │
139
- │ │
140
- │ ℹ️ PLATFORM: │
141
- │ [?] ❓ Help - Complete command reference │
142
- │ [K] 📚 Knowledge - ONE Playbookology & frameworks │
143
- │ [S] 📈 Status - Your projects & progress │
144
- │ [Q] 🚪 Exit - Leave platform │
145
- │ │
146
- └─────────────────────────────────────────────────────────────────┘`;
147
- }
148
- }
149
-
150
- function displayONEInterface() {
151
- console.clear();
152
- console.log(createResponsiveLogo());
153
- console.log(createResponsiveMenu());
154
- console.log('\n**🎯 Select your path to exponential growth:**');
155
- console.log('_[Enter choice: 1-9, L, H, A, T, t, W, i, w, P, B, D, O, M, F, ?, K, S, Q]_');
156
- console.log('\n**✍️ Write a Story: /story**');
157
- }
158
-
159
- // Mission 9: Beautiful Simplicity Through Unified Orchestration
160
- // Single gateway to the entire ONE ecosystem
161
-
162
- // Team-based agent categorization with hyphenated naming convention
163
- const MARKETING_TEAM_AGENTS = [
164
- // New team-prefixed agents
165
- 'marketing-director',
166
- 'marketing-content-poster',
167
- // Legacy marketing agents (gradually migrating to team-prefixed names)
168
- 'elevate-marketing-orchestrator',
169
- 'brand-identity-specialist',
170
- 'content-hook-specialist',
171
- 'customer-journey-designer',
172
- 'customer-success-manager',
173
- 'engagement-specialist',
174
- 'lead-capture-expert',
175
- 'lead-magnet-creator',
176
- 'market-research-analyst',
177
- 'nurture-campaign-manager',
178
- 'sales-environment-optimizer',
179
- 'upsell-strategist',
180
- 'advocacy-campaign-designer',
181
- // Crypto Marketing Agents
182
- 'crypto-marketing-orchestrator',
183
- 'crypto-architecture-specialist',
184
- 'crypto-token-analyst',
185
- 'crypto-market-researcher',
186
- 'crypto-community-psychologist',
187
- 'crypto-strategic-synthesizer',
188
- 'crypto-viral-content-creator',
189
- 'crypto-diamond-formation-specialist',
190
- 'crypto-airdrop-strategist',
191
- 'crypto-wallet-identification-expert',
192
- 'crypto-engagement-specialist',
193
- 'crypto-dex-optimization-expert',
194
- 'crypto-ecosystem-expansion-manager',
195
- 'crypto-analytics-educator',
196
- 'crypto-network-effect-amplifier',
197
- 'crypto-optimization-analyst',
198
- 'playbook-generator',
199
- 'content-playbook-writer'
200
- ];
201
-
202
- const ENGINEERING_TEAM_AGENTS = [
203
- // New team-prefixed agents
204
- 'engineering-director',
205
- // Legacy engineering agents (gradually migrating to team-prefixed names)
206
- 'one-orchestrator',
207
- 'one-master',
208
- 'analyst',
209
- 'architect',
210
- 'dev',
211
- 'pm',
212
- 'po',
213
- 'qa',
214
- 'sm',
215
- 'ux-expert'
216
- ];
217
-
218
- const DESIGN_TEAM_AGENTS = [
219
- // Design team agents (to be created)
220
- 'design-director',
221
- 'design-ui-specialist',
222
- 'design-brand-manager',
223
- 'ux-expert' // Moving from engineering to design
224
- ];
225
-
226
- function filterAgentsByTeam(agents, team) {
227
- const teamAgents = {
228
- 'marketing': MARKETING_TEAM_AGENTS,
229
- 'engineering': ENGINEERING_TEAM_AGENTS,
230
- 'design': DESIGN_TEAM_AGENTS
231
- };
232
- return agents.filter(agent => teamAgents[team]?.includes(agent));
233
- }
234
-
235
- program
236
- .name('one')
237
- .description('🎼 ONE Framework - Beautiful Simplicity Through Unified Orchestration')
238
- .version('1.0.0');
239
-
240
- // Default command - show responsive interface when called without arguments
241
- program
242
- .command('interface')
243
- .alias('ui')
244
- .description('🎨 Launch the interactive ONE interface')
245
- .action(() => {
246
- displayONEInterface();
247
- });
248
-
249
- // ========================================
250
- // MISSION 9: UNIFIED COMMAND ARCHITECTURE
251
- // ========================================
252
- // Single `/one` gateway to entire ecosystem
253
-
254
- // Core Mission 9 Commands - The Symphony Interface
255
- program
256
- .command('mission [name]')
257
- .alias('m')
258
- .description('🎯 Launch goal-oriented campaigns')
259
- .option('-l, --list', 'List available missions')
260
- .option('-c, --create', 'Create new mission')
261
- .option('-s, --status', 'Show mission status')
262
- .action(async (name, options) => {
263
- await handleMissionCommand(name, options);
264
- });
265
-
266
- program
267
- .command('story [name]')
268
- .alias('s')
269
- .description('📖 Execute narrative workflows')
270
- .option('-l, --list', 'List available stories')
271
- .option('-c, --create', 'Create new story')
272
- .option('-m, --mission <mission>', 'Filter by mission')
273
- .action(async (name, options) => {
274
- await handleStoryCommand(name, options);
275
- });
276
-
277
- program
278
- .command('agent [name]')
279
- .alias('a')
280
- .description('🤖 Invoke specialized AI agents')
281
- .option('-l, --list', 'List all available agents')
282
- .option('-t, --team <team>', 'Filter by team')
283
- .option('-c, --claude', 'List Claude Code agents')
284
- .option('-i, --info <agent>', 'Show agent information')
285
- .action(async (name, options) => {
286
- await handleAgentCommand(name, options);
287
- });
288
-
289
- program
290
- .command('team [name]')
291
- .alias('t')
292
- .description('👥 Coordinate agent groups')
293
- .option('-l, --list', 'List available teams')
294
- .option('-m, --members <team>', 'Show team members')
295
- .action(async (name, options) => {
296
- await handleTeamCommand(name, options);
297
- });
298
-
299
- program
300
- .command('workflow [name]')
301
- .alias('w')
302
- .description('⚡ Run proven processes')
303
- .option('-l, --list', 'List available workflows')
304
- .option('-r, --run <workflow>', 'Execute workflow')
305
- .action(async (name, options) => {
306
- await handleWorkflowCommand(name, options);
307
- });
308
-
309
- program
310
- .command('template [name]')
311
- .description('📄 Generate documents')
312
- .option('-l, --list', 'List available templates')
313
- .option('-c, --create <template>', 'Create from template')
314
- .action(async (name, options) => {
315
- await handleTemplateCommand(name, options);
316
- });
317
-
318
- program
319
- .command('task [name]')
320
- .description('✅ Execute specific actions')
321
- .option('-l, --list', 'List available tasks')
322
- .option('-r, --run <task>', 'Execute task')
323
- .action(async (name, options) => {
324
- await handleTaskCommand(name, options);
325
- });
326
-
327
- program
328
- .command('checklist [name]')
329
- .alias('c')
330
- .description('🔍 Validate quality')
331
- .option('-l, --list', 'List available checklists')
332
- .option('-r, --run <checklist>', 'Execute checklist')
333
- .action(async (name, options) => {
334
- await handleChecklistCommand(name, options);
335
- });
336
-
337
- program
338
- .command('data [name]')
339
- .alias('d')
340
- .description('💾 Access knowledge base')
341
- .option('-l, --list', 'List available data')
342
- .option('-s, --search <query>', 'Search knowledge base')
343
- .action(async (name, options) => {
344
- await handleDataCommand(name, options);
345
- });
346
-
347
- program
348
- .command('playbook [name]')
349
- .alias('p')
350
- .description('📚 Industry guides and playbooks')
351
- .option('-l, --list', 'List available playbooks')
352
- .option('-g, --generate <client>', 'Generate client playbook')
353
- .option('-i, --industry <industry>', 'Industry filter')
354
- .action(async (name, options) => {
355
- await handlePlaybookCommand(name, options);
356
- });
357
-
358
- program
359
- .command('tool [name]')
360
- .description('🛠️ Utility functions')
361
- .option('-l, --list', 'List available tools')
362
- .option('-r, --run <tool>', 'Execute tool')
363
- .action(async (name, options) => {
364
- await handleToolCommand(name, options);
365
- });
366
-
367
- // Mission 9 Help - Context-aware assistance
368
- program
369
- .command('help [command]')
370
- .alias('h')
371
- .description('❓ Intelligent assistance')
372
- .action(async (command) => {
373
- await handleHelpCommand(command);
374
- });
375
-
376
- // Mission 9 Symphony Status
377
- program
378
- .command('status')
379
- .description('🎼 Show symphony orchestration status')
380
- .action(async () => {
381
- await showSymphonyStatus();
382
- });
383
-
384
- program
385
- .command('build-bundles')
386
- .description('Build web bundles for agents and teams')
387
- .option('-a, --agents-only', 'Build only agent bundles')
388
- .option('-t, --teams-only', 'Build only team bundles')
389
- .option('-e, --expansions-only', 'Build only expansion pack bundles')
390
- .option('--no-expansions', 'Skip building expansion packs')
391
- .option('--no-clean', 'Skip cleaning output directories')
392
- .action(async (options) => {
393
- const { default: WebBuilder } = await import('./builders/web-builder.js');
394
- const builder = new WebBuilder({
395
- rootDir: process.cwd()
396
- });
397
-
398
- try {
399
- if (options.clean) {
400
- console.log('Cleaning output directories...');
401
- await builder.cleanOutputDirs();
402
- }
403
-
404
- if (options.expansionsOnly) {
405
- console.log('Building expansion pack bundles...');
406
- await builder.buildAllExpansionPacks({ clean: false });
407
- } else {
408
- if (!options.teamsOnly) {
409
- console.log('Building agent bundles...');
410
- await builder.buildAgents();
411
- }
412
-
413
- if (!options.agentsOnly) {
414
- console.log('Building team bundles...');
415
- await builder.buildTeams();
416
- }
417
-
418
- if (!options.noExpansions) {
419
- console.log('Building expansion pack bundles...');
420
- await builder.buildAllExpansionPacks({ clean: false });
421
- }
422
- }
423
-
424
- console.log('Build completed successfully!');
425
- } catch (error) {
426
- console.error('Build failed:', error.message);
427
- process.exit(1);
428
- }
429
- });
430
-
431
- program
432
- .command('build:expansions')
433
- .description('Build web bundles for all expansion packs')
434
- .option('--expansion <name>', 'Build specific expansion pack only')
435
- .option('--no-clean', 'Skip cleaning output directories')
436
- .action(async (options) => {
437
- const { default: WebBuilder } = await import('./builders/web-builder.js');
438
- const builder = new WebBuilder({
439
- rootDir: process.cwd()
440
- });
441
-
442
- try {
443
- if (options.expansion) {
444
- console.log(`Building expansion pack: ${options.expansion}`);
445
- await builder.buildExpansionPack(options.expansion, { clean: options.clean });
446
- } else {
447
- console.log('Building all expansion packs...');
448
- await builder.buildAllExpansionPacks({ clean: options.clean });
449
- }
450
-
451
- console.log('Expansion pack build completed successfully!');
452
- } catch (error) {
453
- console.error('Expansion pack build failed:', error.message);
454
- process.exit(1);
455
- }
456
- });
457
-
458
- program
459
- .command('list:agents')
460
- .description('List all available agents')
461
- .action(async () => {
462
- const { default: WebBuilder } = await import('./builders/web-builder.js');
463
- const builder = new WebBuilder({ rootDir: process.cwd() });
464
- const agents = await builder.resolver.listAgents();
465
- console.log('Available agents:');
466
- agents.forEach(agent => console.log(` - ${agent}`));
467
- });
468
-
469
- program
470
- .command('list:expansions')
471
- .description('List all available expansion packs')
472
- .action(async () => {
473
- const { default: WebBuilder } = await import('./builders/web-builder.js');
474
- const builder = new WebBuilder({ rootDir: process.cwd() });
475
- const expansions = await builder.listExpansionPacks();
476
- console.log('Available expansion packs:');
477
- expansions.forEach(expansion => console.log(` - ${expansion}`));
478
- });
479
-
480
- program
481
- .command('validate')
482
- .description('Validate agent and team configurations')
483
- .action(async () => {
484
- const { default: WebBuilder } = await import('./builders/web-builder.js');
485
- const builder = new WebBuilder({ rootDir: process.cwd() });
486
- try {
487
- // Validate by attempting to build all agents and teams
488
- const agents = await builder.resolver.listAgents();
489
- const teams = await builder.resolver.listTeams();
490
-
491
- console.log('Validating agents...');
492
- for (const agent of agents) {
493
- await builder.resolver.resolveAgentDependencies(agent);
494
- console.log(` ✓ ${agent}`);
495
- }
496
-
497
- console.log('\nValidating teams...');
498
- for (const team of teams) {
499
- await builder.resolver.resolveTeamDependencies(team);
500
- console.log(` ✓ ${team}`);
501
- }
502
-
503
- console.log('\nAll configurations are valid!');
504
- } catch (error) {
505
- console.error('Validation failed:', error.message);
506
- process.exit(1);
507
- }
508
- });
509
-
510
- program
511
- .command('upgrade')
512
- .description('Upgrade a one-playbook V3 project to V4')
513
- .option('-p, --project <path>', 'Path to V3 project (defaults to current directory)')
514
- .option('--dry-run', 'Show what would be changed without making changes')
515
- .option('--no-backup', 'Skip creating backup (not recommended)')
516
- .action(async (options) => {
517
- const { default: V3ToV4Upgrader } = await import('./upgraders/v3-to-v4-upgrader.js');
518
- const upgrader = new V3ToV4Upgrader();
519
- await upgrader.upgrade({
520
- projectPath: options.project,
521
- dryRun: options.dryRun,
522
- backup: options.backup
523
- });
524
- });
525
-
526
- // Marketing Domain Command
527
- program
528
- .command('market [subcommand] [name]')
529
- .description('Marketing-focused agent interface and playbook management')
530
- .option('--list', 'List available marketing agents')
531
- .option('--help-domain', 'Show marketing domain help')
532
- .option('--version <version>', 'Version for archive command')
533
- .option('--description <desc>', 'Description for archive command')
534
- .option('--format <format>', 'Format for generate/export commands')
535
- .option('--industry <industry>', 'Industry for playbook commands')
536
- .action(async (subcommand, name, options) => {
537
- const { default: WebBuilder } = await import('./builders/web-builder.js');
538
- const builder = new WebBuilder({ rootDir: process.cwd() });
539
-
540
- // Handle subcommands
541
- if (subcommand) {
542
- const { default: PlaybookManager } = await import('./playbook-generator/lib/manager.js');
543
- const manager = new PlaybookManager({ rootDir: process.cwd() });
544
-
545
- switch (subcommand) {
546
- case 'create-playbook':
547
- // Redirect to existing create-playbook command
548
- const { default: PlaybookWizard } = await import('./playbook-generator/lib/wizard.js');
549
- const wizard = new PlaybookWizard({ rootDir: process.cwd() });
550
-
551
- if (!name) {
552
- console.error('Error: Please specify client name');
553
- console.error('Usage: one market create-playbook "Client Name" [--industry type]');
554
- process.exit(1);
555
- }
556
-
557
- try {
558
- await wizard.createClientPlaybook(name);
559
- console.log('\nNext step: Generate your playbook with:');
560
- console.log(` one market generate --client ${name.toLowerCase().replace(/\s+/g, '-')}`);
561
- } catch (error) {
562
- console.error('Error creating playbook:', error.message);
563
- process.exit(1);
564
- }
565
- return;
566
-
567
- case 'list-playbooks':
568
- // Show existing playbooks
569
- console.log('📚 Marketing Playbooks:\n');
570
-
571
- try {
572
- const { promises: fs } = await import('fs');
573
-
574
- // List clients
575
- try {
576
- const clients = await fs.readdir('one/playbooks/clients');
577
- if (clients.length > 0) {
578
- console.log('🏢 Clients:');
579
- for (const client of clients) {
580
- try {
581
- await fs.access(`one/playbooks/clients/${client}/config.yaml`);
582
- console.log(` - ${client}`);
583
- } catch {}
584
- }
585
- console.log();
586
- }
587
- } catch {}
588
-
589
- // List industries
590
- try {
591
- const industries = await fs.readdir('one/playbooks/industries');
592
- if (industries.length > 0) {
593
- console.log('🏭 Industries:');
594
- for (const industry of industries) {
595
- try {
596
- await fs.access(`one/playbooks/industries/${industry}/config.yaml`);
597
- console.log(` - ${industry}`);
598
- } catch {}
599
- }
600
- }
601
- } catch {}
602
- } catch (error) {
603
- console.log('No playbooks found.');
604
- }
605
- return;
606
-
607
- case 'generate':
608
- if (!name) {
609
- console.error('Error: Please specify --client name');
610
- process.exit(1);
611
- }
612
-
613
- // Redirect to generate-playbook
614
- const { PlaybookGenerator } = await import('./playbook-generator/index.js');
615
- const generator = new PlaybookGenerator({
616
- rootDir: process.cwd(),
617
- outputDir: './output/playbooks'
618
- });
619
-
620
- try {
621
- const configPath = `one/playbooks/clients/${name}/config.yaml`;
622
- const result = await generator.generatePlaybook(configPath, {
623
- format: options.format || 'both',
624
- verbose: true
625
- });
626
-
627
- console.log('\nPlaybook generation completed!');
628
- console.log(`Generated files: ${result.files.join(', ')}`);
629
- } catch (error) {
630
- console.error('Generation failed:', error.message);
631
- process.exit(1);
632
- }
633
- return;
634
-
635
- case 'archive':
636
- if (!name) {
637
- console.error('Error: Please specify --client name');
638
- process.exit(1);
639
- }
640
-
641
- try {
642
- const result = await manager.archivePlaybook('client', name, {
643
- version: options.version,
644
- description: options.description
645
- });
646
-
647
- console.log(`✅ Archive created: ${result.metadata.version}`);
648
- await manager.trackChanges('client', name, `Archive ${name} - ${result.metadata.version}`);
649
- } catch (error) {
650
- console.error('Archive failed:', error.message);
651
- process.exit(1);
652
- }
653
- return;
654
-
655
- case 'export':
656
- if (!name) {
657
- console.error('Error: Please specify --client name');
658
- process.exit(1);
659
- }
660
-
661
- try {
662
- const result = await manager.exportPlaybook('client', name, {
663
- format: options.format
664
- });
665
-
666
- console.log(`✅ Export package created: ${result.zipPath}`);
667
- } catch (error) {
668
- console.error('Export failed:', error.message);
669
- process.exit(1);
670
- }
671
- return;
672
-
673
- default:
674
- // Fall through to show agents
675
- break;
676
- }
677
- }
678
-
679
- // Original functionality
680
- if (options.list) {
681
- const allAgents = await builder.resolver.listAgents();
682
- const marketingAgents = filterAgentsByTeam(allAgents, 'marketing');
683
- console.log('Available marketing-team agents:');
684
- marketingAgents.forEach(agent => console.log(` - ${agent}`));
685
- return;
686
- }
687
-
688
- if (options.helpDomain) {
689
- console.log(`
690
- 🎯 ONE Marketing Playbook
691
-
692
- Transform your marketing from random acts to predictable revenue with the proven Elevate Framework.
693
-
694
- Available Commands:
695
- one market --list List all marketing agents
696
- one market --help-domain Show this help
697
-
698
- Playbook Management:
699
- one market create-playbook "Client" Create new client playbook
700
- one market list-playbooks List existing playbooks
701
- one market generate --client name Generate playbook PDFs
702
- one market archive --client name Archive playbook version
703
- one market export --client name Export distribution package
704
-
705
- Marketing Specialists:
706
- Foundation Team:
707
- - brand-identity-specialist Build clarity on brand positioning
708
- - market-research-analyst Understand your market landscape
709
- - customer-journey-designer Map customer experience paths
710
-
711
- ATTRACT Team (Elevate Reach):
712
- - content-hook-specialist Create compelling content hooks
713
- - lead-magnet-creator Design irresistible lead magnets
714
- - lead-capture-expert Optimize landing pages for conversion
715
-
716
- CONVERT Team (Elevate Sales):
717
- - engagement-specialist Design engagement sequences
718
- - sales-environment-optimizer Optimize sales environment
719
- - nurture-campaign-manager Create nurture campaigns
720
-
721
- GROW Team (Elevate Value):
722
- - upsell-strategist Develop upsell strategies
723
- - customer-success-manager Manage customer success programs
724
- - advocacy-campaign-designer Design customer advocacy campaigns
725
-
726
- Orchestrator:
727
- - elevate-marketing-orchestrator Guide through complete Elevate framework
728
-
729
- Usage Examples:
730
- one market --list # See all marketing agents
731
- one market create-playbook "Acme Corp" --industry saas
732
- one market generate --client acme-corp --format pdf
733
- one market archive --client acme-corp --version v1.2
734
-
735
- For development/engineering tasks, use: one engineer
736
- `);
737
- return;
738
- }
739
-
740
- // Default behavior - show available marketing agents
741
- const allAgents = await builder.resolver.listAgents();
742
- const marketingAgents = filterAgentsByTeam(allAgents, 'marketing');
743
- console.log('🎯 ONE Marketing Playbook - Available Agents:');
744
- marketingAgents.forEach(agent => console.log(` - ${agent}`));
745
- console.log('\nPlaybook Commands:');
746
- console.log(' one market create-playbook "Client Name"');
747
- console.log(' one market list-playbooks');
748
- console.log(' one market generate --client name');
749
- console.log('\nUse --help-domain for detailed information.');
750
- });
751
-
752
- // Engineering Domain Command
753
- program
754
- .command('engineer')
755
- .description('Launch engineering-focused agent interface')
756
- .option('--list', 'List available engineering agents')
757
- .option('--help-domain', 'Show engineering domain help')
758
- .action(async (options) => {
759
- const { default: WebBuilder } = await import('./builders/web-builder.js');
760
- const builder = new WebBuilder({ rootDir: process.cwd() });
761
-
762
- if (options.list) {
763
- const allAgents = await builder.resolver.listAgents();
764
- const engineeringAgents = filterAgentsByTeam(allAgents, 'engineering');
765
- console.log('Available engineering-team agents:');
766
- engineeringAgents.forEach(agent => console.log(` - ${agent}`));
767
- return;
768
- }
769
-
770
- if (options.helpDomain) {
771
- console.log(`
772
- 🚀 ONE Engineering Playbook
773
-
774
- Complete AI-powered development framework for systematic software delivery.
775
-
776
- Available Commands:
777
- one engineer --list List all engineering agents
778
- one engineer --help-domain Show this help
779
-
780
- Engineering Team:
781
- Planning & Analysis:
782
- - analyst Business analysis and requirements gathering
783
- - pm Product management and roadmap planning
784
- - architect System design and technical architecture
785
-
786
- Development:
787
- - dev Code implementation and debugging
788
- - ux-expert UI/UX design and user experience
789
- - sm Scrum master and project coordination
790
-
791
- Quality & Operations:
792
- - qa Quality assurance and testing
793
- - po Product owner and backlog management
794
-
795
- Universal Agents:
796
- - one-orchestrator Multi-agent workflow coordination
797
- - one-master Universal task executor
798
-
799
- Workflows:
800
- Greenfield: Complete new project development
801
- Brownfield: Enhancement of existing projects
802
-
803
- Usage Examples:
804
- one engineer --list # See all engineering agents
805
- npm run build-bundles # Build development bundles
806
- npm run validate # Validate agent configurations
807
-
808
- For marketing tasks, use: one market
809
- `);
810
- return;
811
- }
812
-
813
- // Default behavior - show available engineering agents
814
- const allAgents = await builder.resolver.listAgents();
815
- const engineeringAgents = filterAgentsByTeam(allAgents, 'engineering');
816
- console.log('🚀 ONE Engineering Playbook - Available Agents:');
817
- engineeringAgents.forEach(agent => console.log(` - ${agent}`));
818
- console.log('\nUse --help-domain for detailed information about engineering agents.');
819
- });
820
-
821
- // Handle /one command specifically
822
- program
823
- .command('/')
824
- .description('🎨 Launch the interactive ONE interface')
825
- .action(() => {
826
- displayONEInterface();
827
- });
828
-
829
- // Dynamic agent launch command - matches any agent name
830
- program
831
- .arguments('<agent-name>')
832
- .description('Launch a specific agent')
833
- .action(async (agentName) => {
834
- // Check if it's the special "/one" command
835
- if (agentName === '/one' || agentName === 'one') {
836
- displayONEInterface();
837
- return;
838
- }
839
-
840
- const { default: WebBuilder } = await import('./builders/web-builder.js');
841
- const builder = new WebBuilder({ rootDir: process.cwd() });
842
-
843
- try {
844
- const agents = await builder.resolver.listAgents();
845
-
846
- if (agents.includes(agentName)) {
847
- console.log(`Launching agent: ${agentName}`);
848
- console.log(`Agent bundle path: dist/${agentName}.md`);
849
- console.log('\nYou can now use this agent in your preferred AI tool.');
850
- } else {
851
- console.error(`Error: Agent '${agentName}' not found.`);
852
- console.error('Available agents:');
853
- agents.forEach(agent => console.error(` - ${agent}`));
854
- process.exit(1);
855
- }
856
- } catch (error) {
857
- console.error('Error:', error.message);
858
- process.exit(1);
859
- }
860
- });
861
-
862
- // Create New Playbook Command (Interactive Wizard)
863
- program
864
- .command('create-playbook')
865
- .description('Create a new playbook with interactive setup wizard')
866
- .option('--client <name>', 'Create playbook for specific client')
867
- .option('--industry <name>', 'Create playbook for industry')
868
- .action(async (options) => {
869
- const { default: PlaybookWizard } = await import('./playbook-generator/lib/wizard.js');
870
-
871
- try {
872
- const wizard = new PlaybookWizard({
873
- rootDir: process.cwd()
874
- });
875
-
876
- if (options.client) {
877
- await wizard.createClientPlaybook(options.client);
878
- } else if (options.industry) {
879
- await wizard.createIndustryPlaybook(options.industry);
880
- } else {
881
- console.error('Error: Must specify --client <name> or --industry <name>');
882
- process.exit(1);
883
- }
884
-
885
- } catch (error) {
886
- const { ErrorHandler } = await import('./playbook-generator/lib/errors.js');
887
- const handled = ErrorHandler.handle(error, 'create-playbook');
888
- const helpInfo = ErrorHandler.createUserHelp(handled);
889
-
890
- console.error(helpInfo.error);
891
- console.error(helpInfo.help);
892
- process.exit(1);
893
- }
894
- });
895
-
896
- // Playbook Generation Command
897
- program
898
- .command('generate-playbook')
899
- .description('Generate custom playbooks for clients or industries')
900
- .option('--client <name>', 'Generate playbook for specific client')
901
- .option('--industry <name>', 'Generate playbook for industry')
902
- .option('--config <path>', 'Use custom configuration file')
903
- .option('--format <format>', 'Output format: pdf, epub, enhanced-pdf, both, all', 'both')
904
- .option('--output <dir>', 'Output directory', './output/playbooks')
905
- .option('--interactive', 'Review each chapter as it\'s generated')
906
- .option('--verbose', 'Enable verbose output')
907
- .option('--dry-run', 'Show what would be generated without creating files')
908
- .action(async (options) => {
909
- // Use the new packaged version for compatibility
910
- const { PlaybookGenerator } = await import('./playbook-generator/index.js');
911
-
912
- try {
913
- const generator = new PlaybookGenerator({
914
- rootDir: process.cwd(),
915
- outputDir: options.output
916
- });
917
-
918
- let configPath;
919
- if (options.config) {
920
- configPath = options.config;
921
- } else if (options.client) {
922
- // Try new folder structure first, fall back to legacy
923
- const newStructure = `one/playbooks/clients/${options.client}/config.yaml`;
924
- const legacyStructure = `one/playbooks/clients/${options.client}-config.yaml`;
925
-
926
- const fs = await import('fs');
927
- if (fs.existsSync(newStructure)) {
928
- configPath = newStructure;
929
- } else if (fs.existsSync(legacyStructure)) {
930
- configPath = legacyStructure;
931
- } else {
932
- console.error(`Error: Configuration not found for client '${options.client}'`);
933
- console.error('Try running: one create-playbook --client ' + options.client);
934
- process.exit(1);
935
- }
936
- } else if (options.industry) {
937
- // Try new folder structure first, fall back to legacy
938
- const newStructure = `one/playbooks/industries/${options.industry}/config.yaml`;
939
- const legacyStructure = `one/playbooks/industries/${options.industry}-config.yaml`;
940
-
941
- const fs = await import('fs');
942
- if (fs.existsSync(newStructure)) {
943
- configPath = newStructure;
944
- } else if (fs.existsSync(legacyStructure)) {
945
- configPath = legacyStructure;
946
- } else {
947
- console.error(`Error: Configuration not found for industry '${options.industry}'`);
948
- console.error('Try running: one create-playbook --industry ' + options.industry);
949
- process.exit(1);
950
- }
951
- } else {
952
- console.error('Error: Must specify --client, --industry, or --config option');
953
- process.exit(1);
954
- }
955
-
956
- console.log(`Generating playbook from: ${configPath}`);
957
-
958
- if (options.dryRun) {
959
- console.log('DRY RUN MODE - No files will be created');
960
- await generator.validateConfig(configPath);
961
- console.log('Configuration is valid!');
962
- } else {
963
- const result = await generator.generatePlaybook(configPath, {
964
- format: options.format,
965
- verbose: options.verbose || false,
966
- interactive: options.interactive
967
- });
968
-
969
- console.log('\nPlaybook generation completed!');
970
- console.log(`Generated files: ${result.files.join(', ')}`);
971
- }
972
-
973
- } catch (error) {
974
- const { ErrorHandler } = await import('./playbook-generator/lib/errors.js');
975
- const handled = ErrorHandler.handle(error, 'generate-playbook');
976
- const helpInfo = ErrorHandler.createUserHelp(handled);
977
-
978
- console.error(helpInfo.error);
979
- console.error(helpInfo.help);
980
- process.exit(1);
981
- }
982
- });
983
-
984
- // List available playbook configurations
985
- program
986
- .command('list-playbooks')
987
- .description('List available playbook configurations')
988
- .action(async () => {
989
- const { promises: fs } = await import('fs');
990
-
991
- try {
992
- console.log('📚 Available Playbook Configurations:\n');
993
-
994
- // List industry configs (both legacy and new structure)
995
- try {
996
- const industries = new Set();
997
-
998
- // Check legacy structure
999
- try {
1000
- const industryFiles = await fs.readdir('one/playbooks/industries');
1001
- industryFiles
1002
- .filter(f => f.endsWith('-config.yaml'))
1003
- .forEach(f => industries.add(f.replace('-config.yaml', '')));
1004
- } catch (e) {}
1005
-
1006
- // Check new structure
1007
- try {
1008
- const industryFiles = await fs.readdir('one/playbooks/industries');
1009
- const dirs = await Promise.all(
1010
- industryFiles.map(async item => {
1011
- try {
1012
- const stat = await fs.stat(`one/playbooks/industries/${item}`);
1013
- if (stat.isDirectory()) {
1014
- const configExists = await fs.access(`one/playbooks/industries/${item}/config.yaml`).then(() => true).catch(() => false);
1015
- return configExists ? item : null;
1016
- }
1017
- return null;
1018
- } catch {
1019
- return null;
1020
- }
1021
- })
1022
- );
1023
- dirs.filter(Boolean).forEach(dir => industries.add(dir));
1024
- } catch (e) {}
1025
-
1026
- if (industries.size > 0) {
1027
- console.log('🏭 Industries:');
1028
- Array.from(industries).sort().forEach(industry => console.log(` - ${industry}`));
1029
- console.log();
1030
- } else {
1031
- console.log('🏭 Industries: No configurations found\n');
1032
- }
1033
- } catch (e) {
1034
- console.log('🏭 Industries: No configurations found\n');
1035
- }
1036
-
1037
- // List client configs (both legacy and new structure)
1038
- try {
1039
- const clients = new Set();
1040
-
1041
- // Check legacy structure
1042
- try {
1043
- const clientFiles = await fs.readdir('one/playbooks/clients');
1044
- clientFiles
1045
- .filter(f => f.endsWith('-config.yaml'))
1046
- .forEach(f => clients.add(f.replace('-config.yaml', '')));
1047
- } catch (e) {}
1048
-
1049
- // Check new structure
1050
- try {
1051
- const clientFiles = await fs.readdir('one/playbooks/clients');
1052
- const dirs = await Promise.all(
1053
- clientFiles.map(async item => {
1054
- try {
1055
- const stat = await fs.stat(`one/playbooks/clients/${item}`);
1056
- if (stat.isDirectory()) {
1057
- const configExists = await fs.access(`one/playbooks/clients/${item}/config.yaml`).then(() => true).catch(() => false);
1058
- return configExists ? item : null;
1059
- }
1060
- return null;
1061
- } catch {
1062
- return null;
1063
- }
1064
- })
1065
- );
1066
- dirs.filter(Boolean).forEach(dir => clients.add(dir));
1067
- } catch (e) {}
1068
-
1069
- if (clients.size > 0) {
1070
- console.log('🏢 Clients:');
1071
- Array.from(clients).sort().forEach(client => console.log(` - ${client}`));
1072
- console.log();
1073
- } else {
1074
- console.log('🏢 Clients: No configurations found\n');
1075
- }
1076
- } catch (e) {
1077
- console.log('🏢 Clients: No configurations found\n');
1078
- }
1079
-
1080
- console.log('Usage Examples:');
1081
- console.log(' one generate-playbook --industry saas --format pdf');
1082
- console.log(' one generate-playbook --client acme-corp --format epub');
1083
- console.log(' one generate-playbook --config custom/my-config.yaml');
1084
-
1085
- } catch (error) {
1086
- console.error('Error listing playbooks:', error.message);
1087
- }
1088
- });
1089
-
1090
- // Archive playbook command
1091
- program
1092
- .command('archive-playbook')
1093
- .description('Archive a client or industry playbook with versioning')
1094
- .option('--client <name>', 'Archive client playbook')
1095
- .option('--industry <name>', 'Archive industry playbook')
1096
- .option('--version <version>', 'Version tag (default: timestamp)')
1097
- .option('--description <desc>', 'Archive description')
1098
- .action(async (options) => {
1099
- const { default: PlaybookManager } = await import('./playbook-generator/lib/manager.js');
1100
- const manager = new PlaybookManager({ rootDir: process.cwd() });
1101
-
1102
- try {
1103
- let type, name;
1104
- if (options.client) {
1105
- type = 'client';
1106
- name = options.client;
1107
- } else if (options.industry) {
1108
- type = 'industry';
1109
- name = options.industry;
1110
- } else {
1111
- console.error('Error: Must specify --client or --industry');
1112
- process.exit(1);
1113
- }
1114
-
1115
- console.log(`Archiving ${type} playbook: ${name}...`);
1116
-
1117
- const result = await manager.archivePlaybook(type, name, {
1118
- version: options.version,
1119
- description: options.description
1120
- });
1121
-
1122
- console.log(`✅ Archive created successfully!`);
1123
- console.log(` Path: ${result.archivePath}`);
1124
- console.log(` Version: ${result.metadata.version}`);
1125
-
1126
- // Also track changes in git
1127
- await manager.trackChanges(type, name, `Archive ${name} - ${result.metadata.version}`);
1128
-
1129
- } catch (error) {
1130
- console.error('Archive failed:', error.message);
1131
- process.exit(1);
1132
- }
1133
- });
1134
-
1135
- // Export playbook command
1136
- program
1137
- .command('export-playbook')
1138
- .description('Export playbook as a distributable package')
1139
- .option('--client <name>', 'Export client playbook')
1140
- .option('--industry <name>', 'Export industry playbook')
1141
- .option('--format <format>', 'Export format (default: full)')
1142
- .action(async (options) => {
1143
- const { default: PlaybookManager } = await import('./playbook-generator/lib/manager.js');
1144
- const manager = new PlaybookManager({ rootDir: process.cwd() });
1145
-
1146
- try {
1147
- let type, name;
1148
- if (options.client) {
1149
- type = 'client';
1150
- name = options.client;
1151
- } else if (options.industry) {
1152
- type = 'industry';
1153
- name = options.industry;
1154
- } else {
1155
- console.error('Error: Must specify --client or --industry');
1156
- process.exit(1);
1157
- }
1158
-
1159
- console.log(`Exporting ${type} playbook: ${name}...`);
1160
-
1161
- const result = await manager.exportPlaybook(type, name, {
1162
- format: options.format
1163
- });
1164
-
1165
- console.log(`✅ Export package created successfully!`);
1166
- console.log(` Package: ${result.zipPath}`);
1167
- console.log(` Files included: ${result.metadata.included_files.length}`);
1168
-
1169
- } catch (error) {
1170
- console.error('Export failed:', error.message);
1171
- process.exit(1);
1172
- }
1173
- });
1174
-
1175
- // Backup playbook command
1176
- program
1177
- .command('backup-playbook')
1178
- .description('Create a backup snapshot of a playbook')
1179
- .option('--client <name>', 'Backup client playbook')
1180
- .option('--industry <name>', 'Backup industry playbook')
1181
- .action(async (options) => {
1182
- const { default: PlaybookManager } = await import('./playbook-generator/lib/manager.js');
1183
- const manager = new PlaybookManager({ rootDir: process.cwd() });
1184
-
1185
- try {
1186
- let type, name;
1187
- if (options.client) {
1188
- type = 'client';
1189
- name = options.client;
1190
- } else if (options.industry) {
1191
- type = 'industry';
1192
- name = options.industry;
1193
- } else {
1194
- console.error('Error: Must specify --client or --industry');
1195
- process.exit(1);
1196
- }
1197
-
1198
- console.log(`Creating backup of ${type} playbook: ${name}...`);
1199
-
1200
- const result = await manager.backupPlaybook(type, name);
1201
-
1202
- console.log(`✅ Backup created successfully!`);
1203
- console.log(` Backup ID: ${result.timestamp}`);
1204
- console.log(` Location: ${result.backupPath}`);
1205
-
1206
- } catch (error) {
1207
- console.error('Backup failed:', error.message);
1208
- process.exit(1);
1209
- }
1210
- });
1211
-
1212
- // List archives command
1213
- program
1214
- .command('list-archives')
1215
- .description('List available archives for a playbook')
1216
- .option('--client <name>', 'List client playbook archives')
1217
- .option('--industry <name>', 'List industry playbook archives')
1218
- .action(async (options) => {
1219
- const { default: PlaybookManager } = await import('./playbook-generator/lib/manager.js');
1220
- const manager = new PlaybookManager({ rootDir: process.cwd() });
1221
-
1222
- try {
1223
- let type, name;
1224
- if (options.client) {
1225
- type = 'client';
1226
- name = options.client;
1227
- } else if (options.industry) {
1228
- type = 'industry';
1229
- name = options.industry;
1230
- } else {
1231
- console.error('Error: Must specify --client or --industry');
1232
- process.exit(1);
1233
- }
1234
-
1235
- const archives = await manager.listArchives(type, name);
1236
-
1237
- if (archives.length === 0) {
1238
- console.log(`No archives found for ${type}: ${name}`);
1239
- } else {
1240
- console.log(`📚 Archives for ${type}: ${name}\n`);
1241
- archives.forEach(archive => {
1242
- console.log(`Version: ${archive.version}`);
1243
- console.log(` Archived: ${archive.archived_at}`);
1244
- console.log(` By: ${archive.archived_by}`);
1245
- console.log(` Description: ${archive.description}`);
1246
- console.log();
1247
- });
1248
- }
1249
-
1250
- } catch (error) {
1251
- console.error('Error listing archives:', error.message);
1252
- process.exit(1);
1253
- }
1254
- });
1255
-
1256
- // Apple-style book generation commands
1257
- program
1258
- .command('create-book')
1259
- .description('Create a new Apple-style book project structure')
1260
- .option('--title <title>', 'Book title')
1261
- .option('--author <author>', 'Book author')
1262
- .option('--subtitle <subtitle>', 'Book subtitle')
1263
- .action(async (options) => {
1264
- const { promises: fs } = await import('fs');
1265
- const path = await import('path');
1266
- const yaml = await import('js-yaml');
1267
-
1268
- try {
1269
- const title = options.title || 'My Book';
1270
- const author = options.author || 'Author Name';
1271
- const subtitle = options.subtitle || '';
1272
-
1273
- console.log(`📚 Creating Apple-style book: ${title}`);
1274
-
1275
- // Create directory structure
1276
- const dirs = ['content', 'images', 'output'];
1277
- for (const dir of dirs) {
1278
- await fs.mkdir(dir, { recursive: true });
1279
- console.log(`✓ Created ${dir}/ directory`);
1280
- }
1281
-
1282
- // Create sample book.yaml
1283
- const bookConfig = {
1284
- title,
1285
- subtitle,
1286
- author,
1287
- cover: 'cover.jpg'
1288
- };
1289
-
1290
- await fs.writeFile('book.yaml', yaml.dump(bookConfig));
1291
- console.log('✓ Created book.yaml');
1292
-
1293
- // Create sample chapter
1294
- const sampleChapter = `# Introduction
1295
-
1296
- This is your first chapter. Add your content here.
1297
-
1298
- ## Section 1.1
1299
-
1300
- You can add images by placing them in the images/ folder and referencing them:
1301
-
1302
- ![Sample Image](1.1-sample.png)
1303
-
1304
- ## Section 1.2
1305
-
1306
- Continue writing your content...
1307
- `;
1308
-
1309
- await fs.writeFile('content/1-Introduction.md', sampleChapter);
1310
- console.log('✓ Created sample chapter: content/1-Introduction.md');
1311
-
1312
- // Create sample section
1313
- const sampleSection = `# Implementation Details
1314
-
1315
- This is a section that extends Chapter 1.
1316
-
1317
- ![Implementation Flow](1.1-implementation.png)
1318
-
1319
- Your detailed implementation content goes here.
1320
- `;
1321
-
1322
- await fs.writeFile('content/1.1-Implementation.md', sampleSection);
1323
- console.log('✓ Created sample section: content/1.1-Implementation.md');
1324
-
1325
- console.log('\n🎉 Apple-style book project created successfully!');
1326
- console.log('\nNext steps:');
1327
- console.log('1. Add your chapters to content/ directory (numbered: 1-Chapter.md, 2-Chapter.md)');
1328
- console.log('2. Add your images to images/ directory');
1329
- console.log('3. Generate your book with: one generate-book');
1330
- console.log('\nFile naming conventions:');
1331
- console.log('- Chapters: 1-Introduction.md, 2-Foundation.md, etc.');
1332
- console.log('- Sections: 1.1-Setup.md, 1.2-Config.md, etc.');
1333
- console.log('- Chapter images: 1-introduction.jpg, 2-foundation.jpg');
1334
- console.log('- Section images: 1.1-setup.png, 1.2-config.png');
1335
-
1336
- } catch (error) {
1337
- console.error('Error creating book:', error.message);
1338
- process.exit(1);
1339
- }
1340
- });
1341
-
1342
- program
1343
- .command('generate-book')
1344
- .description('Generate Apple-style book from content and images')
1345
- .option('--format <format>', 'Output format: pdf, epub, docx, or both', 'pdf')
1346
- .option('--config <config>', 'Book configuration file', 'book.yaml')
1347
- .option('--verbose', 'Verbose output')
1348
- .action(async (options) => {
1349
- const { promises: fs } = await import('fs');
1350
- const yaml = await import('js-yaml');
1351
- const { default: PlaybookGenerator } = await import('./lib/playbook-generator.js');
1352
-
1353
- try {
1354
- // Load book configuration
1355
- const configPath = options.config;
1356
- const configContent = await fs.readFile(configPath, 'utf8');
1357
- const config = yaml.load(configContent);
1358
-
1359
- // Validate required fields
1360
- if (!config.title) {
1361
- console.error('Error: book.yaml missing required field: title');
1362
- process.exit(1);
1363
- }
1364
-
1365
- console.log(`📚 Generating Apple-style book: ${config.title}`);
1366
- console.log(`📝 Format: ${options.format}`);
1367
-
1368
- // Initialize generator
1369
- const generator = new PlaybookGenerator({
1370
- rootDir: process.cwd(),
1371
- outputDir: './output'
1372
- });
1373
-
1374
- // Generate book
1375
- const result = await generator.generateAppleBook(config, {
1376
- format: options.format,
1377
- verbose: options.verbose
1378
- });
1379
-
1380
- console.log('\n🎉 Book generated successfully!');
1381
- console.log(`📖 Found ${result.structure.chapters.length} chapters`);
1382
- console.log('📁 Generated files:');
1383
- result.files.forEach(file => {
1384
- console.log(` ${file}`);
1385
- });
1386
-
1387
- } catch (error) {
1388
- console.error('Error generating book:', error.message);
1389
- if (options.verbose) {
1390
- console.error(error.stack);
1391
- }
1392
- process.exit(1);
1393
- }
1394
- });
1395
-
1396
- // New ONE: Command Structure
1397
- program
1398
- .command('one:mission [subcommand]')
1399
- .description('Manage missions (goal-oriented campaigns)')
1400
- .action(async (subcommand) => {
1401
- await handleOneCommand('mission', subcommand);
1402
- });
1403
-
1404
- program
1405
- .command('one:story [subcommand]')
1406
- .description('Manage stories (individual narratives within missions)')
1407
- .action(async (subcommand) => {
1408
- await handleOneCommand('story', subcommand);
1409
- });
1410
-
1411
- program
1412
- .command('one:agent [subcommand]')
1413
- .description('Manage agents (AI specialists with team prefixes)')
1414
- .action(async (subcommand) => {
1415
- await handleOneCommand('agent', subcommand);
1416
- });
1417
-
1418
- program
1419
- .command('one:checklist [subcommand]')
1420
- .description('Manage checklists (quality validation gates)')
1421
- .action(async (subcommand) => {
1422
- await handleOneCommand('checklist', subcommand);
1423
- });
1424
-
1425
- program
1426
- .command('one:agent-team [subcommand]')
1427
- .description('Manage agent teams (marketing-team, engineering-team, design-team)')
1428
- .action(async (subcommand) => {
1429
- await handleOneCommand('agent-team', subcommand);
1430
- });
1431
-
1432
- program
1433
- .command('one:data [subcommand]')
1434
- .description('Manage data (knowledge base and assets)')
1435
- .action(async (subcommand) => {
1436
- await handleOneCommand('data', subcommand);
1437
- });
1438
-
1439
- program
1440
- .command('one:playbook [subcommand]')
1441
- .description('Manage playbooks (industry and client guides)')
1442
- .action(async (subcommand) => {
1443
- await handleOneCommand('playbook', subcommand);
1444
- });
1445
-
1446
- program
1447
- .command('one:test [subcommand]')
1448
- .description('Manage tests (testing frameworks)')
1449
- .action(async (subcommand) => {
1450
- await handleOneCommand('test', subcommand);
1451
- });
1452
-
1453
- program
1454
- .command('one:task [subcommand]')
1455
- .description('Manage tasks (granular actions within stories)')
1456
- .action(async (subcommand) => {
1457
- await handleOneCommand('task', subcommand);
1458
- });
1459
-
1460
- program
1461
- .command('one:tool [subcommand]')
1462
- .description('Manage tools (development and deployment utilities)')
1463
- .action(async (subcommand) => {
1464
- await handleOneCommand('tool', subcommand);
1465
- });
1466
-
1467
- program
1468
- .command('one:template [subcommand]')
1469
- .description('Manage templates (document and story templates)')
1470
- .action(async (subcommand) => {
1471
- await handleOneCommand('template', subcommand);
1472
- });
1473
- program
1474
- .command('one:foundation')
1475
- .description('Create your personalized Company, Market, Customer foundation')
1476
- .action(async () => {
1477
- await handleFoundationCommand();
1478
- });
1479
-
1480
- program
1481
- .command('one:pdf [file]')
1482
- .description('Convert markdown/HTML to PDF with embedded images')
1483
- .option('-o, --output <file>', 'Output PDF filename')
1484
- .option('-t, --title <title>', 'Document title')
1485
- .action(async (file, options) => {
1486
- await handlePdfCommand(file, options);
1487
- });
1488
-
1489
- program
1490
- .command('one:formats')
1491
- .description('Generate Bull Character Guide in all formats (MD, DOCX, EPUB, PDF)')
1492
- .option('-f, --format <format>', 'Specific format: md, docx, epub, pdf, all', 'all')
1493
- .action(async (options) => {
1494
- await handleFormatsCommand(options);
1495
- });
1496
-
1497
-
1498
- // ONE Command Handler
1499
- async function handleOneCommand(type, subcommand) {
1500
- const { promises: fs } = await import('fs');
1501
- const path = await import('path');
1502
-
1503
- const directories = {
1504
- mission: 'one/missions',
1505
- story: 'one/stories',
1506
- agent: 'one/agents',
1507
- checklist: 'one/checklists',
1508
- 'agent-team': 'one/teams',
1509
- data: 'one/data',
1510
- playbook: 'one/playbooks',
1511
- test: 'one/tests',
1512
- task: 'one/tasks',
1513
- tool: 'one/tools',
1514
- template: 'one/templates'
1515
- };
1516
-
1517
- const dir = directories[type];
1518
-
1519
- try {
1520
- // List items in the directory
1521
- const items = await fs.readdir(dir);
1522
- const itemList = items
1523
- .filter(item => !item.startsWith('.'))
1524
- .map((item, index) => `[${index + 1}] ${item}`)
1525
- .join('\n ');
1526
-
1527
- console.log(`\n📋 Here are your ${type.charAt(0).toUpperCase() + type.slice(1)}s:\n`);
1528
- console.log(` ${itemList}\n`);
1529
- console.log(`Select a number or write a new item (e.g., ${type}, ${type === 'agent-team' ? 'team' : type === 'mission' ? 'story' : 'task'}, etc.)\n`);
1530
-
1531
- // If a subcommand was provided, try to handle it
1532
- if (subcommand) {
1533
- const itemPath = path.join(dir, subcommand);
1534
- try {
1535
- const content = await fs.readFile(itemPath, 'utf8');
1536
- console.log(`📄 Content of ${subcommand}:\n`);
1537
- console.log(content);
1538
- } catch (error) {
1539
- console.log(`ℹ️ Item '${subcommand}' not found. Available items listed above.`);
1540
- }
1541
- }
1542
-
1543
- } catch (error) {
1544
- console.error(`Error accessing ${type}s: ${error.message}`);
1545
- console.log(`\nDirectory: ${dir}`);
1546
- console.log(`Suggestion: Create the directory structure with 'npm run build'`);
1547
- }
1548
- }
1549
-
1550
- // Content Generation Command - Bull Content Engine Integration
1551
- program
1552
- .command('content [client] [type] [prompt]')
1553
- .alias('one:content')
1554
- .description('Generate Bull-branded content for specific clients using the Content Engine')
1555
- .option('-t, --title <title>', 'Custom content title')
1556
- .option('-p, --platform <platform>', 'Target platform for social media content')
1557
- .option('--priority <level>', 'Content priority level (high/medium/low)')
1558
- .option('--interactive', 'Run in interactive mode (default if no args provided)')
1559
- .action(async (client, type, prompt, options) => {
1560
- try {
1561
- const { OneContentCommand } = await import('./content/one-content-command.js');
1562
-
1563
- if (client && type && prompt) {
1564
- // Direct mode with all parameters provided
1565
- const contentOptions = {
1566
- title: options.title,
1567
- platform: options.platform,
1568
- priority: options.priority || 'medium'
1569
- };
1570
-
1571
- await OneContentCommand.run([client, type, prompt, JSON.stringify(contentOptions)]);
1572
- } else {
1573
- // Interactive mode
1574
- await OneContentCommand.run([]);
1575
- }
1576
- } catch (error) {
1577
- console.error('❌ Content generation failed:', error.message);
1578
- console.log('\n💡 Troubleshooting:');
1579
- console.log(' • Ensure client exists in playbooks/clients/ folder');
1580
- console.log(' • Check content type is valid (market_analysis, educational, community, social_media, newsletter)');
1581
- console.log(' • Try running in interactive mode: node one/tools/cli.js content');
1582
- process.exit(1);
1583
- }
1584
- });
1585
-
1586
- // PDF Conversion Command Handler
1587
- async function handlePdfCommand(file, options) {
1588
- const { spawn } = await import('child_process');
1589
- const path = await import('path');
1590
-
1591
- if (!file) {
1592
- console.log('📋 ONE Framework PDF Converter');
1593
- console.log('\nUsage:');
1594
- console.log(' node one/tools/cli.js one:pdf <file.md|file.html> [options]');
1595
- console.log('\nOptions:');
1596
- console.log(' -o, --output <file> Output PDF filename');
1597
- console.log(' -t, --title <title> Document title');
1598
- console.log('\nExamples:');
1599
- console.log(' node one/tools/cli.js one:pdf document.md');
1600
- console.log(' node one/tools/cli.js one:pdf document.md -o custom.pdf');
1601
- console.log(' node one/tools/cli.js one:pdf document.md -t "Custom Title"');
1602
- console.log('\nPre-configured conversions:');
1603
- console.log(' npm run pdf:bullstamp-character # Bull Character Guide');
1604
- console.log(' npm run pdf:bullstamp-foundation # Foundation playbook');
1605
- return;
1606
- }
1607
-
1608
- console.log('🔄 Converting to PDF using ONE Framework enhanced converter...');
1609
-
1610
- // Build command arguments
1611
- const args = ['one/tools/enhanced-pdf-converter.py', file];
1612
-
1613
- if (options.output) {
1614
- args.push(options.output);
1615
- }
1616
-
1617
- if (options.title) {
1618
- args.push(options.title);
1619
- }
1620
-
1621
- // Execute the Python converter
1622
- const converter = spawn('python3', args, {
1623
- stdio: 'inherit',
1624
- cwd: process.cwd()
1625
- });
1626
-
1627
- converter.on('close', (code) => {
1628
- if (code === 0) {
1629
- console.log('✅ PDF conversion completed successfully!');
1630
- } else {
1631
- console.error('❌ PDF conversion failed');
1632
- process.exit(1);
1633
- }
1634
- });
1635
-
1636
- converter.on('error', (error) => {
1637
- console.error('❌ Failed to start PDF converter:', error.message);
1638
- console.log('\n💡 Troubleshooting:');
1639
- console.log(' • Ensure Python 3 is installed: python3 --version');
1640
- console.log(' • Install required dependencies: pip3 install markdown');
1641
- console.log(' • For Chrome PDF engine: ensure Google Chrome is installed');
1642
- process.exit(1);
1643
- });
1644
- }
1645
-
1646
- // Handle multi-format generation command
1647
- async function handleFormatsCommand(options) {
1648
- const { spawn } = await import('child_process');
1649
-
1650
- console.log('📋 ONE Framework Multi-Format Generator');
1651
- console.log('🔄 Generating Bull Character Guide formats...');
1652
- console.log(`📝 Format: ${options.format}`);
1653
-
1654
- if (options.format === 'all') {
1655
- console.log('📄 Generating all formats: MD, DOCX, EPUB, PDF');
1656
-
1657
- // First generate markdown and multi-format documents
1658
- const multiFormatProcess = spawn('python3', ['one/tools/bull-character-multi-format.py'], { stdio: 'inherit' });
1659
-
1660
- multiFormatProcess.on('close', (code) => {
1661
- if (code === 0) {
1662
- console.log('✅ Markdown format completed!');
1663
-
1664
- // Then generate DOCX and EPUB
1665
- const docxEpubProcess = spawn('python3', ['one/tools/bull-character-docx-epub.py'], { stdio: 'inherit' });
1666
-
1667
- docxEpubProcess.on('close', (code) => {
1668
- if (code === 0) {
1669
- console.log('✅ DOCX and EPUB formats completed!');
1670
-
1671
- // Finally merge PDFs if not already done
1672
- const mergeProcess = spawn('python3', ['one/tools/merge-bull-pdfs.py'], { stdio: 'inherit' });
1673
-
1674
- mergeProcess.on('close', (code) => {
1675
- if (code === 0) {
1676
- console.log('✅ All formats generated successfully!');
1677
- console.log('📁 Available formats:');
1678
- console.log(' • the-bull-character.md (Markdown)');
1679
- console.log(' • the-bull-character.docx (Microsoft Word)');
1680
- console.log(' • the-bull-character.epub (E-book)');
1681
- console.log(' • the-bull-character.pdf (PDF)');
1682
- } else {
1683
- console.log('⚠️ PDF merge failed, but other formats are ready.');
1684
- }
1685
- });
1686
- } else {
1687
- console.log('❌ DOCX/EPUB generation failed.');
1688
- }
1689
- });
1690
- } else {
1691
- console.log('❌ Markdown generation failed.');
1692
- }
1693
- });
1694
- } else {
1695
- // Handle specific format generation
1696
- let scriptPath;
1697
- switch (options.format.toLowerCase()) {
1698
- case 'md':
1699
- scriptPath = 'one/tools/bull-character-multi-format.py';
1700
- break;
1701
- case 'docx':
1702
- case 'epub':
1703
- scriptPath = 'one/tools/bull-character-docx-epub.py';
1704
- break;
1705
- case 'pdf':
1706
- scriptPath = 'one/tools/merge-bull-pdfs.py';
1707
- break;
1708
- default:
1709
- console.log('❌ Invalid format. Use: md, docx, epub, pdf, or all');
1710
- return;
1711
- }
1712
-
1713
- console.log(`🔄 Generating ${options.format.toUpperCase()} format...`);
1714
- const process = spawn('python3', [scriptPath], { stdio: 'inherit' });
1715
-
1716
- process.on('close', (code) => {
1717
- if (code === 0) {
1718
- console.log(`✅ ${options.format.toUpperCase()} format generated successfully!`);
1719
- } else {
1720
- console.log(`❌ ${options.format.toUpperCase()} generation failed.`);
1721
- }
1722
- });
1723
- }
1724
- }
1725
-
1726
- // Foundation Command Handler
1727
- async function handleFoundationCommand() {
1728
- try {
1729
- const FoundationWizard = await import('./foundation-wizard.js');
1730
- const wizard = new FoundationWizard.default();
1731
- await wizard.run();
1732
- } catch (error) {
1733
- console.error('Error running foundation wizard:', error);
1734
- console.log('\nTo create your foundation:');
1735
- console.log('1. Ensure you have a complete ONE installation');
1736
- console.log('2. Run "npm install" to install dependencies');
1737
- console.log('3. Try the command again');
1738
- }
1739
- }
1740
-
1741
- // Spiral Automation System
1742
- program
1743
- .command('spiral')
1744
- .description('🌀 ONE Spiral Automation System - Transform URLs into complete business systems')
1745
- .argument('[input]', 'URL, business idea, or company name to analyze')
1746
- .option('--demo', 'Run interactive demo interface')
1747
- .option('--test', 'Run test with BullStamp example')
1748
- .option('--info', 'Show system information')
1749
- .option('--dashboard', 'Start interactive dashboard after processing')
1750
- .option('-o, --output <file>', 'Save results to file')
1751
- .option('-f, --format <format>', 'Output format (json|yaml)', 'json')
1752
- .option('--debug', 'Enable debug mode')
1753
- .action(async (input, options) => {
1754
- try {
1755
- if (options.demo) {
1756
- const { default: SpiralDemo } = await import('./spiral-automation/spiral-demo.js');
1757
- const demo = new SpiralDemo();
1758
- await demo.run();
1759
- return;
1760
- }
1761
-
1762
- if (options.test) {
1763
- console.log('🧪 Running BullStamp Test...');
1764
- const { default: SpiralAutomationEngine } = await import('./spiral-automation/engine/spiral-automation-engine.js');
1765
- const engine = new SpiralAutomationEngine({ debugMode: true });
1766
- const result = await engine.processInput('bullstamp.io');
1767
- console.log('✅ Test completed successfully!');
1768
- return;
1769
- }
1770
-
1771
- if (options.info) {
1772
- console.log('🌀 Spiral Automation System Information');
1773
- console.log('━'.repeat(50));
1774
- console.log();
1775
- console.log('Components: Web Scraper, Market Research, Customer Intelligence, Foundation Synthesizer');
1776
- console.log('Capabilities: URL Analysis, Business Ideas, Company Research, Game Progression');
1777
- console.log('Quick Start: "one spiral --demo" for interactive demo');
1778
- return;
1779
- }
1780
-
1781
- if (!input) {
1782
- console.log('🌀 ONE Spiral Automation System');
1783
- console.log('Usage: one spiral <url|idea|company> [options]');
1784
- console.log(' one spiral --demo (interactive demo)');
1785
- console.log(' one spiral --test (test with BullStamp)');
1786
- console.log(' one spiral --dashboard (start with dashboard)');
1787
- console.log(' one spiral --info (system information)');
1788
- return;
1789
- }
1790
-
1791
- // Process input
1792
- console.log('🌀 Processing:', input);
1793
- const { default: SpiralAutomationEngine } = await import('./spiral-automation/engine/spiral-automation-engine.js');
1794
- const engine = new SpiralAutomationEngine({ debugMode: options.debug });
1795
- const result = await engine.processInput(input);
1796
-
1797
- if (options.output) {
1798
- const fs = await import('fs/promises');
1799
- const content = options.format === 'yaml'
1800
- ? (await import('js-yaml')).dump(result, { indent: 2 })
1801
- : JSON.stringify(result, null, 2);
1802
- await fs.writeFile(options.output, content, 'utf8');
1803
- console.log(`💾 Results saved to: ${options.output}`);
1804
- } else {
1805
- console.log('✅ Processing complete! Use --output to save results.');
1806
- }
1807
-
1808
- // Start dashboard if requested
1809
- if (options.dashboard && result.success) {
1810
- console.log();
1811
- console.log('🎮 Starting interactive dashboard...');
1812
- await engine.startInteractiveDashboard(result, result.sessionId);
1813
- }
1814
-
1815
- } catch (error) {
1816
- console.error('❌ Spiral automation failed:', error.message);
1817
- process.exit(1);
1818
- }
1819
- });
1820
-
1821
- // ========================================
1822
- // MISSION 9: IMPLEMENTATION FUNCTIONS
1823
- // Beautiful Simplicity Through Unified Orchestration
1824
- // ========================================
1825
-
1826
- // Claude Agent Discovery and Integration
1827
- async function discoverClaudeAgents() {
1828
- try {
1829
- const claudeAgentsPath = path.resolve('.claude/agents');
1830
- const files = await fs.readdir(claudeAgentsPath);
1831
- const agents = files
1832
- .filter(f => f.endsWith('.md') && f !== 'README.md')
1833
- .map(f => f.replace('.md', ''))
1834
- .sort();
1835
-
1836
- return agents;
1837
- } catch (error) {
1838
- return [];
1839
- }
1840
- }
1841
-
1842
- // Enhanced agent information extraction
1843
- async function getAgentInfo(agentName) {
1844
- try {
1845
- // Try Claude agents first
1846
- const claudePath = path.resolve('.claude/agents', `${agentName}.md`);
1847
- try {
1848
- const content = await fs.readFile(claudePath, 'utf8');
1849
- return {
1850
- name: agentName,
1851
- location: 'claude',
1852
- type: 'Claude Code Agent',
1853
- description: extractDescription(content),
1854
- capabilities: extractCapabilities(content),
1855
- team: extractTeam(agentName)
1856
- };
1857
- } catch {}
1858
-
1859
- // Try one/agents
1860
- const onePath = path.resolve('one/agents', `${agentName}.md`);
1861
- try {
1862
- const content = await fs.readFile(onePath, 'utf8');
1863
- return {
1864
- name: agentName,
1865
- location: 'one',
1866
- type: 'ONE Framework Agent',
1867
- description: extractDescription(content),
1868
- capabilities: extractCapabilities(content),
1869
- team: extractTeam(agentName)
1870
- };
1871
- } catch {}
1872
-
1873
- return null;
1874
- } catch (error) {
1875
- return null;
1876
- }
1877
- }
1878
-
1879
- function extractDescription(content) {
1880
- // Extract description from agent file
1881
- const lines = content.split('\\n');
1882
- for (const line of lines) {
1883
- if (line.includes('description:') || line.includes('Description:')) {
1884
- return line.split(':')[1]?.trim() || 'No description available';
1885
- }
1886
- }
1887
-
1888
- // Fallback: look for first paragraph
1889
- const paragraphs = content.split('\\n\\n');
1890
- if (paragraphs.length > 1) {
1891
- return paragraphs[1].substring(0, 200) + '...';
1892
- }
1893
-
1894
- return 'No description available';
1895
- }
1896
-
1897
- function extractCapabilities(content) {
1898
- const capabilities = [];
1899
- const lines = content.split('\\n');
1900
-
1901
- for (const line of lines) {
1902
- if (line.includes('tools:') || line.includes('Tools:')) {
1903
- // Extract tools as capabilities
1904
- const toolsMatch = line.match(/\\[(.*?)\\]/);
1905
- if (toolsMatch) {
1906
- capabilities.push(...toolsMatch[1].split(',').map(t => t.trim()));
1907
- }
1908
- }
1909
- }
1910
-
1911
- return capabilities;
1912
- }
1913
-
1914
- function extractTeam(agentName) {
1915
- const prefixMap = {
1916
- 'marketing-': 'Marketing Team',
1917
- 'engineering-': 'Engineering Team',
1918
- 'sales-': 'Sales Team',
1919
- 'service-': 'Service Team',
1920
- 'research-': 'Research Team',
1921
- 'content-': 'Content Team',
1922
- 'crypto-': 'Crypto Team',
1923
- 'company-': 'Company Specialists',
1924
- 'tools-': 'Tools Team',
1925
- 'framework-': 'Framework Team'
1926
- };
1927
-
1928
- for (const [prefix, team] of Object.entries(prefixMap)) {
1929
- if (agentName.startsWith(prefix)) {
1930
- return team;
1931
- }
1932
- }
1933
-
1934
- return 'Core Team';
1935
- }
1936
-
1937
- // Mission 9 Command Handlers
1938
- async function handleMissionCommand(name, options) {
1939
- console.log('🎯 \\x1b[1mMission Command - Goal-Oriented Campaigns\\x1b[0m\\n');
1940
-
1941
- if (options.list || !name) {
1942
- await listMissions();
1943
- } else if (options.create) {
1944
- await createMission(name);
1945
- } else if (options.status) {
1946
- await showMissionStatus(name);
1947
- } else {
1948
- await launchMission(name);
1949
- }
1950
- }
1951
-
1952
- async function handleStoryCommand(name, options) {
1953
- console.log('📖 \\x1b[1mStory Command - Narrative Workflows\\x1b[0m\\n');
1954
-
1955
- if (options.list || !name) {
1956
- await listStories(options.mission);
1957
- } else if (options.create) {
1958
- await createStory(name, options.mission);
1959
- } else {
1960
- await executeStory(name);
1961
- }
1962
- }
1963
-
1964
- async function handleAgentCommand(name, options) {
1965
- console.log('🤖 \\x1b[1mAgent Command - Specialized AI\\x1b[0m\\n');
1966
-
1967
- if (options.info) {
1968
- await showAgentInfo(options.info);
1969
- } else if (options.list || !name) {
1970
- await listAgents(options.team, options.claude);
1971
- } else {
1972
- await invokeAgent(name);
1973
- }
1974
- }
1975
-
1976
- async function handleTeamCommand(name, options) {
1977
- console.log('👥 \\x1b[1mTeam Command - Agent Coordination\\x1b[0m\\n');
1978
-
1979
- if (options.list || !name) {
1980
- await listTeams();
1981
- } else if (options.members) {
1982
- await showTeamMembers(options.members);
1983
- } else {
1984
- await coordinateTeam(name);
1985
- }
1986
- }
1987
-
1988
- async function handleWorkflowCommand(name, options) {
1989
- console.log('⚡ \\x1b[1mWorkflow Command - Proven Processes\\x1b[0m\\n');
1990
-
1991
- if (options.list || !name) {
1992
- await listWorkflows();
1993
- } else if (options.run) {
1994
- await executeWorkflow(options.run);
1995
- } else {
1996
- await showWorkflow(name);
1997
- }
1998
- }
1999
-
2000
- async function handleTemplateCommand(name, options) {
2001
- console.log('📄 \\x1b[1mTemplate Command - Document Generation\\x1b[0m\\n');
2002
-
2003
- if (options.list || !name) {
2004
- await listTemplates();
2005
- } else if (options.create) {
2006
- await createFromTemplate(options.create);
2007
- } else {
2008
- await showTemplate(name);
2009
- }
2010
- }
2011
-
2012
- async function handleTaskCommand(name, options) {
2013
- console.log('✅ \\x1b[1mTask Command - Specific Actions\\x1b[0m\\n');
2014
-
2015
- if (options.list || !name) {
2016
- await listTasks();
2017
- } else if (options.run) {
2018
- await executeTask(options.run);
2019
- } else {
2020
- await showTask(name);
2021
- }
2022
- }
2023
-
2024
- async function handleChecklistCommand(name, options) {
2025
- console.log('🔍 \\x1b[1mChecklist Command - Quality Validation\\x1b[0m\\n');
2026
-
2027
- if (options.list || !name) {
2028
- await listChecklists();
2029
- } else if (options.run) {
2030
- await executeChecklist(options.run);
2031
- } else {
2032
- await showChecklist(name);
2033
- }
2034
- }
2035
-
2036
- async function handleDataCommand(name, options) {
2037
- console.log('💾 \\x1b[1mData Command - Knowledge Base\\x1b[0m\\n');
2038
-
2039
- if (options.search) {
2040
- await searchKnowledge(options.search);
2041
- } else if (options.list || !name) {
2042
- await listData();
2043
- } else {
2044
- await showData(name);
2045
- }
2046
- }
2047
-
2048
- async function handlePlaybookCommand(name, options) {
2049
- console.log('📚 \\x1b[1mPlaybook Command - Industry Guides\\x1b[0m\\n');
2050
-
2051
- if (options.generate) {
2052
- await generatePlaybook(options.generate, options.industry);
2053
- } else if (options.list || !name) {
2054
- await listPlaybooks();
2055
- } else {
2056
- await showPlaybook(name);
2057
- }
2058
- }
2059
-
2060
- async function handleToolCommand(name, options) {
2061
- console.log('🛠️ \\x1b[1mTool Command - Utilities\\x1b[0m\\n');
2062
-
2063
- if (options.list || !name) {
2064
- await listTools();
2065
- } else if (options.run) {
2066
- await executeTool(options.run);
2067
- } else {
2068
- await showTool(name);
2069
- }
2070
- }
2071
-
2072
- async function handleHelpCommand(command) {
2073
- if (command) {
2074
- await showCommandHelp(command);
2075
- } else {
2076
- await showGeneralHelp();
2077
- }
2078
- }
2079
-
2080
- // Implementation Functions
2081
- async function listAgents(teamFilter, claudeOnly) {
2082
- const claudeAgents = await discoverClaudeAgents();
2083
- const oneAgents = await discoverOneAgents();
2084
-
2085
- if (claudeOnly) {
2086
- console.log('🎭 \\x1b[1mClaude Code Agents\\x1b[0m (.claude/agents/)\\n');
2087
- displayAgentsByTeam(claudeAgents, teamFilter);
2088
- } else {
2089
- console.log('🎭 \\x1b[1mAgent Symphony - Beautiful Simplicity\\x1b[0m\\n');
2090
-
2091
- if (claudeAgents.length > 0) {
2092
- console.log('\\x1b[36m🎪 Claude Code Agents\\x1b[0m (.claude/agents/)');
2093
- displayAgentsByTeam(claudeAgents, teamFilter);
2094
- console.log();
2095
- }
2096
-
2097
- if (oneAgents.length > 0) {
2098
- console.log('\\x1b[33m🎪 ONE Framework Agents\\x1b[0m (one/agents/)');
2099
- displayAgentsByTeam(oneAgents, teamFilter);
2100
- }
2101
-
2102
- console.log(`\\n\\x1b[32m✨ Total: ${claudeAgents.length + oneAgents.length} specialized agents ready\\x1b[0m`);
2103
- console.log('\\x1b[2mUse: one agent <name> to invoke, one agent -i <name> for details\\x1b[0m');
2104
- }
2105
- }
2106
-
2107
- function displayAgentsByTeam(agents, teamFilter) {
2108
- const teams = {};
2109
-
2110
- agents.forEach(agent => {
2111
- const team = extractTeam(agent);
2112
- if (!teamFilter || team.toLowerCase().includes(teamFilter.toLowerCase())) {
2113
- if (!teams[team]) teams[team] = [];
2114
- teams[team].push(agent);
2115
- }
2116
- });
2117
-
2118
- Object.entries(teams).sort().forEach(([team, teamAgents]) => {
2119
- console.log(`\\n \\x1b[1m${team}\\x1b[0m`);
2120
- teamAgents.sort().forEach(agent => {
2121
- console.log(` • ${agent}`);
2122
- });
2123
- });
2124
- }
2125
-
2126
- async function discoverOneAgents() {
2127
- try {
2128
- const oneAgentsPath = path.resolve('one/agents');
2129
- const files = await fs.readdir(oneAgentsPath);
2130
- return files
2131
- .filter(f => f.endsWith('.md'))
2132
- .map(f => f.replace('.md', ''))
2133
- .sort();
2134
- } catch (error) {
2135
- return [];
2136
- }
2137
- }
2138
-
2139
- async function showAgentInfo(agentName) {
2140
- const info = await getAgentInfo(agentName);
2141
-
2142
- if (!info) {
2143
- console.log(`❌ Agent '${agentName}' not found`);
2144
- console.log('\\nUse: one agent --list to see available agents');
2145
- return;
2146
- }
2147
-
2148
- console.log(`\\x1b[1m${info.name}\\x1b[0m`);
2149
- console.log(`Type: ${info.type}`);
2150
- console.log(`Team: ${info.team}`);
2151
- console.log(`Location: ${info.location}`);
2152
- console.log(`\\nDescription:`);
2153
- console.log(` ${info.description}`);
2154
-
2155
- if (info.capabilities.length > 0) {
2156
- console.log(`\\nCapabilities:`);
2157
- info.capabilities.forEach(cap => console.log(` • ${cap}`));
2158
- }
2159
-
2160
- console.log(`\\n\\x1b[2mInvoke with: one agent ${agentName}\\x1b[0m`);
2161
- }
2162
-
2163
- async function showSymphonyStatus() {
2164
- console.log('🎼 \\x1b[1mSymphony Orchestration Status\\x1b[0m\\n');
2165
-
2166
- const claudeAgents = await discoverClaudeAgents();
2167
- const oneAgents = await discoverOneAgents();
2168
-
2169
- // Show ecosystem health
2170
- console.log('\\x1b[36m🎪 Agent Ensemble\\x1b[0m');
2171
- console.log(` Claude Code Agents: ${claudeAgents.length}`);
2172
- console.log(` ONE Framework Agents: ${oneAgents.length}`);
2173
- console.log(` Total Specialists: ${claudeAgents.length + oneAgents.length}`);
2174
-
2175
- // Show component status
2176
- console.log('\\n\\x1b[33m🏗️ Component Status\\x1b[0m');
2177
- await checkComponentStatus('missions', 'one/missions');
2178
- await checkComponentStatus('stories', 'one/stories');
2179
- await checkComponentStatus('workflows', 'one/workflows');
2180
- await checkComponentStatus('templates', 'one/templates');
2181
- await checkComponentStatus('tasks', 'one/tasks');
2182
- await checkComponentStatus('checklists', 'one/checklists');
2183
- await checkComponentStatus('data', 'one/data');
2184
- await checkComponentStatus('playbooks', 'one/playbooks');
2185
-
2186
- console.log('\\n\\x1b[32m✨ Mission 9: Beautiful Simplicity Achieved\\x1b[0m');
2187
- console.log('\\x1b[2mAll components working in harmony through /one command\\x1b[0m');
2188
- }
2189
-
2190
- async function checkComponentStatus(name, directory) {
2191
- try {
2192
- const files = await fs.readdir(directory);
2193
- const count = files.filter(f => !f.startsWith('.')).length;
2194
- console.log(` ${name}: ${count} items ✅`);
2195
- } catch (error) {
2196
- console.log(` ${name}: not found ❌`);
2197
- }
2198
- }
2199
-
2200
- async function showGeneralHelp() {
2201
- console.log('🎼 \\x1b[1mONE Framework - Beautiful Simplicity Through Unified Orchestration\\x1b[0m\\n');
2202
-
2203
- console.log('\\x1b[36m🎨 Interactive Interface\\x1b[0m');
2204
- console.log(' one interface 🎨 Launch responsive ONE interface');
2205
- console.log(' one ui 🎨 Alias for interface command');
2206
- console.log(' one one 🎯 Quick access to interface');
2207
- console.log();
2208
-
2209
- console.log('\\x1b[36m🎯 Mission 9 Commands - The Symphony Interface\\x1b[0m');
2210
- console.log(' one mission 🎯 Launch goal-oriented campaigns');
2211
- console.log(' one story 📖 Execute narrative workflows');
2212
- console.log(' one agent 🤖 Invoke specialized AI');
2213
- console.log(' one team 👥 Coordinate agent groups');
2214
- console.log(' one workflow ⚡ Run proven processes');
2215
- console.log(' one template 📄 Generate documents');
2216
- console.log(' one task ✅ Execute specific actions');
2217
- console.log(' one checklist 🔍 Validate quality');
2218
- console.log(' one data 💾 Access knowledge base');
2219
- console.log(' one playbook 📚 Industry guides');
2220
- console.log(' one tool 🛠️ Utility functions');
2221
- console.log(' one status 🎼 Symphony status');
2222
- console.log(' one help ❓ This help');
2223
-
2224
- console.log('\\n\\x1b[33m✨ Quick Start\\x1b[0m');
2225
- console.log(' one interface # Beautiful responsive interface');
2226
- console.log(' one agent --list # See all 40+ specialized agents');
2227
- console.log(' one mission --list # View available campaigns');
2228
- console.log(' one status # Check ecosystem health');
2229
-
2230
- console.log('\\n\\x1b[32m🎪 Beautiful Simplicity Principles\\x1b[0m');
2231
- console.log(' • Responsive design - adapts to any terminal size');
2232
- console.log(' • One command (/one) - access entire ecosystem');
2233
- console.log(' • Intelligent routing - finds what you need');
2234
- console.log(' • Progressive disclosure - simple stays simple');
2235
- console.log(' • Emergent capabilities - combinations create magic');
2236
-
2237
- console.log('\\n\\x1b[2m"True sophistication is making the complex appear simple"\\x1b[0m');
2238
- }
2239
-
2240
- // Placeholder implementations for missing functions
2241
- async function listMissions() { console.log('📋 Missions feature coming soon...'); }
2242
- async function createMission(name) { console.log(`🎯 Creating mission: ${name}...`); }
2243
- async function showMissionStatus(name) { console.log(`📊 Status for mission: ${name}...`); }
2244
- async function launchMission(name) { console.log(`🚀 Launching mission: ${name}...`); }
2245
- async function listStories(mission) { console.log('📚 Stories feature coming soon...'); }
2246
- async function createStory(name, mission) { console.log(`📝 Creating story: ${name}...`); }
2247
- async function executeStory(name) { console.log(`▶️ Executing story: ${name}...`); }
2248
- async function invokeAgent(name) { console.log(`🤖 Invoking agent: ${name}...`); }
2249
- async function listTeams() { console.log('👥 Teams feature coming soon...'); }
2250
- async function showTeamMembers(team) { console.log(`👫 Team members for: ${team}...`); }
2251
- async function coordinateTeam(name) { console.log(`🎵 Coordinating team: ${name}...`); }
2252
- async function listWorkflows() { console.log('⚡ Workflows feature coming soon...'); }
2253
- async function executeWorkflow(name) { console.log(`⚡ Executing workflow: ${name}...`); }
2254
- async function showWorkflow(name) { console.log(`📋 Workflow details: ${name}...`); }
2255
- async function listTemplates() { console.log('📄 Templates feature coming soon...'); }
2256
- async function createFromTemplate(template) { console.log(`📝 Creating from template: ${template}...`); }
2257
- async function showTemplate(name) { console.log(`📄 Template details: ${name}...`); }
2258
- async function listTasks() { console.log('✅ Tasks feature coming soon...'); }
2259
- async function executeTask(task) { console.log(`⚡ Executing task: ${task}...`); }
2260
- async function showTask(name) { console.log(`✅ Task details: ${name}...`); }
2261
- async function listChecklists() { console.log('🔍 Checklists feature coming soon...'); }
2262
- async function executeChecklist(checklist) { console.log(`✅ Running checklist: ${checklist}...`); }
2263
- async function showChecklist(name) { console.log(`🔍 Checklist details: ${name}...`); }
2264
- async function listData() { console.log('💾 Data browser coming soon...'); }
2265
- async function searchKnowledge(query) { console.log(`🔍 Searching for: ${query}...`); }
2266
- async function showData(name) { console.log(`💾 Data details: ${name}...`); }
2267
- async function listPlaybooks() { console.log('📚 Playbooks feature coming soon...'); }
2268
- async function generatePlaybook(client, industry) { console.log(`📖 Generating playbook for: ${client}...`); }
2269
- async function showPlaybook(name) { console.log(`📚 Playbook details: ${name}...`); }
2270
- async function listTools() { console.log('🛠️ Tools feature coming soon...'); }
2271
- async function executeTool(tool) { console.log(`🔧 Running tool: ${tool}...`); }
2272
- async function showTool(name) { console.log(`🛠️ Tool details: ${name}...`); }
2273
- async function showCommandHelp(command) { console.log(`❓ Help for command: ${command}...`); }
2274
-
2275
- program.parse();