stigmergy 1.2.0 → 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 (130) hide show
  1. package/LICENSE +18 -18
  2. package/README.md +31 -211
  3. package/STIGMERGY.md +70 -61
  4. package/docs/MULTI_USER_WIKI_COLLABORATION_SYSTEM.md +523 -0
  5. package/docs/PROJECT_CONSTITUTION.md +433 -433
  6. package/docs/PROJECT_STRUCTURE_CURRENT.md +80 -80
  7. package/docs/PROMPT_BASED_SKILLS_SYSTEM_DESIGN.md +458 -0
  8. package/docs/SKILL_IMPLEMENTATION_CONSTRAINTS_AND_ALIGNMENT.md +423 -0
  9. package/docs/TECHNICAL_FEASIBILITY_ANALYSIS.md +308 -0
  10. package/examples/calculator-example.js +72 -72
  11. package/examples/cline_usage_examples.md +364 -364
  12. package/examples/encryption-example.js +67 -67
  13. package/examples/json-parser-example.js +120 -120
  14. package/examples/json-validation-example.js +64 -64
  15. package/examples/multilingual-hook-demo.js +125 -0
  16. package/examples/rest-client-example.js +52 -52
  17. package/examples/rest_client_example.js +54 -54
  18. package/package.json +38 -20
  19. package/scripts/build.js +74 -74
  20. package/scripts/dependency-analyzer.js +101 -0
  21. package/scripts/generate-cli-docs.js +64 -0
  22. package/scripts/post-deployment-config.js +296 -296
  23. package/scripts/postuninstall.js +46 -0
  24. package/scripts/preinstall-check.js +173 -173
  25. package/scripts/preuninstall.js +75 -0
  26. package/scripts/publish.js +58 -268
  27. package/scripts/run-layered-tests.js +247 -0
  28. package/scripts/safe-install.js +139 -139
  29. package/scripts/simple-publish.js +57 -59
  30. package/src/adapters/claude/install_claude_integration.js +292 -0
  31. package/src/adapters/codebuddy/install_codebuddy_integration.js +349 -0
  32. package/src/adapters/codex/install_codex_integration.js +395 -0
  33. package/src/adapters/copilot/install_copilot_integration.js +716 -0
  34. package/src/adapters/gemini/install_gemini_integration.js +304 -0
  35. package/src/adapters/iflow/install_iflow_integration.js +304 -0
  36. package/src/adapters/qoder/install_qoder_integration.js +1090 -0
  37. package/src/adapters/qwen/install_qwen_integration.js +285 -0
  38. package/src/cli/router.js +562 -39
  39. package/src/core/cache_cleaner.js +82 -59
  40. package/src/core/cli_help_analyzer.js +297 -291
  41. package/src/core/cli_parameter_handler.js +5 -0
  42. package/src/core/cli_tools.js +6 -6
  43. package/src/core/coordination/index.js +2 -2
  44. package/src/core/coordination/nodejs/AdapterManager.js +30 -17
  45. package/src/core/coordination/nodejs/CLCommunication.js +28 -20
  46. package/src/core/coordination/nodejs/CLIIntegrationManager.js +72 -36
  47. package/src/core/coordination/nodejs/HealthChecker.js +13 -14
  48. package/src/core/coordination/nodejs/HookDeploymentManager.js +325 -63
  49. package/src/core/coordination/nodejs/StatisticsCollector.js +6 -6
  50. package/src/core/coordination/nodejs/index.js +29 -11
  51. package/src/core/coordination/nodejs/utils/Logger.js +1 -1
  52. package/src/core/enhanced_installer.js +92 -69
  53. package/src/core/enhanced_uninstaller.js +73 -53
  54. package/src/core/installer.js +815 -294
  55. package/src/core/multilingual/language-pattern-manager.js +172 -0
  56. package/src/core/smart_router.js +141 -26
  57. package/src/core/upgrade_manager.js +91 -46
  58. package/src/data_structures.js +1 -1
  59. package/src/deploy.js +2 -2
  60. package/src/index.js +3 -3
  61. package/src/test/cli-availability-checker.js +194 -0
  62. package/src/test/test-environment.js +289 -0
  63. package/src/utils/helpers.js +2 -2
  64. package/src/utils.js +7 -1
  65. package/test/multilingual/hook-deployment.test.js +91 -0
  66. package/test/multilingual/language-pattern-manager.test.js +140 -0
  67. package/test/multilingual/system-test.js +85 -0
  68. package/test/cache-cleaner-implemented.test.js +0 -328
  69. package/test/cache-cleaner.test.js +0 -390
  70. package/test/calculator.test.js +0 -215
  71. package/test/collision-test.js +0 -26
  72. package/test/comprehensive-enhanced-features.test.js +0 -252
  73. package/test/comprehensive-execution-test.js +0 -428
  74. package/test/conflict-prevention-test.js +0 -95
  75. package/test/cross-cli-detection-test.js +0 -33
  76. package/test/csv-processing-test.js +0 -36
  77. package/test/deploy-hooks-test.js +0 -250
  78. package/test/e2e/claude-cli-test.js +0 -128
  79. package/test/e2e/collaboration-test.js +0 -75
  80. package/test/e2e/comprehensive-test.js +0 -431
  81. package/test/e2e/error-handling-test.js +0 -90
  82. package/test/e2e/individual-tool-test.js +0 -143
  83. package/test/e2e/other-cli-test.js +0 -130
  84. package/test/e2e/qoder-cli-test.js +0 -128
  85. package/test/e2e/run-e2e-tests.js +0 -73
  86. package/test/e2e/test-data.js +0 -88
  87. package/test/e2e/test-utils.js +0 -222
  88. package/test/encryption-simple-test.js +0 -110
  89. package/test/encryption.test.js +0 -129
  90. package/test/enhanced-main-alignment.test.js +0 -298
  91. package/test/enhanced-uninstaller-implemented.test.js +0 -271
  92. package/test/enhanced-uninstaller.test.js +0 -284
  93. package/test/error-handling-test.js +0 -341
  94. package/test/fibonacci.test.js +0 -178
  95. package/test/final-deploy-test.js +0 -221
  96. package/test/final-install-test.js +0 -226
  97. package/test/hash-table-demo.js +0 -33
  98. package/test/hash-table-test.js +0 -26
  99. package/test/hash_table_test.js +0 -114
  100. package/test/hook-system-integration-test.js +0 -307
  101. package/test/iflow-integration-test.js +0 -292
  102. package/test/improved-install-test.js +0 -362
  103. package/test/install-command-test.js +0 -370
  104. package/test/json-parser-test.js +0 -161
  105. package/test/json-validation-test.js +0 -164
  106. package/test/natural-language-skills-test.js +0 -320
  107. package/test/nl-integration-test.js +0 -179
  108. package/test/parameter-parsing-test.js +0 -143
  109. package/test/plugin-deployment-test.js +0 -316
  110. package/test/postinstall-test.js +0 -269
  111. package/test/python-plugins-test.js +0 -259
  112. package/test/real-test.js +0 -435
  113. package/test/remaining-adapters-test.js +0 -256
  114. package/test/rest-client-test.js +0 -56
  115. package/test/rest_client.test.js +0 -85
  116. package/test/safe-installation-cleaner.test.js +0 -343
  117. package/test/simple-iflow-hook-test.js +0 -137
  118. package/test/stigmergy-upgrade-test.js +0 -243
  119. package/test/system-compatibility-test.js +0 -467
  120. package/test/tdd-deploy-fix-test.js +0 -324
  121. package/test/tdd-fixes-test.js +0 -211
  122. package/test/third-party-skills-test.js +0 -321
  123. package/test/tool-selection-integration-test.js +0 -158
  124. package/test/unit/calculator-full.test.js +0 -191
  125. package/test/unit/calculator-simple.test.js +0 -96
  126. package/test/unit/calculator.test.js +0 -97
  127. package/test/unit/cli-scanner.test.js +0 -291
  128. package/test/unit/cli_parameter_handler.test.js +0 -116
  129. package/test/unit/cross-cli-executor.test.js +0 -399
  130. package/test/weather-processor.test.js +0 -104
@@ -1,362 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Improved Test for CLI Installation with Better Error Handling
5
- * This test verifies installation commands with improved error handling
6
- * and Windows compatibility
7
- */
8
-
9
- const { spawnSync, spawn } = require('child_process');
10
- const path = require('path');
11
- const os = require('os');
12
-
13
- class ImprovedInstallTester {
14
- constructor() {
15
- this.testResults = [];
16
- }
17
-
18
- // Test 1: Verify npm availability with multiple methods
19
- async testNpmAvailability() {
20
- console.log('[TEST 1] Verifying npm availability with multiple methods...');
21
-
22
- try {
23
- // Method 1: Direct npm command
24
- console.log(' Testing direct npm command...');
25
- const npmDirect = spawnSync('npm', ['--version'], {
26
- encoding: 'utf8',
27
- timeout: 10000
28
- });
29
-
30
- console.log(` Direct npm - Status: ${npmDirect.status}`);
31
- if (npmDirect.stdout) {
32
- console.log(` Direct npm - Version: ${npmDirect.stdout.trim()}`);
33
- }
34
-
35
- // Method 2: npm through cmd.exe on Windows
36
- const isWindows = process.platform === 'win32';
37
- let npmThroughCmd = { status: null };
38
-
39
- if (isWindows) {
40
- console.log(' Testing npm through cmd.exe...');
41
- npmThroughCmd = spawnSync('cmd.exe', ['/c', 'npm', '--version'], {
42
- encoding: 'utf8',
43
- timeout: 10000
44
- });
45
- console.log(` npm through cmd.exe - Status: ${npmThroughCmd.status}`);
46
- }
47
-
48
- // Method 3: Check PATH for npm
49
- console.log(' Checking PATH for npm...');
50
- const pathEnv = process.env.PATH || '';
51
- const hasNpmInPath = pathEnv.toLowerCase().includes('npm');
52
- console.log(` npm in PATH: ${hasNpmInPath}`);
53
-
54
- const npmAvailable = npmDirect.status === 0 || npmThroughCmd.status === 0;
55
-
56
- this.testResults.push({
57
- name: 'npm Availability',
58
- passed: npmAvailable,
59
- details: `Direct: ${npmDirect.status === 0}, Cmd: ${npmThroughCmd.status === 0}, PATH: ${hasNpmInPath}`
60
- });
61
-
62
- return npmAvailable;
63
- } catch (error) {
64
- console.log(` ✗ Failed to check npm availability: ${error.message}`);
65
- this.testResults.push({
66
- name: 'npm Availability',
67
- passed: false,
68
- details: `Failed to check: ${error.message}`
69
- });
70
- return false;
71
- }
72
- }
73
-
74
- // Test 2: Test Qoder CLI installation with shell options
75
- async testQoderInstallationWithShellOptions() {
76
- console.log('\n[TEST 2] Testing Qoder CLI installation with shell options...');
77
-
78
- try {
79
- const installCommand = 'npm install -g @qoder-ai/qodercli';
80
- const commandParts = installCommand.split(' ');
81
- const command = commandParts[0];
82
- const args = commandParts.slice(1);
83
-
84
- console.log(` Installation command: ${installCommand}`);
85
-
86
- // Test 1: Without shell option
87
- console.log(' Testing without shell option...');
88
- const test1 = spawnSync(command, args, {
89
- encoding: 'utf8',
90
- timeout: 15000,
91
- stdio: 'pipe'
92
- });
93
-
94
- console.log(` Without shell - Status: ${test1.status}`);
95
-
96
- // Test 2: With shell=true
97
- console.log(' Testing with shell=true...');
98
- const test2 = spawnSync(command, args, {
99
- encoding: 'utf8',
100
- timeout: 15000,
101
- stdio: 'pipe',
102
- shell: true
103
- });
104
-
105
- console.log(` With shell - Status: ${test2.status}`);
106
-
107
- // Test 3: On Windows, try cmd.exe explicitly
108
- let test3 = { status: null };
109
- if (process.platform === 'win32') {
110
- console.log(' Testing with explicit cmd.exe...');
111
- const fullCommand = [command, ...args].join(' ');
112
- test3 = spawnSync('cmd.exe', ['/c', fullCommand], {
113
- encoding: 'utf8',
114
- timeout: 15000,
115
- stdio: 'pipe'
116
- });
117
- console.log(` Explicit cmd.exe - Status: ${test3.status}`);
118
- }
119
-
120
- // Determine which method works
121
- const worksWithoutShell = test1.status === 0;
122
- const worksWithShell = test2.status === 0;
123
- const worksWithCmd = test3.status === 0;
124
-
125
- console.log(` Results - Without shell: ${worksWithoutShell}, With shell: ${worksWithShell}, With cmd: ${worksWithCmd}`);
126
-
127
- this.testResults.push({
128
- name: 'Qoder Installation Shell Options',
129
- passed: worksWithoutShell || worksWithShell || worksWithCmd,
130
- details: `Without shell: ${worksWithoutShell}, With shell: ${worksWithShell}, With cmd: ${worksWithCmd}`
131
- });
132
-
133
- return worksWithoutShell || worksWithShell || worksWithCmd;
134
- } catch (error) {
135
- console.log(` ✗ Failed to test installation with shell options: ${error.message}`);
136
- this.testResults.push({
137
- name: 'Qoder Installation Shell Options',
138
- passed: false,
139
- details: `Failed to test: ${error.message}`
140
- });
141
- return false;
142
- }
143
- }
144
-
145
- // Test 3: Test spawn vs spawnSync behavior
146
- async testSpawnVsSpawnSync() {
147
- console.log('\n[TEST 3] Testing spawn vs spawnSync behavior...');
148
-
149
- try {
150
- const command = 'npm';
151
- const args = ['--version'];
152
-
153
- // Test spawnSync
154
- console.log(' Testing spawnSync...');
155
- const syncResult = spawnSync(command, args, {
156
- encoding: 'utf8',
157
- timeout: 10000,
158
- shell: true
159
- });
160
-
161
- console.log(` spawnSync - Status: ${syncResult.status}`);
162
-
163
- // Test spawn
164
- console.log(' Testing spawn...');
165
- const spawnResult = await new Promise((resolve) => {
166
- const child = spawn(command, args, {
167
- encoding: 'utf8',
168
- timeout: 10000,
169
- shell: true
170
- });
171
-
172
- let stdout = '';
173
- let stderr = '';
174
-
175
- child.stdout.on('data', (data) => {
176
- stdout += data.toString();
177
- });
178
-
179
- child.stderr.on('data', (data) => {
180
- stderr += data.toString();
181
- });
182
-
183
- child.on('close', (code) => {
184
- resolve({
185
- status: code,
186
- stdout: stdout,
187
- stderr: stderr
188
- });
189
- });
190
-
191
- child.on('error', (error) => {
192
- resolve({
193
- status: null,
194
- error: error.message
195
- });
196
- });
197
-
198
- // Timeout
199
- setTimeout(() => {
200
- child.kill();
201
- resolve({
202
- status: null,
203
- error: 'Timeout'
204
- });
205
- }, 11000);
206
- });
207
-
208
- console.log(` spawn - Status: ${spawnResult.status}`);
209
- if (spawnResult.error) {
210
- console.log(` spawn - Error: ${spawnResult.error}`);
211
- }
212
-
213
- const bothWork = syncResult.status === 0 && spawnResult.status === 0;
214
-
215
- this.testResults.push({
216
- name: 'Spawn vs SpawnSync',
217
- passed: bothWork,
218
- details: `spawnSync: ${syncResult.status}, spawn: ${spawnResult.status}`
219
- });
220
-
221
- return bothWork;
222
- } catch (error) {
223
- console.log(` ✗ Failed to test spawn behavior: ${error.message}`);
224
- this.testResults.push({
225
- name: 'Spawn vs SpawnSync',
226
- passed: false,
227
- details: `Failed to test: ${error.message}`
228
- });
229
- return false;
230
- }
231
- }
232
-
233
- // Test 4: Verify current installation implementation issues
234
- async testCurrentInstallationImplementation() {
235
- console.log('\n[TEST 4] Verifying current installation implementation...');
236
-
237
- try {
238
- // Simulate the current implementation from main_english.js
239
- const toolInfo = {
240
- name: 'Qoder CLI',
241
- install: 'npm install -g @qoder-ai/qodercli'
242
- };
243
-
244
- console.log(` Simulating current implementation for: ${toolInfo.name}`);
245
- console.log(` Install command: ${toolInfo.install}`);
246
-
247
- const installCmd = toolInfo.install.split(' ');
248
- console.log(` Command parts: ${JSON.stringify(installCmd)}`);
249
-
250
- // Current implementation (similar to lines 512-518 in main_english.js)
251
- console.log(' Testing current implementation approach...');
252
- const result = spawnSync(installCmd[0], installCmd.slice(1), {
253
- encoding: 'utf8',
254
- timeout: 300000, // 5 minutes
255
- stdio: 'pipe', // Changed from 'inherit' to 'pipe' for testing
256
- env: process.env
257
- });
258
-
259
- console.log(` Current implementation - Status: ${result.status}`);
260
- if (result.error) {
261
- console.log(` Current implementation - Error: ${result.error.message}`);
262
- }
263
- if (result.stderr && result.stderr.length > 0) {
264
- const stderrPreview = result.stderr.substring(0, 200);
265
- console.log(` Current implementation - Stderr preview: ${stderrPreview}${result.stderr.length > 200 ? '...' : ''}`);
266
- }
267
-
268
- // Test with shell=true
269
- console.log(' Testing current implementation with shell=true...');
270
- const resultWithShell = spawnSync(installCmd[0], installCmd.slice(1), {
271
- encoding: 'utf8',
272
- timeout: 300000,
273
- stdio: 'pipe',
274
- env: process.env,
275
- shell: true
276
- });
277
-
278
- console.log(` Current implementation with shell - Status: ${resultWithShell.status}`);
279
- if (resultWithShell.error) {
280
- console.log(` Current implementation with shell - Error: ${resultWithShell.error.message}`);
281
- }
282
- if (resultWithShell.stderr && resultWithShell.stderr.length > 0) {
283
- const stderrPreview = resultWithShell.stderr.substring(0, 200);
284
- console.log(` Current implementation with shell - Stderr preview: ${stderrPreview}${resultWithShell.stderr.length > 200 ? '...' : ''}`);
285
- }
286
-
287
- this.testResults.push({
288
- name: 'Current Installation Implementation',
289
- passed: result.status === 0 || resultWithShell.status === 0,
290
- details: `Without shell: ${result.status}, With shell: ${resultWithShell.status}`
291
- });
292
-
293
- return result.status === 0 || resultWithShell.status === 0;
294
- } catch (error) {
295
- console.log(` ✗ Failed to test current implementation: ${error.message}`);
296
- this.testResults.push({
297
- name: 'Current Installation Implementation',
298
- passed: false,
299
- details: `Failed to test: ${error.message}`
300
- });
301
- return false;
302
- }
303
- }
304
-
305
- // Run all tests
306
- async runAllTests() {
307
- console.log('Improved CLI Installation Test');
308
- console.log('='.repeat(40));
309
-
310
- await this.testNpmAvailability();
311
- await this.testQoderInstallationWithShellOptions();
312
- await this.testSpawnVsSpawnSync();
313
- await this.testCurrentInstallationImplementation();
314
-
315
- // Summary
316
- console.log('\n' + '='.repeat(40));
317
- console.log('Improved Installation Test Summary:');
318
- console.log('='.repeat(40));
319
-
320
- let passedTests = 0;
321
- this.testResults.forEach(result => {
322
- console.log(`${result.name}: ${result.passed ? '✓ PASS' : '✗ FAIL'} - ${result.details}`);
323
- if (result.passed) passedTests++;
324
- });
325
-
326
- console.log(`\nOverall Result: ${passedTests}/${this.testResults.length} tests passed`);
327
-
328
- if (passedTests === this.testResults.length) {
329
- console.log('✓ All improved installation tests passed!');
330
- } else if (passedTests > 0) {
331
- console.log('⚠ Some improved installation tests passed.');
332
- } else {
333
- console.log('✗ All improved installation tests failed.');
334
- }
335
-
336
- return {
337
- totalTests: this.testResults.length,
338
- passedTests: passedTests,
339
- results: this.testResults
340
- };
341
- }
342
- }
343
-
344
- // Run the tests
345
- async function runImprovedInstallTests() {
346
- const tester = new ImprovedInstallTester();
347
- const results = await tester.runAllTests();
348
- return results;
349
- }
350
-
351
- // Export for use in other modules
352
- module.exports = { ImprovedInstallTester };
353
-
354
- // Run if called directly
355
- if (require.main === module) {
356
- runImprovedInstallTests().then(results => {
357
- process.exit(results.passedTests === results.totalTests ? 0 : 1);
358
- }).catch(error => {
359
- console.error('[Test Failed]:', error.message);
360
- process.exit(1);
361
- });
362
- }