vibecodingmachine-core 2026.2.26-1739 → 2026.3.9-850
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/package.json +1 -1
- package/src/agents/AgentCheckDiscoveryService.js +180 -0
- package/src/agents/AgentCheckService.js +18 -261
- package/src/agents/AgentCheckStatisticsService.js +195 -0
- package/src/agents/EnvironmentConfigurationManager.js +31 -380
- package/src/agents/InstallationType.js +19 -6
- package/src/agents/SimpleAgentCheckService.js +472 -0
- package/src/agents/config-managers/ConfigUtils.js +72 -0
- package/src/agents/config-managers/DefaultConfig.js +58 -0
- package/src/agents/config-managers/EnvVarLoader.js +66 -0
- package/src/agents/config-managers/FileConfigLoader.js +124 -0
- package/src/agents/config-managers/TypeConverters.js +61 -0
- package/src/agents/config-managers/VariableMappings.js +92 -0
- package/src/agents/discovery/AgentDiscoveryService-refactored.js +272 -0
- package/src/agents/discovery/AgentDiscoveryService.js +29 -403
- package/src/agents/discovery/agent-validator.js +262 -0
- package/src/agents/discovery/discovery-results.js +176 -0
- package/src/agents/discovery/discovery-scanner.js +268 -0
- package/src/agents/discovery/discovery-utils.js +161 -0
- package/src/agents/discovery/executable-analyzer.js +290 -0
- package/src/agents/discovery/history-manager.js +310 -0
- package/src/agents/verification/ResultAnalyzer-refactored.js +341 -0
- package/src/agents/verification/ResultAnalyzer.js +30 -431
- package/src/agents/verification/analysis-utils.js +310 -0
- package/src/agents/verification/batch-analyzer.js +440 -0
- package/src/agents/verification/pattern-recognizer.js +369 -0
- package/src/agents/verification/report-generator.js +320 -0
- package/src/agents/verification/test-analyzer.js +290 -0
- package/src/agents/windows/InstallerFactory.js +4 -0
- package/src/agents/windows/VSCodeExtensionInstaller.js +404 -0
- package/src/analysis/analysis-engine.js +314 -0
- package/src/analysis/ast-analyzer.js +342 -0
- package/src/analysis/boundary-detector-refactored.js +378 -0
- package/src/analysis/boundary-detector.js +200 -603
- package/src/analysis/boundary-scanner.js +609 -0
- package/src/analysis/boundary-types.js +118 -0
- package/src/analysis/boundary-utils.js +293 -0
- package/src/analysis/deadline-priority-calculator.js +18 -0
- package/src/analysis/detection-methods.js +347 -0
- package/src/analysis/importance-priority-calculator.js +18 -0
- package/src/analysis/priority/factor-calculators.js +204 -0
- package/src/analysis/priority/factor-helpers.js +71 -0
- package/src/analysis/priority/priority-constants.js +73 -0
- package/src/analysis/priority/priority-factor-calculators.js +301 -0
- package/src/analysis/priority/reasons-generator.js +44 -0
- package/src/analysis/priority-calculator.js +15 -580
- package/src/analysis/strategy-generator.js +16 -66
- package/src/analysis/type-priority-calculator.js +18 -0
- package/src/analysis/urgency-priority-calculator.js +18 -0
- package/src/auto-mode/AutoModeBusinessLogic.js +2 -40
- package/src/commands/disable-requirement.js +60 -0
- package/src/commands/disable-spec.js +60 -0
- package/src/commands/enable-requirement.js +60 -0
- package/src/commands/enable-spec.js +60 -0
- package/src/commands/registry.js +1 -6
- package/src/commands/requirements.js +8 -2
- package/src/ide-integration/applescript-manager.cjs +9 -24
- package/src/ide-integration/cdp-handlers/chat-reader.js +44 -0
- package/src/ide-integration/cdp-handlers/connection-handler.js +88 -0
- package/src/ide-integration/cdp-handlers/continuation-handler.js +314 -0
- package/src/ide-integration/cdp-handlers/message-submitter.js +75 -0
- package/src/ide-integration/cdp-handlers/text-sender.js +138 -0
- package/src/ide-integration/cdp-manager.js +28 -573
- package/src/ide-integration/claude-code-cli-manager.cjs +48 -12
- package/src/ide-integration/ide-openers/claude-opener.js +171 -0
- package/src/ide-integration/ide-openers/cursor-opener.js +53 -0
- package/src/ide-integration/ide-openers/other-ides-opener.js +230 -0
- package/src/ide-integration/ide-openers/vscode-opener.js +147 -0
- package/src/ide-integration/macos-ide-manager.js +20 -582
- package/src/ide-integration/macos-quota-checker.js +164 -0
- package/src/ide-integration/macos-text-sender.js +19 -38
- package/src/ide-integration/provider-manager.cjs +52 -7
- package/src/index.cjs +6 -0
- package/src/index.js +10 -0
- package/src/llm/direct-llm-manager.cjs +501 -0
- package/src/localization/translations/en-part1.js +363 -0
- package/src/localization/translations/en-part2.js +320 -0
- package/src/localization/translations/en.js +4 -687
- package/src/localization/translations/es-part1.js +363 -0
- package/src/localization/translations/es-part2.js +320 -0
- package/src/localization/translations/es.js +4 -688
- package/src/models/file-analysis-collection.js +139 -0
- package/src/models/file-analysis-metrics.js +50 -0
- package/src/models/file-analysis.js +15 -262
- package/src/models/plan-manager.js +410 -0
- package/src/models/refactoring-models.js +380 -0
- package/src/models/refactoring-plan-refactored.js +81 -0
- package/src/models/refactoring-plan.js +2 -663
- package/src/monitoring/alert-system.js +4 -45
- package/src/monitoring/continuous-scan-notifications.js +37 -191
- package/src/monitoring/notification-handlers/base-handler.js +58 -0
- package/src/monitoring/notification-handlers/error-handler.js +36 -0
- package/src/monitoring/notification-handlers/index.js +21 -0
- package/src/monitoring/notification-handlers/new-violation-handler.js +91 -0
- package/src/monitoring/notification-handlers/progress-handler.js +48 -0
- package/src/monitoring/notification-handlers/resolved-violation-handler.js +54 -0
- package/src/monitoring/notification-handlers/threshold-handler.js +36 -0
- package/src/provider-registry.js +8 -0
- package/src/refactoring/boundary/boundary-detector-refactored.js +58 -0
- package/src/refactoring/boundary/boundary-detector.js +26 -596
- package/src/refactoring/boundary/detectors/boundary-analyzers.js +281 -0
- package/src/refactoring/boundary/detectors/boundary-core.js +167 -0
- package/src/refactoring/boundary/detectors/class-detector.js +247 -0
- package/src/refactoring/boundary/detectors/config-detector.js +270 -0
- package/src/refactoring/boundary/detectors/constant-detector.js +269 -0
- package/src/refactoring/boundary/detectors/function-detector.js +248 -0
- package/src/refactoring/boundary/detectors/module-detector.js +249 -0
- package/src/refactoring/boundary/detectors/object-detector.js +247 -0
- package/src/refactoring/boundary/detectors/type-detectors.js +338 -0
- package/src/refactoring/boundary/detectors/utility-detector.js +270 -0
- package/src/refactoring/circular-dependency-resolver-original.js +16 -76
- package/src/refactoring/code-mover-refactored.js +309 -0
- package/src/refactoring/code-mover.js +48 -355
- package/src/refactoring/execution-status.js +18 -0
- package/src/refactoring/execution-strategies.js +172 -0
- package/src/refactoring/file-splitter-core.js +568 -0
- package/src/refactoring/file-splitter-types.js +136 -0
- package/src/refactoring/file-splitter.js +2 -682
- package/src/refactoring/functionality-validator.js +11 -51
- package/src/refactoring/import-manager-refactored.js +385 -0
- package/src/refactoring/import-manager.js +112 -487
- package/src/refactoring/import-models.js +189 -0
- package/src/refactoring/import-parser.js +306 -0
- package/src/refactoring/move-executor.js +431 -0
- package/src/refactoring/move-utils.js +368 -0
- package/src/refactoring/operation-executor.js +76 -0
- package/src/refactoring/plan-creator.js +36 -0
- package/src/refactoring/plan-executor.js +143 -0
- package/src/refactoring/plan-validator.js +68 -0
- package/src/refactoring/refactoring-executor-result.js +70 -0
- package/src/refactoring/refactoring-executor.js +34 -569
- package/src/refactoring/refactoring-operation.js +94 -0
- package/src/refactoring/refactoring-plan.js +69 -0
- package/src/refactoring/refactoring-rollback.js +22 -527
- package/src/refactoring/rollback-handlers/RollbackExecutor.js +107 -0
- package/src/refactoring/rollback-handlers/RollbackManager.js +265 -0
- package/src/refactoring/rollback-handlers/RollbackOperation.js +105 -0
- package/src/refactoring/rollback-handlers/RollbackResult.js +109 -0
- package/src/refactoring/rollback-handlers/RollbackStatistics.js +77 -0
- package/src/refactoring/test-validator.js +32 -448
- package/src/refactoring/validation/baseline-runner.js +71 -0
- package/src/refactoring/validation/report-generator.js +136 -0
- package/src/refactoring/validation/result-comparator.js +92 -0
- package/src/refactoring/validation/test-suite.js +59 -0
- package/src/refactoring/validation/test-validation-result.js +83 -0
- package/src/refactoring/validation/validation-runner.js +95 -0
- package/src/refactoring/validation/validation-status.js +18 -0
- package/src/rui/commands/AgentCommandParser.js +60 -369
- package/src/rui/commands/AgentResponseFormatter.js +7 -47
- package/src/rui/commands/parsers/CommandMapper.js +148 -0
- package/src/rui/commands/parsers/CommandValidator.js +228 -0
- package/src/rui/commands/parsers/ComponentExtractor.js +100 -0
- package/src/rui/commands/parsers/TokenParser.js +69 -0
- package/src/rui/commands/parsers/tokenizer.js +153 -0
- package/src/utils/current-requirement-operations.js +50 -1
- package/src/utils/report-generator.js +18 -514
- package/src/utils/report-generators/analysis-generator.js +115 -0
- package/src/utils/report-generators/base-generator.js +141 -0
- package/src/utils/report-generators/compliance-generator.js +41 -0
- package/src/utils/report-generators/format-handlers.js +185 -0
- package/src/utils/report-generators/refactoring-generator.js +46 -0
- package/src/utils/report-generators/validation-generator.js +63 -0
- package/src/utils/requirement-enable-disable.js +265 -0
- package/src/utils/requirement-helpers/requirement-file-ops.js +69 -1
- package/src/utils/requirement-helpers/requirement-mover.js +88 -1
- package/src/utils/requirement-helpers.js +5 -2
- package/src/utils/smoke-test-cli.js +45 -8
- package/src/utils/specification-enable-disable.js +122 -0
- package/src/utils/specification-helpers.js +30 -4
- package/src/utils/specification-migration.js +5 -5
- package/src/utils/test-comparator.js +118 -0
- package/src/utils/test-config.js +54 -0
- package/src/utils/test-executor.js +133 -0
- package/src/utils/test-parser.js +215 -0
- package/src/utils/test-runner-baseline.js +63 -0
- package/src/utils/test-runner-core.js +98 -0
- package/src/utils/test-runner-report.js +39 -0
- package/src/utils/test-runner-validation.js +71 -0
- package/src/utils/test-runner.js +11 -535
- package/src/validation/comparison-analyzer.js +333 -0
- package/src/validation/compliance-reporter-new.js +282 -0
- package/src/validation/compliance-reporter-refactored.js +344 -0
- package/src/validation/compliance-reporter.js +278 -591
- package/src/validation/compliance-utils.js +278 -0
- package/src/validation/html-generator.js +446 -0
- package/src/validation/metrics/category-calculator.js +137 -0
- package/src/validation/metrics/metrics-helpers.js +155 -0
- package/src/validation/metrics/overview-calculator.js +85 -0
- package/src/validation/metrics/overview-metrics.js +41 -0
- package/src/validation/metrics/quality-calculator.js +166 -0
- package/src/validation/metrics/size-calculator.js +69 -0
- package/src/validation/metrics-calculator.js +27 -551
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verification Result - Pattern Recognizer
|
|
3
|
+
*
|
|
4
|
+
* Identifies patterns and risk factors in verification results.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Identify patterns in test result
|
|
9
|
+
* @param {Object} testResult - Test result
|
|
10
|
+
* @returns {Array} - Identified patterns
|
|
11
|
+
*/
|
|
12
|
+
function identifyPatterns(testResult) {
|
|
13
|
+
const patterns = [];
|
|
14
|
+
|
|
15
|
+
if (testResult.error) {
|
|
16
|
+
const error = testResult.error.toLowerCase();
|
|
17
|
+
|
|
18
|
+
if (error.includes('timeout')) {
|
|
19
|
+
patterns.push('timeout-pattern');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (error.includes('permission') || error.includes('access')) {
|
|
23
|
+
patterns.push('permission-pattern');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (error.includes('not found')) {
|
|
27
|
+
patterns.push('missing-dependency-pattern');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (error.includes('connection') || error.includes('network')) {
|
|
31
|
+
patterns.push('network-pattern');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (error.includes('syntax') || error.includes('parse')) {
|
|
35
|
+
patterns.push('syntax-pattern');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (error.includes('memory') || error.includes('heap')) {
|
|
39
|
+
patterns.push('memory-pattern');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (error.includes('disk') || error.includes('space')) {
|
|
43
|
+
patterns.push('disk-pattern');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (testResult.duration && testResult.duration > 30000) {
|
|
48
|
+
patterns.push('slow-performance-pattern');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (testResult.duration && testResult.duration < 100) {
|
|
52
|
+
patterns.push('fast-performance-pattern');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return patterns;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Identify risk factors
|
|
60
|
+
* @param {Object} testResult - Test result
|
|
61
|
+
* @returns {Array} - Risk factors
|
|
62
|
+
*/
|
|
63
|
+
function identifyRiskFactors(testResult) {
|
|
64
|
+
const riskFactors = [];
|
|
65
|
+
|
|
66
|
+
if (!testResult.success) {
|
|
67
|
+
// High risk factors
|
|
68
|
+
if (testResult.error) {
|
|
69
|
+
const error = testResult.error.toLowerCase();
|
|
70
|
+
|
|
71
|
+
if (error.includes('permission') || error.includes('access denied')) {
|
|
72
|
+
riskFactors.push({
|
|
73
|
+
type: 'security',
|
|
74
|
+
level: 'high',
|
|
75
|
+
description: 'Permission or access issues detected',
|
|
76
|
+
impact: 'May prevent agent from functioning properly'
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (error.includes('not found') || error.includes('missing')) {
|
|
81
|
+
riskFactors.push({
|
|
82
|
+
type: 'dependency',
|
|
83
|
+
level: 'high',
|
|
84
|
+
description: 'Missing dependencies or files',
|
|
85
|
+
impact: 'Agent may not have required components'
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (error.includes('corrupt') || error.includes('invalid')) {
|
|
90
|
+
riskFactors.push({
|
|
91
|
+
type: 'integrity',
|
|
92
|
+
level: 'high',
|
|
93
|
+
description: 'Data corruption or invalid configuration',
|
|
94
|
+
impact: 'Agent may behave unpredictably'
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Medium risk factors
|
|
100
|
+
if (testResult.duration && testResult.duration > 60000) {
|
|
101
|
+
riskFactors.push({
|
|
102
|
+
type: 'performance',
|
|
103
|
+
level: 'medium',
|
|
104
|
+
description: 'Extremely slow test execution',
|
|
105
|
+
impact: 'May indicate performance bottlenecks'
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (testResult.error && testResult.error.includes('timeout')) {
|
|
110
|
+
riskFactors.push({
|
|
111
|
+
type: 'reliability',
|
|
112
|
+
level: 'medium',
|
|
113
|
+
description: 'Test timeout occurred',
|
|
114
|
+
impact: 'May indicate timing or resource issues'
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
// Success but with potential risks
|
|
119
|
+
if (testResult.duration && testResult.duration > 20000) {
|
|
120
|
+
riskFactors.push({
|
|
121
|
+
type: 'performance',
|
|
122
|
+
level: 'low',
|
|
123
|
+
description: 'Slow but successful test execution',
|
|
124
|
+
impact: 'May affect user experience'
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return riskFactors;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Identify patterns in batch results
|
|
134
|
+
* @param {Object} batchResult - Batch verification result
|
|
135
|
+
* @returns {Array} - Batch patterns
|
|
136
|
+
*/
|
|
137
|
+
function identifyBatchPatterns(batchResult) {
|
|
138
|
+
const patterns = [];
|
|
139
|
+
|
|
140
|
+
if (!batchResult.results || batchResult.results.length === 0) {
|
|
141
|
+
return patterns;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const results = batchResult.results;
|
|
145
|
+
const failureRate = results.filter(r => !r.success).length / results.length;
|
|
146
|
+
|
|
147
|
+
// High failure rate pattern
|
|
148
|
+
if (failureRate > 0.5) {
|
|
149
|
+
patterns.push('high-failure-rate-pattern');
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (failureRate > 0.2) {
|
|
153
|
+
patterns.push('moderate-failure-rate-pattern');
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Error type patterns
|
|
157
|
+
const errorTypes = new Set();
|
|
158
|
+
results.forEach(result => {
|
|
159
|
+
if (result.error) {
|
|
160
|
+
errorTypes.add(result.error.split(':')[0]); // Get error type before details
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
if (errorTypes.size > 5) {
|
|
165
|
+
patterns.push('diverse-error-types-pattern');
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Performance patterns
|
|
169
|
+
const durations = results
|
|
170
|
+
.filter(r => r.duration)
|
|
171
|
+
.map(r => r.duration);
|
|
172
|
+
|
|
173
|
+
if (durations.length > 0) {
|
|
174
|
+
const avgDuration = durations.reduce((sum, d) => sum + d, 0) / durations.length;
|
|
175
|
+
const maxDuration = Math.max(...durations);
|
|
176
|
+
|
|
177
|
+
if (avgDuration > 30000) {
|
|
178
|
+
patterns.push('slow-average-performance-pattern');
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (maxDuration > avgDuration * 3) {
|
|
182
|
+
patterns.push('performance-variance-pattern');
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Agent-specific patterns
|
|
187
|
+
const agentIds = new Set(results.map(r => r.agentId).filter(Boolean));
|
|
188
|
+
if (agentIds.size > 0) {
|
|
189
|
+
const agentFailures = {};
|
|
190
|
+
|
|
191
|
+
results.forEach(result => {
|
|
192
|
+
if (result.agentId && !result.success) {
|
|
193
|
+
agentFailures[result.agentId] = (agentFailures[result.agentId] || 0) + 1;
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
// Check for consistently failing agents
|
|
198
|
+
Object.entries(agentFailures).forEach(([agentId, failureCount]) => {
|
|
199
|
+
const agentResults = results.filter(r => r.agentId === agentId);
|
|
200
|
+
const agentFailureRate = failureCount / agentResults.length;
|
|
201
|
+
|
|
202
|
+
if (agentFailureRate > 0.8) {
|
|
203
|
+
patterns.push(`agent-${agentId}-consistently-failing-pattern`);
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return patterns;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Calculate risk score
|
|
213
|
+
* @param {Array} riskFactors - Risk factors
|
|
214
|
+
* @returns {number} - Risk score (0-100)
|
|
215
|
+
*/
|
|
216
|
+
function calculateRiskScore(riskFactors) {
|
|
217
|
+
if (!riskFactors || riskFactors.length === 0) {
|
|
218
|
+
return 0;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
let totalScore = 0;
|
|
222
|
+
|
|
223
|
+
riskFactors.forEach(factor => {
|
|
224
|
+
let factorScore = 0;
|
|
225
|
+
|
|
226
|
+
switch (factor.level) {
|
|
227
|
+
case 'high':
|
|
228
|
+
factorScore = 30;
|
|
229
|
+
break;
|
|
230
|
+
case 'medium':
|
|
231
|
+
factorScore = 15;
|
|
232
|
+
break;
|
|
233
|
+
case 'low':
|
|
234
|
+
factorScore = 5;
|
|
235
|
+
break;
|
|
236
|
+
default:
|
|
237
|
+
factorScore = 10;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Apply type weighting
|
|
241
|
+
switch (factor.type) {
|
|
242
|
+
case 'security':
|
|
243
|
+
factorScore *= 1.5;
|
|
244
|
+
break;
|
|
245
|
+
case 'dependency':
|
|
246
|
+
factorScore *= 1.3;
|
|
247
|
+
break;
|
|
248
|
+
case 'integrity':
|
|
249
|
+
factorScore *= 1.4;
|
|
250
|
+
break;
|
|
251
|
+
case 'performance':
|
|
252
|
+
factorScore *= 1.1;
|
|
253
|
+
break;
|
|
254
|
+
case 'reliability':
|
|
255
|
+
factorScore *= 1.2;
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
totalScore += factorScore;
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
return Math.min(100, totalScore);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Get pattern severity
|
|
267
|
+
* @param {string} pattern - Pattern identifier
|
|
268
|
+
* @returns {string} - Severity level
|
|
269
|
+
*/
|
|
270
|
+
function getPatternSeverity(pattern) {
|
|
271
|
+
const severityMap = {
|
|
272
|
+
'timeout-pattern': 'medium',
|
|
273
|
+
'permission-pattern': 'high',
|
|
274
|
+
'missing-dependency-pattern': 'high',
|
|
275
|
+
'network-pattern': 'medium',
|
|
276
|
+
'syntax-pattern': 'high',
|
|
277
|
+
'memory-pattern': 'high',
|
|
278
|
+
'disk-pattern': 'medium',
|
|
279
|
+
'slow-performance-pattern': 'medium',
|
|
280
|
+
'fast-performance-pattern': 'low',
|
|
281
|
+
'high-failure-rate-pattern': 'high',
|
|
282
|
+
'moderate-failure-rate-pattern': 'medium',
|
|
283
|
+
'diverse-error-types-pattern': 'medium',
|
|
284
|
+
'slow-average-performance-pattern': 'medium',
|
|
285
|
+
'performance-variance-pattern': 'low'
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
return severityMap[pattern] || 'medium';
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Generate pattern-based recommendations
|
|
293
|
+
* @param {Array} patterns - Identified patterns
|
|
294
|
+
* @returns {Array} - Recommendations
|
|
295
|
+
*/
|
|
296
|
+
function generatePatternRecommendations(patterns) {
|
|
297
|
+
const recommendations = [];
|
|
298
|
+
|
|
299
|
+
patterns.forEach(pattern => {
|
|
300
|
+
switch (pattern) {
|
|
301
|
+
case 'timeout-pattern':
|
|
302
|
+
recommendations.push({
|
|
303
|
+
type: 'performance',
|
|
304
|
+
message: 'Increase timeout values or optimize test execution',
|
|
305
|
+
priority: 'medium'
|
|
306
|
+
});
|
|
307
|
+
break;
|
|
308
|
+
|
|
309
|
+
case 'permission-pattern':
|
|
310
|
+
recommendations.push({
|
|
311
|
+
type: 'security',
|
|
312
|
+
message: 'Review and fix file permissions',
|
|
313
|
+
priority: 'high'
|
|
314
|
+
});
|
|
315
|
+
break;
|
|
316
|
+
|
|
317
|
+
case 'missing-dependency-pattern':
|
|
318
|
+
recommendations.push({
|
|
319
|
+
type: 'dependencies',
|
|
320
|
+
message: 'Install missing dependencies and verify paths',
|
|
321
|
+
priority: 'high'
|
|
322
|
+
});
|
|
323
|
+
break;
|
|
324
|
+
|
|
325
|
+
case 'network-pattern':
|
|
326
|
+
recommendations.push({
|
|
327
|
+
type: 'network',
|
|
328
|
+
message: 'Check network connectivity and firewall settings',
|
|
329
|
+
priority: 'medium'
|
|
330
|
+
});
|
|
331
|
+
break;
|
|
332
|
+
|
|
333
|
+
case 'syntax-pattern':
|
|
334
|
+
recommendations.push({
|
|
335
|
+
type: 'code-quality',
|
|
336
|
+
message: 'Fix syntax errors in configuration or code',
|
|
337
|
+
priority: 'high'
|
|
338
|
+
});
|
|
339
|
+
break;
|
|
340
|
+
|
|
341
|
+
case 'slow-performance-pattern':
|
|
342
|
+
recommendations.push({
|
|
343
|
+
type: 'performance',
|
|
344
|
+
message: 'Optimize test performance and resource usage',
|
|
345
|
+
priority: 'medium'
|
|
346
|
+
});
|
|
347
|
+
break;
|
|
348
|
+
|
|
349
|
+
case 'high-failure-rate-pattern':
|
|
350
|
+
recommendations.push({
|
|
351
|
+
type: 'reliability',
|
|
352
|
+
message: 'Investigate systematic issues causing high failure rate',
|
|
353
|
+
priority: 'high'
|
|
354
|
+
});
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
return recommendations;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
module.exports = {
|
|
363
|
+
identifyPatterns,
|
|
364
|
+
identifyRiskFactors,
|
|
365
|
+
identifyBatchPatterns,
|
|
366
|
+
calculateRiskScore,
|
|
367
|
+
getPatternSeverity,
|
|
368
|
+
generatePatternRecommendations
|
|
369
|
+
};
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Report Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates analysis reports from verification results.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { determineSeverity, categorizeResult, generateRecommendations } = require('./analysis-utils');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Report Generator class
|
|
11
|
+
*/
|
|
12
|
+
class ReportGenerator {
|
|
13
|
+
constructor(options = {}) {
|
|
14
|
+
this.logger = options.logger || null;
|
|
15
|
+
this.includeDetails = options.includeDetails !== false;
|
|
16
|
+
this.format = options.format || 'json'; // json, html, text
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Generate analysis report
|
|
21
|
+
* @param {Array} testResults - Array of test results
|
|
22
|
+
* @param {Object} options - Report options
|
|
23
|
+
* @returns {Object} - Generated report
|
|
24
|
+
*/
|
|
25
|
+
generateReport(testResults, options = {}) {
|
|
26
|
+
const report = {
|
|
27
|
+
metadata: this.generateMetadata(testResults, options),
|
|
28
|
+
summary: this.generateSummary(testResults),
|
|
29
|
+
details: this.includeDetails ? this.generateDetails(testResults) : null,
|
|
30
|
+
recommendations: this.generateGlobalRecommendations(testResults)
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
if (this.logger) {
|
|
34
|
+
this.logger.info('Generated analysis report', {
|
|
35
|
+
resultCount: testResults.length,
|
|
36
|
+
format: this.format
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return report;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Generate report metadata
|
|
45
|
+
* @param {Array} testResults - Array of test results
|
|
46
|
+
* @param {Object} options - Report options
|
|
47
|
+
* @returns {Object} - Report metadata
|
|
48
|
+
*/
|
|
49
|
+
generateMetadata(testResults, options) {
|
|
50
|
+
return {
|
|
51
|
+
generatedAt: new Date().toISOString(),
|
|
52
|
+
totalResults: testResults.length,
|
|
53
|
+
reportFormat: this.format,
|
|
54
|
+
analysisOptions: options,
|
|
55
|
+
version: '1.0.0'
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Generate report summary
|
|
61
|
+
* @param {Array} testResults - Array of test results
|
|
62
|
+
* @returns {Object} - Report summary
|
|
63
|
+
*/
|
|
64
|
+
generateSummary(testResults) {
|
|
65
|
+
const summary = {
|
|
66
|
+
totalTests: testResults.length,
|
|
67
|
+
successfulTests: 0,
|
|
68
|
+
failedTests: 0,
|
|
69
|
+
criticalIssues: 0,
|
|
70
|
+
warningIssues: 0,
|
|
71
|
+
testTypes: {},
|
|
72
|
+
severityDistribution: {
|
|
73
|
+
critical: 0,
|
|
74
|
+
error: 0,
|
|
75
|
+
warning: 0,
|
|
76
|
+
info: 0
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
testResults.forEach(result => {
|
|
81
|
+
// Count success/failure
|
|
82
|
+
if (result.success) {
|
|
83
|
+
summary.successfulTests++;
|
|
84
|
+
} else {
|
|
85
|
+
summary.failedTests++;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Count severity
|
|
89
|
+
const severity = determineSeverity(result);
|
|
90
|
+
summary.severityDistribution[severity]++;
|
|
91
|
+
|
|
92
|
+
// Count critical issues
|
|
93
|
+
if (severity === 'critical') {
|
|
94
|
+
summary.criticalIssues++;
|
|
95
|
+
} else if (severity === 'warning') {
|
|
96
|
+
summary.warningIssues++;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Count test types
|
|
100
|
+
const testType = result.testType || 'unknown';
|
|
101
|
+
summary.testTypes[testType] = (summary.testTypes[testType] || 0) + 1;
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// Calculate success rate
|
|
105
|
+
summary.successRate = (summary.successfulTests / summary.totalTests * 100).toFixed(2);
|
|
106
|
+
summary.failureRate = (summary.failedTests / summary.totalTests * 100).toFixed(2);
|
|
107
|
+
|
|
108
|
+
return summary;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Generate detailed analysis
|
|
113
|
+
* @param {Array} testResults - Array of test results
|
|
114
|
+
* @returns {Array} - Detailed results
|
|
115
|
+
*/
|
|
116
|
+
generateDetails(testResults) {
|
|
117
|
+
return testResults.map(result => ({
|
|
118
|
+
testId: result.testId,
|
|
119
|
+
testType: result.testType,
|
|
120
|
+
success: result.success,
|
|
121
|
+
severity: determineSeverity(result),
|
|
122
|
+
category: categorizeResult(result),
|
|
123
|
+
recommendations: generateRecommendations(result),
|
|
124
|
+
timestamp: result.timestamp || new Date().toISOString(),
|
|
125
|
+
duration: result.duration || 0,
|
|
126
|
+
error: result.error || null,
|
|
127
|
+
warnings: result.warnings || []
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Generate global recommendations
|
|
133
|
+
* @param {Array} testResults - Array of test results
|
|
134
|
+
* @returns {Array} - Global recommendations
|
|
135
|
+
*/
|
|
136
|
+
generateGlobalRecommendations(testResults) {
|
|
137
|
+
const recommendations = [];
|
|
138
|
+
const issues = testResults.filter(r => !r.success);
|
|
139
|
+
|
|
140
|
+
// Analyze common failure patterns
|
|
141
|
+
const failureTypes = {};
|
|
142
|
+
issues.forEach(issue => {
|
|
143
|
+
const category = categorizeResult(issue);
|
|
144
|
+
failureTypes[category] = (failureTypes[category] || 0) + 1;
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// Generate recommendations based on failure patterns
|
|
148
|
+
Object.entries(failureTypes).forEach(([category, count]) => {
|
|
149
|
+
if (count > 0) {
|
|
150
|
+
const recommendation = this.generateCategoryRecommendation(category, count);
|
|
151
|
+
if (recommendation) {
|
|
152
|
+
recommendations.push(recommendation);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// Sort by priority
|
|
158
|
+
recommendations.sort((a, b) => {
|
|
159
|
+
const priorityOrder = { critical: 4, high: 3, medium: 2, low: 1 };
|
|
160
|
+
return (priorityOrder[b.priority] || 0) - (priorityOrder[a.priority] || 0);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
return recommendations;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Generate recommendation for a specific category
|
|
168
|
+
* @param {string} category - Failure category
|
|
169
|
+
* @param {number} count - Number of failures
|
|
170
|
+
* @returns {Object|null} - Recommendation object
|
|
171
|
+
*/
|
|
172
|
+
generateCategoryRecommendation(category, count) {
|
|
173
|
+
const recommendations = {
|
|
174
|
+
installation_failure: {
|
|
175
|
+
priority: count > 2 ? 'critical' : 'high',
|
|
176
|
+
message: `${count} installation failures detected. Check system requirements and permissions.`,
|
|
177
|
+
action: 'verify_installation_requirements'
|
|
178
|
+
},
|
|
179
|
+
verification_failure: {
|
|
180
|
+
priority: 'medium',
|
|
181
|
+
message: `${count} verification failures detected. Review agent configurations.`,
|
|
182
|
+
action: 'review_agent_configurations'
|
|
183
|
+
},
|
|
184
|
+
configuration_failure: {
|
|
185
|
+
priority: 'high',
|
|
186
|
+
message: `${count} configuration failures detected. Check configuration files and parameters.`,
|
|
187
|
+
action: 'validate_configuration_files'
|
|
188
|
+
},
|
|
189
|
+
connectivity_failure: {
|
|
190
|
+
priority: 'high',
|
|
191
|
+
message: `${count} connectivity failures detected. Check network settings and firewall.`,
|
|
192
|
+
action: 'test_network_connectivity'
|
|
193
|
+
},
|
|
194
|
+
performance_failure: {
|
|
195
|
+
priority: 'medium',
|
|
196
|
+
message: `${count} performance issues detected. Optimize agent settings.`,
|
|
197
|
+
action: 'optimize_agent_performance'
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
return recommendations[category] || null;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Export report to file
|
|
206
|
+
* @param {Object} report - Report object
|
|
207
|
+
* @param {string} filePath - Output file path
|
|
208
|
+
* @returns {Promise<void>}
|
|
209
|
+
*/
|
|
210
|
+
async exportToFile(report, filePath) {
|
|
211
|
+
const fs = require('fs').promises;
|
|
212
|
+
|
|
213
|
+
try {
|
|
214
|
+
let content;
|
|
215
|
+
|
|
216
|
+
switch (this.format) {
|
|
217
|
+
case 'json':
|
|
218
|
+
content = JSON.stringify(report, null, 2);
|
|
219
|
+
break;
|
|
220
|
+
case 'html':
|
|
221
|
+
content = this.generateHTMLReport(report);
|
|
222
|
+
break;
|
|
223
|
+
case 'text':
|
|
224
|
+
content = this.generateTextReport(report);
|
|
225
|
+
break;
|
|
226
|
+
default:
|
|
227
|
+
content = JSON.stringify(report, null, 2);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
await fs.writeFile(filePath, content, 'utf8');
|
|
231
|
+
|
|
232
|
+
if (this.logger) {
|
|
233
|
+
this.logger.info('Report exported to file', { filePath, format: this.format });
|
|
234
|
+
}
|
|
235
|
+
} catch (error) {
|
|
236
|
+
if (this.logger) {
|
|
237
|
+
this.logger.error('Failed to export report to file', {
|
|
238
|
+
filePath,
|
|
239
|
+
error: error.message
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
throw error;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Generate HTML report
|
|
248
|
+
* @param {Object} report - Report object
|
|
249
|
+
* @returns {string} - HTML content
|
|
250
|
+
*/
|
|
251
|
+
generateHTMLReport(report) {
|
|
252
|
+
return `
|
|
253
|
+
<!DOCTYPE html>
|
|
254
|
+
<html>
|
|
255
|
+
<head>
|
|
256
|
+
<title>Verification Analysis Report</title>
|
|
257
|
+
<style>
|
|
258
|
+
body { font-family: Arial, sans-serif; margin: 20px; }
|
|
259
|
+
.summary { background: #f5f5f5; padding: 15px; border-radius: 5px; margin-bottom: 20px; }
|
|
260
|
+
.critical { color: #d32f2f; }
|
|
261
|
+
.error { color: #f57c00; }
|
|
262
|
+
.warning { color: #ff9800; }
|
|
263
|
+
.success { color: #28a745; }
|
|
264
|
+
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
|
|
265
|
+
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
|
|
266
|
+
th { background-color: #f2f2f2; }
|
|
267
|
+
</style>
|
|
268
|
+
</head>
|
|
269
|
+
<body>
|
|
270
|
+
<h1>Verification Analysis Report</h1>
|
|
271
|
+
|
|
272
|
+
<div class="summary">
|
|
273
|
+
<h2>Summary</h2>
|
|
274
|
+
<p>Total Tests: ${report.summary.totalTests}</p>
|
|
275
|
+
<p>Success Rate: <span class="success">${report.summary.successRate}%</span></p>
|
|
276
|
+
<p>Failure Rate: <span class="error">${report.summary.failureRate}%</span></p>
|
|
277
|
+
<p>Critical Issues: <span class="critical">${report.summary.criticalIssues}</span></p>
|
|
278
|
+
<p>Warning Issues: <span class="warning">${report.summary.warningIssues}</span></p>
|
|
279
|
+
</div>
|
|
280
|
+
|
|
281
|
+
<h2>Global Recommendations</h2>
|
|
282
|
+
<ul>
|
|
283
|
+
${report.recommendations.map(rec =>
|
|
284
|
+
`<li><strong>${rec.message}</strong> (Priority: ${rec.priority})</li>`
|
|
285
|
+
).join('')}
|
|
286
|
+
</ul>
|
|
287
|
+
</body>
|
|
288
|
+
</html>`;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Generate text report
|
|
293
|
+
* @param {Object} report - Report object
|
|
294
|
+
* @returns {string} - Text content
|
|
295
|
+
*/
|
|
296
|
+
generateTextReport(report) {
|
|
297
|
+
const { summary, recommendations } = report;
|
|
298
|
+
|
|
299
|
+
return `
|
|
300
|
+
VERIFICATION ANALYSIS REPORT
|
|
301
|
+
Generated: ${report.metadata.generatedAt}
|
|
302
|
+
|
|
303
|
+
SUMMARY:
|
|
304
|
+
--------
|
|
305
|
+
Total Tests: ${summary.totalTests}
|
|
306
|
+
Successful Tests: ${summary.successfulTests} (${summary.successRate}%)
|
|
307
|
+
Failed Tests: ${summary.failedTests} (${summary.failureRate}%)
|
|
308
|
+
Critical Issues: ${summary.criticalIssues}
|
|
309
|
+
Warning Issues: ${summary.warningIssues}
|
|
310
|
+
|
|
311
|
+
GLOBAL RECOMMENDATIONS:
|
|
312
|
+
------------------------
|
|
313
|
+
${recommendations.map(rec =>
|
|
314
|
+
`- [${rec.priority.toUpperCase()}] ${rec.message}`
|
|
315
|
+
).join('\n')}
|
|
316
|
+
`;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
module.exports = ReportGenerator;
|