Bundle Wiki Prebuild
Portable build quickref for copying the parent
wiki/tree intoui/.content/wikiso the Vercel reader can load markdown at runtime.
Open this page when the wiki UI build cannot find markdown, when Vercel deploys from ui/, or when content appears stale in the deployed reader. Architecture context: Kevin Wiki UI Architecture.
Why It Exists
When Vercel's root directory is ui, ../wiki is not present in the serverless deployment filesystem. The prebuild step embeds the wiki tree into .content/wiki so runtime loaders can read the content without reaching outside the deployment bundle.
The same rule applies to instruction/docs files that routes expose as agent docs. ui/scripts/bundle-wiki.mjs starts from root *.md files plus ui/AGENTS.md, follows referenced docs such as scripts/SKILL.md, copies the discovered files into ui/.content, and writes agent-doc-sources.json so deployed routes never reach back to /vercel/path0/*.md at runtime or during tracing.
Contract
| Environment | Wiki source |
|---|---|
| Local dev | Live ../wiki unless WIKI_DIR overrides. |
| Production / Vercel | Bundled ui/.content/wiki copied during prebuild. |
| Override | WIKI_DIR points the reader at an alternate wiki root. |
Checklist
- Confirm
ui/package.jsonrunsnode scripts/bundle-wiki.mjsasprebuild. - Confirm Vercel project root is
ui. - Confirm
next.config.tstraces.content/**/*. - Confirm root
*.mdfiles and referenced instruction docs are allowlisted in root.vercelignore. - Rebuild after wiki changes before deploying reader content.
- Pair with Password Gate Setup and Public Categories Env for visibility/privacy.
Timeline
- 2026-07-06 | Added referenced instruction-doc bundling to the contract after Vercel reported
ENOENTfor/vercel/path0/scripts/SKILL.md; the prebuild bundle now writesagent-doc-sources.jsonand reads agent-doc pages only from.content. Source: User Vercel error reports, 2026-07-06;ui/scripts/bundle-wiki.mjs;ui/src/lib/wiki-page-reader.ts - 2026-07-06 | Added root doc bundling to the contract after Vercel reported
ENOENTfor/vercel/path0/README.mdand/vercel/path0/SKILL.md; the prebuild bundle now includes all root*.mddocs plusui/AGENTS.md. Source: User Vercel error reports, 2026-07-06;ui/scripts/bundle-wiki.mjs - 2026-07-01 | Rebuilt as the source/projection quickref for the wiki reader's bundled markdown path. Source: User request, 2026-07-01
- 2026-05-31 | Agent doc from ui prebuild script and README. Source: ui/README.md, 2026-05-31