ADR-0039: cloudhal.dev: Starlight over the repo's docs, a link contract checked in CI, docs for agents
- Status: Accepted
- Date: 2026-10-21 (decided by Halil)
- Amendment (2026-10-21, phase 3): the docs stay out of the site MCP server;
cloudhal.dev/mcpis the only docs MCP. See rule 4. - Related: RFC-0037, ADR-0037, ADR-0011, RFC-0004
- Sources: Starlight · starlight-llms-txt · llms.txt · Cloudflare docs for agents · Workers static assets: redirects and headers
Context
ADR-0037 makes cloudhal.dev the developer domain and the only copy of the docs. Packages, cloudhal.com, the schemas’ $ids and the fetcher’s User-Agent already link there. A stopgap (apps/docs, #33) serves the schemas, /fetch, /llms.txt and redirects /docs to GitHub. RFC-0037 proposes the real site.
Decision
- Starlight in
apps/docs, reading the monorepo’sdocs/through a content-collection loader. Docs change in the same PR as code. The samecloudhal-devWorker serves it with the schemas and/fetch. - Generated reference: CLI, MCP tools,
cloudhal.json, schemas and changelog are built from source, never written by hand. - Link contract: a published URL never 404s (moves get a 301 from
apps/docs/redirects.ts);/schemas/v1/*never moves; user-facing links point at cloudhal.dev, not GitHub paths; errors link to/e/<code>pages from one error-code registry inpackages/core-contracts; CI checks all of it. - Docs for agents: Markdown per page (
<path>.mdand<path>/index.md),Accept: text/markdownwithx-markdown-tokens,llms.txtandllms-full.txtper site and per section, and a standalone, read-only, unauthenticated MCP atcloudhal.dev/mcp(search_docs,read_doc), rate limited per IP. The site MCP server (cloudhal mcp, remote/mcp) gets no docs tools (amendment): it is for agents working on sites (content, design, generated UI, comments, schedules), and its how-to knowledge lives in skills, tool descriptions and server instructions. Docs tools there would add tools that narrow-scoped keys never need, a second knowledge source that can contradict the first, and an outbound dependency on cloudhal.dev. Developer agents read the docs from cloudhal.dev; the site server’s instructions only namellms.txt. - English only, latest release only while 0.x; versions under
/docs/v<major>/from 1.0; languages later under/docs/<lang>/. - All ADRs and RFCs are published, each page showing its status.
- Delivered in four phases (RFC-0037 §7): the site; generated reference, error pages, CI checks and previews; agent endpoints; new content and link migration.
Alternatives considered
| Alternative | Pros | Cons | Why not |
|---|---|---|---|
| A Cloudhal site (dogfood) | Shows the product | Docs leave the repo and drift; needs a Markdown-from-git import | cloudhal.com already dogfoods |
| Mintlify / GitBook | Fast, polished | Vendor lock-in, cost, not on our Worker | Contradicts open source and self-hosting |
| Docusaurus | Versioning built in | A second front-end stack | Starlight is Astro, like the renderer |
| GitHub only | No work | No search, navigation or Markdown endpoints | The stopgap, not the site |
| Docs tools in the site MCP (Supabase, Sanity) | One server to connect | Irrelevant tools for narrow keys, two knowledge sources, an outbound call from every deployment | Their servers are developer tools; Cloudhal’s is content-operational and policy-governed (amendment) |
Consequences
- Positive. One docs source; reference that cannot drift; stable URLs; agents get Markdown, indexes and search.
- Negative. A docs build in CI on docs and reference changes; moving a docs file needs a redirect entry; a small Worker script for content negotiation and the MCP endpoint.
- Risks. Starlight and Astro majors must move together with the renderer’s Astro (one catalog entry); an unauthenticated MCP endpoint needs rate limiting.