designlang 12.16.0 → 12.18.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/CHANGELOG.md +51 -0
- package/CODE_OF_CONDUCT.md +132 -0
- package/README.md +27 -6
- package/assets/atlas-cloud-logo.svg +55 -0
- package/bin/design-extract.js +50 -1
- package/commands/extract.md +9 -1
- package/docs/INTERVIEW_PREP.md +98 -0
- package/package.json +7 -5
- package/src/classifiers/smart.js +54 -22
- package/src/formatters/motion-gsap.js +131 -0
- package/src/formatters/motion-waapi.js +140 -0
- package/src/formatters/verify.js +77 -0
- package/src/verify/diff.js +52 -0
- package/src/verify/index.js +122 -0
- package/src/verify/render.js +45 -0
- package/src/verify/restyle.js +155 -0
- package/src/verify/tokens.js +45 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [12.18.0] — 2026-06-12
|
|
4
|
+
|
|
5
|
+
**`verify` closes the loop — designlang now *proves* its extraction with a fidelity score.**
|
|
6
|
+
|
|
7
|
+
Every release so far *read* a design system and emitted artifacts. None proved
|
|
8
|
+
the artifacts could rebuild the source. `verify` does exactly that.
|
|
9
|
+
|
|
10
|
+
- **`designlang verify <url>`** — extracts the design, then for each detected
|
|
11
|
+
component (button + card in v1) rebuilds a clone styled **only** by the
|
|
12
|
+
extracted tokens (every visual property snapped to its nearest token; colours
|
|
13
|
+
matched in CIE-Lab ΔE space), renders it, and **pixel-diffs** it against the
|
|
14
|
+
live component. Emits a **0–100 fidelity score**, a per-token-family
|
|
15
|
+
attribution of where information was lost, and a `verify.html` triptych
|
|
16
|
+
(original │ rebuilt-from-tokens │ loss heatmap) per component, plus
|
|
17
|
+
`verify.json`. `--min <score>` exits non-zero for CI gating.
|
|
18
|
+
|
|
19
|
+
The score is honest by construction: a component not on the page is `n/a`
|
|
20
|
+
(excluded, never a silent 100), and a property with no matching token is
|
|
21
|
+
`unmapped` — counted as loss and surfaced in the attribution, so a weak
|
|
22
|
+
extractor *lowers* the score rather than hiding behind it. Size mismatches are
|
|
23
|
+
letterboxed, never stretched.
|
|
24
|
+
|
|
25
|
+
Adds `pixelmatch` + `pngjs` as dependencies. New modules under `src/verify/`
|
|
26
|
+
(`tokens`, `restyle`, `render`, `diff`, `index`) are isolated and unit-tested.
|
|
27
|
+
|
|
28
|
+
## [12.17.0] — 2026-06-12
|
|
29
|
+
|
|
30
|
+
**motionlang adds two more emitters — GSAP and the framework-free Web Animations API.**
|
|
31
|
+
|
|
32
|
+
The motion language already shipped to Framer Motion, Motion One, plain CSS
|
|
33
|
+
and Tailwind. This release covers the two most-requested remaining targets:
|
|
34
|
+
GreenSock and the browser-native Web Animations API.
|
|
35
|
+
|
|
36
|
+
- **GSAP preset (`<host>-motion.gsap.js`)** — registers the page's extracted
|
|
37
|
+
cubic-bezier curves as named `CustomEase`s (so the site's exact feel is
|
|
38
|
+
reproducible), exposes duration presets in seconds, and ships `gsap.from()`
|
|
39
|
+
reveal helpers (`fadeIn` / `slideUp` / `scaleIn` / `pop`). When the page
|
|
40
|
+
uses scroll-/view-timeline, a `revealOnScroll()` ScrollTrigger batch helper
|
|
41
|
+
is emitted too. `registerEases(gsap)` wires the CustomEases in one call.
|
|
42
|
+
|
|
43
|
+
- **Web Animations API preset (`<host>-motion.waapi.js`)** — zero dependency,
|
|
44
|
+
runs on the browser-native `Element.animate()`. WAAPI accepts cubic-bezier
|
|
45
|
+
easing strings verbatim, so the extracted curves are reproduced *exactly*
|
|
46
|
+
(no spring approximation). Emits `easings`, `durations`, keyframe arrays
|
|
47
|
+
reconstructed from on-page `@keyframes`, and `fadeIn` / `slideUp` / `scaleIn`
|
|
48
|
+
helpers that return the live `Animation` and honour `prefers-reduced-motion`
|
|
49
|
+
automatically.
|
|
50
|
+
|
|
51
|
+
Both surface as live copy/download cards on the motionlang analyzer at
|
|
52
|
+
designlang.app/motion.
|
|
53
|
+
|
|
3
54
|
## [12.16.0] — 2026-06-06
|
|
4
55
|
|
|
5
56
|
**motionlang grows two framework-agnostic emitters + the website PDF download is fixed.**
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
|
10
|
+
identity and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the overall
|
|
26
|
+
community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
|
31
|
+
any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email address,
|
|
35
|
+
without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official email address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
smanavarya@gmail.com.
|
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
+
|
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
+
reporter of any incident.
|
|
68
|
+
|
|
69
|
+
## Enforcement Guidelines
|
|
70
|
+
|
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
+
|
|
74
|
+
### 1. Correction
|
|
75
|
+
|
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
+
unprofessional or unwelcome in the community.
|
|
78
|
+
|
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
|
82
|
+
|
|
83
|
+
### 2. Warning
|
|
84
|
+
|
|
85
|
+
**Community Impact**: A violation through a single incident or series of
|
|
86
|
+
actions.
|
|
87
|
+
|
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
|
93
|
+
ban.
|
|
94
|
+
|
|
95
|
+
### 3. Temporary Ban
|
|
96
|
+
|
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
|
98
|
+
sustained inappropriate behavior.
|
|
99
|
+
|
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
+
communication with the community for a specified period of time. No public or
|
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
+
Violating these terms may lead to a permanent ban.
|
|
105
|
+
|
|
106
|
+
### 4. Permanent Ban
|
|
107
|
+
|
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
+
|
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
|
113
|
+
community.
|
|
114
|
+
|
|
115
|
+
## Attribution
|
|
116
|
+
|
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
118
|
+
version 2.1, available at
|
|
119
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
120
|
+
|
|
121
|
+
Community Impact Guidelines were inspired by
|
|
122
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
123
|
+
|
|
124
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
125
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
|
126
|
+
[https://www.contributor-covenant.org/translations][translations].
|
|
127
|
+
|
|
128
|
+
[homepage]: https://www.contributor-covenant.org
|
|
129
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
130
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
131
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
|
132
|
+
[translations]: https://www.contributor-covenant.org/translations
|
package/README.md
CHANGED
|
@@ -10,14 +10,23 @@
|
|
|
10
10
|
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
|
-
---
|
|
14
|
-
|
|
15
13
|
<p align="center">
|
|
16
14
|
<img src="https://raw.githubusercontent.com/Manavarya09/design-extract/main/designlang.png" alt="designlang in action — extracts DTCG tokens, Tailwind config, Figma variables, brand book PDF" width="100%">
|
|
17
15
|
</p>
|
|
18
16
|
|
|
19
17
|
[](https://www.npmjs.com/package/designlang)
|
|
20
18
|
|
|
19
|
+
<p align="center">
|
|
20
|
+
<a href="https://www.atlascloud.ai/?utm_source=github&utm_medium=referral&utm_campaign=design-extract">
|
|
21
|
+
<img src="./assets/atlas-cloud-logo.svg" alt="Atlas Cloud" width="220">
|
|
22
|
+
</a>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
<p align="center">
|
|
26
|
+
Powered by <a href="https://www.atlascloud.ai/?utm_source=github&utm_medium=referral&utm_campaign=design-extract">Atlas Cloud</a> for OpenAI-compatible <code>--smart</code> classification.
|
|
27
|
+
For AI coding workflows, try the <a href="https://www.atlascloud.ai/console/coding-plan?utm_source=github&utm_medium=referral&utm_campaign=design-extract">Atlas Cloud coding plan</a>.
|
|
28
|
+
</p>
|
|
29
|
+
|
|
21
30
|
**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
31
|
|
|
23
32
|
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**.
|
|
@@ -26,6 +35,7 @@ It also goes where extractors don't: **layout patterns**, **responsive behavior
|
|
|
26
35
|
|
|
27
36
|
```bash
|
|
28
37
|
npx designlang https://stripe.com # extract everything
|
|
38
|
+
npx designlang verify stripe.com # fidelity score: rebuild from tokens vs live ← v12.18
|
|
29
39
|
npx designlang pair stripe.com linear.app # fuse two designs (visuals A × voice B) ← v12.8
|
|
30
40
|
npx designlang brand stripe.com # full brand-guidelines book (13 chapters) ← v12.7
|
|
31
41
|
npx designlang theme-swap stripe.com --primary "#ff4800" # recolour around your brand ← v12.6
|
|
@@ -51,6 +61,21 @@ npm i -g designlang # global
|
|
|
51
61
|
npx skills add Manavarya09/design-extract # as an agent skill (40+ agents)
|
|
52
62
|
```
|
|
53
63
|
|
|
64
|
+
## Atlas Cloud for `--smart`
|
|
65
|
+
|
|
66
|
+
`designlang --smart` can now use Atlas Cloud through its OpenAI-compatible chat API, so low-confidence classifiers can stay zero-dependency while routing to Atlas-hosted models.
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
export ATLASCLOUD_API_KEY="<atlascloud-api-key>"
|
|
70
|
+
export ATLASCLOUD_MODEL="deepseek-ai/deepseek-v4-pro"
|
|
71
|
+
|
|
72
|
+
npx designlang https://stripe.com --smart
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
- Atlas Cloud envs: `ATLASCLOUD_API_KEY`, `ATLASCLOUD_MODEL`, optional `ATLASCLOUD_API_BASE`
|
|
76
|
+
- Alias envs also work: `ATLAS_CLOUD_API_KEY`, `ATLAS_CLOUD_MODEL`, `ATLAS_CLOUD_API_BASE`
|
|
77
|
+
- Existing `OPENAI_API_KEY` and `ANTHROPIC_API_KEY` flows keep working unchanged
|
|
78
|
+
|
|
54
79
|
## What you get
|
|
55
80
|
|
|
56
81
|
Each run writes 17+ files to `./design-extract-output/`. The headline outputs:
|
|
@@ -276,9 +301,6 @@ npx skills add Manavarya09/design-extract
|
|
|
276
301
|
|
|
277
302
|
In Cursor / Codex / etc., use `/extract-design <url>`.
|
|
278
303
|
|
|
279
|
-
## Website
|
|
280
|
-
|
|
281
|
-
**[https://designlang.manavaryasingh.com](https://designlang.manavaryasingh.com/)** — the brutalist product page.
|
|
282
304
|
|
|
283
305
|
## Contributing
|
|
284
306
|
|
|
@@ -288,4 +310,3 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). PRs welcome!
|
|
|
288
310
|
|
|
289
311
|
[MIT](LICENSE) - Manav Arya Singh
|
|
290
312
|
|
|
291
|
-
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 1224 792">
|
|
3
|
+
<defs>
|
|
4
|
+
<style>
|
|
5
|
+
.cls-1 {
|
|
6
|
+
clip-path: url(#clippath);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.cls-2 {
|
|
10
|
+
fill: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.cls-2, .cls-3 {
|
|
14
|
+
stroke-width: 0px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.cls-4 {
|
|
18
|
+
clip-path: url(#clippath-1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.cls-5 {
|
|
22
|
+
clip-path: url(#clippath-2);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.cls-3 {
|
|
26
|
+
fill: #000;
|
|
27
|
+
}
|
|
28
|
+
</style>
|
|
29
|
+
<clipPath id="clippath">
|
|
30
|
+
<rect class="cls-2" x="20.73" y="315.14" width="1182.55" height="161.72"/>
|
|
31
|
+
</clipPath>
|
|
32
|
+
<clipPath id="clippath-1">
|
|
33
|
+
<rect class="cls-2" x="20.73" y="315.14" width="1182.55" height="161.72"/>
|
|
34
|
+
</clipPath>
|
|
35
|
+
<clipPath id="clippath-2">
|
|
36
|
+
<rect class="cls-2" x="20.73" y="315.14" width="1182.55" height="161.72"/>
|
|
37
|
+
</clipPath>
|
|
38
|
+
</defs>
|
|
39
|
+
<g class="cls-1">
|
|
40
|
+
<path class="cls-3" d="M104.38,315.14L20.73,476.86c38.73-15.32,70.03-17.6,98.12-16.26l-12.85-28.4c-5.63-.57-21.86-.57-29.57,1.45l27.95-62.14s42.06,91.31,42.13,91.32c8.09,1.27,29.8,8.55,41.52,14.03l-83.66-161.72Z"/>
|
|
41
|
+
</g>
|
|
42
|
+
<polygon class="cls-3" points="207.87 323.37 207.87 361.57 189.68 361.57 189.68 381.76 207.87 381.76 207.87 471.35 234.07 471.35 234.07 381.76 252.87 381.76 252.87 361.57 234.07 361.57 234.07 323.37 207.87 323.37"/>
|
|
43
|
+
<rect class="cls-3" x="268.07" y="323.37" width="26.19" height="147.98"/>
|
|
44
|
+
<g class="cls-4">
|
|
45
|
+
<path class="cls-3" d="M340.48,416.95c0,13.6,9.79,33.39,33.39,33.39,14.6,0,24.2-7.6,29.2-17.59,2.6-4.8,3.8-10,4.2-15.4.2-5.2-.8-10.6-3-15.4-4.6-10.4-14.8-19.4-30.6-19.4-21.2,0-33.19,17.2-33.19,34.19v.2ZM433.26,471.35h-26.19v-15.8c-7,12.8-21.6,19.2-36.99,19.2-35.2,0-55.8-27.4-55.8-58.4,0-34.6,25-58.19,55.8-58.19,20,0,32.19,10.6,36.99,19.4v-16h26.19v109.78Z"/>
|
|
46
|
+
<path class="cls-3" d="M506.87,391.16c-.2-5.8-3.2-11.8-13.4-11.8-8.8,0-12.99,5.6-12.99,11,.2,7,8.2,10.79,18.6,13.8,17.6,4.8,36.6,10,36.8,33.59.4,22.6-18.6,36.99-41.59,36.99-17,0-40-8.8-41.99-35.39h26.19c1,11.8,11.2,14.2,16.2,14.2,8.2,0,15.2-5.4,15-12.8,0-9.4-8.2-12-28.4-18.99-14.8-4.6-26.79-12.8-26.99-28.6,0-21.6,18.19-35,39.39-35,14.8,0,36.8,6.6,39,33h-25.8Z"/>
|
|
47
|
+
<path class="cls-3" d="M760.26,421.76c-9,30.59-37.8,52.39-72.39,52.39-45.19,0-77.59-35.8-77.59-76.99s30.59-76.58,77.39-76.58c42.59.2,66.79,31.59,72.59,53.19h-31.4c-4.6-10.19-17.8-26.79-41.39-26.99-28.8,0-47.39,24.2-47.39,50.39s19.4,50.79,47.6,50.79c26.39,0,38.39-20.8,41.19-26.19h31.4Z"/>
|
|
48
|
+
</g>
|
|
49
|
+
<rect class="cls-3" x="779.68" y="323.37" width="26.19" height="147.98"/>
|
|
50
|
+
<g class="cls-5">
|
|
51
|
+
<path class="cls-3" d="M852.09,416.56c0,19.2,14.59,33.39,32.59,33.39s32.4-14.2,32.4-33.6-14.4-33.59-32.4-33.59-32.59,14.2-32.59,33.59v.2ZM825.89,416.15c0-28,20.6-57.79,58.79-57.79s58.79,29.79,58.79,57.99-20.59,58.19-58.79,58.19-58.79-29.79-58.79-58.19v-.2Z"/>
|
|
52
|
+
<path class="cls-3" d="M1064.87,471.35h-24.6v-14.6c-4.6,8.6-14.4,18.2-34.19,18-36-.2-42.79-27.6-42.79-46.8v-66.39h26.19v59.79c0,16.2,5.4,28.99,23.99,28.8,18.8,0,25.2-12.4,25.2-28v-60.59h26.2v109.78Z"/>
|
|
53
|
+
<path class="cls-3" d="M1111.28,416.35c0,18.6,13.4,33.8,33.59,33.8,9.6,0,18.2-3.8,24.4-10,6.2-6.2,9.8-14.8,9.39-24.4,0-9.6-3.8-17.8-9.8-23.6-6-6-14.39-9.6-23.79-9.6-21.4,0-33.8,16.4-33.8,33.59v.2ZM1203.27,471.35h-25v-15.8c-4.8,8.2-15.2,19.2-37.6,19.2-33.79,0-55.59-26.4-55.59-58.4,0-35.59,25.4-58.19,55.19-58.19,21,0,32.8,11.19,36.8,17.59v-52.39h26.2v147.98Z"/>
|
|
54
|
+
</g>
|
|
55
|
+
</svg>
|
package/bin/design-extract.js
CHANGED
|
@@ -32,6 +32,8 @@ import { formatFramerMotion } from '../src/formatters/framer-motion.js';
|
|
|
32
32
|
import { formatMotionOne } from '../src/formatters/motion-one.js';
|
|
33
33
|
import { formatMotionCss } from '../src/formatters/motion-css.js';
|
|
34
34
|
import { formatMotionTailwind } from '../src/formatters/motion-tailwind.js';
|
|
35
|
+
import { formatMotionGsap } from '../src/formatters/motion-gsap.js';
|
|
36
|
+
import { formatMotionWaapi } from '../src/formatters/motion-waapi.js';
|
|
35
37
|
import { formatCssVars } from '../src/formatters/css-vars.js';
|
|
36
38
|
import { formatPreview } from '../src/formatters/preview.js';
|
|
37
39
|
import { formatFigma } from '../src/formatters/figma.js';
|
|
@@ -112,7 +114,7 @@ program
|
|
|
112
114
|
.option('--tokens-legacy', 'Emit pre-v7 flat token JSON (backward compat)')
|
|
113
115
|
.option('--platforms <csv>', 'Additional platforms: web,ios,android,flutter,wordpress,all (web is always emitted)', 'web')
|
|
114
116
|
.option('--emit-agent-rules', 'Emit Cursor/Claude Code/generic agent rules')
|
|
115
|
-
.option('--smart', 'use optional LLM fallback when heuristic classifiers have low confidence (
|
|
117
|
+
.option('--smart', 'use optional LLM fallback when heuristic classifiers have low confidence (supports ATLASCLOUD_API_KEY, OPENAI_API_KEY, or ANTHROPIC_API_KEY)')
|
|
116
118
|
.option('--pages <n>', 'crawl N canonical pages (pricing/docs/blog/about/product) in addition to the homepage', parseInt)
|
|
117
119
|
.option('--no-prompts', 'skip writing the prompt-pack directory')
|
|
118
120
|
.option('--no-design-md', 'skip writing the agent-native DESIGN.md (single-file, 8-section, YAML front matter)')
|
|
@@ -361,6 +363,8 @@ program
|
|
|
361
363
|
{ name: `${prefix}-motion.one.js`, content: formatMotionOne(design), label: 'Motion One presets (animate() + springs + scroll)' },
|
|
362
364
|
{ name: `${prefix}-motion.css`, content: formatMotionCss(design), label: 'Motion CSS (vars + keyframes + utilities + reduced-motion)' },
|
|
363
365
|
{ name: `${prefix}-motion.tailwind.js`, content: formatMotionTailwind(design), label: 'Tailwind motion preset (duration/easing/keyframes/animation)' },
|
|
366
|
+
{ name: `${prefix}-motion.gsap.js`, content: formatMotionGsap(design), label: 'GSAP presets (CustomEase + reveals + ScrollTrigger)' },
|
|
367
|
+
{ name: `${prefix}-motion.waapi.js`, content: formatMotionWaapi(design), label: 'Web Animations API presets (zero-dependency, exact curves)' },
|
|
364
368
|
{ name: `${prefix}-variables.css`, content: formatCssVars(design), label: 'CSS Variables' },
|
|
365
369
|
{ name: `${prefix}-preview.html`, content: formatPreview(design), label: 'Visual Preview' },
|
|
366
370
|
{ name: `${prefix}-figma-variables.json`, content: formatFigma(design), label: 'Figma Variables' },
|
|
@@ -1916,6 +1920,51 @@ program
|
|
|
1916
1920
|
}
|
|
1917
1921
|
});
|
|
1918
1922
|
|
|
1923
|
+
// ── Verify — fidelity loop: rebuild from tokens, pixel-diff vs original ──
|
|
1924
|
+
program
|
|
1925
|
+
.command('verify <url>')
|
|
1926
|
+
.description('Rebuild components from the extracted tokens and pixel-diff them against the live page — a 0-100 fidelity score + loss heatmaps.')
|
|
1927
|
+
.option('-o, --out <dir>', 'output directory', './design-extract-output')
|
|
1928
|
+
.option('-c, --components <list>', 'comma-separated components to check (button,card,input,nav)', 'button,card')
|
|
1929
|
+
.option('--min <score>', 'exit non-zero if site fidelity is below this (CI gate)', parseInt)
|
|
1930
|
+
.option('--system-chrome', 'use the system Chrome install instead of bundled Chromium')
|
|
1931
|
+
.action(async (url, opts) => {
|
|
1932
|
+
if (!url.startsWith('http')) url = `https://${url}`;
|
|
1933
|
+
validateUrl(url);
|
|
1934
|
+
const spinner = ora('Extracting + rebuilding from tokens').start();
|
|
1935
|
+
try {
|
|
1936
|
+
const { verifyDesign } = await import('../src/verify/index.js');
|
|
1937
|
+
const { formatVerifyHtml, formatVerifyJson } = await import('../src/formatters/verify.js');
|
|
1938
|
+
const components = String(opts.components).split(',').map((s) => s.trim()).filter(Boolean);
|
|
1939
|
+
const report = await verifyDesign(url, {
|
|
1940
|
+
components,
|
|
1941
|
+
out: resolve(opts.out),
|
|
1942
|
+
channel: opts.systemChrome ? 'chrome' : undefined,
|
|
1943
|
+
});
|
|
1944
|
+
mkdirSync(resolve(opts.out), { recursive: true });
|
|
1945
|
+
const htmlPath = join(resolve(opts.out), 'verify.html');
|
|
1946
|
+
const jsonPath = join(resolve(opts.out), 'verify.json');
|
|
1947
|
+
writeFileSync(htmlPath, formatVerifyHtml(report), 'utf8');
|
|
1948
|
+
writeFileSync(jsonPath, formatVerifyJson(report), 'utf8');
|
|
1949
|
+
|
|
1950
|
+
const score = report.fidelity;
|
|
1951
|
+
spinner.succeed(`Fidelity ${score == null ? 'n/a' : score + '/100'} → ${htmlPath}`);
|
|
1952
|
+
for (const c of report.components) {
|
|
1953
|
+
const line = c.status === 'ok'
|
|
1954
|
+
? `${chalk.bold(c.component.padEnd(8))} ${chalk.cyan(String(c.fidelity).padStart(3))}/100`
|
|
1955
|
+
: `${chalk.bold(c.component.padEnd(8))} ${chalk.gray(c.status)} ${chalk.gray(c.reason || '')}`;
|
|
1956
|
+
console.log(' ' + line);
|
|
1957
|
+
}
|
|
1958
|
+
if (opts.min != null && score != null && score < opts.min) {
|
|
1959
|
+
console.error(chalk.red(`\n Fidelity ${score} is below --min ${opts.min}\n`));
|
|
1960
|
+
process.exit(1);
|
|
1961
|
+
}
|
|
1962
|
+
} catch (err) {
|
|
1963
|
+
spinner.fail(err.message);
|
|
1964
|
+
process.exit(1);
|
|
1965
|
+
}
|
|
1966
|
+
});
|
|
1967
|
+
|
|
1919
1968
|
// ── Chat — REPL over a live extraction (v12) ──────────────
|
|
1920
1969
|
program
|
|
1921
1970
|
.command('chat <target>')
|
package/commands/extract.md
CHANGED
|
@@ -35,7 +35,15 @@ Useful flags the user may pass via `$ARGUMENTS`:
|
|
|
35
35
|
| `--depth <n>` | crawl N additional canonical pages |
|
|
36
36
|
| `--dark` | also extract dark mode |
|
|
37
37
|
| `--platforms ios,android,flutter,wordpress` | multi-platform emitters |
|
|
38
|
-
| `--smart` | LLM fallback for low-confidence classifiers (
|
|
38
|
+
| `--smart` | LLM fallback for low-confidence classifiers (supports `ATLASCLOUD_API_KEY`, `OPENAI_API_KEY`, or `ANTHROPIC_API_KEY`) |
|
|
39
39
|
| `--cookie-file ./session.json` | authenticated extraction |
|
|
40
40
|
|
|
41
41
|
Full reference: https://github.com/Manavarya09/design-extract#full-cli-reference
|
|
42
|
+
|
|
43
|
+
Atlas Cloud quick setup for `--smart`:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
export ATLASCLOUD_API_KEY="<atlascloud-api-key>"
|
|
47
|
+
export ATLASCLOUD_MODEL="deepseek-ai/deepseek-v4-pro"
|
|
48
|
+
npx designlang https://stripe.com --smart
|
|
49
|
+
```
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# designlang — Interview Prep (Plain English)
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## What is it, in one sentence
|
|
6
|
+
|
|
7
|
+
You give it any website URL. It opens a real browser, reads every style off the page, and spits out 17+ files — design tokens, Tailwind config, Figma variables, a full brand book — everything you'd need to recreate or match that design.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## How it actually works — step by step
|
|
12
|
+
|
|
13
|
+
### 1. Opens a real browser
|
|
14
|
+
|
|
15
|
+
It uses Playwright (basically headless Chrome) and loads the actual live website — not the source code, not a screenshot. The real thing, fully rendered, fonts loaded, dark mode checked, hover states triggered.
|
|
16
|
+
|
|
17
|
+
> **Say this:** *"We're reading the computed styles off the live DOM — what the browser actually rendered, not what someone wrote in a CSS file. That means it catches inline styles, CSS variables, third-party component libraries, everything."*
|
|
18
|
+
|
|
19
|
+
### 2. Pulls every style off the page
|
|
20
|
+
|
|
21
|
+
Once the page is loaded, it walks up to 5,000 elements and reads their computed styles — colors, fonts, spacing, shadows, borders, z-index, animations. It also grabs CSS variables, media queries, and keyframe animations separately.
|
|
22
|
+
|
|
23
|
+
### 3. Runs 30+ extractors in parallel
|
|
24
|
+
|
|
25
|
+
Each piece gets its own focused extractor — one for colors, one for typography, one for spacing, one for motion, one for accessibility contrast, and so on. They all run on the same raw data. If one crashes, the others keep going (`safeExtract` wraps each one, so a broken extractor returns `null` instead of killing the whole run).
|
|
26
|
+
|
|
27
|
+
> **Say this:** *"Each extractor is isolated. The whole thing can't blow up because one extractor failed on a weird site."*
|
|
28
|
+
|
|
29
|
+
### 4. Does the smart stuff
|
|
30
|
+
|
|
31
|
+
A few things are more interesting than just reading values:
|
|
32
|
+
|
|
33
|
+
- **Colors** — clusters similar colors together (so 40 near-identical blues become "primary blue") and figures out which one is the brand color based on how often it shows up on buttons and CTAs
|
|
34
|
+
- **Interactions** — actually hovers over elements, opens menus, triggers modals, and diffs the styles before and after to capture hover states and transitions
|
|
35
|
+
- **Scoring** — grades the design system (color discipline, typography consistency, spacing system) against real production benchmarks like Stripe and Linear
|
|
36
|
+
- **Accessibility** — checks every foreground/background color pair against WCAG, and suggests the nearest passing color as a fix
|
|
37
|
+
|
|
38
|
+
### 5. Writes 17+ output files
|
|
39
|
+
|
|
40
|
+
Each formatter takes the extracted data and writes a specific file. Tailwind config, Figma variables JSON, DTCG tokens, a big markdown doc for feeding into AI tools, CSS variables, typed React component stubs, a graded report card HTML, and more.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## The interesting features to talk about
|
|
45
|
+
|
|
46
|
+
**Interaction states** — most extractors just read static CSS. designlang actually *does things* to the page: scrolls, hovers buttons, opens dropdowns, clicks modals. Then it captures what changed. That's how you get real hover colors and transition details, not just the default state.
|
|
47
|
+
|
|
48
|
+
**The grading system** — it scores the design on things like "how many unique colors does this site use?" (≤12 gets 100, >100 gets 35 with a warning). It has real calibration data from sites like Stripe, Vercel, GitHub. So when it says a site scores 80/100 for typography consistency, that's against a real benchmark, not made up.
|
|
49
|
+
|
|
50
|
+
**Remix / vocabulary** — you can say "restyle this site as brutalist" or "cyberpunk" and it rewrites the tokens into that vocabulary. There are 6 vocabulary modules (brutalist, swiss, art-deco, cyberpunk, soft-ui, editorial), each with its own rules for color, type, spacing.
|
|
51
|
+
|
|
52
|
+
**Pair** — point it at two sites (e.g. `designlang pair stripe.com linear.app`) and it fuses them: takes the visual identity of one and the brand voice/tone of the other.
|
|
53
|
+
|
|
54
|
+
**MCP server** — the extracted data can be served over MCP so any AI tool that speaks MCP can query the design tokens directly, without re-crawling.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## How it handles dark mode
|
|
59
|
+
|
|
60
|
+
It loads the page twice — once with `colorScheme: light`, once with `colorScheme: dark`. Both passes run the color and variable extractors. The output has a `darkMode` section with its own palette and CSS variable overrides.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## What makes it different from other design extraction tools
|
|
65
|
+
|
|
66
|
+
> **Say this:** *"Most tools give you the colors and fonts. designlang reads the architecture — the layout system, the responsive behavior across 4 breakpoints, what changes on hover, how the motion feels. The diff between a color picker and a design system reverse-engineer."*
|
|
67
|
+
|
|
68
|
+
The things no one else does:
|
|
69
|
+
- Hover/focus/active state capture (actually simulates interaction)
|
|
70
|
+
- Motion fingerprint — figures out if the site feels "springy", "smooth", "mechanical" based on the easing curves
|
|
71
|
+
- Multi-page consistency — crawls internal links and reconciles which tokens are shared vs per-route
|
|
72
|
+
- Accessibility remediation — not just "this fails WCAG" but "here's the nearest color that would pass"
|
|
73
|
+
- Brand voice — reads button labels and headings to figure out tone, pronoun posture, CTA verb patterns
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## The whole thing in one breath
|
|
78
|
+
|
|
79
|
+
> "It opens a real browser, renders the site, walks every element, and runs 30+ extractors on the computed styles. Colors get clustered into a palette, interactions get simulated to capture hover states, the design gets graded against real benchmarks, and everything formats out into whatever you need — Tailwind config, Figma variables, DTCG tokens, an AI prompt pack."
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Quick answers for common questions
|
|
84
|
+
|
|
85
|
+
**Why use a headless browser instead of fetching the CSS?**
|
|
86
|
+
CSS files only tell you what was written. The browser tells you what was actually applied — after cascade, after JS, after third-party components inject their own styles. The computed styles are the ground truth.
|
|
87
|
+
|
|
88
|
+
**What if the site uses React or loads content lazily?**
|
|
89
|
+
The crawler waits for `networkidle` and `fonts.ready` before extracting. For interaction states, it also scrolls and clicks to trigger lazy-loaded content.
|
|
90
|
+
|
|
91
|
+
**How does it know which color is the "primary" brand color?**
|
|
92
|
+
It clusters all colors by visual similarity, then looks at which cluster appears most on interactive elements — buttons, links, CTAs. The one with the highest interactive-background score wins.
|
|
93
|
+
|
|
94
|
+
**How accurate is the grade?**
|
|
95
|
+
It's calibrated against real production design systems (Stripe, Linear, Vercel, GitHub, Apple). Not perfect, but it's a relative signal — a 90 means "this is as tight as Stripe," not "this passed a spec."
|
|
96
|
+
|
|
97
|
+
**What's the hardest part technically?**
|
|
98
|
+
Color clustering. You can't just bucket by hex — hover states and opacity variants create hundreds of near-identical colors. The clustering groups them by perceptual distance so the output is readable instead of noise.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "designlang",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.18.0",
|
|
4
4
|
"description": "Extract the complete design language from any website and ship it — 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": {
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
},
|
|
9
9
|
"main": "src/index.js",
|
|
10
10
|
"exports": {
|
|
11
|
-
".":
|
|
12
|
-
"./api":
|
|
13
|
-
"./mcp":
|
|
11
|
+
".": "./src/index.js",
|
|
12
|
+
"./api": "./src/api.js",
|
|
13
|
+
"./mcp": "./src/mcp/index.js",
|
|
14
14
|
"./package.json": "./package.json"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
"commander": "^12.0.0",
|
|
25
25
|
"ora": "^8.0.0",
|
|
26
26
|
"pdf-lib": "^1.17.1",
|
|
27
|
-
"
|
|
27
|
+
"pixelmatch": "^7.2.0",
|
|
28
|
+
"playwright": "^1.42.0",
|
|
29
|
+
"pngjs": "^7.0.0"
|
|
28
30
|
},
|
|
29
31
|
"engines": {
|
|
30
32
|
"node": ">=20"
|