MCPcopy Create free account
hub / github.com/SethGammon/Citadel / main

Function main

scripts/evidence-validate.js:63–86  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

61}
62
63function main() {
64 const args = parseArgs(process.argv);
65 if (args.help || !args.file) {
66 process.stdout.write(`${usage()}\n`);
67 process.exitCode = args.help ? 0 : 2;
68 return;
69 }
70
71 const filePath = path.resolve(args.projectRoot, args.file);
72 const markdown = fs.readFileSync(filePath, 'utf8');
73 const report = validateExitEvidence(markdown, {
74 projectRoot: args.projectRoot,
75 target: args.target,
76 });
77 const pass = report.pass && (args.allowMissing || !report.missingDeclarations);
78
79 if (args.writeRepair && report.failures.length > 0) {
80 fs.writeFileSync(filePath, appendRepairTasks(markdown, report.failures), 'utf8');
81 }
82
83 if (args.json) process.stdout.write(`${JSON.stringify({ ...report, pass }, null, 2)}\n`);
84 else process.stdout.write(render(args.file, { ...report, pass }));
85 process.exitCode = pass ? 0 : 1;
86}
87
88if (require.main === module) {
89 main();

Callers 1

Calls 5

validateExitEvidenceFunction · 0.85
appendRepairTasksFunction · 0.85
parseArgsFunction · 0.70
usageFunction · 0.70
renderFunction · 0.70

Tested by

no test coverage detected