ADR-034: The docs are a VitePress site over docs/, published to GitHub Pages
Date: 2026-11-01 Status: accepted
The idea
golem's docs are good, but GitHub shows them one file at a time. The README is 461 lines, because it is the front door, the user guide, and the contributor guide at once. Phase 11 (#264) turns docs/ into a site with a side menu, search, and both themes, in golem's own look. Four choices follow:
- VitePress builds the site from
docs/as it is. No file moves, so every link to a doc keeps working. - GitHub Pages hosts it, published by a workflow on each merge to
main. A pull request builds the site but does not publish it. - A broken link fails
just check, like a type error. - The site looks like the web UI, because it reads the same tokens. It never copies them.
flowchart LR md["docs/**/*.md<br>sources, unchanged paths"] --> vp["VitePress<br>docs/.vitepress/config.mts"] tokens["packages/web/src/styles/tokens.css<br>the one palette"] -.->|read at build time| vp vp -->|"just docs-build<br>(in just check: dead links fail)"| dist["docs/.vitepress/dist"] dist -->|"docs.yml, on merge to main"| pages["heygolem.dev"]
Decision
VitePress, with docs/ as its source folder
- The site is a workspace package,
@golem/docs, indocs/package.json. Its config and theme live indocs/.vitepress/. - Every
.mdfile indocs/is a page at the path it has today.docs/architecture.mdis/architecture, anddocs/adr/012-permission-rules.mdis/adr/012-permission-rules. - New pages go in new folders:
docs/guide/,docs/architecture/, anddocs/contributing/. (The series was first planned indocs/concepts/, apart fromarchitecture.md. Step 11.6 merged the two instead: each chapter indocs/architecture/teaches one idea and then holds golem's details for it, andarchitecture.mdbecomes the overview that links them, so no topic is written twice.) When a page should have a nicer URL than its file name,rewritesin the config maps it. The file does not move, so the links in AGENTS.md, the skills, code comments, and issues keep working. srcExcludeleaves out what is not a page:adr/template.md.- A link that leaves
docs/(to../README.md,../CONTRIBUTING.md, orpackages/…) becomes a full GitHub URL. A file the site should show, such asCONTRIBUTING.md, is pulled in with<!--@include: ../CONTRIBUTING.md-->, so it still has one source. - Mermaid diagrams are drawn by a small component of the theme,
GolemMermaid.vue, in golem's palette for each theme. The plan, the architecture, and nine ADRs already use Mermaid. (vitepress-plugin-mermaidwas used at first. It always draws dark mode in Mermaid's own dark theme, so step 11.3.1 replaced it.) - Search is VitePress's local search. It is built into the site, so there is no service and no key.
Published to GitHub Pages by a workflow
.github/workflows/docs.ymlruns on a push tomainthat touchesdocs/**orREADME.md, and on demand. It builds withvitepress build docsand publishes withactions/upload-pages-artifactandactions/deploy-pages.- Pages is set to "GitHub Actions" in the repo settings, once. The site lives at
https://heygolem.dev/, sobaseis/. (Until December 2026 it lived atmilanpavel.github.io/golem/, withbase/golem/. GitHub redirects the old address.) - A pull request does not publish anything.
just checkin CI builds the whole site, so a page that breaks the build cannot merge. - The site describes
main, not a release. A page about a feature that is not released yet says so.
A broken link fails the check
just docsruns the dev server.just docs-buildbuilds the site, andjust checkruns it.- VitePress fails the build on a dead internal link, and the config leaves that on. The only exceptions are listed in
ignoreDeadLinks, each with a comment saying why.
The look comes from the web UI's tokens
The approved design is the web UI's architecture page, and ADR-029 makes packages/web/src/styles/tokens.css the one place golem's colours are defined. The docs use the same palette, in slip and kiln:
tokens.cssis a Tailwind@themeblock, which VitePress cannot import.config.mtsreads the file at build time, takes each--color-*line, and serves them as plain custom properties through a virtual CSS module. The theme maps them onto VitePress's variables:--vp-c-brand-1comes fromclay-ink,--vp-c-bgfrombg, a tip fromallow, and so on. A token that the map names but the file does not have fails the build.- Each value is
light-dark(slip, kiln). The docs write the slip value on:rootand the kiln value onhtml.dark, the class VitePress's toggle sets, so the colours follow the switch. Mermaid gets the same values as plain colours, because it works out its shades from them. - Fonts are self-hosted from the same
@fontsource-variablepackages the web UI uses: Geist, Literata, and Geist Mono. The pixel labels use@fontsource/silkscreen. No font request leaves the site. - The pixel golem is drawn from the grid in
packages/tui/src/logo.ts. The legend andwhy-*SVGs indocs/images/are used as they are.
Alternatives considered
Starlight (Astro)
- Pros: the most polished default look. It is TypeScript and fits the pnpm workspace.
- Cons: its pages must live in
src/content/docs/. Every doc moves, and every link to one breaks or needs a redirect. - Why not: VitePress reads
docs/where it is, and golem's own theme replaces most of the default look either way.
MkDocs Material, or Zensical
- Pros: a rich theme, and Python, like the daemon.
- Cons: MkDocs Material is in maintenance mode. Zensical, its successor, is young. Neither can read the web UI's tokens or run its Vite tooling, so the look would be copied by hand.
- Why not: the look must come from one source, and that source lives in the TypeScript workspace.
The GitHub wiki
- Pros: nothing to build, and a sidebar through
_Sidebar.md. - Cons: a separate git repository with no pull requests, no review, and no CI. A plain look that cannot be themed.
- Why not: docs change with the code, so they must go through the same review.
Only better Markdown in the repo
- Pros: no tooling. GitHub renders Mermaid and shows a table of contents per file.
- Cons: no side menu across files, no search, no home page, and no theme.
- Why not: it does not give what Phase 11 is for.
Consequences
Positive
- One URL for everything a user or contributor needs, with a side menu and search.
- No doc moves. Old links keep working, and
docs/*.mdstill reads well on GitHub. - The docs and the web UI look like one product. A palette change in
tokens.cssreaches both. - A broken link is caught in the pull request, not by a reader.
Negative
- A new package,
@golem/docs, with VitePress and Mermaid as dev dependencies.just checktakes a little longer. - VitePress brings its own Vite, older than the web UI's. pnpm keeps them apart, but there are two in the lockfile.
- Markdown that renders on GitHub but not in VitePress, or the other way round, needs care. A raw HTML block, a relative link out of
docs/, and an image path are the usual cases.
Risks
- Reading
tokens.csswith a regex. If its format changes, the docs lose their colours. The build fails on a missing token, so this shows up in CI, not on the site. - Pages settings live outside the repo. If Pages is switched off or set to a branch, the workflow fails visibly.
docs/ops/build.md(The docs site) notes the setting. - The site runs ahead of releases. It is built from
main, so it can describe a feature not yet in Homebrew. A page marks such a feature, and a versioned site can come later if it is needed.