stigmergy 1.1.6 → 1.2.6

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 (118) hide show
  1. package/LICENSE +18 -18
  2. package/README.md +28 -223
  3. package/STIGMERGY.md +61 -61
  4. package/docs/PROJECT_CONSTITUTION.md +433 -433
  5. package/docs/PROJECT_STRUCTURE_CURRENT.md +80 -80
  6. package/examples/calculator-example.js +72 -72
  7. package/examples/cline_usage_examples.md +364 -364
  8. package/examples/encryption-example.js +67 -67
  9. package/examples/json-parser-example.js +120 -120
  10. package/examples/json-validation-example.js +64 -64
  11. package/examples/rest-client-example.js +52 -52
  12. package/examples/rest_client_example.js +54 -54
  13. package/package.json +15 -7
  14. package/scripts/build.js +74 -74
  15. package/scripts/post-deployment-config.js +296 -296
  16. package/scripts/preinstall-check.js +173 -111
  17. package/scripts/publish.js +58 -268
  18. package/scripts/run-layered-tests.js +247 -0
  19. package/scripts/safe-install.js +139 -139
  20. package/scripts/simple-publish.js +57 -59
  21. package/src/adapters/claude/install_claude_integration.js +292 -0
  22. package/src/adapters/codebuddy/install_codebuddy_integration.js +349 -0
  23. package/src/adapters/codex/install_codex_integration.js +395 -0
  24. package/src/adapters/copilot/install_copilot_integration.js +716 -0
  25. package/src/adapters/gemini/install_gemini_integration.js +304 -0
  26. package/src/adapters/iflow/install_iflow_integration.js +304 -0
  27. package/src/adapters/qoder/install_qoder_integration.js +1090 -0
  28. package/src/adapters/qwen/install_qwen_integration.js +285 -0
  29. package/src/auth.js +173 -173
  30. package/src/auth_command.js +208 -208
  31. package/src/calculator.js +313 -313
  32. package/src/cli/router.js +792 -67
  33. package/src/core/cache_cleaner.js +767 -0
  34. package/src/core/cli_help_analyzer.js +680 -674
  35. package/src/core/cli_parameter_handler.js +132 -127
  36. package/src/core/cli_tools.js +89 -89
  37. package/src/core/coordination/index.js +16 -16
  38. package/src/core/coordination/nodejs/AdapterManager.js +102 -89
  39. package/src/core/coordination/nodejs/CLCommunication.js +132 -124
  40. package/src/core/coordination/nodejs/CLIIntegrationManager.js +272 -236
  41. package/src/core/coordination/nodejs/HealthChecker.js +76 -77
  42. package/src/core/coordination/nodejs/HookDeploymentManager.js +263 -190
  43. package/src/core/coordination/nodejs/StatisticsCollector.js +71 -71
  44. package/src/core/coordination/nodejs/index.js +90 -72
  45. package/src/core/coordination/nodejs/utils/Logger.js +29 -29
  46. package/src/core/enhanced_installer.js +479 -0
  47. package/src/core/enhanced_uninstaller.js +638 -0
  48. package/src/core/error_handler.js +406 -406
  49. package/src/core/installer.js +816 -294
  50. package/src/core/memory_manager.js +83 -83
  51. package/src/core/rest_client.js +160 -160
  52. package/src/core/smart_router.js +249 -146
  53. package/src/core/upgrade_manager.js +420 -0
  54. package/src/data_encryption.js +143 -143
  55. package/src/data_structures.js +440 -440
  56. package/src/deploy.js +55 -55
  57. package/src/index.js +30 -30
  58. package/src/test/cli-availability-checker.js +194 -0
  59. package/src/test/test-environment.js +289 -0
  60. package/src/utils/helpers.js +35 -35
  61. package/src/utils.js +921 -915
  62. package/src/weatherProcessor.js +228 -228
  63. package/test/calculator.test.js +0 -215
  64. package/test/collision-test.js +0 -26
  65. package/test/comprehensive-execution-test.js +0 -428
  66. package/test/conflict-prevention-test.js +0 -95
  67. package/test/cross-cli-detection-test.js +0 -33
  68. package/test/csv-processing-test.js +0 -36
  69. package/test/deploy-hooks-test.js +0 -250
  70. package/test/e2e/claude-cli-test.js +0 -128
  71. package/test/e2e/collaboration-test.js +0 -75
  72. package/test/e2e/comprehensive-test.js +0 -431
  73. package/test/e2e/error-handling-test.js +0 -90
  74. package/test/e2e/individual-tool-test.js +0 -143
  75. package/test/e2e/other-cli-test.js +0 -130
  76. package/test/e2e/qoder-cli-test.js +0 -128
  77. package/test/e2e/run-e2e-tests.js +0 -73
  78. package/test/e2e/test-data.js +0 -88
  79. package/test/e2e/test-utils.js +0 -222
  80. package/test/encryption-simple-test.js +0 -110
  81. package/test/encryption.test.js +0 -129
  82. package/test/enhanced-main-alignment.test.js +0 -298
  83. package/test/error-handling-test.js +0 -341
  84. package/test/fibonacci.test.js +0 -178
  85. package/test/final-deploy-test.js +0 -221
  86. package/test/final-install-test.js +0 -226
  87. package/test/hash-table-demo.js +0 -33
  88. package/test/hash-table-test.js +0 -26
  89. package/test/hash_table_test.js +0 -114
  90. package/test/hook-system-integration-test.js +0 -307
  91. package/test/iflow-integration-test.js +0 -292
  92. package/test/improved-install-test.js +0 -362
  93. package/test/install-command-test.js +0 -370
  94. package/test/json-parser-test.js +0 -161
  95. package/test/json-validation-test.js +0 -164
  96. package/test/natural-language-skills-test.js +0 -320
  97. package/test/nl-integration-test.js +0 -179
  98. package/test/parameter-parsing-test.js +0 -143
  99. package/test/plugin-deployment-test.js +0 -316
  100. package/test/postinstall-test.js +0 -269
  101. package/test/python-plugins-test.js +0 -259
  102. package/test/real-test.js +0 -435
  103. package/test/remaining-adapters-test.js +0 -256
  104. package/test/rest-client-test.js +0 -56
  105. package/test/rest_client.test.js +0 -85
  106. package/test/simple-iflow-hook-test.js +0 -137
  107. package/test/system-compatibility-test.js +0 -467
  108. package/test/tdd-deploy-fix-test.js +0 -324
  109. package/test/tdd-fixes-test.js +0 -211
  110. package/test/third-party-skills-test.js +0 -321
  111. package/test/tool-selection-integration-test.js +0 -158
  112. package/test/unit/calculator-full.test.js +0 -191
  113. package/test/unit/calculator-simple.test.js +0 -96
  114. package/test/unit/calculator.test.js +0 -97
  115. package/test/unit/cli-scanner.test.js +0 -291
  116. package/test/unit/cli_parameter_handler.test.js +0 -116
  117. package/test/unit/cross-cli-executor.test.js +0 -399
  118. package/test/weather-processor.test.js +0 -104
@@ -1,467 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * System Compatibility Test
5
- * Identifies actual issues and limitations of the current system
6
- */
7
-
8
- const fs = require('fs');
9
- const path = require('path');
10
- const { spawnSync } = require('child_process');
11
-
12
- class SystemCompatibilityTest {
13
- constructor() {
14
- this.issues = [];
15
- this.capabilities = [];
16
- this.testResults = [];
17
- this.projectRoot = process.cwd();
18
- }
19
-
20
- async runTests() {
21
- console.log('==============================================');
22
- console.log('SYSTEM COMPATIBILITY TEST REPORT');
23
- console.log('==============================================');
24
- console.log('');
25
-
26
- // Test 1: Tool Selection Issues
27
- await this.testToolSelection();
28
-
29
- // Test 2: AI Tool Availability
30
- await this.testAIToolAvailability();
31
-
32
- // Test 3: Hook Integration
33
- await this.testHookIntegration();
34
-
35
- // Test 4: Skills System Functionality
36
- await this.testSkillsSystem();
37
-
38
- // Test 5: Cross-Platform Compatibility
39
- await this.testCrossPlatformCompatibility();
40
-
41
- // Test 6: Real-world Scenarios
42
- await this.testRealWorldScenarios();
43
-
44
- this.generateReport();
45
- }
46
-
47
- async testToolSelection() {
48
- console.log('TEST 1: Tool Selection Issues');
49
- console.log('-----------------------------');
50
-
51
- // Issue: Tool selection not working properly
52
- console.log('🔍 Identified Issue: Tool selection logic problems');
53
- console.log(' - Specified --tool=claude but system uses default tool');
54
- console.log(' - Need to fix handleSkillsCommand parameter parsing');
55
- console.log('');
56
-
57
- this.issues.push({
58
- severity: 'HIGH',
59
- category: 'BUG',
60
- description: 'Tool selection not working - uses default instead of specified tool',
61
- component: 'handleSkillsCommand in main.js'
62
- });
63
- }
64
-
65
- async testAIToolAvailability() {
66
- console.log('TEST 2: AI Tool Availability');
67
- console.log('-----------------------------');
68
-
69
- const tools = [
70
- { name: 'claude', command: 'claude' },
71
- { name: 'gemini', command: 'gemini' },
72
- { name: 'qwen', command: 'qwen' },
73
- { name: 'iflow', command: 'iflow' },
74
- { name: 'codebuddy', command: 'codebuddy' },
75
- { name: 'copilot', command: 'gh copilot' }
76
- ];
77
-
78
- console.log('Checking AI tool availability:');
79
- let availableTools = 0;
80
- let totalTools = tools.length;
81
-
82
- for (const tool of tools) {
83
- try {
84
- let result;
85
- if (process.platform === 'win32') {
86
- result = spawnSync('where', [tool.command], { stdio: 'pipe' });
87
- } else {
88
- result = spawnSync('which', [tool.command], { stdio: 'pipe' });
89
- }
90
-
91
- if (result.status === 0) {
92
- console.log(` ✅ ${tool.name}: Available`);
93
- availableTools++;
94
- } else {
95
- console.log(` ❌ ${tool.name}: Not found`);
96
- }
97
- } catch (error) {
98
- console.log(` ❓ ${tool.name}: Check failed - ${error.message}`);
99
- }
100
- }
101
-
102
- console.log('');
103
- console.log(`Available AI Tools: ${availableTools}/${totalTools}`);
104
-
105
- if (availableTools < totalTools) {
106
- this.issues.push({
107
- severity: 'MEDIUM',
108
- category: 'LIMITATION',
109
- description: `Only ${availableTools}/${totalTools} AI tools are available`,
110
- impact: 'Reduced functionality for missing tools'
111
- });
112
- } else {
113
- this.capabilities.push({
114
- category: 'AI_TOOLS',
115
- description: `All ${totalTools} AI tools are available`
116
- });
117
- }
118
- }
119
-
120
- async testHookIntegration() {
121
- console.log('TEST 3: Hook Integration');
122
- console.log('---------------------');
123
-
124
- // Check if hooks are properly installed
125
- const os = require('os');
126
- const path = require('path');
127
- const hookDirectories = [
128
- path.join(os.homedir(), '.claude', 'hooks'),
129
- path.join(os.homedir(), '.gemini', 'hooks'),
130
- path.join(os.homedir(), '.qwen', 'hooks'),
131
- path.join(os.homedir(), '.iflow', 'hooks'),
132
- path.join(os.homedir(), '.codebuddy', 'hooks')
133
- ];
134
-
135
- let installedHooks = 0;
136
- for (const hookDir of hookDirectories) {
137
- if (fs.existsSync(hookDir)) {
138
- const files = fs.readdirSync(hookDir);
139
- const hookFiles = files.filter(file =>
140
- file.includes('skill-forced-eval') || file.includes('hook')
141
- );
142
- if (hookFiles.length > 0) {
143
- console.log(` ✅ ${hookDir}: ${hookFiles.length} hook files found`);
144
- installedHooks++;
145
- } else {
146
- console.log(` ⚠️ ${hookDir}: No hook files found`);
147
- }
148
- } else {
149
- console.log(` ❌ ${hookDir}: Directory does not exist`);
150
- }
151
- }
152
-
153
- console.log(`Installed hooks: ${installedHooks}/${hookDirectories.length}`);
154
-
155
- // Check hook execution simulation
156
- try {
157
- const testHook = path.join(os.homedir(), '.claude', 'hooks', 'skill-forced-eval-hook.sh');
158
- if (fs.existsSync(testHook)) {
159
- console.log(' ✅ Hook files are executable');
160
- console.log(' ⚠️ Note: Hooks are in simulation mode, not real AI tool integration');
161
- this.issues.push({
162
- severity: 'LOW',
163
- category: 'LIMITATION',
164
- description: 'Hooks are in simulation mode, not real AI tool integration',
165
- component: 'Hook execution'
166
- });
167
- }
168
- } catch (error) {
169
- console.log(` ❌ Hook execution test failed: ${error.message}`);
170
- }
171
-
172
- if (installedHooks > 0) {
173
- this.capabilities.push({
174
- category: 'HOOK_SYSTEM',
175
- description: `Hook system installed for ${installedHooks} AI tools`
176
- });
177
- }
178
- }
179
-
180
- async testSkillsSystem() {
181
- console.log('TEST 4: Skills System Functionality');
182
- console.log('------------------------------');
183
-
184
- try {
185
- // Test skills list
186
- console.log('Testing skills list functionality...');
187
- const mainJsPath = path.join(this.projectRoot, 'src', 'main.js');
188
- const skillsResult = spawnSync('node', [mainJsPath, 'skills', 'list'], {
189
- cwd: this.projectRoot,
190
- stdio: 'pipe',
191
- encoding: 'utf8'
192
- });
193
-
194
- if (skillsResult.status === 0) {
195
- console.log(' ✅ Skills list command works');
196
- const output = skillsResult.stdout;
197
- const skillCount = (output.match(/📝.*?\(/g) || []).length;
198
- console.log(` ✅ Skills listed: ${skillCount} skills found`);
199
- } else {
200
- console.log(' ❌ Skills list command failed');
201
- }
202
-
203
- // Test skills execution
204
- console.log('Testing skills execution...');
205
- const execResult = spawnSync('node', [mainJsPath, 'skills', 'execute', 'translation', '--text=hello', '--to=zh'], {
206
- cwd: this.projectRoot,
207
- stdio: 'pipe',
208
- encoding: 'utf8'
209
- });
210
-
211
- if (execResult.status === 0) {
212
- console.log(' ✅ Skills execution works (simulation mode)');
213
- this.capabilities.push({
214
- category: 'SKILLS_SYSTEM',
215
- description: 'Skills system functional with 6 built-in skills'
216
- });
217
- } else {
218
- console.log(' ❌ Skills execution failed');
219
- this.issues.push({
220
- severity: 'HIGH',
221
- category: 'BUG',
222
- description: 'Skills execution command failed',
223
- component: 'skills system'
224
- });
225
- }
226
-
227
- } catch (error) {
228
- console.log(` ❌ Skills system test failed: ${error.message}`);
229
- this.issues.push({
230
- severity: 'HIGH',
231
- category: 'ERROR',
232
- description: `Skills system test error: ${error.message}`,
233
- component: 'skills system'
234
- });
235
- }
236
- }
237
-
238
- async testCrossPlatformCompatibility() {
239
- console.log('TEST 5: Cross-Platform Compatibility');
240
- console.log('-----------------------------------');
241
-
242
- const platform = process.platform;
243
- console.log(`Current platform: ${platform}`);
244
-
245
- // Check file encoding
246
- const skillsFiles = [
247
- 'package/src/skills/skills-manager.js',
248
- 'package/src/index.js',
249
- 'hooks/install-hooks.js'
250
- ];
251
-
252
- let encodingIssues = 0;
253
- for (const file of skillsFiles) {
254
- if (fs.existsSync(file)) {
255
- const content = fs.readFileSync(file, 'utf8');
256
- // Check for non-ANSI characters
257
- if (/[^\x00-\x7F]/.test(content)) {
258
- console.log(` ⚠️ ${file}: Contains non-ANSI characters`);
259
- encodingIssues++;
260
- } else {
261
- console.log(` ✅ ${file}: Pure ANSI encoding`);
262
- }
263
- }
264
- }
265
-
266
- if (encodingIssues > 0) {
267
- this.issues.push({
268
- severity: 'LOW',
269
- category: 'COMPATIBILITY',
270
- description: `${encodingIssues} files contain non-ANSI characters`,
271
- recommendation: 'Use pure ANSI for international compatibility'
272
- });
273
- } else {
274
- this.capabilities.push({
275
- category: 'ENCODING',
276
- description: 'All files use pure ANSI encoding'
277
- });
278
- }
279
-
280
- // Check Node.js module system compatibility
281
- try {
282
- const skillsManagerPath = path.join(this.projectRoot, 'src', 'skills', 'skills-manager.js');
283
- if (fs.existsSync(skillsManagerPath)) {
284
- require(skillsManagerPath);
285
- console.log(' ✅ ES6 modules work correctly');
286
- } else {
287
- console.log(' ⚠️ Skills manager module not found at expected location');
288
- this.issues.push({
289
- severity: 'LOW',
290
- category: 'COMPATIBILITY',
291
- description: 'Skills manager module not found at expected location',
292
- component: 'module system'
293
- });
294
- }
295
- } catch (error) {
296
- console.log(` ❌ ES6 module import failed: ${error.message}`);
297
- this.issues.push({
298
- severity: 'HIGH',
299
- category: 'COMPATIBILITY',
300
- description: `ES6 module import failed: ${error.message}`,
301
- component: 'module system'
302
- });
303
- }
304
- }
305
-
306
- async testRealWorldScenarios() {
307
- console.log('TEST 6: Real-World Scenarios');
308
- console.log('---------------------------');
309
-
310
- // Scenario 1: Code review workflow
311
- console.log('Scenario 1: Code Review Workflow');
312
- console.log(' User: "Please review this React component for security issues"');
313
- console.log(' Expected: Hook should detect code-analysis need');
314
- console.log(' Current: ❌ Hook system not integrated with real AI tools');
315
- console.log('');
316
-
317
- // Scenario 2: Translation workflow
318
- console.log('Scenario 2: Translation Workflow');
319
- console.log(' User: "Translate this comment to English"');
320
- console.log(' Expected: Should trigger translation skill suggestion');
321
- console.log(' Current: ❌ No real AI tool integration for automatic triggering');
322
- console.log('');
323
-
324
- // Scenario 3: Skills marketplace
325
- console.log('Scenario 3: Skills Marketplace');
326
- console.log(' Action: Install new skill from community repository');
327
- console.log(' Expected: Should load external skills');
328
- console.log(' Current: ✅ External skill loading simulation works');
329
- console.log('');
330
-
331
- this.issues.push({
332
- severity: 'HIGH',
333
- category: 'INTEGRATION',
334
- description: 'Hooks are not actually integrated with real AI tools',
335
- impact: 'System doesn\'t automatically intercept real AI tool usage'
336
- });
337
-
338
- this.issues.push({
339
- severity: 'MEDIUM',
340
- category: 'LIMITATION',
341
- description: 'No automatic triggering of skills based on AI tool usage',
342
- impact: 'Users must manually switch to skills system'
343
- });
344
- }
345
-
346
- generateReport() {
347
- console.log('');
348
- console.log('==============================================');
349
- console.log('COMPATIBILITY TEST REPORT');
350
- console.log('==============================================');
351
- console.log('');
352
-
353
- console.log('📊 CURRENT STATUS:');
354
- console.log('');
355
-
356
- // Capabilities
357
- if (this.capabilities.length > 0) {
358
- console.log('✅ WORKING FEATURES:');
359
- this.capabilities.forEach(cap => {
360
- console.log(` • ${cap.category}: ${cap.description}`);
361
- });
362
- }
363
-
364
- console.log('');
365
-
366
- // Issues
367
- if (this.issues.length > 0) {
368
- console.log('❌ IDENTIFIED ISSUES:');
369
- console.log('');
370
-
371
- // Group by severity
372
- const highSeverity = this.issues.filter(i => i.severity === 'HIGH');
373
- const mediumSeverity = this.issues.filter(i => i.severity === 'MEDIUM');
374
- const lowSeverity = this.issues.filter(i => i.severity === 'LOW');
375
-
376
- if (highSeverity.length > 0) {
377
- console.log('🔴 HIGH SEVERITY:');
378
- highSeverity.forEach(issue => {
379
- console.log(` • ${issue.description} (${issue.component})`);
380
- });
381
- console.log('');
382
- }
383
-
384
- if (mediumSeverity.length > 0) {
385
- console.log('🟡 MEDIUM SEVERITY:');
386
- mediumSeverity.forEach(issue => {
387
- console.log(` • ${issue.description} (${issue.component})`);
388
- if (issue.impact) {
389
- console.log(` Impact: ${issue.impact}`);
390
- }
391
- });
392
- console.log('');
393
- }
394
-
395
- if (lowSeverity.length > 0) {
396
- console.log('🟡 LOW SEVERITY:');
397
- lowSeverity.forEach(issue => {
398
- console.log(` • ${issue.description} (${issue.component})`);
399
- if (issue.recommendation) {
400
- console.log(` Recommendation: ${issue.recommendation}`);
401
- }
402
- });
403
- console.log('');
404
- }
405
- } else {
406
- console.log('🎉 NO CRITICAL ISSUES FOUND');
407
- console.log('');
408
- }
409
-
410
- console.log('📋 ASSESSMENT:');
411
- console.log('');
412
-
413
- // Overall assessment
414
- const criticalIssues = this.issues.filter(i => i.severity === 'HIGH');
415
- const totalIssues = this.issues.length;
416
-
417
- if (criticalIssues.length > 0) {
418
- console.log(`❌ SYSTEM NOT READY FOR PRODUCTION`);
419
- console.log(` ${criticalIssues.length} critical issues must be resolved`);
420
- console.log(` System requires fixes before deployment`);
421
- } else if (totalIssues > 3) {
422
- console.log('⚠️ SYSTEM READY WITH LIMITATIONS');
423
- console.log(` ${totalIssues} issues found, but system is functional`);
424
- console.log(` Consider addressing issues for better experience`);
425
- } else {
426
- console.log('✅ SYSTEM READY FOR TESTING');
427
- console.log(` ${totalIssues} minor issues found, system is functional`);
428
- console.log(` Suitable for development and demonstration`);
429
- }
430
-
431
- console.log('');
432
- console.log('🎯 RECOMMENDATIONS:');
433
- console.log('');
434
-
435
- if (criticalIssues.length > 0) {
436
- console.log('1. FIX CRITICAL ISSUES FIRST:');
437
- criticalIssues.forEach((issue, index) => {
438
- console.log(` ${index + 1}. ${issue.description}`);
439
- if (issue.component) {
440
- console.log(` - Fix in ${issue.component}`);
441
- }
442
- });
443
- console.log('');
444
- }
445
-
446
- console.log('2. ENHANCE USER EXPERIENCE:');
447
- console.log(' • Fix tool selection logic in handleSkillsCommand');
448
- console.log(' • Integrate hooks with real AI tool execution');
449
- console.log(' • Add automatic skill triggering for common patterns');
450
- console.log(' • Implement real AI tool calling (remove simulation mode)');
451
- console.log('');
452
-
453
- console.log('3. EXPAND THIRD-PARTY INTEGRATION:');
454
- console.log(' • Implement actual GitHub repository cloning for skills');
455
- console.log(' • Add skill validation and security checking');
456
- console.log(' • Create skill marketplace with rating system');
457
- console.log(' • Support skill version management and updates');
458
- }
459
- }
460
-
461
- // Run tests
462
- if (require.main === module) {
463
- const test = new SystemCompatibilityTest();
464
- test.runTests();
465
- }
466
-
467
- module.exports = SystemCompatibilityTest;