Skip to content

docs(website): draw the traits diagram - #52

Merged
jgrodziski merged 1 commit into
mainfrom
docs/traits-diagram
Nov 23, 2026
Merged

jgrodziski merged 1 commit into
mainfrom
docs/traits-diagram

Conversation

@jgrodziski

Copy link
Copy Markdown
Contributor

The trait vocabulary of METAMODEL.md §3, drawn as one SVG in the style of the Specy metamodel diagrams, and shown on Reference › Metamodel › Traits.

  • What it shows: the entity in the middle and the seven trait families around it, with one box per trait (19) giving the attributes it contributes. Cardinalities run 0..n per family, dashed boxes are marker traits, and red dots mark the TNamed + TStructural + TInvocable composition.
  • A map of the page: the metamodel-diagram shortcode inlines the SVG. Every box and family frame links to its section, and the SVG's own stylesheet supplies the hover and keyboard-focus states (an <img> would lose both). Only the frames are tab stops, so 11 stops instead of 30.
  • Generated, not drawn: website/scripts/traits-diagram.mjs writes website/assets/diagrams/traits-metamodel.svg. Labels carry textLength measured from static/fonts/*.ttf, so the same file still fits its boxes as the <img> in METAMODEL.md on GitHub, where no webfont loads.
  • Pinned by a test: website/scripts/traits-diagram.test.mjs fails when the SVG is not the generator's output, when the boxes stop matching schemas/ (trait names and the entity record's keys), or when a box links to a heading that no longer exists. The website package's test script, previously true, runs it, and so does the website workflow.

Verification

  • node --test website/scripts/traits-diagram.test.mjs: 5/5 on this base (after feat: add codegraph walk (M21) #50 and feat: add the Python extractor (M22) #51). A deliberately stale SVG, a renamed heading and an extra trait in the contract each make it fail.
  • hugo --minify --gc builds, and the page carries 21 box links and 7 family links.
  • Checked in headless Chromium on the built site:
    • all 30 links resolve;
    • hover, click-through, Tab and Enter work;
    • dark theme renders;
    • at 390px the card scrolls sideways and the page has no horizontal overflow;
    • the file opened alone renders;
    • the file as an <img> with fallback fonts renders.

Not exercised: GitHub's own rendering of METAMODEL.md, and CI's Hugo 0.165 (I built locally with 0.170.1).

🤖 Generated with Claude Code

https://claude.ai/code/session_01PKCVh1MUps9E7nFWjgQgpW

The trait vocabulary of METAMODEL.md §3 as one SVG, in the style of the
Specy metamodel diagrams: the entity in the middle, the seven families
around it, one box per trait with the attributes it contributes, a dashed
box for a marker, red dots on the TNamed + TStructural + TInvocable
composition.

- website/scripts/traits-diagram.mjs generates
  website/assets/diagrams/traits-metamodel.svg (committed). Labels carry
  textLength measured from static/fonts/*.ttf, so the file still fits its
  boxes as an <img> on GitHub, where no webfont loads.
- The metamodel-diagram shortcode inlines it on the traits page: every
  box and family frame links to its section, with hover and focus states
  in the SVG's own stylesheet. assets/css/custom.css styles the card.
- traits-diagram.test.mjs pins the drawing to schemas/ (the trait names
  and the entity record's keys), to its generator, and to the headings it
  links to. The website package's test script runs it, as does the
  website workflow.
- METAMODEL.md §3 shows the same file as its image.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PKCVh1MUps9E7nFWjgQgpW
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
codegraph 98e6299 Commit Preview URL

Branch Preview URL
Nov 23 2026, 10:48 AM

@jgrodziski
jgrodziski merged commit 6e7fd1c into main Nov 23, 2026
36 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant