docs(diagrams): SVG replaces PNG, and a map of the wiki generator flow

d2 emits SVG natively; its PNG path wants a ~150 MB headless-Chromium
download and prompts interactively, so every PNG here was produced by an
out-of-band magick step. There is no Chromium on this system. Dropping PNG
removes the dependency rather than trading one format for another, and cuts
docs/diagrams/ from 17 MB to 3.3 MB. SVG renders in Gitea and in clide
(`clide draw --file <path>`, which takes .d2 source directly), and diffs as
text.

One PNG is kept on purpose: design/star-map-concentric.png has no .d2 source.

Also renders the 7 star-map .d2 files for the first time. star-map-plan.md
listed their renders as a deliverable in March and the step never ran; the
new `make check-diagrams` is what surfaced it.

New: docs/diagrams/data-flow/wiki-generator-flow.d2 — which way the arrows
point for any file under wiki/. Every edge was read in the tool's own source
rather than inferred. It records the trap that keeps costing us: scaffold_bodies.py
writes a body page once and never overwrites it, and the generator then reads
that frontmatter directly — so a hand-edit there is not reverted, it is obeyed,
and silently changes world generation.

Two rendering traps found the expensive way and now written down:

- A d2 `|md` block becomes an SVG <foreignObject>. ImageMagick and flutter_svg
  both silently drop it, so the legend was in the file and invisible in every
  viewer except a browser. Plain labels render as real <text> everywhere.
- Container boxes fight the layout engine. Grouping nodes whose flow-depths
  differ forces long edge routes; this diagram went from an unreadable 2.4:1
  sprawl to a legible 0.75:1 by deleting five containers and changing nothing
  else. Colour classes carry the grouping instead.

make diagrams / make check-diagrams render and gate. Repo-specific rules in
.claude/rules/diagrams.md; d2 syntax and the traps live in the user-scope
d2-diagram skill, whose PNG default was flipped to SVG to match.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-20 01:49:19 +02:00
co-authored by Claude Opus 5
parent 34e5d7b636
commit 0817befcba
52 changed files with 3211 additions and 4 deletions
+25 -1
View File
@@ -12,7 +12,7 @@ GODOT := $(shell command -v godot4 2>/dev/null || command -v godot 2>/dev/null)
perf-baseline debug-schedule \
test-ipc-fixtures test-ipc-protocol test-ipc-integration test-ipc-benchmark \
screenshot visual-movie test-visual visual-update \
manifest
manifest diagrams check-diagrams
# --- Configuration ---
@@ -537,6 +537,30 @@ manifest:
@tooling/generate-character-manifest
@echo "Manifest regenerated — commit client/assets/characters/manifest.json if changed."
# --- Diagrams ---
#
# SVG, not PNG: d2 emits SVG natively, while its PNG path wants a ~150 MB
# headless-Chromium download and prompts interactively. SVG also renders in
# Gitea and in clide (`clide draw --file <path.d2|.svg>`), diffs as text, and
# cut docs/diagrams/ from 17 MB to 2.8 MB.
#
# Do NOT use d2 `|md` blocks in a diagram: they emit an SVG <foreignObject>,
# which ImageMagick and flutter_svg both silently drop — the text is then in
# the file and invisible in every viewer except a browser. Use plain labels.
diagrams:
@for d in $$(find docs/diagrams -name '*.d2'); do \
d2 "$$d" "$${d%.d2}.svg" >/dev/null || exit 1; \
done
@echo "Diagrams rendered — commit any changed docs/diagrams/**/*.svg."
check-diagrams:
@fail=0; for d in $$(find docs/diagrams -name '*.d2'); do \
test -f "$${d%.d2}.svg" || { echo "unrendered: $$d"; fail=1; }; \
done; \
test $$fail -eq 0 || { echo "Run 'make diagrams'."; exit 1; }; \
echo "All diagrams rendered."
# --- Clean ---
clean: