agentic-qe 1.0.5 → 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 +669 -162
- 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 +33 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +656 -39
- 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/index.js +367 -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/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 +94 -0
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools.d.ts +15 -0
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +17 -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 +4 -0
- 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
|
@@ -44,7 +44,7 @@ const fs = __importStar(require("fs-extra"));
|
|
|
44
44
|
const path = __importStar(require("path"));
|
|
45
45
|
class InitCommand {
|
|
46
46
|
static async execute(options) {
|
|
47
|
-
console.log(chalk_1.default.blue.bold('\n🚀 Initializing Agentic QE
|
|
47
|
+
console.log(chalk_1.default.blue.bold('\n🚀 Initializing Agentic QE Project (v1.1.0)\n'));
|
|
48
48
|
try {
|
|
49
49
|
// Parse options
|
|
50
50
|
const maxAgents = parseInt(options.maxAgents);
|
|
@@ -138,6 +138,16 @@ class InitCommand {
|
|
|
138
138
|
if (fleetConfig.streaming) {
|
|
139
139
|
fleetConfig.streaming.enabled = projectAnswers.enableStreaming;
|
|
140
140
|
}
|
|
141
|
+
// Enable Phase 2 features by default (no questions)
|
|
142
|
+
options.enableLearning = true;
|
|
143
|
+
options.enablePatterns = true;
|
|
144
|
+
options.enableImprovement = true;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
// Use defaults if non-interactive
|
|
148
|
+
options.enableLearning = true;
|
|
149
|
+
options.enablePatterns = true;
|
|
150
|
+
options.enableImprovement = true;
|
|
141
151
|
}
|
|
142
152
|
const spinner = (0, ora_1.default)('Setting up fleet infrastructure...').start();
|
|
143
153
|
// Create directory structure
|
|
@@ -153,8 +163,28 @@ class InitCommand {
|
|
|
153
163
|
spinner.text = 'Creating CLAUDE.md documentation...';
|
|
154
164
|
// Create or update CLAUDE.md with agent documentation
|
|
155
165
|
await this.createClaudeMd(fleetConfig);
|
|
166
|
+
// Initialize Claude Flow coordination
|
|
167
|
+
await this.initializeCoordination(fleetConfig);
|
|
168
|
+
// Phase 2: Initialize memory database FIRST (required for agents)
|
|
169
|
+
spinner.text = 'Initializing memory database...';
|
|
170
|
+
await this.initializeMemoryDatabase();
|
|
171
|
+
// Phase 2: Initialize pattern bank database
|
|
172
|
+
if (options.enablePatterns !== false) {
|
|
173
|
+
spinner.text = 'Initializing pattern bank database...';
|
|
174
|
+
await this.initializePatternDatabase(fleetConfig);
|
|
175
|
+
}
|
|
176
|
+
// Phase 2: Initialize learning system
|
|
177
|
+
if (options.enableLearning !== false) {
|
|
178
|
+
spinner.text = 'Initializing learning system...';
|
|
179
|
+
await this.initializeLearningSystem(fleetConfig);
|
|
180
|
+
}
|
|
181
|
+
// Phase 2: Initialize improvement loop
|
|
182
|
+
if (options.enableImprovement !== false) {
|
|
183
|
+
spinner.text = 'Setting up improvement loop...';
|
|
184
|
+
await this.initializeImprovementLoop(fleetConfig);
|
|
185
|
+
}
|
|
186
|
+
// Now spawn agents AFTER databases are initialized
|
|
156
187
|
spinner.text = 'Spawning initial agents...';
|
|
157
|
-
// Spawn initial fleet agents
|
|
158
188
|
await this.spawnInitialAgents(fleetConfig);
|
|
159
189
|
spinner.succeed(chalk_1.default.green('Fleet initialization completed successfully!'));
|
|
160
190
|
// Display summary
|
|
@@ -167,19 +197,25 @@ class InitCommand {
|
|
|
167
197
|
// Show agent status
|
|
168
198
|
const agentCount = await this.countAgentFiles('.claude/agents');
|
|
169
199
|
console.log(chalk_1.default.gray(` Agent Definitions: ${agentCount} agents ready`));
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
200
|
+
// Create comprehensive config.json
|
|
201
|
+
spinner.text = 'Creating comprehensive configuration...';
|
|
202
|
+
await this.createComprehensiveConfig(fleetConfig, {
|
|
203
|
+
enableLearning: options.enableLearning !== false,
|
|
204
|
+
enablePatterns: options.enablePatterns !== false,
|
|
205
|
+
enableImprovement: options.enableImprovement !== false
|
|
206
|
+
});
|
|
207
|
+
spinner.succeed(chalk_1.default.green('Project initialization completed successfully!'));
|
|
208
|
+
// Display comprehensive summary
|
|
209
|
+
await this.displayComprehensiveSummary(fleetConfig, {
|
|
210
|
+
enableLearning: options.enableLearning !== false,
|
|
211
|
+
enablePatterns: options.enablePatterns !== false,
|
|
212
|
+
enableImprovement: options.enableImprovement !== false
|
|
213
|
+
});
|
|
177
214
|
}
|
|
178
215
|
catch (error) {
|
|
179
216
|
console.error(chalk_1.default.red('❌ Initialization failed:'), error.message);
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
217
|
+
console.error(chalk_1.default.gray('\nStack trace:'));
|
|
218
|
+
console.error(chalk_1.default.gray(error.stack));
|
|
183
219
|
process.exit(1);
|
|
184
220
|
}
|
|
185
221
|
}
|
|
@@ -189,8 +225,14 @@ class InitCommand {
|
|
|
189
225
|
'.agentic-qe/config',
|
|
190
226
|
'.agentic-qe/logs',
|
|
191
227
|
'.agentic-qe/data',
|
|
228
|
+
'.agentic-qe/data/learning', // Phase 2: Learning state
|
|
229
|
+
'.agentic-qe/data/patterns', // Phase 2: Pattern database
|
|
230
|
+
'.agentic-qe/data/improvement', // Phase 2: Improvement state
|
|
192
231
|
'.agentic-qe/agents',
|
|
193
232
|
'.agentic-qe/reports',
|
|
233
|
+
'.agentic-qe/scripts', // For coordination scripts
|
|
234
|
+
'.agentic-qe/state', // For state management
|
|
235
|
+
'.agentic-qe/state/coordination', // Coordination state
|
|
194
236
|
'.claude', // For Claude Code integration
|
|
195
237
|
'.claude/agents', // Where agent definitions live
|
|
196
238
|
'tests/unit',
|
|
@@ -206,47 +248,102 @@ class InitCommand {
|
|
|
206
248
|
await this.copyAgentTemplates();
|
|
207
249
|
}
|
|
208
250
|
static async copyAgentTemplates() {
|
|
251
|
+
console.log(chalk_1.default.cyan(' 🔍 Searching for agent templates...'));
|
|
209
252
|
// Find the agentic-qe package location (handles both npm install and local dev)
|
|
210
253
|
const possiblePaths = [
|
|
211
254
|
path.join(__dirname, '../../../.claude/agents'), // From dist/cli/commands
|
|
212
255
|
path.join(process.cwd(), 'node_modules/agentic-qe/.claude/agents'),
|
|
213
256
|
path.join(process.cwd(), '../agentic-qe/.claude/agents') // Monorepo case
|
|
214
257
|
];
|
|
258
|
+
console.log(chalk_1.default.gray(' • Checking paths:'));
|
|
215
259
|
let sourcePath = null;
|
|
216
260
|
for (const p of possiblePaths) {
|
|
217
|
-
|
|
261
|
+
const exists = await fs.pathExists(p);
|
|
262
|
+
console.log(chalk_1.default.gray(` ${exists ? '✓' : '✗'} ${p}`));
|
|
263
|
+
if (exists && !sourcePath) {
|
|
218
264
|
sourcePath = p;
|
|
219
|
-
break;
|
|
220
265
|
}
|
|
221
266
|
}
|
|
222
267
|
if (!sourcePath) {
|
|
223
|
-
console.warn(chalk_1.default.yellow('⚠️
|
|
268
|
+
console.warn(chalk_1.default.yellow(' ⚠️ No agent templates found in package paths'));
|
|
269
|
+
console.warn(chalk_1.default.yellow(' ℹ️ Falling back to programmatic generation (all 18 agents)'));
|
|
224
270
|
await this.createBasicAgents();
|
|
225
271
|
return;
|
|
226
272
|
}
|
|
227
|
-
|
|
273
|
+
console.log(chalk_1.default.green(` ✓ Found agent templates at: ${sourcePath}`));
|
|
274
|
+
// Count available templates
|
|
275
|
+
const availableFiles = await fs.readdir(sourcePath);
|
|
276
|
+
const templateFiles = availableFiles.filter(f => f.endsWith('.md'));
|
|
277
|
+
console.log(chalk_1.default.cyan(` 📦 Found ${templateFiles.length} agent templates to copy`));
|
|
278
|
+
// Copy all agent definition files individually (not directory copy)
|
|
228
279
|
const targetPath = path.join(process.cwd(), '.claude/agents');
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
280
|
+
let copiedFiles = 0;
|
|
281
|
+
for (const templateFile of templateFiles) {
|
|
282
|
+
const sourceFile = path.join(sourcePath, templateFile);
|
|
283
|
+
const targetFile = path.join(targetPath, templateFile);
|
|
284
|
+
// Only copy if target doesn't exist
|
|
285
|
+
if (!await fs.pathExists(targetFile)) {
|
|
286
|
+
await fs.copy(sourceFile, targetFile);
|
|
287
|
+
copiedFiles++;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
console.log(chalk_1.default.green(` ✓ Copied ${copiedFiles} new agent definitions`));
|
|
291
|
+
const copiedCount = await this.countAgentFiles(targetPath);
|
|
292
|
+
console.log(chalk_1.default.cyan(` 📋 Total agents in target: ${copiedCount}`));
|
|
293
|
+
// Verify all 18 agents exist (17 QE agents + 1 base template generator)
|
|
294
|
+
const expectedAgents = 18;
|
|
295
|
+
if (copiedCount < expectedAgents) {
|
|
296
|
+
console.warn(chalk_1.default.yellow(` ⚠️ Expected ${expectedAgents} agents, found ${copiedCount}`));
|
|
297
|
+
console.warn(chalk_1.default.yellow(` ℹ️ Creating missing agents programmatically...`));
|
|
298
|
+
// Get list of files that actually exist in TARGET (not source!)
|
|
299
|
+
const targetFiles = await fs.readdir(targetPath);
|
|
300
|
+
const existingTargetFiles = targetFiles.filter(f => f.endsWith('.md'));
|
|
301
|
+
await this.createMissingAgents(targetPath, existingTargetFiles);
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
console.log(chalk_1.default.green(` ✓ All ${expectedAgents} agents present and ready`));
|
|
305
|
+
}
|
|
234
306
|
}
|
|
235
307
|
static async createBasicAgents() {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
308
|
+
try {
|
|
309
|
+
console.log(chalk_1.default.cyan(' 🛠️ Creating all agent definitions programmatically...'));
|
|
310
|
+
// ALL 18 AGENTS (17 QE agents + 1 base template generator)
|
|
311
|
+
const allAgents = [
|
|
312
|
+
// Core Testing (5)
|
|
313
|
+
'qe-test-generator',
|
|
314
|
+
'qe-test-executor',
|
|
315
|
+
'qe-coverage-analyzer',
|
|
316
|
+
'qe-quality-gate',
|
|
317
|
+
'qe-quality-analyzer',
|
|
318
|
+
// Performance & Security (2)
|
|
319
|
+
'qe-performance-tester',
|
|
320
|
+
'qe-security-scanner',
|
|
321
|
+
// Strategic Planning (3)
|
|
322
|
+
'qe-requirements-validator',
|
|
323
|
+
'qe-production-intelligence',
|
|
324
|
+
'qe-fleet-commander',
|
|
325
|
+
// Deployment (1)
|
|
326
|
+
'qe-deployment-readiness',
|
|
327
|
+
// Advanced Testing (4)
|
|
328
|
+
'qe-regression-risk-analyzer',
|
|
329
|
+
'qe-test-data-architect',
|
|
330
|
+
'qe-api-contract-validator',
|
|
331
|
+
'qe-flaky-test-hunter',
|
|
332
|
+
// Specialized (2)
|
|
333
|
+
'qe-visual-tester',
|
|
334
|
+
'qe-chaos-engineer'
|
|
335
|
+
];
|
|
336
|
+
const targetPath = path.join(process.cwd(), '.claude/agents');
|
|
337
|
+
console.log(chalk_1.default.gray(` • Creating ${allAgents.length} agent definition files...`));
|
|
338
|
+
for (const agentName of allAgents) {
|
|
339
|
+
// Defensive null check
|
|
340
|
+
if (!agentName || typeof agentName !== 'string') {
|
|
341
|
+
console.warn(chalk_1.default.yellow(`⚠️ Skipping invalid agent name: ${agentName}`));
|
|
342
|
+
continue;
|
|
343
|
+
}
|
|
344
|
+
const agentFile = path.join(targetPath, `${agentName}.md`);
|
|
345
|
+
const agentType = agentName.replace('qe-', '');
|
|
346
|
+
const content = `---
|
|
250
347
|
name: ${agentName}
|
|
251
348
|
type: ${agentType}
|
|
252
349
|
color: blue
|
|
@@ -402,10 +499,81 @@ for await (const event of agent.execute(params)) {
|
|
|
402
499
|
}
|
|
403
500
|
\\\`\\\`\\\`
|
|
404
501
|
|
|
502
|
+
For full capabilities, install the complete agentic-qe package.
|
|
503
|
+
`;
|
|
504
|
+
await fs.writeFile(agentFile, content);
|
|
505
|
+
console.log(chalk_1.default.gray(` ✓ Created ${agentName}.md`));
|
|
506
|
+
}
|
|
507
|
+
const finalCount = await this.countAgentFiles(targetPath);
|
|
508
|
+
console.log(chalk_1.default.green(` ✓ Successfully created ${finalCount} agent definitions`));
|
|
509
|
+
}
|
|
510
|
+
catch (error) {
|
|
511
|
+
console.error(chalk_1.default.red('❌ Error in createBasicAgents:'), error.message);
|
|
512
|
+
console.error(chalk_1.default.gray('Stack trace:'), error.stack);
|
|
513
|
+
throw error;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
static async createMissingAgents(targetPath, existingFiles) {
|
|
517
|
+
const allAgentNames = [
|
|
518
|
+
'qe-test-generator', 'qe-test-executor', 'qe-coverage-analyzer',
|
|
519
|
+
'qe-quality-gate', 'qe-quality-analyzer', 'qe-performance-tester',
|
|
520
|
+
'qe-security-scanner', 'qe-requirements-validator', 'qe-production-intelligence',
|
|
521
|
+
'qe-fleet-commander', 'qe-deployment-readiness', 'qe-regression-risk-analyzer',
|
|
522
|
+
'qe-test-data-architect', 'qe-api-contract-validator', 'qe-flaky-test-hunter',
|
|
523
|
+
'qe-visual-tester', 'qe-chaos-engineer'
|
|
524
|
+
];
|
|
525
|
+
const existingAgentNames = existingFiles.map(f => f.replace('.md', ''));
|
|
526
|
+
const missingAgents = allAgentNames.filter(name => !existingAgentNames.includes(name));
|
|
527
|
+
if (missingAgents.length === 0) {
|
|
528
|
+
console.log(chalk_1.default.green(' ✓ No missing agents to create'));
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
console.log(chalk_1.default.cyan(` 🛠️ Creating ${missingAgents.length} missing agents:`));
|
|
532
|
+
for (const agentName of missingAgents) {
|
|
533
|
+
console.log(chalk_1.default.gray(` • ${agentName}`));
|
|
534
|
+
}
|
|
535
|
+
// Create missing agents using the same logic as createBasicAgents
|
|
536
|
+
for (const agentName of missingAgents) {
|
|
537
|
+
const agentFile = path.join(targetPath, `${agentName}.md`);
|
|
538
|
+
const agentType = agentName.replace('qe-', '');
|
|
539
|
+
const content = `---
|
|
540
|
+
name: ${agentName}
|
|
541
|
+
type: ${agentType}
|
|
542
|
+
color: blue
|
|
543
|
+
priority: medium
|
|
544
|
+
description: "Agentic QE Fleet ${agentType} agent"
|
|
545
|
+
capabilities:
|
|
546
|
+
- ${agentType}
|
|
547
|
+
coordination:
|
|
548
|
+
protocol: aqe-hooks
|
|
549
|
+
metadata:
|
|
550
|
+
version: "1.1.0"
|
|
551
|
+
framework: "agentic-qe"
|
|
552
|
+
routing: "supported"
|
|
553
|
+
streaming: "supported"
|
|
554
|
+
---
|
|
555
|
+
|
|
556
|
+
# ${agentName.toUpperCase()} Agent
|
|
557
|
+
|
|
558
|
+
## Description
|
|
559
|
+
This agent is part of the Agentic QE Fleet and specializes in ${agentType}.
|
|
560
|
+
|
|
561
|
+
## Capabilities
|
|
562
|
+
- AI-powered ${agentType}
|
|
563
|
+
- Integration with Agentic QE Fleet
|
|
564
|
+
- Native TypeScript coordination
|
|
565
|
+
|
|
566
|
+
## Coordination Protocol
|
|
567
|
+
|
|
568
|
+
This agent uses **AQE hooks** (Agentic QE native hooks) for coordination (zero external dependencies, 100-500x faster than external hooks).
|
|
569
|
+
|
|
405
570
|
For full capabilities, install the complete agentic-qe package.
|
|
406
571
|
`;
|
|
407
572
|
await fs.writeFile(agentFile, content);
|
|
573
|
+
console.log(chalk_1.default.gray(` ✓ Created ${agentName}.md`));
|
|
408
574
|
}
|
|
575
|
+
const finalCount = await this.countAgentFiles(targetPath);
|
|
576
|
+
console.log(chalk_1.default.green(` ✓ Total agent count: ${finalCount}`));
|
|
409
577
|
}
|
|
410
578
|
static async countAgentFiles(dirPath) {
|
|
411
579
|
if (!await fs.pathExists(dirPath))
|
|
@@ -414,16 +582,50 @@ For full capabilities, install the complete agentic-qe package.
|
|
|
414
582
|
return files.filter(f => f.endsWith('.md')).length;
|
|
415
583
|
}
|
|
416
584
|
static async writeFleetConfig(config) {
|
|
585
|
+
console.log(chalk_1.default.cyan(' 📝 Writing fleet configuration...'));
|
|
586
|
+
// Sanitize config to remove undefined values that cause jsonfile errors
|
|
587
|
+
const sanitizedConfig = this.sanitizeConfig(config);
|
|
417
588
|
const configPath = '.agentic-qe/config/fleet.json';
|
|
418
|
-
await fs.writeJson(configPath,
|
|
589
|
+
await fs.writeJson(configPath, sanitizedConfig, { spaces: 2 });
|
|
590
|
+
console.log(chalk_1.default.gray(` ✓ Wrote ${configPath}`));
|
|
419
591
|
// Create agent configurations
|
|
420
|
-
const agentConfigs = this.generateAgentConfigs(config);
|
|
592
|
+
const agentConfigs = this.sanitizeConfig(this.generateAgentConfigs(config));
|
|
421
593
|
await fs.writeJson('.agentic-qe/config/agents.json', agentConfigs, { spaces: 2 });
|
|
594
|
+
console.log(chalk_1.default.gray(` ✓ Wrote .agentic-qe/config/agents.json`));
|
|
422
595
|
// Create environment configurations
|
|
423
|
-
const envConfigs = this.generateEnvironmentConfigs(config.environments || []);
|
|
596
|
+
const envConfigs = this.sanitizeConfig(this.generateEnvironmentConfigs(config.environments || []));
|
|
424
597
|
await fs.writeJson('.agentic-qe/config/environments.json', envConfigs, { spaces: 2 });
|
|
598
|
+
console.log(chalk_1.default.gray(` ✓ Wrote .agentic-qe/config/environments.json`));
|
|
425
599
|
// Create routing configuration (Phase 1 - v1.0.5)
|
|
426
600
|
await this.writeRoutingConfig(config);
|
|
601
|
+
console.log(chalk_1.default.green(' ✓ Fleet configuration complete'));
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Sanitize config object by removing undefined values and ensuring all properties are serializable
|
|
605
|
+
*/
|
|
606
|
+
static sanitizeConfig(obj) {
|
|
607
|
+
if (obj === null || obj === undefined) {
|
|
608
|
+
return null;
|
|
609
|
+
}
|
|
610
|
+
if (Array.isArray(obj)) {
|
|
611
|
+
return obj.map(item => this.sanitizeConfig(item)).filter(item => item !== null && item !== undefined);
|
|
612
|
+
}
|
|
613
|
+
if (typeof obj === 'object') {
|
|
614
|
+
const sanitized = {};
|
|
615
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
616
|
+
// Skip undefined values
|
|
617
|
+
if (value === undefined) {
|
|
618
|
+
continue;
|
|
619
|
+
}
|
|
620
|
+
// Recursively sanitize nested objects
|
|
621
|
+
const sanitizedValue = this.sanitizeConfig(value);
|
|
622
|
+
if (sanitizedValue !== null && sanitizedValue !== undefined) {
|
|
623
|
+
sanitized[key] = sanitizedValue;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
return sanitized;
|
|
627
|
+
}
|
|
628
|
+
return obj;
|
|
427
629
|
}
|
|
428
630
|
static async writeRoutingConfig(config) {
|
|
429
631
|
const routingConfig = {
|
|
@@ -576,6 +778,9 @@ For full capabilities, install the complete agentic-qe package.
|
|
|
576
778
|
await fs.writeJson('.agentic-qe/data/registry.json', agentRegistry, { spaces: 2 });
|
|
577
779
|
}
|
|
578
780
|
static async initializeCoordination(config) {
|
|
781
|
+
// Ensure config has required properties
|
|
782
|
+
const topology = config.topology || 'hierarchical';
|
|
783
|
+
const maxAgents = config.maxAgents || 10;
|
|
579
784
|
// Create pre-execution coordination script (AQE native)
|
|
580
785
|
const preExecutionScript = `#!/bin/bash
|
|
581
786
|
# Agentic QE Fleet Pre-Execution Coordination
|
|
@@ -585,7 +790,7 @@ For full capabilities, install the complete agentic-qe package.
|
|
|
585
790
|
agentic-qe fleet status --json > /tmp/aqe-fleet-status-pre.json 2>/dev/null || true
|
|
586
791
|
|
|
587
792
|
# Log coordination event
|
|
588
|
-
echo "[AQE] Pre-execution coordination: Fleet topology=${
|
|
793
|
+
echo "[AQE] Pre-execution coordination: Fleet topology=${topology}, Max agents=${maxAgents}" >> .agentic-qe/logs/coordination.log
|
|
589
794
|
|
|
590
795
|
# Store fleet config in coordination memory (via file-based state)
|
|
591
796
|
mkdir -p .agentic-qe/state/coordination
|
|
@@ -949,6 +1154,418 @@ tail -f .agentic-qe/logs/fleet.log
|
|
|
949
1154
|
`;
|
|
950
1155
|
await fs.writeFile(claudeMdPath, claudeMdContent);
|
|
951
1156
|
}
|
|
1157
|
+
// ============================================================================
|
|
1158
|
+
// Phase 2 Initialization Methods (v1.1.0)
|
|
1159
|
+
// ============================================================================
|
|
1160
|
+
/**
|
|
1161
|
+
* Initialize Phase 2 Pattern Bank Database
|
|
1162
|
+
*/
|
|
1163
|
+
static async initializePatternDatabase(config) {
|
|
1164
|
+
const Database = (await Promise.resolve().then(() => __importStar(require('better-sqlite3')))).default;
|
|
1165
|
+
const dbPath = path.join(process.cwd(), '.agentic-qe', 'patterns.db');
|
|
1166
|
+
console.log(chalk_1.default.cyan(' 📦 Initializing Pattern Bank database...'));
|
|
1167
|
+
const db = new Database(dbPath);
|
|
1168
|
+
// Enable WAL mode for better concurrency
|
|
1169
|
+
db.pragma('journal_mode = WAL');
|
|
1170
|
+
db.pragma('synchronous = NORMAL');
|
|
1171
|
+
db.pragma('cache_size = -64000'); // 64MB cache
|
|
1172
|
+
// Read and execute the schema
|
|
1173
|
+
const schemaPath = path.join(__dirname, '../../../docs/architecture/REASONING-BANK-SCHEMA.sql');
|
|
1174
|
+
let schema;
|
|
1175
|
+
if (await fs.pathExists(schemaPath)) {
|
|
1176
|
+
schema = await fs.readFile(schemaPath, 'utf-8');
|
|
1177
|
+
}
|
|
1178
|
+
else {
|
|
1179
|
+
// Fallback: inline schema if file not found
|
|
1180
|
+
schema = this.getPatternBankSchema();
|
|
1181
|
+
}
|
|
1182
|
+
// Execute schema
|
|
1183
|
+
db.exec(schema);
|
|
1184
|
+
db.close();
|
|
1185
|
+
console.log(chalk_1.default.green(' ✓ Pattern Bank initialized'));
|
|
1186
|
+
console.log(chalk_1.default.gray(` • Database: ${dbPath}`));
|
|
1187
|
+
console.log(chalk_1.default.gray(` • Framework: ${config.frameworks?.[0] || 'jest'}`));
|
|
1188
|
+
console.log(chalk_1.default.gray(` • Tables: test_patterns, pattern_usage, cross_project_mappings, pattern_similarity_index`));
|
|
1189
|
+
console.log(chalk_1.default.gray(` • Full-text search: enabled`));
|
|
1190
|
+
}
|
|
1191
|
+
/**
|
|
1192
|
+
* Initialize Phase 2 Memory Database (SwarmMemoryManager)
|
|
1193
|
+
*/
|
|
1194
|
+
static async initializeMemoryDatabase() {
|
|
1195
|
+
const dbPath = path.join(process.cwd(), '.agentic-qe', 'memory.db');
|
|
1196
|
+
console.log(chalk_1.default.cyan(' 💾 Initializing Memory Manager database...'));
|
|
1197
|
+
// Import SwarmMemoryManager dynamically
|
|
1198
|
+
const { SwarmMemoryManager } = await Promise.resolve().then(() => __importStar(require('../../core/memory/SwarmMemoryManager')));
|
|
1199
|
+
const memoryManager = new SwarmMemoryManager(dbPath);
|
|
1200
|
+
await memoryManager.initialize();
|
|
1201
|
+
// Verify tables created
|
|
1202
|
+
const stats = await memoryManager.stats();
|
|
1203
|
+
await memoryManager.close();
|
|
1204
|
+
console.log(chalk_1.default.green(' ✓ Memory Manager initialized'));
|
|
1205
|
+
console.log(chalk_1.default.gray(` • Database: ${dbPath}`));
|
|
1206
|
+
console.log(chalk_1.default.gray(` • Tables: 12 tables (memory_entries, hints, events, workflow_state, patterns, etc.)`));
|
|
1207
|
+
console.log(chalk_1.default.gray(` • Access control: 5 levels (private, team, swarm, public, system)`));
|
|
1208
|
+
}
|
|
1209
|
+
/**
|
|
1210
|
+
* Initialize Phase 2 Learning System
|
|
1211
|
+
*/
|
|
1212
|
+
static async initializeLearningSystem(config) {
|
|
1213
|
+
const learningConfig = {
|
|
1214
|
+
enabled: true,
|
|
1215
|
+
learningRate: 0.1,
|
|
1216
|
+
discountFactor: 0.95,
|
|
1217
|
+
explorationRate: 0.2,
|
|
1218
|
+
explorationDecay: 0.995,
|
|
1219
|
+
minExplorationRate: 0.01,
|
|
1220
|
+
targetImprovement: 0.20, // 20% improvement goal
|
|
1221
|
+
maxMemorySize: 100 * 1024 * 1024, // 100MB
|
|
1222
|
+
batchSize: 32,
|
|
1223
|
+
updateFrequency: 10,
|
|
1224
|
+
replayBufferSize: 10000
|
|
1225
|
+
};
|
|
1226
|
+
// Store learning configuration
|
|
1227
|
+
await fs.writeJson('.agentic-qe/config/learning.json', learningConfig, { spaces: 2 });
|
|
1228
|
+
// Create learning database directory
|
|
1229
|
+
await fs.ensureDir('.agentic-qe/data/learning');
|
|
1230
|
+
// Create learning state placeholder
|
|
1231
|
+
const learningState = {
|
|
1232
|
+
initialized: true,
|
|
1233
|
+
version: '1.1.0',
|
|
1234
|
+
createdAt: new Date().toISOString(),
|
|
1235
|
+
agents: {} // Will be populated as agents learn
|
|
1236
|
+
};
|
|
1237
|
+
await fs.writeJson('.agentic-qe/data/learning/state.json', learningState, { spaces: 2 });
|
|
1238
|
+
console.log(chalk_1.default.green(' ✓ Learning system initialized'));
|
|
1239
|
+
console.log(chalk_1.default.gray(` • Q-learning algorithm (lr=${learningConfig.learningRate}, γ=${learningConfig.discountFactor})`));
|
|
1240
|
+
console.log(chalk_1.default.gray(` • Experience replay buffer: ${learningConfig.replayBufferSize} experiences`));
|
|
1241
|
+
console.log(chalk_1.default.gray(` • Target improvement: ${learningConfig.targetImprovement * 100}%`));
|
|
1242
|
+
}
|
|
1243
|
+
/**
|
|
1244
|
+
* Get inline Pattern Bank schema (fallback if schema file not found)
|
|
1245
|
+
*/
|
|
1246
|
+
static getPatternBankSchema() {
|
|
1247
|
+
return `
|
|
1248
|
+
-- Enable WAL mode for better concurrent access
|
|
1249
|
+
PRAGMA journal_mode = WAL;
|
|
1250
|
+
PRAGMA synchronous = NORMAL;
|
|
1251
|
+
|
|
1252
|
+
-- Core Pattern Storage
|
|
1253
|
+
CREATE TABLE IF NOT EXISTS test_patterns (
|
|
1254
|
+
id TEXT PRIMARY KEY NOT NULL,
|
|
1255
|
+
pattern_type TEXT NOT NULL,
|
|
1256
|
+
framework TEXT NOT NULL,
|
|
1257
|
+
language TEXT NOT NULL DEFAULT 'typescript',
|
|
1258
|
+
code_signature_hash TEXT NOT NULL,
|
|
1259
|
+
code_signature JSON NOT NULL,
|
|
1260
|
+
test_template JSON NOT NULL,
|
|
1261
|
+
metadata JSON NOT NULL,
|
|
1262
|
+
version TEXT NOT NULL DEFAULT '1.0.0',
|
|
1263
|
+
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
1264
|
+
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
1265
|
+
CHECK(pattern_type IN ('edge-case', 'integration', 'boundary', 'error-handling', 'unit', 'e2e', 'performance', 'security')),
|
|
1266
|
+
CHECK(framework IN ('jest', 'mocha', 'cypress', 'vitest', 'playwright', 'ava', 'jasmine')),
|
|
1267
|
+
CHECK(json_valid(code_signature)),
|
|
1268
|
+
CHECK(json_valid(test_template)),
|
|
1269
|
+
CHECK(json_valid(metadata))
|
|
1270
|
+
);
|
|
1271
|
+
|
|
1272
|
+
CREATE INDEX IF NOT EXISTS idx_patterns_framework_type ON test_patterns(framework, pattern_type);
|
|
1273
|
+
CREATE INDEX IF NOT EXISTS idx_patterns_signature_hash ON test_patterns(code_signature_hash);
|
|
1274
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_patterns_dedup ON test_patterns(code_signature_hash, framework);
|
|
1275
|
+
|
|
1276
|
+
-- Pattern Usage Tracking
|
|
1277
|
+
CREATE TABLE IF NOT EXISTS pattern_usage (
|
|
1278
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
1279
|
+
pattern_id TEXT NOT NULL,
|
|
1280
|
+
project_id TEXT NOT NULL,
|
|
1281
|
+
usage_count INTEGER NOT NULL DEFAULT 0,
|
|
1282
|
+
success_count INTEGER NOT NULL DEFAULT 0,
|
|
1283
|
+
failure_count INTEGER NOT NULL DEFAULT 0,
|
|
1284
|
+
avg_execution_time REAL NOT NULL DEFAULT 0.0,
|
|
1285
|
+
avg_coverage_gain REAL NOT NULL DEFAULT 0.0,
|
|
1286
|
+
flaky_count INTEGER NOT NULL DEFAULT 0,
|
|
1287
|
+
quality_score REAL NOT NULL DEFAULT 0.0,
|
|
1288
|
+
first_used TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
1289
|
+
last_used TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
1290
|
+
FOREIGN KEY (pattern_id) REFERENCES test_patterns(id) ON DELETE CASCADE,
|
|
1291
|
+
UNIQUE(pattern_id, project_id)
|
|
1292
|
+
);
|
|
1293
|
+
|
|
1294
|
+
CREATE INDEX IF NOT EXISTS idx_usage_pattern ON pattern_usage(pattern_id);
|
|
1295
|
+
CREATE INDEX IF NOT EXISTS idx_usage_quality ON pattern_usage(quality_score DESC);
|
|
1296
|
+
|
|
1297
|
+
-- Cross-Project Pattern Sharing
|
|
1298
|
+
CREATE TABLE IF NOT EXISTS cross_project_mappings (
|
|
1299
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
1300
|
+
pattern_id TEXT NOT NULL,
|
|
1301
|
+
source_framework TEXT NOT NULL,
|
|
1302
|
+
target_framework TEXT NOT NULL,
|
|
1303
|
+
transformation_rules JSON NOT NULL,
|
|
1304
|
+
compatibility_score REAL NOT NULL DEFAULT 1.0,
|
|
1305
|
+
project_count INTEGER NOT NULL DEFAULT 0,
|
|
1306
|
+
success_rate REAL NOT NULL DEFAULT 0.0,
|
|
1307
|
+
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
1308
|
+
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
1309
|
+
FOREIGN KEY (pattern_id) REFERENCES test_patterns(id) ON DELETE CASCADE,
|
|
1310
|
+
UNIQUE(pattern_id, source_framework, target_framework),
|
|
1311
|
+
CHECK(json_valid(transformation_rules))
|
|
1312
|
+
);
|
|
1313
|
+
|
|
1314
|
+
-- Pattern Similarity Index
|
|
1315
|
+
CREATE TABLE IF NOT EXISTS pattern_similarity_index (
|
|
1316
|
+
pattern_a TEXT NOT NULL,
|
|
1317
|
+
pattern_b TEXT NOT NULL,
|
|
1318
|
+
similarity_score REAL NOT NULL,
|
|
1319
|
+
structure_similarity REAL NOT NULL,
|
|
1320
|
+
identifier_similarity REAL NOT NULL,
|
|
1321
|
+
metadata_similarity REAL NOT NULL,
|
|
1322
|
+
algorithm TEXT NOT NULL DEFAULT 'hybrid-tfidf',
|
|
1323
|
+
last_computed TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
1324
|
+
PRIMARY KEY (pattern_a, pattern_b),
|
|
1325
|
+
FOREIGN KEY (pattern_a) REFERENCES test_patterns(id) ON DELETE CASCADE,
|
|
1326
|
+
FOREIGN KEY (pattern_b) REFERENCES test_patterns(id) ON DELETE CASCADE
|
|
1327
|
+
);
|
|
1328
|
+
|
|
1329
|
+
CREATE INDEX IF NOT EXISTS idx_similarity_score ON pattern_similarity_index(similarity_score DESC);
|
|
1330
|
+
|
|
1331
|
+
-- Full-Text Search
|
|
1332
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS pattern_fts USING fts5(
|
|
1333
|
+
pattern_id UNINDEXED,
|
|
1334
|
+
pattern_name,
|
|
1335
|
+
description,
|
|
1336
|
+
tags,
|
|
1337
|
+
framework,
|
|
1338
|
+
pattern_type,
|
|
1339
|
+
content='',
|
|
1340
|
+
tokenize='porter ascii'
|
|
1341
|
+
);
|
|
1342
|
+
|
|
1343
|
+
-- Schema Version
|
|
1344
|
+
CREATE TABLE IF NOT EXISTS schema_version (
|
|
1345
|
+
version TEXT PRIMARY KEY,
|
|
1346
|
+
applied_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
1347
|
+
description TEXT
|
|
1348
|
+
);
|
|
1349
|
+
|
|
1350
|
+
INSERT OR IGNORE INTO schema_version (version, description)
|
|
1351
|
+
VALUES ('1.1.0', 'Initial QE ReasoningBank schema');
|
|
1352
|
+
`;
|
|
1353
|
+
}
|
|
1354
|
+
/**
|
|
1355
|
+
* Initialize Phase 2 Improvement Loop
|
|
1356
|
+
*/
|
|
1357
|
+
static async initializeImprovementLoop(config) {
|
|
1358
|
+
const improvementConfig = {
|
|
1359
|
+
enabled: true,
|
|
1360
|
+
intervalMs: 3600000, // 1 hour
|
|
1361
|
+
autoApply: false, // Requires user approval
|
|
1362
|
+
enableABTesting: true,
|
|
1363
|
+
strategies: {
|
|
1364
|
+
parallelExecution: { enabled: true, weight: 0.8 },
|
|
1365
|
+
adaptiveRetry: { enabled: true, maxRetries: 3 },
|
|
1366
|
+
resourceOptimization: { enabled: true, adaptive: true }
|
|
1367
|
+
},
|
|
1368
|
+
thresholds: {
|
|
1369
|
+
minImprovement: 0.05, // 5% minimum improvement to apply
|
|
1370
|
+
maxFailureRate: 0.1, // 10% max failure rate
|
|
1371
|
+
minConfidence: 0.8 // 80% confidence required
|
|
1372
|
+
},
|
|
1373
|
+
abTesting: {
|
|
1374
|
+
sampleSize: 100,
|
|
1375
|
+
significanceLevel: 0.05,
|
|
1376
|
+
minSampleDuration: 3600000 // 1 hour
|
|
1377
|
+
}
|
|
1378
|
+
};
|
|
1379
|
+
// Store improvement configuration
|
|
1380
|
+
await fs.writeJson('.agentic-qe/config/improvement.json', improvementConfig, { spaces: 2 });
|
|
1381
|
+
// Create improvement state
|
|
1382
|
+
const improvementState = {
|
|
1383
|
+
version: '1.1.0',
|
|
1384
|
+
lastCycle: null,
|
|
1385
|
+
activeCycles: 0,
|
|
1386
|
+
totalImprovement: 0,
|
|
1387
|
+
strategies: {}
|
|
1388
|
+
};
|
|
1389
|
+
await fs.writeJson('.agentic-qe/data/improvement/state.json', improvementState, { spaces: 2 });
|
|
1390
|
+
console.log(chalk_1.default.green(' ✓ Improvement loop initialized'));
|
|
1391
|
+
console.log(chalk_1.default.gray(` • Cycle interval: ${improvementConfig.intervalMs / 3600000} hour(s)`));
|
|
1392
|
+
console.log(chalk_1.default.gray(` • A/B testing: enabled (sample size: ${improvementConfig.abTesting.sampleSize})`));
|
|
1393
|
+
console.log(chalk_1.default.gray(` • Auto-apply: ${improvementConfig.autoApply ? 'enabled' : 'disabled (requires approval)'}`));
|
|
1394
|
+
}
|
|
1395
|
+
/**
|
|
1396
|
+
* Create comprehensive config.json with all Phase 1 and Phase 2 settings
|
|
1397
|
+
*/
|
|
1398
|
+
static async createComprehensiveConfig(fleetConfig, options) {
|
|
1399
|
+
const comprehensiveConfig = {
|
|
1400
|
+
version: '1.1.0',
|
|
1401
|
+
initialized: new Date().toISOString(),
|
|
1402
|
+
// Phase 1: Multi-Model Router
|
|
1403
|
+
phase1: {
|
|
1404
|
+
routing: {
|
|
1405
|
+
enabled: fleetConfig.routing?.enabled || false,
|
|
1406
|
+
defaultModel: fleetConfig.routing?.defaultModel || 'claude-sonnet-4.5',
|
|
1407
|
+
costTracking: fleetConfig.routing?.enableCostTracking !== false,
|
|
1408
|
+
fallback: fleetConfig.routing?.enableFallback !== false,
|
|
1409
|
+
maxRetries: fleetConfig.routing?.maxRetries || 3,
|
|
1410
|
+
modelPreferences: {
|
|
1411
|
+
simple: 'gpt-3.5-turbo',
|
|
1412
|
+
medium: 'claude-haiku',
|
|
1413
|
+
complex: 'claude-sonnet-4.5',
|
|
1414
|
+
critical: 'gpt-4'
|
|
1415
|
+
},
|
|
1416
|
+
budgets: {
|
|
1417
|
+
daily: 50,
|
|
1418
|
+
monthly: 1000
|
|
1419
|
+
}
|
|
1420
|
+
},
|
|
1421
|
+
streaming: {
|
|
1422
|
+
enabled: fleetConfig.streaming?.enabled !== false,
|
|
1423
|
+
progressInterval: fleetConfig.streaming?.progressInterval || 2000,
|
|
1424
|
+
bufferEvents: fleetConfig.streaming?.bufferEvents || false,
|
|
1425
|
+
timeout: fleetConfig.streaming?.timeout || 1800000
|
|
1426
|
+
}
|
|
1427
|
+
},
|
|
1428
|
+
// Phase 2: Learning, Patterns, and Improvement
|
|
1429
|
+
phase2: {
|
|
1430
|
+
learning: {
|
|
1431
|
+
enabled: options.enableLearning,
|
|
1432
|
+
learningRate: 0.1,
|
|
1433
|
+
discountFactor: 0.95,
|
|
1434
|
+
explorationRate: 0.2,
|
|
1435
|
+
targetImprovement: 0.20
|
|
1436
|
+
},
|
|
1437
|
+
patterns: {
|
|
1438
|
+
enabled: options.enablePatterns,
|
|
1439
|
+
dbPath: '.agentic-qe/data/patterns.db',
|
|
1440
|
+
minConfidence: 0.85,
|
|
1441
|
+
enableExtraction: true
|
|
1442
|
+
},
|
|
1443
|
+
improvement: {
|
|
1444
|
+
enabled: options.enableImprovement,
|
|
1445
|
+
intervalMs: 3600000,
|
|
1446
|
+
autoApply: false,
|
|
1447
|
+
enableABTesting: true
|
|
1448
|
+
}
|
|
1449
|
+
},
|
|
1450
|
+
// Agent configurations
|
|
1451
|
+
agents: {
|
|
1452
|
+
testGenerator: {
|
|
1453
|
+
enablePatterns: options.enablePatterns,
|
|
1454
|
+
enableLearning: options.enableLearning
|
|
1455
|
+
},
|
|
1456
|
+
coverageAnalyzer: {
|
|
1457
|
+
enableLearning: options.enableLearning,
|
|
1458
|
+
targetImprovement: 0.20
|
|
1459
|
+
},
|
|
1460
|
+
flakyTestHunter: {
|
|
1461
|
+
enableML: true,
|
|
1462
|
+
enableLearning: options.enableLearning
|
|
1463
|
+
},
|
|
1464
|
+
defaultAgents: {
|
|
1465
|
+
enableLearning: options.enableLearning
|
|
1466
|
+
}
|
|
1467
|
+
},
|
|
1468
|
+
// Fleet configuration
|
|
1469
|
+
fleet: {
|
|
1470
|
+
topology: fleetConfig.topology || 'hierarchical',
|
|
1471
|
+
maxAgents: fleetConfig.maxAgents || 10,
|
|
1472
|
+
testingFocus: fleetConfig.testingFocus || [],
|
|
1473
|
+
environments: fleetConfig.environments || [],
|
|
1474
|
+
frameworks: fleetConfig.frameworks || ['jest']
|
|
1475
|
+
}
|
|
1476
|
+
};
|
|
1477
|
+
await fs.writeJson('.agentic-qe/config.json', comprehensiveConfig, { spaces: 2 });
|
|
1478
|
+
console.log(chalk_1.default.green(' ✓ Comprehensive configuration created'));
|
|
1479
|
+
console.log(chalk_1.default.gray(` • Config file: .agentic-qe/config.json`));
|
|
1480
|
+
}
|
|
1481
|
+
/**
|
|
1482
|
+
* Display comprehensive initialization summary
|
|
1483
|
+
*/
|
|
1484
|
+
static async displayComprehensiveSummary(fleetConfig, options) {
|
|
1485
|
+
console.log(chalk_1.default.yellow('\n📊 Initialization Summary:\n'));
|
|
1486
|
+
// Multi-Model Router Summary
|
|
1487
|
+
console.log(chalk_1.default.cyan('Multi-Model Router'));
|
|
1488
|
+
console.log(chalk_1.default.gray(` Status: ${fleetConfig.routing?.enabled ? '✅ Enabled' : '⚠️ Disabled (opt-in)'}`));
|
|
1489
|
+
if (fleetConfig.routing?.enabled) {
|
|
1490
|
+
console.log(chalk_1.default.gray(' • Cost optimization: 70-81% savings'));
|
|
1491
|
+
console.log(chalk_1.default.gray(' • Fallback chains: enabled'));
|
|
1492
|
+
console.log(chalk_1.default.gray(' • Budget tracking: daily $50, monthly $1000'));
|
|
1493
|
+
}
|
|
1494
|
+
console.log(chalk_1.default.cyan('\nStreaming'));
|
|
1495
|
+
console.log(chalk_1.default.gray(` Status: ${fleetConfig.streaming?.enabled !== false ? '✅ Enabled' : '⚠️ Disabled'}`));
|
|
1496
|
+
console.log(chalk_1.default.gray(' • Real-time progress updates'));
|
|
1497
|
+
console.log(chalk_1.default.gray(' • for-await-of compatible'));
|
|
1498
|
+
// Learning System Summary
|
|
1499
|
+
console.log(chalk_1.default.cyan('\nLearning System'));
|
|
1500
|
+
console.log(chalk_1.default.gray(` Status: ${options.enableLearning ? '✅ Enabled' : '⚠️ Disabled'}`));
|
|
1501
|
+
if (options.enableLearning) {
|
|
1502
|
+
console.log(chalk_1.default.gray(' • Q-learning (lr=0.1, γ=0.95)'));
|
|
1503
|
+
console.log(chalk_1.default.gray(' • Experience replay (10,000 buffer)'));
|
|
1504
|
+
console.log(chalk_1.default.gray(' • Target: 20% improvement'));
|
|
1505
|
+
}
|
|
1506
|
+
console.log(chalk_1.default.cyan('\nPattern Bank'));
|
|
1507
|
+
console.log(chalk_1.default.gray(` Status: ${options.enablePatterns ? '✅ Enabled' : '⚠️ Disabled'}`));
|
|
1508
|
+
if (options.enablePatterns) {
|
|
1509
|
+
console.log(chalk_1.default.gray(' • Pattern extraction: enabled'));
|
|
1510
|
+
console.log(chalk_1.default.gray(' • Confidence threshold: 85%'));
|
|
1511
|
+
console.log(chalk_1.default.gray(' • Template generation: enabled'));
|
|
1512
|
+
}
|
|
1513
|
+
console.log(chalk_1.default.cyan('\nImprovement Loop'));
|
|
1514
|
+
console.log(chalk_1.default.gray(` Status: ${options.enableImprovement ? '✅ Enabled' : '⚠️ Disabled'}`));
|
|
1515
|
+
if (options.enableImprovement) {
|
|
1516
|
+
console.log(chalk_1.default.gray(' • Cycle: 1 hour intervals'));
|
|
1517
|
+
console.log(chalk_1.default.gray(' • A/B testing: enabled'));
|
|
1518
|
+
console.log(chalk_1.default.gray(' • Auto-apply: OFF (requires approval)'));
|
|
1519
|
+
}
|
|
1520
|
+
// Agent Configuration
|
|
1521
|
+
console.log(chalk_1.default.cyan('\nAgent Configuration:'));
|
|
1522
|
+
console.log(chalk_1.default.gray(' • TestGeneratorAgent: Patterns + Learning'));
|
|
1523
|
+
console.log(chalk_1.default.gray(' • CoverageAnalyzerAgent: Learning + 20% target'));
|
|
1524
|
+
console.log(chalk_1.default.gray(' • FlakyTestHunterAgent: ML + Learning'));
|
|
1525
|
+
console.log(chalk_1.default.gray(' • All agents: Learning enabled (opt-in)'));
|
|
1526
|
+
// Fleet Configuration
|
|
1527
|
+
console.log(chalk_1.default.cyan('\nFleet Configuration:'));
|
|
1528
|
+
console.log(chalk_1.default.gray(` Topology: ${fleetConfig.topology}`));
|
|
1529
|
+
console.log(chalk_1.default.gray(` Max Agents: ${fleetConfig.maxAgents}`));
|
|
1530
|
+
console.log(chalk_1.default.gray(` Frameworks: ${(fleetConfig.frameworks || ['jest']).join(', ')}`));
|
|
1531
|
+
// Next Steps
|
|
1532
|
+
console.log(chalk_1.default.yellow('\n💡 Next Steps:\n'));
|
|
1533
|
+
console.log(chalk_1.default.gray(' 1. Review configuration: .agentic-qe/config.json'));
|
|
1534
|
+
console.log(chalk_1.default.gray(' 2. Generate tests: aqe test generate src/'));
|
|
1535
|
+
if (options.enableLearning) {
|
|
1536
|
+
console.log(chalk_1.default.gray(' 3. Check learning status: aqe learn status'));
|
|
1537
|
+
}
|
|
1538
|
+
if (fleetConfig.routing?.enabled) {
|
|
1539
|
+
console.log(chalk_1.default.gray(' 4. View routing dashboard: aqe routing dashboard'));
|
|
1540
|
+
}
|
|
1541
|
+
if (options.enablePatterns) {
|
|
1542
|
+
console.log(chalk_1.default.gray(' 5. List patterns: aqe patterns list'));
|
|
1543
|
+
}
|
|
1544
|
+
if (options.enableImprovement) {
|
|
1545
|
+
console.log(chalk_1.default.gray(' 6. Start improvement loop: aqe improve start'));
|
|
1546
|
+
}
|
|
1547
|
+
// Documentation
|
|
1548
|
+
console.log(chalk_1.default.yellow('\n📚 Documentation:\n'));
|
|
1549
|
+
console.log(chalk_1.default.gray(' • Getting Started: docs/GETTING-STARTED.md'));
|
|
1550
|
+
if (options.enableLearning) {
|
|
1551
|
+
console.log(chalk_1.default.gray(' • Learning System: docs/guides/LEARNING-SYSTEM-USER-GUIDE.md'));
|
|
1552
|
+
}
|
|
1553
|
+
if (options.enablePatterns) {
|
|
1554
|
+
console.log(chalk_1.default.gray(' • Pattern Management: docs/guides/PATTERN-MANAGEMENT-USER-GUIDE.md'));
|
|
1555
|
+
}
|
|
1556
|
+
if (fleetConfig.routing?.enabled) {
|
|
1557
|
+
console.log(chalk_1.default.gray(' • Cost Optimization: docs/guides/COST-OPTIMIZATION-GUIDE.md'));
|
|
1558
|
+
}
|
|
1559
|
+
// Performance Tips
|
|
1560
|
+
console.log(chalk_1.default.yellow('\n⚡ Performance Tips:\n'));
|
|
1561
|
+
console.log(chalk_1.default.gray(' • Learning improves over time (20% target in 100 tasks)'));
|
|
1562
|
+
console.log(chalk_1.default.gray(' • Patterns increase test quality (85% confidence threshold)'));
|
|
1563
|
+
if (fleetConfig.routing?.enabled) {
|
|
1564
|
+
console.log(chalk_1.default.gray(' • Routing saves 70-81% on AI costs'));
|
|
1565
|
+
}
|
|
1566
|
+
console.log(chalk_1.default.gray(' • Improvement loop optimizes continuously (1 hour cycles)'));
|
|
1567
|
+
console.log('');
|
|
1568
|
+
}
|
|
952
1569
|
}
|
|
953
1570
|
exports.InitCommand = InitCommand;
|
|
954
1571
|
//# sourceMappingURL=init.js.map
|