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,344 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compliance Report Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates comprehensive compliance reports in various formats,
|
|
5
|
+
* integrating validation results, metrics, and recommendations.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const { ComplianceReport, FileComplianceSummary, ComplianceIssue } = require('../models/compliance-report');
|
|
11
|
+
const MetricsCalculator = require('./metrics-calculator');
|
|
12
|
+
const {
|
|
13
|
+
createComplianceReport,
|
|
14
|
+
calculateComplianceMetrics,
|
|
15
|
+
generateComplianceRecommendations,
|
|
16
|
+
validateComplianceReport
|
|
17
|
+
} = require('./compliance-utils');
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Report Generator class
|
|
21
|
+
*/
|
|
22
|
+
class ReportGenerator {
|
|
23
|
+
constructor(options = {}) {
|
|
24
|
+
this.options = {
|
|
25
|
+
outputDir: options.outputDir || './reports',
|
|
26
|
+
formats: options.formats || ['json', 'html', 'markdown'],
|
|
27
|
+
includeMetrics: options.includeMetrics !== false,
|
|
28
|
+
includeRecommendations: options.includeRecommendations !== false,
|
|
29
|
+
includeCharts: options.includeCharts !== false,
|
|
30
|
+
...options
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Generate report in specified format
|
|
36
|
+
* @param {Object} data - Report data
|
|
37
|
+
* @param {string} format - Output format
|
|
38
|
+
* @returns {string} - Generated report
|
|
39
|
+
*/
|
|
40
|
+
generateReport(data, format) {
|
|
41
|
+
switch (format.toLowerCase()) {
|
|
42
|
+
case 'json':
|
|
43
|
+
return this.generateJSONReport(data);
|
|
44
|
+
case 'html':
|
|
45
|
+
return this.generateHTMLReport(data);
|
|
46
|
+
case 'markdown':
|
|
47
|
+
return this.generateMarkdownReport(data);
|
|
48
|
+
default:
|
|
49
|
+
throw new Error(`Unsupported format: ${format}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Generate JSON report
|
|
55
|
+
* @param {Object} data - Report data
|
|
56
|
+
* @returns {string} - JSON report
|
|
57
|
+
*/
|
|
58
|
+
generateJSONReport(data) {
|
|
59
|
+
return JSON.stringify(data, null, 2);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Generate HTML report
|
|
64
|
+
* @param {Object} data - Report data
|
|
65
|
+
* @returns {string} - HTML report
|
|
66
|
+
*/
|
|
67
|
+
generateHTMLReport(data) {
|
|
68
|
+
const { report, metrics, recommendations } = data;
|
|
69
|
+
|
|
70
|
+
return `
|
|
71
|
+
<!DOCTYPE html>
|
|
72
|
+
<html>
|
|
73
|
+
<head>
|
|
74
|
+
<title>Compliance Report</title>
|
|
75
|
+
<style>
|
|
76
|
+
body { font-family: Arial, sans-serif; margin: 20px; }
|
|
77
|
+
.header { background: #f5f5f5; padding: 15px; border-radius: 5px; margin-bottom: 20px; }
|
|
78
|
+
.summary { display: flex; gap: 20px; margin-bottom: 20px; }
|
|
79
|
+
.metric { background: #e9ecef; padding: 15px; border-radius: 5px; flex: 1; }
|
|
80
|
+
.metric h3 { margin: 0 0 10px 0; color: #333; }
|
|
81
|
+
.metric .value { font-size: 24px; font-weight: bold; color: #007bff; }
|
|
82
|
+
.issues { background: #fff3cd; padding: 15px; border-radius: 5px; margin-bottom: 20px; }
|
|
83
|
+
.recommendations { background: #d4edda; padding: 15px; border-radius: 5px; }
|
|
84
|
+
.recommendation { margin-bottom: 10px; padding: 10px; background: white; border-radius: 3px; }
|
|
85
|
+
.high { border-left: 4px solid #dc3545; }
|
|
86
|
+
.medium { border-left: 4px solid #ffc107; }
|
|
87
|
+
.low { border-left: 4px solid #28a745; }
|
|
88
|
+
</style>
|
|
89
|
+
</head>
|
|
90
|
+
<body>
|
|
91
|
+
<div class="header">
|
|
92
|
+
<h1>Compliance Report</h1>
|
|
93
|
+
<p>Generated: ${report.metadata.generatedAt}</p>
|
|
94
|
+
<p>Total Files: ${report.metadata.totalFiles}</p>
|
|
95
|
+
</div>
|
|
96
|
+
|
|
97
|
+
<div class="summary">
|
|
98
|
+
<div class="metric">
|
|
99
|
+
<h3>Compliance Rate</h3>
|
|
100
|
+
<div class="value">${metrics.complianceRate}%</div>
|
|
101
|
+
</div>
|
|
102
|
+
<div class="metric">
|
|
103
|
+
<h3>Total Issues</h3>
|
|
104
|
+
<div class="value">${metrics.totalIssues}</div>
|
|
105
|
+
</div>
|
|
106
|
+
<div class="metric">
|
|
107
|
+
<h3>Files Over Limit</h3>
|
|
108
|
+
<div class="value">${metrics.fileMetrics ? metrics.fileMetrics.filesOverLimit : 0}</div>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
${metrics.totalIssues > 0 ? `
|
|
113
|
+
<div class="issues">
|
|
114
|
+
<h2>Issues Found</h2>
|
|
115
|
+
<p>${metrics.totalIssues} issues need to be addressed</p>
|
|
116
|
+
</div>
|
|
117
|
+
` : ''}
|
|
118
|
+
|
|
119
|
+
<div class="recommendations">
|
|
120
|
+
<h2>Recommendations</h2>
|
|
121
|
+
${recommendations.map(rec => `
|
|
122
|
+
<div class="recommendation ${rec.priority}">
|
|
123
|
+
<strong>${rec.title}</strong>
|
|
124
|
+
<p>${rec.description}</p>
|
|
125
|
+
</div>
|
|
126
|
+
`).join('')}
|
|
127
|
+
</div>
|
|
128
|
+
</body>
|
|
129
|
+
</html>`;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Generate Markdown report
|
|
134
|
+
* @param {Object} data - Report data
|
|
135
|
+
* @returns {string} - Markdown report
|
|
136
|
+
*/
|
|
137
|
+
generateMarkdownReport(data) {
|
|
138
|
+
const { report, metrics, recommendations } = data;
|
|
139
|
+
|
|
140
|
+
return `
|
|
141
|
+
# Compliance Report
|
|
142
|
+
|
|
143
|
+
**Generated:** ${report.metadata.generatedAt}
|
|
144
|
+
|
|
145
|
+
## Summary
|
|
146
|
+
|
|
147
|
+
- **Total Files:** ${report.metadata.totalFiles}
|
|
148
|
+
- **Compliance Rate:** ${metrics.complianceRate}%
|
|
149
|
+
- **Total Issues:** ${metrics.totalIssues}
|
|
150
|
+
- **Files Over Limit:** ${metrics.fileMetrics ? metrics.fileMetrics.filesOverLimit : 0}
|
|
151
|
+
|
|
152
|
+
${metrics.totalIssues > 0 ? `
|
|
153
|
+
## Issues
|
|
154
|
+
|
|
155
|
+
${metrics.totalIssues} issues need to be addressed.
|
|
156
|
+
|
|
157
|
+
` : ''}
|
|
158
|
+
|
|
159
|
+
## Recommendations
|
|
160
|
+
|
|
161
|
+
${recommendations.map(rec => `
|
|
162
|
+
### ${rec.title} (${rec.priority})
|
|
163
|
+
|
|
164
|
+
${rec.description}
|
|
165
|
+
|
|
166
|
+
`).join('')}
|
|
167
|
+
`.trim();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Report Generator class
|
|
173
|
+
*/
|
|
174
|
+
class ComplianceReporter {
|
|
175
|
+
constructor(options = {}) {
|
|
176
|
+
this.options = {
|
|
177
|
+
outputDir: options.outputDir || './reports',
|
|
178
|
+
formats: options.formats || ['json', 'html', 'markdown'],
|
|
179
|
+
includeMetrics: options.includeMetrics !== false,
|
|
180
|
+
includeRecommendations: options.includeRecommendations !== false,
|
|
181
|
+
includeCharts: options.includeCharts !== false,
|
|
182
|
+
...options
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
this.metricsCalculator = new MetricsCalculator();
|
|
186
|
+
this.reportGenerator = new ReportGenerator(this.options);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Generate comprehensive compliance report
|
|
191
|
+
* @param {Array} validationResults - Array of validation results
|
|
192
|
+
* @param {Object} options - Report options
|
|
193
|
+
* @returns {Promise<Object>} - Generated report
|
|
194
|
+
*/
|
|
195
|
+
async generateReport(validationResults, options = {}) {
|
|
196
|
+
const reportOptions = { ...this.options, ...options };
|
|
197
|
+
|
|
198
|
+
try {
|
|
199
|
+
// Create compliance report
|
|
200
|
+
const complianceReport = createComplianceReport(validationResults, reportOptions);
|
|
201
|
+
|
|
202
|
+
// Calculate metrics if enabled
|
|
203
|
+
let metrics = null;
|
|
204
|
+
if (reportOptions.includeMetrics) {
|
|
205
|
+
metrics = calculateComplianceMetrics(complianceReport);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Generate recommendations if enabled
|
|
209
|
+
let recommendations = null;
|
|
210
|
+
if (reportOptions.includeRecommendations) {
|
|
211
|
+
recommendations = generateComplianceRecommendations(complianceReport);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Prepare report data
|
|
215
|
+
const reportData = {
|
|
216
|
+
report: complianceReport,
|
|
217
|
+
metrics,
|
|
218
|
+
recommendations
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
// Generate reports in requested formats
|
|
222
|
+
const generatedReports = await this.generateReportsInFormats(reportData, reportOptions);
|
|
223
|
+
|
|
224
|
+
return {
|
|
225
|
+
success: true,
|
|
226
|
+
report: complianceReport,
|
|
227
|
+
metrics,
|
|
228
|
+
recommendations,
|
|
229
|
+
generatedReports,
|
|
230
|
+
summary: {
|
|
231
|
+
totalFiles: validationResults.length,
|
|
232
|
+
complianceRate: metrics ? metrics.complianceRate : 0,
|
|
233
|
+
totalIssues: metrics ? metrics.totalIssues : 0,
|
|
234
|
+
formats: Object.keys(generatedReports)
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
} catch (error) {
|
|
239
|
+
return {
|
|
240
|
+
success: false,
|
|
241
|
+
error: error.message,
|
|
242
|
+
report: null,
|
|
243
|
+
metrics: null,
|
|
244
|
+
recommendations: null
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Generate reports in multiple formats
|
|
251
|
+
* @param {Object} reportData - Report data
|
|
252
|
+
* @param {Object} options - Report options
|
|
253
|
+
* @returns {Promise<Object>} - Generated reports
|
|
254
|
+
*/
|
|
255
|
+
async generateReportsInFormats(reportData, options) {
|
|
256
|
+
const reports = {};
|
|
257
|
+
const formats = options.formats || ['json'];
|
|
258
|
+
|
|
259
|
+
// Ensure output directory exists
|
|
260
|
+
await fs.promises.mkdir(this.options.outputDir, { recursive: true });
|
|
261
|
+
|
|
262
|
+
for (const format of formats) {
|
|
263
|
+
try {
|
|
264
|
+
const content = this.reportGenerator.generateReport(reportData, format);
|
|
265
|
+
const filename = `compliance-report.${format}`;
|
|
266
|
+
const filepath = path.join(this.options.outputDir, filename);
|
|
267
|
+
|
|
268
|
+
await fs.promises.writeFile(filepath, content, 'utf8');
|
|
269
|
+
reports[format] = {
|
|
270
|
+
success: true,
|
|
271
|
+
filepath,
|
|
272
|
+
size: content.length
|
|
273
|
+
};
|
|
274
|
+
} catch (error) {
|
|
275
|
+
reports[format] = {
|
|
276
|
+
success: false,
|
|
277
|
+
error: error.message
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return reports;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Validate report data
|
|
287
|
+
* @param {Object} reportData - Report data to validate
|
|
288
|
+
* @returns {Object} - Validation result
|
|
289
|
+
*/
|
|
290
|
+
validateReportData(reportData) {
|
|
291
|
+
return validateComplianceReport(reportData.report);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Get reporter information
|
|
296
|
+
* @returns {Object} - Reporter info
|
|
297
|
+
*/
|
|
298
|
+
getReporterInfo() {
|
|
299
|
+
return {
|
|
300
|
+
supportedFormats: ['json', 'html', 'markdown'],
|
|
301
|
+
defaultOptions: this.options,
|
|
302
|
+
features: [
|
|
303
|
+
'multi-format output',
|
|
304
|
+
'metrics calculation',
|
|
305
|
+
'recommendations generation',
|
|
306
|
+
'compliance validation'
|
|
307
|
+
],
|
|
308
|
+
version: '1.0.0'
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Create reporter with default configuration
|
|
314
|
+
* @param {Object} config - Configuration overrides
|
|
315
|
+
* @returns {ComplianceReporter} - Reporter instance
|
|
316
|
+
*/
|
|
317
|
+
static createDefault(config = {}) {
|
|
318
|
+
return new ComplianceReporter({
|
|
319
|
+
outputDir: './reports',
|
|
320
|
+
formats: ['json', 'html'],
|
|
321
|
+
includeMetrics: true,
|
|
322
|
+
includeRecommendations: true,
|
|
323
|
+
...config
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Create reporter for CI/CD
|
|
329
|
+
* @param {Object} config - Configuration overrides
|
|
330
|
+
* @returns {ComplianceReporter} - CI reporter instance
|
|
331
|
+
*/
|
|
332
|
+
static createForCI(config = {}) {
|
|
333
|
+
return new ComplianceReporter({
|
|
334
|
+
outputDir: './compliance-reports',
|
|
335
|
+
formats: ['json', 'markdown'],
|
|
336
|
+
includeMetrics: true,
|
|
337
|
+
includeRecommendations: true,
|
|
338
|
+
includeCharts: false,
|
|
339
|
+
...config
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
module.exports = ComplianceReporter;
|