import fs from "node:fs"; import path from "node:path"; function assert(condition: unknown, message: string) { if (!condition) throw new Error(message); } export function runTests() { const projectRoot = process.cwd(); const repoRoot = path.resolve(projectRoot, ".."); const dashboardSource = fs.readFileSync( path.join(projectRoot, "components", "dashboard", "ScanTerminalDashboard.tsx"), "utf8", ); const opsConfigSource = fs.readFileSync( path.join(projectRoot, "components", "ops", "config", "ConfigPageClient.tsx"), "utf8", ); const nextRoutePath = path.join( projectRoot, "app", "api", "system", "update-announcement", "route.ts", ); const componentPath = path.join( projectRoot, "components", "dashboard", "scan-terminal", "UpdateAnnouncementButton.tsx", ); const opsApiSource = fs.readFileSync(path.join(repoRoot, "web", "services", "ops_api.py"), "utf8"); const systemApiSource = fs.readFileSync(path.join(repoRoot, "web", "services", "system_api.py"), "utf8"); const systemRouterSource = fs.readFileSync(path.join(repoRoot, "web", "routers", "system.py"), "utf8"); const dbSource = fs.readFileSync(path.join(repoRoot, "src", "database", "db_manager.py"), "utf8"); const middlewareSource = fs.readFileSync(path.join(projectRoot, "middleware.ts"), "utf8"); assert(fs.existsSync(componentPath), "terminal must have a compact update announcement component"); assert(!fs.existsSync(nextRoutePath), "update announcements should not depend on an admin-managed API proxy"); const componentSource = fs.readFileSync(componentPath, "utf8"); assert( dashboardSource.includes("UpdateAnnouncementButton") && dashboardSource.includes("