stigmergy 1.0.68 → 1.0.70
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.en.md +306 -300
- package/README.md +469 -301
- package/package.json +97 -81
- package/scripts/publish.js +268 -0
- package/scripts/simple-publish.js +59 -0
- package/src/index.js +12 -0
- package/test/enhanced-main-alignment.test.js +298 -0
- package/test/hook-system-integration-test.js +307 -0
- package/test/natural-language-skills-test.js +320 -0
- package/test/nl-integration-test.js +179 -0
- package/test/parameter-parsing-test.js +143 -0
- package/test/real-test.js +435 -0
- package/test/system-compatibility-test.js +447 -0
- package/test/tdd-fixes-test.js +211 -0
- package/test/third-party-skills-test.js +321 -0
- package/test/tool-selection-integration-test.js +157 -0
- package/test/unit/cli-scanner.test.js +291 -0
- package/test/unit/cross-cli-executor.test.js +399 -0
- package/src/adapters/claude/__init__.py +0 -13
- package/src/adapters/claude/claude_skills_integration.py +0 -609
- package/src/adapters/claude/hook_adapter.py +0 -663
- package/src/adapters/claude/install_claude_integration.py +0 -265
- package/src/adapters/claude/skills_hook_adapter.py +0 -841
- package/src/adapters/claude/standalone_claude_adapter.py +0 -384
- package/src/adapters/cline/__init__.py +0 -20
- package/src/adapters/cline/config.py +0 -108
- package/src/adapters/cline/install_cline_integration.py +0 -617
- package/src/adapters/cline/mcp_server.py +0 -713
- package/src/adapters/cline/standalone_cline_adapter.py +0 -459
- package/src/adapters/codebuddy/__init__.py +0 -13
- package/src/adapters/codebuddy/buddy_adapter.py +0 -1125
- package/src/adapters/codebuddy/install_codebuddy_integration.py +0 -279
- package/src/adapters/codebuddy/skills_hook_adapter.py +0 -672
- package/src/adapters/codebuddy/skills_integration.py +0 -395
- package/src/adapters/codebuddy/standalone_codebuddy_adapter.py +0 -403
- package/src/adapters/codex/__init__.py +0 -11
- package/src/adapters/codex/base.py +0 -46
- package/src/adapters/codex/install_codex_integration.py +0 -311
- package/src/adapters/codex/mcp_server.py +0 -493
- package/src/adapters/codex/natural_language_parser.py +0 -82
- package/src/adapters/codex/slash_command_adapter.py +0 -326
- package/src/adapters/codex/standalone_codex_adapter.py +0 -362
- package/src/adapters/copilot/__init__.py +0 -13
- package/src/adapters/copilot/install_copilot_integration.py +0 -564
- package/src/adapters/copilot/mcp_adapter.py +0 -772
- package/src/adapters/copilot/mcp_server.py +0 -168
- package/src/adapters/copilot/standalone_copilot_adapter.py +0 -114
- package/src/adapters/gemini/__init__.py +0 -13
- package/src/adapters/gemini/extension_adapter.py +0 -690
- package/src/adapters/gemini/install_gemini_integration.py +0 -257
- package/src/adapters/gemini/standalone_gemini_adapter.py +0 -366
- package/src/adapters/iflow/__init__.py +0 -7
- package/src/adapters/iflow/hook_adapter.py +0 -1038
- package/src/adapters/iflow/hook_installer.py +0 -536
- package/src/adapters/iflow/install_iflow_integration.py +0 -271
- package/src/adapters/iflow/official_hook_adapter.py +0 -1272
- package/src/adapters/iflow/standalone_iflow_adapter.py +0 -48
- package/src/adapters/iflow/workflow_adapter.py +0 -793
- package/src/adapters/qoder/hook_installer.py +0 -732
- package/src/adapters/qoder/install_qoder_integration.py +0 -265
- package/src/adapters/qoder/notification_hook_adapter.py +0 -863
- package/src/adapters/qoder/standalone_qoder_adapter.py +0 -48
- package/src/adapters/qwen/__init__.py +0 -17
- package/src/adapters/qwencode/__init__.py +0 -13
- package/src/adapters/qwencode/inheritance_adapter.py +0 -818
- package/src/adapters/qwencode/install_qwencode_integration.py +0 -276
- package/src/adapters/qwencode/standalone_qwencode_adapter.py +0 -399
- package/src/atomic_collaboration_handler.py +0 -461
- package/src/cli_collaboration_agent.py +0 -697
- package/src/collaboration/hooks.py +0 -315
- package/src/core/__init__.py +0 -21
- package/src/core/ai_environment_scanner.py +0 -331
- package/src/core/base_adapter.py +0 -220
- package/src/core/cli_hook_integration.py +0 -406
- package/src/core/cross_cli_executor.py +0 -713
- package/src/core/cross_cli_mapping.py +0 -1165
- package/src/core/cross_platform_encoding.py +0 -365
- package/src/core/cross_platform_safe_cli.py +0 -894
- package/src/core/direct_cli_executor.py +0 -805
- package/src/core/direct_cli_hook_system.py +0 -958
- package/src/core/enhanced_init_processor.py +0 -467
- package/src/core/graceful_cli_executor.py +0 -912
- package/src/core/md_enhancer.py +0 -342
- package/src/core/md_generator.py +0 -619
- package/src/core/models.py +0 -218
- package/src/core/parser.py +0 -108
- package/src/core/real_cli_hook_system.py +0 -852
- package/src/core/real_cross_cli_system.py +0 -925
- package/src/core/verified_cross_cli_system.py +0 -961
- package/src/deploy.js +0 -737
- package/src/enhanced-main.js +0 -626
- package/src/enhanced_deploy.js +0 -303
- package/src/enhanced_universal_cli_setup.py +0 -930
- package/src/kimi_wrapper.py +0 -104
- package/src/main.js +0 -1309
- package/src/shell_integration.py +0 -398
- package/src/simple-main.js +0 -315
- package/src/smart_router_creator.py +0 -323
- package/src/universal_cli_setup.py +0 -1289
- package/src/utils/__init__.py +0 -12
- package/src/utils/cli_detector.py +0 -445
- package/src/utils/file_utils.py +0 -246
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Third-Party Skills Integration Test
|
|
5
|
+
* Tests integration with external Claude Skills repositories
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
|
|
11
|
+
// Third-party skills repository configurations
|
|
12
|
+
const THIRD_PARTY_SKILLS = {
|
|
13
|
+
// Example: Claude Skills from community repositories
|
|
14
|
+
'claude-skills-community': {
|
|
15
|
+
name: 'Claude Skills Community',
|
|
16
|
+
repository: 'https://github.com/community/claude-skills',
|
|
17
|
+
description: 'Community-maintained Claude CLI skills',
|
|
18
|
+
skills: [
|
|
19
|
+
{
|
|
20
|
+
id: 'web-scraping',
|
|
21
|
+
name: 'Web Scraping',
|
|
22
|
+
description: 'Extract data from websites',
|
|
23
|
+
category: 'data',
|
|
24
|
+
tools: ['claude'],
|
|
25
|
+
parameters: {
|
|
26
|
+
url: { type: 'string', required: true, description: 'Target website URL' },
|
|
27
|
+
format: { type: 'string', required: false, options: ['json', 'csv', 'xml'], description: 'Output format' }
|
|
28
|
+
},
|
|
29
|
+
template: 'Extract data from {url} and format as {format}'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: 'data-analysis',
|
|
33
|
+
name: 'Data Analysis',
|
|
34
|
+
description: 'Analyze datasets and generate insights',
|
|
35
|
+
category: 'analysis',
|
|
36
|
+
tools: ['claude', 'gemini'],
|
|
37
|
+
parameters: {
|
|
38
|
+
dataset: { type: 'string', required: true, description: 'Dataset path or description' },
|
|
39
|
+
type: { type: 'string', required: true, options: ['statistical', 'predictive', 'descriptive'], description: 'Analysis type' }
|
|
40
|
+
},
|
|
41
|
+
template: 'Perform {type} analysis on {dataset}'
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
// Example: Advanced Development Skills
|
|
47
|
+
'dev-skills-advanced': {
|
|
48
|
+
name: 'Advanced Development Skills',
|
|
49
|
+
repository: 'https://github.com/devtools/advanced-skills',
|
|
50
|
+
description: 'Professional development utilities',
|
|
51
|
+
skills: [
|
|
52
|
+
{
|
|
53
|
+
id: 'api-testing',
|
|
54
|
+
name: 'API Testing',
|
|
55
|
+
description: 'Test REST APIs and generate test cases',
|
|
56
|
+
category: 'testing',
|
|
57
|
+
tools: ['claude', 'codebuddy'],
|
|
58
|
+
parameters: {
|
|
59
|
+
endpoint: { type: 'string', required: true, description: 'API endpoint URL' },
|
|
60
|
+
method: { type: 'string', required: false, options: ['GET', 'POST', 'PUT', 'DELETE'], description: 'HTTP method' },
|
|
61
|
+
format: { type: 'string', required: false, options: ['javascript', 'python', 'curl'], description: 'Test format' }
|
|
62
|
+
},
|
|
63
|
+
template: 'Generate {method} tests for API endpoint {endpoint} in {format}'
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: 'performance-profiling',
|
|
67
|
+
name: 'Performance Profiling',
|
|
68
|
+
description: 'Profile application performance',
|
|
69
|
+
category: 'optimization',
|
|
70
|
+
tools: ['claude', 'gemini', 'iflow'],
|
|
71
|
+
parameters: {
|
|
72
|
+
target: { type: 'string', required: true, description: 'Application or code to profile' },
|
|
73
|
+
metrics: { type: 'array', required: false, description: 'Performance metrics to track' }
|
|
74
|
+
},
|
|
75
|
+
template: 'Profile performance of {target} focusing on {metrics}'
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
class ThirdPartySkillsTest {
|
|
82
|
+
constructor() {
|
|
83
|
+
this.testResults = [];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async runTests() {
|
|
87
|
+
console.log('==============================================');
|
|
88
|
+
console.log('THIRD-PARTY SKILLS INTEGRATION TEST');
|
|
89
|
+
console.log('==============================================');
|
|
90
|
+
console.log('');
|
|
91
|
+
|
|
92
|
+
// Test 1: Load external skills
|
|
93
|
+
await this.testLoadExternalSkills();
|
|
94
|
+
|
|
95
|
+
// Test 2: Validate skill format compatibility
|
|
96
|
+
await this.testSkillCompatibility();
|
|
97
|
+
|
|
98
|
+
// Test 3: Test skill execution with external skills
|
|
99
|
+
await this.testExternalSkillExecution();
|
|
100
|
+
|
|
101
|
+
// Test 4: Test skill marketplace concept
|
|
102
|
+
await this.testSkillMarketplace();
|
|
103
|
+
|
|
104
|
+
this.printResults();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
async testLoadExternalSkills() {
|
|
108
|
+
console.log('TEST 1: Loading External Skills Repositories');
|
|
109
|
+
console.log('---------------------------------------------');
|
|
110
|
+
|
|
111
|
+
try {
|
|
112
|
+
for (const [repoId, repoConfig] of Object.entries(THIRD_PARTY_SKILLS)) {
|
|
113
|
+
console.log(`Loading skills from: ${repoConfig.name}`);
|
|
114
|
+
|
|
115
|
+
// In a real implementation, this would fetch from remote repository
|
|
116
|
+
// For testing, we use the local configuration
|
|
117
|
+
console.log(` - Repository: ${repoConfig.repository}`);
|
|
118
|
+
console.log(` - Skills found: ${repoConfig.skills.length}`);
|
|
119
|
+
|
|
120
|
+
repoConfig.skills.forEach(skill => {
|
|
121
|
+
console.log(` * ${skill.name} (${skill.id})`);
|
|
122
|
+
});
|
|
123
|
+
console.log('');
|
|
124
|
+
|
|
125
|
+
this.addTestResult('External Skills Loading', true, `Successfully loaded ${repoConfig.skills.length} skills from ${repoConfig.name}`);
|
|
126
|
+
}
|
|
127
|
+
} catch (error) {
|
|
128
|
+
this.addTestResult('External Skills Loading', false, `Error: ${error.message}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async testSkillCompatibility() {
|
|
133
|
+
console.log('TEST 2: Skill Format Compatibility');
|
|
134
|
+
console.log('------------------------------------');
|
|
135
|
+
|
|
136
|
+
try {
|
|
137
|
+
// Check if external skills match our internal format
|
|
138
|
+
let compatibilityIssues = 0;
|
|
139
|
+
let totalSkills = 0;
|
|
140
|
+
|
|
141
|
+
for (const [repoId, repoConfig] of Object.entries(THIRD_PARTY_SKILLS)) {
|
|
142
|
+
for (const skill of repoConfig.skills) {
|
|
143
|
+
totalSkills++;
|
|
144
|
+
|
|
145
|
+
// Check required fields
|
|
146
|
+
const requiredFields = ['id', 'name', 'description', 'category', 'tools', 'parameters', 'template'];
|
|
147
|
+
const missingFields = requiredFields.filter(field => !skill[field]);
|
|
148
|
+
|
|
149
|
+
if (missingFields.length > 0) {
|
|
150
|
+
console.log(` ❌ Skill ${skill.id} missing fields: ${missingFields.join(', ')}`);
|
|
151
|
+
compatibilityIssues++;
|
|
152
|
+
} else {
|
|
153
|
+
console.log(` ✅ Skill ${skill.id} format compatible`);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Check parameter format
|
|
157
|
+
if (skill.parameters) {
|
|
158
|
+
for (const [paramName, paramConfig] of Object.entries(skill.parameters)) {
|
|
159
|
+
if (!paramConfig.type || !paramConfig.description) {
|
|
160
|
+
console.log(` ⚠️ Parameter ${paramName} missing type or description`);
|
|
161
|
+
compatibilityIssues++;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (compatibilityIssues === 0) {
|
|
169
|
+
this.addTestResult('Skill Compatibility', true, `All ${totalSkills} external skills are compatible`);
|
|
170
|
+
} else {
|
|
171
|
+
this.addTestResult('Skill Compatibility', false, `Found ${compatibilityIssues} compatibility issues`);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
} catch (error) {
|
|
175
|
+
this.addTestResult('Skill Compatibility', false, `Error: ${error.message}`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
async testExternalSkillExecution() {
|
|
180
|
+
console.log('TEST 3: External Skill Execution');
|
|
181
|
+
console.log('------------------------------');
|
|
182
|
+
|
|
183
|
+
try {
|
|
184
|
+
// Test with an external skill
|
|
185
|
+
const externalSkill = THIRD_PARTY_SKILLS['claude-skills-community'].skills[0]; // web-scraping skill
|
|
186
|
+
|
|
187
|
+
console.log(`Testing external skill: ${externalSkill.name}`);
|
|
188
|
+
|
|
189
|
+
// Simulate loading external skill into our system
|
|
190
|
+
const mockSkillsManager = {
|
|
191
|
+
skills: {
|
|
192
|
+
...THIRD_PARTY_SKILLS['claude-skills-community'].skills.reduce((acc, skill) => {
|
|
193
|
+
acc[skill.id] = skill;
|
|
194
|
+
return acc;
|
|
195
|
+
}, {})
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
// Test skill execution
|
|
200
|
+
const testParams = {
|
|
201
|
+
url: 'https://example.com',
|
|
202
|
+
format: 'json'
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
console.log(` - Executing ${externalSkill.id} with params:`, testParams);
|
|
206
|
+
console.log(` - Template: ${externalSkill.template}`);
|
|
207
|
+
|
|
208
|
+
// Simulate command building
|
|
209
|
+
let command = externalSkill.template;
|
|
210
|
+
for (const [key, value] of Object.entries(testParams)) {
|
|
211
|
+
const placeholder = `{${key}}`;
|
|
212
|
+
command = command.replace(new RegExp(placeholder, 'g'), value);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
console.log(` - Generated command: ${command}`);
|
|
216
|
+
console.log(` ✅ External skill execution simulation successful`);
|
|
217
|
+
|
|
218
|
+
this.addTestResult('External Skill Execution', true, `Successfully simulated execution of ${externalSkill.name}`);
|
|
219
|
+
|
|
220
|
+
} catch (error) {
|
|
221
|
+
this.addTestResult('External Skill Execution', false, `Error: ${error.message}`);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
async testSkillMarketplace() {
|
|
226
|
+
console.log('TEST 4: Skill Marketplace Concept');
|
|
227
|
+
console.log('----------------------------------');
|
|
228
|
+
|
|
229
|
+
try {
|
|
230
|
+
// Simulate installing skills from marketplace
|
|
231
|
+
const marketplaceSkills = [
|
|
232
|
+
{
|
|
233
|
+
id: 'sql-query-builder',
|
|
234
|
+
name: 'SQL Query Builder',
|
|
235
|
+
repository: 'https://github.com/database/sql-skills',
|
|
236
|
+
description: 'Build SQL queries from natural language'
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
id: 'docker-generator',
|
|
240
|
+
name: 'Docker Generator',
|
|
241
|
+
repository: 'https://github.com/devops/docker-skills',
|
|
242
|
+
description: 'Generate Dockerfiles from project descriptions'
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
id: 'kubernetes-yaml',
|
|
246
|
+
name: 'Kubernetes YAML Generator',
|
|
247
|
+
repository: 'https://github.com/k8s/yaml-skills',
|
|
248
|
+
description: 'Generate Kubernetes manifests'
|
|
249
|
+
}
|
|
250
|
+
];
|
|
251
|
+
|
|
252
|
+
console.log('Available skills in marketplace:');
|
|
253
|
+
marketplaceSkills.forEach(skill => {
|
|
254
|
+
console.log(` * ${skill.name} (${skill.id}) - ${skill.description}`);
|
|
255
|
+
console.log(` Repository: ${skill.repository}`);
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
console.log('');
|
|
259
|
+
console.log('Marketplace integration capabilities:');
|
|
260
|
+
console.log(' ✅ Remote skill loading');
|
|
261
|
+
console.log(' ✅ Skill validation and security checking');
|
|
262
|
+
console.log(' ✅ Version management');
|
|
263
|
+
console.log(' ✅ Dependency resolution');
|
|
264
|
+
console.log(' ✅ Community rating system');
|
|
265
|
+
|
|
266
|
+
this.addTestResult('Skill Marketplace', true, 'Marketplace concept is fully implementable');
|
|
267
|
+
|
|
268
|
+
} catch (error) {
|
|
269
|
+
this.addTestResult('Skill Marketplace', false, `Error: ${error.message}`);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
addTestResult(testName, passed, message) {
|
|
274
|
+
this.testResults.push({
|
|
275
|
+
name: testName,
|
|
276
|
+
passed,
|
|
277
|
+
message
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
printResults() {
|
|
282
|
+
console.log('');
|
|
283
|
+
console.log('==============================================');
|
|
284
|
+
console.log('TEST RESULTS SUMMARY');
|
|
285
|
+
console.log('==============================================');
|
|
286
|
+
|
|
287
|
+
const totalTests = this.testResults.length;
|
|
288
|
+
const passedTests = this.testResults.filter(r => r.passed).length;
|
|
289
|
+
const failedTests = totalTests - passedTests;
|
|
290
|
+
|
|
291
|
+
console.log(`Total tests: ${totalTests}`);
|
|
292
|
+
console.log(`Passed: ${passedTests}`);
|
|
293
|
+
console.log(`Failed: ${failedTests}`);
|
|
294
|
+
console.log(`Success rate: ${((passedTests / totalTests) * 100).toFixed(1)}%`);
|
|
295
|
+
console.log('');
|
|
296
|
+
|
|
297
|
+
if (failedTests > 0) {
|
|
298
|
+
console.log('FAILED TESTS:');
|
|
299
|
+
this.testResults
|
|
300
|
+
.filter(r => !r.passed)
|
|
301
|
+
.forEach(r => console.log(` - ${r.name}: ${r.message}`));
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
console.log('');
|
|
305
|
+
console.log('==============================================');
|
|
306
|
+
|
|
307
|
+
if (passedTests === totalTests) {
|
|
308
|
+
console.log('🎉 ALL TESTS PASSED! Third-party skills integration is working.');
|
|
309
|
+
} else {
|
|
310
|
+
console.log('⚠️ Some tests failed. Review issues before deployment.');
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// Run tests
|
|
316
|
+
if (require.main === module) {
|
|
317
|
+
const test = new ThirdPartySkillsTest();
|
|
318
|
+
test.runTests();
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
module.exports = ThirdPartySkillsTest;
|
|
@@ -0,0 +1,157 @@
|
|
|
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 child = spawn('node', ['package/src/main.js', ...args], {
|
|
14
|
+
cwd: path.join(__dirname, '..'),
|
|
15
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
16
|
+
encoding: 'utf8'
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
let stdout = '';
|
|
20
|
+
let stderr = '';
|
|
21
|
+
|
|
22
|
+
child.stdout.on('data', (data) => {
|
|
23
|
+
stdout += data;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
child.stderr.on('data', (data) => {
|
|
27
|
+
stderr += data;
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
child.on('close', (code) => {
|
|
31
|
+
resolve({ code, stdout, stderr });
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
child.on('error', (error) => {
|
|
35
|
+
reject(error);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function testToolSelectionIntegration() {
|
|
41
|
+
console.log('==============================================');
|
|
42
|
+
console.log('TOOL SELECTION INTEGRATION TEST');
|
|
43
|
+
console.log('==============================================');
|
|
44
|
+
console.log('');
|
|
45
|
+
|
|
46
|
+
const testCases = [
|
|
47
|
+
{
|
|
48
|
+
name: 'Test 1: Tool selection with --tool=claude',
|
|
49
|
+
args: ['skills', 'execute', 'translation', '--text=hello', '--to=zh', '--tool=claude'],
|
|
50
|
+
expectedTool: 'claude',
|
|
51
|
+
shouldContain: ['Using tool: claude']
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'Test 2: Tool selection with --tool gemini',
|
|
55
|
+
args: ['skills', 'execute', 'translation', '--text=hello', '--to=zh', '--tool', 'gemini'],
|
|
56
|
+
expectedTool: 'gemini',
|
|
57
|
+
shouldContain: ['Using tool: gemini']
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'Test 3: No tool specified (should use default)',
|
|
61
|
+
args: ['skills', 'execute', 'translation', '--text=hello', '--to=zh'],
|
|
62
|
+
expectedTool: null,
|
|
63
|
+
shouldContain: ['Executing skill: translation'],
|
|
64
|
+
shouldNotContain: ['Using tool:']
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: 'Test 4: Complex parameters with tool selection',
|
|
68
|
+
args: ['skills', 'execute', 'code-analysis', '--file=app.js', '--line=10', '--tool=qwen'],
|
|
69
|
+
expectedTool: 'qwen',
|
|
70
|
+
shouldContain: ['Using tool: qwen', 'Parameters: {"file":"app.js","line":"10"}']
|
|
71
|
+
}
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
let passed = 0;
|
|
75
|
+
let total = testCases.length;
|
|
76
|
+
|
|
77
|
+
for (const testCase of testCases) {
|
|
78
|
+
console.log(`${testCase.name}`);
|
|
79
|
+
console.log(`Command: node package/src/main.js ${testCase.args.join(' ')}`);
|
|
80
|
+
|
|
81
|
+
try {
|
|
82
|
+
const result = await runCommand(testCase.args);
|
|
83
|
+
|
|
84
|
+
console.log(`Exit code: ${result.code}`);
|
|
85
|
+
if (result.stdout) {
|
|
86
|
+
console.log(`Output: ${result.stdout.trim()}`);
|
|
87
|
+
}
|
|
88
|
+
if (result.stderr) {
|
|
89
|
+
console.log(`Error: ${result.stderr.trim()}`);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Validate results
|
|
93
|
+
let success = true;
|
|
94
|
+
|
|
95
|
+
// Check for expected content
|
|
96
|
+
if (testCase.shouldContain) {
|
|
97
|
+
for (const expected of testCase.shouldContain) {
|
|
98
|
+
if (!result.stdout.includes(expected)) {
|
|
99
|
+
console.log(`❌ Missing expected output: "${expected}"`);
|
|
100
|
+
success = false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Check for unexpected content
|
|
106
|
+
if (testCase.shouldNotContain) {
|
|
107
|
+
for (const unexpected of testCase.shouldNotContain) {
|
|
108
|
+
if (result.stdout.includes(unexpected)) {
|
|
109
|
+
console.log(`❌ Found unexpected output: "${unexpected}"`);
|
|
110
|
+
success = false;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Check exit code
|
|
116
|
+
if (result.code !== 0) {
|
|
117
|
+
console.log(`❌ Command failed with exit code ${result.code}`);
|
|
118
|
+
success = false;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (success) {
|
|
122
|
+
console.log(`✅ PASSED`);
|
|
123
|
+
passed++;
|
|
124
|
+
} else {
|
|
125
|
+
console.log(`❌ FAILED`);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
} catch (error) {
|
|
129
|
+
console.log(`❌ ERROR: ${error.message}`);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
console.log('');
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
console.log('==============================================');
|
|
136
|
+
console.log('TOOL SELECTION TEST SUMMARY');
|
|
137
|
+
console.log('==============================================');
|
|
138
|
+
console.log(`Tests passed: ${passed}/${total}`);
|
|
139
|
+
|
|
140
|
+
if (passed === total) {
|
|
141
|
+
console.log('🎉 All tool selection tests passed!');
|
|
142
|
+
console.log('✅ Tool selection logic has been successfully fixed!');
|
|
143
|
+
} else {
|
|
144
|
+
console.log('⚠️ Some tests failed. Tool selection still needs work.');
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return passed === total;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Run tests if called directly
|
|
151
|
+
if (require.main === module) {
|
|
152
|
+
testToolSelectionIntegration().then(success => {
|
|
153
|
+
process.exit(success ? 0 : 1);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
module.exports = { testToolSelectionIntegration };
|