Documentation workflow
Source code has no comments (ADR 0002, docs/decisions/0002-no-comments-in-source.md), so every explanation lives in Markdown: on this site, or in the repository for decisions and research. Each layer below is enforced by a check, not by discipline.
Where docs live
Section titled “Where docs live”| What | Where | Appears at |
|---|---|---|
| Package guides and API | packages/<pkg>/docs/*.{md,mdx} |
/packages/<pkg>/… |
| Package changelog | packages/<pkg>/CHANGELOG.md |
/packages/<pkg>/changelog/ |
| Runnable examples | packages/<pkg>/docs/examples/*.ts |
Embedded in guide pages |
| User guide | apps/docs/src/content/docs/guide/ |
/guide/… |
| Decisions and research | docs/decisions/, docs/research/ |
Repository only, not the site |
| Site-only pages | apps/docs/src/content/docs/ |
/… |
| Generated API reference | Built from the package’s exports | /api/<pkg>/… |
Package docs sit next to the code, so a code change and its docs land in the same diff.
The rules
Section titled “The rules”- Every export is documented. Each package doc page lists the exports it explains in its
symbolsfrontmatter. The docs build fails on any export that no page lists, and on any listed symbol that is no longer exported. - Every source change has a changelog line. Committing a change under
packages/<pkg>/src/without also stagingpackages/<pkg>/CHANGELOG.mdis rejected by the pre-commit hook. Entries go under Unreleased, in Keep a Changelog sections (Added, Changed, Fixed, Removed). - Examples are real code. Examples are
.tsfiles that import the package by name. They are type-checked byvp checkand exercised by tests intests/docs-examples.test.ts, then embedded into pages with?rawimports. An API change that breaks an example breaks the build. - Every page has a title and description, and internal links use site paths such as
/packages/shapes/overview/. The site build validates the frontmatter schema and every internal link.
Checks and when they run
Section titled “Checks and when they run”| Check | Runs in |
|---|---|
| Format, lint, type check | pre-commit (vp staged) |
Changelog entry for src/ |
pre-commit (vp staged) |
| Tests, including examples | pre-push (vp run ready) |
| Site build, links, coverage | pre-push (vp run ready) |
Adding an export, step by step
Section titled “Adding an export, step by step”- Write the code in
packages/<pkg>/src/and its tests intests/. - Explain it on a page in
packages/<pkg>/docs/and add its name to that page’ssymbols. - If it benefits from an example, add
docs/examples/<name>.ts, embed it, and assert it intests/docs-examples.test.ts. - Add a line to
CHANGELOG.mdunder Unreleased. - Preview with
vp run @draw/docs#dev.