better/compute

Reference

Generated reference for the API, the CLI, command kinds, error codes, the daemon protocol, events, modules and packages, from a live control plane and the .proto files.

Most of this section is generated from the repository by apps/docs/scripts/generate.mjs, so it matches the code it documents. The generator does not parse source files. It imports the built packages and constructs a real control plane with betterCompute() and every module registered: the built-in node controllers, inventory and capacity, plus provision with metal, vps, events, fleet, rollout and audit. That control plane runs on a PGlite executor that is never opened and an IamPort that refuses every call, so nothing is migrated and no decision is made. What it reads is the registry a full deployment serves, plus the .proto files for the protocol page:

PageGenerated from
APIThe method registry, joined with PLAN.md §9.2 (core's apiSurface), so every method shows as registered (served by this build) or planned with its phase
CLIcliManifest() of @better-compute/cli, the same data better-compute help --json prints
Command kindsregistry.commandKinds: lane, roles, retry-safe, self-terminating, attested and destructive flags, timeout and payload message
ErrorsCore's errorCodes and defaultStatus
ProtocolThe .proto sources under proto/bettercompute, read by apps/docs/scripts/protocol.mjs (5cafb1e): every service, RPC, message and enum of commands.proto, inventory.proto, session.proto, common.proto, driver.proto and site.proto, with field numbers, labels, types linked to their message or enum, and each declaration's own comment. It reads the files rather than the compiled descriptors, which drop comments, and was checked against them (157 messages, 25 enums, equal field numbers)
EventseventCatalog of @better-compute/events: every event family with its type, subject and module, the same list webhooks.eventTypes returns
MetricsmetricCatalog() of @better-compute/observability: every Prometheus family with its type, labels, help and buckets, grouped by the function that defines it
ModulesThe registry's modules, their API groups and migrations, and every job in compute.jobs
PackagesEvery packages/*/package.json: name, description and export subpaths

The prose on the API and error pages is hand-written and kept beside the generator in apps/docs/descriptions/: api/<group>.md holds an overview paragraph and one ## method section per method, whose first paragraph becomes the summary, and errors.md holds one ## CODE section per error code. The generator checks those files against the registry, so a description of a method or code that no longer exists fails the run.

The rest of the section is written by hand: the glossary (from apps/docs/data/glossary.json, which also feeds the hover cards on every term in the guides), how to use these docs with AI, the roadmap, and the changelog, which includes the repository's CHANGELOG.md at build time.

Machine-readable docs

The site serves its content to tools and language models as well as to people:

URLContent
/llms.txtAn index of every page with its URL and description, headed by a one-line summary of Better Compute
/llms-full.txtEvery page as Markdown in one file
/docs/<page>.mdOne page as Markdown. A request for /docs/<page> with Accept: text/markdown gets the same answer
/llms.mdx/docs/<page>/content.mdThe route both of the above are rewritten to, with a Link: rel="canonical" header pointing at the HTML page
/api/search?query=...The search index behind the search dialog, as JSON
/api/mcpAn MCP server (Streamable HTTP) with search, page and reference lookup tools; see use the docs with AI

/llms.txt and /llms-full.txt are sent with X-Robots-Tag: noindex, so search engines index the pages themselves.

Regenerating

The generator imports the packages' dist/ output, so build them first. It stops with the list of missing builds when one is absent.

node node_modules/typescript/bin/tsc -b          # build every package the generator imports
node apps/docs/scripts/generate.mjs              # write apps/docs/generated/*.json and the generated pages
node apps/docs/scripts/generate.mjs --check      # fail when anything it would write differs (CI)
node apps/docs/scripts/check-content.mjs         # frontmatter, meta.json entries, links and anchors

generate.mjs writes apps/docs/generated/{api,errors,protocol,cli,command-kinds,events,metrics,modules,packages}.json next to the pages. The site reads them at build time: the MCP server's lookup_api_method, lookup_error_code and lookup_cli_command tools answer from them. In --check mode, pages in reference/api/ that the generator would no longer write count as drift too; without --check it deletes them.

tests/docs-generate.test.ts checks the committed output without a build: the descriptions name only real groups, methods and codes, every API group has its page and meta.json entry, the committed generated/protocol.json equals what protocol.mjs reads from the .proto files now and the protocol page has a heading for every message (2adc7a3), and check-content.mjs reports no problems. With the packages built and DOCS_GENERATE_CHECK=1 it also runs generate.mjs --check, so a registry change without regenerated docs fails the suite.

Edit the source, not the page

Every generated page starts with a comment naming its source. Change the code, or the matching file in apps/docs/descriptions/, and regenerate; a hand edit to a generated page is overwritten on the next run and fails --check until then.

Was this page helpful?

Better Compute is created by Sean Filimon

Last updated

On this page