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.
- package/LICENSE +18 -18
- package/README.md +28 -223
- package/STIGMERGY.md +61 -61
- package/docs/PROJECT_CONSTITUTION.md +433 -433
- package/docs/PROJECT_STRUCTURE_CURRENT.md +80 -80
- package/examples/calculator-example.js +72 -72
- package/examples/cline_usage_examples.md +364 -364
- package/examples/encryption-example.js +67 -67
- package/examples/json-parser-example.js +120 -120
- package/examples/json-validation-example.js +64 -64
- package/examples/rest-client-example.js +52 -52
- package/examples/rest_client_example.js +54 -54
- package/package.json +15 -7
- package/scripts/build.js +74 -74
- package/scripts/post-deployment-config.js +296 -296
- package/scripts/preinstall-check.js +173 -111
- package/scripts/publish.js +58 -268
- package/scripts/run-layered-tests.js +247 -0
- package/scripts/safe-install.js +139 -139
- package/scripts/simple-publish.js +57 -59
- package/src/adapters/claude/install_claude_integration.js +292 -0
- package/src/adapters/codebuddy/install_codebuddy_integration.js +349 -0
- package/src/adapters/codex/install_codex_integration.js +395 -0
- package/src/adapters/copilot/install_copilot_integration.js +716 -0
- package/src/adapters/gemini/install_gemini_integration.js +304 -0
- package/src/adapters/iflow/install_iflow_integration.js +304 -0
- package/src/adapters/qoder/install_qoder_integration.js +1090 -0
- package/src/adapters/qwen/install_qwen_integration.js +285 -0
- package/src/auth.js +173 -173
- package/src/auth_command.js +208 -208
- package/src/calculator.js +313 -313
- package/src/cli/router.js +792 -67
- package/src/core/cache_cleaner.js +767 -0
- package/src/core/cli_help_analyzer.js +680 -674
- package/src/core/cli_parameter_handler.js +132 -127
- package/src/core/cli_tools.js +89 -89
- package/src/core/coordination/index.js +16 -16
- package/src/core/coordination/nodejs/AdapterManager.js +102 -89
- package/src/core/coordination/nodejs/CLCommunication.js +132 -124
- package/src/core/coordination/nodejs/CLIIntegrationManager.js +272 -236
- package/src/core/coordination/nodejs/HealthChecker.js +76 -77
- package/src/core/coordination/nodejs/HookDeploymentManager.js +263 -190
- package/src/core/coordination/nodejs/StatisticsCollector.js +71 -71
- package/src/core/coordination/nodejs/index.js +90 -72
- package/src/core/coordination/nodejs/utils/Logger.js +29 -29
- package/src/core/enhanced_installer.js +479 -0
- package/src/core/enhanced_uninstaller.js +638 -0
- package/src/core/error_handler.js +406 -406
- package/src/core/installer.js +816 -294
- package/src/core/memory_manager.js +83 -83
- package/src/core/rest_client.js +160 -160
- package/src/core/smart_router.js +249 -146
- package/src/core/upgrade_manager.js +420 -0
- package/src/data_encryption.js +143 -143
- package/src/data_structures.js +440 -440
- package/src/deploy.js +55 -55
- package/src/index.js +30 -30
- package/src/test/cli-availability-checker.js +194 -0
- package/src/test/test-environment.js +289 -0
- package/src/utils/helpers.js +35 -35
- package/src/utils.js +921 -915
- package/src/weatherProcessor.js +228 -228
- package/test/calculator.test.js +0 -215
- package/test/collision-test.js +0 -26
- package/test/comprehensive-execution-test.js +0 -428
- package/test/conflict-prevention-test.js +0 -95
- package/test/cross-cli-detection-test.js +0 -33
- package/test/csv-processing-test.js +0 -36
- package/test/deploy-hooks-test.js +0 -250
- package/test/e2e/claude-cli-test.js +0 -128
- package/test/e2e/collaboration-test.js +0 -75
- package/test/e2e/comprehensive-test.js +0 -431
- package/test/e2e/error-handling-test.js +0 -90
- package/test/e2e/individual-tool-test.js +0 -143
- package/test/e2e/other-cli-test.js +0 -130
- package/test/e2e/qoder-cli-test.js +0 -128
- package/test/e2e/run-e2e-tests.js +0 -73
- package/test/e2e/test-data.js +0 -88
- package/test/e2e/test-utils.js +0 -222
- package/test/encryption-simple-test.js +0 -110
- package/test/encryption.test.js +0 -129
- package/test/enhanced-main-alignment.test.js +0 -298
- package/test/error-handling-test.js +0 -341
- package/test/fibonacci.test.js +0 -178
- package/test/final-deploy-test.js +0 -221
- package/test/final-install-test.js +0 -226
- package/test/hash-table-demo.js +0 -33
- package/test/hash-table-test.js +0 -26
- package/test/hash_table_test.js +0 -114
- package/test/hook-system-integration-test.js +0 -307
- package/test/iflow-integration-test.js +0 -292
- package/test/improved-install-test.js +0 -362
- package/test/install-command-test.js +0 -370
- package/test/json-parser-test.js +0 -161
- package/test/json-validation-test.js +0 -164
- package/test/natural-language-skills-test.js +0 -320
- package/test/nl-integration-test.js +0 -179
- package/test/parameter-parsing-test.js +0 -143
- package/test/plugin-deployment-test.js +0 -316
- package/test/postinstall-test.js +0 -269
- package/test/python-plugins-test.js +0 -259
- package/test/real-test.js +0 -435
- package/test/remaining-adapters-test.js +0 -256
- package/test/rest-client-test.js +0 -56
- package/test/rest_client.test.js +0 -85
- package/test/simple-iflow-hook-test.js +0 -137
- package/test/system-compatibility-test.js +0 -467
- package/test/tdd-deploy-fix-test.js +0 -324
- package/test/tdd-fixes-test.js +0 -211
- package/test/third-party-skills-test.js +0 -321
- package/test/tool-selection-integration-test.js +0 -158
- package/test/unit/calculator-full.test.js +0 -191
- package/test/unit/calculator-simple.test.js +0 -96
- package/test/unit/calculator.test.js +0 -97
- package/test/unit/cli-scanner.test.js +0 -291
- package/test/unit/cli_parameter_handler.test.js +0 -116
- package/test/unit/cross-cli-executor.test.js +0 -399
- package/test/weather-processor.test.js +0 -104
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
// Other CLI Tools Integration Tests
|
|
2
|
-
const { executeCommand, recordTestResult } = require('./test-utils');
|
|
3
|
-
|
|
4
|
-
async function testOtherCLIIntegration() {
|
|
5
|
-
console.log('Starting other CLI tools integration testing...\n');
|
|
6
|
-
|
|
7
|
-
// Test 1: Qwen CLI - Java code generation
|
|
8
|
-
console.log('--- Test 1: Qwen CLI - Java code generation ---');
|
|
9
|
-
try {
|
|
10
|
-
const result = await executeCommand('node src/main_english.js call "qwen generate a simple Java method to calculate area of rectangle"', 45000);
|
|
11
|
-
|
|
12
|
-
const passed = result.success &&
|
|
13
|
-
result.stdout.length > 100 &&
|
|
14
|
-
(result.stdout.includes('public') || result.stdout.includes('private')) &&
|
|
15
|
-
(result.stdout.includes('double') || result.stdout.includes('int') || result.stdout.includes('float')) &&
|
|
16
|
-
result.stdout.includes('area') &&
|
|
17
|
-
!result.stdout.includes('Error') &&
|
|
18
|
-
!result.stdout.includes('error');
|
|
19
|
-
|
|
20
|
-
recordTestResult('Qwen CLI - Java Code Generation', passed, {
|
|
21
|
-
command: result.command,
|
|
22
|
-
executionTime: result.executionTime,
|
|
23
|
-
outputLength: result.stdout.length,
|
|
24
|
-
hasError: !result.success || result.stderr.length > 0
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
|
|
28
|
-
console.log(` Execution time: ${result.executionTime}ms`);
|
|
29
|
-
console.log(` Output length: ${result.stdout.length} characters`);
|
|
30
|
-
|
|
31
|
-
} catch (error) {
|
|
32
|
-
recordTestResult('Qwen CLI - Java Code Generation', false, {
|
|
33
|
-
error: error.message
|
|
34
|
-
});
|
|
35
|
-
console.log(` Result: FAIL - ${error.message}`);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Test 2: Gemini CLI - JavaScript function
|
|
39
|
-
console.log('\n--- Test 2: Gemini CLI - JavaScript function ---');
|
|
40
|
-
try {
|
|
41
|
-
const result = await executeCommand('node src/main_english.js call "gemini create a basic JavaScript function for string reversal"', 45000);
|
|
42
|
-
|
|
43
|
-
const passed = result.success &&
|
|
44
|
-
result.stdout.length > 50 &&
|
|
45
|
-
(result.stdout.includes('function') || result.stdout.includes('=>')) &&
|
|
46
|
-
result.stdout.includes('reverse') &&
|
|
47
|
-
!result.stdout.includes('Error') &&
|
|
48
|
-
!result.stdout.includes('error');
|
|
49
|
-
|
|
50
|
-
recordTestResult('Gemini CLI - JavaScript Function', passed, {
|
|
51
|
-
command: result.command,
|
|
52
|
-
executionTime: result.executionTime,
|
|
53
|
-
outputLength: result.stdout.length,
|
|
54
|
-
hasError: !result.success || result.stderr.length > 0
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
|
|
58
|
-
console.log(` Execution time: ${result.executionTime}ms`);
|
|
59
|
-
console.log(` Output length: ${result.stdout.length} characters`);
|
|
60
|
-
|
|
61
|
-
} catch (error) {
|
|
62
|
-
recordTestResult('Gemini CLI - JavaScript Function', false, {
|
|
63
|
-
error: error.message
|
|
64
|
-
});
|
|
65
|
-
console.log(` Result: FAIL - ${error.message}`);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Test 3: iFlow CLI - Algorithm implementation
|
|
69
|
-
console.log('\n--- Test 3: iFlow CLI - Algorithm implementation ---');
|
|
70
|
-
try {
|
|
71
|
-
const result = await executeCommand('node src/main_english.js call "iflow write a basic function to check if a number is even"', 45000);
|
|
72
|
-
|
|
73
|
-
const passed = result.success &&
|
|
74
|
-
result.stdout.length > 50 &&
|
|
75
|
-
(result.stdout.includes('function') || result.stdout.includes('=>')) &&
|
|
76
|
-
(result.stdout.includes('%') || result.stdout.includes('mod')) &&
|
|
77
|
-
!result.stdout.includes('Error') &&
|
|
78
|
-
!result.stdout.includes('error');
|
|
79
|
-
|
|
80
|
-
recordTestResult('iFlow CLI - Algorithm Implementation', passed, {
|
|
81
|
-
command: result.command,
|
|
82
|
-
executionTime: result.executionTime,
|
|
83
|
-
outputLength: result.stdout.length,
|
|
84
|
-
hasError: !result.success || result.stderr.length > 0
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
|
|
88
|
-
console.log(` Execution time: ${result.executionTime}ms`);
|
|
89
|
-
console.log(` Output length: ${result.stdout.length} characters`);
|
|
90
|
-
|
|
91
|
-
} catch (error) {
|
|
92
|
-
recordTestResult('iFlow CLI - Algorithm Implementation', false, {
|
|
93
|
-
error: error.message
|
|
94
|
-
});
|
|
95
|
-
console.log(` Result: FAIL - ${error.message}`);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Test 4: CodeBuddy CLI - Code analysis
|
|
99
|
-
console.log('\n--- Test 4: CodeBuddy CLI - Code analysis ---');
|
|
100
|
-
try {
|
|
101
|
-
const result = await executeCommand('node src/main_english.js call "codebuddy analyze this code for potential memory leaks: let arr = []; for(let i=0; i<1000000; i++) { arr.push(new Object()); }"', 45000);
|
|
102
|
-
|
|
103
|
-
const passed = result.success &&
|
|
104
|
-
result.stdout.length > 50 &&
|
|
105
|
-
(result.stdout.includes('memory') || result.stdout.includes('leak')) &&
|
|
106
|
-
!result.stdout.includes('Error') &&
|
|
107
|
-
!result.stdout.includes('error');
|
|
108
|
-
|
|
109
|
-
recordTestResult('CodeBuddy CLI - Code Analysis', passed, {
|
|
110
|
-
command: result.command,
|
|
111
|
-
executionTime: result.executionTime,
|
|
112
|
-
outputLength: result.stdout.length,
|
|
113
|
-
hasError: !result.success || result.stderr.length > 0
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
|
|
117
|
-
console.log(` Execution time: ${result.executionTime}ms`);
|
|
118
|
-
console.log(` Output length: ${result.stdout.length} characters`);
|
|
119
|
-
|
|
120
|
-
} catch (error) {
|
|
121
|
-
recordTestResult('CodeBuddy CLI - Code Analysis', false, {
|
|
122
|
-
error: error.message
|
|
123
|
-
});
|
|
124
|
-
console.log(` Result: FAIL - ${error.message}`);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
console.log('\n--- Other CLI tools integration testing completed ---\n');
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
module.exports = testOtherCLIIntegration;
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
// Qoder CLI Integration Tests
|
|
2
|
-
const { executeCommand, recordTestResult } = require('./test-utils');
|
|
3
|
-
|
|
4
|
-
async function testQoderCLIIntegration() {
|
|
5
|
-
console.log('Starting Qoder CLI integration testing...\n');
|
|
6
|
-
|
|
7
|
-
// Test 1: Function implementation
|
|
8
|
-
console.log('--- Test 1: Function implementation ---');
|
|
9
|
-
try {
|
|
10
|
-
const result = await executeCommand('node src/main_english.js call "qodercli write a simple function to find maximum of two numbers"', 45000);
|
|
11
|
-
|
|
12
|
-
const passed = result.success &&
|
|
13
|
-
result.stdout.length > 100 &&
|
|
14
|
-
(result.stdout.includes('function') || result.stdout.includes('max')) &&
|
|
15
|
-
(result.stdout.includes('return') || result.stdout.includes('=>')) &&
|
|
16
|
-
!result.stdout.includes('Error') &&
|
|
17
|
-
!result.stdout.includes('error');
|
|
18
|
-
|
|
19
|
-
recordTestResult('Qoder CLI - Function Implementation', passed, {
|
|
20
|
-
command: result.command,
|
|
21
|
-
executionTime: result.executionTime,
|
|
22
|
-
outputLength: result.stdout.length,
|
|
23
|
-
hasError: !result.success || result.stderr.length > 0
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
|
|
27
|
-
console.log(` Execution time: ${result.executionTime}ms`);
|
|
28
|
-
console.log(` Output length: ${result.stdout.length} characters`);
|
|
29
|
-
|
|
30
|
-
} catch (error) {
|
|
31
|
-
recordTestResult('Qoder CLI - Function Implementation', false, {
|
|
32
|
-
error: error.message
|
|
33
|
-
});
|
|
34
|
-
console.log(` Result: FAIL - ${error.message}`);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Test 2: Code refactoring
|
|
38
|
-
console.log('\n--- Test 2: Code refactoring ---');
|
|
39
|
-
try {
|
|
40
|
-
const result = await executeCommand('node src/main_english.js call "qodercli refactor this JavaScript function to be more readable: function calc(a,b,c){if(c==\"add\")return a+b;if(c==\"sub\")return a-b;if(c==\"mul\")return a*b;}', 60000);
|
|
41
|
-
|
|
42
|
-
const passed = result.success &&
|
|
43
|
-
result.stdout.length > 100 &&
|
|
44
|
-
(result.stdout.includes('function') || result.stdout.includes('calc')) &&
|
|
45
|
-
(result.stdout.includes('if') || result.stdout.includes('switch')) &&
|
|
46
|
-
!result.stdout.includes('Error') &&
|
|
47
|
-
!result.stdout.includes('error');
|
|
48
|
-
|
|
49
|
-
recordTestResult('Qoder CLI - Code Refactoring', passed, {
|
|
50
|
-
command: result.command,
|
|
51
|
-
executionTime: result.executionTime,
|
|
52
|
-
outputLength: result.stdout.length,
|
|
53
|
-
hasError: !result.success || result.stderr.length > 0
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
|
|
57
|
-
console.log(` Execution time: ${result.executionTime}ms`);
|
|
58
|
-
console.log(` Output length: ${result.stdout.length} characters`);
|
|
59
|
-
|
|
60
|
-
} catch (error) {
|
|
61
|
-
recordTestResult('Qoder CLI - Code Refactoring', false, {
|
|
62
|
-
error: error.message
|
|
63
|
-
});
|
|
64
|
-
console.log(` Result: FAIL - ${error.message}`);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Test 3: Test generation
|
|
68
|
-
console.log('\n--- Test 3: Test generation ---');
|
|
69
|
-
try {
|
|
70
|
-
const result = await executeCommand('node src/main_english.js call "qodercli generate unit tests for this function: function multiply(a, b) { return a * b; }"', 45000);
|
|
71
|
-
|
|
72
|
-
const passed = result.success &&
|
|
73
|
-
result.stdout.length > 100 &&
|
|
74
|
-
(result.stdout.includes('test') || result.stdout.includes('assert') || result.stdout.includes('expect')) &&
|
|
75
|
-
!result.stdout.includes('Error') &&
|
|
76
|
-
!result.stdout.includes('error');
|
|
77
|
-
|
|
78
|
-
recordTestResult('Qoder CLI - Test Generation', passed, {
|
|
79
|
-
command: result.command,
|
|
80
|
-
executionTime: result.executionTime,
|
|
81
|
-
outputLength: result.stdout.length,
|
|
82
|
-
hasError: !result.success || result.stderr.length > 0
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
|
|
86
|
-
console.log(` Execution time: ${result.executionTime}ms`);
|
|
87
|
-
console.log(` Output length: ${result.stdout.length} characters`);
|
|
88
|
-
|
|
89
|
-
} catch (error) {
|
|
90
|
-
recordTestResult('Qoder CLI - Test Generation', false, {
|
|
91
|
-
error: error.message
|
|
92
|
-
});
|
|
93
|
-
console.log(` Result: FAIL - ${error.message}`);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Test 4: Project structure analysis
|
|
97
|
-
console.log('\n--- Test 4: Project structure analysis ---');
|
|
98
|
-
try {
|
|
99
|
-
const result = await executeCommand('node src/main_english.js call "qodercli analyze the project structure in this directory and suggest improvements"', 45000);
|
|
100
|
-
|
|
101
|
-
const passed = result.success &&
|
|
102
|
-
result.stdout.length > 100 &&
|
|
103
|
-
(result.stdout.includes('structure') || result.stdout.includes('project') || result.stdout.includes('directory')) &&
|
|
104
|
-
!result.stdout.includes('Error') &&
|
|
105
|
-
!result.stdout.includes('error');
|
|
106
|
-
|
|
107
|
-
recordTestResult('Qoder CLI - Project Structure Analysis', passed, {
|
|
108
|
-
command: result.command,
|
|
109
|
-
executionTime: result.executionTime,
|
|
110
|
-
outputLength: result.stdout.length,
|
|
111
|
-
hasError: !result.success || result.stderr.length > 0
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
console.log(` Result: ${passed ? 'PASS' : 'FAIL'}`);
|
|
115
|
-
console.log(` Execution time: ${result.executionTime}ms`);
|
|
116
|
-
console.log(` Output length: ${result.stdout.length} characters`);
|
|
117
|
-
|
|
118
|
-
} catch (error) {
|
|
119
|
-
recordTestResult('Qoder CLI - Project Structure Analysis', false, {
|
|
120
|
-
error: error.message
|
|
121
|
-
});
|
|
122
|
-
console.log(` Result: FAIL - ${error.message}`);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
console.log('\n--- Qoder CLI integration testing completed ---\n');
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
module.exports = testQoderCLIIntegration;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// Main end-to-end test runner
|
|
2
|
-
const { getTestSummary, saveTestReport, logFilePath } = require('./test-utils');
|
|
3
|
-
const testIndividualTools = require('./individual-tool-test');
|
|
4
|
-
const testCollaboration = require('./collaboration-test');
|
|
5
|
-
const testErrorHandling = require('./error-handling-test');
|
|
6
|
-
const runComprehensiveTest = require('./comprehensive-test');
|
|
7
|
-
const testClaudeCLIIntegration = require('./claude-cli-test');
|
|
8
|
-
const testQoderCLIIntegration = require('./qoder-cli-test');
|
|
9
|
-
const testOtherCLIIntegration = require('./other-cli-test');
|
|
10
|
-
|
|
11
|
-
async function runEndToEndTests() {
|
|
12
|
-
console.log('Stigmergy CLI End-to-End Testing');
|
|
13
|
-
console.log('================================\n');
|
|
14
|
-
|
|
15
|
-
// Check if we should run comprehensive tests
|
|
16
|
-
const runComprehensive = process.argv.includes('--comprehensive');
|
|
17
|
-
const runClaudeTests = process.argv.includes('--claude');
|
|
18
|
-
const runQoderTests = process.argv.includes('--qoder');
|
|
19
|
-
const runOtherCLITests = process.argv.includes('--other');
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
if (runComprehensive) {
|
|
23
|
-
// Run comprehensive test suite
|
|
24
|
-
await runComprehensiveTest();
|
|
25
|
-
} else if (runClaudeTests) {
|
|
26
|
-
// Run Claude CLI integration tests
|
|
27
|
-
await testClaudeCLIIntegration();
|
|
28
|
-
} else if (runQoderTests) {
|
|
29
|
-
// Run Qoder CLI integration tests
|
|
30
|
-
await testQoderCLIIntegration();
|
|
31
|
-
} else if (runOtherCLITests) {
|
|
32
|
-
// Run other CLI tools integration tests
|
|
33
|
-
await testOtherCLIIntegration();
|
|
34
|
-
} else {
|
|
35
|
-
// Run individual tool tests
|
|
36
|
-
await testIndividualTools();
|
|
37
|
-
|
|
38
|
-
// Run collaboration tests
|
|
39
|
-
await testCollaboration();
|
|
40
|
-
|
|
41
|
-
// Run error handling tests
|
|
42
|
-
await testErrorHandling();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Generate final report
|
|
46
|
-
const summary = getTestSummary();
|
|
47
|
-
const { reportPath, summaryPath } = saveTestReport();
|
|
48
|
-
|
|
49
|
-
console.log('\n' + '='.repeat(50));
|
|
50
|
-
console.log('FINAL TEST RESULTS');
|
|
51
|
-
console.log('='.repeat(50));
|
|
52
|
-
console.log(`Total Tests: ${summary.total}`);
|
|
53
|
-
console.log(`Passed: ${summary.passed}`);
|
|
54
|
-
console.log(`Failed: ${summary.failed}`);
|
|
55
|
-
console.log(`Pass Rate: ${summary.passRate}%`);
|
|
56
|
-
console.log(`Detailed Report: ${reportPath}`);
|
|
57
|
-
console.log(`Summary Report: ${summaryPath}`);
|
|
58
|
-
console.log(`Full Log: ${logFilePath}`);
|
|
59
|
-
console.log('='.repeat(50));
|
|
60
|
-
|
|
61
|
-
// Exit with appropriate code
|
|
62
|
-
process.exit(summary.failed > 0 ? 1 : 0);
|
|
63
|
-
|
|
64
|
-
} catch (error) {
|
|
65
|
-
console.error('Test execution failed:', error);
|
|
66
|
-
process.exit(1);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Run the tests
|
|
71
|
-
if (require.main === module) {
|
|
72
|
-
runEndToEndTests();
|
|
73
|
-
}
|
package/test/e2e/test-data.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
// Test data for end-to-end testing
|
|
2
|
-
const testData = {
|
|
3
|
-
// Simple code generation prompts for each tool
|
|
4
|
-
simpleCodeGeneration: {
|
|
5
|
-
claude: "claude write a simple Python function to add two numbers",
|
|
6
|
-
gemini: "gemini create a basic JavaScript function for string reversal",
|
|
7
|
-
qwen: "qwen generate a simple Java method to calculate area of rectangle",
|
|
8
|
-
iflow: "iflow write a basic function to check if a number is even",
|
|
9
|
-
qodercli: "qodercli write a simple function to find maximum of two numbers",
|
|
10
|
-
codebuddy: "codebuddy create a basic function to calculate circle circumference",
|
|
11
|
-
copilot: "copilot generate a simple function to convert Celsius to Fahrenheit",
|
|
12
|
-
codex: "codex write a basic function to calculate factorial of a number"
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
// Complex code generation prompts
|
|
16
|
-
complexCodeGeneration: {
|
|
17
|
-
claude: "claude implement a binary search algorithm in Python with proper error handling",
|
|
18
|
-
gemini: "gemini create a JavaScript class for a simple banking system with deposit and withdraw methods",
|
|
19
|
-
qwen: "qwen generate a Java implementation of a linked list with insert and delete operations",
|
|
20
|
-
iflow: "iflow write a function to sort an array using quicksort algorithm",
|
|
21
|
-
qodercli: "qodercli implement a hash table data structure with collision handling",
|
|
22
|
-
codebuddy: "codebuddy create a function to parse JSON data and validate its structure",
|
|
23
|
-
copilot: "copilot generate a function to implement a simple REST API client",
|
|
24
|
-
codex: "codex write a function to process CSV data and generate statistics"
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
// Analysis prompts
|
|
28
|
-
analysis: {
|
|
29
|
-
claude: "claude analyze this Python code for potential security vulnerabilities",
|
|
30
|
-
gemini: "gemini review this JavaScript code for performance optimization opportunities",
|
|
31
|
-
qwen: "qwen check this Java code for adherence to best practices",
|
|
32
|
-
iflow: "iflow evaluate this code for potential bugs and logical errors",
|
|
33
|
-
qodercli: "qodercli assess this function for code quality and maintainability",
|
|
34
|
-
codebuddy: "codebuddy analyze this code for potential memory leaks",
|
|
35
|
-
copilot: "copilot review this code for proper error handling",
|
|
36
|
-
codex: "codex examine this code for potential scalability issues"
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
// Documentation prompts
|
|
40
|
-
documentation: {
|
|
41
|
-
claude: "claude generate documentation for a Python function that sorts arrays",
|
|
42
|
-
gemini: "gemini create JSDoc for a JavaScript function that validates email addresses",
|
|
43
|
-
qwen: "qwen write JavaDoc for a Java method that connects to database",
|
|
44
|
-
iflow: "iflow generate comments for a C++ function that processes image data",
|
|
45
|
-
qodercli: "qodercli create documentation for a function that handles HTTP requests",
|
|
46
|
-
codebuddy: "codebuddy write documentation for a function that encrypts data",
|
|
47
|
-
copilot: "copilot generate README section for a machine learning model API",
|
|
48
|
-
codex: "codex create API documentation for a weather data processing function"
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
// Collaboration scenarios
|
|
52
|
-
collaborationScenarios: [
|
|
53
|
-
{
|
|
54
|
-
name: "Code Review Workflow",
|
|
55
|
-
steps: [
|
|
56
|
-
"qodercli write a Python function to handle user authentication",
|
|
57
|
-
"claude analyze the security of the authentication function",
|
|
58
|
-
"gemini suggest performance improvements for the function"
|
|
59
|
-
]
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
name: "Multi-language Implementation",
|
|
63
|
-
steps: [
|
|
64
|
-
"qwen generate a Java implementation of a calculator class",
|
|
65
|
-
"copilot create a C# version of the same calculator",
|
|
66
|
-
"codex write a JavaScript equivalent of the calculator"
|
|
67
|
-
]
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
name: "Documentation and Testing",
|
|
71
|
-
steps: [
|
|
72
|
-
"iflow write a complex algorithm in Python",
|
|
73
|
-
"codebuddy generate unit tests for the algorithm",
|
|
74
|
-
"qodercli create comprehensive documentation for the algorithm"
|
|
75
|
-
]
|
|
76
|
-
}
|
|
77
|
-
],
|
|
78
|
-
|
|
79
|
-
// Error handling test cases
|
|
80
|
-
errorHandling: {
|
|
81
|
-
invalidTool: "xyz generate a function to add two numbers",
|
|
82
|
-
malformedInput: "claude ",
|
|
83
|
-
extremelyLongInput: "claude " + "very long prompt ".repeat(1000),
|
|
84
|
-
specialCharacters: "gemini analyze code with special chars: \n\t\r\\\"'"
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
module.exports = testData;
|
package/test/e2e/test-utils.js
DELETED
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
// Utility functions for end-to-end testing
|
|
2
|
-
const { spawn } = require('child_process');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
|
|
6
|
-
// Test result tracker
|
|
7
|
-
const testResults = {
|
|
8
|
-
passed: 0,
|
|
9
|
-
failed: 0,
|
|
10
|
-
total: 0,
|
|
11
|
-
details: []
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// Log file path
|
|
15
|
-
const logFilePath = path.join(__dirname, 'logs', `e2e-test-${new Date().toISOString().replace(/[:.]/g, '-')}.log`);
|
|
16
|
-
|
|
17
|
-
// Initialize log file
|
|
18
|
-
fs.writeFileSync(logFilePath, `Stigmergy CLI End-to-End Test Log\n`);
|
|
19
|
-
fs.appendFileSync(logFilePath, `Started at: ${new Date().toISOString()}\n`);
|
|
20
|
-
fs.appendFileSync(logFilePath, `=`.repeat(80) + '\n\n');
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Execute a command and return the result
|
|
24
|
-
* @param {string} command - Command to execute
|
|
25
|
-
* @param {number} timeout - Timeout in milliseconds (default: 30000)
|
|
26
|
-
* @returns {Promise<Object>} Result object with status, stdout, stderr
|
|
27
|
-
*/
|
|
28
|
-
function executeCommand(command, timeout = 30000) {
|
|
29
|
-
return new Promise((resolve) => {
|
|
30
|
-
const startTime = Date.now();
|
|
31
|
-
|
|
32
|
-
// Log the command
|
|
33
|
-
const logEntry = `[${new Date().toISOString()}] Executing: ${command}\n`;
|
|
34
|
-
fs.appendFileSync(logFilePath, logEntry);
|
|
35
|
-
console.log(`Executing: ${command}`);
|
|
36
|
-
|
|
37
|
-
// Spawn the process
|
|
38
|
-
const child = spawn(command, {
|
|
39
|
-
shell: true,
|
|
40
|
-
stdio: ['pipe', 'pipe', 'pipe']
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
let stdout = '';
|
|
44
|
-
let stderr = '';
|
|
45
|
-
|
|
46
|
-
// Capture stdout
|
|
47
|
-
child.stdout.on('data', (data) => {
|
|
48
|
-
stdout += data.toString();
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
// Capture stderr
|
|
52
|
-
child.stderr.on('data', (data) => {
|
|
53
|
-
stderr += data.toString();
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// Handle process close
|
|
57
|
-
child.on('close', (code) => {
|
|
58
|
-
const executionTime = Date.now() - startTime;
|
|
59
|
-
const result = {
|
|
60
|
-
command,
|
|
61
|
-
code,
|
|
62
|
-
stdout,
|
|
63
|
-
stderr,
|
|
64
|
-
executionTime,
|
|
65
|
-
success: code === 0
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
// Log the result
|
|
69
|
-
const resultLog = ` Status: ${code}, Time: ${executionTime}ms\n`;
|
|
70
|
-
fs.appendFileSync(logFilePath, resultLog);
|
|
71
|
-
|
|
72
|
-
if (stdout) {
|
|
73
|
-
fs.appendFileSync(logFilePath, ` STDOUT:\n${stdout}\n`);
|
|
74
|
-
}
|
|
75
|
-
if (stderr) {
|
|
76
|
-
fs.appendFileSync(logFilePath, ` STDERR:\n${stderr}\n`);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
fs.appendFileSync(logFilePath, ` ---\n\n`);
|
|
80
|
-
|
|
81
|
-
resolve(result);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
// Handle errors
|
|
85
|
-
child.on('error', (error) => {
|
|
86
|
-
const executionTime = Date.now() - startTime;
|
|
87
|
-
const result = {
|
|
88
|
-
command,
|
|
89
|
-
code: -1,
|
|
90
|
-
stdout: '',
|
|
91
|
-
stderr: error.message,
|
|
92
|
-
executionTime,
|
|
93
|
-
success: false
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
// Log the error
|
|
97
|
-
const errorLog = ` ERROR: ${error.message}, Time: ${executionTime}ms\n ---\n\n`;
|
|
98
|
-
fs.appendFileSync(logFilePath, errorLog);
|
|
99
|
-
|
|
100
|
-
resolve(result);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
// Handle timeout
|
|
104
|
-
setTimeout(() => {
|
|
105
|
-
if (child.exitCode === null) {
|
|
106
|
-
child.kill();
|
|
107
|
-
const executionTime = Date.now() - startTime;
|
|
108
|
-
const result = {
|
|
109
|
-
command,
|
|
110
|
-
code: -2,
|
|
111
|
-
stdout: '',
|
|
112
|
-
stderr: 'TIMEOUT',
|
|
113
|
-
executionTime,
|
|
114
|
-
success: false
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
// Log the timeout
|
|
118
|
-
const timeoutLog = ` TIMEOUT after ${timeout}ms\n ---\n\n`;
|
|
119
|
-
fs.appendFileSync(logFilePath, timeoutLog);
|
|
120
|
-
|
|
121
|
-
resolve(result);
|
|
122
|
-
}
|
|
123
|
-
}, timeout);
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Record test result
|
|
129
|
-
* @param {string} testName - Name of the test
|
|
130
|
-
* @param {boolean} passed - Whether the test passed
|
|
131
|
-
* @param {Object} details - Additional details about the test
|
|
132
|
-
*/
|
|
133
|
-
function recordTestResult(testName, passed, details = {}) {
|
|
134
|
-
testResults.total++;
|
|
135
|
-
if (passed) {
|
|
136
|
-
testResults.passed++;
|
|
137
|
-
} else {
|
|
138
|
-
testResults.failed++;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const result = {
|
|
142
|
-
name: testName,
|
|
143
|
-
passed,
|
|
144
|
-
details
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
testResults.details.push(result);
|
|
148
|
-
|
|
149
|
-
// Log to file
|
|
150
|
-
const status = passed ? 'PASS' : 'FAIL';
|
|
151
|
-
const logEntry = `[${status}] ${testName}\n`;
|
|
152
|
-
fs.appendFileSync(logFilePath, logEntry);
|
|
153
|
-
|
|
154
|
-
// Log to console
|
|
155
|
-
console.log(`${status}: ${testName}`);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Get test summary
|
|
160
|
-
* @returns {Object} Test summary
|
|
161
|
-
*/
|
|
162
|
-
function getTestSummary() {
|
|
163
|
-
return {
|
|
164
|
-
...testResults,
|
|
165
|
-
passRate: testResults.total > 0 ? (testResults.passed / testResults.total * 100).toFixed(2) : 0
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Save detailed test report
|
|
171
|
-
*/
|
|
172
|
-
function saveTestReport() {
|
|
173
|
-
const summary = getTestSummary();
|
|
174
|
-
const reportPath = path.join(__dirname, 'logs', `e2e-report-${new Date().toISOString().replace(/[:.]/g, '-')}.json`);
|
|
175
|
-
|
|
176
|
-
const report = {
|
|
177
|
-
timestamp: new Date().toISOString(),
|
|
178
|
-
summary,
|
|
179
|
-
details: testResults.details
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
fs.writeFileSync(reportPath, JSON.stringify(report, null, 2));
|
|
183
|
-
|
|
184
|
-
// Also save a human-readable summary
|
|
185
|
-
const summaryPath = path.join(__dirname, 'logs', `e2e-summary-${new Date().toISOString().replace(/[:.]/g, '-')}.txt`);
|
|
186
|
-
let summaryContent = `Stigmergy CLI End-to-End Test Summary\n`;
|
|
187
|
-
summaryContent += `=====================================\n\n`;
|
|
188
|
-
summaryContent += `Timestamp: ${report.timestamp}\n`;
|
|
189
|
-
summaryContent += `Total Tests: ${summary.total}\n`;
|
|
190
|
-
summaryContent += `Passed: ${summary.passed}\n`;
|
|
191
|
-
summaryContent += `Failed: ${summary.failed}\n`;
|
|
192
|
-
summaryContent += `Pass Rate: ${summary.passRate}%\n\n`;
|
|
193
|
-
|
|
194
|
-
summaryContent += `Detailed Results:\n`;
|
|
195
|
-
summaryContent += `-----------------\n`;
|
|
196
|
-
testResults.details.forEach(detail => {
|
|
197
|
-
const status = detail.passed ? 'PASS' : 'FAIL';
|
|
198
|
-
summaryContent += `${status}: ${detail.name}\n`;
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
fs.writeFileSync(summaryPath, summaryContent);
|
|
202
|
-
|
|
203
|
-
return { reportPath, summaryPath };
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Wait for a specified time
|
|
208
|
-
* @param {number} ms - Milliseconds to wait
|
|
209
|
-
* @returns {Promise<void>}
|
|
210
|
-
*/
|
|
211
|
-
function wait(ms) {
|
|
212
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
module.exports = {
|
|
216
|
-
executeCommand,
|
|
217
|
-
recordTestResult,
|
|
218
|
-
getTestSummary,
|
|
219
|
-
saveTestReport,
|
|
220
|
-
wait,
|
|
221
|
-
logFilePath
|
|
222
|
-
};
|