designlang 12.0.0 → 12.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,454 +18,85 @@
18
18
 
19
19
  [![designlang on npm](https://pkgfolio.vercel.app/embed/pkg/designlang?v=2)](https://www.npmjs.com/package/designlang)
20
20
 
21
- **designlang** crawls any website with a headless browser, extracts every computed style from the live DOM, and generates **17+ output files**including an AI-optimized markdown file, visual HTML preview, Tailwind config, React theme, shadcn/ui theme, Figma variables, W3C design tokens, CSS custom properties, motion tokens, typed component anatomy stubs, a brand voice summary, **page intent + section roles**, **visual DNA** (material language + imagery style), **component library detection**, a **logo file**, a **multi-page consistency report**, and a **prompt pack** of ready-to-paste prompts for v0, Lovable, Cursor, and Claude Artifacts.
21
+ **designlang** points a headless browser at any URL and reads the design system off the live DOM. One command emits 17+ files — DTCG tokens, Tailwind config, shadcn theme, Figma variables, motion tokens, typed component anatomy, brand voice, page-intent labels, and a paste-ready prompt pack for v0 / Lovable / Cursor / Claude Artifacts.
22
22
 
23
- But unlike every other tool out there, it also extracts **layout patterns** (grids, flexbox, containers), **motion language** (durations, easings, springs, scroll-linked animations), **component anatomy** (slots, variant × size × state matrices), **brand voice** (tone, CTA verbs, heading style), captures **responsive behavior** across 4 breakpoints, records **interaction states** (hover, focus, active), scores **WCAG accessibility**, lints your own token files, and lets you **drift-check a codebase against a live site**, **visual-diff two URLs**, **compare multiple brands**, or **sync live sites to local tokens**.
23
+ It also goes where extractors don't: **layout patterns**, **responsive behavior across 4 breakpoints**, **hover / focus / active states**, **WCAG contrast scoring**, **multi-page consistency**, **drift checks against a live source-of-truth**, **visual-diffs**, and a **shareable graded report card**.
24
24
 
25
- ## What's New in v10 — The Intent Release
26
-
27
- Everything else captures *how* a site looks. v10 captures *what it is* — the semantic signal an LLM needs to rebuild a site faithfully instead of restyling a generic scaffold.
28
-
29
- - **Page Intent** — classifier labels the URL as `landing` / `pricing` / `docs` / `blog` / `blog-post` / `product` / `about` / `dashboard` / `auth` / `legal`, with a confidence score and rival alternates. URL + title + meta + DOM-shape signals. Heuristic-only by default; opt into `--smart` for LLM refinement.
30
- - **Section Roles** — every semantic region gets a role (`hero`, `feature-grid`, `logo-wall`, `stats`, `testimonial`, `pricing-table`, `faq`, `steps`, `comparison`, `gallery`, `bento`, `cta`, `footer`), plus reading order and extracted slot copy (headings, lede, CTA counts).
31
- - **Multi-Page Crawl** — `--full` (or `--pages <n>`) auto-discovers the site's own canonical pages from its nav (pricing/docs/blog/about/product) and runs the full pipeline on each, then emits a cross-page consistency report — shared tokens, per-page uniques, and pairwise Jaccard scores. LLMs get a real design language, not just a homepage snapshot.
32
- - **Material Language** — classifies the visual vocabulary as `glassmorphism` / `neumorphism` / `flat` / `brutalist` / `skeuomorphic` / `material-you` / `soft-ui` / `mixed` from shadow complexity, backdrop-filter usage, saturation, and geometry.
33
- - **Imagery Style** — fingerprints the images: `photography` / `3d-render` / `isometric` / `flat-illustration` / `gradient-mesh` / `icon-only` / `screenshot` / `mixed`, plus dominant aspect ratio and image-radius profile.
34
- - **Component Library Detection** — identifies `shadcn/ui`, `radix-ui`, `headlessui`, `mui`, `chakra-ui`, `mantine`, `ant-design`, `bootstrap`, `heroui`, `tailwind-ui`, `vuetify`, or plain `tailwindcss`, with evidence and alternates.
35
- - **Logo Extraction** — `--full` writes `*-logo.svg` (or `.png`) plus `*-logo.json` with dimensions, aspect, and sampled clearspace.
36
- - **Prompt Pack** — a `*-prompts/` directory with `v0.txt`, `lovable.txt`, `cursor.md`, `claude-artifacts.md`, and atomic `recipe-<component>.md` cards — tokens, section order, voice, and library inlined so one paste is enough.
37
- - **`--smart` mode** — when a heuristic classifier returns low confidence, fall back to a small LLM call (uses `OPENAI_API_KEY` or `ANTHROPIC_API_KEY` from env). Completely optional — no key, no behavior change.
38
-
39
- ## What's New in v9 — The Motion & Voice Release
40
-
41
- - **Motion Language** — durations bucketed into semantic tokens (`instant`/`xs`/`sm`/`md`/`lg`/`xl`), easings classified into families (ease-out, spring-overshoot, steps), scroll-linked animation detection (`animation-timeline`, `view-timeline-name`), keyframe kind classification (slide / fade / reveal / rotate / scale / pulse), and a `feel` fingerprint — *springy*, *responsive*, *smooth*, *mechanical*, or *mixed*.
42
- - **Component Anatomy v2** — every component cluster is now an *anatomy tree* with slots (label, icon, badge, heading, media), variant × size × state matrices, and an emitted `*-anatomy.tsx` file of typed React stubs you can wire into your design system.
43
- - **Brand Voice** — extracts tone (friendly / formal / technical / playful / neutral), pronoun posture (`we→you` / `you-only` / `we-only` / `third-person`), heading style (Title Case / Sentence case / all-lowercase), top CTA verbs, and a microcopy inventory. Feeds LLMs the *voice*, not just the paint.
44
- - **`designlang lint`** — audit your own `design-tokens.json` (DTCG or flat) or `variables.css` for color sprawl, spacing-scale drift, radius/shadow bloat, and WCAG fg/bg contrast fails. Exits non-zero on errors — CI-ready.
45
- - **`designlang drift`** — point at a live site, pass your local token file, and get a verdict: `in-sync` / `minor-drift` / `notable-drift` / `major-drift`. Integrates cleanly with the existing GitHub Action.
46
- - **`designlang visual-diff`** — capture two URLs side-by-side and emit a single-file HTML report with component screenshots, file-size deltas, and changed color tokens. No heavy pixel-diff dependencies — runs in pure Node + Playwright.
47
-
48
- ## Quick Start
25
+ ## Quick start
49
26
 
50
27
  ```bash
51
- npx designlang https://stripe.com
28
+ npx designlang https://stripe.com # extract everything
29
+ npx designlang grade https://stripe.com --badge # report card + SVG badge ← v12.2
30
+ npx designlang battle stripe.com vercel.com # head-to-head graded fight ← v12.2
31
+ npx designlang clone https://stripe.com # working Next.js starter
32
+ npx designlang --full https://stripe.com # screenshots + responsive + interactions
52
33
  ```
53
34
 
54
- Get everything at once:
35
+ Drop a live design-score badge in any README:
55
36
 
56
- ```bash
57
- npx designlang https://stripe.com --full
37
+ ```markdown
38
+ ![Design Score](https://designlang.app/badge/stripe.com.svg)
58
39
  ```
59
40
 
60
- ## What You Get (11+ Files)
61
-
62
- | File | What it is |
63
- |------|------------|
64
- | `*-design-language.md` | AI-optimized markdown — feed it to any LLM to recreate the design |
65
- | `*-preview.html` | Visual report with swatches, type scale, shadows, a11y score |
66
- | `*-design-tokens.json` | [W3C Design Tokens](https://design-tokens.github.io/community-group/format/) format |
67
- | `*-tailwind.config.js` | Drop-in Tailwind CSS theme |
68
- | `*-variables.css` | CSS custom properties |
69
- | `*-figma-variables.json` | Figma Variables import (with dark mode support) |
70
- | `*-theme.js` | React/CSS-in-JS theme (Chakra, Stitches, Vanilla Extract) |
71
- | `*-shadcn-theme.css` | shadcn/ui globals.css variables |
72
- | `*-motion-tokens.json` | **(v9)** Motion tokens — durations, easings, springs, scroll-linked flag |
73
- | `*-anatomy.tsx` | **(v9)** Typed React stubs for every detected component + variants |
74
- | `*-voice.json` | **(v9)** Brand voice fingerprint — tone, CTA verbs, heading style |
75
-
76
- The markdown output has **19 sections**: Color Palette, Typography, Spacing, Border Radii, Box Shadows, CSS Custom Properties, Breakpoints, Transitions & Animations, Component Patterns (with full CSS snippets), Layout System, Responsive Design, Interaction States, Accessibility (WCAG 2.1), Gradients, Z-Index Map, SVG Icons, Font Files, Image Style Patterns, and Quick Start.
77
-
78
- In v7 a companion `*-mcp.json` file is also written alongside the 8 outputs so that `designlang mcp` can serve regions, components, and health data from disk on later invocations. Opting into `--platforms <csv>` additively emits `ios/`, `android/`, `flutter/`, and/or `wordpress-theme/` directories in the output folder, and `--emit-agent-rules` adds a `.cursor/`, `.claude/`, `CLAUDE.md.fragment`, and `agents.md` set.
79
-
80
41
  ## Install
81
42
 
82
43
  ```bash
83
- # Use directly (no install needed)
84
- npx designlang https://example.com
85
-
86
- # Or install globally
87
- npm install -g designlang
88
-
89
- # As an agent skill (Claude Code, Cursor, Codex, 40+ agents)
90
- npx skills add Manavarya09/design-extract
91
- ```
92
-
93
- ## What Makes This Different
94
-
95
- Most design extraction tools give you colors and fonts. That's it. designlang fills 5 market gaps that no other tool addresses:
96
-
97
- ### 1. Layout System Extraction
98
-
99
- Extracts the structural skeleton — grid column patterns, flex direction usage, container widths, gap values, and justify/align patterns.
100
-
101
- ```
102
- Layout: 55 grids, 492 flex containers
44
+ npm i -g designlang # global
45
+ npx skills add Manavarya09/design-extract # as an agent skill (40+ agents)
103
46
  ```
104
47
 
105
- Every other tool gives you the paint. designlang gives you the architecture.
106
-
107
- ### 2. Responsive Multi-Breakpoint Capture
108
-
109
- Crawls the site at 4 viewports (mobile, tablet, desktop, wide) and maps exactly what changes:
110
-
111
- ```bash
112
- designlang https://vercel.com --responsive
113
- ```
114
-
115
- ```
116
- Responsive: 4 viewports, 3 breakpoint changes
117
- 375px → 768px: Nav visibility hidden → visible, Hamburger shown → hidden
118
- 768px → 1280px: Max grid columns 1 → 3, H1 size 32px → 48px
119
- ```
120
-
121
- No other tool captures how the design *adapts*, just how it looks at one size.
122
-
123
- ### 3. Interaction State Capture
124
-
125
- Programmatically hovers and focuses interactive elements, capturing the actual style transitions:
126
-
127
- ```bash
128
- designlang https://stripe.com --interactions
129
- ```
130
-
131
- ```css
132
- /* Button Hover */
133
- background-color: rgb(83, 58, 253) → rgb(67, 47, 202);
134
- box-shadow: none → 0 4px 12px rgba(83, 58, 253, 0.4);
135
-
136
- /* Input Focus */
137
- border-color: rgb(200, 200, 200) → rgb(83, 58, 253);
138
- outline: none → 2px solid rgb(83, 58, 253);
139
- ```
140
-
141
- ### 4. Live Site Sync
142
-
143
- Treat the deployed site as your source of truth, not Figma:
144
-
145
- ```bash
146
- designlang sync https://stripe.com --out ./src/tokens
147
- ```
148
-
149
- Detects design changes and auto-updates your local `design-tokens.json`, `tailwind.config.js`, and `variables.css`.
150
-
151
- ### 5. Multi-Brand Comparison
152
-
153
- Compare N brands side-by-side:
154
-
155
- ```bash
156
- designlang brands stripe.com vercel.com github.com linear.app
157
- ```
158
-
159
- Generates a matrix with color overlap analysis, typography comparison, spacing systems, and accessibility scores. Outputs both `brands.md` and `brands.html`.
160
-
161
- ### 6. Clone Command
162
-
163
- Generate a working Next.js app with the extracted design applied:
164
-
165
- ```bash
166
- designlang clone https://stripe.com
167
- cd cloned-design && npm install && npm run dev
168
- ```
169
-
170
- One command → a running app with the site's colors, fonts, spacing, and component patterns.
171
-
172
- ### 7. Design System Scoring
173
-
174
- Rate any site's design quality across 7 categories:
175
-
176
- ```bash
177
- designlang score https://vercel.com
178
- ```
179
-
180
- ```
181
- 68/100 Grade: D
182
-
183
- Color Discipline ██████████░░░░░░░░░░ 50
184
- Typography ██████████████░░░░░░ 70
185
- Spacing System ████████████████░░░░ 80
186
- Shadows ██████████░░░░░░░░░░ 50
187
- Border Radii ████████░░░░░░░░░░░░ 40
188
- Accessibility ███████████████████░ 94
189
- Tokenization ████████████████████ 100
190
- ```
191
-
192
- ### 8. Watch Mode
193
-
194
- Monitor a site for design changes:
195
-
196
- ```bash
197
- designlang watch https://stripe.com --interval 60
198
- ```
199
-
200
- Checks hourly and alerts when colors, fonts, or accessibility scores change.
201
-
202
- ### 9. Apply Command (NEW in v5)
203
-
204
- Extract a site's design and write tokens directly into your project — auto-detects your framework:
205
-
206
- ```bash
207
- designlang apply https://stripe.com --dir ./my-app
208
- ```
209
-
210
- Detects Tailwind, shadcn/ui, or plain CSS and writes to the right config files automatically.
211
-
212
- ### 10. Auth Extraction (NEW in v5)
213
-
214
- Extract from authenticated or protected pages with cookies and custom headers:
215
-
216
- ```bash
217
- designlang https://internal-app.com --cookie "session=abc123" --header "Authorization:Bearer token"
218
- ```
219
-
220
- ### 11. Gradient Extraction (NEW in v5)
221
-
222
- Detects all CSS gradients — type (linear/radial/conic), direction, color stops, and classifies them as subtle, brand, bold, or complex.
223
-
224
- ### 12. Z-Index Map (NEW in v5)
225
-
226
- Builds a layer hierarchy from all z-index values, groups them into layers (base, sticky, dropdown, modal, etc.), and flags z-index wars or excessive values (>9999).
227
-
228
- ### 13. SVG Icon Extraction (NEW in v5)
229
-
230
- Finds and deduplicates all inline SVGs, classifies them by size and style (outline/solid/duotone), and extracts the icon color palette.
231
-
232
- ### 14. Font File Detection (NEW in v5)
233
-
234
- Identifies every font source — Google Fonts, self-hosted, CDN, or system — and generates ready-to-use `@font-face` CSS.
235
-
236
- ### 15. Image Style Patterns (NEW in v5)
237
-
238
- Detects image aspect ratios, border treatments, filters, and classifies patterns like avatar, hero, thumbnail, and gallery.
239
-
240
- ### 16. Dark Mode Diffing (NEW in v5)
241
-
242
- Compare light and dark mode side-by-side — see exactly which colors change and which CSS variables are overridden:
243
-
244
- ```bash
245
- designlang https://vercel.com --dark
246
- ```
48
+ ## What you get
247
49
 
248
- ### 17. MCP Server (NEW in v7)
50
+ Each run writes 17+ files to `./design-extract-output/`. The headline outputs:
249
51
 
250
- One-command integration with any MCP-aware AI agent (Cursor, Claude Code, Windsurf, and more):
251
-
252
- ```bash
253
- designlang mcp --output-dir ./design-extract-output
254
- ```
255
-
256
- Launches a stdio JSON-RPC server that exposes the extracted design as MCP resources and tools.
257
-
258
- **Resources:**
259
-
260
- - `designlang://tokens/primitive`primitive token layer
261
- - `designlang://tokens/semantic` semantic token layer (with DTCG alias references)
262
- - `designlang://regions` classified page regions (nav, hero, pricing, etc.)
263
- - `designlang://components` reusable component clusters with variants
264
- - `designlang://health` CSS health audit
265
-
266
- **Tools:**
267
-
268
- - `search_tokens` — query tokens by name, value, or type
269
- - `find_nearest_color` snap any color to the nearest palette token
270
- - `get_region` — fetch a classified region by name
271
- - `get_component` fetch a component cluster by id
272
- - `list_failing_contrast_pairs` — list every WCAG-failing fg/bg pair with remediation suggestions
273
-
274
- ### 18. Multi-Platform Output (NEW in v7)
275
-
276
- Emit iOS SwiftUI, Android Compose, Flutter, and WordPress block-theme files in a single run, in addition to the default web output:
277
-
278
- ```bash
279
- designlang https://stripe.com --platforms all
280
- ```
281
-
282
- Resulting tree:
283
-
284
- ```
285
- design-extract-output/
286
- ├── stripe-com-*.{md,json,css,js,html} (default web output)
287
- ├── ios/
288
- │ └── DesignTokens.swift
289
- ├── android/
290
- ├── Theme.kt
291
- │ ├── colors.xml
292
- │ └── dimens.xml
293
- ├── flutter/
294
- │ └── design_tokens.dart (+ buildDesignlangTheme())
295
- └── wordpress-theme/
296
- ├── theme.json
297
- ├── style.css
298
- ├── functions.php
299
- ├── index.php
300
- └── templates/index.html
301
- ```
302
-
303
- Values for `--platforms` are any comma-separated subset of `web,ios,android,flutter,wordpress,all`. The flag is additive — the default web output is always emitted.
304
-
305
- ### 19. Agent Rules Emitter (NEW in v7)
306
-
307
- Write agent-facing rule files generated from the resolved semantic tokens:
308
-
309
- ```bash
310
- designlang https://stripe.com --emit-agent-rules
311
- ```
312
-
313
- Writes:
314
-
315
- - `.cursor/rules/designlang.mdc` — Cursor rule
316
- - `.claude/skills/designlang/SKILL.md` — Claude Code skill
317
- - `CLAUDE.md.fragment` — snippet you can paste into your project's CLAUDE.md
318
- - `agents.md` — generic, vendor-neutral agent guidance
319
-
320
- Each file is templated from the semantic layer of the extracted token set, so the agent sees real token names and values — not placeholders.
321
-
322
- ### 20. Stack + Tailwind Fingerprint (NEW in v7)
323
-
324
- Automatic framework, utility-class, and analytics detection surfaced on `design.stack`:
325
-
326
- - **Framework**: Next.js, Nuxt, Gatsby, Remix, Astro, Shopify, WordPress, Framer, Webflow, and more.
327
- - **Tailwind**: when Tailwind is in use, records utility-class frequency so you see which utilities drive the design.
328
- - **Analytics**: inventory of analytics scripts — GA4, Plausible, PostHog, Segment, Mixpanel, Amplitude, and friends.
329
-
330
- ### 21. CSS Health Audit (NEW in v7)
331
-
332
- A dedicated audit pass surfaced on `design.cssHealth`:
333
-
334
- - Specificity graph (distribution, hotspots)
335
- - `!important` count
336
- - Duplicate declarations
337
- - Unused CSS via the Playwright Coverage API
338
- - `@keyframes` catalog
339
- - Vendor-prefix audit
340
-
341
- Also contributes a `cssHealth` dimension to the overall design score.
342
-
343
- ### 22. Chrome Extension (NEW in v7.1)
344
-
345
- A Manifest-v3 popup lives in [`chrome-extension/`](chrome-extension/). One click on any tab opens `designlang.manavaryasingh.com` with the URL prefilled — no copy-paste, no context switch. There is also a **Copy CLI** button that puts `npx designlang <url>` in your clipboard.
346
-
347
- - **Permissions:** `activeTab` only, plus host access to the hosted extractor.
348
- - **Install:** toggle developer mode at `chrome://extensions`, click *Load unpacked*, pick the `chrome-extension/` folder.
349
- - **Firefox + Edge** work with the same MV3 manifest.
350
-
351
- ### 24. Motion Language (NEW in v9)
352
-
353
- Extracts the full motion fingerprint, not just transition strings:
354
-
355
- ```bash
356
- designlang https://linear.app
357
- # emits linear-app-motion-tokens.json
358
- ```
359
-
360
- ```
361
- Motion: feel = springy, 2 spring easings, scroll-linked = yes
362
- Durations: instant (80ms), xs (150ms), sm (220ms), md (380ms)
363
- Easings: ease-out (61%), spring-overshoot (18%), ease-in-out (21%)
364
- Keyframes: fade-up (slide-y, used 18x), scale-in (reveal, used 4x)
365
- ```
366
-
367
- ### 25. Component Anatomy v2 (NEW in v9)
368
-
369
- Every detected component becomes an anatomy tree with typed React stubs:
370
-
371
- ```bash
372
- designlang https://stripe.com
373
- # emits stripe-com-anatomy.tsx
374
- ```
375
-
376
- ```tsx
377
- export interface ButtonProps {
378
- variant?: 'primary' | 'secondary' | 'ghost';
379
- size?: 'sm' | 'md' | 'lg';
380
- disabled?: boolean;
381
- leadingIcon?: React.ReactNode;
382
- badge?: React.ReactNode;
383
- children?: React.ReactNode;
384
- }
385
- ```
386
-
387
- ### 26. Brand Voice (NEW in v9)
388
-
389
- Pulls the voice alongside the visual:
390
-
391
- ```bash
392
- designlang https://vercel.com
393
- # emits vercel-com-voice.json + a Brand Voice section in the markdown
394
- ```
395
-
396
- ```
397
- Tone: technical · Pronoun: we→you · Headings: Sentence case (tight)
398
- Top CTA verbs: start (14), get (8), deploy (5), try (3)
399
- Sample headings:
400
- > Develop. Preview. Ship.
401
- > The React framework for the web.
402
- ```
403
-
404
- ### 27. `designlang lint` — Token Quality Linter (NEW in v9)
405
-
406
- Audit your own token file with the same rules the scorer runs against live sites:
407
-
408
- ```bash
409
- designlang lint ./src/tokens/design-tokens.json
410
- ```
411
-
412
- ```
413
- Score: 74/100 Grade: C Tokens: 126
414
-
415
- colorDiscipline ██████████████░░░░░░ 72
416
- spacingSystem ████████████████░░░░ 84
417
- borderRadii ████████████░░░░░░░░ 60
418
- shadows ██████████░░░░░░░░░░ 50
419
- accessibility █████████████████░░░ 88
420
-
421
- WARN [color-sprawl] 3 near-duplicate color pair(s) within 8 RGB units
422
- ERROR [contrast-wcag-aa] 2 fg/bg pair(s) fail WCAG AA (4.5:1)
423
- ```
424
-
425
- Exits non-zero on any `error`-level finding — drop into CI.
426
-
427
- ### 28. `designlang drift` — Codebase ↔ Live Site Sync Check (NEW in v9)
428
-
429
- Point at a deployed site, pass your local tokens, and get a verdict:
430
-
431
- ```bash
432
- designlang drift https://yourapp.com --tokens ./src/tokens.json --tolerance 8
433
- ```
434
-
435
- ```
436
- Verdict: notable-drift (drift ratio: 0.24)
437
-
438
- | token | local | nearest live | Δ |
439
- |----------------|----------|--------------------|----|
440
- | color.primary | #4338CA | #5B4CF5 (primary) | 22 |
441
- | color.border | #D4D4D8 | #E5E5EA (surface) | 18 |
442
- ```
443
-
444
- Configurable `--fail-on <level>` for CI: `minor-drift` / `notable-drift` / `major-drift`.
445
-
446
- ### 29. `designlang visual-diff` — Two-URL Side-by-Side (NEW in v9)
447
-
448
- Capture screenshots + token deltas for two URLs in a single self-contained HTML report:
449
-
450
- ```bash
451
- designlang visual-diff https://staging.app.com https://app.com
452
- ```
453
-
454
- Emits `visual-diff-<timestamp>.html` with embedded images (base64), file-size deltas, and a changed-color-tokens table. Nothing else to serve — just open the file.
455
-
456
- ### 30. Better Auth + Network Control (v7.1)
457
-
458
- Extracting from authenticated, self-signed, or non-default environments now takes one flag:
459
-
460
- - **`--cookie-file <path>`** — loads cookies from JSON array, Playwright `storageState.json`, or Netscape `cookies.txt` (browser extensions, curl exports). Merges cleanly with the existing `--cookie name=value` flag.
461
- - **`--insecure`** — ignore HTTPS/SSL certificate errors for self-signed dev servers, corporate staging, or MITM tools.
462
- - **`--user-agent <ua>`** — override the browser User-Agent string.
463
-
464
- ```bash
465
- designlang https://staging.internal --cookie-file ./session.json --insecure
466
- ```
467
-
468
- ## All Features
52
+ | File | What it is |
53
+ |---|---|
54
+ | `*-design-language.md` | 19-section markdown — feed any LLM to recreate the design |
55
+ | `*-design-tokens.json` | W3C DTCG tokens (primitive + semantic + composite layers) |
56
+ | `*-tailwind.config.js` | Drop-in Tailwind theme |
57
+ | `*-shadcn-theme.css` | shadcn/ui `globals.css` variables |
58
+ | `*-figma-variables.json` | Figma Variables import (light + dark) |
59
+ | `*-variables.css` | CSS custom properties |
60
+ | `*-anatomy.tsx` | Typed React stubs for every detected component + variants |
61
+ | `*-motion-tokens.json` | Durations, easings, springs, scroll-linked flag |
62
+ | `*-voice.json` | Brand voice tone, pronoun posture, CTA verbs |
63
+ | `*-prompts/` | Paste-ready prompts for v0, Lovable, Cursor, Claude Artifacts |
64
+ | `*-mcp.json` | Disk-backed MCP server payload |
65
+ | `*-grade.html` | **v12.1** Shareable Design Report Card (letter grade + evidence) |
66
+ | `*-grade.svg` | **v12.2** Shields.io-style design-score badge (drop into any README) |
67
+ | `*-battle.html` | **v12.2** Head-to-head graded battle card from `designlang battle` |
68
+
69
+ Multi-platform (`--platforms web,ios,android,flutter,wordpress,all`) adds `ios/`, `android/`, `flutter/`, and a WordPress block theme. `--emit-agent-rules` adds Cursor / Claude Code / generic agent rule files.
70
+
71
+ ## Why designlang vs anything else
72
+
73
+ Other tools give you the paint. designlang reads the architecture:
74
+
75
+ - **Layout system** — grids, flex containers, container widths, gaps — not just tokens.
76
+ - **Responsive** crawls 4 breakpoints and reports what changes (`--responsive`).
77
+ - **Interaction states** — programmatically hovers and focuses, captures the deltas (`--interactions`, `--deep-interact`).
78
+ - **Motion language** durations, easing families, spring detection, scroll-linked flag, `feel` fingerprint (springy / smooth / mechanical / mixed).
79
+ - **Component anatomy** — slot trees with variant × size × state matrices, emitted as typed `.tsx`.
80
+ - **Brand voice** — tone, pronoun posture, heading style, CTA verb inventory.
81
+ - **Page intent + section roles** — `landing` / `pricing` / `docs` etc., with semantic regions (`hero`, `feature-grid`, `pricing-table`, `cta`…).
82
+ - **Multi-page consistency** — auto-discovers canonical pages, reconciles shared vs per-route tokens.
83
+ - **WCAG** — every fg/bg pair scored, with a remediation palette suggesting nearest passing colors.
84
+ - **Drift + lint + visual-diff** — `designlang drift`, `lint`, `visual-diff` all CI-ready, exit non-zero on failure.
85
+ - **Live-site sync** — treat the deployed site as source of truth (`designlang sync`).
86
+ - **MCP server** — `designlang mcp` exposes tokens, regions, components, and contrast pairs to any MCP-aware agent.
87
+
88
+ ```bash
89
+ designlang grade https://stripe.com # ← v12.1: shareable report card
90
+ designlang clone https://stripe.com # → working Next.js app
91
+ designlang apply https://stripe.com -d ./app # auto-detect framework, write tokens
92
+ designlang brands stripe.com vercel.com linear.app # N-brand matrix
93
+ designlang drift https://yourapp.com --tokens ./src/tokens.json
94
+ designlang lint ./src/tokens/design-tokens.json # CI-ready linter
95
+ designlang visual-diff https://staging.app https://app # single-file HTML diff
96
+ designlang mcp # stdio MCP server for Cursor / Claude Code
97
+ ```
98
+
99
+ ## All features
469
100
 
470
101
  | Feature | Flag / Command | Description |
471
102
  |---------|---------------|-------------|
@@ -492,6 +123,9 @@ designlang https://staging.internal --cookie-file ./session.json --insecure
492
123
  | Apply | `designlang apply <url>` | Auto-detect framework and write tokens to your project |
493
124
  | Clone | `designlang clone <url>` | Generate a working Next.js starter with extracted design |
494
125
  | Score | `designlang score <url>` | Rate design quality with visual bar chart breakdown |
126
+ | Grade (v12.1) | `designlang grade <url>` | Shareable HTML "Design Report Card" — letter grade, 8 dimensions, evidence, strengths + fixes |
127
+ | Battle (NEW v12.2) | `designlang battle <A> <B>` | Head-to-head graded battle card with verdict, dimension table, palette comparison |
128
+ | Badge (NEW v12.2) | `designlang grade --badge` | Shields.io-style SVG badge — `design · B · 87` — drop into any README. Live endpoint: `designlang.app/badge/<host>.svg` |
495
129
  | Watch | `designlang watch <url>` | Monitor for design changes on interval |
496
130
  | Diff | `designlang diff <A> <B>` | Compare two sites (MD + HTML) |
497
131
  | Multi-brand | `designlang brands <urls...>` | N-site comparison matrix |
@@ -544,6 +178,8 @@ Commands:
544
178
  apply <url> Extract and apply design directly to your project
545
179
  clone <url> Generate a working Next.js starter from extracted design
546
180
  score <url> Rate design quality (7 categories, A-F, bar chart)
181
+ grade <url> Generate a shareable HTML Design Report Card (--format html|md|json|svg|all, --badge, --open)
182
+ battle <urlA> <urlB> Head-to-head graded battle card (--format html|md|json|all, --open)
547
183
  watch <url> Monitor for design changes on interval
548
184
  diff <urlA> <urlB> Compare two sites' design languages
549
185
  brands <urls...> Multi-brand comparison matrix
@@ -555,56 +191,26 @@ Commands:
555
191
  visual-diff <before> <after> (v9) Side-by-side HTML diff of two URLs
556
192
  ```
557
193
 
558
- ## Example Output
194
+ ## Example output
559
195
 
560
- Running `designlang https://vercel.com --full`:
196
+ `designlang https://vercel.com --full` →
561
197
 
562
198
  ```
563
- designlang
564
- https://vercel.com
565
-
566
- Output files:
567
- ✓ vercel-com-design-language.md (32.6KB)
568
- vercel-com-design-tokens.json (5.6KB)
569
- vercel-com-tailwind.config.js (3.4KB)
570
- ✓ vercel-com-variables.css (18.6KB)
571
- ✓ vercel-com-preview.html (31.8KB)
572
- ✓ vercel-com-figma-variables.json (12.4KB)
573
- ✓ vercel-com-theme.js (1.4KB)
574
- ✓ vercel-com-shadcn-theme.css (477B)
575
- ✓ screenshots/button.png
576
- ✓ screenshots/card.png
577
- ✓ screenshots/nav.png
578
- ✓ screenshots/hero.png
579
- ✓ screenshots/full-page.png
580
-
581
- Summary:
582
- Colors: 27 unique colors
583
- Fonts: Geist, Geist Mono
584
- Spacing: 18 values (base: 2px)
585
- Shadows: 11 unique shadows
586
- Radii: 10 unique values
587
- Breakpoints: 45 breakpoints
588
- Components: 11 types detected (with CSS snippets)
589
- CSS Vars: 407 custom properties
590
- Layout: 55 grids, 492 flex containers
591
- Gradients: 4 unique gradients
592
- Z-Index: 8 layers mapped
593
- Icons: 23 unique SVGs
594
- Font Files: 4 font sources detected
595
- Images: 6 style patterns
596
- Responsive: 4 viewports, 3 breakpoint changes
597
- Interactions: 8 state changes captured
598
- A11y: 94% WCAG score (7 failing pairs)
599
- Design Score: 68/100 (D) — 4 issues
199
+ Colors: 27 · Fonts: Geist + Geist Mono · Spacing: 18 (base 2px)
200
+ Shadows: 11 · Radii: 10 · CSS vars: 407 · Layout: 55 grids / 492 flex
201
+ Responsive: 4 viewports, 3 breakpoint changes · Interactions: 8 transitions
202
+ A11y: 94% WCAG · Score: 68/100 (D) · 4 issues
203
+
204
+ 17 files written to ./design-extract-output/
205
+ Run `designlang grade https://vercel.com` for a shareable report card
600
206
  ```
601
207
 
602
- ## How It Works
208
+ ## How it works
603
209
 
604
- 1. **Crawl** — Launches headless Chromium via Playwright, waits for network idle and fonts
605
- 2. **Extract** — Single `page.evaluate()` walks up to 5,000 DOM elements collecting 25+ computed style properties, layout data, inline SVGs, font sources, and image metadata
606
- 3. **Process** — 17 extractor modules parse, deduplicate, cluster, and classify the raw data (including gradients, z-index layers, icons, fonts, and image patterns)
607
- 4. **Format** — 8 formatter modules generate output files
210
+ 1. **Crawl** — Headless Chromium via Playwright, waits for network idle and fonts
211
+ 2. **Extract** — One `page.evaluate()` walks up to 5,000 DOM elements, collecting 25+ computed properties, inline SVGs, font sources, and image metadata
212
+ 3. **Process** — 17 extractor modules parse, deduplicate, cluster, and classify the raw data
213
+ 4. **Format** — 12+ formatter modules emit the output files
608
214
  5. **Score** — Accessibility extractor calculates WCAG contrast ratios for all color pairs
609
215
  6. **Capture** — Optional: screenshots, responsive viewport crawling, interaction state recording
610
216