import { existsSync, readFileSync } from "node:fs"; const requiredFiles = [ "src/features/execution/pages/ExecutionCenter.tsx", "src/features/execution-feedback/pages/ExecutionFeedback.tsx", "src/app/routes.tsx", "src/shared/lib/navigation.tsx", "src/shared/components/ProjectFlowRail.tsx", "src/features/projects/pages/Workspace.tsx", "package.json", ]; const fail = (message) => { console.error(`ProjectBrain execution center readiness: FAIL - ${message}`); process.exit(1); }; for (const file of requiredFiles) { if (!existsSync(file)) fail(`missing ${file}`); } const read = (file) => readFileSync(file, "utf8"); const page = read("src/features/execution/pages/ExecutionCenter.tsx"); const routes = read("src/app/routes.tsx"); const nav = read("src/shared/lib/navigation.tsx"); const rail = read("src/shared/components/ProjectFlowRail.tsx"); const workspace = read("src/features/projects/pages/Workspace.tsx"); const pkg = read("package.json"); if (!routes.includes('/projects/:projectId/execution')) fail("execution route is not registered"); if (!routes.includes('ExecutionCenter')) fail("ExecutionCenter page is not imported in routes"); if (!nav.includes('Execution Center')) fail("Execution Center is missing from navigation"); if (!nav.includes('/execution')) fail("execution navigation path is missing"); if (!rail.includes('id: "execution"')) fail("project flow rail lacks execution step"); if (!workspace.includes('Open Execution') || !workspace.includes('Execution Center')) fail("workspace lacks execution shortcuts"); if (!page.includes('RuntimeExecutionQueue')) fail("execution page lacks runtime execution queue"); if (!page.includes('RuntimeHandoffBuilder') || !page.includes('RuntimeContextPromptPilot')) fail("execution page lacks handoff/prompt bridge"); if (!page.includes('generateFirstImplementationTask')) fail("execution page cannot create the first implementation task"); if (!page.includes('downloadText') || !page.includes('navigator.clipboard')) fail("execution page lacks copy/download brief support"); if (!page.includes('Review-gated execution inputs')) fail("execution page does not expose review-gated inputs"); if (!page.includes('acceptedStarterReviews')) fail("execution page does not distinguish accepted starter reviews"); if (!page.includes('Active Codex Skills')) fail("execution page does not show active Codex skills"); if (!page.includes('formatSkillsForCodexHandoff')) fail("execution brief does not include skill blocks"); if (!page.includes('QA/QC skill is active')) fail("execution readiness does not check QA/QC skill coverage"); if (!page.includes('Codex Handoff Quality Engine')) fail("execution page does not show Codex handoff quality engine"); if (!page.includes('Codex Session Pack')) fail("execution page does not show Codex session pack."); if (!page.includes('Run in Codex')) fail("execution page must expose Run in Codex action."); if (!page.includes('Download ZIP')) fail("execution page does not expose session pack ZIP action."); if (!page.includes('/session-packs')) fail("execution page does not link to Session Packs."); if (!page.includes('Copy next Codex prompt')) fail("execution page cannot copy next Codex prompt"); if (!page.includes('Open Codex Handoff')) fail("execution page does not link to Codex handoffs"); if (!page.includes('Review impact')) fail("execution page does not expose handoff impact review"); if (!page.includes('Recommended to approve the impact review before executing this prompt')) fail("execution page must warn before unapproved prompt execution"); if (!page.includes('Codex Execution Feedback')) fail("execution page must show execution feedback status"); if (!page.includes('View build loop')) fail("execution page must link to Build Loop"); if (!routes.includes('/projects/:projectId/execution-feedback')) fail("execution feedback route is not registered"); if (!routes.includes('/projects/:projectId/build-loop')) fail("build loop route is not registered"); if (!pkg.includes('audit:execution-feedback')) fail("package scripts lack audit:execution-feedback"); if (!pkg.includes('audit:build-loop')) fail("package scripts lack audit:build-loop"); if (!pkg.includes('audit:execution-center')) fail("package scripts lack audit:execution-center"); if (!pkg.includes('audit:history-center') || !pkg.includes('audit:source-library') || !pkg.includes('audit:guided-start') || !pkg.includes('audit:skills') || !pkg.includes('audit:repository-intake') || !pkg.includes('audit:handoffs') || !pkg.includes('audit:handoff-review') || !pkg.includes('audit:execution-feedback') || !pkg.includes('audit:build-loop')) fail("audit chain lost previous ProjectBrain gates"); console.log("ProjectBrain execution center readiness: PASS");