Moved the sanitize implementation verbatim from src/lib/sanitize.ts into a new plain-JS src/lib/sanitize.core.mjs, with no behavior change. Because tsconfig extends astro/tsconfigs/strict without allowJs, importing the .mjs from TypeScript needed a declaration file, so the canonical types (PublicSnapshot, PrivateReport, SanitizationError, sanitize) now live in src/lib/sanitize.core.d.mts next to the implementation; src/lib/sanitize.ts is a two-line re-export of the values and types. Verified a bare node -e import of the .mjs both sanitizes a clean report and throws SanitizationError on a quote-bearing leak. npm test passes (49 tests, incl. the 5 unchanged sanitize tests) and npm run check reports 0 errors.
Full depth — file names, mechanisms, and trade-offs.Concise and competent — what it does, without the internals.Plain language — the value of the work, no jargon.
Extract the pure sanitizer logic from src/lib/sanitize.ts into a new…Sanitiser split into a shareable coreLet both halves of the system share one safety filter
Extracted the sanitizer into plain-JS src/lib/sanitize.core.mjs so engine .mjs code can import it; sanitize.ts is now a typed re-export.Split the sanitiser into a plain-JS core the engine can import, with the typed wrapper left in place for the site.The safety filter existed only where the website could use it. Moved it so the machine uses the very same filter — one filter, rather than two that could drift apart.
Below is the machine's full write-up, in its own words.
Below is the machine's own write-up. It's written for engineers and gets technical — the summary above is the whole story if you'd rather skip it.