claude-flow 2.7.37 → 2.7.39
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
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Claude-Flow Smart Dispatcher - Detects and uses the best available runtime
|
|
3
3
|
# Enhanced with NPX cache error handling and retry logic
|
|
4
4
|
|
|
5
|
-
VERSION="2.7.
|
|
5
|
+
VERSION="2.7.39"
|
|
6
6
|
|
|
7
7
|
# Determine the correct path based on how the script is invoked
|
|
8
8
|
if [ -L "$0" ]; then
|
|
@@ -15,14 +15,17 @@ else
|
|
|
15
15
|
fi
|
|
16
16
|
|
|
17
17
|
# Handle global npm installation vs local execution
|
|
18
|
-
if [ -f "$SCRIPT_DIR/../src/cli/simple-cli.js" ]; then
|
|
19
|
-
#
|
|
18
|
+
if [ -f "$SCRIPT_DIR/../dist/src/cli/simple-cli.js" ]; then
|
|
19
|
+
# npm package installation (uses dist/)
|
|
20
|
+
ROOT_DIR=$(cd "$SCRIPT_DIR/.." && pwd)
|
|
21
|
+
elif [ -f "$SCRIPT_DIR/../src/cli/simple-cli.js" ]; then
|
|
22
|
+
# Local development (uses src/ directly)
|
|
20
23
|
ROOT_DIR=$(cd "$SCRIPT_DIR/.." && pwd)
|
|
21
24
|
else
|
|
22
25
|
# Global npm installation - files might be in different location
|
|
23
26
|
# Try to find the module root
|
|
24
27
|
NODE_ROOT=$(npm root -g 2>/dev/null)
|
|
25
|
-
if [ -n "$NODE_ROOT" ] && [ -f "$NODE_ROOT/claude-flow/src/cli/simple-cli.js" ]; then
|
|
28
|
+
if [ -n "$NODE_ROOT" ] && [ -f "$NODE_ROOT/claude-flow/dist/src/cli/simple-cli.js" ]; then
|
|
26
29
|
ROOT_DIR="$NODE_ROOT/claude-flow"
|
|
27
30
|
else
|
|
28
31
|
# Fallback to relative path
|
|
@@ -101,8 +104,11 @@ execute_with_retry() {
|
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
# Use Node.js with TypeScript support and WASM modules enabled
|
|
104
|
-
if [ -f "$ROOT_DIR/src/cli/simple-cli.js" ]; then
|
|
105
|
-
# Use node for JavaScript version
|
|
107
|
+
if [ -f "$ROOT_DIR/dist/src/cli/simple-cli.js" ]; then
|
|
108
|
+
# Use node for compiled JavaScript version (npm package)
|
|
109
|
+
exec node --experimental-wasm-modules "$ROOT_DIR/dist/src/cli/simple-cli.js" "$@"
|
|
110
|
+
elif [ -f "$ROOT_DIR/src/cli/simple-cli.js" ]; then
|
|
111
|
+
# Use node for JavaScript version (local development)
|
|
106
112
|
exec node --experimental-wasm-modules "$ROOT_DIR/src/cli/simple-cli.js" "$@"
|
|
107
113
|
elif command -v tsx >/dev/null 2>&1 && [ -f "$ROOT_DIR/src/cli/simple-cli.ts" ]; then
|
|
108
114
|
# Use tsx for TypeScript functionality with WASM support (no retry needed)
|
|
@@ -274,6 +274,8 @@ async function preEditCommand(subArgs, flags) {
|
|
|
274
274
|
printSuccess(`✅ Pre-edit hook completed`);
|
|
275
275
|
} catch (err) {
|
|
276
276
|
printError(`Pre-edit hook failed: ${err.message}`);
|
|
277
|
+
} finally{
|
|
278
|
+
process.exit(0);
|
|
277
279
|
}
|
|
278
280
|
}
|
|
279
281
|
async function preBashCommand(subArgs, flags) {
|
|
@@ -351,6 +353,8 @@ async function preBashCommand(subArgs, flags) {
|
|
|
351
353
|
printSuccess(`✅ Pre-bash hook completed`);
|
|
352
354
|
} catch (err) {
|
|
353
355
|
printError(`Pre-bash hook failed: ${err.message}`);
|
|
356
|
+
} finally{
|
|
357
|
+
process.exit(0);
|
|
354
358
|
}
|
|
355
359
|
}
|
|
356
360
|
async function postTaskCommand(subArgs, flags) {
|
|
@@ -549,6 +553,8 @@ async function postEditCommand(subArgs, flags) {
|
|
|
549
553
|
printSuccess(`✅ Post-edit hook completed`);
|
|
550
554
|
} catch (err) {
|
|
551
555
|
printError(`Post-edit hook failed: ${err.message}`);
|
|
556
|
+
} finally{
|
|
557
|
+
process.exit(0);
|
|
552
558
|
}
|
|
553
559
|
}
|
|
554
560
|
async function postBashCommand(subArgs, flags) {
|
|
@@ -647,6 +653,8 @@ async function postBashCommand(subArgs, flags) {
|
|
|
647
653
|
printSuccess(`✅ Post-bash hook completed`);
|
|
648
654
|
} catch (err) {
|
|
649
655
|
printError(`Post-bash hook failed: ${err.message}`);
|
|
656
|
+
} finally{
|
|
657
|
+
process.exit(0);
|
|
650
658
|
}
|
|
651
659
|
}
|
|
652
660
|
async function postSearchCommand(subArgs, flags) {
|
|
@@ -925,6 +933,8 @@ async function sessionEndCommand(subArgs, flags) {
|
|
|
925
933
|
printSuccess(`✅ Session-end hook completed`);
|
|
926
934
|
} catch (err) {
|
|
927
935
|
printError(`Session-end hook failed: ${err.message}`);
|
|
936
|
+
} finally{
|
|
937
|
+
process.exit(0);
|
|
928
938
|
}
|
|
929
939
|
}
|
|
930
940
|
async function sessionRestoreCommand(subArgs, flags) {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { promises as fs } from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
3
|
import { exec } from 'child_process';
|
|
4
4
|
import { promisify } from 'util';
|
|
5
5
|
const execAsync = promisify(exec);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
let MetricsReader = class MetricsReader {
|
|
7
|
+
constructor(){
|
|
8
|
+
this.metricsDir = '.claude-flow/metrics';
|
|
9
|
+
this.sessionsDir = '.claude-flow/sessions';
|
|
10
|
+
}
|
|
9
11
|
async getSystemMetrics() {
|
|
10
12
|
try {
|
|
11
13
|
const filePath = path.join(this.metricsDir, 'system-metrics.json');
|
|
@@ -16,6 +18,15 @@ export class MetricsReader {
|
|
|
16
18
|
return null;
|
|
17
19
|
}
|
|
18
20
|
}
|
|
21
|
+
async getTaskQueue() {
|
|
22
|
+
try {
|
|
23
|
+
const queueFile = '.claude-flow/tasks/queue.json';
|
|
24
|
+
const content = await fs.readFile(queueFile, 'utf8');
|
|
25
|
+
return JSON.parse(content);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
19
30
|
async getTaskMetrics() {
|
|
20
31
|
try {
|
|
21
32
|
const filePath = path.join(this.metricsDir, 'task-metrics.json');
|
|
@@ -36,30 +47,30 @@ export class MetricsReader {
|
|
|
36
47
|
}
|
|
37
48
|
async getActiveAgents() {
|
|
38
49
|
try {
|
|
39
|
-
const perfMetrics = await this.getPerformanceMetrics();
|
|
40
|
-
const sessionFiles = await this.getSessionFiles();
|
|
41
50
|
const agents = [];
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (
|
|
47
|
-
|
|
51
|
+
const agentsDir = '.claude-flow/agents';
|
|
52
|
+
try {
|
|
53
|
+
const agentFiles = await fs.readdir(agentsDir);
|
|
54
|
+
for (const file of agentFiles){
|
|
55
|
+
if (file.endsWith('.json')) {
|
|
56
|
+
try {
|
|
57
|
+
const content = await fs.readFile(path.join(agentsDir, file), 'utf8');
|
|
58
|
+
const agent = JSON.parse(content);
|
|
59
|
+
agents.push(agent);
|
|
60
|
+
} catch {}
|
|
48
61
|
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (agents.length === 0
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
lastActivity: Date.now() - i * 1000
|
|
62
|
-
});
|
|
62
|
+
}
|
|
63
|
+
} catch {}
|
|
64
|
+
if (agents.length === 0) {
|
|
65
|
+
const sessionFiles = await this.getSessionFiles();
|
|
66
|
+
for (const file of sessionFiles){
|
|
67
|
+
try {
|
|
68
|
+
const content = await fs.readFile(path.join(this.sessionsDir, 'pair', file), 'utf8');
|
|
69
|
+
const sessionData = JSON.parse(content);
|
|
70
|
+
if (sessionData.agents && Array.isArray(sessionData.agents)) {
|
|
71
|
+
agents.push(...sessionData.agents);
|
|
72
|
+
}
|
|
73
|
+
} catch {}
|
|
63
74
|
}
|
|
64
75
|
}
|
|
65
76
|
return agents;
|
|
@@ -135,7 +146,7 @@ export class MetricsReader {
|
|
|
135
146
|
}
|
|
136
147
|
async getMCPServerStatus() {
|
|
137
148
|
try {
|
|
138
|
-
const { stdout } = await execAsync('ps aux | grep -E "mcp
|
|
149
|
+
const { stdout } = await execAsync('ps aux | grep -E "mcp" | grep -v grep | wc -l');
|
|
139
150
|
const processCount = parseInt(stdout.trim(), 10);
|
|
140
151
|
const { stdout: orchestratorOut } = await execAsync('ps aux | grep -E "claude-flow start" | grep -v grep | wc -l');
|
|
141
152
|
const orchestratorRunning = parseInt(orchestratorOut.trim(), 10) > 0;
|
|
@@ -164,15 +175,6 @@ export class MetricsReader {
|
|
|
164
175
|
};
|
|
165
176
|
}
|
|
166
177
|
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
//# sourceMappingURL=metrics-reader.js.map processCount: 0,
|
|
170
|
-
orchestratorRunning: false,
|
|
171
|
-
port: null,
|
|
172
|
-
connections: 0
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
178
|
};
|
|
177
179
|
export { MetricsReader };
|
|
178
180
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-flow",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.39",
|
|
4
4
|
"description": "Enterprise-grade AI agent orchestration with WASM-powered ReasoningBank memory and AgentDB vector database (always uses latest agentic-flow)",
|
|
5
5
|
"mcpName": "io.github.ruvnet/claude-flow",
|
|
6
6
|
"main": "cli.mjs",
|