#!/usr/bin/env node /** * P1-4 modal hygiene report. * * Walks `client/src/pages/` and lists every inline modal pattern that * hasn't yet been migrated to the shared `Modal` component (Track A). * The migration is being done piecemeal in branches per file-owner, so * this script is the regression net: any new inline modal added in a * later PR shows up here, and finished file owners disappear from the * list. * * The pattern looked for is the inline "backdrop + card" convention, * which the migration spec (`modals.md` ยง1) defines as: * *
*
* ... (panel content) *
*
* * Counts per file are a rough scan; the actual migration work lives in * `feat/p1-4-modals-` worktrees and the PRs they produce. */ const fs = require('node:fs'); const path = require('node:path'); const ROOT = path.join(__dirname, '..', 'client', 'src', 'pages'); const BACKDROP = /fixed inset-0[^>]*backdrop-blur-(sm|md|lg)/; function walk(dir, out = []) { for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { const full = path.join(dir, entry.name); if (entry.isDirectory()) walk(full, out); else if (full.endsWith('.tsx')) out.push(full); } return out; } let total = 0; const report = []; for (const file of walk(ROOT)) { const text = fs.readFileSync(file, 'utf8'); const matches = text.match(/fixed inset-0[^>]*backdrop-blur-(sm|md|lg)/g); const count = matches ? matches.length : 0; if (count > 0) { total += count; report.push({ file: path.relative(path.join(__dirname, '..'), file), count }); } } report.sort((a, b) => b.count - a.count); for (const r of report) { console.log(`${String(r.count).padStart(3)} ${r.file}`); } console.log('---'); console.log(`Total inline modals remaining: ${total}`); process.exit(total > 0 ? 1 : 0);