context-forge
Version:
AI orchestration platform with autonomous teams, enhancement planning, migration tools, 25+ slash commands, checkpoints & hooks. Multi-IDE: Claude, Cursor, Windsurf, Cline, Copilot
56 lines ⢠2.54 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateValidationReport = generateValidationReport;
exports.saveValidationReport = saveValidationReport;
exports.generateValidationSummary = generateValidationSummary;
const handlebars_1 = __importDefault(require("handlebars"));
const fs_extra_1 = __importDefault(require("fs-extra"));
const path_1 = __importDefault(require("path"));
async function generateValidationReport(report) {
const templatePath = path_1.default.join(__dirname, '../../templates/validation/report.md');
const templateContent = await fs_extra_1.default.readFile(templatePath, 'utf-8');
const template = handlebars_1.default.compile(templateContent);
// Handlebars already has built-in if, unless, and each helpers
// No need to register them again
return template(report);
}
async function saveValidationReport(report, projectPath) {
const reportContent = await generateValidationReport(report);
const reportsDir = path_1.default.join(projectPath, '.validation-reports');
await fs_extra_1.default.ensureDir(reportsDir);
// Save markdown report
const filename = `validation-report-${Date.now()}.md`;
const filepath = path_1.default.join(reportsDir, filename);
await fs_extra_1.default.writeFile(filepath, reportContent);
// Also save as latest
const latestPath = path_1.default.join(reportsDir, 'latest-report.md');
await fs_extra_1.default.writeFile(latestPath, reportContent);
return filepath;
}
// Generate a summary for CLI output
function generateValidationSummary(report) {
const lines = [];
lines.push(`\nš Validation Report - ${report.projectName}`);
lines.push('='.repeat(50));
if (report.overallSuccess) {
lines.push('ā
Status: PASSED');
}
else {
lines.push('ā Status: FAILED');
}
lines.push(`\nTotal: ${report.summary.total} | Passed: ${report.summary.passed} | Failed: ${report.summary.failed}`);
if (report.results.some((r) => !r.success)) {
lines.push('\nFailed Commands:');
report.results
.filter((r) => !r.success)
.forEach((r) => {
lines.push(` ā ${r.level}: ${r.command}`);
});
}
lines.push('\nRun "context-forge validate --report" for detailed report');
return lines.join('\n');
}
//# sourceMappingURL=validationReport.js.map