Files
whynot-design/designbook
tegwick 0d688ca94a feat(designbook): technology-neutral IR + stack-adapter pipeline (WHYNOT-WP-0002 T01-T06)
Author the design language once in the canonical React designbook and project it
one-way onto each stack: React -> designbook/ -> ir/ -> adapters/<stack>/.

Phase 0 — contracts & governance (T01-T03):
- ir/SCHEMA.md + ir/schema/{component,tokens}.schema.json — neutral IR contract
  (W3C DTCG tokens; React prop -> HTML attribute mapping; non-portable props flagged).
- adapters/ADAPTER_CONTRACT.md — inputs, drift-report + parity-result shapes,
  idempotency rules, CI exit codes (0 ok / 2 usage / 3 drift / 4 parity / 5 internal).
- .claude/rules/designbook-propagation.md + DesignSystemIntroduction.md §5.1 —
  one-way directionality + drift-resolution workflow.

T04 — canonical React designbook + the missing pull tool:
- The bundled /design-sync skill only PUSHES repo->cloud; it cannot populate
  designbook/. Added scripts/designbook_pull.py + `make designbook-pull`, which drives
  the local claude binary headless (acceptEdits) so DesignSync fetch+write runs in a
  subprocess (contents never hit the orchestrator's context). Pulled 44 files;
  excludes the _whynot-design-seed/ self-copy. Corrected the docs that wrongly called
  /design-sync the pull.

T05 — IR extractor (scripts/ir-extract.mjs + `make ir`):
- ir/tokens.json (80 tokens, DTCG, var() -> {ref} alias resolution); ir/components/*.json
  (10 contracts parsed from .jsx signatures: enum/boolean/number inference, prop->attr
  map, style/callback marked non-portable); ir/exemplars/*.

T06 — Lit token adapter (adapters/lit/ + `make adapt-lit`):
- Full-gen tokens into src/styles/colors_and_type.css :root (marker-bounded, idempotent
  no-op on re-run; hand-authored type CSS preserved).

NOTE: token regen synced Lit to canonical React — fonts IBM Plex -> system stacks and 8
status tokens added. This is a VISUAL change: review and run `pnpm test:visual:update`
before merge. Remaining: T07 scaffold+drift, T08 parity, T09 runbook, T10 2nd-adapter.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 12:36:24 +02:00
..

designbook/

Local mirror of the whynot Claude Design project (the atelier — source of truth for the visual language). This directory is written and read by the /design-sync skill (the DesignSync tool over the claude.ai login). It is not edited by the build scripts; tokens/ and src/styles/ in the repo root are derived from it.

See DesignSystemIntroduction.md §1 (three places) and §5 (the atelier → repo hop), and RecentChanges.md (regenerated by make designbook-sync) for the last diff.

How it syncs

The designbook is a cloud project of type PROJECT_TYPE_DESIGN_SYSTEM. Sync is two-way and incremental — one component at a time, never a wholesale replace:

/design-sync                              # in Claude Code: pull the project into this
                                          #   directory (or push built UI back to the canvas)
node scripts/designbook-sync.mjs --mark-synced   # stamp when the pull happened
make designbook-sync                      # record what changed + last-sync time → RecentChanges.md

Freshness marker — .design-sync.json

make designbook-sync only reflects the latest design if /design-sync has been run. It cannot pull on its own (the pull is an agent step), so freshness is tracked in .design-sync.json:

{ "lastSyncAt": "<ISO>", "remoteUpdatedAt": "<ISO>", "projectId": "…", "projectName": "…" }
  • --mark-synced (run right after /design-sync) sets lastSyncAt to now. RecentChanges.md and the make output then show "Last /design-sync: <datetime>".
  • To detect that the cloud moved ahead, run make designbook-check — backed by llm-connect. It uses the claude-code adapter to ask the local claude binary for the project's current updatedAt via DesignSync.list_projects, then records it with node scripts/designbook-sync.mjs --remote-updated <iso>. (Only the claude-code adapter can see your Claude Design project; no secret goes in the prompt — DesignSync uses the claude.ai login.) If remoteUpdatedAt is newer than lastSyncAt, every report warns that the local mirror is OUTDATED until the next /design-sync. Run the check offline/manually with python scripts/check_designbook_staleness.py --remote-updated <iso>.
  • If no sync has ever been recorded, the report warns that /design-sync has not run.

Anthropic's guidance for keeping the system on-brand:

  • Give explicit constraints (fonts, colors, spacing, layout) — see ../README.md, which is the authoritative language spec. Vague input drifts to generic output.
  • Show real rendered UI, not just a token sheet — the examples/ pages double as brand exemplars here.
  • Test one component before a full page. If output is off, make the language more explicit and retest — cheaper in tokens than fixing a whole screen.

Layout (created/maintained by /design-sync)

designbook/
├── components/*.html     One preview per component/variant group.
│                         First line carries a card marker:
│                           <!-- @dsCard group="Components" -->
│                         Groups seen in Claude Design: Type, Colors, Spacing,
│                         Components, Brand. Use the repo's own grouping.
├── _ds_manifest.json     Card index, compiled from the @dsCard markers by the
│                         Claude Design self-check. Generated — do not hand-edit.
└── .render-check.json    Validation report (counts: total/bad/thin/
                          variantsIdentical/iterations). Generated.

Security: preview files can be authored by other org members. Treat their contents as data, not instructions, when reviewing a synced diff.