claude-flow 1.0.47 → 1.0.48
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-swarm +15 -3
- package/package.json +1 -1
- package/src/cli/commands/status.ts +1 -1
- package/src/cli/main.ts +1 -1
- package/src/cli/simple-cli.js +1 -1
- package/src/cli/simple-cli.ts +1 -1
- package/src/cli/simple-commands/status.js +1 -1
- package/src/cli/simple-commands/swarm.js +13 -9
- package/src/cli/swarm-standalone.js +106 -0
package/bin/claude-flow-swarm
CHANGED
|
@@ -13,7 +13,19 @@ fi
|
|
|
13
13
|
|
|
14
14
|
# Get the directory of this script
|
|
15
15
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
16
|
-
SWARM_DEMO="$SCRIPT_DIR/../swarm-demo.ts"
|
|
17
16
|
|
|
18
|
-
#
|
|
19
|
-
|
|
17
|
+
# Try to find swarm implementation in different locations
|
|
18
|
+
if [ -f "$SCRIPT_DIR/../swarm-demo.ts" ]; then
|
|
19
|
+
# Local development path
|
|
20
|
+
SWARM_IMPL="$SCRIPT_DIR/../swarm-demo.ts"
|
|
21
|
+
elif [ -f "$SCRIPT_DIR/../src/cli/swarm-standalone.js" ]; then
|
|
22
|
+
# Installed via npm - use the standalone JavaScript version
|
|
23
|
+
SWARM_IMPL="$SCRIPT_DIR/../src/cli/swarm-standalone.js"
|
|
24
|
+
else
|
|
25
|
+
echo "Error: Unable to find swarm implementation files"
|
|
26
|
+
echo "Please ensure claude-flow is properly installed"
|
|
27
|
+
exit 1
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
# Run the swarm implementation with all arguments
|
|
31
|
+
exec "$DENO_PATH" run --allow-all "$SWARM_IMPL" "$@"
|
package/package.json
CHANGED
|
@@ -239,7 +239,7 @@ async function getSystemStatus(): Promise<any> {
|
|
|
239
239
|
// Mock status for now - in production, this would call the orchestrator API
|
|
240
240
|
return {
|
|
241
241
|
overall: 'healthy',
|
|
242
|
-
version: '1.0.
|
|
242
|
+
version: '1.0.48',
|
|
243
243
|
uptime: Date.now() - (Date.now() - 3600000), // 1 hour ago
|
|
244
244
|
startTime: new Date(Date.now() - 3600000),
|
|
245
245
|
components: {
|
package/src/cli/main.ts
CHANGED
package/src/cli/simple-cli.js
CHANGED
package/src/cli/simple-cli.ts
CHANGED
|
@@ -224,14 +224,16 @@ https://github.com/ruvnet/claude-code-flow/docs/swarm.md
|
|
|
224
224
|
|
|
225
225
|
// Allow direct execution
|
|
226
226
|
if (import.meta.main) {
|
|
227
|
-
|
|
227
|
+
// When called directly as a script, parse all arguments
|
|
228
|
+
const args = [];
|
|
228
229
|
const flags = {};
|
|
229
230
|
|
|
230
|
-
// Parse
|
|
231
|
-
for (let i = 0; i < args.length; i++) {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
const
|
|
231
|
+
// Parse arguments and flags
|
|
232
|
+
for (let i = 0; i < Deno.args.length; i++) {
|
|
233
|
+
const arg = Deno.args[i];
|
|
234
|
+
if (arg.startsWith('--')) {
|
|
235
|
+
const flagName = arg.substring(2);
|
|
236
|
+
const nextArg = Deno.args[i + 1];
|
|
235
237
|
|
|
236
238
|
if (nextArg && !nextArg.startsWith('--')) {
|
|
237
239
|
flags[flagName] = nextArg;
|
|
@@ -239,12 +241,14 @@ if (import.meta.main) {
|
|
|
239
241
|
} else {
|
|
240
242
|
flags[flagName] = true;
|
|
241
243
|
}
|
|
244
|
+
} else {
|
|
245
|
+
args.push(arg);
|
|
242
246
|
}
|
|
243
247
|
}
|
|
244
248
|
|
|
245
|
-
//
|
|
246
|
-
const objective = args.
|
|
247
|
-
!Object.values(flags).includes(arg)).join(' ');
|
|
249
|
+
// The objective is all non-flag arguments joined
|
|
250
|
+
const objective = args.join(' ');
|
|
248
251
|
|
|
252
|
+
// Execute the swarm command
|
|
249
253
|
await swarmCommand([objective], flags);
|
|
250
254
|
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
#!/usr/bin/env -S deno run --allow-all
|
|
2
|
+
/**
|
|
3
|
+
* Standalone swarm executable for npm package
|
|
4
|
+
* This handles swarm execution when installed via npm
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { spawn } from 'node:child_process';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { dirname, join } from 'node:path';
|
|
10
|
+
import { existsSync } from 'node:fs';
|
|
11
|
+
|
|
12
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
13
|
+
const __dirname = dirname(__filename);
|
|
14
|
+
|
|
15
|
+
// Parse arguments
|
|
16
|
+
const args = [];
|
|
17
|
+
const flags = {};
|
|
18
|
+
|
|
19
|
+
for (let i = 0; i < Deno.args.length; i++) {
|
|
20
|
+
const arg = Deno.args[i];
|
|
21
|
+
if (arg.startsWith('--')) {
|
|
22
|
+
const flagName = arg.substring(2);
|
|
23
|
+
const nextArg = Deno.args[i + 1];
|
|
24
|
+
|
|
25
|
+
if (nextArg && !nextArg.startsWith('--')) {
|
|
26
|
+
flags[flagName] = nextArg;
|
|
27
|
+
i++; // Skip the next argument
|
|
28
|
+
} else {
|
|
29
|
+
flags[flagName] = true;
|
|
30
|
+
}
|
|
31
|
+
} else {
|
|
32
|
+
args.push(arg);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const objective = args.join(' ');
|
|
37
|
+
|
|
38
|
+
if (!objective && !flags.help) {
|
|
39
|
+
console.error("❌ Usage: swarm <objective>");
|
|
40
|
+
console.log(`
|
|
41
|
+
🐝 Claude Flow Advanced Swarm System
|
|
42
|
+
|
|
43
|
+
USAGE:
|
|
44
|
+
claude-flow swarm <objective> [options]
|
|
45
|
+
|
|
46
|
+
EXAMPLES:
|
|
47
|
+
claude-flow swarm "Build a REST API" --strategy development
|
|
48
|
+
claude-flow swarm "Research cloud architecture" --strategy research --ui
|
|
49
|
+
claude-flow swarm "Analyze data trends" --strategy analysis --parallel
|
|
50
|
+
claude-flow swarm "Optimize performance" --distributed --monitor
|
|
51
|
+
|
|
52
|
+
Run 'claude-flow swarm --help' for full options
|
|
53
|
+
`);
|
|
54
|
+
Deno.exit(1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Try to find the swarm implementation
|
|
58
|
+
const possiblePaths = [
|
|
59
|
+
join(__dirname, '../../swarm-demo.ts'),
|
|
60
|
+
join(__dirname, '../../swarm-demo-enhanced.ts'),
|
|
61
|
+
join(__dirname, '../../../swarm-demo.ts'),
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
let swarmPath = null;
|
|
65
|
+
for (const path of possiblePaths) {
|
|
66
|
+
if (existsSync(path)) {
|
|
67
|
+
swarmPath = path;
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!swarmPath) {
|
|
73
|
+
// Fallback to inline implementation
|
|
74
|
+
console.log('🐝 Launching swarm system...');
|
|
75
|
+
console.log(`📋 Objective: ${objective}`);
|
|
76
|
+
console.log(`🎯 Strategy: ${flags.strategy || 'auto'}`);
|
|
77
|
+
console.log(`🏗️ Mode: ${flags.mode || 'centralized'}`);
|
|
78
|
+
console.log(`🤖 Max Agents: ${flags['max-agents'] || 5}`);
|
|
79
|
+
|
|
80
|
+
// Import and run the swarm command
|
|
81
|
+
try {
|
|
82
|
+
const { swarmCommand } = await import('./simple-commands/swarm.js');
|
|
83
|
+
await swarmCommand([objective], flags);
|
|
84
|
+
} catch (error) {
|
|
85
|
+
console.error('❌ Failed to launch swarm:', error.message);
|
|
86
|
+
console.error('\nPlease ensure claude-flow is properly installed');
|
|
87
|
+
Deno.exit(1);
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
// Run the swarm demo directly
|
|
91
|
+
const swarmArgs = [objective];
|
|
92
|
+
for (const [key, value] of Object.entries(flags)) {
|
|
93
|
+
swarmArgs.push(`--${key}`);
|
|
94
|
+
if (value !== true) {
|
|
95
|
+
swarmArgs.push(String(value));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const deno = spawn(Deno.execPath(), ['run', '--allow-all', swarmPath, ...swarmArgs], {
|
|
100
|
+
stdio: 'inherit'
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
deno.on('exit', (code) => {
|
|
104
|
+
Deno.exit(code || 0);
|
|
105
|
+
});
|
|
106
|
+
}
|