claude-flow 2.5.0-alpha.132 → 2.5.0-alpha.135

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.
Files changed (26) hide show
  1. package/.claude/settings.json +20 -20
  2. package/bin/claude-flow +1 -1
  3. package/dist/src/cli/help-formatter.js +0 -5
  4. package/dist/src/cli/simple-cli.js +61 -166
  5. package/dist/src/cli/simple-cli.js.map +1 -1
  6. package/dist/src/cli/simple-commands/init/copy-revised-templates.js +15 -3
  7. package/dist/src/cli/simple-commands/init/copy-revised-templates.js.map +1 -1
  8. package/dist/src/cli/simple-commands/init/index.js +165 -9
  9. package/dist/src/cli/simple-commands/init/index.js.map +1 -1
  10. package/dist/src/cli/simple-commands/init/template-copier.js +10 -0
  11. package/dist/src/cli/simple-commands/init/template-copier.js.map +1 -1
  12. package/dist/src/cli/simple-commands/init/templates/enhanced-templates.js +21 -20
  13. package/dist/src/cli/simple-commands/init/templates/enhanced-templates.js.map +1 -1
  14. package/dist/src/core/version.js +1 -1
  15. package/dist/src/core/version.js.map +1 -1
  16. package/dist/src/memory/swarm-memory.js +421 -340
  17. package/dist/src/memory/swarm-memory.js.map +1 -1
  18. package/dist/src/utils/metrics-reader.js +41 -29
  19. package/dist/src/utils/metrics-reader.js.map +1 -1
  20. package/package.json +1 -1
  21. package/src/cli/simple-commands/init/copy-revised-templates.js +10 -3
  22. package/src/cli/simple-commands/init/index.js +169 -0
  23. package/src/cli/simple-commands/init/template-copier.js +13 -0
  24. package/src/cli/simple-commands/init/templates/enhanced-templates.js +20 -16
  25. package/src/cli/simple-commands/init/templates/settings.json +21 -20
  26. package/src/cli/simple-commands/init/templates/statusline-command.sh +175 -0
@@ -9,32 +9,29 @@
9
9
  },
10
10
  "permissions": {
11
11
  "allow": [
12
- "Bash(npx claude-flow *)",
12
+ "Bash(npx claude-flow:*)",
13
13
  "Bash(npm run lint)",
14
14
  "Bash(npm run test:*)",
15
- "Bash(npm test *)",
15
+ "Bash(npm test:*)",
16
16
  "Bash(git status)",
17
- "Bash(git diff *)",
18
- "Bash(git log *)",
19
- "Bash(git add *)",
20
- "Bash(git commit *)",
17
+ "Bash(git diff:*)",
18
+ "Bash(git log:*)",
19
+ "Bash(git add:*)",
20
+ "Bash(git commit:*)",
21
21
  "Bash(git push)",
22
- "Bash(git config *)",
23
- "Bash(git tag *)",
24
- "Bash(git branch *)",
25
- "Bash(git checkout *)",
26
- "Bash(git stash *)",
27
- "Bash(jq *)",
28
- "Bash(node *)",
29
- "Bash(which *)",
22
+ "Bash(git config:*)",
23
+ "Bash(git tag:*)",
24
+ "Bash(git branch:*)",
25
+ "Bash(git checkout:*)",
26
+ "Bash(git stash:*)",
27
+ "Bash(jq:*)",
28
+ "Bash(node:*)",
29
+ "Bash(which:*)",
30
30
  "Bash(pwd)",
31
- "Bash(ls *)"
31
+ "Bash(ls:*)"
32
32
  ],
33
33
  "deny": [
34
- "Bash(rm -rf /)",
35
- "Bash(curl * | bash)",
36
- "Bash(wget * | sh)",
37
- "Bash(eval *)"
34
+ "Bash(rm -rf /)"
38
35
  ]
39
36
  },
40
37
  "hooks": {
@@ -110,5 +107,8 @@
110
107
  ]
111
108
  },
112
109
  "includeCoAuthoredBy": true,
113
- "enabledMcpjsonServers": ["claude-flow", "ruv-swarm"]
110
+ "enabledMcpjsonServers": ["claude-flow", "ruv-swarm"],
111
+ "statusLine": {
112
+ "command": "/home/codespace/.claude/statusline-command.sh"
113
+ }
114
114
  }
package/bin/claude-flow CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
  # Claude-Flow Smart Dispatcher - Detects and uses the best available runtime
3
3
 
4
- VERSION="2.5.0-alpha.132"
4
+ VERSION="2.5.0-alpha.135"
5
5
 
6
6
  # Determine the correct path based on how the script is invoked
7
7
  if [ -L "$0" ]; then
@@ -85,9 +85,4 @@ export class HelpFormatter {
85
85
  }
86
86
  }
87
87
 
88
- //# sourceMappingURL=help-formatter.js.map/\s+/g, ' ');
89
- return text;
90
- }
91
- }
92
-
93
88
  //# sourceMappingURL=help-formatter.js.map
@@ -1,47 +1,13 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env -S deno run --allow-all
2
+ import { promises as fs } from 'node:fs';
2
3
  import { executeCommand, hasCommand, showCommandHelp, listCommands } from './command-registry.js';
3
4
  import { parseFlags } from './utils.js';
4
- import { args, cwd, isMainModule, exit, readTextFile, writeTextFile, mkdirAsync, errors } from './node-compat.js';
5
- import { spawn } from 'child_process';
6
- import process from 'process';
7
- import readline from 'readline';
8
- import { getMainHelp, getCommandHelp, getStandardizedCommandHelp } from './help-text.js';
9
5
  import { VERSION } from '../core/version.js';
10
- const LEGACY_AGENT_MAPPING = {
11
- analyst: 'code-analyzer',
12
- coordinator: 'task-orchestrator',
13
- optimizer: 'perf-analyzer',
14
- documenter: 'api-docs',
15
- monitor: 'performance-benchmarker',
16
- specialist: 'system-architect',
17
- architect: 'system-architect'
18
- };
19
- function resolveLegacyAgentType(legacyType) {
20
- return LEGACY_AGENT_MAPPING[legacyType] || legacyType;
21
- }
22
- function printHelp(plain = false) {
23
- console.log(getMainHelp(plain));
24
- }
25
- function printCommandHelp(command) {
26
- const standardCommands = [
27
- 'agent',
28
- 'sparc',
29
- 'memory'
30
- ];
31
- if (standardCommands.includes(command)) {
32
- const help = getStandardizedCommandHelp(command);
33
- console.log(help);
34
- } else {
35
- const help = getCommandHelp(command);
36
- console.log(help);
37
- }
38
- }
39
- function printLegacyHelp() {
6
+ function printHelp() {
40
7
  console.log(`
41
8
  🌊 Claude-Flow v${VERSION} - Enterprise-Grade AI Agent Orchestration Platform
42
9
 
43
- 🎯 ENTERPRISE FEATURES: Complete ruv-swarm integration with 90+ MCP tools, neural networking, and production-ready infrastructure
44
- ⚡ ALPHA 85: Advanced automation capabilities & stream-JSON chaining for multi-agent pipelines
10
+ 🎯 ENTERPRISE FEATURES: Complete ruv-swarm integration with 27 MCP tools, neural networking, and production-ready infrastructure
45
11
 
46
12
  USAGE:
47
13
  claude-flow <command> [options]
@@ -175,8 +141,8 @@ function printSuccess(message) {
175
141
  function printWarning(message) {
176
142
  console.warn(`⚠️ Warning: ${message}`);
177
143
  }
178
- function showHelpWithCommands(plain = false) {
179
- printHelp(plain);
144
+ function showHelpWithCommands() {
145
+ printHelp();
180
146
  console.log('\nRegistered Commands:');
181
147
  const commands = listCommands();
182
148
  for (const command of commands){
@@ -185,58 +151,14 @@ function showHelpWithCommands(plain = false) {
185
151
  console.log('\nUse "claude-flow help <command>" for detailed usage information');
186
152
  }
187
153
  async function main() {
154
+ const args = Deno.args;
188
155
  if (args.length === 0) {
189
- printHelp(usePlainHelp);
156
+ printHelp();
190
157
  return;
191
158
  }
192
159
  const command = args[0];
193
160
  const { flags, args: parsedArgs } = parseFlags(args.slice(1));
194
- const usePlainHelp = args.includes('--plain');
195
- let enhancedFlags = flags;
196
- try {
197
- const { detectExecutionEnvironment, applySmartDefaults } = await import('./utils/environment-detector.js');
198
- enhancedFlags = applySmartDefaults(flags);
199
- enhancedFlags._environment = detectExecutionEnvironment({
200
- skipWarnings: true
201
- });
202
- } catch (e) {
203
- enhancedFlags = flags;
204
- }
205
- if (command !== 'help' && command !== '--help' && command !== '-h' && (enhancedFlags.help || enhancedFlags.h)) {
206
- const detailedHelp = getCommandHelp(command);
207
- if (detailedHelp && !detailedHelp.includes('Help not available')) {
208
- printCommandHelp(command);
209
- } else if (hasCommand(command)) {
210
- showCommandHelp(command);
211
- } else {
212
- printError(`Unknown command: ${command}`);
213
- console.log('\nRun "claude-flow --help" to see available commands.');
214
- }
215
- return;
216
- }
217
161
  switch(command){
218
- case 'env-check':
219
- case 'environment':
220
- if (enhancedFlags._environment) {
221
- const env = enhancedFlags._environment;
222
- console.log(`\n🖥️ Environment Detection Results:`);
223
- console.log(` Terminal: ${env.terminalType}`);
224
- console.log(` Interactive: ${env.isInteractive ? 'Yes' : 'No'}`);
225
- console.log(` TTY Support: ${env.supportsRawMode ? 'Yes' : 'No'}`);
226
- console.log(` Detected: ${env.isVSCode ? 'VS Code' : env.isCI ? 'CI/CD' : env.isDocker ? 'Docker' : env.isSSH ? 'SSH' : 'Standard Terminal'}`);
227
- if (env.recommendedFlags.length > 0) {
228
- console.log(`\n💡 Recommended flags:`);
229
- console.log(` ${env.recommendedFlags.join(' ')}`);
230
- }
231
- if (enhancedFlags.appliedDefaults && enhancedFlags.appliedDefaults.length > 0) {
232
- console.log(`\n✅ Auto-applied:`);
233
- console.log(` ${enhancedFlags.appliedDefaults.join(' ')}`);
234
- }
235
- console.log();
236
- } else {
237
- console.log('Environment detection not available');
238
- }
239
- return;
240
162
  case 'version':
241
163
  case '--version':
242
164
  case '-v':
@@ -246,14 +168,9 @@ async function main() {
246
168
  case '--help':
247
169
  case '-h':
248
170
  if (parsedArgs.length > 0) {
249
- const detailedHelp = getCommandHelp(parsedArgs[0]);
250
- if (detailedHelp && !detailedHelp.includes('Help not available')) {
251
- printCommandHelp(parsedArgs[0]);
252
- } else {
253
- showCommandHelp(parsedArgs[0]);
254
- }
171
+ showCommandHelp(parsedArgs[0]);
255
172
  } else {
256
- printHelp(usePlainHelp);
173
+ showHelpWithCommands();
257
174
  }
258
175
  return;
259
176
  }
@@ -263,7 +180,6 @@ async function main() {
263
180
  return;
264
181
  } catch (err) {
265
182
  printError(err.message);
266
- console.log(`\nRun "claude-flow ${command} --help" for usage information.`);
267
183
  return;
268
184
  }
269
185
  }
@@ -283,12 +199,11 @@ async function main() {
283
199
  console.log('📊 Real-time monitoring would display here');
284
200
  break;
285
201
  case 'spawn':
286
- const rawSpawnType = subArgs[0] || 'general';
287
- const spawnType = resolveLegacyAgentType(rawSpawnType);
202
+ const spawnType = subArgs[0] || 'general';
288
203
  const spawnName = flags.name || `agent-${Date.now()}`;
289
204
  printSuccess(`Spawning ${spawnType} agent: ${spawnName}`);
290
205
  console.log('🤖 Agent would be created with the following configuration:');
291
- console.log(` Type: ${spawnType}${rawSpawnType !== spawnType ? ` (resolved from: ${rawSpawnType})` : ''}`);
206
+ console.log(` Type: ${spawnType}`);
292
207
  console.log(` Name: ${spawnName}`);
293
208
  console.log(' Capabilities: Research, Analysis, Code Generation');
294
209
  console.log(' Status: Ready');
@@ -313,7 +228,7 @@ async function main() {
313
228
  console.log(' • Max Pool Size: 10');
314
229
  console.log(' • Idle Timeout: 5 minutes');
315
230
  console.log(' • Shell: /bin/bash');
316
- console.log(' • Working Directory: ' + cwd());
231
+ console.log(' • Working Directory: ' + process.cwd());
317
232
  console.log(' Performance:');
318
233
  console.log(' • Average Response Time: N/A');
319
234
  console.log(' • Terminal Creation Time: N/A');
@@ -362,7 +277,7 @@ async function main() {
362
277
  const terminalConfig = {
363
278
  name: nameIndex >= 0 ? subArgs[nameIndex + 1] : 'terminal-' + Date.now(),
364
279
  shell: shellIndex >= 0 ? subArgs[shellIndex + 1] : 'bash',
365
- workingDirectory: wdIndex >= 0 ? subArgs[wdIndex + 1] : cwd(),
280
+ workingDirectory: wdIndex >= 0 ? subArgs[wdIndex + 1] : process.cwd(),
366
281
  env: envIndex >= 0 ? subArgs[envIndex + 1] : '',
367
282
  persistent: persistentIndex >= 0
368
283
  };
@@ -1319,9 +1234,10 @@ ${flags1.mode === 'full' || !flags1.mode ? `Full-stack development covering all
1319
1234
  console.log('Debug - Executing command:');
1320
1235
  console.log(`claude ${claudeArgs.map((arg)=>arg.includes(' ') || arg.includes('\n') ? `"${arg}"` : arg).join(' ')}`);
1321
1236
  }
1322
- const child = spawn('claude', claudeArgs, {
1237
+ const command = new Deno.Command('claude', {
1238
+ args: claudeArgs,
1323
1239
  env: {
1324
- ...process.env,
1240
+ ...Deno.env.toObject(),
1325
1241
  CLAUDE_INSTANCE_ID: instanceId,
1326
1242
  CLAUDE_FLOW_MODE: flags1.mode || 'full',
1327
1243
  CLAUDE_FLOW_COVERAGE: (flags1.coverage || 80).toString(),
@@ -1331,18 +1247,17 @@ ${flags1.mode === 'full' || !flags1.mode ? `Full-stack development covering all
1331
1247
  CLAUDE_FLOW_COORDINATION_ENABLED: flags1.parallel ? 'true' : 'false',
1332
1248
  CLAUDE_FLOW_FEATURES: 'memory,coordination,swarm'
1333
1249
  },
1334
- stdio: 'inherit'
1335
- });
1336
- await new Promise((resolve)=>{
1337
- child.on('exit', (code)=>{
1338
- if (code === 0) {
1339
- printSuccess(`Claude instance ${instanceId} completed successfully`);
1340
- } else {
1341
- printError(`Claude instance ${instanceId} exited with code ${code}`);
1342
- }
1343
- resolve();
1344
- });
1250
+ stdin: 'inherit',
1251
+ stdout: 'inherit',
1252
+ stderr: 'inherit'
1345
1253
  });
1254
+ const child = command.spawn();
1255
+ const status = await child.status;
1256
+ if (status.success) {
1257
+ printSuccess(`Claude instance ${instanceId} completed successfully`);
1258
+ } else {
1259
+ printError(`Claude instance ${instanceId} exited with code ${status.code}`);
1260
+ }
1346
1261
  } catch (err) {
1347
1262
  printError(`Failed to spawn Claude: ${err.message}`);
1348
1263
  console.log('Make sure you have the Claude CLI installed.');
@@ -1895,7 +1810,7 @@ ${flags1.mode === 'full' || !flags1.mode ? `Full-stack development covering all
1895
1810
  console.log('\nDid you mean:');
1896
1811
  suggestions.forEach((cmd)=>console.log(` claude-flow ${cmd}`));
1897
1812
  }
1898
- exit(1);
1813
+ process.exit(1);
1899
1814
  }
1900
1815
  }
1901
1816
  async function startRepl() {
@@ -1973,7 +1888,7 @@ Shortcuts:
1973
1888
  },
1974
1889
  config: async (key)=>{
1975
1890
  try {
1976
- const config = JSON.parse(await readTextFile('claude-flow.config.json'));
1891
+ const config = JSON.parse(await fs.readFile('claude-flow.config.json', 'utf-8'));
1977
1892
  if (key) {
1978
1893
  const keys = key.split('.');
1979
1894
  let value = config;
@@ -2001,25 +1916,21 @@ Shortcuts:
2001
1916
  if (trimmed.startsWith('!')) {
2002
1917
  const shellCmd = trimmed.substring(1);
2003
1918
  try {
2004
- await new Promise((resolve)=>{
2005
- const proc = spawn('sh', [
1919
+ const command = new Deno.Command('sh', {
1920
+ args: [
2006
1921
  '-c',
2007
1922
  shellCmd
2008
- ], {
2009
- stdio: [
2010
- 'inherit',
2011
- 'pipe',
2012
- 'pipe'
2013
- ]
2014
- });
2015
- proc.stdout.on('data', (data)=>{
2016
- console.log(data.toString());
2017
- });
2018
- proc.stderr.on('data', (data)=>{
2019
- console.error(data.toString());
2020
- });
2021
- proc.on('exit', resolve);
1923
+ ],
1924
+ stdout: 'piped',
1925
+ stderr: 'piped'
2022
1926
  });
1927
+ const { stdout, stderr } = await command.output();
1928
+ if (stdout.length > 0) {
1929
+ console.log(new TextDecoder().decode(stdout));
1930
+ }
1931
+ if (stderr.length > 0) {
1932
+ console.error(new TextDecoder().decode(stderr));
1933
+ }
2023
1934
  } catch (err) {
2024
1935
  console.error(`Shell error: ${err.message}`);
2025
1936
  }
@@ -2039,7 +1950,7 @@ Shortcuts:
2039
1950
  const parts = trimmed.split(' ');
2040
1951
  const command = parts[0];
2041
1952
  const args = parts.slice(1);
2042
- if (replCommands[command]) {
1953
+ if (command in replCommands) {
2043
1954
  await replCommands[command](...args);
2044
1955
  return true;
2045
1956
  }
@@ -2060,8 +1971,7 @@ Shortcuts:
2060
1971
  const subCmd = args[0];
2061
1972
  switch(subCmd){
2062
1973
  case 'spawn':
2063
- const rawType = args[1] || 'researcher';
2064
- const type = resolveLegacyAgentType(rawType);
1974
+ const type = args[1] || 'researcher';
2065
1975
  const name = args[2] || `agent-${Date.now()}`;
2066
1976
  const agent = {
2067
1977
  id: `agent-${Date.now()}`,
@@ -2266,33 +2176,18 @@ Shortcuts:
2266
2176
  console.log('Terminal commands: create, list, exec, attach, detach');
2267
2177
  }
2268
2178
  }
2269
- const rl = readline.createInterface({
2270
- input: process.stdin,
2271
- output: process.stdout
2272
- });
2273
- function updatePrompt() {
2274
- rl.setPrompt(replState.currentSession ? `claude-flow:${replState.currentSession}> ` : 'claude-flow> ');
2275
- }
2276
- updatePrompt();
2277
- rl.prompt();
2278
- rl.on('line', async (input)=>{
2279
- input = input.trim();
2179
+ const decoder = new TextDecoder();
2180
+ const encoder = new TextEncoder();
2181
+ while(true){
2182
+ const prompt = replState.currentSession ? `claude-flow:${replState.currentSession}> ` : 'claude-flow> ';
2183
+ await Deno.stdout.write(encoder.encode(prompt));
2184
+ const buf = new Uint8Array(1024);
2185
+ const n = await Deno.stdin.read(buf);
2186
+ if (n === null) break;
2187
+ const input = decoder.decode(buf.subarray(0, n)).trim();
2280
2188
  const shouldContinue = await processReplCommand(input);
2281
- if (!shouldContinue) {
2282
- rl.close();
2283
- } else {
2284
- updatePrompt();
2285
- rl.prompt();
2286
- }
2287
- });
2288
- rl.on('SIGINT', ()=>{
2289
- console.log('\nExiting Claude-Flow...');
2290
- rl.close();
2291
- process.exit(0);
2292
- });
2293
- return new Promise((resolve)=>{
2294
- rl.on('close', resolve);
2295
- });
2189
+ if (!shouldContinue) break;
2190
+ }
2296
2191
  }
2297
2192
  function createMinimalClaudeMd() {
2298
2193
  return `# Claude Code Integration
@@ -2609,30 +2504,30 @@ async function createSparcStructureManually() {
2609
2504
  ];
2610
2505
  for (const dir of rooDirectories){
2611
2506
  try {
2612
- await mkdirAsync(dir, {
2507
+ await Deno.mkdir(dir, {
2613
2508
  recursive: true
2614
2509
  });
2615
2510
  console.log(` ✓ Created ${dir}/`);
2616
2511
  } catch (err) {
2617
- if (!(err instanceof errors.AlreadyExists)) {
2512
+ if (!(err instanceof Deno.errors.AlreadyExists)) {
2618
2513
  throw err;
2619
2514
  }
2620
2515
  }
2621
2516
  }
2622
2517
  let roomodesContent;
2623
2518
  try {
2624
- roomodesContent = await readTextFile('.roomodes');
2519
+ roomodesContent = await fs.readFile('.roomodes');
2625
2520
  console.log(' ✓ Using existing .roomodes configuration');
2626
2521
  } catch {
2627
2522
  roomodesContent = createBasicRoomodesConfig();
2628
- await writeTextFile('.roomodes', roomodesContent);
2523
+ await fs.writeFile('.roomodes', roomodesContent);
2629
2524
  console.log(' ✓ Created .roomodes configuration');
2630
2525
  }
2631
2526
  const basicWorkflow = createBasicSparcWorkflow();
2632
- await writeTextFile('.roo/workflows/basic-tdd.json', basicWorkflow);
2527
+ await fs.writeFile('.roo/workflows/basic-tdd.json', basicWorkflow);
2633
2528
  console.log(' ✓ Created .roo/workflows/basic-tdd.json');
2634
2529
  const rooReadme = createRooReadme();
2635
- await writeTextFile('.roo/README.md', rooReadme);
2530
+ await fs.writeFile('.roo/README.md', rooReadme);
2636
2531
  console.log(' ✓ Created .roo/README.md');
2637
2532
  console.log(' ✅ Basic SPARC structure created successfully');
2638
2533
  } catch (err) {
@@ -3063,7 +2958,7 @@ This SPARC-enabled project follows a systematic development approach:
3063
2958
  For more information about SPARC methodology, see: https://github.com/ruvnet/claude-code-flow/docs/sparc.md
3064
2959
  `;
3065
2960
  }
3066
- if (isMainModule(import.meta.url)) {
2961
+ if (import.meta.url === `file://${process.argv[1]}`) {
3067
2962
  await main();
3068
2963
  }
3069
2964