import { readFileSync } from "node:fs"; import { execFileSync } from "node:child_process"; import { join } from "node:path"; import { expect, it } from "vitest"; const ROOT = join(__dirname, "../.."); // RULE: Nothing but /Applications/CottonDB.app opens the owner's data folder: no script names a database file in the data folder (owner's rule; architect, 15 Oct 2026, after the phone cut's schema gate was found opening a life.db in the data folder with sqlite3). A script that needs the Macs' state reads it over MCP. it("no script under scripts/ names a database file in the data folder", () => { const files = execFileSync("git", ["ls-files", "scripts"], { cwd: ROOT, encoding: "utf8" }) .split("\n").filter(f => f && !f.startsWith("scripts/__tests__/") && /\.(sh|ts|mts|js|mjs|py)$/.test(f)); const named = files.flatMap(f => readFileSync(join(ROOT, f), "utf8").split("\n") .map((line, i) => (/CottonDB\/files\/\S*life\.db/.test(line) ? `${f}:${i + 1}` : null)) .filter((hit): hit is string => hit !== null)); expect(named).toEqual([]); });