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.
@@ -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
- # Run the swarm demo with all arguments
19
- exec "$DENO_PATH" run --allow-all "$SWARM_DEMO" "$@"
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "description": "Advanced AI agent orchestration system for Claude Code",
5
5
  "main": "src/cli/main.ts",
6
6
  "bin": {
@@ -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.47',
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
@@ -6,7 +6,7 @@
6
6
  import { CLI } from "./cli-core.ts";
7
7
  import { setupCommands } from "./commands/index.ts";
8
8
 
9
- const VERSION = "1.0.47";
9
+ const VERSION = "1.0.48";
10
10
 
11
11
  async function main() {
12
12
  const cli = new CLI("claude-flow", "Advanced AI Agent Orchestration System");
@@ -13,7 +13,7 @@ import {
13
13
  } from './command-registry.js';
14
14
  import { parseFlags } from './utils.js';
15
15
 
16
- const VERSION = '1.0.47';
16
+ const VERSION = '1.0.48';
17
17
 
18
18
  function printHelp() {
19
19
  console.log(`
@@ -4,7 +4,7 @@
4
4
  * This version avoids import assertion issues while maintaining functionality
5
5
  */
6
6
 
7
- const VERSION = '1.0.47';
7
+ const VERSION = '1.0.48';
8
8
 
9
9
  function printHelp() {
10
10
  console.log(`
@@ -17,7 +17,7 @@ export async function statusCommand(subArgs, flags) {
17
17
  async function getSystemStatus(verbose = false) {
18
18
  const status = {
19
19
  timestamp: Date.now(),
20
- version: '1.0.47',
20
+ version: '1.0.48',
21
21
  orchestrator: {
22
22
  running: false,
23
23
  uptime: 0,
@@ -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
- const args = Deno.args.slice(1); // Skip the command name
227
+ // When called directly as a script, parse all arguments
228
+ const args = [];
228
229
  const flags = {};
229
230
 
230
- // Parse basic flags
231
- for (let i = 0; i < args.length; i++) {
232
- if (args[i].startsWith('--')) {
233
- const flagName = args[i].substring(2);
234
- const nextArg = args[i + 1];
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
- // Filter out flags from args to get the objective
246
- const objective = args.filter(arg => !arg.startsWith('--') &&
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
+ }