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,446 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compliance Report - HTML Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates HTML format compliance reports with styling and formatting.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Generate HTML compliance report
|
|
9
|
+
* @param {Object} complianceReport - Compliance report data
|
|
10
|
+
* @param {Object} options - Generation options
|
|
11
|
+
* @returns {string} - HTML content
|
|
12
|
+
*/
|
|
13
|
+
function generateHTMLReport(complianceReport, options = {}) {
|
|
14
|
+
const html = `
|
|
15
|
+
<!DOCTYPE html>
|
|
16
|
+
<html lang="en">
|
|
17
|
+
<head>
|
|
18
|
+
<meta charset="UTF-8">
|
|
19
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
20
|
+
<title>${complianceReport.title}</title>
|
|
21
|
+
<style>
|
|
22
|
+
${generateReportStyles()}
|
|
23
|
+
</style>
|
|
24
|
+
</head>
|
|
25
|
+
<body>
|
|
26
|
+
${generateReportHeader(complianceReport)}
|
|
27
|
+
${generateSummarySection(complianceReport.summary)}
|
|
28
|
+
${generateFileDetailsSection(complianceReport.files)}
|
|
29
|
+
${generateMetricsSection(complianceReport.metrics)}
|
|
30
|
+
${generateRecommendationsSection(complianceReport.recommendations)}
|
|
31
|
+
${generateReportFooter(options)}
|
|
32
|
+
</body>
|
|
33
|
+
</html>`;
|
|
34
|
+
|
|
35
|
+
return html;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Generate report header
|
|
40
|
+
* @param {Object} complianceReport - Compliance report data
|
|
41
|
+
* @returns {string} - HTML header
|
|
42
|
+
*/
|
|
43
|
+
function generateReportHeader(complianceReport) {
|
|
44
|
+
return `
|
|
45
|
+
<header class="report-header">
|
|
46
|
+
<h1>${complianceReport.title}</h1>
|
|
47
|
+
<div class="report-meta">
|
|
48
|
+
<div class="meta-item">
|
|
49
|
+
<strong>Generated:</strong> ${new Date(complianceReport.generatedAt).toLocaleString()}
|
|
50
|
+
</div>
|
|
51
|
+
<div class="meta-item">
|
|
52
|
+
<strong>Scope:</strong> ${complianceReport.scope}
|
|
53
|
+
</div>
|
|
54
|
+
<div class="meta-item">
|
|
55
|
+
<strong>Path:</strong> ${complianceReport.scopePath}
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</header>`;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Generate summary section
|
|
63
|
+
* @param {Object} summary - Report summary
|
|
64
|
+
* @returns {string} - HTML summary section
|
|
65
|
+
*/
|
|
66
|
+
function generateSummarySection(summary) {
|
|
67
|
+
if (!summary) return '';
|
|
68
|
+
|
|
69
|
+
return `
|
|
70
|
+
<section class="summary-section">
|
|
71
|
+
<h2>Executive Summary</h2>
|
|
72
|
+
<div class="summary-grid">
|
|
73
|
+
<div class="summary-card ${getScoreClass(summary.overallComplianceScore)}">
|
|
74
|
+
<h3>Overall Compliance</h3>
|
|
75
|
+
<div class="score">${summary.overallComplianceScore.toFixed(1)}%</div>
|
|
76
|
+
<div class="status">${summary.overallStatus}</div>
|
|
77
|
+
</div>
|
|
78
|
+
<div class="summary-card">
|
|
79
|
+
<h3>Files Analyzed</h3>
|
|
80
|
+
<div class="metric">${summary.totalFiles}</div>
|
|
81
|
+
</div>
|
|
82
|
+
<div class="summary-card">
|
|
83
|
+
<h3>Compliance Rate</h3>
|
|
84
|
+
<div class="metric">${summary.complianceRate.toFixed(1)}%</div>
|
|
85
|
+
</div>
|
|
86
|
+
<div class="summary-card">
|
|
87
|
+
<h3>Total Issues</h3>
|
|
88
|
+
<div class="metric ${summary.totalIssues > 0 ? 'issues' : 'no-issues'}">${summary.totalIssues}</div>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
</section>`;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Generate file details section
|
|
96
|
+
* @param {Array} files - File compliance data
|
|
97
|
+
* @returns {string} - HTML file details section
|
|
98
|
+
*/
|
|
99
|
+
function generateFileDetailsSection(files) {
|
|
100
|
+
if (!files || files.length === 0) return '';
|
|
101
|
+
|
|
102
|
+
let html = `
|
|
103
|
+
<section class="files-section">
|
|
104
|
+
<h2>File Details</h2>
|
|
105
|
+
<div class="files-table-container">
|
|
106
|
+
<table class="files-table">
|
|
107
|
+
<thead>
|
|
108
|
+
<tr>
|
|
109
|
+
<th>File</th>
|
|
110
|
+
<th>Lines</th>
|
|
111
|
+
<th>Status</th>
|
|
112
|
+
<th>Issues</th>
|
|
113
|
+
<th>Score</th>
|
|
114
|
+
</tr>
|
|
115
|
+
</thead>
|
|
116
|
+
<tbody>`;
|
|
117
|
+
|
|
118
|
+
files.forEach(file => {
|
|
119
|
+
const statusClass = getStatusClass(file.status);
|
|
120
|
+
const scoreClass = getScoreClass(file.complianceScore);
|
|
121
|
+
|
|
122
|
+
html += `
|
|
123
|
+
<tr class="${statusClass}">
|
|
124
|
+
<td>
|
|
125
|
+
<div class="file-path">${file.filePath}</div>
|
|
126
|
+
</td>
|
|
127
|
+
<td>${file.lineCount}</td>
|
|
128
|
+
<td>
|
|
129
|
+
<span class="status ${statusClass}">${file.status}</span>
|
|
130
|
+
${getStatusIcon(file.status)}
|
|
131
|
+
</td>
|
|
132
|
+
<td>
|
|
133
|
+
<div class="issue-count ${file.issues.length > 0 ? 'has-issues' : ''}">${file.issues.length}</div>
|
|
134
|
+
</td>
|
|
135
|
+
<td>
|
|
136
|
+
<div class="score ${scoreClass}">${file.complianceScore.toFixed(1)}%</div>
|
|
137
|
+
</td>
|
|
138
|
+
</tr>`;
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
html += `
|
|
142
|
+
</tbody>
|
|
143
|
+
</table>
|
|
144
|
+
</div>
|
|
145
|
+
</section>`;
|
|
146
|
+
|
|
147
|
+
return html;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Generate metrics section for HTML report
|
|
152
|
+
* @param {Object} metrics - Metrics data
|
|
153
|
+
* @returns {string} - HTML metrics section
|
|
154
|
+
*/
|
|
155
|
+
function generateMetricsSection(metrics) {
|
|
156
|
+
if (!metrics) return '';
|
|
157
|
+
|
|
158
|
+
let html = `
|
|
159
|
+
<section class="metrics-section">
|
|
160
|
+
<h2>Metrics Analysis</h2>
|
|
161
|
+
<div class="metrics-grid">`;
|
|
162
|
+
|
|
163
|
+
// Overview metrics
|
|
164
|
+
if (metrics.overview) {
|
|
165
|
+
html += `
|
|
166
|
+
<div class="metric-card">
|
|
167
|
+
<h3>Compliance Rate</h3>
|
|
168
|
+
<div class="metric-value ${getScoreClass(metrics.overview.complianceRate)}">${metrics.overview.complianceRate.toFixed(1)}%</div>
|
|
169
|
+
</div>
|
|
170
|
+
<div class="metric-card">
|
|
171
|
+
<h3>Health Status</h3>
|
|
172
|
+
<div class="metric-value">${metrics.overview.healthStatus}</div>
|
|
173
|
+
</div>
|
|
174
|
+
<div class="metric-card">
|
|
175
|
+
<h3>Avg Issues/File</h3>
|
|
176
|
+
<div class="metric-value">${metrics.overview.averageIssuesPerFile.toFixed(1)}</div>
|
|
177
|
+
</div>`;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
html += `
|
|
181
|
+
</div>
|
|
182
|
+
</section>`;
|
|
183
|
+
|
|
184
|
+
return html;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Generate recommendations section
|
|
189
|
+
* @param {Array} recommendations - Recommendations data
|
|
190
|
+
* @returns {string} - HTML recommendations section
|
|
191
|
+
*/
|
|
192
|
+
function generateRecommendationsSection(recommendations) {
|
|
193
|
+
if (!recommendations || recommendations.length === 0) return '';
|
|
194
|
+
|
|
195
|
+
let html = `
|
|
196
|
+
<section class="recommendations-section">
|
|
197
|
+
<h2>Recommendations</h2>
|
|
198
|
+
<div class="recommendations-list">`;
|
|
199
|
+
|
|
200
|
+
recommendations.forEach(rec => {
|
|
201
|
+
const priorityClass = rec.priority === 'critical' ? 'critical' :
|
|
202
|
+
rec.priority === 'high' ? 'violation' :
|
|
203
|
+
rec.priority === 'medium' ? 'warning' : 'compliant';
|
|
204
|
+
|
|
205
|
+
html += `
|
|
206
|
+
<div class="recommendation-item">
|
|
207
|
+
<h3><span class="${priorityClass}">${rec.title}</span> (${rec.priority})</h3>
|
|
208
|
+
<p>${rec.description}</p>
|
|
209
|
+
<p><strong>Action:</strong> ${rec.action}</p>
|
|
210
|
+
</div>`;
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
html += `
|
|
214
|
+
</div>
|
|
215
|
+
</section>`;
|
|
216
|
+
|
|
217
|
+
return html;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Generate report footer
|
|
222
|
+
* @param {Object} options - Generation options
|
|
223
|
+
* @returns {string} - HTML footer
|
|
224
|
+
*/
|
|
225
|
+
function generateReportFooter(options) {
|
|
226
|
+
return `
|
|
227
|
+
<footer class="report-footer">
|
|
228
|
+
<div class="footer-content">
|
|
229
|
+
<p>Generated by VibeCodingMachine Compliance Reporter</p>
|
|
230
|
+
<p>Generated on ${new Date().toLocaleString()}</p>
|
|
231
|
+
${options.includeTimestamp ? `<p>Timestamp: ${Date.now()}</p>` : ''}
|
|
232
|
+
</div>
|
|
233
|
+
</footer>`;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Generate CSS styles for report
|
|
238
|
+
* @returns {string} - CSS styles
|
|
239
|
+
*/
|
|
240
|
+
function generateReportStyles() {
|
|
241
|
+
return `
|
|
242
|
+
body {
|
|
243
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
244
|
+
line-height: 1.6;
|
|
245
|
+
color: #333;
|
|
246
|
+
max-width: 1200px;
|
|
247
|
+
margin: 0 auto;
|
|
248
|
+
padding: 20px;
|
|
249
|
+
background-color: #f8f9fa;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.report-header {
|
|
253
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
254
|
+
color: white;
|
|
255
|
+
padding: 30px;
|
|
256
|
+
border-radius: 8px;
|
|
257
|
+
margin-bottom: 30px;
|
|
258
|
+
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.report-header h1 {
|
|
262
|
+
margin: 0 0 10px 0;
|
|
263
|
+
font-size: 2.5em;
|
|
264
|
+
font-weight: 300;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.report-meta {
|
|
268
|
+
display: flex;
|
|
269
|
+
gap: 30px;
|
|
270
|
+
flex-wrap: wrap;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.meta-item {
|
|
274
|
+
display: flex;
|
|
275
|
+
flex-direction: column;
|
|
276
|
+
gap: 5px;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.summary-section, .files-section, .metrics-section, .recommendations-section {
|
|
280
|
+
background: white;
|
|
281
|
+
border-radius: 8px;
|
|
282
|
+
padding: 25px;
|
|
283
|
+
margin-bottom: 30px;
|
|
284
|
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.summary-grid, .metrics-grid {
|
|
288
|
+
display: grid;
|
|
289
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
290
|
+
gap: 20px;
|
|
291
|
+
margin-bottom: 20px;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.summary-card, .metric-card {
|
|
295
|
+
background: #f8f9fa;
|
|
296
|
+
border: 1px solid #e9ecef;
|
|
297
|
+
border-radius: 6px;
|
|
298
|
+
padding: 20px;
|
|
299
|
+
text-align: center;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.summary-card h3, .metric-card h3 {
|
|
303
|
+
margin: 0 0 10px 0;
|
|
304
|
+
color: #6c757d;
|
|
305
|
+
font-size: 0.9em;
|
|
306
|
+
text-transform: uppercase;
|
|
307
|
+
letter-spacing: 0.5px;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.score {
|
|
311
|
+
font-size: 2.5em;
|
|
312
|
+
font-weight: bold;
|
|
313
|
+
margin: 10px 0;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.compliant { color: #28a745; }
|
|
317
|
+
.warning { color: #ffc107; }
|
|
318
|
+
.violation { color: #dc3545; }
|
|
319
|
+
.critical { color: #6f42c1; }
|
|
320
|
+
|
|
321
|
+
.files-table-container {
|
|
322
|
+
overflow-x: auto;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.files-table {
|
|
326
|
+
width: 100%;
|
|
327
|
+
border-collapse: collapse;
|
|
328
|
+
margin-top: 20px;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.files-table th, .files-table td {
|
|
332
|
+
padding: 12px;
|
|
333
|
+
text-align: left;
|
|
334
|
+
border-bottom: 1px solid #e9ecef;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.files-table th {
|
|
338
|
+
background-color: #f8f9fa;
|
|
339
|
+
font-weight: 600;
|
|
340
|
+
color: #495057;
|
|
341
|
+
position: sticky;
|
|
342
|
+
top: 0;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.file-path {
|
|
346
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
347
|
+
font-size: 0.9em;
|
|
348
|
+
background: #f1f3f4;
|
|
349
|
+
padding: 4px 8px;
|
|
350
|
+
border-radius: 4px;
|
|
351
|
+
word-break: break-all;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.recommendations-list {
|
|
355
|
+
display: grid;
|
|
356
|
+
gap: 20px;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.recommendation-item {
|
|
360
|
+
background: #f8f9fa;
|
|
361
|
+
border-left: 4px solid #6c757d;
|
|
362
|
+
padding: 20px;
|
|
363
|
+
border-radius: 0 6px 6px 0;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.recommendation-item h3 {
|
|
367
|
+
margin: 0 0 10px 0;
|
|
368
|
+
color: #495057;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.recommendation-item p {
|
|
372
|
+
margin: 10px 0;
|
|
373
|
+
color: #6c757d;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.report-footer {
|
|
377
|
+
text-align: center;
|
|
378
|
+
padding: 40px 20px;
|
|
379
|
+
color: #6c757d;
|
|
380
|
+
border-top: 1px solid #e9ecef;
|
|
381
|
+
margin-top: 40px;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.issues { color: #dc3545; font-weight: bold; }
|
|
385
|
+
.no-issues { color: #28a745; }
|
|
386
|
+
|
|
387
|
+
@media (max-width: 768px) {
|
|
388
|
+
body { padding: 10px; }
|
|
389
|
+
.report-meta { flex-direction: column; gap: 15px; }
|
|
390
|
+
.summary-grid, .metrics-grid { grid-template-columns: 1fr; }
|
|
391
|
+
.files-table { font-size: 0.8em; }
|
|
392
|
+
}`;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Get status icon
|
|
397
|
+
* @param {string} status - Status string
|
|
398
|
+
* @returns {string} - Status icon
|
|
399
|
+
*/
|
|
400
|
+
function getStatusIcon(status) {
|
|
401
|
+
const icons = {
|
|
402
|
+
compliant: '✅',
|
|
403
|
+
warning: '⚠️',
|
|
404
|
+
violation: '❌',
|
|
405
|
+
critical: '🚨'
|
|
406
|
+
};
|
|
407
|
+
return icons[status] || '❓';
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Get status class for styling
|
|
412
|
+
* @param {string} status - Status string
|
|
413
|
+
* @returns {string} - CSS class
|
|
414
|
+
*/
|
|
415
|
+
function getStatusClass(status) {
|
|
416
|
+
const classMap = {
|
|
417
|
+
compliant: 'status-compliant',
|
|
418
|
+
warning: 'status-warning',
|
|
419
|
+
violation: 'status-violation',
|
|
420
|
+
critical: 'status-critical'
|
|
421
|
+
};
|
|
422
|
+
return classMap[status] || 'status-unknown';
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Get score class for styling
|
|
427
|
+
* @param {number} score - Compliance score
|
|
428
|
+
* @returns {string} - CSS class
|
|
429
|
+
*/
|
|
430
|
+
function getScoreClass(score) {
|
|
431
|
+
if (score >= 90) return 'compliant';
|
|
432
|
+
if (score >= 70) return 'warning';
|
|
433
|
+
if (score >= 50) return 'violation';
|
|
434
|
+
return 'critical';
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
module.exports = {
|
|
438
|
+
generateHTMLReport,
|
|
439
|
+
generateReportHeader,
|
|
440
|
+
generateSummarySection,
|
|
441
|
+
generateFileDetailsSection,
|
|
442
|
+
generateMetricsSection,
|
|
443
|
+
generateRecommendationsSection,
|
|
444
|
+
generateReportFooter,
|
|
445
|
+
generateReportStyles
|
|
446
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Category and Severity Metrics Calculator
|
|
3
|
+
* Calculates category and severity-specific metrics
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
class CategoryCalculator {
|
|
7
|
+
constructor(options = {}) {
|
|
8
|
+
this.options = options;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Calculate category-specific metrics
|
|
13
|
+
*/
|
|
14
|
+
calculateCategoryMetrics(report) {
|
|
15
|
+
const categories = {};
|
|
16
|
+
const totalIssues = report.summary.totalIssues;
|
|
17
|
+
|
|
18
|
+
// Calculate metrics for each category
|
|
19
|
+
for (const [category, issueCount] of Object.entries(report.issuesByCategory)) {
|
|
20
|
+
if (issueCount > 0) {
|
|
21
|
+
const categoryFiles = report.fileSummaries.filter(f =>
|
|
22
|
+
f.issues.some(issue => issue.category === category)
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
categories[category] = {
|
|
26
|
+
issueCount,
|
|
27
|
+
percentage: totalIssues > 0 ? (issueCount / totalIssues * 100) : 0,
|
|
28
|
+
affectedFiles: categoryFiles.length,
|
|
29
|
+
averageIssuesPerAffectedFile: categoryFiles.length > 0 ?
|
|
30
|
+
(issueCount / categoryFiles.length) : 0,
|
|
31
|
+
severity: this.getCategorySeverity(category, issueCount, report.summary.totalFiles)
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
categories,
|
|
38
|
+
mostProblematicCategory: this.getMostProblematicCategory(categories),
|
|
39
|
+
categoryDistribution: this.calculateCategoryDistribution(categories)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Calculate severity-specific metrics
|
|
45
|
+
*/
|
|
46
|
+
calculateSeverityMetrics(report) {
|
|
47
|
+
const summary = report.summary;
|
|
48
|
+
const totalIssues = report.summary.totalIssues;
|
|
49
|
+
|
|
50
|
+
const severities = {
|
|
51
|
+
critical: {
|
|
52
|
+
count: summary.criticalFiles,
|
|
53
|
+
issues: report.fileSummaries.reduce((sum, f) => sum + f.criticalIssues, 0),
|
|
54
|
+
percentage: totalIssues > 0 ? (summary.criticalFiles / summary.totalFiles * 100) : 0
|
|
55
|
+
},
|
|
56
|
+
error: {
|
|
57
|
+
count: summary.violationFiles,
|
|
58
|
+
issues: report.fileSummaries.reduce((sum, f) => sum + f.violationIssues, 0),
|
|
59
|
+
percentage: totalIssues > 0 ? (summary.violationFiles / summary.totalFiles * 100) : 0
|
|
60
|
+
},
|
|
61
|
+
warning: {
|
|
62
|
+
count: summary.warningFiles,
|
|
63
|
+
issues: report.fileSummaries.reduce((sum, f) => sum + f.warningIssues, 0),
|
|
64
|
+
percentage: totalIssues > 0 ? (summary.warningFiles / summary.totalFiles * 100) : 0
|
|
65
|
+
},
|
|
66
|
+
info: {
|
|
67
|
+
count: summary.compliantFiles,
|
|
68
|
+
issues: report.fileSummaries.reduce((sum, f) => sum + f.compliantIssues, 0),
|
|
69
|
+
percentage: totalIssues > 0 ? (summary.compliantFiles / summary.totalFiles * 100) : 0
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
severities,
|
|
75
|
+
severityRiskScore: this.calculateSeverityRiskScore(severities),
|
|
76
|
+
escalationRisk: this.calculateEscalationRisk(severities)
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
getCategorySeverity(category, issueCount, totalFiles) {
|
|
81
|
+
const severityRatio = issueCount / totalFiles;
|
|
82
|
+
if (severityRatio > 0.1) return 'high';
|
|
83
|
+
if (severityRatio > 0.05) return 'medium';
|
|
84
|
+
return 'low';
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
getMostProblematicCategory(categories) {
|
|
88
|
+
return Object.entries(categories)
|
|
89
|
+
.sort(([,a], [,b]) => b.issueCount - a.issueCount)[0]?.[1];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
calculateCategoryDistribution(categories) {
|
|
93
|
+
const total = Object.values(categories).reduce((sum, cat) => sum + cat.issueCount, 0);
|
|
94
|
+
const distribution = {};
|
|
95
|
+
|
|
96
|
+
for (const [name, category] of Object.entries(categories)) {
|
|
97
|
+
distribution[name] = {
|
|
98
|
+
count: category.issueCount,
|
|
99
|
+
percentage: total > 0 ? (category.issueCount / total * 100) : 0
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return distribution;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
calculateSeverityRiskScore(severities) {
|
|
107
|
+
const weights = {
|
|
108
|
+
critical: 10,
|
|
109
|
+
error: 5,
|
|
110
|
+
warning: 2,
|
|
111
|
+
info: 0
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
let riskScore = 0;
|
|
115
|
+
for (const [severity, data] of Object.entries(severities)) {
|
|
116
|
+
riskScore += weights[severity] * data.count;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return riskScore;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
calculateEscalationRisk(severities) {
|
|
123
|
+
// Risk of warnings escalating to errors, errors to critical
|
|
124
|
+
const warningToErrorRatio = severities.warning.count > 0 ?
|
|
125
|
+
severities.error.count / severities.warning.count : 0;
|
|
126
|
+
const errorToCriticalRatio = severities.error.count > 0 ?
|
|
127
|
+
severities.critical.count / severities.error.count : 0;
|
|
128
|
+
|
|
129
|
+
return {
|
|
130
|
+
warningEscalationRisk: Math.min(warningToErrorRatio * 100, 100),
|
|
131
|
+
errorEscalationRisk: Math.min(errorToCriticalRatio * 100, 100),
|
|
132
|
+
overallEscalationRisk: (warningToErrorRatio + errorToCriticalRatio) / 2 * 100
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
module.exports = CategoryCalculator;
|