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,431 +0,0 @@
1
- // Comprehensive End-to-End Test Suite
2
- const { executeCommand, recordTestResult, getTestSummary, saveTestReport, logFilePath, wait } = require('./test-utils');
3
- const testData = require('./test-data');
4
-
5
- async function runComprehensiveTest() {
6
- console.log('Stigmergy CLI Comprehensive End-to-End Testing');
7
- console.log('=============================================\n');
8
-
9
- try {
10
- // Test 1: Individual tool functionality
11
- await testIndividualToolFunctionality();
12
-
13
- // Test 2: Collaboration scenarios
14
- await testCollaborationScenarios();
15
-
16
- // Test 3: Error handling
17
- await testErrorHandling();
18
-
19
- // Test 4: Advanced features
20
- await testAdvancedFeatures();
21
-
22
- // Generate final report
23
- const summary = getTestSummary();
24
- const { reportPath, summaryPath } = saveTestReport();
25
-
26
- console.log('\n' + '='.repeat(50));
27
- console.log('COMPREHENSIVE TEST RESULTS');
28
- console.log('='.repeat(50));
29
- console.log(`Total Tests: ${summary.total}`);
30
- console.log(`Passed: ${summary.passed}`);
31
- console.log(`Failed: ${summary.failed}`);
32
- console.log(`Pass Rate: ${summary.passRate}%`);
33
- console.log(`Detailed Report: ${reportPath}`);
34
- console.log(`Summary Report: ${summaryPath}`);
35
- console.log(`Full Log: ${logFilePath}`);
36
- console.log('='.repeat(50));
37
-
38
- // Exit with appropriate code
39
- process.exit(summary.failed > 0 ? 1 : 0);
40
-
41
- } catch (error) {
42
- console.error('Test execution failed:', error);
43
- process.exit(1);
44
- }
45
- }
46
-
47
- async function testIndividualToolFunctionality() {
48
- console.log('Starting individual tool functionality testing...\n');
49
-
50
- // Test each tool with simple code generation
51
- for (const [tool, prompt] of Object.entries(testData.simpleCodeGeneration)) {
52
- console.log(`\n--- Testing ${tool} with simple code generation ---`);
53
-
54
- try {
55
- const result = await executeCommand(`stigmergy call "${prompt}"`, 45000);
56
-
57
- // Check if the command executed successfully
58
- const passed = result.success &&
59
- result.stdout.length > 50 && // At least some content
60
- !result.stdout.includes('Error') &&
61
- !result.stdout.includes('error');
62
-
63
- recordTestResult(`${tool} - Simple Code Generation`, passed, {
64
- command: result.command,
65
- executionTime: result.executionTime,
66
- outputLength: result.stdout.length,
67
- hasError: !result.success || result.stderr.length > 0
68
- });
69
-
70
- // Log result summary
71
- console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
72
- console.log(` Execution time: ${result.executionTime}ms`);
73
- console.log(` Output length: ${result.stdout.length} characters`);
74
-
75
- } catch (error) {
76
- recordTestResult(`${tool} - Simple Code Generation`, false, {
77
- error: error.message
78
- });
79
- console.log(` Result: FAIL - ${error.message}`);
80
- }
81
- }
82
-
83
- // Test each tool with complex code generation
84
- for (const [tool, prompt] of Object.entries(testData.complexCodeGeneration)) {
85
- console.log(`\n--- Testing ${tool} with complex code generation ---`);
86
-
87
- try {
88
- const result = await executeCommand(`stigmergy call "${prompt}"`, 60000);
89
-
90
- // Check if the command executed successfully
91
- const passed = result.success &&
92
- result.stdout.length > 100 && // More content for complex tasks
93
- !result.stdout.includes('Error') &&
94
- !result.stdout.includes('error');
95
-
96
- recordTestResult(`${tool} - Complex Code Generation`, passed, {
97
- command: result.command,
98
- executionTime: result.executionTime,
99
- outputLength: result.stdout.length,
100
- hasError: !result.success || result.stderr.length > 0
101
- });
102
-
103
- // Log result summary
104
- console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
105
- console.log(` Execution time: ${result.executionTime}ms`);
106
- console.log(` Output length: ${result.stdout.length} characters`);
107
-
108
- } catch (error) {
109
- recordTestResult(`${tool} - Complex Code Generation`, false, {
110
- error: error.message
111
- });
112
- console.log(` Result: FAIL - ${error.message}`);
113
- }
114
- }
115
-
116
- // Test each tool with analysis task
117
- for (const [tool, prompt] of Object.entries(testData.analysis)) {
118
- console.log(`\n--- Testing ${tool} with analysis task ---`);
119
-
120
- try {
121
- const result = await executeCommand(`stigmergy call "${prompt}"`, 45000);
122
-
123
- // Check if the command executed successfully
124
- const passed = result.success &&
125
- result.stdout.length > 50 &&
126
- !result.stdout.includes('Error') &&
127
- !result.stdout.includes('error');
128
-
129
- recordTestResult(`${tool} - Analysis Task`, passed, {
130
- command: result.command,
131
- executionTime: result.executionTime,
132
- outputLength: result.stdout.length,
133
- hasError: !result.success || result.stderr.length > 0
134
- });
135
-
136
- // Log result summary
137
- console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
138
- console.log(` Execution time: ${result.executionTime}ms`);
139
- console.log(` Output length: ${result.stdout.length} characters`);
140
-
141
- } catch (error) {
142
- recordTestResult(`${tool} - Analysis Task`, false, {
143
- error: error.message
144
- });
145
- console.log(` Result: FAIL - ${error.message}`);
146
- }
147
- }
148
-
149
- // Test each tool with documentation task
150
- for (const [tool, prompt] of Object.entries(testData.documentation)) {
151
- console.log(`\n--- Testing ${tool} with documentation task ---`);
152
-
153
- try {
154
- const result = await executeCommand(`stigmergy call "${prompt}"`, 45000);
155
-
156
- // Check if the command executed successfully
157
- const passed = result.success &&
158
- result.stdout.length > 50 &&
159
- !result.stdout.includes('Error') &&
160
- !result.stdout.includes('error');
161
-
162
- recordTestResult(`${tool} - Documentation Task`, passed, {
163
- command: result.command,
164
- executionTime: result.executionTime,
165
- outputLength: result.stdout.length,
166
- hasError: !result.success || result.stderr.length > 0
167
- });
168
-
169
- // Log result summary
170
- console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
171
- console.log(` Execution time: ${result.executionTime}ms`);
172
- console.log(` Output length: ${result.stdout.length} characters`);
173
-
174
- } catch (error) {
175
- recordTestResult(`${tool} - Documentation Task`, false, {
176
- error: error.message
177
- });
178
- console.log(` Result: FAIL - ${error.message}`);
179
- }
180
- }
181
-
182
- console.log('\n--- Individual tool functionality testing completed ---\n');
183
- }
184
-
185
- async function testCollaborationScenarios() {
186
- console.log('Starting collaboration scenarios testing...\n');
187
-
188
- // Test each collaboration scenario
189
- for (const scenario of testData.collaborationScenarios) {
190
- console.log(`\n--- Testing ${scenario.name} ---`);
191
-
192
- let allStepsPassed = true;
193
- const stepResults = [];
194
-
195
- // Execute each step in the scenario
196
- for (let i = 0; i < scenario.steps.length; i++) {
197
- const step = scenario.steps[i];
198
- console.log(` Step ${i + 1}: ${step}`);
199
-
200
- try {
201
- const result = await executeCommand(`stigmergy call "${step}"`, 60000);
202
-
203
- // Check if the command executed successfully
204
- const stepPassed = result.success &&
205
- result.stdout.length > 30 &&
206
- !result.stdout.includes('Error') &&
207
- !result.stdout.includes('error');
208
-
209
- stepResults.push({
210
- step: i + 1,
211
- command: step,
212
- passed: stepPassed,
213
- executionTime: result.executionTime,
214
- outputLength: result.stdout.length
215
- });
216
-
217
- if (!stepPassed) {
218
- allStepsPassed = false;
219
- }
220
-
221
- // Log result summary
222
- console.log(` Result: ${stepPassed ? 'PASS' : 'FAIL'}`);
223
- console.log(` Execution time: ${result.executionTime}ms`);
224
- console.log(` Output length: ${result.stdout.length} characters`);
225
-
226
- // Wait a bit between steps to avoid overwhelming the system
227
- await wait(2000);
228
-
229
- } catch (error) {
230
- stepResults.push({
231
- step: i + 1,
232
- command: step,
233
- passed: false,
234
- error: error.message
235
- });
236
-
237
- allStepsPassed = false;
238
- console.log(` Result: FAIL - ${error.message}`);
239
- }
240
- }
241
-
242
- // Record overall scenario result
243
- recordTestResult(`Collaboration - ${scenario.name}`, allStepsPassed, {
244
- steps: stepResults,
245
- totalSteps: scenario.steps.length,
246
- passedSteps: stepResults.filter(s => s.passed).length
247
- });
248
-
249
- console.log(` Overall: ${allStepsPassed ? 'PASS' : 'FAIL'}`);
250
- }
251
-
252
- console.log('\n--- Collaboration scenarios testing completed ---\n');
253
- }
254
-
255
- async function testErrorHandling() {
256
- console.log('Starting error handling testing...\n');
257
-
258
- // Test invalid tool
259
- console.log('\n--- Testing invalid tool handling ---');
260
- try {
261
- const result = await executeCommand(`stigmergy call "${testData.errorHandling.invalidTool}"`, 30000);
262
-
263
- // Should fail gracefully
264
- const passed = !result.success &&
265
- (result.stderr.includes('not found') ||
266
- result.stderr.includes('Error') ||
267
- result.stdout.includes('Error'));
268
-
269
- recordTestResult('Error Handling - Invalid Tool', passed, {
270
- command: result.command,
271
- executionTime: result.executionTime,
272
- stdoutLength: result.stdout.length,
273
- stderrLength: result.stderr.length,
274
- hasErrorOutput: result.stderr.length > 0
275
- });
276
-
277
- console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
278
- console.log(` Execution time: ${result.executionTime}ms`);
279
-
280
- } catch (error) {
281
- recordTestResult('Error Handling - Invalid Tool', false, {
282
- error: error.message
283
- });
284
- console.log(` Result: FAIL - ${error.message}`);
285
- }
286
-
287
- // Test malformed input
288
- console.log('\n--- Testing malformed input handling ---');
289
- try {
290
- const result = await executeCommand(`stigmergy call "${testData.errorHandling.malformedInput}"`, 30000);
291
-
292
- // Should handle gracefully
293
- const passed = result.code !== -1; // Not a crash
294
-
295
- recordTestResult('Error Handling - Malformed Input', passed, {
296
- command: result.command,
297
- executionTime: result.executionTime,
298
- stdoutLength: result.stdout.length,
299
- stderrLength: result.stderr.length
300
- });
301
-
302
- console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
303
- console.log(` Execution time: ${result.executionTime}ms`);
304
-
305
- } catch (error) {
306
- recordTestResult('Error Handling - Malformed Input', false, {
307
- error: error.message
308
- });
309
- console.log(` Result: FAIL - ${error.message}`);
310
- }
311
-
312
- // Test special characters
313
- console.log('\n--- Testing special characters handling ---');
314
- try {
315
- const result = await executeCommand(`stigmergy call "${testData.errorHandling.specialCharacters}"`, 30000);
316
-
317
- // Should handle without crashing
318
- const passed = result.code !== -1;
319
-
320
- recordTestResult('Error Handling - Special Characters', passed, {
321
- command: result.command,
322
- executionTime: result.executionTime,
323
- stdoutLength: result.stdout.length,
324
- stderrLength: result.stderr.length
325
- });
326
-
327
- console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
328
- console.log(` Execution time: ${result.executionTime}ms`);
329
-
330
- } catch (error) {
331
- recordTestResult('Error Handling - Special Characters', false, {
332
- error: error.message
333
- });
334
- console.log(` Result: FAIL - ${error.message}`);
335
- }
336
-
337
- // Test extremely long input
338
- console.log('\n--- Testing extremely long input handling ---');
339
- try {
340
- const result = await executeCommand(`stigmergy call "${testData.errorHandling.extremelyLongInput}"`, 30000);
341
-
342
- // Should handle without crashing
343
- const passed = result.code !== -1;
344
-
345
- recordTestResult('Error Handling - Extremely Long Input', passed, {
346
- command: result.command,
347
- executionTime: result.executionTime,
348
- stdoutLength: result.stdout.length,
349
- stderrLength: result.stderr.length
350
- });
351
-
352
- console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
353
- console.log(` Execution time: ${result.executionTime}ms`);
354
-
355
- } catch (error) {
356
- recordTestResult('Error Handling - Extremely Long Input', false, {
357
- error: error.message
358
- });
359
- console.log(` Result: FAIL - ${error.message}`);
360
- }
361
-
362
- console.log('\n--- Error handling testing completed ---\n');
363
- }
364
-
365
- async function testAdvancedFeatures() {
366
- console.log('Starting advanced features testing...\n');
367
-
368
- // Test memory management
369
- console.log('\n--- Testing memory management ---');
370
- try {
371
- // First call to generate some memory
372
- await executeCommand(`stigmergy call "claude write a simple function to add two numbers"`, 30000);
373
-
374
- // Check if memory files were created
375
- const result = await executeCommand('node -e "const fs = require(\'fs\'); const path = require(\'path\'); const memPath = path.join(process.cwd(), \'STIGMERGY.md\'); console.log(fs.existsSync(memPath) ? \'Memory file exists\' : \'Memory file missing\')"', 10000);
376
-
377
- const passed = result.success && result.stdout.includes('Memory file exists');
378
-
379
- recordTestResult('Advanced Features - Memory Management', passed, {
380
- command: result.command,
381
- executionTime: result.executionTime,
382
- hasMemoryFile: result.stdout.includes('Memory file exists')
383
- });
384
-
385
- console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
386
- console.log(` Execution time: ${result.executionTime}ms`);
387
-
388
- } catch (error) {
389
- recordTestResult('Advanced Features - Memory Management', false, {
390
- error: error.message
391
- });
392
- console.log(` Result: FAIL - ${error.message}`);
393
- }
394
-
395
- // Test smart routing
396
- console.log('\n--- Testing smart routing ---');
397
- try {
398
- const result = await executeCommand(`stigmergy call "write a Python function to authenticate users"`, 30000);
399
-
400
- // Should successfully route to an appropriate tool
401
- const passed = result.success &&
402
- result.stdout.length > 50 &&
403
- !result.stdout.includes('Error') &&
404
- !result.stdout.includes('error');
405
-
406
- recordTestResult('Advanced Features - Smart Routing', passed, {
407
- command: result.command,
408
- executionTime: result.executionTime,
409
- outputLength: result.stdout.length
410
- });
411
-
412
- console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
413
- console.log(` Execution time: ${result.executionTime}ms`);
414
- console.log(` Output length: ${result.stdout.length} characters`);
415
-
416
- } catch (error) {
417
- recordTestResult('Advanced Features - Smart Routing', false, {
418
- error: error.message
419
- });
420
- console.log(` Result: FAIL - ${error.message}`);
421
- }
422
-
423
- console.log('\n--- Advanced features testing completed ---\n');
424
- }
425
-
426
- // Run the tests
427
- if (require.main === module) {
428
- runComprehensiveTest();
429
- }
430
-
431
- module.exports = runComprehensiveTest;
@@ -1,90 +0,0 @@
1
- // Error handling testing
2
- const { executeCommand, recordTestResult } = require('./test-utils');
3
- const testData = require('./test-data');
4
-
5
- async function testErrorHandling() {
6
- console.log('Starting error handling testing...\n');
7
-
8
- // Test invalid tool
9
- console.log('\n--- Testing invalid tool handling ---');
10
- try {
11
- const result = await executeCommand(`stigmergy call "${testData.errorHandling.invalidTool}"`, 30000);
12
-
13
- // Should fail gracefully
14
- const passed = !result.success &&
15
- (result.stderr.includes('not found') ||
16
- result.stderr.includes('Error') ||
17
- result.stdout.includes('Error'));
18
-
19
- recordTestResult('Error Handling - Invalid Tool', passed, {
20
- command: result.command,
21
- executionTime: result.executionTime,
22
- stdoutLength: result.stdout.length,
23
- stderrLength: result.stderr.length,
24
- hasErrorOutput: result.stderr.length > 0
25
- });
26
-
27
- console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
28
- console.log(` Execution time: ${result.executionTime}ms`);
29
-
30
- } catch (error) {
31
- recordTestResult('Error Handling - Invalid Tool', false, {
32
- error: error.message
33
- });
34
- console.log(` Result: FAIL - ${error.message}`);
35
- }
36
-
37
- // Test malformed input
38
- console.log('\n--- Testing malformed input handling ---');
39
- try {
40
- const result = await executeCommand(`stigmergy call "${testData.errorHandling.malformedInput}"`, 30000);
41
-
42
- // Should handle gracefully
43
- const passed = result.code !== -1; // Not a crash
44
-
45
- recordTestResult('Error Handling - Malformed Input', passed, {
46
- command: result.command,
47
- executionTime: result.executionTime,
48
- stdoutLength: result.stdout.length,
49
- stderrLength: result.stderr.length
50
- });
51
-
52
- console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
53
- console.log(` Execution time: ${result.executionTime}ms`);
54
-
55
- } catch (error) {
56
- recordTestResult('Error Handling - Malformed Input', false, {
57
- error: error.message
58
- });
59
- console.log(` Result: FAIL - ${error.message}`);
60
- }
61
-
62
- // Test special characters
63
- console.log('\n--- Testing special characters handling ---');
64
- try {
65
- const result = await executeCommand(`stigmergy call "${testData.errorHandling.specialCharacters}"`, 30000);
66
-
67
- // Should handle without crashing
68
- const passed = result.code !== -1;
69
-
70
- recordTestResult('Error Handling - Special Characters', passed, {
71
- command: result.command,
72
- executionTime: result.executionTime,
73
- stdoutLength: result.stdout.length,
74
- stderrLength: result.stderr.length
75
- });
76
-
77
- console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
78
- console.log(` Execution time: ${result.executionTime}ms`);
79
-
80
- } catch (error) {
81
- recordTestResult('Error Handling - Special Characters', false, {
82
- error: error.message
83
- });
84
- console.log(` Result: FAIL - ${error.message}`);
85
- }
86
-
87
- console.log('\n--- Error handling testing completed ---\n');
88
- }
89
-
90
- module.exports = testErrorHandling;
@@ -1,143 +0,0 @@
1
- // Individual CLI tool testing
2
- const { executeCommand, recordTestResult } = require('./test-utils');
3
- const testData = require('./test-data');
4
-
5
- async function testIndividualTools() {
6
- console.log('Starting individual CLI tool testing...\n');
7
-
8
- // Test each tool with simple code generation
9
- for (const [tool, prompt] of Object.entries(testData.simpleCodeGeneration)) {
10
- console.log(`\n--- Testing ${tool} with simple code generation ---`);
11
-
12
- try {
13
- const result = await executeCommand(`stigmergy call "${prompt}"`, 45000);
14
-
15
- // Check if the command executed successfully
16
- const passed = result.success &&
17
- result.stdout.length > 50 && // At least some content
18
- !result.stdout.includes('Error') &&
19
- !result.stdout.includes('error');
20
-
21
- recordTestResult(`${tool} - Simple Code Generation`, passed, {
22
- command: result.command,
23
- executionTime: result.executionTime,
24
- outputLength: result.stdout.length,
25
- hasError: !result.success || result.stderr.length > 0
26
- });
27
-
28
- // Log result summary
29
- console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
30
- console.log(` Execution time: ${result.executionTime}ms`);
31
- console.log(` Output length: ${result.stdout.length} characters`);
32
-
33
- } catch (error) {
34
- recordTestResult(`${tool} - Simple Code Generation`, false, {
35
- error: error.message
36
- });
37
- console.log(` Result: FAIL - ${error.message}`);
38
- }
39
- }
40
-
41
- // Test each tool with complex code generation
42
- for (const [tool, prompt] of Object.entries(testData.complexCodeGeneration)) {
43
- console.log(`\n--- Testing ${tool} with complex code generation ---`);
44
-
45
- try {
46
- const result = await executeCommand(`stigmergy call "${prompt}"`, 60000);
47
-
48
- // Check if the command executed successfully
49
- const passed = result.success &&
50
- result.stdout.length > 100 && // More content for complex tasks
51
- !result.stdout.includes('Error') &&
52
- !result.stdout.includes('error');
53
-
54
- recordTestResult(`${tool} - Complex Code Generation`, passed, {
55
- command: result.command,
56
- executionTime: result.executionTime,
57
- outputLength: result.stdout.length,
58
- hasError: !result.success || result.stderr.length > 0
59
- });
60
-
61
- // Log result summary
62
- console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
63
- console.log(` Execution time: ${result.executionTime}ms`);
64
- console.log(` Output length: ${result.stdout.length} characters`);
65
-
66
- } catch (error) {
67
- recordTestResult(`${tool} - Complex Code Generation`, false, {
68
- error: error.message
69
- });
70
- console.log(` Result: FAIL - ${error.message}`);
71
- }
72
- }
73
-
74
- // Test each tool with analysis task
75
- for (const [tool, prompt] of Object.entries(testData.analysis)) {
76
- console.log(`\n--- Testing ${tool} with analysis task ---`);
77
-
78
- try {
79
- const result = await executeCommand(`stigmergy call "${prompt}"`, 45000);
80
-
81
- // Check if the command executed successfully
82
- const passed = result.success &&
83
- result.stdout.length > 50 &&
84
- !result.stdout.includes('Error') &&
85
- !result.stdout.includes('error');
86
-
87
- recordTestResult(`${tool} - Analysis Task`, passed, {
88
- command: result.command,
89
- executionTime: result.executionTime,
90
- outputLength: result.stdout.length,
91
- hasError: !result.success || result.stderr.length > 0
92
- });
93
-
94
- // Log result summary
95
- console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
96
- console.log(` Execution time: ${result.executionTime}ms`);
97
- console.log(` Output length: ${result.stdout.length} characters`);
98
-
99
- } catch (error) {
100
- recordTestResult(`${tool} - Analysis Task`, false, {
101
- error: error.message
102
- });
103
- console.log(` Result: FAIL - ${error.message}`);
104
- }
105
- }
106
-
107
- // Test each tool with documentation task
108
- for (const [tool, prompt] of Object.entries(testData.documentation)) {
109
- console.log(`\n--- Testing ${tool} with documentation task ---`);
110
-
111
- try {
112
- const result = await executeCommand(`stigmergy call "${prompt}"`, 45000);
113
-
114
- // Check if the command executed successfully
115
- const passed = result.success &&
116
- result.stdout.length > 50 &&
117
- !result.stdout.includes('Error') &&
118
- !result.stdout.includes('error');
119
-
120
- recordTestResult(`${tool} - Documentation Task`, passed, {
121
- command: result.command,
122
- executionTime: result.executionTime,
123
- outputLength: result.stdout.length,
124
- hasError: !result.success || result.stderr.length > 0
125
- });
126
-
127
- // Log result summary
128
- console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
129
- console.log(` Execution time: ${result.executionTime}ms`);
130
- console.log(` Output length: ${result.stdout.length} characters`);
131
-
132
- } catch (error) {
133
- recordTestResult(`${tool} - Documentation Task`, false, {
134
- error: error.message
135
- });
136
- console.log(` Result: FAIL - ${error.message}`);
137
- }
138
- }
139
-
140
- console.log('\n--- Individual tool testing completed ---\n');
141
- }
142
-
143
- module.exports = testIndividualTools;