hpcompaq435/accessaudit-scanner
0
1import { readFileSync, writeFileSync } from "node:fs";2import { remediateAll } from "./remediate.js";3import type { ScanResult } from "./types.js";4 5const inputPath = process.argv[2] ?? "scan-result.json";6 7let scan: ScanResult;8try {9 scan = JSON.parse(readFileSync(inputPath, "utf8")) as ScanResult;10} catch {11 console.error(12 `Could not read ${inputPath}. Run a scan first:\n npm run scan -- ./fixtures/sample.html`,13 );14 process.exit(1);15}16 17const remediated = await remediateAll(scan.violations);18 19const report = { ...scan, violations: remediated };20writeFileSync("report.json", JSON.stringify(report, null, 2));21 22console.log(`Site: ${scan.url} • Score: ${scan.score}/100\n`);23for (const v of remediated) {24 const r = v.remediation;25 console.log(`[${r.priority.toUpperCase()}] ${v.id} (${v.impact}, x${v.nodeCount})`);26 console.log(` Who: ${r.whoItAffects}`);27 console.log(` Fix: ${r.howToFix}\n`);28}29console.log(`Full enriched report written to report.json`);30 