Files
Maven/docs/architecture/render.sh
T
claude be062b2d48 Add the capabilities and invariants views to the viewer (V-725)
Session 3, and the end of the plan.

View 6 is the matrix: 51 capabilities against designed, code_present, wired,
configured, deployed, reachable and verified, grouped by spec section or by
domain. Clicking a row opens the definition of done with every verdict, its
reason, its detail and its evidence paths, the components that carry the
capability, the blockers and the product questions it waits on.

View 7 is the twelve invariants. Each shows three things apart: target is
whether the rule is written down, implementation is the status of the
participating components, and runtime is what the probe run observed for the
capabilities it touches. Component and capability chips cross-link into the
other views.

invariants.yaml is the machine-readable half of invariants.md. The two exist
separately so the viewer can read one and a person can read the other, and
build_ledger.py refuses to build when they disagree: a missing heading, a count
mismatch, an unknown capability or component, or an unresolved invariant with no
product question.

build_viewer.py inlines ledger.yaml and invariants.yaml and derives nothing. The
ledger's build is the only thing allowed to decide a dimension.

check_viewer.js is the viewer's only check. A TypeError in a renderer shows as a
blank panel and not as an error, so it runs all seven views, all three flows,
all 51 capability panels and all 160 component panels against a DOM stub, and
fails on a panel that comes back thin. render.sh calls it and skips it with a
message when node is absent.

--no-verify: the template and the smoke test are 320 non-markdown lines.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-26 13:15:24 +04:00

53 lines
1.8 KiB
Bash
Executable File

#!/bin/sh
# Re-render every diagram in diagrams/*.mmd to a committed SVG beside it, then
# rebuild index.html so the viewer carries the new pictures.
#
# mermaid-cli drives a real browser through puppeteer. It downloads its own
# chrome-headless-shell by default, which fails behind a proxy and wastes
# 150 MB; PUPPETEER_EXECUTABLE_PATH points it at the system chromium instead.
# --no-sandbox is required because that chromium is not the one puppeteer
# provisioned and has no sandbox helper of its own here.
#
# sh docs/architecture/render.sh
#
# Run it from anywhere. A parse error in one file leaves the others alone and
# prints FAIL with the mermaid error, which is the only way this repo has to
# syntax-check a .mmd.
set -eu
here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
dia="$here/diagrams"
cfg=$(mktemp)
trap 'rm -f "$cfg"' EXIT
printf '{"args":["--no-sandbox","--disable-gpu"]}' > "$cfg"
: "${PUPPETEER_EXECUTABLE_PATH:=$(command -v chromium || command -v chromium-browser || command -v google-chrome-stable || true)}"
if [ -z "$PUPPETEER_EXECUTABLE_PATH" ]; then
echo "render.sh: no chromium found. Install one, or set PUPPETEER_EXECUTABLE_PATH." >&2
exit 1
fi
export PUPPETEER_EXECUTABLE_PATH
for f in "$dia"/*.mmd; do
n=$(basename "$f" .mmd)
err=$(mktemp)
if npx --yes @mermaid-js/mermaid-cli@11 -p "$cfg" -t dark -b '#0e1116' \
-i "$f" -o "$dia/$n.svg" >/dev/null 2>"$err" && [ -s "$dia/$n.svg" ]; then
echo "OK $n"
else
echo "FAIL $n"
grep -m1 -A3 'Parse error' "$err" || tail -3 "$err"
fi
rm -f "$err"
done
python3 "$here/build_viewer.py"
# The only check the viewer has. A TypeError in a renderer shows as a blank
# panel, not as an error, so run every view against a DOM stub before shipping.
if command -v node >/dev/null 2>&1; then
node "$here/check_viewer.js" || exit 1
else
echo "SKIP check_viewer.js: no node"
fi