@claude-flow/cli 3.1.0-alpha.49 → 3.1.0-alpha.50

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 (2) hide show
  1. package/bin/preinstall.cjs +38 -10
  2. package/package.json +1 -1
@@ -45,19 +45,47 @@ try {
45
45
  } catch (e) { /* non-fatal */ }
46
46
 
47
47
  // 2. Remove corrupted integrity entries from _cacache (fixes ECOMPROMISED)
48
- // Only removes the index directory which contains integrity manifests.
49
- // The content-v2 directory (actual cached tarballs) is left intact.
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
50
  try {
51
51
  var cacheIndex = path.join(npmDir, '_cacache', 'index-v5');
52
52
  if (fs.existsSync(cacheIndex)) {
53
- // Check if the index is readable if not, it's corrupted
54
- try {
55
- fs.readdirSync(cacheIndex);
56
- } catch (e) {
57
- if (e.code === 'EACCES' || e.code === 'EPERM') {
58
- // Permission issue — try to fix
59
- fs.rmSync(cacheIndex, { recursive: true, force: true });
60
- }
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 */ }
61
89
  }
62
90
  }
63
91
  } catch (e) { /* non-fatal */ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.1.0-alpha.49",
3
+ "version": "3.1.0-alpha.50",
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",