agentic-qe 1.0.4 → 1.1.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/.claude/agents/qe-quality-analyzer.md +405 -0
- package/CHANGELOG.md +109 -0
- package/CONTRIBUTING.md +51 -0
- package/README.md +690 -134
- package/bin/aqe +90 -938
- package/dist/adapters/MemoryStoreAdapter.d.ts.map +1 -1
- package/dist/adapters/MemoryStoreAdapter.js +6 -0
- package/dist/adapters/MemoryStoreAdapter.js.map +1 -1
- package/dist/agents/CoverageAnalyzerAgent.d.ts +58 -3
- package/dist/agents/CoverageAnalyzerAgent.d.ts.map +1 -1
- package/dist/agents/CoverageAnalyzerAgent.js +316 -48
- package/dist/agents/CoverageAnalyzerAgent.js.map +1 -1
- package/dist/agents/FlakyTestHunterAgent.d.ts +48 -4
- package/dist/agents/FlakyTestHunterAgent.d.ts.map +1 -1
- package/dist/agents/FlakyTestHunterAgent.js +217 -10
- package/dist/agents/FlakyTestHunterAgent.js.map +1 -1
- package/dist/agents/LearningAgent.d.ts +75 -0
- package/dist/agents/LearningAgent.d.ts.map +1 -0
- package/dist/agents/LearningAgent.js +177 -0
- package/dist/agents/LearningAgent.js.map +1 -0
- package/dist/agents/TestGeneratorAgent.d.ts +42 -2
- package/dist/agents/TestGeneratorAgent.d.ts.map +1 -1
- package/dist/agents/TestGeneratorAgent.js +232 -13
- package/dist/agents/TestGeneratorAgent.js.map +1 -1
- package/dist/cli/commands/improve/index.d.ts +70 -0
- package/dist/cli/commands/improve/index.d.ts.map +1 -0
- package/dist/cli/commands/improve/index.js +530 -0
- package/dist/cli/commands/improve/index.js.map +1 -0
- package/dist/cli/commands/init.d.ts +34 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +875 -42
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/learn/index.d.ts +68 -0
- package/dist/cli/commands/learn/index.d.ts.map +1 -0
- package/dist/cli/commands/learn/index.js +431 -0
- package/dist/cli/commands/learn/index.js.map +1 -0
- package/dist/cli/commands/patterns/index.d.ts +75 -0
- package/dist/cli/commands/patterns/index.d.ts.map +1 -0
- package/dist/cli/commands/patterns/index.js +502 -0
- package/dist/cli/commands/patterns/index.js.map +1 -0
- package/dist/cli/commands/routing/index.d.ts +95 -0
- package/dist/cli/commands/routing/index.d.ts.map +1 -0
- package/dist/cli/commands/routing/index.js +399 -0
- package/dist/cli/commands/routing/index.js.map +1 -0
- package/dist/cli/index.js +455 -8
- package/dist/cli/index.js.map +1 -1
- package/dist/core/memory/SwarmMemoryManager.d.ts +5 -0
- package/dist/core/memory/SwarmMemoryManager.d.ts.map +1 -1
- package/dist/core/memory/SwarmMemoryManager.js +7 -0
- package/dist/core/memory/SwarmMemoryManager.js.map +1 -1
- package/dist/core/routing/AdaptiveModelRouter.d.ts +86 -0
- package/dist/core/routing/AdaptiveModelRouter.d.ts.map +1 -0
- package/dist/core/routing/AdaptiveModelRouter.js +264 -0
- package/dist/core/routing/AdaptiveModelRouter.js.map +1 -0
- package/dist/core/routing/ComplexityAnalyzer.d.ts +49 -0
- package/dist/core/routing/ComplexityAnalyzer.d.ts.map +1 -0
- package/dist/core/routing/ComplexityAnalyzer.js +182 -0
- package/dist/core/routing/ComplexityAnalyzer.js.map +1 -0
- package/dist/core/routing/CostTracker.d.ts +55 -0
- package/dist/core/routing/CostTracker.d.ts.map +1 -0
- package/dist/core/routing/CostTracker.js +210 -0
- package/dist/core/routing/CostTracker.js.map +1 -0
- package/dist/core/routing/FleetManagerIntegration.d.ts +68 -0
- package/dist/core/routing/FleetManagerIntegration.d.ts.map +1 -0
- package/dist/core/routing/FleetManagerIntegration.js +170 -0
- package/dist/core/routing/FleetManagerIntegration.js.map +1 -0
- package/dist/core/routing/ModelRules.d.ts +38 -0
- package/dist/core/routing/ModelRules.d.ts.map +1 -0
- package/dist/core/routing/ModelRules.js +170 -0
- package/dist/core/routing/ModelRules.js.map +1 -0
- package/dist/core/routing/QETask.d.ts +12 -0
- package/dist/core/routing/QETask.d.ts.map +1 -0
- package/dist/core/routing/QETask.js +21 -0
- package/dist/core/routing/QETask.js.map +1 -0
- package/dist/core/routing/index.d.ts +19 -0
- package/dist/core/routing/index.d.ts.map +1 -0
- package/dist/core/routing/index.js +50 -0
- package/dist/core/routing/index.js.map +1 -0
- package/dist/core/routing/types.d.ts +136 -0
- package/dist/core/routing/types.d.ts.map +1 -0
- package/dist/core/routing/types.js +28 -0
- package/dist/core/routing/types.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/learning/FlakyFixRecommendations.d.ts +40 -0
- package/dist/learning/FlakyFixRecommendations.d.ts.map +1 -0
- package/dist/learning/FlakyFixRecommendations.js +247 -0
- package/dist/learning/FlakyFixRecommendations.js.map +1 -0
- package/dist/learning/FlakyPredictionModel.d.ts +57 -0
- package/dist/learning/FlakyPredictionModel.d.ts.map +1 -0
- package/dist/learning/FlakyPredictionModel.js +289 -0
- package/dist/learning/FlakyPredictionModel.js.map +1 -0
- package/dist/learning/FlakyTestDetector.d.ts +46 -0
- package/dist/learning/FlakyTestDetector.d.ts.map +1 -0
- package/dist/learning/FlakyTestDetector.js +215 -0
- package/dist/learning/FlakyTestDetector.js.map +1 -0
- package/dist/learning/ImprovementLoop.d.ts +119 -0
- package/dist/learning/ImprovementLoop.d.ts.map +1 -0
- package/dist/learning/ImprovementLoop.js +353 -0
- package/dist/learning/ImprovementLoop.js.map +1 -0
- package/dist/learning/LearningEngine.d.ts +144 -0
- package/dist/learning/LearningEngine.d.ts.map +1 -0
- package/dist/learning/LearningEngine.js +531 -0
- package/dist/learning/LearningEngine.js.map +1 -0
- package/dist/learning/PerformanceTracker.d.ts +118 -0
- package/dist/learning/PerformanceTracker.d.ts.map +1 -0
- package/dist/learning/PerformanceTracker.js +376 -0
- package/dist/learning/PerformanceTracker.js.map +1 -0
- package/dist/learning/StatisticalAnalysis.d.ts +47 -0
- package/dist/learning/StatisticalAnalysis.d.ts.map +1 -0
- package/dist/learning/StatisticalAnalysis.js +170 -0
- package/dist/learning/StatisticalAnalysis.js.map +1 -0
- package/dist/learning/SwarmIntegration.d.ts +107 -0
- package/dist/learning/SwarmIntegration.d.ts.map +1 -0
- package/dist/learning/SwarmIntegration.js +191 -0
- package/dist/learning/SwarmIntegration.js.map +1 -0
- package/dist/learning/index.d.ts +10 -0
- package/dist/learning/index.d.ts.map +1 -0
- package/dist/learning/index.js +16 -0
- package/dist/learning/index.js.map +1 -0
- package/dist/learning/types.d.ts +288 -0
- package/dist/learning/types.d.ts.map +1 -0
- package/dist/learning/types.js +9 -0
- package/dist/learning/types.js.map +1 -0
- package/dist/mcp/handlers/phase2/Phase2Tools.d.ts +175 -0
- package/dist/mcp/handlers/phase2/Phase2Tools.d.ts.map +1 -0
- package/dist/mcp/handlers/phase2/Phase2Tools.js +693 -0
- package/dist/mcp/handlers/phase2/Phase2Tools.js.map +1 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +171 -9
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/streaming/CoverageAnalyzeStreamHandler.d.ts +112 -0
- package/dist/mcp/streaming/CoverageAnalyzeStreamHandler.d.ts.map +1 -0
- package/dist/mcp/streaming/CoverageAnalyzeStreamHandler.js +341 -0
- package/dist/mcp/streaming/CoverageAnalyzeStreamHandler.js.map +1 -0
- package/dist/mcp/streaming/StreamingMCPTool.d.ts +80 -0
- package/dist/mcp/streaming/StreamingMCPTool.d.ts.map +1 -0
- package/dist/mcp/streaming/StreamingMCPTool.js +276 -0
- package/dist/mcp/streaming/StreamingMCPTool.js.map +1 -0
- package/dist/mcp/streaming/TestExecuteStreamHandler.d.ts +73 -0
- package/dist/mcp/streaming/TestExecuteStreamHandler.d.ts.map +1 -0
- package/dist/mcp/streaming/TestExecuteStreamHandler.js +436 -0
- package/dist/mcp/streaming/TestExecuteStreamHandler.js.map +1 -0
- package/dist/mcp/streaming/index.d.ts +14 -0
- package/dist/mcp/streaming/index.d.ts.map +1 -0
- package/dist/mcp/streaming/index.js +30 -0
- package/dist/mcp/streaming/index.js.map +1 -0
- package/dist/mcp/streaming/types.d.ts +117 -0
- package/dist/mcp/streaming/types.d.ts.map +1 -0
- package/dist/mcp/streaming/types.js +88 -0
- package/dist/mcp/streaming/types.js.map +1 -0
- package/dist/mcp/tools.d.ts +18 -1
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +123 -1
- package/dist/mcp/tools.js.map +1 -1
- package/dist/reasoning/CodeSignatureGenerator.d.ts +98 -0
- package/dist/reasoning/CodeSignatureGenerator.d.ts.map +1 -0
- package/dist/reasoning/CodeSignatureGenerator.js +427 -0
- package/dist/reasoning/CodeSignatureGenerator.js.map +1 -0
- package/dist/reasoning/PatternClassifier.d.ts +98 -0
- package/dist/reasoning/PatternClassifier.d.ts.map +1 -0
- package/dist/reasoning/PatternClassifier.js +345 -0
- package/dist/reasoning/PatternClassifier.js.map +1 -0
- package/dist/reasoning/PatternExtractor.d.ts +131 -0
- package/dist/reasoning/PatternExtractor.d.ts.map +1 -0
- package/dist/reasoning/PatternExtractor.js +539 -0
- package/dist/reasoning/PatternExtractor.js.map +1 -0
- package/dist/reasoning/PatternMemoryIntegration.d.ts +102 -0
- package/dist/reasoning/PatternMemoryIntegration.d.ts.map +1 -0
- package/dist/reasoning/PatternMemoryIntegration.js +336 -0
- package/dist/reasoning/PatternMemoryIntegration.js.map +1 -0
- package/dist/reasoning/QEReasoningBank.d.ts +121 -0
- package/dist/reasoning/QEReasoningBank.d.ts.map +1 -0
- package/dist/reasoning/QEReasoningBank.js +235 -0
- package/dist/reasoning/QEReasoningBank.js.map +1 -0
- package/dist/reasoning/TestTemplateCreator.d.ts +95 -0
- package/dist/reasoning/TestTemplateCreator.d.ts.map +1 -0
- package/dist/reasoning/TestTemplateCreator.js +535 -0
- package/dist/reasoning/TestTemplateCreator.js.map +1 -0
- package/dist/reasoning/index.d.ts +10 -0
- package/dist/reasoning/index.d.ts.map +1 -0
- package/dist/reasoning/index.js +31 -0
- package/dist/reasoning/index.js.map +1 -0
- package/dist/reasoning/types.d.ts +717 -0
- package/dist/reasoning/types.d.ts.map +1 -0
- package/dist/reasoning/types.js +57 -0
- package/dist/reasoning/types.js.map +1 -0
- package/dist/types/index.d.ts +20 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/pattern.types.d.ts +364 -0
- package/dist/types/pattern.types.d.ts.map +1 -0
- package/dist/types/pattern.types.js +60 -0
- package/dist/types/pattern.types.js.map +1 -0
- package/package.json +25 -3
package/bin/aqe
CHANGED
|
@@ -1,959 +1,111 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Agentic QE CLI Entry Point
|
|
5
|
+
* Version: 1.1.0
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
7
|
+
* This script imports and executes the comprehensive TypeScript CLI
|
|
8
|
+
* which includes all Phase 1 and Phase 2 commands:
|
|
9
|
+
*
|
|
10
|
+
* Phase 1 (v1.0.5):
|
|
11
|
+
* - Multi-Model Router (routing commands)
|
|
12
|
+
* - Streaming MCP tools
|
|
13
|
+
*
|
|
14
|
+
* Phase 2 (Milestone 2.2):
|
|
15
|
+
* - Learning Engine (learn commands)
|
|
16
|
+
* - Pattern Management (patterns commands)
|
|
17
|
+
* - Continuous Improvement (improve commands)
|
|
18
|
+
* - QE Reasoning Bank integration
|
|
19
|
+
*
|
|
20
|
+
* Core Commands:
|
|
21
|
+
* - init, status, start
|
|
22
|
+
* - workflow (list, pause, cancel)
|
|
23
|
+
* - config (init, validate, get, set, list, reset)
|
|
24
|
+
* - debug (agent, diagnostics, health-check, troubleshoot)
|
|
25
|
+
* - memory (stats, compact)
|
|
8
26
|
*/
|
|
9
27
|
|
|
10
28
|
const path = require('path');
|
|
11
29
|
const fs = require('fs');
|
|
12
|
-
const { spawn } = require('child_process');
|
|
13
|
-
const { promisify } = require('util');
|
|
14
|
-
const chalk = require('chalk');
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Copy comprehensive agent template from agentic-qe package
|
|
18
|
-
* @param {string} agentName - Name of the agent
|
|
19
|
-
* @param {string} targetDir - Target directory for agent creation
|
|
20
|
-
*/
|
|
21
|
-
function copyAgentTemplate(agentName, targetDir = process.cwd()) {
|
|
22
|
-
// Security: Validate and sanitize directory path
|
|
23
|
-
const sanitizedTargetDir = path.resolve(targetDir);
|
|
24
|
-
if (!isAllowedDirectory(sanitizedTargetDir)) {
|
|
25
|
-
throw new Error(`Access denied: ${targetDir} is not an allowed directory`);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Find source template (comprehensive agent definition)
|
|
29
|
-
const possibleSources = [
|
|
30
|
-
path.join(__dirname, '..', '.claude', 'agents', `${agentName}.md`), // Same package
|
|
31
|
-
path.join(process.cwd(), 'node_modules', 'agentic-qe', '.claude', 'agents', `${agentName}.md`), // Installed
|
|
32
|
-
path.join(process.cwd(), '..', 'agentic-qe', '.claude', 'agents', `${agentName}.md`) // Monorepo
|
|
33
|
-
];
|
|
34
|
-
|
|
35
|
-
let sourceTemplate = null;
|
|
36
|
-
for (const src of possibleSources) {
|
|
37
|
-
if (fs.existsSync(src)) {
|
|
38
|
-
sourceTemplate = src;
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const targetPath = path.join(sanitizedTargetDir, '.claude', 'agents', `${agentName}.md`);
|
|
44
|
-
|
|
45
|
-
if (sourceTemplate) {
|
|
46
|
-
// Copy the comprehensive agent template
|
|
47
|
-
fs.copyFileSync(sourceTemplate, targetPath);
|
|
48
|
-
console.log(chalk.green(`✅ Registered agent: ${agentName} ${chalk.gray('(comprehensive template)')}`));
|
|
49
|
-
} else {
|
|
50
|
-
// Fallback to basic template if comprehensive not found
|
|
51
|
-
console.log(chalk.yellow(`⚠️ Comprehensive template not found for ${agentName}, using basic template`));
|
|
52
|
-
registerAgentBasic(agentName, targetDir);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return targetPath;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Fallback: Register basic agent if comprehensive template not found
|
|
60
|
-
* @param {string} agentName - Name of the agent
|
|
61
|
-
* @param {string} targetDir - Target directory
|
|
62
|
-
*/
|
|
63
|
-
function registerAgentBasic(agentName, targetDir = process.cwd()) {
|
|
64
|
-
const agentPath = path.join(targetDir, '.claude', 'agents', `${agentName}.md`);
|
|
65
|
-
const agentType = agentName.replace('qe-', '');
|
|
66
|
-
|
|
67
|
-
const capabilities = {
|
|
68
|
-
'qe-test-generator': ['AI-powered test generation', 'Property-based testing', 'Coverage-driven generation'],
|
|
69
|
-
'qe-test-executor': ['Parallel test execution', 'Retry logic', 'Real-time reporting'],
|
|
70
|
-
'qe-coverage-analyzer': ['O(log n) optimization', 'Gap identification', 'Critical path analysis'],
|
|
71
|
-
'qe-quality-gate': ['Threshold enforcement', 'Go/no-go decisions', 'Risk assessment'],
|
|
72
|
-
'qe-performance-tester': ['Load testing', 'Bottleneck detection', 'SLA validation'],
|
|
73
|
-
'qe-security-scanner': ['SAST/DAST integration', 'Vulnerability detection', 'CVE monitoring']
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const caps = capabilities[agentName] || ['Quality engineering'];
|
|
77
|
-
|
|
78
|
-
const agentContent = `# ${agentName}
|
|
79
30
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
This is an Agentic QE Fleet agent specialized in ${agentType}.
|
|
88
|
-
|
|
89
|
-
## Commands
|
|
90
|
-
- Initialize: \`aqe agent spawn --name ${agentName} --type ${agentType}\`
|
|
91
|
-
- Execute: \`aqe agent execute --name ${agentName} --task "<task>"\`
|
|
92
|
-
- Status: \`aqe agent status --name ${agentName}\`
|
|
93
|
-
|
|
94
|
-
## Integration
|
|
95
|
-
This agent integrates with the Agentic QE Fleet through:
|
|
96
|
-
- EventBus for coordination
|
|
97
|
-
- MemoryManager for state persistence
|
|
98
|
-
- FleetManager for lifecycle management
|
|
99
|
-
`;
|
|
100
|
-
|
|
101
|
-
fs.writeFileSync(agentPath, agentContent);
|
|
102
|
-
console.log(chalk.green(`✅ Registered agent: ${agentName} ${chalk.gray('(basic template)')}`));
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Security: Path validation function
|
|
107
|
-
*/
|
|
108
|
-
function isAllowedDirectory(dirPath) {
|
|
109
|
-
const resolvedPath = path.resolve(dirPath);
|
|
110
|
-
const workspaceRoot = path.resolve('/workspaces');
|
|
111
|
-
const homeDir = path.resolve(process.env.HOME || '/tmp');
|
|
112
|
-
|
|
113
|
-
// Allow only paths within workspace or user home directory
|
|
114
|
-
return resolvedPath.startsWith(workspaceRoot) || resolvedPath.startsWith(homeDir);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Security: Execute command safely using spawn
|
|
119
|
-
*/
|
|
120
|
-
function executeCommand(command, args = [], options = {}) {
|
|
121
|
-
return new Promise((resolve, reject) => {
|
|
122
|
-
const child = spawn(command, args, {
|
|
123
|
-
stdio: options.stdio || 'pipe',
|
|
124
|
-
cwd: options.cwd || process.cwd(),
|
|
125
|
-
env: { ...process.env, ...options.env }
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
let stdout = '';
|
|
129
|
-
let stderr = '';
|
|
130
|
-
|
|
131
|
-
if (child.stdout) {
|
|
132
|
-
child.stdout.on('data', (data) => {
|
|
133
|
-
stdout += data.toString();
|
|
134
|
-
if (options.stdio === 'inherit') {
|
|
135
|
-
process.stdout.write(data);
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (child.stderr) {
|
|
141
|
-
child.stderr.on('data', (data) => {
|
|
142
|
-
stderr += data.toString();
|
|
143
|
-
if (options.stdio === 'inherit') {
|
|
144
|
-
process.stderr.write(data);
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
child.on('close', (code) => {
|
|
150
|
-
if (code === 0) {
|
|
151
|
-
resolve({ stdout, stderr, code });
|
|
152
|
-
} else {
|
|
153
|
-
reject(new Error(`Command failed with code ${code}: ${stderr}`));
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
child.on('error', (error) => {
|
|
158
|
-
reject(error);
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Copy command definitions from agentic-qe package to project
|
|
165
|
-
* @param {string} targetDir - Target directory for command creation
|
|
166
|
-
*/
|
|
167
|
-
function copyCommandDefinitions(targetDir = process.cwd()) {
|
|
168
|
-
// Security: Validate and sanitize directory path
|
|
169
|
-
const sanitizedTargetDir = path.resolve(targetDir);
|
|
170
|
-
if (!isAllowedDirectory(sanitizedTargetDir)) {
|
|
171
|
-
throw new Error(`Access denied: ${targetDir} is not an allowed directory`);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
const targetCommandsDir = path.join(sanitizedTargetDir, '.claude', 'commands');
|
|
175
|
-
|
|
176
|
-
// Create commands directory if it doesn't exist
|
|
177
|
-
if (!fs.existsSync(targetCommandsDir)) {
|
|
178
|
-
fs.mkdirSync(targetCommandsDir, { recursive: true });
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// Define command names (8 QE slash commands)
|
|
182
|
-
const commands = [
|
|
183
|
-
'aqe-generate',
|
|
184
|
-
'aqe-execute',
|
|
185
|
-
'aqe-analyze',
|
|
186
|
-
'aqe-optimize',
|
|
187
|
-
'aqe-report',
|
|
188
|
-
'aqe-fleet-status',
|
|
189
|
-
'aqe-chaos',
|
|
190
|
-
'aqe-benchmark'
|
|
191
|
-
];
|
|
192
|
-
|
|
193
|
-
// Search for command templates in multiple possible locations
|
|
194
|
-
const possibleSourceDirs = [
|
|
195
|
-
path.join(__dirname, '..', '.claude', 'commands'), // Same package
|
|
196
|
-
path.join(process.cwd(), 'node_modules', 'agentic-qe', '.claude', 'commands'), // Installed
|
|
197
|
-
path.join(process.cwd(), '..', 'agentic-qe', '.claude', 'commands') // Monorepo
|
|
198
|
-
];
|
|
199
|
-
|
|
200
|
-
let sourceCommandsDir = null;
|
|
201
|
-
for (const src of possibleSourceDirs) {
|
|
202
|
-
if (fs.existsSync(src)) {
|
|
203
|
-
sourceCommandsDir = src;
|
|
204
|
-
break;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
console.log(chalk.cyan('\n📋 Setting up QE slash commands...\n'));
|
|
209
|
-
|
|
210
|
-
let copiedCount = 0;
|
|
211
|
-
let createdCount = 0;
|
|
212
|
-
|
|
213
|
-
commands.forEach(commandName => {
|
|
214
|
-
const targetPath = path.join(targetCommandsDir, `${commandName}.md`);
|
|
215
|
-
|
|
216
|
-
// Skip if command already exists
|
|
217
|
-
if (fs.existsSync(targetPath)) {
|
|
218
|
-
console.log(chalk.gray(` ${commandName}.md already exists (skipped)`));
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
// Try to copy from source
|
|
223
|
-
if (sourceCommandsDir) {
|
|
224
|
-
const sourcePath = path.join(sourceCommandsDir, `${commandName}.md`);
|
|
225
|
-
if (fs.existsSync(sourcePath)) {
|
|
226
|
-
fs.copyFileSync(sourcePath, targetPath);
|
|
227
|
-
console.log(chalk.green(`✅ Copied command: ${commandName}.md`));
|
|
228
|
-
copiedCount++;
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// Fallback: Create basic command stub
|
|
234
|
-
const commandStub = generateCommandStub(commandName);
|
|
235
|
-
fs.writeFileSync(targetPath, commandStub);
|
|
236
|
-
console.log(chalk.yellow(`⚠️ Created stub: ${commandName}.md (template not found)`));
|
|
237
|
-
createdCount++;
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
console.log(chalk.gray(`\n Commands copied: ${copiedCount}, Stubs created: ${createdCount}`));
|
|
241
|
-
return { copiedCount, createdCount };
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Generate a basic command stub if template not found
|
|
246
|
-
* @param {string} commandName - Name of the command
|
|
247
|
-
*/
|
|
248
|
-
function generateCommandStub(commandName) {
|
|
249
|
-
const commandType = commandName.replace('aqe-', '');
|
|
250
|
-
|
|
251
|
-
return `# ${commandName}
|
|
252
|
-
|
|
253
|
-
**Command Type:** ${commandType}
|
|
254
|
-
**Status:** Stub (requires implementation)
|
|
255
|
-
|
|
256
|
-
## Overview
|
|
257
|
-
This is a placeholder for the ${commandName} command. Full implementation coming soon.
|
|
258
|
-
|
|
259
|
-
## Usage
|
|
260
|
-
\`\`\`bash
|
|
261
|
-
/${commandName} [options]
|
|
262
|
-
\`\`\`
|
|
263
|
-
|
|
264
|
-
## Implementation
|
|
265
|
-
This command integrates with:
|
|
266
|
-
- Claude Flow hooks
|
|
267
|
-
- AQE Fleet agents
|
|
268
|
-
- Memory coordination
|
|
269
|
-
|
|
270
|
-
For full implementation, see the AQE documentation.
|
|
271
|
-
`;
|
|
31
|
+
// Check Node.js version
|
|
32
|
+
const MIN_NODE_VERSION = 18;
|
|
33
|
+
const currentVersion = parseInt(process.versions.node.split('.')[0]);
|
|
34
|
+
if (currentVersion < MIN_NODE_VERSION) {
|
|
35
|
+
console.error(`❌ Error: Node.js ${MIN_NODE_VERSION}+ required. Current: ${process.version}`);
|
|
36
|
+
console.error(`Please upgrade Node.js: https://nodejs.org/`);
|
|
37
|
+
process.exit(1);
|
|
272
38
|
}
|
|
273
39
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
if (fs.existsSync(settingsPath)) {
|
|
289
|
-
console.log(chalk.yellow('\n⚠️ settings.json already exists (skipped)'));
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
const settings = {
|
|
294
|
-
version: "1.0.0",
|
|
295
|
-
hooks: {
|
|
296
|
-
enabled: true,
|
|
297
|
-
preToolUse: {
|
|
298
|
-
enabled: true,
|
|
299
|
-
commands: [
|
|
300
|
-
"npx claude-flow@alpha hooks pre-task --description \"{{description}}\" --agent \"{{agent}}\""
|
|
301
|
-
]
|
|
302
|
-
},
|
|
303
|
-
postToolUse: {
|
|
304
|
-
enabled: true,
|
|
305
|
-
commands: [
|
|
306
|
-
"npx claude-flow@alpha hooks post-task --task-id \"{{task_id}}\" --results \"{{results}}\""
|
|
307
|
-
]
|
|
308
|
-
},
|
|
309
|
-
postEdit: {
|
|
310
|
-
enabled: true,
|
|
311
|
-
commands: [
|
|
312
|
-
"npx claude-flow@alpha hooks post-edit --file \"{{file}}\" --memory-key \"aqe/files/{{file_name}}\""
|
|
313
|
-
]
|
|
314
|
-
}
|
|
315
|
-
},
|
|
316
|
-
environment: {
|
|
317
|
-
CLAUDE_FLOW_HOOKS_ENABLED: "true",
|
|
318
|
-
AQE_FLEET_ENABLED: "true",
|
|
319
|
-
AQE_MEMORY_NAMESPACE: "aqe"
|
|
320
|
-
},
|
|
321
|
-
permissions: {
|
|
322
|
-
allowedCommands: [
|
|
323
|
-
"aqe-generate",
|
|
324
|
-
"aqe-execute",
|
|
325
|
-
"aqe-analyze",
|
|
326
|
-
"aqe-optimize",
|
|
327
|
-
"aqe-report",
|
|
328
|
-
"aqe-fleet-status",
|
|
329
|
-
"aqe-chaos",
|
|
330
|
-
"aqe-benchmark"
|
|
331
|
-
]
|
|
332
|
-
},
|
|
333
|
-
customPrompts: {
|
|
334
|
-
testGeneration: "Generate comprehensive tests following TDD best practices",
|
|
335
|
-
coverageAnalysis: "Use sublinear algorithms for efficient coverage analysis",
|
|
336
|
-
qualityGate: "Enforce quality thresholds: 95% coverage, <15 complexity"
|
|
337
|
-
}
|
|
338
|
-
};
|
|
339
|
-
|
|
340
|
-
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
|
|
341
|
-
console.log(chalk.green('\n✅ Created settings.json with hook configuration'));
|
|
342
|
-
console.log(chalk.gray(` File: ${settingsPath}`));
|
|
40
|
+
// Determine CLI path (compiled TypeScript)
|
|
41
|
+
const cliPath = path.join(__dirname, '..', 'dist', 'cli', 'index.js');
|
|
42
|
+
|
|
43
|
+
// Check if build exists
|
|
44
|
+
if (!fs.existsSync(cliPath)) {
|
|
45
|
+
console.error('❌ Error: CLI not built. Please run: npm run build');
|
|
46
|
+
console.error('');
|
|
47
|
+
console.error('Build steps:');
|
|
48
|
+
console.error(' cd /workspaces/agentic-qe-cf');
|
|
49
|
+
console.error(' npm install');
|
|
50
|
+
console.error(' npm run build');
|
|
51
|
+
console.error('');
|
|
52
|
+
console.error('After building, try again: aqe --help');
|
|
53
|
+
process.exit(1);
|
|
343
54
|
}
|
|
344
55
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
function createFleetConfig(config, targetDir = process.cwd()) {
|
|
351
|
-
// Security: Validate and sanitize directory path
|
|
352
|
-
const sanitizedTargetDir = path.resolve(targetDir);
|
|
353
|
-
if (!isAllowedDirectory(sanitizedTargetDir)) {
|
|
354
|
-
throw new Error(`Access denied: ${targetDir} is not an allowed directory`);
|
|
56
|
+
// Global error handler
|
|
57
|
+
process.on('uncaughtException', (error) => {
|
|
58
|
+
console.error('❌ Unexpected error:', error.message);
|
|
59
|
+
if (process.env.DEBUG || process.env.VERBOSE) {
|
|
60
|
+
console.error('Stack trace:', error.stack);
|
|
355
61
|
}
|
|
62
|
+
console.error('');
|
|
63
|
+
console.error('Please report this issue at:');
|
|
64
|
+
console.error('https://github.com/proffesor-for-testing/agentic-qe/issues');
|
|
65
|
+
process.exit(1);
|
|
66
|
+
});
|
|
356
67
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
version: "2.0.0",
|
|
362
|
-
topology: config.topology || 'hierarchical',
|
|
363
|
-
maxAgents: config.maxAgents || 6,
|
|
364
|
-
agents: config.agents || [],
|
|
365
|
-
created: new Date().toISOString(),
|
|
366
|
-
status: 'active',
|
|
367
|
-
configuration: {
|
|
368
|
-
coordination: {
|
|
369
|
-
memoryNamespace: 'aqe',
|
|
370
|
-
hooksEnabled: true,
|
|
371
|
-
neuralLearning: true
|
|
372
|
-
},
|
|
373
|
-
testing: {
|
|
374
|
-
defaultFramework: 'jest',
|
|
375
|
-
coverageThreshold: 95,
|
|
376
|
-
parallelWorkers: 'auto'
|
|
377
|
-
},
|
|
378
|
-
optimization: {
|
|
379
|
-
algorithm: 'sublinear',
|
|
380
|
-
targetCoveragePerTest: 'maximize'
|
|
381
|
-
}
|
|
382
|
-
},
|
|
383
|
-
metadata: {
|
|
384
|
-
packageVersion: '2.0.0',
|
|
385
|
-
claudeFlowVersion: 'alpha',
|
|
386
|
-
initDate: new Date().toISOString()
|
|
387
|
-
}
|
|
388
|
-
};
|
|
389
|
-
|
|
390
|
-
fs.writeFileSync(configPath, JSON.stringify(fleetConfig, null, 2));
|
|
391
|
-
console.log(chalk.green('\n✅ Created fleet configuration'));
|
|
392
|
-
console.log(chalk.gray(` File: ${configPath}`));
|
|
393
|
-
|
|
394
|
-
return fleetConfig;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
* Update CLAUDE.md in target project with AQE rules
|
|
399
|
-
*/
|
|
400
|
-
function updateClaudeMD(targetDir = process.cwd()) {
|
|
401
|
-
// Security: Validate and sanitize directory path
|
|
402
|
-
const sanitizedTargetDir = path.resolve(targetDir);
|
|
403
|
-
if (!isAllowedDirectory(sanitizedTargetDir)) {
|
|
404
|
-
throw new Error(`Access denied: ${targetDir} is not an allowed directory`);
|
|
68
|
+
process.on('unhandledRejection', (reason, promise) => {
|
|
69
|
+
console.error('❌ Unhandled promise rejection:', reason);
|
|
70
|
+
if (process.env.DEBUG || process.env.VERBOSE) {
|
|
71
|
+
console.error('Promise:', promise);
|
|
405
72
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
console.
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
- **qe-coverage-analyzer**: O(log n) coverage optimization with gap detection
|
|
429
|
-
- **qe-quality-gate**: Intelligent go/no-go decisions with risk assessment
|
|
430
|
-
- **qe-performance-tester**: Load testing and bottleneck detection
|
|
431
|
-
- **qe-security-scanner**: SAST/DAST integration with CVE monitoring
|
|
432
|
-
|
|
433
|
-
### ⚡ Agent Usage
|
|
434
|
-
**Spawn agents via Claude Code Task tool:**
|
|
435
|
-
\`\`\`javascript
|
|
436
|
-
Task("Generate tests", "Create comprehensive test suite", "qe-test-generator")
|
|
437
|
-
Task("Execute tests", "Run tests in parallel", "qe-test-executor")
|
|
438
|
-
Task("Analyze coverage", "Find coverage gaps", "qe-coverage-analyzer")
|
|
439
|
-
\`\`\`
|
|
440
|
-
|
|
441
|
-
**Or use MCP tools for coordination:**
|
|
442
|
-
\`\`\`javascript
|
|
443
|
-
mcp__agentic_qe__fleet_init({ topology: "hierarchical" })
|
|
444
|
-
mcp__agentic_qe__test_generate({ framework: "jest", coverage: 0.95 })
|
|
445
|
-
\`\`\`
|
|
446
|
-
|
|
447
|
-
### 🎯 Best Practices
|
|
448
|
-
1. **Initialize Fleet First**: Run \`aqe init\` before using agents
|
|
449
|
-
2. **Use Parallel Execution**: Spawn multiple agents in single messages
|
|
450
|
-
3. **Leverage Memory**: Agents share state via Claude Flow memory
|
|
451
|
-
4. **Monitor Progress**: Check agent status with \`aqe status\`
|
|
452
|
-
5. **Claude Flow Integration**: Agents use hooks for coordination
|
|
453
|
-
|
|
454
|
-
### ⚠️ Common Pitfalls
|
|
455
|
-
- Don't expect agents in root .claude/agents/ - they're in project's .claude/agents/
|
|
456
|
-
- Real vs Mock: \`aqe init\` creates real agents (not mocked demos)
|
|
457
|
-
- Hooks are intentional: Agents coordinate via Claude Flow hooks
|
|
458
|
-
- Memory is shared: All agents can access aqe/* memory keys
|
|
459
|
-
|
|
460
|
-
### 🔧 Commands
|
|
461
|
-
- \`aqe init\` - Initialize AQE fleet in current project
|
|
462
|
-
- \`aqe status\` - Show fleet status
|
|
463
|
-
- \`aqe test <module>\` - Generate tests for a module
|
|
464
|
-
- \`aqe coverage\` - Analyze test coverage
|
|
465
|
-
- \`aqe quality\` - Run quality gate check
|
|
466
|
-
- \`aqe agent spawn --name <agent>\` - Spawn specific agent
|
|
467
|
-
- \`aqe agent execute --name <agent> --task "<task>"\` - Execute task
|
|
468
|
-
|
|
469
|
-
---
|
|
470
|
-
|
|
471
|
-
*Agentic QE Fleet - Enterprise-grade quality engineering powered by AI and sublinear algorithms*
|
|
472
|
-
`;
|
|
473
|
-
|
|
474
|
-
// Check if CLAUDE.md exists
|
|
475
|
-
if (fs.existsSync(claudeMdPath)) {
|
|
476
|
-
let content = fs.readFileSync(claudeMdPath, 'utf-8');
|
|
477
|
-
|
|
478
|
-
// Check if AQE rules already exist
|
|
479
|
-
if (content.includes('AGENTIC QE FLEET - CRITICAL RULES')) {
|
|
480
|
-
console.log(chalk.yellow('⚠️ AQE rules already exist in CLAUDE.md'));
|
|
481
|
-
console.log(chalk.cyan(' Updating existing rules...'));
|
|
482
|
-
|
|
483
|
-
// Replace existing AQE section
|
|
484
|
-
const startMarker = '## 🚀 AGENTIC QE FLEET - CRITICAL RULES';
|
|
485
|
-
const endMarker = '*Agentic QE Fleet - Enterprise-grade quality engineering powered by AI and sublinear algorithms*';
|
|
486
|
-
|
|
487
|
-
const startIndex = content.indexOf(startMarker);
|
|
488
|
-
if (startIndex !== -1) {
|
|
489
|
-
const endIndex = content.indexOf(endMarker, startIndex);
|
|
490
|
-
if (endIndex !== -1) {
|
|
491
|
-
const before = content.substring(0, startIndex);
|
|
492
|
-
const after = content.substring(endIndex + endMarker.length);
|
|
493
|
-
content = before + aqeRules.trim() + after;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
} else {
|
|
497
|
-
// Append AQE rules to existing CLAUDE.md
|
|
498
|
-
content += aqeRules;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
fs.writeFileSync(claudeMdPath, content);
|
|
502
|
-
console.log(chalk.green('✅ Updated existing CLAUDE.md with AQE rules'));
|
|
73
|
+
console.error('');
|
|
74
|
+
console.error('Please report this issue at:');
|
|
75
|
+
console.error('https://github.com/proffesor-for-testing/agentic-qe/issues');
|
|
76
|
+
process.exit(1);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// Load and execute the compiled TypeScript CLI
|
|
80
|
+
try {
|
|
81
|
+
// Import the CLI module
|
|
82
|
+
require(cliPath);
|
|
83
|
+
|
|
84
|
+
} catch (error) {
|
|
85
|
+
console.error('❌ Error loading CLI:', error.message);
|
|
86
|
+
|
|
87
|
+
if (process.env.DEBUG || process.env.VERBOSE) {
|
|
88
|
+
console.error('');
|
|
89
|
+
console.error('Debug information:');
|
|
90
|
+
console.error(' CLI path:', cliPath);
|
|
91
|
+
console.error(' CLI exists:', fs.existsSync(cliPath));
|
|
92
|
+
console.error(' Node version:', process.version);
|
|
93
|
+
console.error(' Platform:', process.platform);
|
|
94
|
+
console.error(' Stack trace:', error.stack);
|
|
503
95
|
} else {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
## Project Overview
|
|
508
|
-
This project uses Agentic QE Fleet for comprehensive quality engineering.
|
|
509
|
-
${aqeRules}`;
|
|
510
|
-
|
|
511
|
-
fs.writeFileSync(claudeMdPath, defaultContent);
|
|
512
|
-
console.log(chalk.green('✅ Created new CLAUDE.md with AQE rules'));
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
console.log(chalk.gray(` File: ${claudeMdPath}`));
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
/**
|
|
519
|
-
* Initialize the AQE Fleet with real agents
|
|
520
|
-
* @param {string} targetDir - Target directory for initialization (defaults to current directory)
|
|
521
|
-
*/
|
|
522
|
-
async function initializeFleet(targetDir = process.cwd()) {
|
|
523
|
-
console.log(chalk.cyan('\n🚀 Initializing Agentic QE Fleet...\n'));
|
|
524
|
-
|
|
525
|
-
// Security: Validate and sanitize directory path
|
|
526
|
-
const sanitizedTargetDir = path.resolve(targetDir);
|
|
527
|
-
if (!isAllowedDirectory(sanitizedTargetDir)) {
|
|
528
|
-
throw new Error(`Access denied: ${targetDir} is not an allowed directory`);
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
console.log(chalk.gray(`Target directory: ${sanitizedTargetDir}\n`));
|
|
532
|
-
|
|
533
|
-
// Ensure Claude agents directory exists in target directory
|
|
534
|
-
const targetClaudeDir = path.join(sanitizedTargetDir, '.claude', 'agents');
|
|
535
|
-
if (!fs.existsSync(targetClaudeDir)) {
|
|
536
|
-
fs.mkdirSync(targetClaudeDir, { recursive: true });
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
// Define AQE agent types
|
|
540
|
-
// Complete 16-agent AQE Fleet
|
|
541
|
-
const aqeAgents = [
|
|
542
|
-
// Core Testing Agents (6)
|
|
543
|
-
{
|
|
544
|
-
name: 'qe-test-generator',
|
|
545
|
-
type: 'test-generator',
|
|
546
|
-
capabilities: [
|
|
547
|
-
'AI-powered test generation',
|
|
548
|
-
'Property-based testing',
|
|
549
|
-
'Boundary value analysis',
|
|
550
|
-
'Coverage-driven generation',
|
|
551
|
-
'Multi-framework support (Jest, Mocha, Cypress)'
|
|
552
|
-
]
|
|
553
|
-
},
|
|
554
|
-
{
|
|
555
|
-
name: 'qe-test-executor',
|
|
556
|
-
type: 'test-executor',
|
|
557
|
-
capabilities: [
|
|
558
|
-
'Parallel test execution',
|
|
559
|
-
'Retry logic for flaky tests',
|
|
560
|
-
'Real-time reporting',
|
|
561
|
-
'Framework integration',
|
|
562
|
-
'Resource optimization'
|
|
563
|
-
]
|
|
564
|
-
},
|
|
565
|
-
{
|
|
566
|
-
name: 'qe-coverage-analyzer',
|
|
567
|
-
type: 'coverage-analyzer',
|
|
568
|
-
capabilities: [
|
|
569
|
-
'O(log n) coverage optimization',
|
|
570
|
-
'Gap identification',
|
|
571
|
-
'Critical path analysis',
|
|
572
|
-
'Sublinear algorithms',
|
|
573
|
-
'Coverage trend analysis'
|
|
574
|
-
]
|
|
575
|
-
},
|
|
576
|
-
{
|
|
577
|
-
name: 'qe-quality-gate',
|
|
578
|
-
type: 'quality-gate',
|
|
579
|
-
capabilities: [
|
|
580
|
-
'Threshold enforcement',
|
|
581
|
-
'Go/no-go decisions',
|
|
582
|
-
'Risk assessment',
|
|
583
|
-
'Policy validation',
|
|
584
|
-
'Automated approvals'
|
|
585
|
-
]
|
|
586
|
-
},
|
|
587
|
-
{
|
|
588
|
-
name: 'qe-performance-tester',
|
|
589
|
-
type: 'performance-tester',
|
|
590
|
-
capabilities: [
|
|
591
|
-
'Load testing orchestration',
|
|
592
|
-
'Bottleneck detection',
|
|
593
|
-
'Resource monitoring',
|
|
594
|
-
'SLA validation',
|
|
595
|
-
'Performance regression detection'
|
|
596
|
-
]
|
|
597
|
-
},
|
|
598
|
-
{
|
|
599
|
-
name: 'qe-security-scanner',
|
|
600
|
-
type: 'security-scanner',
|
|
601
|
-
capabilities: [
|
|
602
|
-
'SAST/DAST integration',
|
|
603
|
-
'Vulnerability detection',
|
|
604
|
-
'Compliance checking',
|
|
605
|
-
'Security test generation',
|
|
606
|
-
'CVE monitoring'
|
|
607
|
-
]
|
|
608
|
-
},
|
|
609
|
-
// Specialized Testing Agents (3)
|
|
610
|
-
{
|
|
611
|
-
name: 'qe-fleet-commander',
|
|
612
|
-
type: 'fleet-commander',
|
|
613
|
-
capabilities: [
|
|
614
|
-
'Hierarchical coordination',
|
|
615
|
-
'Resource allocation',
|
|
616
|
-
'Dynamic topology management',
|
|
617
|
-
'Conflict resolution',
|
|
618
|
-
'Auto-scaling'
|
|
619
|
-
]
|
|
620
|
-
},
|
|
621
|
-
{
|
|
622
|
-
name: 'qe-chaos-engineer',
|
|
623
|
-
type: 'chaos-engineer',
|
|
624
|
-
capabilities: [
|
|
625
|
-
'Fault injection',
|
|
626
|
-
'Recovery testing',
|
|
627
|
-
'Blast radius control',
|
|
628
|
-
'Experiment orchestration',
|
|
629
|
-
'Safety validation'
|
|
630
|
-
]
|
|
631
|
-
},
|
|
632
|
-
{
|
|
633
|
-
name: 'qe-visual-tester',
|
|
634
|
-
type: 'visual-tester',
|
|
635
|
-
capabilities: [
|
|
636
|
-
'Screenshot comparison',
|
|
637
|
-
'Visual regression detection',
|
|
638
|
-
'Accessibility validation',
|
|
639
|
-
'Cross-browser testing',
|
|
640
|
-
'Semantic analysis'
|
|
641
|
-
]
|
|
642
|
-
},
|
|
643
|
-
// Strategic Planning Agents (P0 - Critical) (3)
|
|
644
|
-
{
|
|
645
|
-
name: 'qe-requirements-validator',
|
|
646
|
-
type: 'requirements-validator',
|
|
647
|
-
capabilities: [
|
|
648
|
-
'Testability analysis',
|
|
649
|
-
'BDD scenario generation',
|
|
650
|
-
'Risk assessment',
|
|
651
|
-
'Acceptance criteria validation',
|
|
652
|
-
'Traceability mapping'
|
|
653
|
-
]
|
|
654
|
-
},
|
|
655
|
-
{
|
|
656
|
-
name: 'qe-deployment-readiness',
|
|
657
|
-
type: 'deployment-validator',
|
|
658
|
-
capabilities: [
|
|
659
|
-
'Risk scoring',
|
|
660
|
-
'Release confidence calculation',
|
|
661
|
-
'Checklist automation',
|
|
662
|
-
'Rollback prediction',
|
|
663
|
-
'Stakeholder reporting'
|
|
664
|
-
]
|
|
665
|
-
},
|
|
666
|
-
{
|
|
667
|
-
name: 'qe-production-intelligence',
|
|
668
|
-
type: 'production-analyzer',
|
|
669
|
-
capabilities: [
|
|
670
|
-
'Incident replay testing',
|
|
671
|
-
'RUM analysis',
|
|
672
|
-
'Anomaly detection',
|
|
673
|
-
'Load pattern analysis',
|
|
674
|
-
'Feature usage analytics'
|
|
675
|
-
]
|
|
676
|
-
},
|
|
677
|
-
// Optimization Agents (P1 - High Value) (4)
|
|
678
|
-
{
|
|
679
|
-
name: 'qe-regression-risk-analyzer',
|
|
680
|
-
type: 'regression-analyzer',
|
|
681
|
-
capabilities: [
|
|
682
|
-
'Change impact analysis',
|
|
683
|
-
'Test selection optimization',
|
|
684
|
-
'Risk heat mapping',
|
|
685
|
-
'Dependency tracking',
|
|
686
|
-
'Historical pattern learning'
|
|
687
|
-
]
|
|
688
|
-
},
|
|
689
|
-
{
|
|
690
|
-
name: 'qe-test-data-architect',
|
|
691
|
-
type: 'data-generator',
|
|
692
|
-
capabilities: [
|
|
693
|
-
'Schema-aware generation',
|
|
694
|
-
'Relationship preservation',
|
|
695
|
-
'Edge case data',
|
|
696
|
-
'Data anonymization',
|
|
697
|
-
'Realistic data synthesis'
|
|
698
|
-
]
|
|
699
|
-
},
|
|
700
|
-
{
|
|
701
|
-
name: 'qe-api-contract-validator',
|
|
702
|
-
type: 'contract-validator',
|
|
703
|
-
capabilities: [
|
|
704
|
-
'Schema validation',
|
|
705
|
-
'Breaking change detection',
|
|
706
|
-
'Version compatibility',
|
|
707
|
-
'Contract diffing',
|
|
708
|
-
'Consumer impact analysis'
|
|
709
|
-
]
|
|
710
|
-
},
|
|
711
|
-
{
|
|
712
|
-
name: 'qe-flaky-test-hunter',
|
|
713
|
-
type: 'flaky-test-detector',
|
|
714
|
-
capabilities: [
|
|
715
|
-
'Flaky detection',
|
|
716
|
-
'Root cause analysis',
|
|
717
|
-
'Auto-stabilization',
|
|
718
|
-
'Quarantine management',
|
|
719
|
-
'Trend tracking'
|
|
720
|
-
]
|
|
721
|
-
}
|
|
722
|
-
];
|
|
723
|
-
|
|
724
|
-
// Copy comprehensive agent templates
|
|
725
|
-
console.log(chalk.bold('Registering AQE agents with Claude Code:\n'));
|
|
726
|
-
aqeAgents.forEach(agent => {
|
|
727
|
-
copyAgentTemplate(agent.name, targetDir);
|
|
728
|
-
});
|
|
729
|
-
|
|
730
|
-
// Copy command definitions (8 QE slash commands)
|
|
731
|
-
copyCommandDefinitions(targetDir);
|
|
732
|
-
|
|
733
|
-
// Create settings.json with hook configuration
|
|
734
|
-
createSettingsJson(targetDir);
|
|
735
|
-
|
|
736
|
-
// Create fleet configuration with all metadata
|
|
737
|
-
const fleetConfig = createFleetConfig({
|
|
738
|
-
fleetId: `aqe-fleet-${Date.now()}`,
|
|
739
|
-
topology: 'hierarchical',
|
|
740
|
-
maxAgents: 6,
|
|
741
|
-
agents: aqeAgents.map(a => a.name)
|
|
742
|
-
}, targetDir);
|
|
743
|
-
|
|
744
|
-
console.log(chalk.cyan('\n📋 Fleet Configuration:'));
|
|
745
|
-
console.log(` Fleet ID: ${chalk.green(fleetConfig.fleetId)}`);
|
|
746
|
-
console.log(` Topology: ${chalk.green(fleetConfig.topology)}`);
|
|
747
|
-
console.log(` Agents: ${chalk.green(fleetConfig.agents.length)}`);
|
|
748
|
-
console.log(` Commands: ${chalk.green('8 QE slash commands')}`);
|
|
749
|
-
console.log(` Hooks: ${chalk.green('Enabled via settings.json')}`);
|
|
750
|
-
|
|
751
|
-
// Update CLAUDE.md with AQE rules
|
|
752
|
-
updateClaudeMD(targetDir);
|
|
753
|
-
|
|
754
|
-
// Initialize with Claude Flow hooks using secure execution
|
|
755
|
-
console.log(chalk.cyan('\n🔗 Integrating with Claude Flow...\n'));
|
|
756
|
-
try {
|
|
757
|
-
await executeCommand('npx', ['claude-flow@alpha', 'hooks', 'pre-task', '--description', 'AQE Fleet Initialization'], { stdio: 'inherit' });
|
|
758
|
-
await executeCommand('npx', ['claude-flow@alpha', 'memory', 'store', '--key', 'aqe/fleet/id', '--value', fleetConfig.fleetId], { stdio: 'inherit' });
|
|
759
|
-
await executeCommand('npx', ['claude-flow@alpha', 'hooks', 'notify', '--message', 'AQE Fleet initialized with real agents'], { stdio: 'inherit' });
|
|
760
|
-
} catch (error) {
|
|
761
|
-
console.log(chalk.yellow('⚠️ Claude Flow integration optional - continuing...'));
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
console.log(chalk.green('\n✅ AQE Fleet successfully initialized!'));
|
|
765
|
-
console.log(chalk.gray('\nAgents are now available in: .claude/agents/'));
|
|
766
|
-
console.log(chalk.gray('Use Claude Code to interact with these agents.\n'));
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
/**
|
|
770
|
-
* Show fleet status
|
|
771
|
-
*/
|
|
772
|
-
function showFleetStatus() {
|
|
773
|
-
console.log(chalk.cyan('\n📊 AQE Fleet Status\n'));
|
|
774
|
-
|
|
775
|
-
const configPath = path.join(process.cwd(), '.claude', 'aqe-fleet.json');
|
|
776
|
-
|
|
777
|
-
if (!fs.existsSync(configPath)) {
|
|
778
|
-
console.log(chalk.red('❌ Fleet not initialized. Run: aqe init'));
|
|
779
|
-
return;
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
783
|
-
|
|
784
|
-
console.log(`Fleet ID: ${chalk.green(config.fleetId)}`);
|
|
785
|
-
console.log(`Status: ${chalk.green(config.status)}`);
|
|
786
|
-
console.log(`Created: ${chalk.gray(config.created)}`);
|
|
787
|
-
console.log(`Topology: ${chalk.green(config.topology)}`);
|
|
788
|
-
|
|
789
|
-
console.log(chalk.bold('\n🤖 Registered Agents:'));
|
|
790
|
-
const CLAUDE_AGENTS_DIR = path.join(process.cwd(), '.claude', 'agents');
|
|
791
|
-
config.agents.forEach(agentName => {
|
|
792
|
-
const agentPath = path.join(CLAUDE_AGENTS_DIR, `${agentName}.md`);
|
|
793
|
-
const exists = fs.existsSync(agentPath);
|
|
794
|
-
const status = exists ? chalk.green('✓ Active') : chalk.red('✗ Missing');
|
|
795
|
-
console.log(` ${agentName}: ${status}`);
|
|
796
|
-
});
|
|
797
|
-
|
|
798
|
-
console.log(chalk.cyan('\n💡 Quick Commands:'));
|
|
799
|
-
console.log(' aqe test <module> - Generate tests');
|
|
800
|
-
console.log(' aqe coverage - Analyze coverage');
|
|
801
|
-
console.log(' aqe quality - Check quality gates');
|
|
802
|
-
console.log(' aqe agent execute - Run agent task');
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
/**
|
|
806
|
-
* Setup MCP integration
|
|
807
|
-
*/
|
|
808
|
-
function setupMCP() {
|
|
809
|
-
console.log(chalk.cyan('\n🔧 Setting up MCP Server for Claude Code...\n'));
|
|
810
|
-
|
|
811
|
-
// Update package.json with MCP script
|
|
812
|
-
const packagePath = path.join(process.cwd(), 'package.json');
|
|
813
|
-
|
|
814
|
-
if (!fs.existsSync(packagePath)) {
|
|
815
|
-
console.log(chalk.red('❌ No package.json found. Please run from project root.'));
|
|
816
|
-
return;
|
|
96
|
+
console.error('');
|
|
97
|
+
console.error('Run with DEBUG=1 for detailed error information:');
|
|
98
|
+
console.error(' DEBUG=1 aqe --help');
|
|
817
99
|
}
|
|
818
100
|
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
console.
|
|
827
|
-
|
|
828
|
-
console.log(chalk.cyan('\nTo connect AQE to Claude Code:'));
|
|
829
|
-
console.log(chalk.bold('\n1. Add MCP server to Claude Code:'));
|
|
830
|
-
console.log(chalk.gray(' claude mcp add agentic-qe "cd ' + process.cwd() + ' && npm run mcp:start"'));
|
|
831
|
-
|
|
832
|
-
console.log(chalk.bold('\n2. Restart Claude Code to load MCP tools'));
|
|
101
|
+
console.error('');
|
|
102
|
+
console.error('Troubleshooting:');
|
|
103
|
+
console.error(' 1. Rebuild: npm run build');
|
|
104
|
+
console.error(' 2. Reinstall: npm install');
|
|
105
|
+
console.error(' 3. Check Node.js version: node --version (require 18+)');
|
|
106
|
+
console.error('');
|
|
107
|
+
console.error('If the issue persists, please report at:');
|
|
108
|
+
console.error('https://github.com/proffesor-for-testing/agentic-qe/issues');
|
|
833
109
|
|
|
834
|
-
console.log(chalk.bold('\n3. Use MCP tools in Claude Code:'));
|
|
835
|
-
console.log(chalk.gray(' - mcp__agentic_qe__fleet_init'));
|
|
836
|
-
console.log(chalk.gray(' - mcp__agentic_qe__test_generate'));
|
|
837
|
-
console.log(chalk.gray(' - mcp__agentic_qe__test_execute'));
|
|
838
|
-
console.log(chalk.gray(' - mcp__agentic_qe__quality_analyze'));
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
// Get command and arguments
|
|
842
|
-
const command = process.argv[2];
|
|
843
|
-
const args = process.argv.slice(3);
|
|
844
|
-
|
|
845
|
-
// Handle commands - wrapped in async function for secure execution
|
|
846
|
-
async function handleCommand() {
|
|
847
|
-
switch(command) {
|
|
848
|
-
case 'init':
|
|
849
|
-
// Initialize AQE Fleet
|
|
850
|
-
const targetDir = args[0] || process.cwd();
|
|
851
|
-
await initializeFleet(targetDir);
|
|
852
|
-
break;
|
|
853
|
-
|
|
854
|
-
case 'status':
|
|
855
|
-
// Show fleet status
|
|
856
|
-
showFleetStatus();
|
|
857
|
-
break;
|
|
858
|
-
|
|
859
|
-
case 'mcp':
|
|
860
|
-
// Setup MCP server
|
|
861
|
-
setupMCP();
|
|
862
|
-
break;
|
|
863
|
-
|
|
864
|
-
case 'agent':
|
|
865
|
-
// Agent management commands - delegate to main agentic-qe using secure execution
|
|
866
|
-
const mainScript = path.join(__dirname, 'agentic-qe');
|
|
867
|
-
try {
|
|
868
|
-
await executeCommand('node', [mainScript, 'agent', ...args], { stdio: 'inherit' });
|
|
869
|
-
} catch (error) {
|
|
870
|
-
console.error(chalk.red('Failed to execute agent command:'), error.message);
|
|
871
|
-
process.exit(1);
|
|
872
|
-
}
|
|
873
|
-
break;
|
|
874
|
-
|
|
875
|
-
case 'test':
|
|
876
|
-
// Quick test generation
|
|
877
|
-
if (!args.length) {
|
|
878
|
-
console.log(chalk.red('❌ Please specify a module: aqe test <module>'));
|
|
879
|
-
process.exit(1);
|
|
880
|
-
}
|
|
881
|
-
console.log(chalk.cyan(`\n🧪 Generating tests for: ${args.join(' ')}\n`));
|
|
882
|
-
console.log(chalk.yellow('Using qe-test-generator agent...'));
|
|
883
|
-
// TODO: Implement actual test generation
|
|
884
|
-
console.log(chalk.gray('\nNote: Direct test generation coming soon.'));
|
|
885
|
-
console.log(chalk.gray('For now, use: aqe agent execute --name qe-test-generator --task "generate tests for ' + args.join(' ') + '"'));
|
|
886
|
-
break;
|
|
887
|
-
|
|
888
|
-
case 'coverage':
|
|
889
|
-
// Quick coverage analysis
|
|
890
|
-
console.log(chalk.cyan('\n📊 Analyzing test coverage...\n'));
|
|
891
|
-
console.log(chalk.yellow('Using qe-coverage-analyzer agent...'));
|
|
892
|
-
// TODO: Implement actual coverage analysis
|
|
893
|
-
console.log(chalk.gray('\nNote: Direct coverage analysis coming soon.'));
|
|
894
|
-
console.log(chalk.gray('For now, use: aqe agent execute --name qe-coverage-analyzer --task "analyze coverage"'));
|
|
895
|
-
break;
|
|
896
|
-
|
|
897
|
-
case 'quality':
|
|
898
|
-
// Quick quality gate check
|
|
899
|
-
console.log(chalk.cyan('\n✅ Running quality gate check...\n'));
|
|
900
|
-
console.log(chalk.yellow('Using qe-quality-gate agent...'));
|
|
901
|
-
// TODO: Implement actual quality gate
|
|
902
|
-
console.log(chalk.gray('\nNote: Direct quality gate check coming soon.'));
|
|
903
|
-
console.log(chalk.gray('For now, use: aqe agent execute --name qe-quality-gate --task "evaluate quality gate"'));
|
|
904
|
-
break;
|
|
905
|
-
|
|
906
|
-
case 'help':
|
|
907
|
-
case '--help':
|
|
908
|
-
case '-h':
|
|
909
|
-
case undefined:
|
|
910
|
-
// Show help
|
|
911
|
-
console.log(chalk.cyan('\n🚀 AQE - Agentic Quality Engineering Fleet\n'));
|
|
912
|
-
console.log(chalk.bold('Usage:') + ' aqe <command> [options]\n');
|
|
913
|
-
|
|
914
|
-
console.log(chalk.bold('Core Commands:'));
|
|
915
|
-
console.log(' ' + chalk.green('init [dir]') + ' Initialize AQE Fleet in directory (updates CLAUDE.md)');
|
|
916
|
-
console.log(' ' + chalk.green('status') + ' Show fleet status and registered agents');
|
|
917
|
-
console.log(' ' + chalk.green('mcp') + ' Setup MCP server for Claude Code integration\n');
|
|
918
|
-
|
|
919
|
-
console.log(chalk.bold('Quick Actions:'));
|
|
920
|
-
console.log(' ' + chalk.green('test <module>') + ' Generate tests for a module');
|
|
921
|
-
console.log(' ' + chalk.green('coverage') + ' Analyze test coverage');
|
|
922
|
-
console.log(' ' + chalk.green('quality') + ' Run quality gate check\n');
|
|
923
|
-
|
|
924
|
-
console.log(chalk.bold('Agent Management:'));
|
|
925
|
-
console.log(' ' + chalk.green('agent spawn') + ' Spawn a QE agent');
|
|
926
|
-
console.log(' ' + chalk.green('agent execute') + ' Execute agent task');
|
|
927
|
-
console.log(' ' + chalk.green('agent status') + ' Check agent status\n');
|
|
928
|
-
|
|
929
|
-
console.log(chalk.bold('Available Agents:'));
|
|
930
|
-
console.log(' • qe-test-generator - AI-powered test creation');
|
|
931
|
-
console.log(' • qe-test-executor - Parallel test execution');
|
|
932
|
-
console.log(' • qe-coverage-analyzer - O(log n) coverage optimization');
|
|
933
|
-
console.log(' • qe-quality-gate - Go/no-go decisions');
|
|
934
|
-
console.log(' • qe-performance-tester - Load testing');
|
|
935
|
-
console.log(' • qe-security-scanner - SAST/DAST scanning\n');
|
|
936
|
-
|
|
937
|
-
console.log(chalk.gray('Examples:'));
|
|
938
|
-
console.log(chalk.gray(' aqe init # Initialize in current directory'));
|
|
939
|
-
console.log(chalk.gray(' aqe init /my/project # Initialize in specific directory'));
|
|
940
|
-
console.log(chalk.gray(' aqe test user-service # Generate tests for user-service'));
|
|
941
|
-
console.log(chalk.gray(' aqe coverage # Analyze test coverage'));
|
|
942
|
-
console.log(chalk.gray(' aqe quality # Check quality gates\n'));
|
|
943
|
-
|
|
944
|
-
console.log(chalk.dim('For detailed help on any command, use: aqe <command> --help'));
|
|
945
|
-
console.log(chalk.dim('Documentation: https://github.com/agentic-qe/docs\n'));
|
|
946
|
-
break;
|
|
947
|
-
|
|
948
|
-
default:
|
|
949
|
-
console.error(chalk.red(`Unknown command: ${command}`));
|
|
950
|
-
console.log(chalk.yellow('\nRun "aqe help" to see available commands'));
|
|
951
|
-
process.exit(1);
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
// Execute command handler
|
|
956
|
-
handleCommand().catch(error => {
|
|
957
|
-
console.error(chalk.red('Error executing command:'), error.message);
|
|
958
110
|
process.exit(1);
|
|
959
|
-
}
|
|
111
|
+
}
|