claude-flow 2.5.0-alpha.137 → 2.5.0-alpha.138
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 +1 -1
- package/dist/src/cli/help-formatter.js +0 -5
- package/dist/src/cli/simple-cli.js +166 -61
- package/dist/src/cli/simple-cli.js.map +1 -1
- package/dist/src/cli/simple-commands/init/templates/enhanced-templates.js +1 -1
- package/dist/src/cli/simple-commands/init/templates/enhanced-templates.js.map +1 -1
- package/dist/src/memory/swarm-memory.js +340 -421
- package/dist/src/memory/swarm-memory.js.map +1 -1
- package/dist/src/utils/metrics-reader.js +39 -37
- package/dist/src/utils/metrics-reader.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/simple-commands/init/templates/enhanced-templates.js +1 -1
- package/src/cli/simple-commands/init/templates/settings.json +1 -1
package/bin/claude-flow
CHANGED
|
@@ -1,13 +1,47 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
2
|
-
import { promises as fs } from 'node:fs';
|
|
1
|
+
#!/usr/bin/env node
|
|
3
2
|
import { executeCommand, hasCommand, showCommandHelp, listCommands } from './command-registry.js';
|
|
4
3
|
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';
|
|
5
9
|
import { VERSION } from '../core/version.js';
|
|
6
|
-
|
|
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() {
|
|
7
40
|
console.log(`
|
|
8
41
|
🌊 Claude-Flow v${VERSION} - Enterprise-Grade AI Agent Orchestration Platform
|
|
9
42
|
|
|
10
|
-
🎯 ENTERPRISE FEATURES: Complete ruv-swarm integration with
|
|
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
|
|
11
45
|
|
|
12
46
|
USAGE:
|
|
13
47
|
claude-flow <command> [options]
|
|
@@ -141,8 +175,8 @@ function printSuccess(message) {
|
|
|
141
175
|
function printWarning(message) {
|
|
142
176
|
console.warn(`⚠️ Warning: ${message}`);
|
|
143
177
|
}
|
|
144
|
-
function showHelpWithCommands() {
|
|
145
|
-
printHelp();
|
|
178
|
+
function showHelpWithCommands(plain = false) {
|
|
179
|
+
printHelp(plain);
|
|
146
180
|
console.log('\nRegistered Commands:');
|
|
147
181
|
const commands = listCommands();
|
|
148
182
|
for (const command of commands){
|
|
@@ -151,14 +185,58 @@ function showHelpWithCommands() {
|
|
|
151
185
|
console.log('\nUse "claude-flow help <command>" for detailed usage information');
|
|
152
186
|
}
|
|
153
187
|
async function main() {
|
|
154
|
-
const args = Deno.args;
|
|
155
188
|
if (args.length === 0) {
|
|
156
|
-
printHelp();
|
|
189
|
+
printHelp(usePlainHelp);
|
|
157
190
|
return;
|
|
158
191
|
}
|
|
159
192
|
const command = args[0];
|
|
160
193
|
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
|
+
}
|
|
161
217
|
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;
|
|
162
240
|
case 'version':
|
|
163
241
|
case '--version':
|
|
164
242
|
case '-v':
|
|
@@ -168,9 +246,14 @@ async function main() {
|
|
|
168
246
|
case '--help':
|
|
169
247
|
case '-h':
|
|
170
248
|
if (parsedArgs.length > 0) {
|
|
171
|
-
|
|
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
|
+
}
|
|
172
255
|
} else {
|
|
173
|
-
|
|
256
|
+
printHelp(usePlainHelp);
|
|
174
257
|
}
|
|
175
258
|
return;
|
|
176
259
|
}
|
|
@@ -180,6 +263,7 @@ async function main() {
|
|
|
180
263
|
return;
|
|
181
264
|
} catch (err) {
|
|
182
265
|
printError(err.message);
|
|
266
|
+
console.log(`\nRun "claude-flow ${command} --help" for usage information.`);
|
|
183
267
|
return;
|
|
184
268
|
}
|
|
185
269
|
}
|
|
@@ -199,11 +283,12 @@ async function main() {
|
|
|
199
283
|
console.log('📊 Real-time monitoring would display here');
|
|
200
284
|
break;
|
|
201
285
|
case 'spawn':
|
|
202
|
-
const
|
|
286
|
+
const rawSpawnType = subArgs[0] || 'general';
|
|
287
|
+
const spawnType = resolveLegacyAgentType(rawSpawnType);
|
|
203
288
|
const spawnName = flags.name || `agent-${Date.now()}`;
|
|
204
289
|
printSuccess(`Spawning ${spawnType} agent: ${spawnName}`);
|
|
205
290
|
console.log('🤖 Agent would be created with the following configuration:');
|
|
206
|
-
console.log(` Type: ${spawnType}`);
|
|
291
|
+
console.log(` Type: ${spawnType}${rawSpawnType !== spawnType ? ` (resolved from: ${rawSpawnType})` : ''}`);
|
|
207
292
|
console.log(` Name: ${spawnName}`);
|
|
208
293
|
console.log(' Capabilities: Research, Analysis, Code Generation');
|
|
209
294
|
console.log(' Status: Ready');
|
|
@@ -228,7 +313,7 @@ async function main() {
|
|
|
228
313
|
console.log(' • Max Pool Size: 10');
|
|
229
314
|
console.log(' • Idle Timeout: 5 minutes');
|
|
230
315
|
console.log(' • Shell: /bin/bash');
|
|
231
|
-
console.log(' • Working Directory: ' +
|
|
316
|
+
console.log(' • Working Directory: ' + cwd());
|
|
232
317
|
console.log(' Performance:');
|
|
233
318
|
console.log(' • Average Response Time: N/A');
|
|
234
319
|
console.log(' • Terminal Creation Time: N/A');
|
|
@@ -277,7 +362,7 @@ async function main() {
|
|
|
277
362
|
const terminalConfig = {
|
|
278
363
|
name: nameIndex >= 0 ? subArgs[nameIndex + 1] : 'terminal-' + Date.now(),
|
|
279
364
|
shell: shellIndex >= 0 ? subArgs[shellIndex + 1] : 'bash',
|
|
280
|
-
workingDirectory: wdIndex >= 0 ? subArgs[wdIndex + 1] :
|
|
365
|
+
workingDirectory: wdIndex >= 0 ? subArgs[wdIndex + 1] : cwd(),
|
|
281
366
|
env: envIndex >= 0 ? subArgs[envIndex + 1] : '',
|
|
282
367
|
persistent: persistentIndex >= 0
|
|
283
368
|
};
|
|
@@ -1234,10 +1319,9 @@ ${flags1.mode === 'full' || !flags1.mode ? `Full-stack development covering all
|
|
|
1234
1319
|
console.log('Debug - Executing command:');
|
|
1235
1320
|
console.log(`claude ${claudeArgs.map((arg)=>arg.includes(' ') || arg.includes('\n') ? `"${arg}"` : arg).join(' ')}`);
|
|
1236
1321
|
}
|
|
1237
|
-
const
|
|
1238
|
-
args: claudeArgs,
|
|
1322
|
+
const child = spawn('claude', claudeArgs, {
|
|
1239
1323
|
env: {
|
|
1240
|
-
...
|
|
1324
|
+
...process.env,
|
|
1241
1325
|
CLAUDE_INSTANCE_ID: instanceId,
|
|
1242
1326
|
CLAUDE_FLOW_MODE: flags1.mode || 'full',
|
|
1243
1327
|
CLAUDE_FLOW_COVERAGE: (flags1.coverage || 80).toString(),
|
|
@@ -1247,17 +1331,18 @@ ${flags1.mode === 'full' || !flags1.mode ? `Full-stack development covering all
|
|
|
1247
1331
|
CLAUDE_FLOW_COORDINATION_ENABLED: flags1.parallel ? 'true' : 'false',
|
|
1248
1332
|
CLAUDE_FLOW_FEATURES: 'memory,coordination,swarm'
|
|
1249
1333
|
},
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
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
|
+
});
|
|
1253
1345
|
});
|
|
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
|
-
}
|
|
1261
1346
|
} catch (err) {
|
|
1262
1347
|
printError(`Failed to spawn Claude: ${err.message}`);
|
|
1263
1348
|
console.log('Make sure you have the Claude CLI installed.');
|
|
@@ -1810,7 +1895,7 @@ ${flags1.mode === 'full' || !flags1.mode ? `Full-stack development covering all
|
|
|
1810
1895
|
console.log('\nDid you mean:');
|
|
1811
1896
|
suggestions.forEach((cmd)=>console.log(` claude-flow ${cmd}`));
|
|
1812
1897
|
}
|
|
1813
|
-
|
|
1898
|
+
exit(1);
|
|
1814
1899
|
}
|
|
1815
1900
|
}
|
|
1816
1901
|
async function startRepl() {
|
|
@@ -1888,7 +1973,7 @@ Shortcuts:
|
|
|
1888
1973
|
},
|
|
1889
1974
|
config: async (key)=>{
|
|
1890
1975
|
try {
|
|
1891
|
-
const config = JSON.parse(await
|
|
1976
|
+
const config = JSON.parse(await readTextFile('claude-flow.config.json'));
|
|
1892
1977
|
if (key) {
|
|
1893
1978
|
const keys = key.split('.');
|
|
1894
1979
|
let value = config;
|
|
@@ -1916,21 +2001,25 @@ Shortcuts:
|
|
|
1916
2001
|
if (trimmed.startsWith('!')) {
|
|
1917
2002
|
const shellCmd = trimmed.substring(1);
|
|
1918
2003
|
try {
|
|
1919
|
-
|
|
1920
|
-
|
|
2004
|
+
await new Promise((resolve)=>{
|
|
2005
|
+
const proc = spawn('sh', [
|
|
1921
2006
|
'-c',
|
|
1922
2007
|
shellCmd
|
|
1923
|
-
],
|
|
1924
|
-
|
|
1925
|
-
|
|
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);
|
|
1926
2022
|
});
|
|
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
|
-
}
|
|
1934
2023
|
} catch (err) {
|
|
1935
2024
|
console.error(`Shell error: ${err.message}`);
|
|
1936
2025
|
}
|
|
@@ -1950,7 +2039,7 @@ Shortcuts:
|
|
|
1950
2039
|
const parts = trimmed.split(' ');
|
|
1951
2040
|
const command = parts[0];
|
|
1952
2041
|
const args = parts.slice(1);
|
|
1953
|
-
if (command
|
|
2042
|
+
if (replCommands[command]) {
|
|
1954
2043
|
await replCommands[command](...args);
|
|
1955
2044
|
return true;
|
|
1956
2045
|
}
|
|
@@ -1971,7 +2060,8 @@ Shortcuts:
|
|
|
1971
2060
|
const subCmd = args[0];
|
|
1972
2061
|
switch(subCmd){
|
|
1973
2062
|
case 'spawn':
|
|
1974
|
-
const
|
|
2063
|
+
const rawType = args[1] || 'researcher';
|
|
2064
|
+
const type = resolveLegacyAgentType(rawType);
|
|
1975
2065
|
const name = args[2] || `agent-${Date.now()}`;
|
|
1976
2066
|
const agent = {
|
|
1977
2067
|
id: `agent-${Date.now()}`,
|
|
@@ -2176,18 +2266,33 @@ Shortcuts:
|
|
|
2176
2266
|
console.log('Terminal commands: create, list, exec, attach, detach');
|
|
2177
2267
|
}
|
|
2178
2268
|
}
|
|
2179
|
-
const
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
const n = await Deno.stdin.read(buf);
|
|
2186
|
-
if (n === null) break;
|
|
2187
|
-
const input = decoder.decode(buf.subarray(0, n)).trim();
|
|
2188
|
-
const shouldContinue = await processReplCommand(input);
|
|
2189
|
-
if (!shouldContinue) break;
|
|
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> ');
|
|
2190
2275
|
}
|
|
2276
|
+
updatePrompt();
|
|
2277
|
+
rl.prompt();
|
|
2278
|
+
rl.on('line', async (input)=>{
|
|
2279
|
+
input = input.trim();
|
|
2280
|
+
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
|
+
});
|
|
2191
2296
|
}
|
|
2192
2297
|
function createMinimalClaudeMd() {
|
|
2193
2298
|
return `# Claude Code Integration
|
|
@@ -2504,30 +2609,30 @@ async function createSparcStructureManually() {
|
|
|
2504
2609
|
];
|
|
2505
2610
|
for (const dir of rooDirectories){
|
|
2506
2611
|
try {
|
|
2507
|
-
await
|
|
2612
|
+
await mkdirAsync(dir, {
|
|
2508
2613
|
recursive: true
|
|
2509
2614
|
});
|
|
2510
2615
|
console.log(` ✓ Created ${dir}/`);
|
|
2511
2616
|
} catch (err) {
|
|
2512
|
-
if (!(err instanceof
|
|
2617
|
+
if (!(err instanceof errors.AlreadyExists)) {
|
|
2513
2618
|
throw err;
|
|
2514
2619
|
}
|
|
2515
2620
|
}
|
|
2516
2621
|
}
|
|
2517
2622
|
let roomodesContent;
|
|
2518
2623
|
try {
|
|
2519
|
-
roomodesContent = await
|
|
2624
|
+
roomodesContent = await readTextFile('.roomodes');
|
|
2520
2625
|
console.log(' ✓ Using existing .roomodes configuration');
|
|
2521
2626
|
} catch {
|
|
2522
2627
|
roomodesContent = createBasicRoomodesConfig();
|
|
2523
|
-
await
|
|
2628
|
+
await writeTextFile('.roomodes', roomodesContent);
|
|
2524
2629
|
console.log(' ✓ Created .roomodes configuration');
|
|
2525
2630
|
}
|
|
2526
2631
|
const basicWorkflow = createBasicSparcWorkflow();
|
|
2527
|
-
await
|
|
2632
|
+
await writeTextFile('.roo/workflows/basic-tdd.json', basicWorkflow);
|
|
2528
2633
|
console.log(' ✓ Created .roo/workflows/basic-tdd.json');
|
|
2529
2634
|
const rooReadme = createRooReadme();
|
|
2530
|
-
await
|
|
2635
|
+
await writeTextFile('.roo/README.md', rooReadme);
|
|
2531
2636
|
console.log(' ✓ Created .roo/README.md');
|
|
2532
2637
|
console.log(' ✅ Basic SPARC structure created successfully');
|
|
2533
2638
|
} catch (err) {
|
|
@@ -2958,7 +3063,7 @@ This SPARC-enabled project follows a systematic development approach:
|
|
|
2958
3063
|
For more information about SPARC methodology, see: https://github.com/ruvnet/claude-code-flow/docs/sparc.md
|
|
2959
3064
|
`;
|
|
2960
3065
|
}
|
|
2961
|
-
if (import.meta.url
|
|
3066
|
+
if (isMainModule(import.meta.url)) {
|
|
2962
3067
|
await main();
|
|
2963
3068
|
}
|
|
2964
3069
|
|