stigmergy 1.2.12 โ 1.3.1-beta
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/builtin-skills.json +43 -0
- package/config/enhanced-cli-config.json +438 -0
- package/docs/CLI_TOOLS_AGENT_SKILL_ANALYSIS.md +463 -0
- package/docs/DESIGN_CLI_HELP_ANALYZER_REFACTOR.md +726 -0
- package/docs/ENHANCED_CLI_AGENT_SKILL_CONFIG.md +285 -0
- package/docs/IMPLEMENTATION_CHECKLIST_CLI_HELP_ANALYZER_REFACTOR.md +1268 -0
- package/docs/INSTALLER_ARCHITECTURE.md +257 -0
- package/docs/LESSONS_LEARNED.md +252 -0
- package/docs/SPECS_CLI_HELP_ANALYZER_REFACTOR.md +287 -0
- package/docs/SUDO_PROBLEM_AND_SOLUTION.md +529 -0
- package/docs/correct-skillsio-implementation.md +368 -0
- package/docs/development_guidelines.md +276 -0
- package/docs/independent-resume-implementation.md +198 -0
- package/docs/resumesession-final-implementation.md +195 -0
- package/docs/resumesession-usage.md +87 -0
- package/package.json +19 -9
- package/scripts/analyze-router.js +168 -0
- package/scripts/run-comprehensive-tests.js +230 -0
- package/scripts/run-quick-tests.js +90 -0
- package/scripts/test-runner.js +344 -0
- package/skills/resumesession/INDEPENDENT_SKILL.md +171 -0
- package/skills/resumesession/SKILL.md +127 -0
- package/skills/resumesession/__init__.py +33 -0
- package/skills/resumesession/implementations/simple-resume.js +13 -0
- package/src/adapters/claude/install_claude_integration.js +9 -1
- package/src/adapters/codebuddy/install_codebuddy_integration.js +3 -1
- package/src/adapters/codex/install_codex_integration.js +15 -5
- package/src/adapters/gemini/install_gemini_integration.js +3 -1
- package/src/adapters/qwen/install_qwen_integration.js +3 -1
- package/src/cli/commands/autoinstall.js +65 -0
- package/src/cli/commands/errors.js +190 -0
- package/src/cli/commands/independent-resume.js +395 -0
- package/src/cli/commands/install.js +179 -0
- package/src/cli/commands/permissions.js +108 -0
- package/src/cli/commands/project.js +485 -0
- package/src/cli/commands/scan.js +97 -0
- package/src/cli/commands/simple-resume.js +377 -0
- package/src/cli/commands/skills.js +158 -0
- package/src/cli/commands/status.js +113 -0
- package/src/cli/commands/stigmergy-resume.js +775 -0
- package/src/cli/commands/system.js +301 -0
- package/src/cli/commands/universal-resume.js +394 -0
- package/src/cli/router-beta.js +471 -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 +582 -26
- package/src/core/cli_path_detector.js +702 -709
- package/src/core/cli_tools.js +515 -160
- package/src/core/coordination/nodejs/CLIIntegrationManager.js +18 -0
- package/src/core/coordination/nodejs/HookDeploymentManager.js +242 -412
- 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 +932 -0
- package/src/core/coordination/nodejs/generators/SkillsIntegrationGenerator.js +1395 -0
- package/src/core/coordination/nodejs/generators/index.js +12 -0
- package/src/core/enhanced_cli_installer.js +1208 -608
- package/src/core/enhanced_cli_parameter_handler.js +402 -0
- package/src/core/execution_mode_detector.js +222 -0
- package/src/core/installer.js +151 -106
- package/src/core/local_skill_scanner.js +732 -0
- package/src/core/multilingual/language-pattern-manager.js +1 -1
- package/src/core/skills/BuiltinSkillsDeployer.js +188 -0
- package/src/core/skills/StigmergySkillManager.js +123 -16
- package/src/core/skills/embedded-openskills/SkillParser.js +7 -3
- package/src/core/smart_router.js +291 -2
- package/src/index.js +10 -4
- package/src/utils.js +66 -7
- package/test/cli-integration.test.js +304 -0
- package/test/direct_smart_router_test.js +88 -0
- package/test/enhanced-cli-agent-skill-test.js +485 -0
- package/test/simple_test.js +82 -0
- package/test/smart_router_test_runner.js +123 -0
- package/test/smart_routing_edge_cases.test.js +284 -0
- package/test/smart_routing_simple_verification.js +139 -0
- package/test/smart_routing_verification.test.js +346 -0
- package/test/specific-cli-agent-skill-analysis.js +385 -0
- package/test/unit/smart_router.test.js +295 -0
- package/test/very_simple_test.js +54 -0
- package/src/cli/router.js +0 -1737
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Router.js Structure Analysis Tool
|
|
5
|
+
* Analyzes the router.js file to identify modularization opportunities
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
|
|
11
|
+
console.log('๐ Router.js Structure Analysis');
|
|
12
|
+
console.log('='.repeat(50));
|
|
13
|
+
|
|
14
|
+
const routerPath = path.join(__dirname, '../src/cli/router.js');
|
|
15
|
+
|
|
16
|
+
if (!fs.existsSync(routerPath)) {
|
|
17
|
+
console.error('โ router.js file not found');
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const content = fs.readFileSync(routerPath, 'utf8');
|
|
22
|
+
const lines = content.split('\n');
|
|
23
|
+
|
|
24
|
+
console.log(`๐ Total Lines: ${lines.length}`);
|
|
25
|
+
console.log(`๐ File Size: ${(fs.statSync(routerPath).size / 1024).toFixed(2)} KB`);
|
|
26
|
+
console.log('');
|
|
27
|
+
|
|
28
|
+
// Analyze imports
|
|
29
|
+
console.log('๐ฆ Import Analysis:');
|
|
30
|
+
const importRegex = /const\s+(.+?)\s*=\s*require\(['"](.+?)['"]\)/g;
|
|
31
|
+
const imports = [];
|
|
32
|
+
let match;
|
|
33
|
+
|
|
34
|
+
while ((match = importRegex.exec(content)) !== null) {
|
|
35
|
+
imports.push({
|
|
36
|
+
name: match[1],
|
|
37
|
+
path: match[2],
|
|
38
|
+
line: content.substring(0, match.index).split('\n').length
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
console.log(`Found ${imports.length} imports:`);
|
|
43
|
+
imports.forEach(imp => {
|
|
44
|
+
console.log(` ๐ ${imp.name} <- ${imp.path} (line ${imp.line})`);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// Analyze functions
|
|
48
|
+
console.log('\n๐ง Function Analysis:');
|
|
49
|
+
const functionRegex = /(?:function\s+(\w+)|const\s+(\w+)\s*=\s*(?:async\s+)?(?:function|\([^)]*\)\s*=>))/g;
|
|
50
|
+
const functions = [];
|
|
51
|
+
let funcMatch;
|
|
52
|
+
|
|
53
|
+
while ((funcMatch = functionRegex.exec(content)) !== null) {
|
|
54
|
+
const funcName = funcMatch[1] || funcMatch[2];
|
|
55
|
+
const funcStart = content.substring(0, funcMatch.index).split('\n').length;
|
|
56
|
+
functions.push({
|
|
57
|
+
name: funcName,
|
|
58
|
+
line: funcStart,
|
|
59
|
+
isAsync: content.includes('async') && content.substring(funcMatch.index - 50, funcMatch.index).includes('async')
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
console.log(`Found ${functions.length} functions:`);
|
|
64
|
+
functions.forEach(func => {
|
|
65
|
+
console.log(` โ๏ธ ${func.name}${func.isAsync ? ' (async)' : ''} (line ${func.line})`);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Analyze main sections
|
|
69
|
+
console.log('\n๐ Section Analysis:');
|
|
70
|
+
|
|
71
|
+
// Look for main sections
|
|
72
|
+
const sections = [
|
|
73
|
+
{ name: 'Import Section', pattern: /const.*require/ },
|
|
74
|
+
{ name: 'Setup Section', pattern: /setupGlobalErrorHandlers|program\.version/ },
|
|
75
|
+
{ name: 'Command Definitions', pattern: /program\.command/ },
|
|
76
|
+
{ name: 'CLI Tools Routing', pattern: /SmartRouter|routeToCLI/ },
|
|
77
|
+
{ name: 'Error Handling', pattern: /errorHandler|catch.*error/ },
|
|
78
|
+
{ name: 'Helper Functions', pattern: /function formatBytes|function getWorkingDirectory/ },
|
|
79
|
+
{ name: 'Main Execution', pattern: /async function main|if \(require\.main/ }
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
sections.forEach(section => {
|
|
83
|
+
const sectionMatch = content.match(section.pattern);
|
|
84
|
+
if (sectionMatch) {
|
|
85
|
+
const lineNum = content.substring(0, sectionMatch.index).split('\n').length;
|
|
86
|
+
console.log(` ๐ ${section.name} (around line ${lineNum})`);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// Look for command definitions
|
|
91
|
+
console.log('\n๐ฏ Command Definitions:');
|
|
92
|
+
const commandRegex = /program\.command\(['"]([^'"]+)['"]\)/g;
|
|
93
|
+
const commands = [];
|
|
94
|
+
let cmdMatch;
|
|
95
|
+
|
|
96
|
+
while ((cmdMatch = commandRegex.exec(content)) !== null) {
|
|
97
|
+
commands.push(cmdMatch[1]);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
console.log(`Found ${commands.length} CLI commands:`);
|
|
101
|
+
commands.forEach(cmd => {
|
|
102
|
+
console.log(` ๐ป ${cmd}`);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// Look for CLI tools routing
|
|
106
|
+
console.log('\n๐ฃ๏ธ CLI Tools Routing:');
|
|
107
|
+
const toolRegex = /(?:case|if).*['"]([^'"]+)['"].*?:/g;
|
|
108
|
+
const tools = [];
|
|
109
|
+
let toolMatch;
|
|
110
|
+
|
|
111
|
+
while ((toolMatch = toolRegex.exec(content)) !== null) {
|
|
112
|
+
const tool = toolMatch[1];
|
|
113
|
+
if (!tools.includes(tool) && ['claude', 'gemini', 'qwen', 'codebuddy', 'codex', 'iflow', 'qodercli', 'copilot'].includes(tool)) {
|
|
114
|
+
tools.push(tool);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
console.log(`Found routing for ${tools.length} CLI tools:`);
|
|
119
|
+
tools.forEach(tool => {
|
|
120
|
+
console.log(` ๐ ${tool}`);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// Suggest modularization strategy
|
|
124
|
+
console.log('\n๐ก Modularization Suggestions:');
|
|
125
|
+
console.log('');
|
|
126
|
+
|
|
127
|
+
console.log('๐๏ธ Recommended Module Structure:');
|
|
128
|
+
console.log(' src/cli/');
|
|
129
|
+
console.log(' โโโ router.js (main entry, ~200 lines)');
|
|
130
|
+
console.log(' โโโ commands/');
|
|
131
|
+
console.log(' โ โโโ index.js (command registry)');
|
|
132
|
+
console.log(' โ โโโ install.js (install commands)');
|
|
133
|
+
console.log(' โ โโโ status.js (status commands)');
|
|
134
|
+
console.log(' โ โโโ scan.js (scan commands)');
|
|
135
|
+
console.log(' โ โโโ deploy.js (deploy commands)');
|
|
136
|
+
console.log(' โโโ routing/');
|
|
137
|
+
console.log(' โ โโโ index.js (routing coordinator)');
|
|
138
|
+
console.log(' โ โโโ cli-router.js (CLI tools routing)');
|
|
139
|
+
console.log(' โ โโโ command-router.js (command routing)');
|
|
140
|
+
console.log(' โโโ utils/');
|
|
141
|
+
console.log(' โ โโโ formatters.js (format helpers)');
|
|
142
|
+
console.log(' โ โโโ validators.js (input validation)');
|
|
143
|
+
console.log(' โ โโโ executors.js (command execution)');
|
|
144
|
+
console.log(' โโโ config/');
|
|
145
|
+
console.log(' โโโ program-setup.js (commander setup)');
|
|
146
|
+
console.log(' โโโ environment.js (environment setup)');
|
|
147
|
+
|
|
148
|
+
console.log('');
|
|
149
|
+
console.log('๐ฏ TDD Migration Strategy:');
|
|
150
|
+
console.log(' 1. โ
Create comprehensive test suite for current router.js');
|
|
151
|
+
console.log(' 2. ๐ Extract helper functions first (low risk)');
|
|
152
|
+
console.log(' 3. ๐ Extract command definitions (medium risk)');
|
|
153
|
+
console.log(' 4. ๐ Extract CLI routing logic (medium risk)');
|
|
154
|
+
console.log(' 5. ๐ Create modular command handlers (high risk)');
|
|
155
|
+
console.log(' 6. โ
Maintain backward compatibility');
|
|
156
|
+
console.log(' 7. โ
Create rollback mechanism');
|
|
157
|
+
|
|
158
|
+
console.log('');
|
|
159
|
+
console.log('โ ๏ธ Risk Assessment:');
|
|
160
|
+
console.log(' ๐ข LOW: Helper functions (formatBytes, etc.)');
|
|
161
|
+
console.log(' ๐ก MEDIUM: Command definitions and routing');
|
|
162
|
+
console.log(' ๐ด HIGH: Core CLI execution logic');
|
|
163
|
+
console.log('');
|
|
164
|
+
console.log('๐ก๏ธ Safety Measures:');
|
|
165
|
+
console.log(' โ
Backup original file');
|
|
166
|
+
console.log(' โ
Create feature branch');
|
|
167
|
+
console.log(' โ
Test before and after each extraction');
|
|
168
|
+
console.log(' โ
Gradual migration with rollback points');
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Comprehensive Test Runner
|
|
5
|
+
* Runs all tests and generates detailed coverage report
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { execSync } = require('child_process');
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
|
|
12
|
+
console.log('๐ฏ COMPREHENSIVE TEST SUITE');
|
|
13
|
+
console.log('='.repeat(70));
|
|
14
|
+
|
|
15
|
+
// ANSI color codes
|
|
16
|
+
const colors = {
|
|
17
|
+
reset: '\x1b[0m',
|
|
18
|
+
green: '\x1b[32m',
|
|
19
|
+
red: '\x1b[31m',
|
|
20
|
+
yellow: '\x1b[33m',
|
|
21
|
+
blue: '\x1b[34m',
|
|
22
|
+
cyan: '\x1b[36m'
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function log(message, color = 'reset') {
|
|
26
|
+
console.log(`${colors[color]}${message}${colors.reset}`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function runCommand(command, description) {
|
|
30
|
+
log(`\n๐ฆ ${description}...`, 'cyan');
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
const output = execSync(command, {
|
|
34
|
+
stdio: 'inherit',
|
|
35
|
+
cwd: process.cwd()
|
|
36
|
+
});
|
|
37
|
+
log(`โ
${description} completed`, 'green');
|
|
38
|
+
return true;
|
|
39
|
+
} catch (error) {
|
|
40
|
+
log(`โ ${description} failed`, 'red');
|
|
41
|
+
log(`Error: ${error.message}`, 'red');
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function ensureDirectories() {
|
|
47
|
+
const dirs = [
|
|
48
|
+
'tests/comprehensive/cli',
|
|
49
|
+
'tests/comprehensive/cli/commands',
|
|
50
|
+
'tests/comprehensive/core',
|
|
51
|
+
'tests/comprehensive/coordination',
|
|
52
|
+
'tests/comprehensive/adapters',
|
|
53
|
+
'tests/comprehensive/utils',
|
|
54
|
+
'coverage'
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
dirs.forEach(dir => {
|
|
58
|
+
const fullPath = path.join(process.cwd(), dir);
|
|
59
|
+
if (!fs.existsSync(fullPath)) {
|
|
60
|
+
fs.mkdirSync(fullPath, { recursive: true });
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function countTestFiles() {
|
|
66
|
+
const testDirs = [
|
|
67
|
+
'tests/unit',
|
|
68
|
+
'tests/integration',
|
|
69
|
+
'tests/e2e',
|
|
70
|
+
'tests/comprehensive',
|
|
71
|
+
'tests/regression'
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
let totalTests = 0;
|
|
75
|
+
testDirs.forEach(dir => {
|
|
76
|
+
const testPath = path.join(process.cwd(), dir);
|
|
77
|
+
if (fs.existsSync(testPath)) {
|
|
78
|
+
const files = fs.readdirSync(testPath)
|
|
79
|
+
.filter(f => f.endsWith('.test.js'));
|
|
80
|
+
totalTests += files.length;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
return totalTests;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function countSourceFiles() {
|
|
88
|
+
const srcPath = path.join(process.cwd(), 'src');
|
|
89
|
+
|
|
90
|
+
function countDir(dir) {
|
|
91
|
+
let count = 0;
|
|
92
|
+
const items = fs.readdirSync(dir, { withFileTypes: true });
|
|
93
|
+
|
|
94
|
+
items.forEach(item => {
|
|
95
|
+
if (item.isDirectory()) {
|
|
96
|
+
count += countDir(path.join(dir, item.name));
|
|
97
|
+
} else if (item.name.endsWith('.js')) {
|
|
98
|
+
count++;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
return count;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return countDir(srcPath);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function printSummary() {
|
|
109
|
+
log('\n' + '='.repeat(70), 'cyan');
|
|
110
|
+
log('๐ TEST SUITE SUMMARY', 'cyan');
|
|
111
|
+
log('='.repeat(70), 'cyan');
|
|
112
|
+
|
|
113
|
+
const sourceFiles = countSourceFiles();
|
|
114
|
+
const testFiles = countTestFiles();
|
|
115
|
+
const coverage = ((testFiles / sourceFiles) * 100).toFixed(1);
|
|
116
|
+
|
|
117
|
+
log(`\n๐ Source Files: ${sourceFiles}`);
|
|
118
|
+
log(`๐งช Test Files: ${testFiles}`);
|
|
119
|
+
log(`๐ Test Coverage: ${coverage}%`);
|
|
120
|
+
|
|
121
|
+
log('\n' + '='.repeat(70), 'cyan');
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function readCoverageReport() {
|
|
125
|
+
const coveragePath = path.join(process.cwd(), 'coverage', 'coverage-summary.json');
|
|
126
|
+
|
|
127
|
+
if (!fs.existsSync(coveragePath)) {
|
|
128
|
+
log('\nโ ๏ธ Coverage report not found', 'yellow');
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const coverage = JSON.parse(fs.readFileSync(coveragePath, 'utf8'));
|
|
133
|
+
|
|
134
|
+
log('\n' + '='.repeat(70), 'cyan');
|
|
135
|
+
log('๐ DETAILED COVERAGE REPORT', 'cyan');
|
|
136
|
+
log('='.repeat(70), 'cyan');
|
|
137
|
+
|
|
138
|
+
const total = coverage.total;
|
|
139
|
+
log(`\n๐ Overall Coverage:`, 'cyan');
|
|
140
|
+
log(` Statements: ${total.statements.pct}% (${total.statements.covered}/${total.statements.total})`);
|
|
141
|
+
log(` Branches: ${total.branches.pct}% (${total.branches.covered}/${total.branches.total})`);
|
|
142
|
+
log(` Functions: ${total.functions.pct}% (${total.functions.covered}/${total.functions.total})`);
|
|
143
|
+
log(` Lines: ${total.lines.pct}% (${total.lines.covered}/${total.lines.total})`);
|
|
144
|
+
|
|
145
|
+
// Find files with low coverage
|
|
146
|
+
log('\n๐ Files with Low Coverage (< 80%):', 'yellow');
|
|
147
|
+
let lowCoverageFound = false;
|
|
148
|
+
|
|
149
|
+
Object.entries(coverage).forEach(([file, data]) => {
|
|
150
|
+
if (file !== 'total' && data.statements.pct < 80) {
|
|
151
|
+
lowCoverageFound = true;
|
|
152
|
+
const relativePath = file.replace(process.cwd(), '');
|
|
153
|
+
log(` ${relativePath}: ${data.statements.pct}%`, 'red');
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
if (!lowCoverageFound) {
|
|
158
|
+
log(' โ
All files have good coverage!', 'green');
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
log('\n' + '='.repeat(70), 'cyan');
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async function main() {
|
|
165
|
+
const startTime = Date.now();
|
|
166
|
+
|
|
167
|
+
try {
|
|
168
|
+
// Ensure test directories exist
|
|
169
|
+
ensureDirectories();
|
|
170
|
+
|
|
171
|
+
// Print initial summary
|
|
172
|
+
log('\n๐ Test Environment:', 'blue');
|
|
173
|
+
log(` Node.js: ${process.version}`);
|
|
174
|
+
log(` Platform: ${process.platform}`);
|
|
175
|
+
log(` CWD: ${process.cwd()}`);
|
|
176
|
+
|
|
177
|
+
// Run pre-test cleanup
|
|
178
|
+
log('\n๐งน Cleaning test environment...', 'blue');
|
|
179
|
+
try {
|
|
180
|
+
execSync('npm run clean 2>/dev/null || true', { stdio: 'ignore' });
|
|
181
|
+
} catch (e) {
|
|
182
|
+
// Ignore cleanup errors
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Run tests by category
|
|
186
|
+
const results = {
|
|
187
|
+
unit: runCommand('npm run test:unit -- --silent', 'Unit Tests'),
|
|
188
|
+
integration: runCommand('npm run test:integration -- --silent', 'Integration Tests'),
|
|
189
|
+
comprehensive: runCommand('jest tests/comprehensive --coverage --silent', 'Comprehensive Tests')
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
// Generate coverage report
|
|
193
|
+
if (results.comprehensive) {
|
|
194
|
+
readCoverageReport();
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Calculate duration
|
|
198
|
+
const duration = ((Date.now() - startTime) / 1000).toFixed(2);
|
|
199
|
+
|
|
200
|
+
// Print final summary
|
|
201
|
+
printSummary();
|
|
202
|
+
|
|
203
|
+
log(`\nโฑ๏ธ Total Duration: ${duration}s`, 'blue');
|
|
204
|
+
|
|
205
|
+
// Determine success
|
|
206
|
+
const allPassed = Object.values(results).every(r => r === true);
|
|
207
|
+
|
|
208
|
+
if (allPassed) {
|
|
209
|
+
log('\nโ
ALL TESTS PASSED!', 'green');
|
|
210
|
+
log('\n๐ Great job! Your test suite is comprehensive.', 'green');
|
|
211
|
+
process.exit(0);
|
|
212
|
+
} else {
|
|
213
|
+
log('\nโ SOME TESTS FAILED', 'red');
|
|
214
|
+
log('\n๐ก Run with --verbose to see detailed error messages', 'yellow');
|
|
215
|
+
process.exit(1);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
} catch (error) {
|
|
219
|
+
log(`\n๐ฅ Fatal Error: ${error.message}`, 'red');
|
|
220
|
+
console.error(error);
|
|
221
|
+
process.exit(1);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Run if executed directly
|
|
226
|
+
if (require.main === module) {
|
|
227
|
+
main();
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
module.exports = { runCommand, readCoverageReport, printSummary };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Quick Test Runner
|
|
5
|
+
* Runs only the comprehensive tests without legacy tests
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { execSync } = require('child_process');
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
|
|
12
|
+
console.log('๐ฏ QUICK COMPREHENSIVE TEST SUITE');
|
|
13
|
+
console.log('='.repeat(70));
|
|
14
|
+
|
|
15
|
+
// ANSI colors
|
|
16
|
+
const colors = {
|
|
17
|
+
reset: '\x1b[0m',
|
|
18
|
+
green: '\x1b[32m',
|
|
19
|
+
red: '\x1b[31m',
|
|
20
|
+
yellow: '\x1b[33m',
|
|
21
|
+
blue: '\x1b[34m',
|
|
22
|
+
cyan: '\x1b[36m'
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function log(message, color = 'reset') {
|
|
26
|
+
console.log(`${colors[color]}${message}${colors.reset}`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function runCommand(command, description) {
|
|
30
|
+
log(`\n๐ฆ ${description}...`, 'cyan');
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
const output = execSync(command, {
|
|
34
|
+
stdio: 'inherit',
|
|
35
|
+
cwd: process.cwd()
|
|
36
|
+
});
|
|
37
|
+
log(`โ
${description} completed`, 'green');
|
|
38
|
+
return true;
|
|
39
|
+
} catch (error) {
|
|
40
|
+
log(`โ ${description} failed`, 'red');
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async function main() {
|
|
46
|
+
const startTime = Date.now();
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
log('\n๐ Running comprehensive tests only...', 'blue');
|
|
50
|
+
|
|
51
|
+
// Ensure directories exist
|
|
52
|
+
const dirs = ['tests/comprehensive/cli/commands', 'tests/comprehensive/core', 'tests/comprehensive/coordination'];
|
|
53
|
+
dirs.forEach(dir => {
|
|
54
|
+
const fullPath = path.join(process.cwd(), dir);
|
|
55
|
+
if (!fs.existsSync(fullPath)) {
|
|
56
|
+
fs.mkdirSync(fullPath, { recursive: true });
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Run comprehensive tests only
|
|
61
|
+
const result = runCommand(
|
|
62
|
+
'jest tests/comprehensive --coverage',
|
|
63
|
+
'Comprehensive Tests'
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
// Calculate duration
|
|
67
|
+
const duration = ((Date.now() - startTime) / 1000).toFixed(2);
|
|
68
|
+
|
|
69
|
+
log(`\nโฑ๏ธ Duration: ${duration}s`, 'blue');
|
|
70
|
+
|
|
71
|
+
if (result) {
|
|
72
|
+
log('\nโ
ALL TESTS PASSED!', 'green');
|
|
73
|
+
process.exit(0);
|
|
74
|
+
} else {
|
|
75
|
+
log('\nโ SOME TESTS FAILED', 'red');
|
|
76
|
+
log('\n๐ก Check the output above for details', 'yellow');
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
} catch (error) {
|
|
81
|
+
log(`\n๐ฅ Fatal Error: ${error.message}`, 'red');
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (require.main === module) {
|
|
87
|
+
main();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
module.exports = { runCommand };
|