@claude-flow/cli 3.1.0-alpha.53 → 3.1.0-alpha.54

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/cli.js CHANGED
@@ -6,36 +6,8 @@
6
6
  *
7
7
  * Auto-detects MCP mode when stdin is piped and no args provided.
8
8
  * This allows: echo '{"jsonrpc":"2.0",...}' | npx @claude-flow/cli
9
- *
10
- * Includes pre-flight npx cache repair to prevent ENOTEMPTY errors
11
- * in remote/CI environments (known npm 10.x bug).
12
9
  */
13
10
 
14
- // Pre-flight: repair stale npx cache to prevent ENOTEMPTY on next run
15
- import { existsSync, readdirSync, rmSync, statSync } from 'node:fs';
16
- import { join } from 'node:path';
17
- import { homedir } from 'node:os';
18
-
19
- try {
20
- const npxRoot = join(homedir(), '.npm', '_npx');
21
- if (existsSync(npxRoot)) {
22
- for (const dir of readdirSync(npxRoot)) {
23
- const nm = join(npxRoot, dir, 'node_modules');
24
- if (!existsSync(nm)) continue;
25
- try {
26
- for (const entry of readdirSync(nm)) {
27
- if (entry.startsWith('.') && entry.includes('-') && /[A-Za-z]{8}$/.test(entry)) {
28
- try {
29
- const p = join(nm, entry);
30
- if (statSync(p).isDirectory()) rmSync(p, { recursive: true, force: true });
31
- } catch {}
32
- }
33
- }
34
- } catch {}
35
- }
36
- }
37
- } catch {}
38
-
39
11
  import { randomUUID } from 'crypto';
40
12
 
41
13
  // Check if we should run in MCP server mode
package/bin/mcp-server.js CHANGED
@@ -5,36 +5,8 @@
5
5
  * Direct stdio MCP server for Claude Code integration.
6
6
  * This entry point handles stdin/stdout directly for MCP protocol
7
7
  * without any CLI formatting output that would corrupt the protocol.
8
- *
9
- * Includes pre-flight npx cache repair to prevent ENOTEMPTY errors
10
- * in remote/CI environments (known npm 10.x bug).
11
8
  */
12
9
 
13
- // Pre-flight: repair stale npx cache to prevent ENOTEMPTY on next run
14
- import { existsSync, readdirSync, rmSync, statSync } from 'node:fs';
15
- import { join } from 'node:path';
16
- import { homedir } from 'node:os';
17
-
18
- try {
19
- const npxRoot = join(homedir(), '.npm', '_npx');
20
- if (existsSync(npxRoot)) {
21
- for (const dir of readdirSync(npxRoot)) {
22
- const nm = join(npxRoot, dir, 'node_modules');
23
- if (!existsSync(nm)) continue;
24
- try {
25
- for (const entry of readdirSync(nm)) {
26
- if (entry.startsWith('.') && entry.includes('-') && /[A-Za-z]{8}$/.test(entry)) {
27
- try {
28
- const p = join(nm, entry);
29
- if (statSync(p).isDirectory()) rmSync(p, { recursive: true, force: true });
30
- } catch {}
31
- }
32
- }
33
- } catch {}
34
- }
35
- }
36
- } catch {}
37
-
38
10
  import { randomUUID } from 'crypto';
39
11
  import { listMCPTools, callMCPTool, hasTool } from '../dist/src/mcp-client.js';
40
12
 
@@ -1,111 +1,2 @@
1
1
  #!/usr/bin/env node
2
- /**
3
- * Preinstall hook: repairs npm/npx cache to prevent ENOTEMPTY and ECOMPROMISED.
4
- *
5
- * Handles two common npm bugs in remote/CI/Codespaces environments:
6
- * - ENOTEMPTY: leftover .package-XxXxXxXx dirs from interrupted atomic renames
7
- * - ECOMPROMISED: corrupted integrity manifests in _cacache
8
- *
9
- * Works on Windows, macOS, and Linux. Uses only Node.js built-ins (CJS).
10
- * Intentionally uses var/ES5 for maximum Node.js compatibility (14+).
11
- */
12
- var fs = require('fs');
13
- var path = require('path');
14
- var os = require('os');
15
-
16
- var npmDir = path.join(os.homedir(), '.npm');
17
-
18
- // 1. Clean stale rename artifacts from npx cache (fixes ENOTEMPTY)
19
- try {
20
- var npxRoot = path.join(npmDir, '_npx');
21
- if (fs.existsSync(npxRoot)) {
22
- var dirs = fs.readdirSync(npxRoot);
23
- for (var i = 0; i < dirs.length; i++) {
24
- var nm = path.join(npxRoot, dirs[i], 'node_modules');
25
- if (fs.existsSync(nm) === false) continue;
26
-
27
- try {
28
- var entries = fs.readdirSync(nm);
29
- for (var k = 0; k < entries.length; k++) {
30
- var entry = entries[k];
31
- // Stale rename targets: .package-name-XxXxXxXx (dot prefix, dash, 8+ alpha suffix)
32
- if (entry.charAt(0) === '.' && entry.indexOf('-') > 0 && /[A-Za-z]{8}$/.test(entry)) {
33
- try {
34
- var p = path.join(nm, entry);
35
- var stat = fs.statSync(p);
36
- if (stat.isDirectory()) {
37
- fs.rmSync(p, { recursive: true, force: true });
38
- }
39
- } catch (e) { /* ignore individual failures */ }
40
- }
41
- }
42
- } catch (e) { /* can't read dir, skip */ }
43
- }
44
- }
45
- } catch (e) { /* non-fatal */ }
46
-
47
- // 2. Remove corrupted integrity entries from _cacache (fixes ECOMPROMISED)
48
- // Scans index-v5 hash buckets for entries referencing claude-flow or ruflo
49
- // packages and removes them so npm re-fetches with correct integrity.
50
- try {
51
- var cacheIndex = path.join(npmDir, '_cacache', 'index-v5');
52
- if (fs.existsSync(cacheIndex)) {
53
- // Walk the two-level hash bucket structure: index-v5/XX/YY/...
54
- var buckets = fs.readdirSync(cacheIndex);
55
- for (var bi = 0; bi < buckets.length; bi++) {
56
- var bucketPath = path.join(cacheIndex, buckets[bi]);
57
- try {
58
- var stat = fs.statSync(bucketPath);
59
- if (!stat.isDirectory()) continue;
60
- var subBuckets = fs.readdirSync(bucketPath);
61
- for (var si = 0; si < subBuckets.length; si++) {
62
- var subPath = path.join(bucketPath, subBuckets[si]);
63
- try {
64
- var subStat = fs.statSync(subPath);
65
- if (subStat.isDirectory()) {
66
- // Third level
67
- var files = fs.readdirSync(subPath);
68
- for (var fi = 0; fi < files.length; fi++) {
69
- var filePath = path.join(subPath, files[fi]);
70
- try {
71
- var content = fs.readFileSync(filePath, 'utf-8');
72
- if (content.indexOf('claude-flow') !== -1 || content.indexOf('ruflo') !== -1) {
73
- fs.unlinkSync(filePath);
74
- }
75
- } catch (e2) { /* skip unreadable */ }
76
- }
77
- } else {
78
- // File at second level
79
- try {
80
- var content2 = fs.readFileSync(subPath, 'utf-8');
81
- if (content2.indexOf('claude-flow') !== -1 || content2.indexOf('ruflo') !== -1) {
82
- fs.unlinkSync(subPath);
83
- }
84
- } catch (e2) { /* skip unreadable */ }
85
- }
86
- } catch (e2) { /* skip */ }
87
- }
88
- } catch (e2) { /* skip unreadable bucket */ }
89
- }
90
- }
91
- } catch (e) { /* non-fatal */ }
92
-
93
- // 3. Remove stale package-lock.json files from npx cache entries
94
- try {
95
- if (fs.existsSync(npxRoot)) {
96
- var cDirs = fs.readdirSync(npxRoot);
97
- for (var j = 0; j < cDirs.length; j++) {
98
- var lockFile = path.join(npxRoot, cDirs[j], 'package-lock.json');
99
- try {
100
- if (fs.existsSync(lockFile)) {
101
- var lockStat = fs.statSync(lockFile);
102
- // Remove lock files older than 1 hour (likely stale)
103
- var ageMs = Date.now() - lockStat.mtimeMs;
104
- if (ageMs > 3600000) {
105
- fs.unlinkSync(lockFile);
106
- }
107
- }
108
- } catch (e) { /* ignore */ }
109
- }
110
- }
111
- } catch (e) { /* non-fatal */ }
2
+ // Preinstall hook — no-op (cache repair removed in 3.1.0-alpha.53)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.1.0-alpha.53",
3
+ "version": "3.1.0-alpha.54",
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",