aem-eds-kit 0.4.26 → 0.4.30
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 +75 -8
- package/dist/bin/eds.js +160 -118
- package/package.json +6 -2
- package/samples/hero.svg +35 -0
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
**Turn a design into an EDS block** - JS, CSS and a Universal Editor model - without leaving your terminal.
|
|
12
12
|
|
|
13
|
-
`aem-eds-kit` gives you the `eds` command. Paste a design link - Figma,
|
|
13
|
+
`aem-eds-kit` gives you the `eds` command. Paste a design link - a Figma URL, or a Framer / Google Stitch page - and it hands the design to the AI agent you already use (Claude Code, Cursor or Codex), which writes production-ready code straight into your repo. Figma is read through MCP or the REST API; Framer and Stitch render real HTML, so they're **scraped with headless Chromium** (no token needed). It also scaffolds blocks, previews them in your browser, and keeps your project healthy with a few quick audits.
|
|
14
14
|
|
|
15
15
|
It lives next to `@adobe/aem-cli` (your local dev server) and handles everything around it.
|
|
16
16
|
|
|
@@ -56,6 +56,26 @@ eds block from-design "<figma-url>" --name hero
|
|
|
56
56
|
|
|
57
57
|
`eds` runs on your machine, not on your site - it never adds a single byte to what your visitors download.
|
|
58
58
|
|
|
59
|
+
## Try it in 30 seconds (no Figma account, no token)
|
|
60
|
+
|
|
61
|
+
From inside an EDS project (or spin a throwaway one up with `eds sandbox new demo`):
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
eds block from-design --sample --name hero --dry-run # see the prompt - zero setup
|
|
65
|
+
eds block from-design --sample --name hero # generate it with your AI agent
|
|
66
|
+
eds block preview hero # see it live in the browser
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`--sample` uses a **bundled "Kiri Bloom" hero design**, read straight from disk - **no Figma token, no MCP call, no network**. (`--dry-run` needs no AI agent either - it just prints the prompt.)
|
|
70
|
+
|
|
71
|
+
Ready for the real thing? Point it at the official **Kiri Bloom AEM EDS Kit** training file in Figma:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
eds block from-design \
|
|
75
|
+
"https://www.figma.com/design/vwlEKTFhcrlwuA8dRgN5SD/Kiri-Bloom-AEM-EDS-Kit-Example?node-id=0-1" \
|
|
76
|
+
--name hero
|
|
77
|
+
```
|
|
78
|
+
|
|
59
79
|
## Interactive mode
|
|
60
80
|
|
|
61
81
|
Run `eds` with no command and it opens an **interactive menu** that walks you through every feature (set up the project, generate a block from a design, migrate a classic AEM component, scaffold, create a block, add an integration, preview, Admin API, audits, Figma setup). Most commands are also interactive on their own when you omit arguments - e.g. `eds init`, `eds block from-design` (wizard), `eds migrate component`, `eds scaffold`, `eds integrate`, `eds preview`. Flags and subcommands still work for CI / power users.
|
|
@@ -83,6 +103,10 @@ eds scaffold blocks
|
|
|
83
103
|
# Add a third-party service (GTM, GA4, chat…)
|
|
84
104
|
eds integrate
|
|
85
105
|
|
|
106
|
+
# QA a block before you ship it (visual regression + content/a11y)
|
|
107
|
+
eds block test hero
|
|
108
|
+
eds block check hero
|
|
109
|
+
|
|
86
110
|
# Audit your project
|
|
87
111
|
eds doctor
|
|
88
112
|
```
|
|
@@ -103,7 +127,7 @@ eds scaffold ue
|
|
|
103
127
|
eds scaffold helpers
|
|
104
128
|
|
|
105
129
|
# 4. Build blocks - from a design, from scratch, or migrated from classic AEM
|
|
106
|
-
eds block from-design # paste a Figma/Stitch
|
|
130
|
+
eds block from-design # paste a Figma URL, a Framer/Stitch page, or a local SVG
|
|
107
131
|
# eds block create hero
|
|
108
132
|
# eds migrate component ./components/hero
|
|
109
133
|
|
|
@@ -266,14 +290,17 @@ The generated `_<name>.json` uses the EDS block-plugin (xwalk) format (`definiti
|
|
|
266
290
|
|
|
267
291
|
### `eds block from-design [design-url]`
|
|
268
292
|
|
|
269
|
-
Translates a design - **Figma, Google Stitch
|
|
293
|
+
Translates a design - **a Figma URL, a Framer / Google Stitch page, or a local SVG/PNG export** - into an EDS block. Run with **no URL** for a step-by-step wizard (design source, name, link, content source, UE model, screenshot, run mode). It builds a prompt with EDS conventions + your project's design tokens and hands it to your AI agent (Claude Code, Cursor, or Codex). *(This was `from-figma` before it went design-agnostic; Figma is the most battle-tested source and stays pixel-perfect.)*
|
|
270
294
|
|
|
271
|
-
**
|
|
295
|
+
**Figma vs. web sources.** Figma paints to a WebGL canvas, so it's read through the **REST API** (with a token) or **MCP**. Framer and Google Stitch render **real HTML**, so `eds` **scrapes** them with headless Chromium — reading computed layout, typography, colours and geometry straight off the page (no token, no MCP). Canva and Sketch are canvas/image-based and aren't scrapeable — export a frame and pass it as a local SVG/PNG. The provider is detected from the URL host, or set with `--provider`.
|
|
296
|
+
|
|
297
|
+
**Fetch → cache → generate.** `eds` resolves the design **once** into a snapshot, then the agent generates from it — so retries and refine passes never re-fetch. It picks the cheapest adapter automatically:
|
|
272
298
|
|
|
273
299
|
1. **Local file** — pass a path to an SVG/PNG export (`eds block from-design ./hero.svg`) → read from disk, no network.
|
|
274
|
-
2. **Cache** — a snapshot already fetched for this
|
|
275
|
-
3. **
|
|
276
|
-
4. **Figma
|
|
300
|
+
2. **Cache** — a snapshot already fetched for this design (`tmp/eds-cli/design-cache/`) is reused.
|
|
301
|
+
3. **Web scrape (Framer / Stitch)** — the live page is rendered in headless Chromium and its computed layout/styles are extracted. Needs Playwright + a browser: `npx playwright install chromium`.
|
|
302
|
+
4. **Figma REST** — if a Figma token is set, `eds` fetches the node itself and embeds a compact design spec. Separate, generous quota; **does not touch the MCP limit**.
|
|
303
|
+
5. **Figma MCP** — fallback: the agent makes **one** `get_design_context` call and caches it.
|
|
277
304
|
|
|
278
305
|
The agent then generates pixel-perfect code (JS + CSS) **and its Universal Editor model** by default, with lightweight **placeholders** for not-yet-authored content. You see a **live, colour-coded log** with per-phase timings. On success you get a **menu** — refine the block with another pass, open the live preview, or finish (preview is **opt-in**, never auto-launched).
|
|
279
306
|
|
|
@@ -282,13 +309,16 @@ The agent then generates pixel-perfect code (JS + CSS) **and its Universal Edito
|
|
|
282
309
|
```bash
|
|
283
310
|
eds block from-design # interactive wizard
|
|
284
311
|
eds block from-design "<figma-url>" --name hero # non-interactive (REST if a token is set, else MCP)
|
|
312
|
+
eds block from-design "<framer-url>" --name hero # Framer/Stitch → scraped with headless Chromium
|
|
285
313
|
eds block from-design ./hero.svg --name hero # from a local export (no network)
|
|
314
|
+
eds block from-design --sample --name hero # bundled Kiri Bloom sample (no token, no MCP)
|
|
286
315
|
eds block from-design "<figma-url>" --dry-run # just build the prompt
|
|
287
316
|
```
|
|
288
317
|
|
|
289
318
|
| Flag | Description |
|
|
290
319
|
|---|---|
|
|
291
320
|
| `--name <name>` | Override the inferred block name |
|
|
321
|
+
| `--provider <type>` | Design source: `figma` \| `framer` \| `stitch` (else detected from the URL) |
|
|
292
322
|
| `--source <type>` | Content source: `document` \| `ue` \| `cf` \| `mixed` |
|
|
293
323
|
| `--widths <list>` | Design frame widths for preview breakpoints (e.g. `390,768,1440`) |
|
|
294
324
|
| `--agent <type>` | Force `claude` \| `cursor` \| `codex` \| `none` |
|
|
@@ -297,6 +327,7 @@ eds block from-design "<figma-url>" --dry-run # just build the prompt
|
|
|
297
327
|
| `--screenshot` | Add a screenshot MCP call for a pixel check (opt-in — costs a call) |
|
|
298
328
|
| `--mcp` | Force the Figma MCP adapter even when a REST token is set |
|
|
299
329
|
| `--refresh` | Ignore the cached snapshot and re-fetch |
|
|
330
|
+
| `--sample` | Use the bundled Kiri Bloom sample design (no URL, token or MCP) |
|
|
300
331
|
| `--serve` | Auto-start the live preview (non-interactive runs only) |
|
|
301
332
|
| `--yes` | Skip confirmation prompts |
|
|
302
333
|
|
|
@@ -340,6 +371,42 @@ eds block preview hero --widths 375,768,1280 # custom breakpoints
|
|
|
340
371
|
eds block preview hero --port 9000 --no-open
|
|
341
372
|
```
|
|
342
373
|
|
|
374
|
+
### `eds block test [name]` · `eds block check [name]`
|
|
375
|
+
|
|
376
|
+
Two deterministic QA passes over a block's **rendered** DOM (no agent) - one block, or **all** of them when you omit the name. Both render the block in headless Chromium (Playwright), so install the browser once: `npx playwright install chromium`. Wire them into CI next to the audits - both exit non-zero on failure.
|
|
377
|
+
|
|
378
|
+
**`eds block test`** - **visual regression.** Screenshots each block at every breakpoint and diffs it (pixelmatch) against a committed baseline in `blocks/<name>/__snapshots__/`; it fails when the changed-pixel ratio crosses the threshold (default 1%) and writes the diff image to `tmp/eds-cli/visual-diff/`. `--update` (re)writes the baselines after an intended change. `--design` does a **design↔render** diff instead - the rendered block against its Figma design image (needs a Figma token and a Figma source in the block's `.eds-meta.json`).
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
eds block test # all blocks vs committed baselines
|
|
382
|
+
eds block test hero # one block
|
|
383
|
+
eds block test hero --update # (re)write baselines after an intended change
|
|
384
|
+
eds block test hero --design # rendered block vs its Figma design image
|
|
385
|
+
eds block test --threshold 0.02 # allow 2% changed pixels
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
| Flag | Description |
|
|
389
|
+
|---|---|
|
|
390
|
+
| `--update` | (Re)write baseline screenshots instead of comparing |
|
|
391
|
+
| `--threshold <ratio>` | Max changed-pixel ratio before failing (default `0.01` = 1%) |
|
|
392
|
+
| `--design` | Compare the rendered block against its Figma design image (needs a token) |
|
|
393
|
+
| `--widths <list>` | Breakpoint widths (e.g. `375,768,1280`) |
|
|
394
|
+
| `--port <port>` | Port for the internal preview server (default `8788`) |
|
|
395
|
+
|
|
396
|
+
**`eds block check`** - **content, link & a11y.** Renders each block (after `decorate()`) and flags missing image `alt`, missing image dimensions (CLS risk), links/buttons with no accessible name, empty `href`s and inline event handlers. Checks run at the widest breakpoint; it exits non-zero on any error, or on any warning with `--strict`.
|
|
397
|
+
|
|
398
|
+
```bash
|
|
399
|
+
eds block check # all blocks
|
|
400
|
+
eds block check hero # one block
|
|
401
|
+
eds block check --strict # fail on warnings too
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
| Flag | Description |
|
|
405
|
+
|---|---|
|
|
406
|
+
| `--strict` | Fail on warnings too, not just errors |
|
|
407
|
+
| `--widths <list>` | Breakpoint widths (the widest is used) |
|
|
408
|
+
| `--port <port>` | Port for the internal preview server (default `8789`) |
|
|
409
|
+
|
|
343
410
|
### `eds scaffold ue` · `eds scaffold blocks`
|
|
344
411
|
|
|
345
412
|
Scaffold Universal Editor components deterministically (no agent). `eds scaffold ue` writes/merges the three UE config files with the default-content components and a **`field-reference` block showing all 17 field types** + a multifield. `eds scaffold blocks` scaffolds standard Block Collection blocks (hero, cards, columns, accordion, embed) with UE models. Run `eds scaffold` for an interactive picker.
|
|
@@ -597,7 +664,7 @@ Tests use fixtures in `tests/fixtures/` - a sample EDS project and recorded Figm
|
|
|
597
664
|
|
|
598
665
|
## Roadmap
|
|
599
666
|
|
|
600
|
-
- **Design sources** -
|
|
667
|
+
- **Design sources** - Figma (REST/MCP), Framer and Google Stitch (headless-Chromium scrape) are wired; next is deepening the scrape extractor (multi-breakpoint capture, component/variant detection) and a generic `eds setup` in place of `eds figma setup`. Canva/Sketch stay on the local-export path (canvas/image — not scrapeable).
|
|
601
668
|
- **Screenshot-to-block** - build a block from a plain image (harder: no structured layout/measurements, so pixel-perfect is tougher).
|
|
602
669
|
- **Tokens & sync** - design variables → CSS custom properties, and incremental re-sync of an existing block (`--update`).
|
|
603
670
|
- **Headless & CI** - a direct MCP client (no agent needed) for CI/CD, plus `eds lighthouse`, `eds rum` and `eds migrate page`.
|