Regenerate diagrams#

The diagrams on this site are generated from the code and the contracts, and CI fails when one is stale or names something that does not exist. Regenerate them in the same change as the code they describe.

Script

Writes

Reads

docs/diagrams/published.py

The SVGs published on this site, in docs/diagrams/

Contracts, Compose stacks, parts lists and the source

docs/diagrams/build.py

Engineering sheets with measured counts, in the maintainers’ docs/design/toolkit-restructure/diagrams/; nothing in a copy without that folder

The working tree

docs/diagrams/concept.py

The two level 0 concept diagrams, rendered by build.py

Hand-written content

docs/diagrams/flows.py

Flow sheets, rendered by published.py

Hand-written steps

Published diagrams#

The sheets on this site draw only what is built: no file or line counts, versions or plans. Structure sheets come from the same declarations as the engineering diagrams. Flow steps are written by hand in flows.py, and published.py checks every route against contracts/openapi/v1.json, every MCP tool against contracts/mcp/tools-v1.json, every container against the Compose stacks, every part against the parts lists and every named code symbol against the source.

python3 docs/diagrams/published.py
python3 docs/diagrams/published.py --check

The first writes the SVGs, the second fails on a wrong name or a stale file. A wrong name means the diagram or the code changed without the other: fix whichever is wrong. Each sheet is written in a light and a dark palette (<name>.svg, <name>-dark.svg); a new color needs its dark value in published.py. Embed the light file with a figure; the site shows the dark file in its dark theme:

:::{figure} /diagrams/flow-parts.svg
:alt: How parts load
:width: 100%
:::

CI runs --check on every change, in the published_diagrams job.

Engineering diagrams#

python3 docs/diagrams/build.py
python3 docs/diagrams/build.py --check

build.py counts files, lines, libraries, operations and imports from the working tree, and fails when a Python module belongs to no declared block. When a module moves, update its block in build.py and its path in ci/boundaries/tiers.toml; the two must agree. CI runs the check in the design_diagrams job.

Run from a clean export#

Both scripts count what is on disk, so stray build/, *.egg-info and virtual environments change the output. Generate from an export of tracked files, with Python 3.12:

tmp=$(mktemp -d)
git ls-files | tar -cf - -T - | tar -C "$tmp" -xf -
python3.12 "$tmp/docs/diagrams/published.py"
python3.12 "$tmp/docs/diagrams/build.py"

Then copy the changed SVGs back into the working tree.

Both scripts need only the standard library. When their inputs are missing, as in a Toolkit-only checkout, published.py --check says so and skips.