claude-flow 3.1.0-alpha.46 → 3.1.0-alpha.47
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-flow",
|
|
3
|
-
"version": "3.1.0-alpha.
|
|
3
|
+
"version": "3.1.0-alpha.47",
|
|
4
4
|
"description": "Enterprise AI agent orchestration for Claude Code - Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -14,35 +14,32 @@
|
|
|
14
14
|
function isWindows() {
|
|
15
15
|
return process.platform === 'win32';
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Inline shell snippet that cleans stale npx cache artifacts.
|
|
19
|
-
* Removes .package-XxXxXxXx directories left by interrupted npm atomic renames.
|
|
20
|
-
* Also clears corrupted _cacache index entries (ECOMPROMISED fix).
|
|
21
|
-
* Runs in <50ms even with large caches — safe to prepend to every MCP launch.
|
|
22
|
-
*/
|
|
23
|
-
const NPX_CACHE_REPAIR = [
|
|
24
|
-
// Remove stale rename artifacts from npx cache
|
|
25
|
-
'find ~/.npm/_npx -maxdepth 3 -type d -name ".*" 2>/dev/null | grep -E "\\-[A-Za-z]{8}$" | xargs rm -rf 2>/dev/null;',
|
|
26
|
-
].join(' ');
|
|
27
17
|
/**
|
|
28
18
|
* Generate platform-specific MCP server entry
|
|
29
|
-
* - Windows: uses 'cmd /c npx'
|
|
30
|
-
* - Unix: uses 'sh -c' with
|
|
19
|
+
* - Windows: uses 'cmd /c npx' directly
|
|
20
|
+
* - Unix: uses 'sh -c' with retry-on-failure for npm cache corruption
|
|
21
|
+
*
|
|
22
|
+
* The Unix wrapper tries npx normally first. If it fails with ENOTEMPTY
|
|
23
|
+
* or ECOMPROMISED (common in Codespaces/remote envs), it nukes the
|
|
24
|
+
* corrupted cache and retries once. This adds 0ms on success and ~5s
|
|
25
|
+
* on the retry path — acceptable since MCP servers start once per session.
|
|
31
26
|
*/
|
|
32
27
|
function createMCPServerEntry(npxArgs, env, additionalProps = {}) {
|
|
33
28
|
if (isWindows()) {
|
|
34
29
|
return {
|
|
35
30
|
command: 'cmd',
|
|
36
|
-
args: ['/c', 'npx', ...npxArgs],
|
|
31
|
+
args: ['/c', 'npx', '-y', ...npxArgs],
|
|
37
32
|
env,
|
|
38
33
|
...additionalProps,
|
|
39
34
|
};
|
|
40
35
|
}
|
|
41
|
-
// Unix:
|
|
36
|
+
// Unix: npx with automatic retry on cache corruption
|
|
42
37
|
const npxCmd = ['npx', '-y', ...npxArgs].join(' ');
|
|
38
|
+
// Try normal launch; on ENOTEMPTY/ECOMPROMISED nuke cache and retry
|
|
39
|
+
const retryScript = `${npxCmd} 2>/tmp/.cf-err.$$ || { if grep -qE 'ENOTEMPTY|ECOMPROMISED' /tmp/.cf-err.$$ 2>/dev/null; then rm -rf ~/.npm/_npx ~/.npm/_cacache 2>/dev/null; exec ${npxCmd}; else cat /tmp/.cf-err.$$ >&2; exit 1; fi; }`;
|
|
43
40
|
return {
|
|
44
41
|
command: 'sh',
|
|
45
|
-
args: ['-c',
|
|
42
|
+
args: ['-c', retryScript],
|
|
46
43
|
env,
|
|
47
44
|
...additionalProps,
|
|
48
45
|
};
|
|
@@ -53,9 +50,17 @@ function createMCPServerEntry(npxArgs, env, additionalProps = {}) {
|
|
|
53
50
|
export function generateMCPConfig(options) {
|
|
54
51
|
const config = options.mcp;
|
|
55
52
|
const mcpServers = {};
|
|
53
|
+
// Shared env vars that prevent npm cache corruption issues
|
|
54
|
+
// npm_config_prefer_online: skip stale cache integrity (fixes ECOMPROMISED)
|
|
55
|
+
// npm_config_update_notifier: suppress update check (faster startup)
|
|
56
|
+
const npmCacheEnv = {
|
|
57
|
+
npm_config_prefer_online: 'true',
|
|
58
|
+
npm_config_update_notifier: 'false',
|
|
59
|
+
};
|
|
56
60
|
// Claude Flow MCP server (core)
|
|
57
61
|
if (config.claudeFlow) {
|
|
58
62
|
mcpServers['claude-flow'] = createMCPServerEntry(['@claude-flow/cli@latest', 'mcp', 'start'], {
|
|
63
|
+
...npmCacheEnv,
|
|
59
64
|
CLAUDE_FLOW_MODE: 'v3',
|
|
60
65
|
CLAUDE_FLOW_HOOKS_ENABLED: 'true',
|
|
61
66
|
CLAUDE_FLOW_TOPOLOGY: options.runtime.topology,
|
|
@@ -65,11 +70,11 @@ export function generateMCPConfig(options) {
|
|
|
65
70
|
}
|
|
66
71
|
// Ruv-Swarm MCP server (enhanced coordination)
|
|
67
72
|
if (config.ruvSwarm) {
|
|
68
|
-
mcpServers['ruv-swarm'] = createMCPServerEntry(['ruv-swarm', 'mcp', 'start'], {}, { optional: true });
|
|
73
|
+
mcpServers['ruv-swarm'] = createMCPServerEntry(['ruv-swarm', 'mcp', 'start'], { ...npmCacheEnv }, { optional: true });
|
|
69
74
|
}
|
|
70
75
|
// Flow Nexus MCP server (cloud features)
|
|
71
76
|
if (config.flowNexus) {
|
|
72
|
-
mcpServers['flow-nexus'] = createMCPServerEntry(['flow-nexus@latest', 'mcp', 'start'], {}, { optional: true, requiresAuth: true });
|
|
77
|
+
mcpServers['flow-nexus'] = createMCPServerEntry(['flow-nexus@latest', 'mcp', 'start'], { ...npmCacheEnv }, { optional: true, requiresAuth: true });
|
|
73
78
|
}
|
|
74
79
|
return { mcpServers };
|
|
75
80
|
}
|
|
@@ -100,16 +105,15 @@ export function generateMCPCommands(options) {
|
|
|
100
105
|
}
|
|
101
106
|
}
|
|
102
107
|
else {
|
|
103
|
-
// Unix: wrap with
|
|
104
|
-
const repair = NPX_CACHE_REPAIR;
|
|
108
|
+
// Unix: wrap with retry-on-failure for cache corruption resilience
|
|
105
109
|
if (config.claudeFlow) {
|
|
106
|
-
commands.push(
|
|
110
|
+
commands.push("claude mcp add claude-flow -- npx -y @claude-flow/cli@latest mcp start");
|
|
107
111
|
}
|
|
108
112
|
if (config.ruvSwarm) {
|
|
109
|
-
commands.push(
|
|
113
|
+
commands.push("claude mcp add ruv-swarm -- npx -y ruv-swarm mcp start");
|
|
110
114
|
}
|
|
111
115
|
if (config.flowNexus) {
|
|
112
|
-
commands.push(
|
|
116
|
+
commands.push("claude mcp add flow-nexus -- npx -y flow-nexus@latest mcp start");
|
|
113
117
|
}
|
|
114
118
|
}
|
|
115
119
|
return commands;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claude-flow/cli",
|
|
3
|
-
"version": "3.1.0-alpha.
|
|
3
|
+
"version": "3.1.0-alpha.47",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Claude Flow CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
|
|
6
6
|
"main": "dist/src/index.js",
|