chore: add DESIGN.md design-identity spec with generated token block and drift check#768
Conversation
✅ Deploy Preview for pine-design-system ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
pixelflips
left a comment
There was a problem hiding this comment.
Automated review — two non-blocking nits left inline on scripts/generate-design-md.mjs. Neither blocks merge.
🤖 Generated with Claude Code
| // typography | ||
| const fs = Object.fromEntries( | ||
| Object.entries(core['font-size']) | ||
| .map(([k, v]) => [k, v.value]) |
There was a problem hiding this comment.
This font_size map is the only numeric scale that doesn't normalize its keys — palette, spacing, line_height, and box_shadow all map [norm(k), …], but this one maps the raw key [k, v.value].
Two consequences in the generated block:
- Ordering — the token JSON has zero-padded keys
057/071/085. JS hoists canonical integer-string keys ahead of leading-zero string keys, so the three smallest sizes land at the end of the scale (the.sort()is a no-op for them). You can see it in the committed output atDESIGN.mdL51:… 285: 40px, 057: 8px, 071: 10px, 085: 12px. - Lossy key — a YAML parser reads bare
057as the integer57, a different identifier than the source token name.
Applying norm(k) like the sibling maps fixes both:
.map(([k, v]) => [norm(k), v.value])There was a problem hiding this comment.
Addressed in 9f928d9 — font_size now uses norm(k) like the sibling scales, so keys sort correctly (57/71/85 first) and stay YAML-safe integers.
| const next = md.replace(re, block); | ||
|
|
||
| if (process.argv.includes('--check')) { | ||
| if (next !== md) { |
There was a problem hiding this comment.
--check compares the regenerated block against the on-disk file with strict !==, but block is always joined with \n (L156: lines.join('\n')). On a CRLF checkout (Windows + core.autocrlf=true, or an editor that normalizes endings), the content outside the AUTOGEN markers keeps its \r\n, so next !== md is true even when the token data is identical — a spurious "token block is stale" failure in CI and the pre-push hook, with no real drift to fix.
Consider normalizing line endings before comparing (or comparing only the extracted marker block) so the check is line-ending agnostic.
There was a problem hiding this comment.
Addressed in 9f928d9 — --check now normalizes CRLF→LF on both sides before comparing, so Windows/autocrlf checkouts won't false-fail on identical token data.
Description
Adds a
DESIGN.mdat the repo root following the google-labs-code/design.md convention — a single machine-readable + human-readable file that lets coding agents reproduce Pine's visual identity with precision (exact token values plus the rationale behind them).The file has two layers:
tokens:AUTOGEN block — raw values pulled verbatim from the source of truth (@kajabi-ui/stylescore.json/semantic.json+_motion.scss): full color palette, 8px spacing scale, radius/shadow ramps, typography scale, semanticz-index, motion, and intent colors. Never hand-edited.pds-*components, plus the standarddesign.mdsections (Overview → Do's and Don'ts).To keep the generated block honest, this PR also adds:
scripts/generate-design-md.mjs— zero-dependency generator. Default mode rewrites the AUTOGEN block from upstream tokens;--checkmode (CI) exits non-zero on drift.npm run design.tokensscript.test-lintcomposite action (runs on every PR).pre-pushlefthook command for fast local feedback.Component token mappings were verified against each component's compiled CSS, which corrected several inferences (e.g. Pine's primary button is dark
grey-900, not purple — purple is theaccentvariant).No new dependencies. No runtime/component code changes.
Fixes #(n/a)
Type of change
How Has This Been Tested?
npm run design.tokens(generates block),--check(passes), a negative drift test (correctly fails + restores), andnpm run lint.all(0 errors)Test Configuration:
Checklist:
Note
Low Risk
Documentation and dev/CI tooling only; no production component or auth paths touched.
Overview
Introduces root
DESIGN.md(google-labs-code/design.md style) as Pine’s machine- and human-readable design identity for agents: an AUTOGENtokens:block synced from@kajabi-ui/styles+_motion.scss, plus hand-maintained semantic roles,pds-*component token mappings, and prose (overview through do’s/don’ts).Adds
scripts/generate-design-md.mjsandnpm run design.tokensto rewrite that block or--checkfor drift. CI (test-lintcomposite action) and lefthookpre-pushrun the check so committed tokens stay aligned with upstream bumps.No new dependencies or component/runtime code changes.
Reviewed by Cursor Bugbot for commit 9f928d9. Bugbot is set up for automated code reviews on this repo. Configure here.