Contributing to the docs
Writing pages for this site, and the checks they must pass.
6 min read
How to add or edit a page, and the checks every change must pass. The site lives in apps/web/: a
Foldkit app built with Vite and Bun. Pages are Markdown, compiled and
prerendered to static HTML at build time. The lint, format and task configs are at the repo root,
generated by shoemaker from shoemaker.config.ts.
just web-dev # dev server at http://localhost:4321 with hot reload, plus the Command Center
just ts-check # content check, oxlint, tsc, oxfmt, jscpd, knip, vitest
just web-build # ts-check, then the static build into apps/web/dist/client/
just ts-fix # oxlint's autofixes, then oxfmt
just web-deploy # build and deploy to Cloudflare (CI does this on every push to main)Code changes have checks of their own: just ci runs the Rust checks, ts-check and Ruff on
the Python, and just py-check adds ty, the Python type check.
Writing pages#
Where:
.mdfiles underapps/web/src/content/docs/. The file path is the URL (gpu/design.mdis/gpu/design/) and the folder is the sidebar group. Group names and their order are inapps/web/src/content/pages.ts; old-URL redirects inapps/web/src/site/redirects.ts.Frontmatter is flat
key: valuelines:titleanddescription(required),orderandlabel(optional).Vocabulary: CommonMark plus GFM tables and strikethrough. Raw HTML, footnotes, task lists and reference-style links fail the build, with the file and line.
Links between pages are site-absolute with a trailing slash:
/simulation/scenarios/#catalog. Anchors are GitHub-style heading slugs. The build fails on a broken internal link or anchor.Code blocks are highlighted at build time by Shiki; give the fence a language.
Directives#
For anything richer than Markdown, use a directive. They're declared, with their attributes, in
apps/web/src/site/islandAttributes.ts, and a typo fails the build.
| Directive | What it renders |
|---|---|
:::Aside{type="note" title="…"} … ::: | A callout: note, tip, caution or danger |
:::Steps around one ordered list | Numbered steps on a rail |
::::Tabs with :::Tab{label="…"} children | Tabs; the selection lives in the app's Model |
::::Details whose first line is a ## heading | A collapsible section, closed until clicked; links to a heading inside open it. Use :::: when it holds other directives |
::::Cards with :::Card{title="…"} or ::LinkCard{title="…" href="/x/"} | A card grid |
:::FileTree around a nested list | A file tree. Each item starts with its name in inline code (bold highlights it; … alone means "more"), then a note. Folders end in /; folders with entries collapse, open unless {folders="closed"} |
::TrainingChart{run="selfplay/main-1v1-s11" metrics="sps"} | A line chart from a run's metrics.jsonl, snapshotted at build time |
::Explainer{name="policy"} | An interactive figure from src/explainers/ (the ML primer's: loop, policy, discount, advantage, gae, clip, shaping, selfPlay, measuring) |
::Replay{src="/replays/x.rlvsnap" title="…"} | A 3D replay of a snapshot (physlab view … --export) in the web viewer, behind a Play button. Files go in apps/web/public/replays/; the build fails on a missing one. Optional camera: 0 free, 1–8 follow a car, 9 director (default) |
An emphasis that starts with a colored circle is a status badge: *🟢 done*, *🟡 partial*,
*⚪ not started*, *🔴 blocked*, *🔵 idea*.
Docs that live next to code#
A few Markdown files document the code beside them: vendor/rocketsim/PATCHES.md and
bakkesmod-plugin/README.md. The site has its own pages for them
(RocketSim patches, BakkesMod plugin),
written from those files but not generated from them, so change both when either changes.
Working on the app#
Layout:
src/main.ts(init, update, Commands, Subscriptions),src/model.ts,src/message.ts,src/route.ts,src/view/(layout, Markdown views, directive views),src/content/pages.ts,src/search.ts.src/site/holds modules shared with the build plugins inplugins/.Style: Foldkit idioms (a pure
update, side effects only as Commands, streams as Subscriptions) and Effect everywhere else:Matchinstead ofswitch, EffectFileSystem,Path,effect/httpandeffect/processinstead of Node built-ins,Effect.tryandEffect.tryPromiseinstead oftry/catchandasync/await,Schemato decode anything from outside.Styling: Tailwind utility classes in the views, and no hand-written CSS.
src/styles.cssis only the Tailwind import and the@themefonts. To style Markdown inside a directive, give its AST nodes their own classes in the views (src/view/directiveLists.tsdoes this forStepsandFileTree).Lint and format: the root
oxlint.config.tsruns every oxlint category aterrorwith shoemaker's shared rules (the@effect/tsgotype-aware rules and anti-slop among them), plus Foldkit's. The repo keeps zero warnings: every rule iserrororoff, and eachoffcarries a comment saying why. oxfmt formats everything except Markdown (oxfmt.config.ts). Both cover every package.Tests: vitest with
@effect/vitestfor Effect code and Foldkit'sstoryhelpers forupdate(bun run test).Foldkit reference offline: a clone of the Foldkit repo in
tmp/foldkithas its docs site source and every example app.
The Command Center (/command-center/) exists only on the dev server: its API is a Vite dev
server plugin, and a static build leaves it out.
Deploying#
The site is deployed to Cloudflare as static files at https://rocket-ml.ethanshoe.dev, open to
anyone. Every cloud resource, the site and the R2 bucket for runs/, is in one Alchemy stack,
alchemy.run.ts. Once
CI passes on main, .github/workflows/deploy.yml downloads the chart data from R2
(just runs-pull-charts), builds the viewer and deploys the stack. Run that workflow by hand to
pick up newly pushed chart data. Alchemy compares each resource with what is deployed and only
changes what differs.
One-time setup:
In the Cloudflare dashboard, turn on R2 (it asks for a payment method even for the free tier).
Make the
personalalchemy profile and putALCHEMY_PROFILE=personalin.env.local:bun alchemy profile edit --profile personal --add Cloudflarewith an API token that can create API tokens (API Tokens Edit) or the Global API Key, andbun alchemy profile edit --profile personal --add GitHubaftergh auth loginwith thereposcope. Thenjust web-deploycreates the site and the bucket, andbun run infra:github(stacks/github.ts) mints CI's Cloudflare token and writes it and the account id to the repository's secrets. CI never runs that stack, so its token can't create tokens.Under R2, create two API tokens for the bucket: Object Read only (CI) and Object Read & Write (your machine). Each shows an Access Key ID and a Secret Access Key.
Store CI's pair in the repository's secrets with
gh secret set:R2_ACCESS_KEY_ID,R2_SECRET_ACCESS_KEY. Put the read-write pair in Infisical asR2_ACCOUNT_ID,R2_ACCESS_KEY_IDandR2_SECRET_ACCESS_KEYto usejust runs-pushandjust runs-pull. SetINFISICAL_DOMAIN,INFISICAL_PROJECT_ID,INFISICAL_CLIENT_IDandINFISICAL_CLIENT_SECRETin your machine's environment;.env.schemalists every variable.
The deployed site's ::Replay players use just rlviser-web-public, the viewer without Rocket
League's assets (see RLViser replay); CI builds it before the site. A
deploy refuses any other viewer build in apps/web/public/rlviser/, such as just rlviser-web's.