UNPKG

cortexweaver

Version:

CortexWeaver is a command-line interface (CLI) tool that orchestrates a swarm of specialized AI agents, powered by Claude Code and Gemini CLI, to assist in software development. It transforms a high-level project plan (plan.md) into a series of coordinate

88 lines 3.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.QualityAnalyzer = void 0; /** * QualityAnalyzer handles test results and quality analysis for the Governor agent */ class QualityAnalyzer { constructor(cognitiveCanvas, currentTask) { this.cognitiveCanvas = cognitiveCanvas; this.currentTask = currentTask; } /** * Analyze test results and quality reports */ async analyzeTestResults() { if (!this.cognitiveCanvas || !this.currentTask) { return { totalTests: 0, passRate: 0, qualityScore: 0, issues: [], recommendations: [] }; } try { const tasks = await this.cognitiveCanvas.getTasksByProject(this.currentTask.projectId); let totalTests = 0; let passedTests = 0; const issues = []; const recommendations = []; for (const task of tasks) { const testResults = task.metadata?.testResults; if (testResults) { const passed = testResults.passed || 0; const failed = testResults.failed || 0; totalTests += passed + failed; passedTests += passed; // Identify quality issues const taskPassRate = (passed + failed) > 0 ? passed / (passed + failed) : 0; if (taskPassRate < 0.7) { issues.push(`low test pass rate in ${task.title}`); } } } const passRate = totalTests > 0 ? passedTests / totalTests : 0; const qualityScore = this.calculateQualityScore(passRate, totalTests, issues.length); // Generate recommendations if (passRate < 0.7) { issues.push('low test pass rate'); recommendations.push('improve test coverage'); recommendations.push('fix failing tests'); } if (totalTests === 0) { issues.push('no test data available'); recommendations.push('implement testing framework'); } return { totalTests, passRate, qualityScore, issues, recommendations }; } catch (error) { // Re-throw error to be caught by executeTask throw new Error(`Quality analysis failed: ${error.message}`); } } /** * Calculate quality score based on test results */ calculateQualityScore(passRate, totalTests, issueCount) { if (totalTests === 0) return 0; let score = passRate + (totalTests > 0 ? 0.1 : 0) - (issueCount * 0.1); return Math.max(0, Math.min(1, score)); } /** * Update cognitive canvas and current task references */ updateReferences(cognitiveCanvas, currentTask) { this.cognitiveCanvas = cognitiveCanvas; this.currentTask = currentTask; } } exports.QualityAnalyzer = QualityAnalyzer; //# sourceMappingURL=quality-analyzer.js.map