claude-flow 1.0.13 → 1.0.15
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/package.json +3 -4
- package/scripts/install.js +0 -57
- package/src/cli/cli-core.ts +1 -1
- package/src/cli/commands/index.ts +0 -126
- package/src/cli/main.ts +1 -1
- package/bin/claude-flow +0 -15
- package/scripts/init.js +0 -255
- package/src/cli/main.js +0 -163
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-flow",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "Advanced AI agent orchestration system for Claude Code",
|
|
5
5
|
"main": "src/cli/main.ts",
|
|
6
6
|
"bin": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"postinstall": "node scripts/install.js",
|
|
11
|
-
"build": "PATH=\"/home/codespace/.deno/bin:$PATH\" deno compile --allow-all --no-check --output=bin/claude-flow
|
|
11
|
+
"build": "PATH=\"/home/codespace/.deno/bin:$PATH\" deno compile --allow-all --no-check --output=bin/claude-flow src/cli/main.ts",
|
|
12
12
|
"build:simple": "PATH=\"/home/codespace/.deno/bin:$PATH\" deno compile --allow-all --no-check --output=bin/claude-flow-simple src/cli/simple-cli.ts",
|
|
13
13
|
"test": "deno task test"
|
|
14
14
|
},
|
|
@@ -38,9 +38,8 @@
|
|
|
38
38
|
"bin/claude-flow",
|
|
39
39
|
"src/",
|
|
40
40
|
"scripts/install.js",
|
|
41
|
-
"scripts/init.js",
|
|
42
41
|
"README.md",
|
|
43
42
|
"LICENSE",
|
|
44
43
|
"deno.json"
|
|
45
44
|
]
|
|
46
|
-
}
|
|
45
|
+
}
|
package/scripts/install.js
CHANGED
|
@@ -50,55 +50,6 @@ async function installDeno() {
|
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
// Build the binary
|
|
54
|
-
async function buildBinary() {
|
|
55
|
-
console.log('Building Claude-Flow binary...');
|
|
56
|
-
|
|
57
|
-
// Create bin directory if it doesn't exist
|
|
58
|
-
const binDir = path.join(__dirname, '..', 'bin');
|
|
59
|
-
if (!fs.existsSync(binDir)) {
|
|
60
|
-
fs.mkdirSync(binDir, { recursive: true });
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Try to find deno in common locations
|
|
64
|
-
let denoPath = 'deno';
|
|
65
|
-
const possiblePaths = [
|
|
66
|
-
path.join(os.homedir(), '.deno', 'bin', 'deno'),
|
|
67
|
-
'/usr/local/bin/deno',
|
|
68
|
-
'/usr/bin/deno'
|
|
69
|
-
];
|
|
70
|
-
|
|
71
|
-
for (const p of possiblePaths) {
|
|
72
|
-
if (fs.existsSync(p)) {
|
|
73
|
-
denoPath = p;
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return new Promise((resolve, reject) => {
|
|
79
|
-
const build = spawn(denoPath, [
|
|
80
|
-
'compile',
|
|
81
|
-
'--allow-all',
|
|
82
|
-
'--no-check',
|
|
83
|
-
'--output=' + path.join(binDir, 'claude-flow-binary'),
|
|
84
|
-
path.join(__dirname, '..', 'src', 'cli', 'main.ts')
|
|
85
|
-
], { stdio: 'inherit' });
|
|
86
|
-
|
|
87
|
-
build.on('close', (code) => {
|
|
88
|
-
if (code === 0) {
|
|
89
|
-
console.log('Binary built successfully!');
|
|
90
|
-
resolve();
|
|
91
|
-
} else {
|
|
92
|
-
reject(new Error('Failed to build binary'));
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
build.on('error', (err) => {
|
|
97
|
-
reject(err);
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
|
|
102
53
|
// Main installation process
|
|
103
54
|
async function main() {
|
|
104
55
|
try {
|
|
@@ -108,14 +59,6 @@ async function main() {
|
|
|
108
59
|
await installDeno();
|
|
109
60
|
}
|
|
110
61
|
|
|
111
|
-
// Try to build the binary
|
|
112
|
-
try {
|
|
113
|
-
await buildBinary();
|
|
114
|
-
} catch (buildError) {
|
|
115
|
-
console.warn('Failed to build binary:', buildError.message);
|
|
116
|
-
console.log('Falling back to runtime execution mode.');
|
|
117
|
-
}
|
|
118
|
-
|
|
119
62
|
console.log('Claude-Flow installation completed!');
|
|
120
63
|
console.log('You can now use: npx claude-flow or claude-flow (if installed globally)');
|
|
121
64
|
|
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.3";
|
|
12
12
|
|
|
13
13
|
interface CommandContext {
|
|
14
14
|
args: string[];
|
|
@@ -12,129 +12,6 @@ let orchestrator: Orchestrator | null = null;
|
|
|
12
12
|
let configManager: ConfigManager | null = null;
|
|
13
13
|
let persistence: JsonPersistenceManager | null = null;
|
|
14
14
|
|
|
15
|
-
async function checkAndInstallDeno(): Promise<boolean> {
|
|
16
|
-
try {
|
|
17
|
-
// Check if Deno is already available
|
|
18
|
-
const checkCommand = new Deno.Command("deno", {
|
|
19
|
-
args: ["--version"],
|
|
20
|
-
stdout: "null",
|
|
21
|
-
stderr: "null",
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
try {
|
|
25
|
-
const result = await checkCommand.output();
|
|
26
|
-
if (result.success) {
|
|
27
|
-
info("✓ Deno is already installed");
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
} catch {
|
|
31
|
-
// Deno not found, continue to installation
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
warning("Deno not found. Installing Deno automatically...");
|
|
35
|
-
|
|
36
|
-
// Determine OS and install Deno
|
|
37
|
-
const os = Deno.build.os;
|
|
38
|
-
const homeDir = Deno.env.get("HOME") || Deno.env.get("USERPROFILE") || "";
|
|
39
|
-
const denoDir = `${homeDir}/.deno`;
|
|
40
|
-
|
|
41
|
-
if (os === "windows") {
|
|
42
|
-
error("Please install Deno manually on Windows from https://deno.land/");
|
|
43
|
-
console.log("Run: irm https://deno.land/install.ps1 | iex");
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Download and install Deno for Unix-like systems
|
|
48
|
-
info("Downloading Deno installer...");
|
|
49
|
-
|
|
50
|
-
const installScript = await fetch("https://deno.land/x/install/install.sh");
|
|
51
|
-
if (!installScript.ok) {
|
|
52
|
-
throw new Error("Failed to download Deno installer");
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const scriptContent = await installScript.text();
|
|
56
|
-
const tempFile = await Deno.makeTempFile({ suffix: ".sh" });
|
|
57
|
-
await Deno.writeTextFile(tempFile, scriptContent);
|
|
58
|
-
|
|
59
|
-
// Make script executable
|
|
60
|
-
await Deno.chmod(tempFile, 0o755);
|
|
61
|
-
|
|
62
|
-
// Run the installer
|
|
63
|
-
const installCommand = new Deno.Command("sh", {
|
|
64
|
-
args: [tempFile],
|
|
65
|
-
env: {
|
|
66
|
-
...Deno.env.toObject(),
|
|
67
|
-
DENO_INSTALL: denoDir,
|
|
68
|
-
},
|
|
69
|
-
stdout: "inherit",
|
|
70
|
-
stderr: "inherit",
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
const installResult = await installCommand.output();
|
|
74
|
-
|
|
75
|
-
// Clean up temp file
|
|
76
|
-
await Deno.remove(tempFile);
|
|
77
|
-
|
|
78
|
-
if (!installResult.success) {
|
|
79
|
-
throw new Error("Failed to install Deno");
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
success("✓ Deno installed successfully!");
|
|
83
|
-
|
|
84
|
-
// Export path instructions
|
|
85
|
-
const denoBinPath = `${denoDir}/bin`;
|
|
86
|
-
const shellConfig = os === "darwin" ? "~/.zshrc" : "~/.bashrc";
|
|
87
|
-
|
|
88
|
-
info("\nTo use Deno, add it to your PATH:");
|
|
89
|
-
console.log(` export DENO_INSTALL="${denoDir}"`);
|
|
90
|
-
console.log(` export PATH="$DENO_INSTALL/bin:$PATH"`);
|
|
91
|
-
console.log(`\nAdd these lines to your ${shellConfig} file to make it permanent.`);
|
|
92
|
-
|
|
93
|
-
// Try to add to current session PATH
|
|
94
|
-
const currentPath = Deno.env.get("PATH") || "";
|
|
95
|
-
if (!currentPath.includes(denoBinPath)) {
|
|
96
|
-
Deno.env.set("PATH", `${denoBinPath}:${currentPath}`);
|
|
97
|
-
info(`\n✓ Temporarily added Deno to PATH for this session`);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// Create a shell script to help users
|
|
101
|
-
const setupScript = `#!/bin/bash
|
|
102
|
-
# Claude-Flow Deno Setup Script
|
|
103
|
-
# This script sets up Deno in your environment
|
|
104
|
-
|
|
105
|
-
export DENO_INSTALL="${denoDir}"
|
|
106
|
-
export PATH="$DENO_INSTALL/bin:$PATH"
|
|
107
|
-
|
|
108
|
-
# Check if Deno is accessible
|
|
109
|
-
if command -v deno &> /dev/null; then
|
|
110
|
-
echo "✓ Deno is now available in your PATH"
|
|
111
|
-
deno --version
|
|
112
|
-
else
|
|
113
|
-
echo "❌ Failed to add Deno to PATH"
|
|
114
|
-
echo "Please manually add the following to your ${shellConfig}:"
|
|
115
|
-
echo ' export DENO_INSTALL="${denoDir}"'
|
|
116
|
-
echo ' export PATH="$DENO_INSTALL/bin:$PATH"'
|
|
117
|
-
fi
|
|
118
|
-
`;
|
|
119
|
-
|
|
120
|
-
await Deno.writeTextFile("setup-deno.sh", setupScript);
|
|
121
|
-
await Deno.chmod("setup-deno.sh", 0o755);
|
|
122
|
-
|
|
123
|
-
info("\n✓ Created setup-deno.sh script");
|
|
124
|
-
console.log(" Run: source ./setup-deno.sh");
|
|
125
|
-
console.log(" to set up Deno in your current shell\n");
|
|
126
|
-
|
|
127
|
-
return true;
|
|
128
|
-
|
|
129
|
-
} catch (err) {
|
|
130
|
-
error(`Failed to install Deno: ${(err as Error).message}`);
|
|
131
|
-
console.log("\nPlease install Deno manually:");
|
|
132
|
-
console.log(" curl -fsSL https://deno.land/x/install/install.sh | sh");
|
|
133
|
-
console.log(" or visit: https://deno.land/");
|
|
134
|
-
return false;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
15
|
async function getPersistence(): Promise<JsonPersistenceManager> {
|
|
139
16
|
if (!persistence) {
|
|
140
17
|
persistence = new JsonPersistenceManager();
|
|
@@ -184,9 +61,6 @@ export function setupCommands(cli: CLI): void {
|
|
|
184
61
|
try {
|
|
185
62
|
success("Initializing Claude Code integration files...");
|
|
186
63
|
|
|
187
|
-
// Check and install Deno first
|
|
188
|
-
const denoInstalled = await checkAndInstallDeno();
|
|
189
|
-
|
|
190
64
|
const force = ctx.flags.force as boolean || ctx.flags.f as boolean;
|
|
191
65
|
const minimal = ctx.flags.minimal as boolean || ctx.flags.m as boolean;
|
|
192
66
|
|
package/src/cli/main.ts
CHANGED
package/bin/claude-flow
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const { spawn } = require('child_process');
|
|
5
|
-
|
|
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
|
-
});
|
|
12
|
-
|
|
13
|
-
child.on('exit', (code) => {
|
|
14
|
-
process.exit(code || 0);
|
|
15
|
-
});
|
package/scripts/init.js
DELETED
|
@@ -1,255 +0,0 @@
|
|
|
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/main.js
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
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 };
|