stigmergy 1.2.6 → 1.2.8

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 (59) hide show
  1. package/README.md +32 -17
  2. package/STIGMERGY.md +16 -7
  3. package/docs/MULTI_USER_WIKI_COLLABORATION_SYSTEM.md +523 -0
  4. package/docs/PROMPT_BASED_SKILLS_SYSTEM_DESIGN.md +458 -0
  5. package/docs/SKILL_IMPLEMENTATION_CONSTRAINTS_AND_ALIGNMENT.md +423 -0
  6. package/docs/TECHNICAL_FEASIBILITY_ANALYSIS.md +308 -0
  7. package/examples/multilingual-hook-demo.js +125 -0
  8. package/package.json +14 -17
  9. package/scripts/dependency-analyzer.js +101 -0
  10. package/scripts/generate-cli-docs.js +64 -0
  11. package/scripts/postuninstall.js +46 -0
  12. package/scripts/preuninstall.js +75 -0
  13. package/scripts/run-layered-tests.js +3 -3
  14. package/src/adapters/claude/install_claude_integration.js +17 -17
  15. package/src/adapters/codebuddy/install_codebuddy_integration.js +13 -13
  16. package/src/adapters/codex/install_codex_integration.js +27 -27
  17. package/src/adapters/copilot/install_copilot_integration.js +46 -46
  18. package/src/adapters/gemini/install_gemini_integration.js +10 -10
  19. package/src/adapters/iflow/install_iflow_integration.js +7 -7
  20. package/src/adapters/qoder/install_qoder_integration.js +12 -12
  21. package/src/adapters/qwen/install_qwen_integration.js +17 -17
  22. package/src/auth.js +173 -173
  23. package/src/auth_command.js +208 -208
  24. package/src/calculator.js +313 -313
  25. package/src/cli/router.js +151 -7
  26. package/src/core/cache_cleaner.js +767 -767
  27. package/src/core/cli_help_analyzer.js +680 -680
  28. package/src/core/cli_parameter_handler.js +132 -132
  29. package/src/core/cli_tools.js +89 -89
  30. package/src/core/coordination/index.js +16 -16
  31. package/src/core/coordination/nodejs/AdapterManager.js +102 -102
  32. package/src/core/coordination/nodejs/CLCommunication.js +132 -132
  33. package/src/core/coordination/nodejs/CLIIntegrationManager.js +272 -272
  34. package/src/core/coordination/nodejs/HealthChecker.js +76 -76
  35. package/src/core/coordination/nodejs/HookDeploymentManager.js +463 -274
  36. package/src/core/coordination/nodejs/StatisticsCollector.js +71 -71
  37. package/src/core/coordination/nodejs/index.js +90 -90
  38. package/src/core/coordination/nodejs/utils/Logger.js +29 -29
  39. package/src/core/enhanced_installer.js +479 -479
  40. package/src/core/enhanced_uninstaller.js +638 -638
  41. package/src/core/error_handler.js +406 -406
  42. package/src/core/installer.js +32 -32
  43. package/src/core/memory_manager.js +83 -83
  44. package/src/core/multilingual/language-pattern-manager.js +172 -0
  45. package/src/core/rest_client.js +160 -160
  46. package/src/core/smart_router.js +261 -249
  47. package/src/core/upgrade_manager.js +48 -20
  48. package/src/data_encryption.js +143 -143
  49. package/src/data_structures.js +440 -440
  50. package/src/deploy.js +55 -55
  51. package/src/index.js +30 -30
  52. package/src/test/cli-availability-checker.js +194 -194
  53. package/src/test/test-environment.js +289 -289
  54. package/src/utils/helpers.js +35 -35
  55. package/src/utils.js +921 -921
  56. package/src/weatherProcessor.js +228 -228
  57. package/test/multilingual/hook-deployment.test.js +91 -0
  58. package/test/multilingual/language-pattern-manager.test.js +140 -0
  59. package/test/multilingual/system-test.js +85 -0
package/src/deploy.js CHANGED
@@ -1,55 +1,55 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Stigmergy Deployment Script
5
- * This script deploys hooks and integrations for all available CLI tools
6
- */
7
-
8
- const fs = require('fs').promises;
9
- const path = require('path');
10
-
11
- // Import the main Stigmergy installer
12
- const StigmergyInstaller = require('./core/installer');
13
-
14
- // Set up global error handlers using our error handler module
15
- const { setupGlobalErrorHandlers } = require('./core/error_handler');
16
- setupGlobalErrorHandlers();
17
-
18
- async function deploy() {
19
- console.log('Stigmergy Deployment Script');
20
- console.log('==========================');
21
-
22
- try {
23
- // Create installer instance
24
- const installer = new StigmergyInstaller();
25
-
26
- // Scan for available tools
27
- console.log('[SCAN] Scanning for available CLI tools...');
28
- const scanResult = await installer.scanCLI();
29
- const available = scanResult.available;
30
-
31
- // Deploy hooks for all available tools
32
- console.log('[DEPLOY] Deploying hooks for all available tools...');
33
- await installer.deployHooks(available);
34
-
35
- console.log('\n[SUCCESS] Deployment completed successfully!');
36
- return true;
37
- } catch (error) {
38
- console.error('[ERROR] Deployment failed:', error.message);
39
- return false;
40
- }
41
- }
42
-
43
- // Run deployment if called directly
44
- if (require.main === module) {
45
- deploy()
46
- .then((success) => {
47
- process.exit(success ? 0 : 1);
48
- })
49
- .catch((error) => {
50
- console.error('[FATAL ERROR]:', error.message);
51
- process.exit(1);
52
- });
53
- }
54
-
55
- module.exports = { deploy };
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Stigmergy Deployment Script
5
+ * This script deploys hooks and integrations for all available CLI tools
6
+ */
7
+
8
+ const fs = require('fs').promises;
9
+ const path = require('path');
10
+
11
+ // Import the main Stigmergy installer
12
+ const StigmergyInstaller = require('./core/installer');
13
+
14
+ // Set up global error handlers using our error handler module
15
+ const { setupGlobalErrorHandlers } = require('./core/error_handler');
16
+ setupGlobalErrorHandlers();
17
+
18
+ async function deploy() {
19
+ console.log('Stigmergy Deployment Script');
20
+ console.log('==========================');
21
+
22
+ try {
23
+ // Create installer instance
24
+ const installer = new StigmergyInstaller();
25
+
26
+ // Scan for available tools
27
+ console.log('[SCAN] Scanning for available CLI tools...');
28
+ const scanResult = await installer.scanCLI();
29
+ const available = scanResult.available;
30
+
31
+ // Deploy hooks for all available tools
32
+ console.log('[DEPLOY] Deploying hooks for all available tools...');
33
+ await installer.deployHooks(available);
34
+
35
+ console.log('\n[SUCCESS] Deployment completed successfully!');
36
+ return true;
37
+ } catch (error) {
38
+ console.error('[ERROR] Deployment failed:', error.message);
39
+ return false;
40
+ }
41
+ }
42
+
43
+ // Run deployment if called directly
44
+ if (require.main === module) {
45
+ deploy()
46
+ .then((success) => {
47
+ process.exit(success ? 0 : 1);
48
+ })
49
+ .catch((error) => {
50
+ console.error('[FATAL ERROR]:', error.message);
51
+ process.exit(1);
52
+ });
53
+ }
54
+
55
+ module.exports = { deploy };
package/src/index.js CHANGED
@@ -1,30 +1,30 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Stigmergy CLI - Multi-Agents Cross-AI CLI Tools Collaboration System
5
- * Unified Entry Point
6
- * International Version - Pure English & ANSI Only
7
- * Version: 1.0.94
8
- */
9
-
10
- // Import all components
11
- const MemoryManager = require('./core/memory_manager');
12
- const StigmergyInstaller = require('./core/installer');
13
- const { maxOfTwo, isAuthenticated } = require('./utils/helpers');
14
- const main = require('./cli/router');
15
-
16
- // Run the main application
17
- if (require.main === module) {
18
- main().catch((error) => {
19
- console.error('[FATAL] Unhandled error in Stigmergy CLI:', error);
20
- process.exit(1);
21
- });
22
- }
23
-
24
- module.exports = {
25
- MemoryManager,
26
- StigmergyInstaller,
27
- maxOfTwo,
28
- isAuthenticated,
29
- main,
30
- };
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Stigmergy CLI - Multi-Agents Cross-AI CLI Tools Collaboration System
5
+ * Unified Entry Point
6
+ * International Version - Pure English & ANSI Only
7
+ * Version: 1.0.94
8
+ */
9
+
10
+ // Import all components
11
+ const MemoryManager = require('./core/memory_manager');
12
+ const StigmergyInstaller = require('./core/installer');
13
+ const { maxOfTwo, isAuthenticated } = require('./utils/helpers');
14
+ const main = require('./cli/router');
15
+
16
+ // Run the main application
17
+ if (require.main === module) {
18
+ main().catch((error) => {
19
+ console.error('[FATAL] Unhandled error in Stigmergy CLI:', error);
20
+ process.exit(1);
21
+ });
22
+ }
23
+
24
+ module.exports = {
25
+ MemoryManager,
26
+ StigmergyInstaller,
27
+ maxOfTwo,
28
+ isAuthenticated,
29
+ main,
30
+ };
@@ -1,194 +1,194 @@
1
- /**
2
- * CLI Availability Checker
3
- * Detects which CLI tools are installed and available for testing
4
- */
5
-
6
- const { spawn } = require('child_process');
7
- const { CLI_TOOLS } = require('../../src/core/cli_tools');
8
-
9
- class CLIAvailabilityChecker {
10
- constructor() {
11
- this.checkedTools = new Map();
12
- this.timeout = 5000; // 5 seconds timeout for each check
13
- }
14
-
15
- /**
16
- * Check if a CLI tool is installed and available
17
- * @param {string} toolName - Name of the CLI tool
18
- * @returns {Promise<boolean>} True if tool is available
19
- */
20
- async isToolAvailable(toolName) {
21
- if (this.checkedTools.has(toolName)) {
22
- return this.checkedTools.get(toolName);
23
- }
24
-
25
- const tool = CLI_TOOLS[toolName];
26
- if (!tool) {
27
- this.checkedTools.set(toolName, false);
28
- return false;
29
- }
30
-
31
- try {
32
- const isAvailable = await this.checkToolExists(toolName, tool.version);
33
- this.checkedTools.set(toolName, isAvailable);
34
- return isAvailable;
35
- } catch (error) {
36
- this.checkedTools.set(toolName, false);
37
- return false;
38
- }
39
- }
40
-
41
- /**
42
- * Check if a specific command exists
43
- * @param {string} toolName - Tool name
44
- * @param {string} versionCommand - Command to check version
45
- * @returns {Promise<boolean>} True if command exists
46
- */
47
- async checkToolExists(toolName, versionCommand) {
48
- return new Promise((resolve) => {
49
- const parts = versionCommand.split(' ');
50
- const command = parts[0];
51
- const args = parts.slice(1);
52
-
53
- const child = spawn(command, args, {
54
- stdio: 'pipe',
55
- shell: true,
56
- windowsHide: true
57
- });
58
-
59
- let resolved = false;
60
- let stdout = '';
61
- let stderr = '';
62
-
63
- child.stdout?.on('data', (data) => {
64
- stdout += data.toString();
65
- });
66
-
67
- child.stderr?.on('data', (data) => {
68
- stderr += data.toString();
69
- });
70
-
71
- // Set timeout
72
- const timeoutId = setTimeout(() => {
73
- if (!resolved) {
74
- resolved = true;
75
- child.kill('SIGTERM');
76
- resolve(false);
77
- }
78
- }, this.timeout);
79
-
80
- child.on('close', (code) => {
81
- if (!resolved) {
82
- resolved = true;
83
- clearTimeout(timeoutId);
84
-
85
- // Check for serious errors
86
- if (stderr.includes('ERR_MODULE_NOT_FOUND') ||
87
- stderr.includes('Cannot find module') ||
88
- stderr.includes('command not found') ||
89
- stderr.includes('is not recognized')) {
90
- resolve(false);
91
- return;
92
- }
93
-
94
- // Consider exit code 0, 1, or 255 as success
95
- // Some CLIs return 255 for version commands
96
- // But also check that we got some output (not just empty error)
97
- const hasOutput = stdout.length > 0 || (stderr.length > 0 && !stderr.includes('Error'));
98
- resolve((code === 0 || code === 1 || code === 255) && hasOutput);
99
- }
100
- });
101
-
102
- child.on('error', () => {
103
- if (!resolved) {
104
- resolved = true;
105
- clearTimeout(timeoutId);
106
- resolve(false);
107
- }
108
- });
109
- });
110
- }
111
-
112
- /**
113
- * Get availability of all CLI tools
114
- * @returns {Promise<Object>} Map of tool availability
115
- */
116
- async checkAllTools() {
117
- const results = {};
118
- const toolNames = Object.keys(CLI_TOOLS);
119
-
120
- // Check tools sequentially to avoid conflicts
121
- for (const toolName of toolNames) {
122
- results[toolName] = await this.isToolAvailable(toolName);
123
- }
124
-
125
- return results;
126
- }
127
-
128
- /**
129
- * Get only available tools
130
- * @returns {Promise<Array>} List of available tool names
131
- */
132
- async getAvailableTools() {
133
- const allTools = await this.checkAllTools();
134
- return Object.entries(allTools)
135
- .filter(([_, available]) => available)
136
- .map(([name, _]) => name);
137
- }
138
-
139
- /**
140
- * Get installation commands for unavailable tools
141
- * @returns {Promise<Object>} Map of tool to installation command
142
- */
143
- async getInstallationCommands() {
144
- const allTools = await this.checkAllTools();
145
- const commands = {};
146
-
147
- Object.entries(allTools).forEach(([toolName, available]) => {
148
- if (!available && CLI_TOOLS[toolName]) {
149
- commands[toolName] = CLI_TOOLS[toolName].install;
150
- }
151
- });
152
-
153
- return commands;
154
- }
155
-
156
- /**
157
- * Print availability report
158
- */
159
- async printAvailabilityReport() {
160
- const allTools = await this.checkAllTools();
161
- const available = Object.entries(allTools).filter(([_, a]) => a).length;
162
- const total = Object.keys(allTools).length;
163
-
164
- console.log('\n=== CLI Tool Availability Report ===');
165
- console.log(`Available: ${available}/${total}\n`);
166
-
167
- console.log('�?Available Tools:');
168
- Object.entries(allTools)
169
- .filter(([_, available]) => available)
170
- .forEach(([toolName, _]) => {
171
- console.log(` - ${toolName}`);
172
- });
173
-
174
- const unavailable = Object.entries(allTools).filter(([_, a]) => !a);
175
- if (unavailable.length > 0) {
176
- console.log('\n�?Unavailable Tools:');
177
- unavailable.forEach(([toolName, _]) => {
178
- console.log(` - ${toolName}`);
179
- console.log(` Install: ${CLI_TOOLS[toolName].install}`);
180
- });
181
- }
182
-
183
- console.log('=====================================\n');
184
- }
185
-
186
- /**
187
- * Clear cache of checked tools
188
- */
189
- clearCache() {
190
- this.checkedTools.clear();
191
- }
192
- }
193
-
194
- module.exports = CLIAvailabilityChecker;
1
+ /**
2
+ * CLI Availability Checker
3
+ * Detects which CLI tools are installed and available for testing
4
+ */
5
+
6
+ const { spawn } = require('child_process');
7
+ const { CLI_TOOLS } = require('../../src/core/cli_tools');
8
+
9
+ class CLIAvailabilityChecker {
10
+ constructor() {
11
+ this.checkedTools = new Map();
12
+ this.timeout = 5000; // 5 seconds timeout for each check
13
+ }
14
+
15
+ /**
16
+ * Check if a CLI tool is installed and available
17
+ * @param {string} toolName - Name of the CLI tool
18
+ * @returns {Promise<boolean>} True if tool is available
19
+ */
20
+ async isToolAvailable(toolName) {
21
+ if (this.checkedTools.has(toolName)) {
22
+ return this.checkedTools.get(toolName);
23
+ }
24
+
25
+ const tool = CLI_TOOLS[toolName];
26
+ if (!tool) {
27
+ this.checkedTools.set(toolName, false);
28
+ return false;
29
+ }
30
+
31
+ try {
32
+ const isAvailable = await this.checkToolExists(toolName, tool.version);
33
+ this.checkedTools.set(toolName, isAvailable);
34
+ return isAvailable;
35
+ } catch (error) {
36
+ this.checkedTools.set(toolName, false);
37
+ return false;
38
+ }
39
+ }
40
+
41
+ /**
42
+ * Check if a specific command exists
43
+ * @param {string} toolName - Tool name
44
+ * @param {string} versionCommand - Command to check version
45
+ * @returns {Promise<boolean>} True if command exists
46
+ */
47
+ async checkToolExists(toolName, versionCommand) {
48
+ return new Promise((resolve) => {
49
+ const parts = versionCommand.split(' ');
50
+ const command = parts[0];
51
+ const args = parts.slice(1);
52
+
53
+ const child = spawn(command, args, {
54
+ stdio: 'pipe',
55
+ shell: true,
56
+ windowsHide: true
57
+ });
58
+
59
+ let resolved = false;
60
+ let stdout = '';
61
+ let stderr = '';
62
+
63
+ child.stdout?.on('data', (data) => {
64
+ stdout += data.toString();
65
+ });
66
+
67
+ child.stderr?.on('data', (data) => {
68
+ stderr += data.toString();
69
+ });
70
+
71
+ // Set timeout
72
+ const timeoutId = setTimeout(() => {
73
+ if (!resolved) {
74
+ resolved = true;
75
+ child.kill('SIGTERM');
76
+ resolve(false);
77
+ }
78
+ }, this.timeout);
79
+
80
+ child.on('close', (code) => {
81
+ if (!resolved) {
82
+ resolved = true;
83
+ clearTimeout(timeoutId);
84
+
85
+ // Check for serious errors
86
+ if (stderr.includes('ERR_MODULE_NOT_FOUND') ||
87
+ stderr.includes('Cannot find module') ||
88
+ stderr.includes('command not found') ||
89
+ stderr.includes('is not recognized')) {
90
+ resolve(false);
91
+ return;
92
+ }
93
+
94
+ // Consider exit code 0, 1, or 255 as success
95
+ // Some CLIs return 255 for version commands
96
+ // But also check that we got some output (not just empty error)
97
+ const hasOutput = stdout.length > 0 || (stderr.length > 0 && !stderr.includes('Error'));
98
+ resolve((code === 0 || code === 1 || code === 255) && hasOutput);
99
+ }
100
+ });
101
+
102
+ child.on('error', () => {
103
+ if (!resolved) {
104
+ resolved = true;
105
+ clearTimeout(timeoutId);
106
+ resolve(false);
107
+ }
108
+ });
109
+ });
110
+ }
111
+
112
+ /**
113
+ * Get availability of all CLI tools
114
+ * @returns {Promise<Object>} Map of tool availability
115
+ */
116
+ async checkAllTools() {
117
+ const results = {};
118
+ const toolNames = Object.keys(CLI_TOOLS);
119
+
120
+ // Check tools sequentially to avoid conflicts
121
+ for (const toolName of toolNames) {
122
+ results[toolName] = await this.isToolAvailable(toolName);
123
+ }
124
+
125
+ return results;
126
+ }
127
+
128
+ /**
129
+ * Get only available tools
130
+ * @returns {Promise<Array>} List of available tool names
131
+ */
132
+ async getAvailableTools() {
133
+ const allTools = await this.checkAllTools();
134
+ return Object.entries(allTools)
135
+ .filter(([_, available]) => available)
136
+ .map(([name, _]) => name);
137
+ }
138
+
139
+ /**
140
+ * Get installation commands for unavailable tools
141
+ * @returns {Promise<Object>} Map of tool to installation command
142
+ */
143
+ async getInstallationCommands() {
144
+ const allTools = await this.checkAllTools();
145
+ const commands = {};
146
+
147
+ Object.entries(allTools).forEach(([toolName, available]) => {
148
+ if (!available && CLI_TOOLS[toolName]) {
149
+ commands[toolName] = CLI_TOOLS[toolName].install;
150
+ }
151
+ });
152
+
153
+ return commands;
154
+ }
155
+
156
+ /**
157
+ * Print availability report
158
+ */
159
+ async printAvailabilityReport() {
160
+ const allTools = await this.checkAllTools();
161
+ const available = Object.entries(allTools).filter(([_, a]) => a).length;
162
+ const total = Object.keys(allTools).length;
163
+
164
+ console.log('\n=== CLI Tool Availability Report ===');
165
+ console.log(`Available: ${available}/${total}\n`);
166
+
167
+ console.log('�?Available Tools:');
168
+ Object.entries(allTools)
169
+ .filter(([_, available]) => available)
170
+ .forEach(([toolName, _]) => {
171
+ console.log(` - ${toolName}`);
172
+ });
173
+
174
+ const unavailable = Object.entries(allTools).filter(([_, a]) => !a);
175
+ if (unavailable.length > 0) {
176
+ console.log('\n�?Unavailable Tools:');
177
+ unavailable.forEach(([toolName, _]) => {
178
+ console.log(` - ${toolName}`);
179
+ console.log(` Install: ${CLI_TOOLS[toolName].install}`);
180
+ });
181
+ }
182
+
183
+ console.log('=====================================\n');
184
+ }
185
+
186
+ /**
187
+ * Clear cache of checked tools
188
+ */
189
+ clearCache() {
190
+ this.checkedTools.clear();
191
+ }
192
+ }
193
+
194
+ module.exports = CLIAvailabilityChecker;