stigmergy 1.0.99 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/bin/stigmergy +1 -1
- package/bin/stigmergy.cmd +1 -1
- package/docs/NATIVE_INTEGRATION_GUIDE.md +1155 -1190
- package/docs/PROJECT_STRUCTURE.md +283 -303
- package/package.json +10 -7
- package/src/cli/router.js +456 -0
- package/src/core/coordination/index.js +16 -0
- package/src/core/coordination/nodejs/AdapterManager.js +89 -0
- package/src/core/coordination/nodejs/CLCommunication.js +59 -0
- package/src/core/coordination/nodejs/CLIIntegrationManager.js +236 -0
- package/src/core/coordination/nodejs/HealthChecker.js +77 -0
- package/src/core/coordination/nodejs/HookDeploymentManager.js +256 -0
- package/src/core/coordination/nodejs/StatisticsCollector.js +71 -0
- package/src/core/coordination/nodejs/index.js +72 -0
- package/src/core/coordination/nodejs/utils/Logger.js +29 -0
- package/src/core/installer.js +375 -0
- package/src/index.js +25 -4
- package/src/main.js +1068 -831
- package/src/utils/helpers.js +35 -0
- package/test/cross-cli-detection-test.js +33 -0
- package/test/python-plugins-test.js +259 -0
- package/test/remaining-adapters-test.js +256 -0
- package/test/system-compatibility-test.js +466 -446
- package/test/tool-selection-integration-test.js +157 -156
- package/src/main_english.js +0 -1338
|
@@ -1,157 +1,158 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Integration Test for Tool Selection Fix
|
|
5
|
-
* Tests the actual main.js handleSkillsCommand function
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
const { spawn } = require('child_process');
|
|
9
|
-
const path = require('path');
|
|
10
|
-
|
|
11
|
-
function runCommand(args) {
|
|
12
|
-
return new Promise((resolve, reject) => {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
let
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
console.log('
|
|
43
|
-
console.log('
|
|
44
|
-
console.log('');
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
let
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
console.log(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
console.log('
|
|
137
|
-
console.log('
|
|
138
|
-
console.log(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
console.log('
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Integration Test for Tool Selection Fix
|
|
5
|
+
* Tests the actual main.js handleSkillsCommand function
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { spawn } = require('child_process');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
|
|
11
|
+
function runCommand(args) {
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
const mainPath = path.join(__dirname, '..', 'src', 'main.js');
|
|
14
|
+
const child = spawn('node', [mainPath, ...args], {
|
|
15
|
+
cwd: path.join(__dirname, '..'),
|
|
16
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
17
|
+
encoding: 'utf8'
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
let stdout = '';
|
|
21
|
+
let stderr = '';
|
|
22
|
+
|
|
23
|
+
child.stdout.on('data', (data) => {
|
|
24
|
+
stdout += data;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
child.stderr.on('data', (data) => {
|
|
28
|
+
stderr += data;
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
child.on('close', (code) => {
|
|
32
|
+
resolve({ code, stdout, stderr });
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
child.on('error', (error) => {
|
|
36
|
+
reject(error);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async function testToolSelectionIntegration() {
|
|
42
|
+
console.log('==============================================');
|
|
43
|
+
console.log('TOOL SELECTION INTEGRATION TEST');
|
|
44
|
+
console.log('==============================================');
|
|
45
|
+
console.log('');
|
|
46
|
+
|
|
47
|
+
const testCases = [
|
|
48
|
+
{
|
|
49
|
+
name: 'Test 1: Tool selection with --tool=claude',
|
|
50
|
+
args: ['skills', 'execute', 'translation', '--text=hello', '--to=zh', '--tool=claude'],
|
|
51
|
+
expectedTool: 'claude',
|
|
52
|
+
shouldContain: ['Using tool: claude']
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'Test 2: Tool selection with --tool gemini',
|
|
56
|
+
args: ['skills', 'execute', 'translation', '--text=hello', '--to=zh', '--tool', 'gemini'],
|
|
57
|
+
expectedTool: 'gemini',
|
|
58
|
+
shouldContain: ['Using tool: gemini']
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'Test 3: No tool specified (should use default)',
|
|
62
|
+
args: ['skills', 'execute', 'translation', '--text=hello', '--to=zh'],
|
|
63
|
+
expectedTool: null,
|
|
64
|
+
shouldContain: ['Executing skill: translation'],
|
|
65
|
+
shouldNotContain: ['Using tool:']
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'Test 4: Complex parameters with tool selection',
|
|
69
|
+
args: ['skills', 'execute', 'code-analysis', '--file=app.js', '--line=10', '--tool=qwen'],
|
|
70
|
+
expectedTool: 'qwen',
|
|
71
|
+
shouldContain: ['Using tool: qwen', 'Parameters: {"file":"app.js","line":"10"}']
|
|
72
|
+
}
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
let passed = 0;
|
|
76
|
+
let total = testCases.length;
|
|
77
|
+
|
|
78
|
+
for (const testCase of testCases) {
|
|
79
|
+
console.log(`${testCase.name}`);
|
|
80
|
+
console.log(`Command: node package/src/main.js ${testCase.args.join(' ')}`);
|
|
81
|
+
|
|
82
|
+
try {
|
|
83
|
+
const result = await runCommand(testCase.args);
|
|
84
|
+
|
|
85
|
+
console.log(`Exit code: ${result.code}`);
|
|
86
|
+
if (result.stdout) {
|
|
87
|
+
console.log(`Output: ${result.stdout.trim()}`);
|
|
88
|
+
}
|
|
89
|
+
if (result.stderr) {
|
|
90
|
+
console.log(`Error: ${result.stderr.trim()}`);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Validate results
|
|
94
|
+
let success = true;
|
|
95
|
+
|
|
96
|
+
// Check for expected content
|
|
97
|
+
if (testCase.shouldContain) {
|
|
98
|
+
for (const expected of testCase.shouldContain) {
|
|
99
|
+
if (!result.stdout.includes(expected)) {
|
|
100
|
+
console.log(`❌ Missing expected output: "${expected}"`);
|
|
101
|
+
success = false;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Check for unexpected content
|
|
107
|
+
if (testCase.shouldNotContain) {
|
|
108
|
+
for (const unexpected of testCase.shouldNotContain) {
|
|
109
|
+
if (result.stdout.includes(unexpected)) {
|
|
110
|
+
console.log(`❌ Found unexpected output: "${unexpected}"`);
|
|
111
|
+
success = false;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Check exit code
|
|
117
|
+
if (result.code !== 0) {
|
|
118
|
+
console.log(`❌ Command failed with exit code ${result.code}`);
|
|
119
|
+
success = false;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (success) {
|
|
123
|
+
console.log(`✅ PASSED`);
|
|
124
|
+
passed++;
|
|
125
|
+
} else {
|
|
126
|
+
console.log(`❌ FAILED`);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
} catch (error) {
|
|
130
|
+
console.log(`❌ ERROR: ${error.message}`);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
console.log('');
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
console.log('==============================================');
|
|
137
|
+
console.log('TOOL SELECTION TEST SUMMARY');
|
|
138
|
+
console.log('==============================================');
|
|
139
|
+
console.log(`Tests passed: ${passed}/${total}`);
|
|
140
|
+
|
|
141
|
+
if (passed === total) {
|
|
142
|
+
console.log('🎉 All tool selection tests passed!');
|
|
143
|
+
console.log('✅ Tool selection logic has been successfully fixed!');
|
|
144
|
+
} else {
|
|
145
|
+
console.log('⚠️ Some tests failed. Tool selection still needs work.');
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return passed === total;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Run tests if called directly
|
|
152
|
+
if (require.main === module) {
|
|
153
|
+
testToolSelectionIntegration().then(success => {
|
|
154
|
+
process.exit(success ? 0 : 1);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
157
158
|
module.exports = { testToolSelectionIntegration };
|