stigmergy 1.1.6 → 1.2.0
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 +14 -27
- package/scripts/preinstall-check.js +78 -16
- package/src/cli/router.js +375 -29
- package/src/core/cache_cleaner.js +744 -0
- package/src/core/cli_tools.js +1 -1
- package/src/core/enhanced_installer.js +456 -0
- package/src/core/enhanced_uninstaller.js +618 -0
- package/src/core/installer.js +1 -0
- package/src/core/upgrade_manager.js +403 -0
- package/test/cache-cleaner-implemented.test.js +328 -0
- package/test/cache-cleaner.test.js +390 -0
- package/test/comprehensive-enhanced-features.test.js +252 -0
- package/test/enhanced-uninstaller-implemented.test.js +271 -0
- package/test/enhanced-uninstaller.test.js +284 -0
- package/test/plugin-deployment-test.js +1 -1
- package/test/safe-installation-cleaner.test.js +343 -0
- package/test/stigmergy-upgrade-test.js +243 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stigmergy",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Stigmergy CLI - Multi-Agents Cross-AI CLI Tools Collaboration System",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -12,28 +12,20 @@
|
|
|
12
12
|
"test:unit": "jest tests/unit",
|
|
13
13
|
"test:integration": "jest tests/integration",
|
|
14
14
|
"test:e2e": "jest tests/e2e",
|
|
15
|
-
"test:rest-client": "node test/rest_client.test.js",
|
|
16
|
-
"test:nodejs-coordination": "jest tests/unit/nodejs-coordination-layer.test.js",
|
|
17
|
-
"test:nodejs-hooks": "jest tests/unit/nodejs-hook-deployment.test.js",
|
|
18
|
-
"test:nodejs-integration": "jest tests/unit/nodejs-cli-integration.test.js",
|
|
19
|
-
"example:rest-client": "node examples/rest_client_example.js",
|
|
20
15
|
"coverage": "jest --coverage",
|
|
21
|
-
"test:watch": "jest --watch",
|
|
22
16
|
"build": "node scripts/build.js",
|
|
23
17
|
"deploy": "node src/index.js deploy",
|
|
24
18
|
"status": "node src/index.js status",
|
|
25
19
|
"scan": "node src/index.js scan",
|
|
26
20
|
"init": "node src/index.js init",
|
|
27
|
-
"clean": "node cleanup.js",
|
|
28
21
|
"validate": "node src/index.js validate",
|
|
29
22
|
"dev": "node --watch src/index.js",
|
|
30
23
|
"lint": "eslint src/",
|
|
31
24
|
"format": "prettier --write src/",
|
|
32
|
-
"
|
|
33
|
-
"diagnostic": "node
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"test:conflict-prevention": "node test/conflict-prevention-test.js",
|
|
25
|
+
"clean": "node src/index.js clean",
|
|
26
|
+
"diagnostic": "node src/index.js diagnostic",
|
|
27
|
+
"uninstall": "node -e \"const EU=require('./src/core/enhanced_uninstaller'); new EU({dryRun:true,verbose:true}).completeUninstall()\"",
|
|
28
|
+
"uninstall-force": "node -e \"const EU=require('./src/core/enhanced_uninstaller'); new EU({force:true,verbose:true}).completeUninstall()\"",
|
|
37
29
|
"post-deployment-config": "node scripts/post-deployment-config.js",
|
|
38
30
|
"preinstall": "node scripts/preinstall-check.js",
|
|
39
31
|
"postinstall": "node src/index.js auto-install"
|
|
@@ -78,27 +70,22 @@
|
|
|
78
70
|
},
|
|
79
71
|
"dependencies": {
|
|
80
72
|
"chalk": "^4.1.2",
|
|
81
|
-
"child_process": "^1.0.2",
|
|
82
73
|
"chokidar": "^3.5.3",
|
|
83
|
-
"commander": "^
|
|
84
|
-
"events": "^3.3.0",
|
|
74
|
+
"commander": "^9.5.0",
|
|
85
75
|
"figures": "^3.2.0",
|
|
86
|
-
"fs-extra": "^11.
|
|
87
|
-
"glob": "^
|
|
76
|
+
"fs-extra": "^11.2.0",
|
|
77
|
+
"glob": "^8.1.0",
|
|
88
78
|
"inquirer": "^8.2.6",
|
|
89
79
|
"js-yaml": "^4.1.0",
|
|
90
80
|
"ora": "^5.4.1",
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"semver": "^7.5.4",
|
|
94
|
-
"table": "^6.8.1",
|
|
95
|
-
"util": "^0.12.5"
|
|
81
|
+
"semver": "^7.6.3",
|
|
82
|
+
"table": "^6.8.2"
|
|
96
83
|
},
|
|
97
84
|
"devDependencies": {
|
|
98
|
-
"eslint": "^8.
|
|
99
|
-
"jest": "^
|
|
100
|
-
"nodemon": "^3.
|
|
101
|
-
"prettier": "^3.
|
|
85
|
+
"eslint": "^8.57.1",
|
|
86
|
+
"jest": "^29.7.0",
|
|
87
|
+
"nodemon": "^3.1.7",
|
|
88
|
+
"prettier": "^3.3.3"
|
|
102
89
|
},
|
|
103
90
|
"config": {
|
|
104
91
|
"encoding": "ansi",
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Stigmergy Pre-installation
|
|
5
|
-
* This script prevents installation conflicts
|
|
4
|
+
* Enhanced Stigmergy Pre-installation Check
|
|
5
|
+
* This script prevents installation conflicts and cleans historical caches
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
const fs = require('fs');
|
|
9
9
|
const path = require('path');
|
|
10
10
|
const { spawnSync } = require('child_process');
|
|
11
11
|
|
|
12
|
-
console.log('[PRE-INSTALL] Running
|
|
12
|
+
console.log('[PRE-INSTALL] Running enhanced installation preparation...');
|
|
13
13
|
|
|
14
14
|
// Check 1: Verify no conflicting "node" package is already installed
|
|
15
15
|
function checkConflictingNodePackage() {
|
|
@@ -96,16 +96,78 @@ function checkExistingInstallation() {
|
|
|
96
96
|
console.log('[OK] No conflicting Stigmergy installation found.');
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
//
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
99
|
+
// Check 5: Clean historical caches (NEW FUNCTION)
|
|
100
|
+
function cleanHistoricalCaches() {
|
|
101
|
+
console.log('[CLEAN] Cleaning historical caches to prevent conflicts...');
|
|
102
|
+
|
|
103
|
+
try {
|
|
104
|
+
// Import and use our enhanced cache cleaner
|
|
105
|
+
const CacheCleaner = require('../src/core/cache_cleaner');
|
|
106
|
+
const cleaner = new CacheCleaner({
|
|
107
|
+
dryRun: false,
|
|
108
|
+
force: true,
|
|
109
|
+
verbose: false,
|
|
110
|
+
preserveRecent: 60 * 60 * 1000 // Preserve files from last hour
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// Clean only safe items before installation
|
|
114
|
+
cleaner.cleanAllCaches({
|
|
115
|
+
cleanStigmergy: false, // Don't clean main config during install
|
|
116
|
+
cleanNPX: true, // Clean NPX cache (safe)
|
|
117
|
+
cleanNPM: false, // Don't clean NPM cache during install
|
|
118
|
+
cleanCLI: false, // Don't clean CLI configs during install
|
|
119
|
+
cleanTemp: true // Clean temporary files (safe)
|
|
120
|
+
}).then(results => {
|
|
121
|
+
if (results.filesRemoved > 0) {
|
|
122
|
+
console.log(`[CLEAN] Removed ${results.filesRemoved} cache files`);
|
|
123
|
+
console.log(`[CLEAN] Freed ${formatBytes(results.bytesFreed)} space`);
|
|
124
|
+
} else {
|
|
125
|
+
console.log('[CLEAN] No cache files needed cleaning');
|
|
126
|
+
}
|
|
127
|
+
}).catch(error => {
|
|
128
|
+
console.log(`[WARN] Cache cleaning failed: ${error.message}`);
|
|
129
|
+
console.log('[INFO] Continuing with installation...');
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
} catch (error) {
|
|
133
|
+
console.log(`[WARN] Could not initialize cache cleaner: ${error.message}`);
|
|
134
|
+
console.log('[INFO] Continuing with installation...');
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Helper function to format bytes
|
|
139
|
+
function formatBytes(bytes) {
|
|
140
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
|
|
141
|
+
if (bytes === 0) return '0 Bytes';
|
|
142
|
+
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
143
|
+
return Math.round(bytes / Math.pow(1024, i) * 100) / 100 + ' ' + sizes[i];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Run all checks and preparation
|
|
147
|
+
async function runInstallationPreparation() {
|
|
148
|
+
try {
|
|
149
|
+
// System requirements first
|
|
150
|
+
checkSystemNode();
|
|
151
|
+
checkNpm();
|
|
152
|
+
checkConflictingNodePackage();
|
|
153
|
+
checkExistingInstallation();
|
|
154
|
+
|
|
155
|
+
// Clean caches (async, but don't wait for completion to avoid blocking npm install)
|
|
156
|
+
cleanHistoricalCaches();
|
|
157
|
+
|
|
158
|
+
console.log('[SUCCESS] Enhanced installation preparation completed.');
|
|
159
|
+
console.log('[INFO] Proceeding with package installation...');
|
|
160
|
+
|
|
161
|
+
// Give cache cleaning a moment to start
|
|
162
|
+
setTimeout(() => {
|
|
163
|
+
process.exit(0);
|
|
164
|
+
}, 1000);
|
|
165
|
+
|
|
166
|
+
} catch (error) {
|
|
167
|
+
console.error('[FATAL] Installation preparation failed:', error.message);
|
|
168
|
+
process.exit(1);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Run the enhanced preparation
|
|
173
|
+
runInstallationPreparation();
|