1 min read
kevin-wiki / ui/scripts
Purpose
Build- and check-time scripts for the viewer: bundle the wiki/ markdown into a
form the Next app serves, and enforce the wiki's quality invariants (inline
citations, gate passwords) so broken content can't ship.
Mental model & key files
bundle-wiki.mjs— packages wiki content plus referenced public image/video assets for the app to render; private-page-only assets stay out of deployment.enforce-citations.ts+lib/citation-scan.ts— fail the build when facts lack[Source: ...]citations;test-citations.tscovers the scanner.test-gate-passwords.ts— validates gated-content password config.test-privacy-gating.ts— locks regression cases for people, career, Dedalus, generated packs, and operational logs.
Patterns to follow / invariants
- ESM;
.mjsfor plain Node scripts,.tsrun via tsx. - Keep scan/validation logic in
lib/(pure) and the entrypoints thin + testable. - A failing citation/gate check should block the build — these are guardrails.
Common tasks → first action
- Re-bundle after wiki edits → run
bundle-wiki.mjs. - Add a content guardrail → put the predicate in
lib/, call it from anenforce-*.tsentry, add atest-*.ts.
Gotchas
- These run in the
ui/pnpm workspace, not the repo-root tsx environment. - Citation enforcement mirrors
wiki/conventions — keep it in sync withconventions-qualityif the citation format changes.