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,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analysis Report Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates analysis reports for file size and code metrics
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const BaseReportGenerator = require('./base-generator');
|
|
8
|
+
|
|
9
|
+
class AnalysisReportGenerator extends BaseReportGenerator {
|
|
10
|
+
/**
|
|
11
|
+
* Generate analysis summary
|
|
12
|
+
*/
|
|
13
|
+
generateSummary(analysisData) {
|
|
14
|
+
const files = analysisData.files || [];
|
|
15
|
+
const totalFiles = files.length;
|
|
16
|
+
const largeFiles = files.filter(f => f.lineCount > 555).length;
|
|
17
|
+
const mediumFiles = files.filter(f => f.lineCount > 300 && f.lineCount <= 555).length;
|
|
18
|
+
const smallFiles = files.filter(f => f.lineCount <= 300).length;
|
|
19
|
+
|
|
20
|
+
const totalLines = files.reduce((sum, f) => sum + f.lineCount, 0);
|
|
21
|
+
const avgLines = totalFiles > 0 ? Math.round(totalLines / totalFiles) : 0;
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
totalFiles,
|
|
25
|
+
totalLines,
|
|
26
|
+
averageLines: avgLines,
|
|
27
|
+
sizeDistribution: {
|
|
28
|
+
small: smallFiles,
|
|
29
|
+
medium: mediumFiles,
|
|
30
|
+
large: largeFiles,
|
|
31
|
+
xlarge: files.filter(f => f.lineCount > 800).length
|
|
32
|
+
},
|
|
33
|
+
complianceRate: totalFiles > 0 ? ((totalFiles - largeFiles) / totalFiles * 100).toFixed(1) : 0,
|
|
34
|
+
needsRefactoring: largeFiles + mediumFiles
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Generate recommendations
|
|
40
|
+
*/
|
|
41
|
+
generateRecommendations(analysisData) {
|
|
42
|
+
const recommendations = [];
|
|
43
|
+
const files = analysisData.files || [];
|
|
44
|
+
|
|
45
|
+
// Large file recommendations
|
|
46
|
+
const largeFiles = files.filter(f => f.lineCount > 555);
|
|
47
|
+
if (largeFiles.length > 0) {
|
|
48
|
+
recommendations.push({
|
|
49
|
+
type: 'urgent',
|
|
50
|
+
title: `Refactor ${largeFiles.length} Large Files`,
|
|
51
|
+
description: `${largeFiles.length} files exceed the 555-line limit and require immediate refactoring.`,
|
|
52
|
+
files: largeFiles.map(f => f.path),
|
|
53
|
+
priority: 'high'
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Medium file recommendations
|
|
58
|
+
const mediumFiles = files.filter(f => f.lineCount > 300 && f.lineCount <= 555);
|
|
59
|
+
if (mediumFiles.length > 0) {
|
|
60
|
+
recommendations.push({
|
|
61
|
+
type: 'planning',
|
|
62
|
+
title: `Plan Refactoring for ${mediumFiles.length} Medium Files`,
|
|
63
|
+
description: `${mediumFiles.length} files are approaching the size limit and should be planned for refactoring.`,
|
|
64
|
+
files: mediumFiles.map(f => f.path),
|
|
65
|
+
priority: 'medium'
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Package-specific recommendations
|
|
70
|
+
const packageStats = this.analyzePackageStats(files);
|
|
71
|
+
for (const [pkg, stats] of Object.entries(packageStats)) {
|
|
72
|
+
if (stats.complianceRate < 80) {
|
|
73
|
+
recommendations.push({
|
|
74
|
+
type: 'package',
|
|
75
|
+
title: `Improve ${pkg} Package Compliance`,
|
|
76
|
+
description: `Package ${pkg} has ${stats.complianceRate}% compliance rate and needs attention.`,
|
|
77
|
+
files: stats.files,
|
|
78
|
+
priority: 'medium'
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return recommendations;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Generate statistics
|
|
88
|
+
*/
|
|
89
|
+
generateStatistics(analysisData) {
|
|
90
|
+
const files = analysisData.files || [];
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
fileSizes: this.calculateSizeDistribution(files),
|
|
94
|
+
packageStats: this.analyzePackageStats(files),
|
|
95
|
+
fileTypeStats: this.analyzeFileTypeStats(files),
|
|
96
|
+
complexityMetrics: this.calculateComplexityMetrics(files)
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Generate full analysis report data
|
|
102
|
+
*/
|
|
103
|
+
generate(analysisData) {
|
|
104
|
+
return {
|
|
105
|
+
type: 'analysis',
|
|
106
|
+
metadata: this.metadata,
|
|
107
|
+
summary: this.generateSummary(analysisData),
|
|
108
|
+
files: analysisData.files || [],
|
|
109
|
+
recommendations: this.generateRecommendations(analysisData),
|
|
110
|
+
statistics: this.generateStatistics(analysisData)
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
module.exports = AnalysisReportGenerator;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Report Generator
|
|
3
|
+
*
|
|
4
|
+
* Base class for all report generators with shared utilities
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const path = require('path');
|
|
8
|
+
|
|
9
|
+
class BaseReportGenerator {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.config = config;
|
|
12
|
+
this.metadata = {
|
|
13
|
+
generatedAt: new Date().toISOString(),
|
|
14
|
+
version: '1.0.0',
|
|
15
|
+
config: config.reporting || {}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Extract package name from file path
|
|
21
|
+
*/
|
|
22
|
+
extractPackageFromPath(filePath) {
|
|
23
|
+
const match = filePath.match(/packages\/([^\/]+)/);
|
|
24
|
+
return match ? match[1] : 'root';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Calculate size distribution
|
|
29
|
+
*/
|
|
30
|
+
calculateSizeDistribution(files) {
|
|
31
|
+
const distribution = {
|
|
32
|
+
'0-100': 0,
|
|
33
|
+
'101-200': 0,
|
|
34
|
+
'201-300': 0,
|
|
35
|
+
'301-400': 0,
|
|
36
|
+
'401-500': 0,
|
|
37
|
+
'501-555': 0,
|
|
38
|
+
'556+': 0
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
for (const file of files) {
|
|
42
|
+
const lines = file.lineCount;
|
|
43
|
+
if (lines <= 100) distribution['0-100']++;
|
|
44
|
+
else if (lines <= 200) distribution['101-200']++;
|
|
45
|
+
else if (lines <= 300) distribution['201-300']++;
|
|
46
|
+
else if (lines <= 400) distribution['301-400']++;
|
|
47
|
+
else if (lines <= 500) distribution['401-500']++;
|
|
48
|
+
else if (lines <= 555) distribution['501-555']++;
|
|
49
|
+
else distribution['556+']++;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return distribution;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Analyze package statistics
|
|
57
|
+
*/
|
|
58
|
+
analyzePackageStats(files) {
|
|
59
|
+
const packageStats = {};
|
|
60
|
+
|
|
61
|
+
for (const file of files) {
|
|
62
|
+
const pkg = this.extractPackageFromPath(file.path);
|
|
63
|
+
if (!packageStats[pkg]) {
|
|
64
|
+
packageStats[pkg] = {
|
|
65
|
+
totalFiles: 0,
|
|
66
|
+
totalLines: 0,
|
|
67
|
+
compliantFiles: 0,
|
|
68
|
+
files: []
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
packageStats[pkg].totalFiles++;
|
|
73
|
+
packageStats[pkg].totalLines += file.lineCount;
|
|
74
|
+
packageStats[pkg].files.push(file.path);
|
|
75
|
+
|
|
76
|
+
if (file.lineCount <= 555) {
|
|
77
|
+
packageStats[pkg].compliantFiles++;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Calculate compliance rates
|
|
82
|
+
for (const stats of Object.values(packageStats)) {
|
|
83
|
+
stats.complianceRate = stats.totalFiles > 0
|
|
84
|
+
? (stats.compliantFiles / stats.totalFiles * 100).toFixed(1)
|
|
85
|
+
: 0;
|
|
86
|
+
stats.averageLines = stats.totalFiles > 0
|
|
87
|
+
? Math.round(stats.totalLines / stats.totalFiles)
|
|
88
|
+
: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return packageStats;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Analyze file type statistics
|
|
96
|
+
*/
|
|
97
|
+
analyzeFileTypeStats(files) {
|
|
98
|
+
const typeStats = {};
|
|
99
|
+
|
|
100
|
+
for (const file of files) {
|
|
101
|
+
const ext = path.extname(file.path);
|
|
102
|
+
if (!typeStats[ext]) {
|
|
103
|
+
typeStats[ext] = {
|
|
104
|
+
count: 0,
|
|
105
|
+
totalLines: 0,
|
|
106
|
+
averageLines: 0
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
typeStats[ext].count++;
|
|
111
|
+
typeStats[ext].totalLines += file.lineCount;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Calculate averages
|
|
115
|
+
for (const stats of Object.values(typeStats)) {
|
|
116
|
+
stats.averageLines = stats.count > 0
|
|
117
|
+
? Math.round(stats.totalLines / stats.count)
|
|
118
|
+
: 0;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return typeStats;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Calculate complexity metrics (simplified)
|
|
126
|
+
*/
|
|
127
|
+
calculateComplexityMetrics(files) {
|
|
128
|
+
return {
|
|
129
|
+
totalComplexity: 0,
|
|
130
|
+
averageComplexity: 0,
|
|
131
|
+
complexityDistribution: {
|
|
132
|
+
low: 0,
|
|
133
|
+
medium: 0,
|
|
134
|
+
high: 0,
|
|
135
|
+
veryHigh: 0
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
module.exports = BaseReportGenerator;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compliance Report Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates compliance reports for constitutional requirements
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const BaseReportGenerator = require('./base-generator');
|
|
8
|
+
|
|
9
|
+
class ComplianceReportGenerator extends BaseReportGenerator {
|
|
10
|
+
/**
|
|
11
|
+
* Generate compliance summary
|
|
12
|
+
*/
|
|
13
|
+
generateSummary(complianceData) {
|
|
14
|
+
const metrics = complianceData.metrics || {};
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
overallScore: metrics.overallScore || 0,
|
|
18
|
+
fileComplianceRate: metrics.fileComplianceRate || 0,
|
|
19
|
+
lineComplianceRate: metrics.lineComplianceRate || 0,
|
|
20
|
+
violationCount: metrics.violationCount || 0,
|
|
21
|
+
lastChecked: metrics.lastChecked || new Date().toISOString(),
|
|
22
|
+
status: metrics.status || 'unknown'
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Generate full compliance report data
|
|
28
|
+
*/
|
|
29
|
+
generate(complianceData) {
|
|
30
|
+
return {
|
|
31
|
+
type: 'compliance',
|
|
32
|
+
metadata: this.metadata,
|
|
33
|
+
summary: this.generateSummary(complianceData),
|
|
34
|
+
metrics: complianceData.metrics || {},
|
|
35
|
+
violations: complianceData.violations || [],
|
|
36
|
+
trends: complianceData.trends || {}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
module.exports = ComplianceReportGenerator;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Report Format Handlers
|
|
3
|
+
*
|
|
4
|
+
* Handles output formatting for different report types
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
|
|
9
|
+
const OUTPUT_FORMATS = {
|
|
10
|
+
JSON: 'json',
|
|
11
|
+
MARKDOWN: 'markdown',
|
|
12
|
+
CONSOLE: 'console',
|
|
13
|
+
HTML: 'html'
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
class FormatHandler {
|
|
17
|
+
/**
|
|
18
|
+
* Output report in specified format
|
|
19
|
+
*/
|
|
20
|
+
static output(reportData, format, outputPath) {
|
|
21
|
+
switch (format) {
|
|
22
|
+
case OUTPUT_FORMATS.JSON:
|
|
23
|
+
return FormatHandler.outputJSON(reportData, outputPath);
|
|
24
|
+
case OUTPUT_FORMATS.MARKDOWN:
|
|
25
|
+
return FormatHandler.outputMarkdown(reportData, outputPath);
|
|
26
|
+
case OUTPUT_FORMATS.CONSOLE:
|
|
27
|
+
return FormatHandler.outputConsole(reportData);
|
|
28
|
+
case OUTPUT_FORMATS.HTML:
|
|
29
|
+
return FormatHandler.outputHTML(reportData, outputPath);
|
|
30
|
+
default:
|
|
31
|
+
throw new Error(`Unsupported output format: ${format}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Output JSON format
|
|
37
|
+
*/
|
|
38
|
+
static outputJSON(reportData, outputPath) {
|
|
39
|
+
const json = JSON.stringify(reportData, null, 2);
|
|
40
|
+
|
|
41
|
+
if (outputPath) {
|
|
42
|
+
fs.writeFileSync(outputPath, json, 'utf8');
|
|
43
|
+
return { success: true, path: outputPath, format: 'json' };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return { success: true, content: json, format: 'json' };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Output Markdown format
|
|
51
|
+
*/
|
|
52
|
+
static outputMarkdown(reportData, outputPath) {
|
|
53
|
+
const markdown = FormatHandler.generateMarkdownReport(reportData);
|
|
54
|
+
|
|
55
|
+
if (outputPath) {
|
|
56
|
+
fs.writeFileSync(outputPath, markdown, 'utf8');
|
|
57
|
+
return { success: true, path: outputPath, format: 'markdown' };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return { success: true, content: markdown, format: 'markdown' };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Output console format
|
|
65
|
+
*/
|
|
66
|
+
static outputConsole(reportData) {
|
|
67
|
+
const consoleOutput = FormatHandler.generateConsoleReport(reportData);
|
|
68
|
+
console.log(consoleOutput);
|
|
69
|
+
return { success: true, content: consoleOutput, format: 'console' };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Output HTML format
|
|
74
|
+
*/
|
|
75
|
+
static outputHTML(reportData, outputPath) {
|
|
76
|
+
const html = FormatHandler.generateHTMLReport(reportData);
|
|
77
|
+
|
|
78
|
+
if (outputPath) {
|
|
79
|
+
fs.writeFileSync(outputPath, html, 'utf8');
|
|
80
|
+
return { success: true, path: outputPath, format: 'html' };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return { success: true, content: html, format: 'html' };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Generate Markdown report
|
|
88
|
+
*/
|
|
89
|
+
static generateMarkdownReport(data) {
|
|
90
|
+
let markdown = `# ${data.type.charAt(0).toUpperCase() + data.type.slice(1)} Report\n\n`;
|
|
91
|
+
|
|
92
|
+
// Metadata
|
|
93
|
+
markdown += `**Generated:** ${new Date(data.metadata.generatedAt).toLocaleString()}\n`;
|
|
94
|
+
markdown += `**Version:** ${data.metadata.version}\n\n`;
|
|
95
|
+
|
|
96
|
+
// Summary
|
|
97
|
+
if (data.summary) {
|
|
98
|
+
markdown += `## Summary\n\n`;
|
|
99
|
+
for (const [key, value] of Object.entries(data.summary)) {
|
|
100
|
+
markdown += `- **${key}:** ${value}\n`;
|
|
101
|
+
}
|
|
102
|
+
markdown += `\n`;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Recommendations
|
|
106
|
+
if (data.recommendations && data.recommendations.length > 0) {
|
|
107
|
+
markdown += `## Recommendations\n\n`;
|
|
108
|
+
for (const rec of data.recommendations) {
|
|
109
|
+
markdown += `### ${rec.title} (${rec.priority})\n`;
|
|
110
|
+
markdown += `${rec.description}\n\n`;
|
|
111
|
+
if (rec.files && rec.files.length > 0) {
|
|
112
|
+
markdown += `**Files:**\n`;
|
|
113
|
+
for (const file of rec.files) {
|
|
114
|
+
markdown += `- \`${file}\`\n`;
|
|
115
|
+
}
|
|
116
|
+
markdown += `\n`;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return markdown;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Generate console report
|
|
126
|
+
*/
|
|
127
|
+
static generateConsoleReport(data) {
|
|
128
|
+
let output = `\n=== ${data.type.toUpperCase()} REPORT ===\n\n`;
|
|
129
|
+
|
|
130
|
+
// Summary
|
|
131
|
+
if (data.summary) {
|
|
132
|
+
output += "SUMMARY:\n";
|
|
133
|
+
for (const [key, value] of Object.entries(data.summary)) {
|
|
134
|
+
output += ` ${key}: ${value}\n`;
|
|
135
|
+
}
|
|
136
|
+
output += "\n";
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return output;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Generate HTML report
|
|
144
|
+
*/
|
|
145
|
+
static generateHTMLReport(data) {
|
|
146
|
+
return `
|
|
147
|
+
<!DOCTYPE html>
|
|
148
|
+
<html>
|
|
149
|
+
<head>
|
|
150
|
+
<title>${data.type} Report</title>
|
|
151
|
+
<style>
|
|
152
|
+
body { font-family: Arial, sans-serif; margin: 20px; }
|
|
153
|
+
.header { background: #f5f5f5; padding: 20px; border-radius: 5px; }
|
|
154
|
+
.summary { margin: 20px 0; }
|
|
155
|
+
.metric { display: inline-block; margin: 10px; padding: 10px; background: #e9ecef; border-radius: 3px; }
|
|
156
|
+
table { border-collapse: collapse; width: 100%; }
|
|
157
|
+
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
|
|
158
|
+
th { background-color: #f2f2f2; }
|
|
159
|
+
</style>
|
|
160
|
+
</head>
|
|
161
|
+
<body>
|
|
162
|
+
<div class="header">
|
|
163
|
+
<h1>${data.type} Report</h1>
|
|
164
|
+
<p>Generated: ${new Date(data.metadata.generatedAt).toLocaleString()}</p>
|
|
165
|
+
</div>
|
|
166
|
+
|
|
167
|
+
<div class="summary">
|
|
168
|
+
<h2>Summary</h2>
|
|
169
|
+
${Object.entries(data.summary || {}).map(([key, value]) =>
|
|
170
|
+
`<div class="metric"><strong>${key}:</strong> ${value}</div>`
|
|
171
|
+
).join('')}
|
|
172
|
+
</div>
|
|
173
|
+
|
|
174
|
+
<script>
|
|
175
|
+
// Add interactive features here if needed
|
|
176
|
+
</script>
|
|
177
|
+
</body>
|
|
178
|
+
</html>`;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
module.exports = {
|
|
183
|
+
FormatHandler,
|
|
184
|
+
OUTPUT_FORMATS
|
|
185
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Refactoring Report Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates reports for refactoring operations and results
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const BaseReportGenerator = require('./base-generator');
|
|
8
|
+
|
|
9
|
+
class RefactoringReportGenerator extends BaseReportGenerator {
|
|
10
|
+
/**
|
|
11
|
+
* Generate refactoring summary
|
|
12
|
+
*/
|
|
13
|
+
generateSummary(refactoringData) {
|
|
14
|
+
const operations = refactoringData.operations || [];
|
|
15
|
+
const successful = operations.filter(op => op.status === 'success').length;
|
|
16
|
+
const failed = operations.filter(op => op.status === 'failed').length;
|
|
17
|
+
const skipped = operations.filter(op => op.status === 'skipped').length;
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
totalOperations: operations.length,
|
|
21
|
+
successful,
|
|
22
|
+
failed,
|
|
23
|
+
skipped,
|
|
24
|
+
successRate: operations.length > 0 ? (successful / operations.length * 100).toFixed(1) : 0,
|
|
25
|
+
filesProcessed: refactoringData.filesProcessed || 0,
|
|
26
|
+
linesReduced: refactoringData.linesReduced || 0,
|
|
27
|
+
modulesCreated: refactoringData.modulesCreated || 0
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Generate full refactoring report data
|
|
33
|
+
*/
|
|
34
|
+
generate(refactoringData) {
|
|
35
|
+
return {
|
|
36
|
+
type: 'refactoring',
|
|
37
|
+
metadata: this.metadata,
|
|
38
|
+
summary: this.generateSummary(refactoringData),
|
|
39
|
+
operations: refactoringData.operations || [],
|
|
40
|
+
results: refactoringData.results || [],
|
|
41
|
+
rollback: refactoringData.rollback || {}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
module.exports = RefactoringReportGenerator;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation Report Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates validation reports for code quality and compliance checks
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const BaseReportGenerator = require('./base-generator');
|
|
8
|
+
|
|
9
|
+
class ValidationReportGenerator extends BaseReportGenerator {
|
|
10
|
+
/**
|
|
11
|
+
* Generate validation summary
|
|
12
|
+
*/
|
|
13
|
+
generateSummary(validationData) {
|
|
14
|
+
const results = validationData.results || [];
|
|
15
|
+
const errors = results.filter(r => r.severity === 'error').length;
|
|
16
|
+
const warnings = results.filter(r => r.severity === 'warning').length;
|
|
17
|
+
const info = results.filter(r => r.severity === 'info').length;
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
totalIssues: results.length,
|
|
21
|
+
errors,
|
|
22
|
+
warnings,
|
|
23
|
+
info,
|
|
24
|
+
filesValidated: validationData.filesValidated || 0,
|
|
25
|
+
passed: errors === 0
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Generate compliance metrics
|
|
31
|
+
*/
|
|
32
|
+
generateComplianceMetrics(validationData) {
|
|
33
|
+
const results = validationData.results || [];
|
|
34
|
+
const filesValidated = validationData.filesValidated || 0;
|
|
35
|
+
|
|
36
|
+
const errorCount = results.filter(r => r.severity === 'error').length;
|
|
37
|
+
const warningCount = results.filter(r => r.severity === 'warning').length;
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
overallScore: filesValidated > 0 ? Math.max(0, 100 - (errorCount * 10 + warningCount * 2)) : 0,
|
|
41
|
+
fileComplianceRate: filesValidated > 0 ? ((filesValidated - errorCount) / filesValidated * 100) : 0,
|
|
42
|
+
lineComplianceRate: 0,
|
|
43
|
+
violationCount: errorCount,
|
|
44
|
+
lastChecked: new Date().toISOString(),
|
|
45
|
+
status: errorCount === 0 ? 'compliant' : warningCount > 0 ? 'warning' : 'non-compliant'
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Generate full validation report data
|
|
51
|
+
*/
|
|
52
|
+
generate(validationData) {
|
|
53
|
+
return {
|
|
54
|
+
type: 'validation',
|
|
55
|
+
metadata: this.metadata,
|
|
56
|
+
summary: this.generateSummary(validationData),
|
|
57
|
+
results: validationData.results || [],
|
|
58
|
+
compliance: this.generateComplianceMetrics(validationData)
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
module.exports = ValidationReportGenerator;
|