stigmergy 1.2.13 β 1.3.2-beta.0
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 +39 -3
- package/STIGMERGY.md +3 -0
- package/config/enhanced-cli-config.json +438 -0
- package/docs/CLI_TOOLS_AGENT_SKILL_ANALYSIS.md +463 -0
- package/docs/ENHANCED_CLI_AGENT_SKILL_CONFIG.md +285 -0
- package/docs/INSTALLER_ARCHITECTURE.md +257 -0
- package/docs/SUDO_PROBLEM_AND_SOLUTION.md +529 -0
- package/package.json +14 -5
- package/scripts/analyze-router.js +168 -0
- package/scripts/test-runner.js +344 -0
- package/src/cli/commands/autoinstall.js +158 -0
- package/src/cli/commands/errors.js +190 -0
- package/src/cli/commands/install.js +142 -0
- package/src/cli/commands/permissions.js +108 -0
- package/src/cli/commands/project.js +449 -0
- package/src/cli/commands/resume.js +136 -0
- package/src/cli/commands/scan.js +97 -0
- package/src/cli/commands/skills.js +158 -0
- package/src/cli/commands/status.js +106 -0
- package/src/cli/commands/system.js +301 -0
- package/src/cli/router-beta.js +477 -0
- package/src/cli/utils/environment.js +75 -0
- package/src/cli/utils/formatters.js +47 -0
- package/src/cli/utils/skills_cache.js +92 -0
- package/src/core/cache_cleaner.js +1 -0
- package/src/core/cli_adapters.js +345 -0
- package/src/core/cli_help_analyzer.js +473 -1
- package/src/core/cli_path_detector.js +2 -1
- package/src/core/cli_tools.js +107 -0
- package/src/core/coordination/nodejs/HookDeploymentManager.js +185 -422
- package/src/core/coordination/nodejs/HookDeploymentManager.refactored.js +323 -0
- package/src/core/coordination/nodejs/generators/CLIAdapterGenerator.js +363 -0
- package/src/core/coordination/nodejs/generators/ResumeSessionGenerator.js +701 -0
- package/src/core/coordination/nodejs/generators/SkillsIntegrationGenerator.js +1210 -0
- package/src/core/coordination/nodejs/generators/index.js +12 -0
- package/src/core/enhanced_cli_installer.js +220 -30
- package/src/core/enhanced_cli_parameter_handler.js +395 -0
- package/src/core/execution_mode_detector.js +222 -0
- package/src/core/installer.js +51 -70
- package/src/core/local_skill_scanner.js +732 -0
- package/src/core/multilingual/language-pattern-manager.js +1 -1
- package/src/core/skills/StigmergySkillManager.js +26 -8
- package/src/core/smart_router.js +279 -2
- package/src/index.js +10 -4
- package/test/cli-integration.test.js +304 -0
- package/test/enhanced-cli-agent-skill-test.js +485 -0
- package/test/specific-cli-agent-skill-analysis.js +385 -0
- package/src/cli/router.js +0 -1783
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Enhanced CLI Agent and Skill Testing Script
|
|
5
|
+
* Tests the enhanced CLI calling functionality with agent and skill support
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const os = require('os');
|
|
10
|
+
|
|
11
|
+
// Import enhanced components
|
|
12
|
+
const CLIHelpAnalyzer = require('../src/core/cli_help_analyzer');
|
|
13
|
+
const SmartRouter = require('../src/core/smart_router');
|
|
14
|
+
|
|
15
|
+
class EnhancedCLITester {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.analyzer = new CLIHelpAnalyzer();
|
|
18
|
+
this.router = new SmartRouter();
|
|
19
|
+
this.testResults = {
|
|
20
|
+
passed: 0,
|
|
21
|
+
failed: 0,
|
|
22
|
+
tests: []
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Run all tests
|
|
28
|
+
*/
|
|
29
|
+
async runAllTests() {
|
|
30
|
+
console.log('π Starting Enhanced CLI Agent and Skill Tests');
|
|
31
|
+
console.log('=' .repeat(60));
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
// Initialize components
|
|
35
|
+
await this.initializeComponents();
|
|
36
|
+
|
|
37
|
+
// Run test categories
|
|
38
|
+
await this.testAnalyzerEnhancedFeatures();
|
|
39
|
+
await this.testRouterEnhancedFeatures();
|
|
40
|
+
await this.testSkillMapping();
|
|
41
|
+
await this.testAgentDetection();
|
|
42
|
+
await this.testCommandGeneration();
|
|
43
|
+
await this.testRoutingOptimization();
|
|
44
|
+
|
|
45
|
+
// Show results
|
|
46
|
+
this.showTestResults();
|
|
47
|
+
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error('β Test suite failed:', error.message);
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Initialize test components
|
|
56
|
+
*/
|
|
57
|
+
async initializeComponents() {
|
|
58
|
+
console.log('\nπ Initializing test components...');
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
await this.analyzer.initialize();
|
|
62
|
+
await this.router.initialize();
|
|
63
|
+
console.log('β
Components initialized successfully');
|
|
64
|
+
} catch (error) {
|
|
65
|
+
console.error('β Failed to initialize components:', error.message);
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Test enhanced analyzer features
|
|
72
|
+
*/
|
|
73
|
+
async testAnalyzerEnhancedFeatures() {
|
|
74
|
+
console.log('\nπ Testing Enhanced Analyzer Features...');
|
|
75
|
+
|
|
76
|
+
const tests = [
|
|
77
|
+
{
|
|
78
|
+
name: 'Enhanced CLI Pattern Detection',
|
|
79
|
+
test: () => this.testEnhancedPatternDetection()
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'Agent Skill Detection',
|
|
83
|
+
test: () => this.testAgentSkillDetection()
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'Prompt Optimization',
|
|
87
|
+
test: () => this.testPromptOptimization()
|
|
88
|
+
}
|
|
89
|
+
];
|
|
90
|
+
|
|
91
|
+
await this.runTestCategory('Analyzer Enhanced Features', tests);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Test enhanced router features
|
|
96
|
+
*/
|
|
97
|
+
async testRouterEnhancedFeatures() {
|
|
98
|
+
console.log('\nπ§ Testing Enhanced Router Features...');
|
|
99
|
+
|
|
100
|
+
const tests = [
|
|
101
|
+
{
|
|
102
|
+
name: 'Enhanced Smart Routing',
|
|
103
|
+
test: () => this.testEnhancedSmartRouting()
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'Agent Skill Compatibility Scoring',
|
|
107
|
+
test: () => this.testCompatibilityScoring()
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: 'Fallback Route Generation',
|
|
111
|
+
test: () => this.testFallbackRoutes()
|
|
112
|
+
}
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
await this.runTestCategory('Router Enhanced Features', tests);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Test skill mapping functionality
|
|
120
|
+
*/
|
|
121
|
+
async testSkillMapping() {
|
|
122
|
+
console.log('\nπΊοΈ Testing Skill Mapping...');
|
|
123
|
+
|
|
124
|
+
const testInputs = [
|
|
125
|
+
{
|
|
126
|
+
input: 'θ―·δ½Ώη¨εΌεεζζθ½εζη¨εΊεεΌεη°θ±‘',
|
|
127
|
+
expectedSkills: ['εΌεεζ'],
|
|
128
|
+
expectedCLIs: ['claude', 'iflow', 'qwen', 'codebuddy']
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
input: 'δ½Ώη¨ζ°ε马ε
ζζΊθ½δ½θΏθ‘εΌεεζ',
|
|
132
|
+
expectedSkills: ['马ε
ζεζ', 'εΌεεζ'],
|
|
133
|
+
expectedCLIs: ['claude', 'iflow', 'qwen']
|
|
134
|
+
}
|
|
135
|
+
];
|
|
136
|
+
|
|
137
|
+
for (const testCase of testInputs) {
|
|
138
|
+
await this.runSkillMappingTest(testCase);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Test agent detection
|
|
144
|
+
*/
|
|
145
|
+
async testAgentDetection() {
|
|
146
|
+
console.log('\nπ€ Testing Agent Detection...');
|
|
147
|
+
|
|
148
|
+
const agentTestCases = [
|
|
149
|
+
{
|
|
150
|
+
input: 'θ―·δ½Ώη¨εΌεεζζθ½εζη¨εΊεεΌεη°θ±‘',
|
|
151
|
+
expectedDetections: { hasAgent: true, hasSkill: true }
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
input: 'δ½Ώη¨ζ°ε马ε
ζζΊθ½δ½θΏθ‘ιΆηΊ§εζ',
|
|
155
|
+
expectedDetections: { hasAgent: true, hasSkill: true }
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
input: 'codebuddy -y -p "skill:alienation-analysis εζη¨εΊεεΌε"',
|
|
159
|
+
expectedDetections: { hasAgent: false, hasSkill: true }
|
|
160
|
+
}
|
|
161
|
+
];
|
|
162
|
+
|
|
163
|
+
for (const testCase of agentTestCases) {
|
|
164
|
+
await this.runAgentDetectionTest(testCase);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Test command generation
|
|
170
|
+
*/
|
|
171
|
+
async testCommandGeneration() {
|
|
172
|
+
console.log('\nβοΈ Testing Command Generation...');
|
|
173
|
+
|
|
174
|
+
const commandTestCases = [
|
|
175
|
+
{
|
|
176
|
+
cliName: 'claude',
|
|
177
|
+
prompt: 'θ―·δ½Ώη¨εΌεεζζθ½εζη¨εΊεεΌεη°θ±‘',
|
|
178
|
+
expectedFormat: 'claude -p'
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
cliName: 'qwen',
|
|
182
|
+
prompt: 'δ½Ώη¨ζ°ε马ε
ζζΊθ½δ½θΏθ‘εΌεεζ',
|
|
183
|
+
expectedFormat: 'qwen'
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
cliName: 'codebuddy',
|
|
187
|
+
prompt: 'skill:alienation-analysis εζη¨εΊεεΌεη°θ±‘',
|
|
188
|
+
expectedFormat: 'codebuddy -y -p'
|
|
189
|
+
}
|
|
190
|
+
];
|
|
191
|
+
|
|
192
|
+
for (const testCase of commandTestCases) {
|
|
193
|
+
await this.runCommandGenerationTest(testCase);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Test routing optimization
|
|
199
|
+
*/
|
|
200
|
+
async testRoutingOptimization() {
|
|
201
|
+
console.log('\nπ― Testing Routing Optimization...');
|
|
202
|
+
|
|
203
|
+
const routingTestCases = [
|
|
204
|
+
'θ―·δ½Ώη¨εΌεεζζθ½εζη¨εΊεεΌεη°θ±‘',
|
|
205
|
+
'δ½Ώη¨ζ°ε马ε
ζζΊθ½δ½θΏθ‘ιΆηΊ§εζ',
|
|
206
|
+
'codebuddy -y -p "skill:alienation-analysis εζη¨εΊεεΌε"'
|
|
207
|
+
];
|
|
208
|
+
|
|
209
|
+
for (const input of routingTestCases) {
|
|
210
|
+
await this.runRoutingOptimizationTest(input);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Run a test category
|
|
216
|
+
*/
|
|
217
|
+
async runTestCategory(categoryName, tests) {
|
|
218
|
+
console.log(`\nπ Running ${categoryName} tests...`);
|
|
219
|
+
|
|
220
|
+
for (const test of tests) {
|
|
221
|
+
try {
|
|
222
|
+
await test.test();
|
|
223
|
+
this.testResults.passed++;
|
|
224
|
+
this.testResults.tests.push({
|
|
225
|
+
name: test.name,
|
|
226
|
+
category: categoryName,
|
|
227
|
+
status: 'passed'
|
|
228
|
+
});
|
|
229
|
+
console.log(`β
${test.name}`);
|
|
230
|
+
} catch (error) {
|
|
231
|
+
this.testResults.failed++;
|
|
232
|
+
this.testResults.tests.push({
|
|
233
|
+
name: test.name,
|
|
234
|
+
category: categoryName,
|
|
235
|
+
status: 'failed',
|
|
236
|
+
error: error.message
|
|
237
|
+
});
|
|
238
|
+
console.log(`β ${test.name}: ${error.message}`);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Test enhanced pattern detection
|
|
245
|
+
*/
|
|
246
|
+
async testEnhancedPatternDetection() {
|
|
247
|
+
const cliName = 'claude';
|
|
248
|
+
|
|
249
|
+
// Check if analyzer has the enhanced method
|
|
250
|
+
if (!this.analyzer.getEnhancedCLIPattern) {
|
|
251
|
+
console.log(` β οΈ Enhanced pattern detection not available, skipping test`);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const pattern = await this.analyzer.getEnhancedCLIPattern(cliName);
|
|
256
|
+
|
|
257
|
+
if (!pattern) {
|
|
258
|
+
throw new Error(`Failed to get enhanced pattern for ${cliName}`);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (!pattern.agentSkillSupport) {
|
|
262
|
+
throw new Error('Enhanced pattern missing agentSkillSupport');
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
console.log(` π Pattern for ${cliName}:`, {
|
|
266
|
+
supportsAgents: pattern.agentSkillSupport.supportsAgents,
|
|
267
|
+
supportsSkills: pattern.agentSkillSupport.supportsSkills,
|
|
268
|
+
naturalLanguageSupport: pattern.agentSkillSupport.naturalLanguageSupport
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Test agent skill detection
|
|
274
|
+
*/
|
|
275
|
+
async testAgentSkillDetection() {
|
|
276
|
+
const testInput = 'θ―·δ½Ώη¨εΌεεζζθ½εζη¨εΊεεΌεη°θ±‘';
|
|
277
|
+
const detections = this.analyzer.detectAgentSkillMentions(testInput, 'claude');
|
|
278
|
+
|
|
279
|
+
if (!detections.hasAgent && !detections.hasSkill) {
|
|
280
|
+
throw new Error('Failed to detect agent or skill in test input');
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
console.log(` π Detections for test input:`, detections);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Test prompt optimization
|
|
288
|
+
*/
|
|
289
|
+
async testPromptOptimization() {
|
|
290
|
+
const originalPrompt = 'θ―·δ½Ώη¨εΌεεζζθ½εζη¨εΊεεΌεη°θ±‘';
|
|
291
|
+
const optimizedPrompt = this.analyzer.optimizePromptForCLI(originalPrompt, 'claude', {});
|
|
292
|
+
|
|
293
|
+
if (!optimizedPrompt || optimizedPrompt.length === 0) {
|
|
294
|
+
throw new Error('Prompt optimization failed');
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
console.log(` π§ Optimized prompt: ${optimizedPrompt}`);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Test enhanced smart routing
|
|
302
|
+
*/
|
|
303
|
+
async testEnhancedSmartRouting() {
|
|
304
|
+
const testInput = 'θ―·δ½Ώη¨εΌεεζζθ½εζη¨εΊεεΌεη°θ±‘';
|
|
305
|
+
const route = await this.router.smartRouteEnhanced(testInput);
|
|
306
|
+
|
|
307
|
+
if (!route.tool) {
|
|
308
|
+
throw new Error('Enhanced routing failed to return tool');
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
console.log(` π§ Enhanced route: ${route.tool} (confidence: ${route.confidence})`);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Test compatibility scoring
|
|
316
|
+
*/
|
|
317
|
+
async testCompatibilityScoring() {
|
|
318
|
+
const compatibility = await this.router.getAgentSkillCompatibilityScore('claude', 'θ―·δ½Ώη¨εΌεεζζθ½εζη¨εΊεεΌεη°θ±‘');
|
|
319
|
+
|
|
320
|
+
if (!compatibility || typeof compatibility.score !== 'number') {
|
|
321
|
+
throw new Error('Compatibility scoring failed');
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
console.log(` π Compatibility score for claude: ${compatibility.score}`);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Test fallback routes
|
|
329
|
+
*/
|
|
330
|
+
async testFallbackRoutes() {
|
|
331
|
+
const primaryRoute = {
|
|
332
|
+
tool: 'nonexistent',
|
|
333
|
+
prompt: 'ζ΅θ―ζη€Ί'
|
|
334
|
+
};
|
|
335
|
+
const error = new Error('Test error');
|
|
336
|
+
|
|
337
|
+
const fallbacks = await this.router.generateFallbackRoutes(primaryRoute, error);
|
|
338
|
+
|
|
339
|
+
console.log(` π Generated ${fallbacks.length} fallback routes`);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Run skill mapping test
|
|
344
|
+
*/
|
|
345
|
+
async runSkillMappingTest(testCase) {
|
|
346
|
+
console.log(`\n πΊοΈ Testing skill mapping for: "${testCase.input}"`);
|
|
347
|
+
|
|
348
|
+
for (const cliName of testCase.expectedCLIs) {
|
|
349
|
+
try {
|
|
350
|
+
const optimizedCall = this.analyzer.generateOptimizedCall(cliName, testCase.input);
|
|
351
|
+
if (optimizedCall) {
|
|
352
|
+
console.log(` β
${cliName}: ${optimizedCall.fullCommand}`);
|
|
353
|
+
}
|
|
354
|
+
} catch (error) {
|
|
355
|
+
console.log(` β ${cliName}: ${error.message}`);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Run agent detection test
|
|
362
|
+
*/
|
|
363
|
+
async runAgentDetectionTest(testCase) {
|
|
364
|
+
console.log(`\n π€ Testing agent detection for: "${testCase.input}"`);
|
|
365
|
+
|
|
366
|
+
for (const cliName of ['claude', 'qwen', 'codebuddy']) {
|
|
367
|
+
try {
|
|
368
|
+
const detections = this.analyzer.detectAgentSkillMentions(testCase.input, cliName);
|
|
369
|
+
console.log(` ${cliName}:`, detections);
|
|
370
|
+
|
|
371
|
+
// Check if detection meets expectations
|
|
372
|
+
const hasExpectedAgent = testCase.expectedDetections.hasAgent === detections.hasAgent;
|
|
373
|
+
const hasExpectedSkill = testCase.expectedDetections.hasSkill === detections.hasSkill;
|
|
374
|
+
|
|
375
|
+
if (!hasExpectedAgent || !hasExpectedSkill) {
|
|
376
|
+
console.log(` β οΈ Detection mismatch for ${cliName}`);
|
|
377
|
+
}
|
|
378
|
+
} catch (error) {
|
|
379
|
+
console.log(` β ${cliName}: ${error.message}`);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Run command generation test
|
|
386
|
+
*/
|
|
387
|
+
async runCommandGenerationTest(testCase) {
|
|
388
|
+
console.log(`\n βοΈ Testing command generation for ${testCase.cliName}:`);
|
|
389
|
+
console.log(` Input: "${testCase.prompt}"`);
|
|
390
|
+
|
|
391
|
+
try {
|
|
392
|
+
const optimizedCall = this.analyzer.generateOptimizedCall(testCase.cliName, testCase.prompt);
|
|
393
|
+
if (optimizedCall) {
|
|
394
|
+
console.log(` β
Generated: ${optimizedCall.fullCommand}`);
|
|
395
|
+
|
|
396
|
+
// Verify format
|
|
397
|
+
if (!optimizedCall.fullCommand.includes(testCase.expectedFormat)) {
|
|
398
|
+
console.log(` β οΈ Expected format "${testCase.expectedFormat}" not found`);
|
|
399
|
+
}
|
|
400
|
+
} else {
|
|
401
|
+
console.log(` β Failed to generate command`);
|
|
402
|
+
}
|
|
403
|
+
} catch (error) {
|
|
404
|
+
console.log(` β Error: ${error.message}`);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Run routing optimization test
|
|
410
|
+
*/
|
|
411
|
+
async runRoutingOptimizationTest(input) {
|
|
412
|
+
console.log(`\n π― Testing routing optimization for: "${input}"`);
|
|
413
|
+
|
|
414
|
+
try {
|
|
415
|
+
const route = await this.router.smartRouteEnhanced(input);
|
|
416
|
+
console.log(` β
Routed to: ${route.tool}`);
|
|
417
|
+
console.log(` π Confidence: ${route.confidence}`);
|
|
418
|
+
console.log(` π§ Optimized prompt: ${route.prompt}`);
|
|
419
|
+
|
|
420
|
+
if (route.alternativeOptions && route.alternativeOptions.length > 0) {
|
|
421
|
+
console.log(` π Alternatives: ${route.alternativeOptions.map(opt => opt.tool).join(', ')}`);
|
|
422
|
+
}
|
|
423
|
+
} catch (error) {
|
|
424
|
+
console.log(` β Routing failed: ${error.message}`);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Show test results summary
|
|
430
|
+
*/
|
|
431
|
+
showTestResults() {
|
|
432
|
+
console.log('\n' + '=' .repeat(60));
|
|
433
|
+
console.log('π TEST RESULTS SUMMARY');
|
|
434
|
+
console.log('=' .repeat(60));
|
|
435
|
+
|
|
436
|
+
console.log(`β
Passed: ${this.testResults.passed}`);
|
|
437
|
+
console.log(`β Failed: ${this.testResults.failed}`);
|
|
438
|
+
console.log(`π Success Rate: ${((this.testResults.passed / (this.testResults.passed + this.testResults.failed)) * 100).toFixed(1)}%`);
|
|
439
|
+
|
|
440
|
+
if (this.testResults.failed > 0) {
|
|
441
|
+
console.log('\nβ Failed Tests:');
|
|
442
|
+
this.testResults.tests
|
|
443
|
+
.filter(test => test.status === 'failed')
|
|
444
|
+
.forEach(test => {
|
|
445
|
+
console.log(` - ${test.category}: ${test.name}`);
|
|
446
|
+
console.log(` Error: ${test.error}`);
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
console.log('\nπ Enhanced CLI Agent and Skill Testing Complete!');
|
|
451
|
+
|
|
452
|
+
if (this.testResults.failed === 0) {
|
|
453
|
+
console.log('β¨ All tests passed! Enhanced functionality is working correctly.');
|
|
454
|
+
} else {
|
|
455
|
+
console.log('β οΈ Some tests failed. Please check the errors above.');
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
// Main execution
|
|
461
|
+
async function main() {
|
|
462
|
+
const tester = new EnhancedCLITester();
|
|
463
|
+
await tester.runAllTests();
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
// Handle errors
|
|
467
|
+
process.on('unhandledRejection', (reason, promise) => {
|
|
468
|
+
console.error('[FATAL] Unhandled Rejection at:', promise, 'reason:', reason);
|
|
469
|
+
process.exit(1);
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
process.on('uncaughtException', (error) => {
|
|
473
|
+
console.error('[FATAL] Uncaught Exception:', error);
|
|
474
|
+
process.exit(1);
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
// Run tests if this file is executed directly
|
|
478
|
+
if (require.main === module) {
|
|
479
|
+
main().catch((error) => {
|
|
480
|
+
console.error('[FATAL] Test execution failed:', error);
|
|
481
|
+
process.exit(1);
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
module.exports = EnhancedCLITester;
|