claude-flow 1.0.7 → 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.
- package/bin/claude-flow-node.js +88 -7
- package/package.json +1 -1
package/bin/claude-flow-node.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
const fs = require('fs').promises;
|
|
8
8
|
const path = require('path');
|
|
9
9
|
const { spawn } = require('child_process');
|
|
10
|
+
const os = require('os');
|
|
10
11
|
|
|
11
12
|
const VERSION = '1.0.0';
|
|
12
13
|
|
|
@@ -37,6 +38,88 @@ function info(msg) {
|
|
|
37
38
|
console.log(`${colors.blue}ℹ️ ${msg}${colors.reset}`);
|
|
38
39
|
}
|
|
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
|
+
|
|
40
123
|
function printHelp() {
|
|
41
124
|
console.log(`
|
|
42
125
|
${colors.blue}🧠 Claude-Flow v${VERSION}${colors.reset} - Advanced AI Agent Orchestration System
|
|
@@ -68,11 +151,13 @@ GLOBAL OPTIONS:
|
|
|
68
151
|
|
|
69
152
|
EXAMPLES:
|
|
70
153
|
claude-flow init # Initialize project
|
|
71
|
-
claude-flow start # Start orchestrator
|
|
154
|
+
claude-flow start # Start orchestrator (auto-installs Deno)
|
|
72
155
|
claude-flow agent spawn researcher --name "Bot" # Spawn research agent
|
|
73
156
|
claude-flow task create research "Analyze data" # Create task
|
|
74
157
|
claude-flow status # Show system status
|
|
75
158
|
|
|
159
|
+
NOTE: Commands requiring Deno will offer automatic installation
|
|
160
|
+
|
|
76
161
|
Documentation: https://github.com/ruvnet/claude-code-flow
|
|
77
162
|
`);
|
|
78
163
|
}
|
|
@@ -556,9 +641,7 @@ async function main() {
|
|
|
556
641
|
break;
|
|
557
642
|
|
|
558
643
|
case 'start':
|
|
559
|
-
|
|
560
|
-
console.log('Please install Deno from https://deno.land/ and run:');
|
|
561
|
-
console.log(' deno run --allow-all src/cli/index.ts start');
|
|
644
|
+
await handleDenoCommand('start', args.slice(1));
|
|
562
645
|
break;
|
|
563
646
|
|
|
564
647
|
case 'agent':
|
|
@@ -570,9 +653,7 @@ async function main() {
|
|
|
570
653
|
case 'claude':
|
|
571
654
|
case 'session':
|
|
572
655
|
case 'workflow':
|
|
573
|
-
|
|
574
|
-
console.log('Please install Deno from https://deno.land/ and run:');
|
|
575
|
-
console.log(` deno run --allow-all src/cli/index.ts ${command} ${args.slice(1).join(' ')}`);
|
|
656
|
+
await handleDenoCommand(command, args.slice(1));
|
|
576
657
|
break;
|
|
577
658
|
|
|
578
659
|
default:
|