claude-flow 1.0.6 → 1.0.8

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.
@@ -0,0 +1,670 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Pure Node.js CLI for Claude-Flow
4
+ * This version works without Deno dependency
5
+ */
6
+
7
+ const fs = require('fs').promises;
8
+ const path = require('path');
9
+ const { spawn } = require('child_process');
10
+ const os = require('os');
11
+
12
+ const VERSION = '1.0.0';
13
+
14
+ // ANSI color codes
15
+ const colors = {
16
+ reset: '\x1b[0m',
17
+ bright: '\x1b[1m',
18
+ red: '\x1b[31m',
19
+ green: '\x1b[32m',
20
+ yellow: '\x1b[33m',
21
+ blue: '\x1b[34m',
22
+ cyan: '\x1b[36m',
23
+ };
24
+
25
+ function success(msg) {
26
+ console.log(`${colors.green}✅ ${msg}${colors.reset}`);
27
+ }
28
+
29
+ function error(msg) {
30
+ console.log(`${colors.red}❌ ${msg}${colors.reset}`);
31
+ }
32
+
33
+ function warning(msg) {
34
+ console.log(`${colors.yellow}⚠️ ${msg}${colors.reset}`);
35
+ }
36
+
37
+ function info(msg) {
38
+ console.log(`${colors.blue}ℹ️ ${msg}${colors.reset}`);
39
+ }
40
+
41
+ // Check if Deno is available
42
+ function checkDeno() {
43
+ return new Promise((resolve) => {
44
+ const deno = spawn('deno', ['--version'], { stdio: 'pipe' });
45
+ deno.on('close', (code) => {
46
+ resolve(code === 0);
47
+ });
48
+ deno.on('error', () => {
49
+ resolve(false);
50
+ });
51
+ });
52
+ }
53
+
54
+ // Install Deno if not available
55
+ async function installDeno() {
56
+ console.log('Deno not found. Installing Deno...');
57
+
58
+ const platform = os.platform();
59
+
60
+ if (platform === 'win32') {
61
+ console.log('Please install Deno manually from https://deno.land/');
62
+ process.exit(1);
63
+ }
64
+
65
+ return new Promise((resolve, reject) => {
66
+ const installScript = spawn('curl', ['-fsSL', 'https://deno.land/x/install/install.sh'], { stdio: 'pipe' });
67
+ const sh = spawn('sh', [], { stdio: ['pipe', 'inherit', 'inherit'] });
68
+
69
+ installScript.stdout.pipe(sh.stdin);
70
+
71
+ sh.on('close', (code) => {
72
+ if (code === 0) {
73
+ success('Deno installed successfully!');
74
+ console.log('Please restart your terminal or run: export PATH="$HOME/.deno/bin:$PATH"');
75
+ resolve();
76
+ } else {
77
+ reject(new Error('Failed to install Deno'));
78
+ }
79
+ });
80
+ });
81
+ }
82
+
83
+ // Handle commands that require Deno
84
+ async function handleDenoCommand(command, args) {
85
+ try {
86
+ const denoAvailable = await checkDeno();
87
+
88
+ if (!denoAvailable) {
89
+ const readline = require('readline');
90
+ const rl = readline.createInterface({
91
+ input: process.stdin,
92
+ output: process.stdout
93
+ });
94
+
95
+ warning(`The '${command}' command requires Deno to be installed.`);
96
+ console.log('Would you like to install Deno automatically? (y/n)');
97
+
98
+ const answer = await new Promise((resolve) => {
99
+ rl.question('', (answer) => {
100
+ rl.close();
101
+ resolve(answer.toLowerCase());
102
+ });
103
+ });
104
+
105
+ if (answer === 'y' || answer === 'yes') {
106
+ await installDeno();
107
+ console.log('\nNow you can run the command again after restarting your terminal or running:');
108
+ console.log('export PATH="$HOME/.deno/bin:$PATH"');
109
+ console.log(`\nThen: npx claude-flow ${command} ${args.join(' ')}`);
110
+ } else {
111
+ console.log('Please install Deno manually from https://deno.land/ and run:');
112
+ console.log(` deno run --allow-all src/cli/index.ts ${command} ${args.join(' ')}`);
113
+ }
114
+ } else {
115
+ console.log(`Running: deno run --allow-all src/cli/index.ts ${command} ${args.join(' ')}`);
116
+ console.log('Note: Make sure you\'re in the claude-flow project directory');
117
+ }
118
+ } catch (error) {
119
+ error(`Failed to handle Deno command: ${error.message}`);
120
+ }
121
+ }
122
+
123
+ function printHelp() {
124
+ console.log(`
125
+ ${colors.blue}🧠 Claude-Flow v${VERSION}${colors.reset} - Advanced AI Agent Orchestration System
126
+
127
+ USAGE:
128
+ claude-flow [COMMAND] [OPTIONS]
129
+
130
+ COMMANDS:
131
+ ${colors.cyan}init${colors.reset} Initialize Claude Code integration files
132
+ ${colors.cyan}start${colors.reset} Start the orchestration system
133
+ ${colors.cyan}agent${colors.reset} Manage agents (spawn, list, terminate, info)
134
+ ${colors.cyan}task${colors.reset} Manage tasks (create, list, status, cancel, workflow)
135
+ ${colors.cyan}memory${colors.reset} Manage memory (query, export, import, stats, cleanup)
136
+ ${colors.cyan}config${colors.reset} Manage configuration (show, get, set, init, validate)
137
+ ${colors.cyan}status${colors.reset} Show system status
138
+ ${colors.cyan}monitor${colors.reset} Monitor system in real-time
139
+ ${colors.cyan}mcp${colors.reset} MCP server management (status, tools, config, logs)
140
+ ${colors.cyan}claude${colors.reset} Spawn Claude instances with specific configurations
141
+ ${colors.cyan}session${colors.reset} Manage terminal sessions
142
+ ${colors.cyan}workflow${colors.reset} Execute workflow files
143
+ ${colors.cyan}version${colors.reset} Show version information
144
+ ${colors.cyan}help${colors.reset} Show this help message
145
+
146
+ GLOBAL OPTIONS:
147
+ -c, --config <path> Path to configuration file
148
+ -v, --verbose Enable verbose logging
149
+ --log-level <level> Set log level (debug, info, warn, error)
150
+ --help Show help for specific command
151
+
152
+ EXAMPLES:
153
+ claude-flow init # Initialize project
154
+ claude-flow start # Start orchestrator (auto-installs Deno)
155
+ claude-flow agent spawn researcher --name "Bot" # Spawn research agent
156
+ claude-flow task create research "Analyze data" # Create task
157
+ claude-flow status # Show system status
158
+
159
+ NOTE: Commands requiring Deno will offer automatic installation
160
+
161
+ Documentation: https://github.com/ruvnet/claude-code-flow
162
+ `);
163
+ }
164
+
165
+ async function executeInit(args) {
166
+ const force = args.includes('-f') || args.includes('--force');
167
+ const minimal = args.includes('-m') || args.includes('--minimal');
168
+
169
+ success('Initializing Claude Code integration files...');
170
+
171
+ try {
172
+ // Check if files already exist
173
+ const files = ['CLAUDE.md', 'memory-bank.md', 'coordination.md'];
174
+ const existingFiles = [];
175
+
176
+ for (const file of files) {
177
+ try {
178
+ await fs.access(file);
179
+ existingFiles.push(file);
180
+ } catch {
181
+ // File doesn't exist, which is fine
182
+ }
183
+ }
184
+
185
+ if (existingFiles.length > 0 && !force) {
186
+ warning(`The following files already exist: ${existingFiles.join(', ')}`);
187
+ console.log('Use --force to overwrite existing files');
188
+ return;
189
+ }
190
+
191
+ // Create CLAUDE.md
192
+ const claudeMd = minimal ? createMinimalClaudeMd() : createFullClaudeMd();
193
+ await fs.writeFile('CLAUDE.md', claudeMd);
194
+ console.log(' ✓ Created CLAUDE.md');
195
+
196
+ // Create memory-bank.md
197
+ const memoryBankMd = minimal ? createMinimalMemoryBankMd() : createFullMemoryBankMd();
198
+ await fs.writeFile('memory-bank.md', memoryBankMd);
199
+ console.log(' ✓ Created memory-bank.md');
200
+
201
+ // Create coordination.md
202
+ const coordinationMd = minimal ? createMinimalCoordinationMd() : createFullCoordinationMd();
203
+ await fs.writeFile('coordination.md', coordinationMd);
204
+ console.log(' ✓ Created coordination.md');
205
+
206
+ // Create directory structure
207
+ const directories = [
208
+ 'memory',
209
+ 'memory/agents',
210
+ 'memory/sessions',
211
+ 'coordination',
212
+ 'coordination/memory_bank',
213
+ 'coordination/subtasks',
214
+ 'coordination/orchestration'
215
+ ];
216
+
217
+ for (const dir of directories) {
218
+ try {
219
+ await fs.mkdir(dir, { recursive: true });
220
+ console.log(` ✓ Created ${dir}/ directory`);
221
+ } catch (err) {
222
+ if (err.code !== 'EEXIST') {
223
+ throw err;
224
+ }
225
+ }
226
+ }
227
+
228
+ // Create placeholder files
229
+ const agentsReadme = createAgentsReadme();
230
+ await fs.writeFile('memory/agents/README.md', agentsReadme);
231
+ console.log(' ✓ Created memory/agents/README.md');
232
+
233
+ const sessionsReadme = createSessionsReadme();
234
+ await fs.writeFile('memory/sessions/README.md', sessionsReadme);
235
+ console.log(' ✓ Created memory/sessions/README.md');
236
+
237
+ // Initialize persistence database
238
+ const initialData = {
239
+ agents: [],
240
+ tasks: [],
241
+ lastUpdated: Date.now()
242
+ };
243
+ await fs.writeFile('memory/claude-flow-data.json', JSON.stringify(initialData, null, 2));
244
+ console.log(' ✓ Created memory/claude-flow-data.json (persistence database)');
245
+
246
+ success('Claude Code integration files initialized successfully!');
247
+ console.log('\nNext steps:');
248
+ console.log('1. Review and customize the generated files for your project');
249
+ console.log('2. Run \'npx claude-flow start\' to begin the orchestration system');
250
+ console.log('3. Use \'claude --dangerously-skip-permissions\' for unattended operation');
251
+
252
+ } catch (err) {
253
+ error(`Failed to initialize files: ${err.message}`);
254
+ process.exit(1);
255
+ }
256
+ }
257
+
258
+ async function executeStatus() {
259
+ try {
260
+ // Check if persistence file exists
261
+ let data;
262
+ try {
263
+ const content = await fs.readFile('memory/claude-flow-data.json', 'utf8');
264
+ data = JSON.parse(content);
265
+ } catch {
266
+ data = { agents: [], tasks: [] };
267
+ }
268
+
269
+ // Check if orchestrator is running (simplified check)
270
+ let isRunning = false;
271
+ try {
272
+ await fs.access('orchestrator.log');
273
+ isRunning = true;
274
+ } catch {
275
+ // Log file doesn't exist, orchestrator not running
276
+ }
277
+
278
+ const activeAgents = data.agents.filter(a => a.status === 'active').length;
279
+ const totalAgents = data.agents.length;
280
+ const pendingTasks = data.tasks.filter(t => t.status === 'pending' || t.status === 'assigned').length;
281
+ const totalTasks = data.tasks.length;
282
+ const completedTasks = data.tasks.filter(t => t.status === 'completed').length;
283
+
284
+ success('Claude-Flow System Status:');
285
+ console.log(`🟢 Status: ${isRunning ? 'Running' : 'Stopped'}`);
286
+ console.log(`🤖 Agents: ${activeAgents} active (${totalAgents} total)`);
287
+ console.log(`📋 Tasks: ${pendingTasks} in queue (${totalTasks} total)`);
288
+ console.log(`✅ Completed: ${completedTasks} tasks`);
289
+ console.log(`💾 Memory: Ready`);
290
+ console.log(`🖥️ Terminal Pool: Ready`);
291
+ console.log(`🌐 MCP Server: ${isRunning ? 'Running' : 'Stopped'}`);
292
+
293
+ } catch (err) {
294
+ error(`Failed to get status: ${err.message}`);
295
+ }
296
+ }
297
+
298
+ // Template functions
299
+ function createMinimalClaudeMd() {
300
+ return `# Claude Code Configuration
301
+
302
+ ## Build Commands
303
+ - \`npm run build\`: Build the project
304
+ - \`npm run test\`: Run tests
305
+ - \`npm run lint\`: Run linter
306
+
307
+ ## Code Style
308
+ - Use TypeScript/ES modules
309
+ - Follow project conventions
310
+ - Run typecheck before committing
311
+
312
+ ## Project Info
313
+ This is a Claude-Flow AI agent orchestration system.
314
+ `;
315
+ }
316
+
317
+ function createFullClaudeMd() {
318
+ return `# Claude Code Configuration
319
+
320
+ ## Build Commands
321
+ - \`npm run build\`: Build the project using Deno compile
322
+ - \`npm run test\`: Run the full test suite
323
+ - \`npm run lint\`: Run ESLint and format checks
324
+ - \`npm run typecheck\`: Run TypeScript type checking
325
+ - \`npx claude-flow start\`: Start the orchestration system
326
+ - \`npx claude-flow --help\`: Show all available commands
327
+
328
+ ## Code Style Preferences
329
+ - Use ES modules (import/export) syntax, not CommonJS (require)
330
+ - Destructure imports when possible (e.g., \`import { foo } from 'bar'\`)
331
+ - Use TypeScript for all new code
332
+ - Follow existing naming conventions (camelCase for variables, PascalCase for classes)
333
+ - Add JSDoc comments for public APIs
334
+ - Use async/await instead of Promise chains
335
+ - Prefer const/let over var
336
+
337
+ ## Workflow Guidelines
338
+ - Always run typecheck after making code changes
339
+ - Run tests before committing changes
340
+ - Use meaningful commit messages following conventional commits
341
+ - Create feature branches for new functionality
342
+ - Ensure all tests pass before merging
343
+
344
+ ## Project Architecture
345
+ This is a Claude-Flow AI agent orchestration system with the following components:
346
+ - **CLI Interface**: Command-line tools for managing the system
347
+ - **Orchestrator**: Core engine for coordinating agents and tasks
348
+ - **Memory System**: Persistent storage and retrieval of information
349
+ - **Terminal Management**: Automated terminal session handling
350
+ - **MCP Integration**: Model Context Protocol server for Claude integration
351
+ - **Agent Coordination**: Multi-agent task distribution and management
352
+
353
+ ## Important Notes
354
+ - Use \`claude --dangerously-skip-permissions\` for unattended operation
355
+ - The system supports both daemon and interactive modes
356
+ - Memory persistence is handled automatically
357
+ - All components are event-driven for scalability
358
+
359
+ ## Debugging
360
+ - Check logs in \`./claude-flow.log\`
361
+ - Use \`npx claude-flow status\` to check system health
362
+ - Monitor with \`npx claude-flow monitor\` for real-time updates
363
+ - Verbose output available with \`--verbose\` flag on most commands
364
+ `;
365
+ }
366
+
367
+ function createMinimalMemoryBankMd() {
368
+ return `# Memory Bank
369
+
370
+ ## Quick Reference
371
+ - Project uses JSON for memory persistence
372
+ - Memory is organized by namespaces
373
+ - Query with \`npx claude-flow memory query <search>\`
374
+
375
+ ## Storage Location
376
+ - Database: \`./memory/claude-flow-data.json\`
377
+ - Sessions: \`./memory/sessions/\`
378
+ `;
379
+ }
380
+
381
+ function createFullMemoryBankMd() {
382
+ return `# Memory Bank Configuration
383
+
384
+ ## Overview
385
+ The Claude-Flow memory system provides persistent storage and intelligent retrieval of information across agent sessions. It uses a hybrid approach combining JSON databases with semantic search capabilities.
386
+
387
+ ## Storage Backends
388
+ - **Primary**: JSON database (\`./memory/claude-flow-data.json\`)
389
+ - **Sessions**: File-based storage in \`./memory/sessions/\`
390
+ - **Cache**: In-memory cache for frequently accessed data
391
+
392
+ ## Memory Organization
393
+ - **Namespaces**: Logical groupings of related information
394
+ - **Sessions**: Time-bound conversation contexts
395
+ - **Indexing**: Automatic content indexing for fast retrieval
396
+ - **Replication**: Optional distributed storage support
397
+
398
+ ## Commands
399
+ - \`npx claude-flow memory query <search>\`: Search stored information
400
+ - \`npx claude-flow memory stats\`: Show memory usage statistics
401
+ - \`npx claude-flow memory export <file>\`: Export memory to file
402
+ - \`npx claude-flow memory import <file>\`: Import memory from file
403
+
404
+ ## Configuration
405
+ Memory settings are configured in \`claude-flow.config.json\`:
406
+ \`\`\`json
407
+ {
408
+ "memory": {
409
+ "backend": "json",
410
+ "path": "./memory/claude-flow-data.json",
411
+ "cacheSize": 1000,
412
+ "indexing": true,
413
+ "namespaces": ["default", "agents", "tasks", "sessions"],
414
+ "retentionPolicy": {
415
+ "sessions": "30d",
416
+ "tasks": "90d",
417
+ "agents": "permanent"
418
+ }
419
+ }
420
+ }
421
+ \`\`\`
422
+
423
+ ## Best Practices
424
+ - Use descriptive namespaces for different data types
425
+ - Regular memory exports for backup purposes
426
+ - Monitor memory usage with stats command
427
+ - Clean up old sessions periodically
428
+
429
+ ## Memory Types
430
+ - **Episodic**: Conversation and interaction history
431
+ - **Semantic**: Factual knowledge and relationships
432
+ - **Procedural**: Task patterns and workflows
433
+ - **Meta**: System configuration and preferences
434
+
435
+ ## Integration Notes
436
+ - Memory is automatically synchronized across agents
437
+ - Search supports both exact match and semantic similarity
438
+ - Memory contents are private to your local instance
439
+ - No data is sent to external services without explicit commands
440
+ `;
441
+ }
442
+
443
+ function createMinimalCoordinationMd() {
444
+ return `# Agent Coordination
445
+
446
+ ## Quick Commands
447
+ - \`npx claude-flow agent spawn <type>\`: Create new agent
448
+ - \`npx claude-flow agent list\`: Show active agents
449
+ - \`npx claude-flow task create <type> <description>\`: Create task
450
+
451
+ ## Agent Types
452
+ - researcher, coder, analyst, coordinator, general
453
+ `;
454
+ }
455
+
456
+ function createFullCoordinationMd() {
457
+ return `# Agent Coordination System
458
+
459
+ ## Overview
460
+ The Claude-Flow coordination system manages multiple AI agents working together on complex tasks. It provides intelligent task distribution, resource management, and inter-agent communication.
461
+
462
+ ## Agent Types and Capabilities
463
+ - **Researcher**: Web search, information gathering, knowledge synthesis
464
+ - **Coder**: Code analysis, development, debugging, testing
465
+ - **Analyst**: Data processing, pattern recognition, insights generation
466
+ - **Coordinator**: Task planning, resource allocation, workflow management
467
+ - **General**: Multi-purpose agent with balanced capabilities
468
+
469
+ ## Task Management
470
+ - **Priority Levels**: 1 (lowest) to 10 (highest)
471
+ - **Dependencies**: Tasks can depend on completion of other tasks
472
+ - **Parallel Execution**: Independent tasks run concurrently
473
+ - **Load Balancing**: Automatic distribution based on agent capacity
474
+
475
+ ## Coordination Commands
476
+ \`\`\`bash
477
+ # Agent Management
478
+ npx claude-flow agent spawn <type> --name <name> --priority <1-10>
479
+ npx claude-flow agent list
480
+ npx claude-flow agent info <agent-id>
481
+ npx claude-flow agent terminate <agent-id>
482
+
483
+ # Task Management
484
+ npx claude-flow task create <type> <description> --priority <1-10> --deps <task-ids>
485
+ npx claude-flow task list --verbose
486
+ npx claude-flow task status <task-id>
487
+ npx claude-flow task cancel <task-id>
488
+
489
+ # System Monitoring
490
+ npx claude-flow status --verbose
491
+ npx claude-flow monitor --interval 5000
492
+ \`\`\`
493
+
494
+ ## Workflow Execution
495
+ Workflows are defined in JSON format and can orchestrate complex multi-agent operations:
496
+ \`\`\`bash
497
+ npx claude-flow workflow examples/research-workflow.json
498
+ npx claude-flow workflow examples/development-config.json --async
499
+ \`\`\`
500
+
501
+ ## Advanced Features
502
+ - **Circuit Breakers**: Automatic failure handling and recovery
503
+ - **Work Stealing**: Dynamic load redistribution for efficiency
504
+ - **Resource Limits**: Memory and CPU usage constraints
505
+ - **Metrics Collection**: Performance monitoring and optimization
506
+
507
+ ## Configuration
508
+ Coordination settings in \`claude-flow.config.json\`:
509
+ \`\`\`json
510
+ {
511
+ "orchestrator": {
512
+ "maxConcurrentTasks": 10,
513
+ "taskTimeout": 300000,
514
+ "defaultPriority": 5
515
+ },
516
+ "agents": {
517
+ "maxAgents": 20,
518
+ "defaultCapabilities": ["research", "code", "terminal"],
519
+ "resourceLimits": {
520
+ "memory": "1GB",
521
+ "cpu": "50%"
522
+ }
523
+ }
524
+ }
525
+ \`\`\`
526
+
527
+ ## Communication Patterns
528
+ - **Direct Messaging**: Agent-to-agent communication
529
+ - **Event Broadcasting**: System-wide notifications
530
+ - **Shared Memory**: Common information access
531
+ - **Task Handoff**: Seamless work transfer between agents
532
+
533
+ ## Best Practices
534
+ - Start with general agents and specialize as needed
535
+ - Use descriptive task names and clear requirements
536
+ - Monitor system resources during heavy workloads
537
+ - Implement proper error handling in workflows
538
+ - Regular cleanup of completed tasks and inactive agents
539
+
540
+ ## Troubleshooting
541
+ - Check agent health with \`npx claude-flow status\`
542
+ - View detailed logs with \`npx claude-flow monitor\`
543
+ - Restart stuck agents with terminate/spawn cycle
544
+ - Use \`--verbose\` flags for detailed diagnostic information
545
+ `;
546
+ }
547
+
548
+ function createAgentsReadme() {
549
+ return `# Agent Memory Storage
550
+
551
+ ## Purpose
552
+ This directory stores agent-specific memory data, configurations, and persistent state information for individual Claude agents in the orchestration system.
553
+
554
+ ## Structure
555
+ Each agent gets its own subdirectory for isolated memory storage:
556
+
557
+ \`\`\`
558
+ memory/agents/
559
+ ├── agent_001/
560
+ │ ├── state.json # Agent state and configuration
561
+ │ ├── knowledge.md # Agent-specific knowledge base
562
+ │ ├── tasks.json # Completed and active tasks
563
+ │ └── calibration.json # Agent-specific calibrations
564
+ ├── agent_002/
565
+ │ └── ...
566
+ └── shared/
567
+ ├── common_knowledge.md # Shared knowledge across agents
568
+ └── global_config.json # Global agent configurations
569
+ \`\`\`
570
+
571
+ ## Usage Guidelines
572
+ 1. **Agent Isolation**: Each agent should only read/write to its own directory
573
+ 2. **Shared Resources**: Use the \`shared/\` directory for cross-agent information
574
+ 3. **State Persistence**: Update state.json whenever agent status changes
575
+ 4. **Knowledge Sharing**: Document discoveries in knowledge.md files
576
+ 5. **Cleanup**: Remove directories for terminated agents periodically
577
+
578
+ ## Last Updated
579
+ ${new Date().toISOString()}
580
+ `;
581
+ }
582
+
583
+ function createSessionsReadme() {
584
+ return `# Session Memory Storage
585
+
586
+ ## Purpose
587
+ This directory stores session-based memory data, conversation history, and contextual information for development sessions using the Claude-Flow orchestration system.
588
+
589
+ ## Structure
590
+ Sessions are organized by date and session ID for easy retrieval:
591
+
592
+ \`\`\`
593
+ memory/sessions/
594
+ ├── 2024-01-10/
595
+ │ ├── session_001/
596
+ │ │ ├── metadata.json # Session metadata and configuration
597
+ │ │ ├── conversation.md # Full conversation history
598
+ │ │ ├── decisions.md # Key decisions and rationale
599
+ │ │ ├── artifacts/ # Generated files and outputs
600
+ │ │ └── coordination_state/ # Coordination system snapshots
601
+ │ └── ...
602
+ └── shared/
603
+ ├── patterns.md # Common session patterns
604
+ └── templates/ # Session template files
605
+ \`\`\`
606
+
607
+ ## Usage Guidelines
608
+ 1. **Session Isolation**: Each session gets its own directory
609
+ 2. **Metadata Completeness**: Always fill out session metadata
610
+ 3. **Conversation Logging**: Document all significant interactions
611
+ 4. **Artifact Organization**: Structure generated files clearly
612
+ 5. **State Preservation**: Snapshot coordination state regularly
613
+
614
+ ## Last Updated
615
+ ${new Date().toISOString()}
616
+ `;
617
+ }
618
+
619
+ // Main CLI handler
620
+ async function main() {
621
+ const args = process.argv.slice(2);
622
+ const command = args[0];
623
+
624
+ if (!command || command === 'help' || command === '--help') {
625
+ printHelp();
626
+ return;
627
+ }
628
+
629
+ if (command === 'version' || command === '--version') {
630
+ console.log(`Claude-Flow v${VERSION}`);
631
+ return;
632
+ }
633
+
634
+ switch (command) {
635
+ case 'init':
636
+ await executeInit(args.slice(1));
637
+ break;
638
+
639
+ case 'status':
640
+ await executeStatus();
641
+ break;
642
+
643
+ case 'start':
644
+ await handleDenoCommand('start', args.slice(1));
645
+ break;
646
+
647
+ case 'agent':
648
+ case 'task':
649
+ case 'memory':
650
+ case 'config':
651
+ case 'monitor':
652
+ case 'mcp':
653
+ case 'claude':
654
+ case 'session':
655
+ case 'workflow':
656
+ await handleDenoCommand(command, args.slice(1));
657
+ break;
658
+
659
+ default:
660
+ error(`Unknown command: ${command}`);
661
+ console.log('Run \'claude-flow help\' for usage information.');
662
+ process.exit(1);
663
+ }
664
+ }
665
+
666
+ // Run the CLI
667
+ main().catch(err => {
668
+ error(`Fatal error: ${err.message}`);
669
+ process.exit(1);
670
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Advanced AI agent orchestration system for Claude Code",
5
5
  "main": "src/cli/main.ts",
6
6
  "bin": {
@@ -35,7 +35,7 @@
35
35
  "node": ">=16.0.0"
36
36
  },
37
37
  "files": [
38
- "bin/claude-flow",
38
+ "bin/",
39
39
  "src/",
40
40
  "scripts/install.js",
41
41
  "README.md",