stigmergy 1.1.5 → 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/STIGMERGY.md +43 -23
- package/package.json +14 -27
- package/scripts/preinstall-check.js +78 -16
- package/src/cli/router.js +378 -132
- package/src/core/cache_cleaner.js +744 -0
- package/src/core/cli_tools.js +1 -1
- package/src/core/coordination/nodejs/CLCommunication.js +86 -21
- package/src/core/coordination/nodejs/HookDeploymentManager.js +56 -13
- package/src/core/enhanced_installer.js +456 -0
- package/src/core/enhanced_uninstaller.js +618 -0
- package/src/core/installer.js +125 -28
- 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/STIGMERGY.md
CHANGED
|
@@ -4,30 +4,50 @@ This project is configured for Stigmergy-based multi-AI CLI collaboration.
|
|
|
4
4
|
|
|
5
5
|
## Available AI CLI Tools
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
Cross-CLI communication is enabled between all supported AI tools:
|
|
8
|
+
- Claude (Anthropic)
|
|
9
|
+
- Qwen (Alibaba)
|
|
10
|
+
- Gemini (Google)
|
|
11
|
+
- iFlow (Intelligent Workflow)
|
|
12
|
+
- Qoder CLI
|
|
13
|
+
- CodeBuddy
|
|
14
|
+
- GitHub Copilot
|
|
15
|
+
- OpenAI Codex
|
|
16
|
+
|
|
17
|
+
## Cross-CLI Collaboration
|
|
18
|
+
|
|
19
|
+
Instead of using a central command, cross-CLI communication happens directly between tools through hooks:
|
|
20
|
+
|
|
21
|
+
### How It Works
|
|
22
|
+
1. Each CLI tool has hooks deployed by Stigmergy
|
|
23
|
+
2. When one tool detects a request to use another tool, it triggers cross-CLI communication
|
|
24
|
+
3. The target tool executes the requested task and returns results
|
|
25
|
+
|
|
26
|
+
### Usage Pattern
|
|
27
|
+
From any supported CLI tool, use natural language patterns:
|
|
12
28
|
```bash
|
|
13
|
-
#
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
stigmergy call gemini "generate docs for this file"
|
|
18
|
-
|
|
19
|
-
# Use Qwen for translation
|
|
20
|
-
stigmergy call qwen "translate to English"
|
|
29
|
+
# Natural language patterns recognized by hooks
|
|
30
|
+
"use qwen to translate this code to Python"
|
|
31
|
+
"ask claude to review this algorithm"
|
|
32
|
+
"call gemini to explain this concept"
|
|
21
33
|
```
|
|
22
34
|
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
# Initialize with Claude as primary AI
|
|
26
|
-
stigmergy init --primary claude
|
|
35
|
+
## Project Memory and Documentation
|
|
27
36
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
This project automatically generates documentation for each CLI tool:
|
|
38
|
+
- claude.md
|
|
39
|
+
- qwen.md
|
|
40
|
+
- gemini.md
|
|
41
|
+
- iflow.md
|
|
42
|
+
- qodercli.md
|
|
43
|
+
- codebuddy.md
|
|
44
|
+
- copilot.md
|
|
45
|
+
- codex.md
|
|
46
|
+
|
|
47
|
+
Each documentation file contains:
|
|
48
|
+
- Tool configuration information
|
|
49
|
+
- Usage patterns
|
|
50
|
+
- Cross-CLI communication instructions
|
|
31
51
|
|
|
32
52
|
## Configuration
|
|
33
53
|
|
|
@@ -36,7 +56,7 @@ Global configuration: `~/.stigmergy/config.json`
|
|
|
36
56
|
## Getting Started
|
|
37
57
|
|
|
38
58
|
1. Run `stigmergy status` to verify setup
|
|
39
|
-
2.
|
|
40
|
-
3.
|
|
59
|
+
2. Check individual CLI documentation files for specific usage instructions
|
|
60
|
+
3. Use natural language requests within any CLI tool to trigger cross-CLI communication
|
|
41
61
|
|
|
42
|
-
For more information: https://github.com/ptreezh/stigmergy-CLI-Multi-Agents
|
|
62
|
+
For more information: https://github.com/ptreezh/stigmergy-CLI-Multi-Agents
|
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();
|