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.ts covers 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; .mjs for plain Node scripts, .ts run 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 an enforce-*.ts entry, add a test-*.ts.

Gotchas

  • These run in the ui/ pnpm workspace, not the repo-root tsx environment.
  • Citation enforcement mirrors wiki/ conventions — keep it in sync with conventions-quality if the citation format changes.