import { readFileSync } from "node:fs";
import { rootPath } from "./src/config";

const files = [
  "scripts/assets/web-probe-sentinel-monitor-workbench/monitor-workbench.js",
  "scripts/assets/web-probe-sentinel-monitor-workbench/monitor-workbench.css",
  "scripts/assets/web-probe-sentinel-monitor-workbench/state/monitor-route.js",
  "scripts/assets/web-probe-sentinel-monitor-workbench/state/monitor-client.js",
];
const source = files.map((path) => readFileSync(rootPath(path), "utf8")).join("\n");
const failures = [];
for (const expected of ["100dvh", "grid-template-columns:360px", "grid-template-columns:280px", "overflow:hidden", "/api/monitor/workspace", "/api/monitor/runs/", "popstate", "/monitor/runs/", "datetime-local", "compact-scope-panel", "compact-time-panel", "Last success", "Last failure", "semantic-row", "原始诊断数据", "diagnostics: \"diagnostic\"", "detailType===\"diagnostic\""]) if (!source.includes(expected)) failures.push(`missing ${expected}`);
for (const forbidden of ["/api/overview", "/api/findings", "schemaVersion", "capability", "freshnessWarningMultiple"]) if (source.includes(forbidden)) failures.push(`forbidden ${forbidden}`);
if (failures.length) { console.error(JSON.stringify({ ok:false, component:"monitor-workbench", failures }, null, 2)); process.exit(1); }
console.log(JSON.stringify({ ok:true, component:"monitor-workbench", exposed:false, viewports:["1920x1080","960x600"], files, valuesRedacted:true }));
