mirror of
https://github.com/proffesor-for-testing/agentic-qe.git
synced 2026-09-19 08:45:47 +08:00
b3d2018ee2
Critical bug fixes and code quality improvements from brutal-honest-review. ## Critical Fixes (9/10 completed, 1 deferred) 1. Fixed Agent Pattern Isolation (CRITICAL) - Added SwarmMemoryManager.queryPatternsByAgent() - SQL filtering by agent_id in metadata - Each agent now isolated 2. Fixed Async Method Cascade - Changed getPatterns() to async - Fixed 10 callers across 6 files - Build passes 3. Fixed Misleading Logging - Added isRealAgentDB() detection - Honest mock vs real reporting 4. Consolidated Embedding Generation - Created EmbeddingGenerator utility - Removed 50+ duplicate lines 5. Added AgentDB Initialization Checks - Empty DB detection - HNSW index verification 6. Integration Test Suite - 26 new test cases - Error path coverage 7. Repository Cleanup - Removed 19 temp test files 8. New QE Skill: sherlock-review - Evidence-based investigative review - 38 QE skills total 9. Deferred: Wire Up Real Test Execution - Deferred to v1.9.0 (documented) ## Statistics - Fixes: 9/10 (90%, 1 deferred) - Files Modified: 16 - Files Created: 3 - Files Deleted: 19 - Integration Tests: 26 - Build: PASSING ## Breaking Changes - getPatterns() now async - add await 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
81 lines
2.5 KiB
TypeScript
81 lines
2.5 KiB
TypeScript
#!/usr/bin/env tsx
|
|
/**
|
|
* Demo: Learning Metrics CLI
|
|
* Populates AgentDB with sample patterns and demonstrates metrics command
|
|
*/
|
|
|
|
import { createAgentDBManager } from '../src/core/memory/AgentDBManager';
|
|
import chalk from 'chalk';
|
|
|
|
async function main() {
|
|
console.log(chalk.blue('🧪 Demo: Learning Metrics CLI\n'));
|
|
|
|
// Create AgentDB manager
|
|
const agentDB = createAgentDBManager({
|
|
dbPath: '.agentic-qe/agentdb.db'
|
|
});
|
|
|
|
await agentDB.initialize();
|
|
console.log(chalk.green('✅ AgentDB initialized\n'));
|
|
|
|
// Populate with sample patterns (simulating agent learning)
|
|
console.log(chalk.blue('📝 Inserting sample learning patterns...\n'));
|
|
|
|
const agentTypes = [
|
|
'qe-test-generator',
|
|
'qe-coverage-analyzer',
|
|
'qe-performance-tester',
|
|
'qe-security-scanner'
|
|
];
|
|
|
|
let totalInserted = 0;
|
|
|
|
for (const agentType of agentTypes) {
|
|
// Insert 5-15 patterns per agent with varying confidence
|
|
const count = Math.floor(Math.random() * 10) + 5;
|
|
|
|
for (let i = 0; i < count; i++) {
|
|
const confidence = 0.5 + (Math.random() * 0.5); // 0.5-1.0
|
|
|
|
await agentDB.store({
|
|
id: `${agentType}_pattern_${i}`,
|
|
type: agentType,
|
|
domain: 'test-generation',
|
|
pattern_data: JSON.stringify({
|
|
pattern: `Sample pattern ${i} for ${agentType}`,
|
|
strategy: ['coverage-first', 'risk-based', 'mutation'][i % 3]
|
|
}),
|
|
confidence,
|
|
usage_count: Math.floor(Math.random() * 50),
|
|
success_count: Math.floor(Math.random() * 40),
|
|
created_at: Date.now() / 1000,
|
|
last_used: Date.now() / 1000
|
|
});
|
|
|
|
totalInserted++;
|
|
}
|
|
|
|
console.log(` ✓ ${agentType}: ${count} patterns (confidence: ${chalk.cyan('50-100%')})`);
|
|
}
|
|
|
|
console.log(chalk.green(`\n✅ Inserted ${totalInserted} patterns total\n`));
|
|
|
|
// Get stats
|
|
const stats = await agentDB.getStats();
|
|
console.log(chalk.blue('📊 Database Stats:\n'));
|
|
console.log(` Total Vectors: ${chalk.cyan(stats.totalVectors)}`);
|
|
console.log(` Dimension: ${chalk.cyan(stats.dimension)}`);
|
|
console.log(` Mode: ${chalk.cyan(stats.mode)}\n`);
|
|
|
|
await agentDB.close();
|
|
|
|
console.log(chalk.green('✅ Demo complete!\n'));
|
|
console.log(chalk.yellow('💡 Now run:'));
|
|
console.log(chalk.gray(' npx tsx src/cli/index.ts learn metrics'));
|
|
console.log(chalk.gray(' npx tsx src/cli/index.ts learn metrics --days 30'));
|
|
console.log(chalk.gray(' npx tsx src/cli/index.ts learn metrics --agent test-generator'));
|
|
console.log();
|
|
}
|
|
|
|
main().catch(console.error);
|