claude-flow 1.0.11 → 1.0.13
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 +10 -72
- package/package.json +3 -2
- package/scripts/init.js +255 -0
- package/src/cli/cli-core.ts +1 -1
- package/src/cli/main.js +163 -0
- package/src/cli/main.ts +1 -1
package/bin/claude-flow
CHANGED
|
@@ -1,77 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const { spawn } = require('child_process');
|
|
4
3
|
const path = require('path');
|
|
5
|
-
const
|
|
4
|
+
const { spawn } = require('child_process');
|
|
6
5
|
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
env: process.env
|
|
14
|
-
});
|
|
15
|
-
child.on('exit', (code) => process.exit(code || 0));
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
6
|
+
// Run the main.js file as a separate process to ensure it's the main module
|
|
7
|
+
const mainPath = path.join(__dirname, '..', 'src', 'cli', 'main.js');
|
|
8
|
+
const child = spawn(process.execPath, [mainPath, ...process.argv.slice(2)], {
|
|
9
|
+
stdio: 'inherit',
|
|
10
|
+
env: process.env
|
|
11
|
+
});
|
|
18
12
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// Use compiled binary
|
|
23
|
-
const child = spawn(binaryPath, process.argv.slice(2), { stdio: 'inherit' });
|
|
24
|
-
child.on('exit', (code) => process.exit(code));
|
|
25
|
-
} else {
|
|
26
|
-
// Fallback to Deno execution
|
|
27
|
-
const mainPath = path.join(__dirname, '..', 'src', 'cli', 'main.ts');
|
|
28
|
-
|
|
29
|
-
// Try to find deno in common locations
|
|
30
|
-
let denoPath = 'deno';
|
|
31
|
-
const os = require('os');
|
|
32
|
-
const possiblePaths = [
|
|
33
|
-
path.join(os.homedir(), '.deno', 'bin', 'deno'),
|
|
34
|
-
'/usr/local/bin/deno',
|
|
35
|
-
'/usr/bin/deno',
|
|
36
|
-
'deno' // Try PATH as last resort
|
|
37
|
-
];
|
|
38
|
-
|
|
39
|
-
let denoFound = false;
|
|
40
|
-
for (const p of possiblePaths) {
|
|
41
|
-
try {
|
|
42
|
-
if (p === 'deno' || fs.existsSync(p)) {
|
|
43
|
-
denoPath = p;
|
|
44
|
-
// Test if it works
|
|
45
|
-
const testChild = spawn(p, ['--version'], { stdio: 'pipe' });
|
|
46
|
-
testChild.on('close', (code) => {
|
|
47
|
-
if (code === 0) denoFound = true;
|
|
48
|
-
});
|
|
49
|
-
if (p !== 'deno') {
|
|
50
|
-
denoFound = true;
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
} catch (e) {
|
|
55
|
-
// Continue to next path
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const child = spawn(denoPath, ['run', '--allow-all', mainPath, ...process.argv.slice(2)], {
|
|
60
|
-
stdio: 'inherit',
|
|
61
|
-
env: { ...process.env }
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
child.on('error', (err) => {
|
|
65
|
-
if (err.code === 'ENOENT') {
|
|
66
|
-
console.error('Error: Deno is not installed. Please install Deno first:');
|
|
67
|
-
console.error('Visit https://deno.land/ for installation instructions.');
|
|
68
|
-
console.error('Or run: curl -fsSL https://deno.land/x/install/install.sh | sh');
|
|
69
|
-
process.exit(1);
|
|
70
|
-
} else {
|
|
71
|
-
console.error('Error executing claude-flow:', err.message);
|
|
72
|
-
process.exit(1);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
child.on('exit', (code) => process.exit(code || 0));
|
|
77
|
-
}
|
|
13
|
+
child.on('exit', (code) => {
|
|
14
|
+
process.exit(code || 0);
|
|
15
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-flow",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "Advanced AI agent orchestration system for Claude Code",
|
|
5
5
|
"main": "src/cli/main.ts",
|
|
6
6
|
"bin": {
|
|
@@ -38,8 +38,9 @@
|
|
|
38
38
|
"bin/claude-flow",
|
|
39
39
|
"src/",
|
|
40
40
|
"scripts/install.js",
|
|
41
|
+
"scripts/init.js",
|
|
41
42
|
"README.md",
|
|
42
43
|
"LICENSE",
|
|
43
44
|
"deno.json"
|
|
44
45
|
]
|
|
45
|
-
}
|
|
46
|
+
}
|
package/scripts/init.js
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const os = require('os');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const https = require('https');
|
|
7
|
+
const { spawn, execSync } = require('child_process');
|
|
8
|
+
|
|
9
|
+
// Colors for console output
|
|
10
|
+
const colors = {
|
|
11
|
+
reset: '\x1b[0m',
|
|
12
|
+
red: '\x1b[31m',
|
|
13
|
+
green: '\x1b[32m',
|
|
14
|
+
yellow: '\x1b[33m',
|
|
15
|
+
blue: '\x1b[34m',
|
|
16
|
+
cyan: '\x1b[36m'
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const success = (msg) => console.log(`${colors.green}✅ ${msg}${colors.reset}`);
|
|
20
|
+
const error = (msg) => console.log(`${colors.red}❌ ${msg}${colors.reset}`);
|
|
21
|
+
const warning = (msg) => console.log(`${colors.yellow}⚠️ ${msg}${colors.reset}`);
|
|
22
|
+
const info = (msg) => console.log(`${colors.cyan}ℹ️ ${msg}${colors.reset}`);
|
|
23
|
+
|
|
24
|
+
// Check if Deno is installed
|
|
25
|
+
function checkDeno() {
|
|
26
|
+
try {
|
|
27
|
+
execSync('deno --version', { stdio: 'ignore' });
|
|
28
|
+
return true;
|
|
29
|
+
} catch {
|
|
30
|
+
// Try common locations
|
|
31
|
+
const homeDir = os.homedir();
|
|
32
|
+
const possiblePaths = [
|
|
33
|
+
path.join(homeDir, '.deno', 'bin', 'deno'),
|
|
34
|
+
'/usr/local/bin/deno',
|
|
35
|
+
'/usr/bin/deno'
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
for (const denoPath of possiblePaths) {
|
|
39
|
+
if (fs.existsSync(denoPath)) {
|
|
40
|
+
try {
|
|
41
|
+
execSync(`${denoPath} --version`, { stdio: 'ignore' });
|
|
42
|
+
return true;
|
|
43
|
+
} catch {
|
|
44
|
+
// Continue checking
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Install Deno automatically
|
|
54
|
+
async function installDeno() {
|
|
55
|
+
return new Promise((resolve, reject) => {
|
|
56
|
+
warning('Deno not found. Installing Deno automatically...');
|
|
57
|
+
|
|
58
|
+
const platform = os.platform();
|
|
59
|
+
const homeDir = os.homedir();
|
|
60
|
+
const denoDir = path.join(homeDir, '.deno');
|
|
61
|
+
|
|
62
|
+
if (platform === 'win32') {
|
|
63
|
+
error('Please install Deno manually on Windows from https://deno.land/');
|
|
64
|
+
console.log('Run in PowerShell: irm https://deno.land/install.ps1 | iex');
|
|
65
|
+
reject(new Error('Manual installation required on Windows'));
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
info('Downloading Deno installer...');
|
|
70
|
+
|
|
71
|
+
// Download the install script
|
|
72
|
+
https.get('https://deno.land/x/install/install.sh', (res) => {
|
|
73
|
+
let scriptData = '';
|
|
74
|
+
|
|
75
|
+
res.on('data', (chunk) => {
|
|
76
|
+
scriptData += chunk;
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
res.on('end', () => {
|
|
80
|
+
// Save the script
|
|
81
|
+
const tempScript = path.join(os.tmpdir(), 'deno-install.sh');
|
|
82
|
+
fs.writeFileSync(tempScript, scriptData);
|
|
83
|
+
fs.chmodSync(tempScript, '755');
|
|
84
|
+
|
|
85
|
+
// Run the installer
|
|
86
|
+
const install = spawn('sh', [tempScript], {
|
|
87
|
+
env: {
|
|
88
|
+
...process.env,
|
|
89
|
+
DENO_INSTALL: denoDir
|
|
90
|
+
},
|
|
91
|
+
stdio: 'inherit'
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
install.on('close', (code) => {
|
|
95
|
+
// Clean up
|
|
96
|
+
try {
|
|
97
|
+
fs.unlinkSync(tempScript);
|
|
98
|
+
} catch {}
|
|
99
|
+
|
|
100
|
+
if (code === 0) {
|
|
101
|
+
success('Deno installed successfully!');
|
|
102
|
+
|
|
103
|
+
// Export path instructions
|
|
104
|
+
const denoBinPath = path.join(denoDir, 'bin');
|
|
105
|
+
const shellConfig = platform === 'darwin' ? '~/.zshrc' : '~/.bashrc';
|
|
106
|
+
|
|
107
|
+
info('\nTo use Deno permanently, add it to your PATH:');
|
|
108
|
+
console.log(` export DENO_INSTALL="${denoDir}"`);
|
|
109
|
+
console.log(` export PATH="$DENO_INSTALL/bin:$PATH"`);
|
|
110
|
+
console.log(`\nAdd these lines to your ${shellConfig} file.`);
|
|
111
|
+
|
|
112
|
+
// Create setup script
|
|
113
|
+
const setupScript = `#!/bin/bash
|
|
114
|
+
# Claude-Flow Deno Setup Script
|
|
115
|
+
# This script sets up Deno in your environment
|
|
116
|
+
|
|
117
|
+
export DENO_INSTALL="${denoDir}"
|
|
118
|
+
export PATH="$DENO_INSTALL/bin:$PATH"
|
|
119
|
+
|
|
120
|
+
# Check if Deno is accessible
|
|
121
|
+
if command -v deno &> /dev/null; then
|
|
122
|
+
echo "✓ Deno is now available in your PATH"
|
|
123
|
+
deno --version
|
|
124
|
+
else
|
|
125
|
+
echo "❌ Failed to add Deno to PATH"
|
|
126
|
+
echo "Please manually add the following to your ${shellConfig}:"
|
|
127
|
+
echo ' export DENO_INSTALL="${denoDir}"'
|
|
128
|
+
echo ' export PATH="$DENO_INSTALL/bin:$PATH"'
|
|
129
|
+
fi
|
|
130
|
+
|
|
131
|
+
# Run claude-flow init with Deno
|
|
132
|
+
echo ""
|
|
133
|
+
echo "Running claude-flow init..."
|
|
134
|
+
${path.join(denoDir, 'bin', 'deno')} run --allow-all ${path.join(__dirname, '..', 'src', 'cli', 'main.ts')} init "$@"
|
|
135
|
+
`;
|
|
136
|
+
|
|
137
|
+
fs.writeFileSync('setup-deno.sh', setupScript);
|
|
138
|
+
fs.chmodSync('setup-deno.sh', '755');
|
|
139
|
+
|
|
140
|
+
info('\n✓ Created setup-deno.sh script');
|
|
141
|
+
console.log(' Run: source ./setup-deno.sh');
|
|
142
|
+
console.log(' to set up Deno and continue with initialization\n');
|
|
143
|
+
|
|
144
|
+
// Update PATH for current process
|
|
145
|
+
process.env.PATH = `${denoBinPath}:${process.env.PATH}`;
|
|
146
|
+
process.env.DENO_INSTALL = denoDir;
|
|
147
|
+
|
|
148
|
+
resolve(true);
|
|
149
|
+
} else {
|
|
150
|
+
reject(new Error('Failed to install Deno'));
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
install.on('error', (err) => {
|
|
155
|
+
reject(err);
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
}).on('error', (err) => {
|
|
159
|
+
reject(err);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Main init function
|
|
165
|
+
async function init(args) {
|
|
166
|
+
try {
|
|
167
|
+
console.log(`${colors.blue}🧠 Claude-Flow Init - Setting up your project${colors.reset}\n`);
|
|
168
|
+
|
|
169
|
+
// Check if Deno is installed
|
|
170
|
+
const denoInstalled = checkDeno();
|
|
171
|
+
|
|
172
|
+
if (!denoInstalled) {
|
|
173
|
+
try {
|
|
174
|
+
await installDeno();
|
|
175
|
+
} catch (err) {
|
|
176
|
+
error(`Failed to install Deno: ${err.message}`);
|
|
177
|
+
console.log('\nPlease install Deno manually:');
|
|
178
|
+
console.log(' curl -fsSL https://deno.land/x/install/install.sh | sh');
|
|
179
|
+
console.log(' or visit: https://deno.land/');
|
|
180
|
+
process.exit(1);
|
|
181
|
+
}
|
|
182
|
+
} else {
|
|
183
|
+
info('✓ Deno is already installed');
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Now run the actual init command with Deno
|
|
187
|
+
let denoPath = 'deno';
|
|
188
|
+
|
|
189
|
+
// If Deno wasn't originally installed, use the newly installed path
|
|
190
|
+
if (!denoInstalled) {
|
|
191
|
+
denoPath = path.join(os.homedir(), '.deno', 'bin', 'deno');
|
|
192
|
+
} else {
|
|
193
|
+
// Try to find Deno in common locations
|
|
194
|
+
const possiblePaths = [
|
|
195
|
+
path.join(os.homedir(), '.deno', 'bin', 'deno'),
|
|
196
|
+
'/usr/local/bin/deno',
|
|
197
|
+
'/usr/bin/deno',
|
|
198
|
+
'deno' // Try PATH as last resort
|
|
199
|
+
];
|
|
200
|
+
|
|
201
|
+
for (const p of possiblePaths) {
|
|
202
|
+
try {
|
|
203
|
+
if (p === 'deno') {
|
|
204
|
+
execSync('deno --version', { stdio: 'ignore' });
|
|
205
|
+
denoPath = p;
|
|
206
|
+
break;
|
|
207
|
+
} else if (fs.existsSync(p)) {
|
|
208
|
+
execSync(`${p} --version`, { stdio: 'ignore' });
|
|
209
|
+
denoPath = p;
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
} catch {
|
|
213
|
+
// Continue checking
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const mainPath = path.join(__dirname, '..', 'src', 'cli', 'main.ts');
|
|
219
|
+
|
|
220
|
+
// Pass through all arguments
|
|
221
|
+
const initArgs = ['run', '--allow-all', mainPath, 'init', ...args];
|
|
222
|
+
|
|
223
|
+
const init = spawn(denoPath, initArgs, {
|
|
224
|
+
stdio: 'inherit',
|
|
225
|
+
env: process.env
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
init.on('close', (code) => {
|
|
229
|
+
if (code !== 0) {
|
|
230
|
+
error('Init command failed');
|
|
231
|
+
process.exit(code);
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
init.on('error', (err) => {
|
|
236
|
+
if (err.code === 'ENOENT') {
|
|
237
|
+
error('Deno not found. Please run: source ./setup-deno.sh');
|
|
238
|
+
error('Then try again: npx claude-flow init');
|
|
239
|
+
} else {
|
|
240
|
+
error(`Failed to run init: ${err.message}`);
|
|
241
|
+
}
|
|
242
|
+
process.exit(1);
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
} catch (err) {
|
|
246
|
+
error(`Init failed: ${err.message}`);
|
|
247
|
+
process.exit(1);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Run if called directly
|
|
252
|
+
if (require.main === module) {
|
|
253
|
+
const args = process.argv.slice(2);
|
|
254
|
+
init(args);
|
|
255
|
+
}
|
package/src/cli/cli-core.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { red, green, yellow, blue, bold, cyan } from "https://deno.land/std@0.22
|
|
|
8
8
|
import { ensureDir } from "https://deno.land/std@0.224.0/fs/mod.ts";
|
|
9
9
|
import { join } from "https://deno.land/std@0.224.0/path/mod.ts";
|
|
10
10
|
|
|
11
|
-
export const VERSION = "1.0.
|
|
11
|
+
export const VERSION = "1.0.13";
|
|
12
12
|
|
|
13
13
|
interface CommandContext {
|
|
14
14
|
args: string[];
|
package/src/cli/main.js
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Claude-Flow CLI - JavaScript entry point for npm distribution
|
|
4
|
+
* This file is used when running from npm/npx to avoid TypeScript compilation issues
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { spawn } = require('child_process');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const os = require('os');
|
|
11
|
+
|
|
12
|
+
// Version should match package.json
|
|
13
|
+
const VERSION = '1.0.13';
|
|
14
|
+
|
|
15
|
+
// Colors for console output
|
|
16
|
+
const colors = {
|
|
17
|
+
reset: '\x1b[0m',
|
|
18
|
+
red: '\x1b[31m',
|
|
19
|
+
green: '\x1b[32m',
|
|
20
|
+
yellow: '\x1b[33m',
|
|
21
|
+
blue: '\x1b[34m',
|
|
22
|
+
cyan: '\x1b[36m',
|
|
23
|
+
bold: '\x1b[1m'
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
function printHelp() {
|
|
27
|
+
console.log(`
|
|
28
|
+
${colors.blue}${colors.bold}🧠 claude-flow v${VERSION} - Advanced AI Agent Orchestration System${colors.reset}
|
|
29
|
+
|
|
30
|
+
USAGE:
|
|
31
|
+
claude-flow [COMMAND] [OPTIONS]
|
|
32
|
+
|
|
33
|
+
COMMANDS:
|
|
34
|
+
init Initialize Claude Code integration files
|
|
35
|
+
start Start the orchestration system
|
|
36
|
+
task Manage tasks
|
|
37
|
+
agent Manage agents
|
|
38
|
+
status Show system status
|
|
39
|
+
mcp Manage MCP server and tools
|
|
40
|
+
claude Spawn Claude instances with specific configurations
|
|
41
|
+
monitor Live monitoring dashboard
|
|
42
|
+
help Show help information
|
|
43
|
+
|
|
44
|
+
GLOBAL OPTIONS:
|
|
45
|
+
-h, --help Show help
|
|
46
|
+
-v, --version Show version
|
|
47
|
+
-c, --config Path to configuration file
|
|
48
|
+
--verbose Enable verbose logging
|
|
49
|
+
--log-level Set log level (debug, info, warn, error)
|
|
50
|
+
|
|
51
|
+
EXAMPLES:
|
|
52
|
+
claude-flow init # Initialize project
|
|
53
|
+
claude-flow start # Start orchestrator
|
|
54
|
+
claude-flow agent spawn researcher --name "Bot" # Spawn research agent
|
|
55
|
+
claude-flow task create research "Analyze data" # Create task
|
|
56
|
+
claude-flow status # Show system status
|
|
57
|
+
|
|
58
|
+
For more detailed help on specific commands, use:
|
|
59
|
+
claude-flow [COMMAND] --help
|
|
60
|
+
|
|
61
|
+
Documentation: https://github.com/ruvnet/claude-code-flow
|
|
62
|
+
Issues: https://github.com/ruvnet/claude-code-flow/issues
|
|
63
|
+
|
|
64
|
+
Created by rUv - Built with ❤️ for the Claude community
|
|
65
|
+
`);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function checkDeno() {
|
|
69
|
+
const possiblePaths = [
|
|
70
|
+
path.join(os.homedir(), '.deno', 'bin', 'deno'),
|
|
71
|
+
'/usr/local/bin/deno',
|
|
72
|
+
'/usr/bin/deno'
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
// Check PATH first
|
|
76
|
+
try {
|
|
77
|
+
const result = require('child_process').execSync('deno --version', { stdio: 'pipe' });
|
|
78
|
+
return 'deno';
|
|
79
|
+
} catch {}
|
|
80
|
+
|
|
81
|
+
// Check common locations
|
|
82
|
+
for (const denoPath of possiblePaths) {
|
|
83
|
+
if (fs.existsSync(denoPath)) {
|
|
84
|
+
try {
|
|
85
|
+
require('child_process').execSync(`${denoPath} --version`, { stdio: 'pipe' });
|
|
86
|
+
return denoPath;
|
|
87
|
+
} catch {}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function main() {
|
|
95
|
+
const args = process.argv.slice(2);
|
|
96
|
+
|
|
97
|
+
// Handle version flag
|
|
98
|
+
if (args.includes('--version') || args.includes('-v')) {
|
|
99
|
+
console.log(`claude-flow v${VERSION}`);
|
|
100
|
+
process.exit(0);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Handle help flag or no args
|
|
104
|
+
if (args.length === 0 || args.includes('--help') || args.includes('-h') || args[0] === 'help') {
|
|
105
|
+
printHelp();
|
|
106
|
+
process.exit(0);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Special handling for init command
|
|
110
|
+
if (args[0] === 'init') {
|
|
111
|
+
const initScript = path.join(__dirname, '..', '..', 'scripts', 'init.js');
|
|
112
|
+
const child = spawn('node', [initScript, ...args.slice(1)], {
|
|
113
|
+
stdio: 'inherit',
|
|
114
|
+
env: process.env
|
|
115
|
+
});
|
|
116
|
+
child.on('exit', (code) => process.exit(code || 0));
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// For other commands, check if Deno is available
|
|
121
|
+
const denoPath = checkDeno();
|
|
122
|
+
|
|
123
|
+
if (!denoPath) {
|
|
124
|
+
console.error(`${colors.red}❌ Error: Deno is not installed.${colors.reset}`);
|
|
125
|
+
console.error(`${colors.yellow}Please run 'claude-flow init' first to set up your environment.${colors.reset}`);
|
|
126
|
+
console.error('\nAlternatively, install Deno manually:');
|
|
127
|
+
console.error(' curl -fsSL https://deno.land/x/install/install.sh | sh');
|
|
128
|
+
console.error(' or visit: https://deno.land/');
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Try to use the simple CLI with Deno
|
|
133
|
+
const simplePath = path.join(__dirname, 'simple-cli.js');
|
|
134
|
+
|
|
135
|
+
if (fs.existsSync(simplePath)) {
|
|
136
|
+
const child = spawn(denoPath, ['run', '--allow-all', simplePath, ...args], {
|
|
137
|
+
stdio: 'inherit',
|
|
138
|
+
env: process.env
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
child.on('error', (err) => {
|
|
142
|
+
console.error(`${colors.red}❌ Error: Failed to execute command${colors.reset}`);
|
|
143
|
+
console.error(err.message);
|
|
144
|
+
process.exit(1);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
child.on('exit', (code) => process.exit(code || 0));
|
|
148
|
+
} else {
|
|
149
|
+
// If we can't find the files, show a helpful error
|
|
150
|
+
console.error(`${colors.red}❌ Error: Claude-Flow CLI files not found${colors.reset}`);
|
|
151
|
+
console.error('This might be a packaging issue. Please try:');
|
|
152
|
+
console.error(' 1. Clone from source: git clone https://github.com/ruvnet/claude-code-flow');
|
|
153
|
+
console.error(' 2. Run: cd claude-code-flow && npm install');
|
|
154
|
+
process.exit(1);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Run the CLI
|
|
159
|
+
if (require.main === module) {
|
|
160
|
+
main();
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
module.exports = { VERSION };
|
package/src/cli/main.ts
CHANGED