Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
429d5d2
feat(colors): ramps and pairs as schema primitives (#1)
claude Apr 26, 2026
de3bfac
feat(linter): expand component property vocabulary (#2)
claude Apr 26, 2026
2211a69
Merge pull request #10 from joesteinkamp/claude/plan-issue-solutions-…
joesteinkamp Apr 26, 2026
898ca24
Merge remote-tracking branch 'origin/main' into claude/implement-issu…
claude Apr 26, 2026
e1ed855
feat: first-class component states with inheritance and a11y rules
claude Apr 26, 2026
667740d
Merge pull request #11 from joesteinkamp/claude/implement-issue-2-pla…
joesteinkamp Apr 26, 2026
93b9aaf
feat(linter): add prose-token-mismatch rule with comment-directive su…
claude Apr 26, 2026
81f858d
Merge pull request #13 from joesteinkamp/claude/design-md-plan-4-oYArp
joesteinkamp Apr 26, 2026
00fb6ae
merge: integrate main (typed properties, ramps/pairs) into states branch
claude Apr 26, 2026
66f0271
merge: resolve conflicts integrating origin/main into states branch
claude Apr 26, 2026
ef0d6b2
Merge pull request #14 from joesteinkamp/claude/fix-merge-conflicts-c…
joesteinkamp Apr 26, 2026
9fdb0a3
feat(linter): component registry + closed-world rules (#6)
claude Apr 26, 2026
6d2cc04
merge: integrate origin/main (component states) into registry branch
claude Apr 26, 2026
13d785c
Merge pull request #15 from joesteinkamp/claude/implement-issue-6-pla…
joesteinkamp Apr 26, 2026
34a10f0
feat: add motion and iconography token primitives
claude Apr 26, 2026
7190a58
merge: resolve conflicts integrating origin/main (states + registry)
claude Apr 26, 2026
c16e8e5
Merge pull request #16 from joesteinkamp/claude/implement-issue-5-pla…
joesteinkamp Apr 26, 2026
4d00286
feat(voice+copy): add `voice:` and `copy:` primitives + content linte…
claude Apr 26, 2026
df11686
feat(themes): first-class theme primitive (dark / high-contrast / den…
claude Apr 26, 2026
c439784
Merge pull request #18 from joesteinkamp/claude/issue-7-run-plan-5M6nM
joesteinkamp Apr 26, 2026
f3e3081
merge: integrate origin/main (themes, motion, iconography) into voice…
claude Apr 26, 2026
0bc9637
Merge pull request #17 from joesteinkamp/claude/issue-8-run-plan-eWlEm
joesteinkamp Apr 26, 2026
1307ffd
feat(layout): responsive, grid, page templates, layout rules (#9)
claude Apr 26, 2026
bcc37a1
Merge pull request #19 from joesteinkamp/claude/design-md-plan-9-dSq2p
joesteinkamp Apr 26, 2026
bf9918d
feat: accept modern color formats, expand sub-tokens, wire up fixer
claude Apr 27, 2026
f760ab6
Merge remote-tracking branch 'origin/main' into claude/review-impecca…
claude Apr 27, 2026
d6d6ac7
Merge pull request #20 from joesteinkamp/claude/review-impeccable-sty…
joesteinkamp Apr 27, 2026
7a95a1e
feat(evals): sketch eval harness for DESIGN.md fidelity
claude Apr 29, 2026
c27d968
Merge pull request #21 from joesteinkamp/claude/add-validation-testin…
joesteinkamp May 2, 2026
5ce5bc7
feat: migrate Tailwind config to v4 CSS @theme
claude May 2, 2026
8ab5285
refactor(tailwind-css): emit shadcn-style :root + @theme inline
claude May 2, 2026
bb1d696
Merge pull request #22 from joesteinkamp/claude/migrate-tailwind-v4-5…
joesteinkamp May 2, 2026
e70c874
tailwind: rename pair foregrounds to shadcn `<pair>-foreground` conve…
claude May 2, 2026
939d923
tailwind: emit shadcn header prelude and lift radius into :root indir…
claude May 2, 2026
356305e
tailwind: rename M3-flat `on-<x>` to `<x>-foreground` when sibling ex…
claude May 2, 2026
de0cce1
Merge pull request #23 from joesteinkamp/claude/document-token-storag…
joesteinkamp May 2, 2026
b3dbe3d
evals: add copy/semantic/vision layers on top of token extraction
claude May 2, 2026
2024526
Merge pull request #24 from joesteinkamp/claude/validate-ai-output-0I8JK
joesteinkamp May 2, 2026
b4ce9bb
docs(readme): switch CLI examples to local-clone bun workflow
claude May 2, 2026
faf7126
Merge pull request #25 from joesteinkamp/claude/update-readme-lint-co…
joesteinkamp May 2, 2026
1422737
docs(readme): add fork overview section
claude May 5, 2026
8c77571
Merge pull request #26 from joesteinkamp/claude/add-fork-info-readme-…
joesteinkamp May 5, 2026
e20e18b
test(evals,tailwind): cover scoring engine and CSS renderer
claude May 12, 2026
310c7e8
Merge pull request #27 from joesteinkamp/claude/analyze-test-coverage…
joesteinkamp Jun 13, 2026
244d864
Merge upstream/main (v0.3.0) into fork
joesteinkamp Jul 24, 2026
56f9148
docs(changelog): record upstream v0.3.0 sync decisions
joesteinkamp Jul 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Change Log

AI-made changes to this fork, with the decisions behind them. Newest first.

## 2026-07-24 β€” Synced fork with upstream v0.3.0 (branch `sync/upstream-0.3.0`, Claude)

**Ask:** analyze upstream's 37-commit lead, then merge it.

**What changed:** all upstream 0.2.0/0.3.0 work merged β€” css-vars export, CSS Color
Module parser (named colors, hwb, lch, color-mix), nested token declarations with
collision detection, unknown-key / token-like-ignored lint rules, typography
sub-property warnings, export/lint exit-code fixes, TTY/ENOENT guards, Windows
`designmd` alias, PHILOSOPHY.md. Fork primitives (ramps, pairs, themes, voice,
copy, motion, iconography, layout, component states, evals) untouched.

**Why this approach:** union merges where features were additive; fork-wins on the
model pipeline and shadcn Tailwind output (deliberate fork identity), upstream-wins
on CLI exit codes, color fallback parsing, and format naming. Color support is the
union of both engines: the fork's parser (incl. display-p3) first, upstream's
`parseCssColor` as fallback.

**Considered and rejected:** adopting upstream's `tailwind`β†’`json-tailwind` alias
(would silently change fork output β€” the fork keeps `tailwind` aliased to the
shadcn-style `css-tailwind` CSS); replacing the fork's color parser wholesale with
upstream's (would lose display-p3 and the `format`/`raw` round-trip metadata).
85 changes: 59 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
# DESIGN.md

A format specification for describing a visual identity to coding agents. DESIGN.md gives agents a persistent, structured understanding of a design system.
> **About this fork**
>
> This is a fork of [google-labs-code/design.md](https://github.com/google-labs-code/design.md). Upstream defines the core DESIGN.md format and a linter; this fork extends both to push DESIGN.md closer to a complete, agent-ready design system spec.
>
> **What changed**
>
> - **Expanded token vocabulary** β€” color ramps and semantic pairs as schema primitives, modern color formats (transparent hex, etc.), and richer component property coverage in the linter.
> - **New token domains** β€” themes (light/dark), motion, iconography, voice & copy, and a layout system (responsive breakpoints, grid, page templates, layout rules).
> - **Tailwind v4 output** β€” generator emits a shadcn-style `:root` + `@theme inline` CSS, with foreground pairs renamed to the `<pair>-foreground` convention and radius lifted into `:root`.
> - **Evaluation harness** β€” a sketch eval suite that checks DESIGN.md fidelity across copy, semantic, and vision layers on top of token extraction.
> - **Docs** β€” token-storage documentation and a local-clone `bun` CLI workflow in the README.
>
> **Why**
>
> Upstream DESIGN.md focuses on the format and a linter for it. The goal of this fork is to test whether DESIGN.md can drive *real* agent output end-to-end: enough tokens to describe a full design system (not just color/type/spacing), a generator that produces idiomatic modern CSS, and evals to measure how faithfully an agent reproduces the intended design.

## The Format

Expand Down Expand Up @@ -54,7 +68,7 @@ An agent that reads this file will produce a UI with deep ink headlines in Publi
Validate a DESIGN.md against the spec, catch broken token references, check WCAG contrast ratios, and surface structural findings β€” all as structured JSON that agents can act on.

```bash
npx @google/design.md lint DESIGN.md
bun run cli lint DESIGN.md
```

```json
Expand All @@ -73,7 +87,7 @@ npx @google/design.md lint DESIGN.md
Compare two versions of a design system to detect token-level and prose regressions:

```bash
npx @google/design.md diff DESIGN.md DESIGN-v2.md
bun run cli diff DESIGN.md DESIGN-v2.md
```

```json
Expand Down Expand Up @@ -122,7 +136,7 @@ components:

| Type | Format | Example |
|:-----|:-------|:--------|
| Color | Any CSS color (hex, `rgb()`, `oklch()`, named, etc.) | `"#1A1C1E"`, `"oklch(62% 0.18 250)"` |
| Color | any CSS color: hex, named colors, `rgb()`, `hsl()`, `hwb()`, `oklch()`, `oklab()`, `lab()`, `lch()`, `color(display-p3 …)`, `color-mix()` | `"#1A1C1E"`, `"oklch(70% 0.15 200)"` |
| Dimension | number + unit (`px`, `em`, `rem`) | `48px`, `-0.02em` |
| Token Reference | `{path.to.token}` | `{colors.primary}` |
| Typography | object with `fontFamily`, `fontSize`, `fontWeight`, `lineHeight`, `letterSpacing`, `fontFeature`, `fontVariation` | See example above |
Expand Down Expand Up @@ -157,7 +171,7 @@ components:
backgroundColor: "{colors.tertiary-container}"
```

Valid component properties: `backgroundColor`, `textColor`, `typography`, `rounded`, `padding`, `size`, `height`, `width`.
Valid component properties: `backgroundColor`, `textColor`, `typography`, `rounded`, `padding`, `size`, `height`, `width`, `gap`, `border`, `outline`, `opacity`, `boxShadow`, `transition`, `backdropFilter`.

Variants (hover, active, pressed) are expressed as separate component entries with a related key name.

Expand All @@ -175,20 +189,18 @@ Variants (hover, active, pressed) are expressed as separate component entries wi

### Installation

```bash
npm install @google/design.md
```

On **Windows**, quote the package name if your shell treats `@` specially (PowerShell, some terminals):
This fork is not published to npm. Clone the repo and install dependencies with [Bun](https://bun.sh):

```bash
npm install "@google/design.md"
git clone https://github.com/joesteinkamp/design.md.git
cd design.md
bun install
```

Or run directly (always resolves from the public npm registry):
Then run the CLI from the repo root via the `cli` script defined in `package.json`:

```bash
npx @google/design.md lint DESIGN.md
bun run cli lint DESIGN.md
```

On **Windows/PowerShell**, this direct form can produce no output (or open
Expand Down Expand Up @@ -238,24 +250,41 @@ All commands accept a file path or `-` for stdin. Output defaults to JSON.
Validate a DESIGN.md file for structural correctness.

```bash
npx @google/design.md lint DESIGN.md
npx @google/design.md lint --format json DESIGN.md
cat DESIGN.md | npx @google/design.md lint -
bun run cli lint DESIGN.md
bun run cli lint --format json DESIGN.md
cat DESIGN.md | bun run cli lint -
bun run cli lint --fix DESIGN.md # rewrite the file with auto-fixes applied
```

| Option | Type | Default | Description |
|:-------|:-----|:--------|:------------|
| `file` | positional | required | Path to DESIGN.md (or `-` for stdin) |
| `--format` | `json` | `json` | Output format |
| `--fix` | boolean | `false` | Apply auto-fixes (currently: section order) and rewrite the input file |

Exit code `1` if errors are found, `0` otherwise.

### `fix`

Apply auto-fixes to a DESIGN.md file. Today the only fix is reordering sections into the canonical order; more fixes will follow. By default the fixed content is written to stdout, leaving the input file untouched.

```bash
bun run cli fix DESIGN.md > DESIGN.fixed.md
bun run cli fix --write DESIGN.md # rewrite in place
```

| Option | Type | Default | Description |
|:-------|:-----|:--------|:------------|
| `file` | positional | required | Path to DESIGN.md (or `-` for stdin) |
| `--write` | boolean | `false` | Rewrite the input file instead of streaming to stdout |
| `--format` | `json` \| `text` | `json` | Format for the report when `--write` is used |

### `diff`

Compare two DESIGN.md files and report token-level changes.

```bash
npx @google/design.md diff DESIGN.md DESIGN-v2.md
bun run cli diff DESIGN.md DESIGN-v2.md
```

| Option | Type | Default | Description |
Expand All @@ -271,11 +300,14 @@ Exit code `1` if regressions are detected (more errors or warnings in the "after
Export DESIGN.md tokens to other formats.

```bash
npx @google/design.md export --format json-tailwind DESIGN.md > tailwind.theme.json
npx @google/design.md export --format css-tailwind DESIGN.md > theme.css
npx @google/design.md export --format dtcg DESIGN.md > tokens.json
bun run cli export --format css-tailwind DESIGN.md > theme.css
bun run cli export --format json-tailwind DESIGN.md > tailwind.theme.json
bun run cli export --format dtcg DESIGN.md > tokens.json
bun run cli export --format css-vars DESIGN.md > tokens.css
```

The `tailwind` format emits a Tailwind v4 `@theme` stylesheet β€” Tailwind v4 deprecates `tailwind.config.js` in favor of CSS-first configuration via `@theme { --color-*; --font-*; ... }`. Import the generated file from your app's main stylesheet alongside `@import "tailwindcss";`.

| Option | Type | Default | Description |
|:-------|:-----|:--------|:------------|
| `file` | positional | required | Path to DESIGN.md (or `-` for stdin) |
Expand All @@ -295,9 +327,9 @@ Exit code `0` on a successful export (regardless of any lint findings in the sou
Output the DESIGN.md format specification (useful for injecting spec context into agent prompts).

```bash
npx @google/design.md spec
npx @google/design.md spec --rules
npx @google/design.md spec --rules-only --format json
bun run cli spec
bun run cli spec --rules
bun run cli spec --rules-only --format json
```

| Option | Type | Default | Description |
Expand Down Expand Up @@ -340,9 +372,10 @@ console.log(report.designSystem); // Parsed DesignSystemState

DESIGN.md tokens are inspired by the [W3C Design Token Format](https://www.designtokens.org/). The `export` command converts tokens to other formats:

- **Tailwind v3 config (JSON)** β€” `npx @google/design.md export --format json-tailwind DESIGN.md` β€” emits a `theme.extend` JSON object for `tailwind.config.js`. `--format tailwind` is a backwards-compatible alias.
- **Tailwind v4 theme (CSS)** β€” `npx @google/design.md export --format css-tailwind DESIGN.md` β€” emits a CSS `@theme { ... }` block using Tailwind v4's CSS-variable token namespaces (`--color-*`, `--font-*`, `--text-*`, `--leading-*`, `--tracking-*`, `--font-weight-*`, `--radius-*`, `--spacing-*`).
- **DTCG tokens.json** ([W3C Design Tokens Format Module](https://tr.designtokens.org/format/)) β€” `npx @google/design.md export --format dtcg DESIGN.md`
- **Tailwind v4 theme (CSS)** β€” `bun run cli export --format css-tailwind DESIGN.md` β€” emits a shadcn-style `:root` + `@theme inline` stylesheet. `--format tailwind` is a backwards-compatible alias.
- **Tailwind v3 config (JSON)** β€” `bun run cli export --format json-tailwind DESIGN.md` β€” emits a `theme.extend` JSON object for `tailwind.config.js`.
- **CSS custom properties** β€” `bun run cli export --format css-vars DESIGN.md` β€” emits a plain `:root { --token: value }` stylesheet.
- **DTCG tokens.json** ([W3C Design Tokens Format Module](https://tr.designtokens.org/format/)) β€” `bun run cli export --format dtcg DESIGN.md`

## Status

Expand Down
Loading