designlang 12.4.0 → 12.7.1
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/.claude-plugin/marketplace.json +15 -7
- package/.claude-plugin/plugin.json +19 -8
- package/CHANGELOG.md +194 -0
- package/README.md +31 -4
- package/SUPPORT.md +22 -0
- package/bin/design-extract.js +181 -0
- package/commands/battle.md +27 -0
- package/commands/brand.md +59 -0
- package/commands/extract.md +41 -0
- package/commands/grade.md +29 -0
- package/commands/pack.md +37 -0
- package/commands/remix.md +29 -0
- package/commands/theme-swap.md +42 -0
- package/package.json +3 -3
- package/src/ci.js +36 -2
- package/src/formatters/brand-book.js +1052 -0
- package/src/formatters/theme-swap.js +272 -0
- package/src/recolor.js +199 -0
- package/src/utils/color-gamut.js +64 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Extract the complete design language from a URL — DTCG tokens, Tailwind, Figma vars, motion, voice, components.
|
|
3
|
+
argument-hint: <url> [extra flags…]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Run **designlang** against the user-provided URL and surface the result.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npx designlang $ARGUMENTS
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
If no `$ARGUMENTS` were supplied, ask the user which URL to extract.
|
|
13
|
+
|
|
14
|
+
Default output goes to `./design-extract-output/`. Once it finishes, read the generated `*-design-language.md` (the AI-optimized markdown) and present a tight summary to the user:
|
|
15
|
+
|
|
16
|
+
- Primary palette (hex codes)
|
|
17
|
+
- Type families + scale
|
|
18
|
+
- Spacing base + scale
|
|
19
|
+
- WCAG accessibility score
|
|
20
|
+
- Component patterns detected
|
|
21
|
+
- Notable signals (motion feel, material language, brand voice tone)
|
|
22
|
+
|
|
23
|
+
Then offer follow-ups:
|
|
24
|
+
|
|
25
|
+
- `/grade <url>` — shareable HTML Design Report Card + SVG badge
|
|
26
|
+
- `/battle <urlA> <urlB>` — head-to-head graded comparison
|
|
27
|
+
- `/remix <url> --as <vocab>` — restyle in another vocabulary
|
|
28
|
+
- `/pack <url>` — bundle every output into one design-system directory
|
|
29
|
+
|
|
30
|
+
Useful flags the user may pass via `$ARGUMENTS`:
|
|
31
|
+
|
|
32
|
+
| Flag | Effect |
|
|
33
|
+
|---|---|
|
|
34
|
+
| `--full` | screenshots + responsive + interactions + deep-interact |
|
|
35
|
+
| `--depth <n>` | crawl N additional canonical pages |
|
|
36
|
+
| `--dark` | also extract dark mode |
|
|
37
|
+
| `--platforms ios,android,flutter,wordpress` | multi-platform emitters |
|
|
38
|
+
| `--smart` | LLM fallback for low-confidence classifiers (needs `OPENAI_API_KEY` or `ANTHROPIC_API_KEY`) |
|
|
39
|
+
| `--cookie-file ./session.json` | authenticated extraction |
|
|
40
|
+
|
|
41
|
+
Full reference: https://github.com/Manavarya09/design-extract#full-cli-reference
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generate a shareable HTML "Design Report Card" — letter grade, 8 dimensions, evidence (palette, type, rhythm), strengths + fixes, plus an SVG badge.
|
|
3
|
+
argument-hint: <url> [--badge] [--open]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Audit the design system at the user-provided URL. Emits a self-contained HTML report card plus JSON + Markdown variants. Pass `--badge` to also emit a shields.io-style SVG you can drop into any README.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npx designlang grade $ARGUMENTS
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
If no `$ARGUMENTS` were supplied, ask the user which URL to grade.
|
|
13
|
+
|
|
14
|
+
After the run completes:
|
|
15
|
+
|
|
16
|
+
1. Read the generated `*.grade.md` file from `./design-extract-output/`
|
|
17
|
+
2. Surface the headline grade (A–F · score · 8 dimensions)
|
|
18
|
+
3. Highlight the top 3 strengths and top 3 issues from the report
|
|
19
|
+
4. Offer to open the HTML in the browser (the `--open` flag does this automatically)
|
|
20
|
+
|
|
21
|
+
If the user wants the live shareable badge URL instead of generating files locally, they can use:
|
|
22
|
+
|
|
23
|
+
```markdown
|
|
24
|
+

|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This endpoint is blob-cached 24h with edge caching for ~50ms repeat hits.
|
|
28
|
+
|
|
29
|
+
Compare two sites with `/battle <A> <B>`, restyle with `/remix`, bundle everything with `/pack`.
|
package/commands/pack.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Bundle every designlang output (DTCG tokens, Tailwind, shadcn, Figma vars, motion, anatomy, Storybook, prompts) into one polished design-system directory ready to zip and ship.
|
|
3
|
+
argument-hint: <url> [--with-clone] [--open]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Run the full extraction once and write every emitter output into a single, signed, layered directory.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npx designlang pack $ARGUMENTS
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
If no URL is provided, ask the user. Default output is `./<host>-design-system/`.
|
|
13
|
+
|
|
14
|
+
Layout produced:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
<host>-design-system/
|
|
18
|
+
├── README.md bespoke "Built from <host>" + grade + at-a-glance
|
|
19
|
+
├── LICENSE.txt provenance + usage guidance
|
|
20
|
+
├── tokens/ DTCG + Tailwind + CSS vars + Figma vars + motion + theme.js
|
|
21
|
+
├── components/ typed React stubs (anatomy.tsx)
|
|
22
|
+
├── storybook/ runnable Storybook project
|
|
23
|
+
├── starter/ minimal HTML starter wired to tokens/variables.css
|
|
24
|
+
├── prompts/ v0 / Lovable / Cursor / Claude Artifacts + named recipes/*.md
|
|
25
|
+
└── extras/ voice.json + prompt-pack.md rollup
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
After the run:
|
|
29
|
+
|
|
30
|
+
1. Surface the headline (`X files, Y KB · ./<dir>`)
|
|
31
|
+
2. Read the auto-generated `README.md` and tell the user what's inside
|
|
32
|
+
3. Suggest next steps:
|
|
33
|
+
- `cd <dir> && zip -r ../<dir>.zip .` to package for sharing
|
|
34
|
+
- `cd <dir>/storybook && npm install && npm run storybook` to run the design system locally
|
|
35
|
+
- Copy `tokens/tailwind.config.js` straight into a project
|
|
36
|
+
|
|
37
|
+
Use `--with-clone` to swap the minimal HTML starter for the full Next.js clone (slower; only when the user wants a runnable app).
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Restyle a site in another design vocabulary — brutalist, swiss, art-deco, cyberpunk, soft-ui, or editorial. Preserves page shape, swaps the visual vocabulary.
|
|
3
|
+
argument-hint: <url> --as <brutalist|swiss|art-deco|cyberpunk|soft-ui|editorial> | --all
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Restyle the page shape of an extracted site under a different visual vocabulary.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npx designlang remix $ARGUMENTS
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
If `$ARGUMENTS` is empty, ask the user for a URL and offer the six vocabularies. If only a URL is given, default to `--all` so they see every variant side by side.
|
|
13
|
+
|
|
14
|
+
The six vocabularies:
|
|
15
|
+
|
|
16
|
+
| `--as <id>` | Vibe |
|
|
17
|
+
|---|---|
|
|
18
|
+
| `brutalist` | Raw, blocky, monospace, no shadows |
|
|
19
|
+
| `swiss` | Clean grid, sans, minimal palette |
|
|
20
|
+
| `art-deco` | Geometric, gold accents, serif display |
|
|
21
|
+
| `cyberpunk` | Neon, dark, glowing CTAs |
|
|
22
|
+
| `soft-ui` | Pastel, soft shadows, generous radii |
|
|
23
|
+
| `editorial` | Newspaper feel, serif, narrow columns |
|
|
24
|
+
|
|
25
|
+
Use `--all` to emit all six in one pass — six standalone HTML files plus a comparison index.
|
|
26
|
+
|
|
27
|
+
After the run, read the comparison index (`*-remix-index.html` or `*-remix.<vocab>.html`) and tell the user which file to open. Offer to launch `--open` automatically.
|
|
28
|
+
|
|
29
|
+
Pair with `/battle` for cross-vocab fights ("Stripe-as-cyberpunk vs Vercel-as-art-deco"), or `/pack` to bundle a remixed system as a downloadable design directory.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Recolour an extracted site's design around a new brand primary. OKLCH hue rotation preserves perceptual lightness — neutrals, type, spacing, and motion stay untouched. Side-by-side HTML preview + recoloured tokens (DTCG, Tailwind, shadcn, Figma).
|
|
3
|
+
argument-hint: <url> --primary <hex> [--from <hex>] [--open]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Take any extracted site and swap its brand primary to the user-provided hex. The whole palette rotates around that hue while neutrals and structural tokens stay put.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npx designlang theme-swap $ARGUMENTS
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
If `$ARGUMENTS` doesn't contain both a URL and `--primary <hex>`, ask the user for the missing piece.
|
|
13
|
+
|
|
14
|
+
After the run completes, all output goes to `./design-extract-output/`:
|
|
15
|
+
|
|
16
|
+
- `*.themeswap.html` — editorial side-by-side preview (open this)
|
|
17
|
+
- `*.themeswap.md` — markdown diff table
|
|
18
|
+
- `*.themeswap.json` — structured before→after deltas
|
|
19
|
+
- `*.themeswap.tokens.json` — recoloured DTCG token set you can drop into a project
|
|
20
|
+
|
|
21
|
+
After the command finishes:
|
|
22
|
+
|
|
23
|
+
1. Read `*.themeswap.md` to summarise the swap (`from → to`, hue shift, count of changed colours).
|
|
24
|
+
2. Show the user the verdict line ("X colours changed, neutrals preserved, type/spacing/motion untouched").
|
|
25
|
+
3. Offer to open the HTML preview (`--open` does this automatically).
|
|
26
|
+
4. Suggest the recoloured token files as drop-ins for an existing Tailwind / shadcn project.
|
|
27
|
+
|
|
28
|
+
## Useful flags
|
|
29
|
+
|
|
30
|
+
| Flag | Effect |
|
|
31
|
+
|---|---|
|
|
32
|
+
| `--primary <hex>` | **required.** Target brand colour (e.g. `"#ff4800"`). |
|
|
33
|
+
| `--from <hex>` | Override the auto-detected source primary when the extractor misclassifies (e.g. a neutral got promoted by usage count). |
|
|
34
|
+
| `--format html\|md\|json\|tokens\|all` | Pick the output(s). Default `all`. |
|
|
35
|
+
| `--out <dir>` | Output directory. Default `./design-extract-output`. |
|
|
36
|
+
| `--open` | Open the HTML preview in your default browser. |
|
|
37
|
+
|
|
38
|
+
## Pairs nicely with
|
|
39
|
+
|
|
40
|
+
- `/grade <url>` — grade the recoloured site by feeding the same target through `/extract` then `/grade`.
|
|
41
|
+
- `/pack <url>` — bundle the recoloured tokens as a downloadable design-system folder.
|
|
42
|
+
- `/remix <url> --as <vocab>` — full vocabulary swap (brutalist, art-deco, cyberpunk…) instead of just brand colour.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "designlang",
|
|
3
|
-
"version": "12.
|
|
4
|
-
"description": "Extract the complete design language from any website and ship it
|
|
3
|
+
"version": "12.7.1",
|
|
4
|
+
"description": "Extract the complete design language from any website and ship it \u2014 clone to a working Next.js starter, guard tokens with a CI drift bot, or browse everything in a local studio. Outputs W3C DTCG tokens, motion tokens, typed anatomy stubs, Tailwind config, and ready-to-paste v0 / Lovable / Cursor / Claude-Artifacts prompts.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"designlang": "./bin/design-extract.js"
|
|
@@ -48,4 +48,4 @@
|
|
|
48
48
|
],
|
|
49
49
|
"author": "masyv",
|
|
50
50
|
"license": "MIT"
|
|
51
|
-
}
|
|
51
|
+
}
|
package/src/ci.js
CHANGED
|
@@ -32,9 +32,43 @@ export async function runCi(url, opts) {
|
|
|
32
32
|
out.push(`## designlang · design regression guard`);
|
|
33
33
|
out.push(`\n**URL:** \`${url}\` \n**Run:** ${new Date().toISOString()}\n`);
|
|
34
34
|
|
|
35
|
-
// 1. Extract
|
|
35
|
+
// 1. Extract — guard the throw site so CI artifacts never come back empty.
|
|
36
|
+
// Playwright can crash on flaky networks, ad-walled URLs, or self-signed
|
|
37
|
+
// proxies; when that happens we still want a report file + a summary.json
|
|
38
|
+
// so downstream jobs (artifact uploads, status comments, dashboards) have
|
|
39
|
+
// something to point at. We preserve the original error via `cause` so the
|
|
40
|
+
// stack survives — losing the trace was a real problem with #76's draft.
|
|
36
41
|
const { extractDesignLanguage } = await import('./index.js');
|
|
37
|
-
|
|
42
|
+
let design;
|
|
43
|
+
try {
|
|
44
|
+
design = await extractDesignLanguage(url);
|
|
45
|
+
} catch (err) {
|
|
46
|
+
const stack = err?.stack || String(err);
|
|
47
|
+
out.push(section('Extraction', [
|
|
48
|
+
`_failed — ${err.message}_`,
|
|
49
|
+
'',
|
|
50
|
+
'```',
|
|
51
|
+
stack,
|
|
52
|
+
'```',
|
|
53
|
+
].join('\n')));
|
|
54
|
+
const md = out.join('\n');
|
|
55
|
+
const mdPath = join(outDir, 'ci-report.md');
|
|
56
|
+
writeFileSync(mdPath, md, 'utf-8');
|
|
57
|
+
const summary = {
|
|
58
|
+
url,
|
|
59
|
+
score: null,
|
|
60
|
+
grade: null,
|
|
61
|
+
driftVerdict: 'unknown',
|
|
62
|
+
extractionFailed: true,
|
|
63
|
+
error: err.message,
|
|
64
|
+
timestamp: new Date().toISOString(),
|
|
65
|
+
};
|
|
66
|
+
writeFileSync(join(outDir, 'ci-summary.json'), JSON.stringify(summary, null, 2), 'utf-8');
|
|
67
|
+
if (process.env.GITHUB_STEP_SUMMARY) {
|
|
68
|
+
try { writeFileSync(process.env.GITHUB_STEP_SUMMARY, md, { flag: 'a' }); } catch {}
|
|
69
|
+
}
|
|
70
|
+
return { mdPath, md, summary, shouldFail: true, cause: err };
|
|
71
|
+
}
|
|
38
72
|
|
|
39
73
|
// 2. Score block
|
|
40
74
|
if (design.score) {
|