Skip to content

🎉 🤖 add component registry derived from JSDoc on archieML types#6543

Draft
mlbrgl wants to merge 3 commits into
masterfrom
claude-cms-base
Draft

🎉 🤖 add component registry derived from JSDoc on archieML types#6543
mlbrgl wants to merge 3 commits into
masterfrom
claude-cms-base

Conversation

@mlbrgl

@mlbrgl mlbrgl commented May 27, 2026

Copy link
Copy Markdown
Member

Context

First PR of the claude-cms stack (followed by #6544, gdoc write-back fidelity, and #6545, file-first CMS). It establishes a single source of truth for ArchieML component documentation: the TypeScript types themselves.

  • Each archieMLComponents/<Name>.ts type carries a short JSDoc that points via @see to a sibling .md sidecar holding the author-facing docs: description, When to use / When NOT to use, Variations, and one or more ```archie example blocks.
  • devTools/gdocs/generate-components-reference.ts walks the OwidEnrichedGdocBlock union via the TS compiler API (canonical iteration order), reads the sidecars, parses every example through archieToEnriched, and emits two artifacts:
    • docs/components-reference.generated.md — human-readable reference, intended to replace the hand-maintained "Writing OWID Articles" Google Doc
    • docs/components.registry.generated.json — machine-readable bundle for agent consumption (Claude Code skills, a future admin component picker)

Drift can't accumulate silently:

  • examples that no longer parse abort generation with exit 1, listing the broken examples
  • a new CI job (components-reference) regenerates both artifacts and fails on git diff
  • a vitest (devTools/gdocs/sidecars.test.ts) asserts every union member has a sidecar

Coverage: 61 components documented. 49 have full docs plus at least one example drawn from the gdoc reference; 12 internal components have minimal markers to be filled in later. Table and Additional Charts intentionally have no example — their content derives from native Google Docs tables/lists that can't be expressed in pure ArchieML text.

Also removes a duplicate EnrichedBlockResearchAndWriting entry from the OwidEnrichedGdocBlock union.

Testing guidance

  • yarn generateComponentsReference — should complete without errors and produce no diff in docs/
  • yarn test run devTools/gdocs/sidecars.test.ts
  • Skim docs/components-reference.generated.md and spot-check a few components against the "Writing OWID Articles" gdoc

🤖 Generated with Claude Code

mlbrgl commented May 27, 2026

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@socket-security

socket-security Bot commented May 27, 2026

Copy link
Copy Markdown

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report

@owidbot

owidbot commented May 27, 2026

Copy link
Copy Markdown
Contributor

Quick links (staging server):

Site Dev Site Preview Admin Wizard Docs Docs Preview

Login: ssh owid@staging-site-claude-cms-base

Archive:

🎨 Bespoke dev server

SVG tester:

Number of differences (graphers): 0 ✅
Number of differences (grapher views): skipped
Number of differences (mdims): skipped
Number of differences (explorers): skipped
Number of differences (thumbnails): skipped

Edited: 2026-05-27 20:29:15 UTC
Execution time: 1.47 seconds

@github-actions

Copy link
Copy Markdown

This PR has had no activity within the last two weeks. It is considered stale and will be closed in 3 days if no further activity is detected.

@github-actions github-actions Bot added the stale label Jun 11, 2026
mlbrgl and others added 3 commits June 12, 2026 11:43
Establish a single source of truth for ArchieML component documentation —
the TypeScript types themselves. Each archieMLComponents/<Name>.ts now
carries JSDoc on its EnrichedBlock<Name> type with a description, When to
use / When NOT to use, Variations, and one or more @example blocks in raw
ArchieML.

devTools/gdocs/generate-components-reference.ts walks every
archieMLComponents file via the TS compiler API, extracts the JSDoc,
parses each @example through archieToEnriched, and emits two artifacts:

- docs/components-reference.generated.md: human-readable reference
  intended to replace the hand-maintained "Writing OWID Articles" Google
  Doc. Every example round-trips through the parser at generation time,
  so drift fails CI (exit 1, listing the broken examples).

- docs/components.registry.generated.json: machine-readable bundle for
  agent consumption (Claude Code skills, future admin component picker).

61 components documented across all files. 49 have full JSDoc + at least
one @example drawn from the Gdoc reference; 12 have minimal markers
(internal components not covered by the hand-written doc) to be filled
in later. Two components — Table and Additional Charts — intentionally
have no @example because their content derives from a native Google Docs
table / bulleted list that can't be expressed in pure ArchieML text.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Each EnrichedBlock* type now points to a sibling .md sidecar via `@see`,
instead of carrying its full author-facing docs in a JSDoc block. The
generator now reads those sidecars (using tsgo to walk the
OwidEnrichedGdocBlock union for canonical iteration order) and derives
example names from the markdown heading immediately above each
` ```archie ` fence.

Adds a vitest that asserts every union member has a sidecar, and a CI
job that regenerates the reference + registry and fails on drift.

Also removes a duplicate EnrichedBlockResearchAndWriting entry from the
OwidEnrichedGdocBlock union.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mlbrgl mlbrgl force-pushed the claude-cms-base branch from 88337b8 to 42f5d16 Compare June 12, 2026 19:12
@github-actions github-actions Bot removed the stale label Jun 13, 2026
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.

2 participants