aem-eds-kit 0.4.26 → 0.4.33

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
@@ -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, Google Stitch, Canva, Sketch or Framer - and it hands the design to the AI agent you already use (Claude Code, Cursor or Codex); the agent reads it through MCP and writes production-ready code straight into your repo. It also scaffolds blocks, previews them in your browser, and keeps your project healthy with a few quick audits.
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/Canva/Sketch/Framer link
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,19 @@ 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, Canva, Sketch or Framer** - 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.)*
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.)*
294
+
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`.
270
296
 
271
- **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 source automatically:
297
+ **Gated sources (`--auth`).** A Google Stitch project (and a private Framer page) sits behind a login, so an anonymous scrape only sees the sign-in shell. Pass `--auth` and `eds` opens a **headed** browser once — you log in by hand, it saves the session, and every later scrape reuses it. The session (cookies/localStorage) is stored owner-only under `~/.eds/auth/<provider>.json`; re-login with `--auth-refresh`. (The saved session is a secret — it's never written to the repo.)
298
+
299
+ **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
300
 
273
301
  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 file/node (`tmp/eds-cli/design-cache/`) is reused.
275
- 3. **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**.
276
- 4. **Figma MCP** — fallback: the agent makes **one** `get_design_context` call and caches it.
302
+ 2. **Cache** — a snapshot already fetched for this design (`tmp/eds-cli/design-cache/`) is reused.
303
+ 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`.
304
+ 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**.
305
+ 5. **Figma MCP** — fallback: the agent makes **one** `get_design_context` call and caches it.
277
306
 
278
307
  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
308
 
@@ -282,13 +311,17 @@ The agent then generates pixel-perfect code (JS + CSS) **and its Universal Edito
282
311
  ```bash
283
312
  eds block from-design # interactive wizard
284
313
  eds block from-design "<figma-url>" --name hero # non-interactive (REST if a token is set, else MCP)
314
+ eds block from-design "<framer-url>" --name hero # Framer/Stitch → scraped with headless Chromium
315
+ eds block from-design "<stitch-url>" --name hero --auth # gated source → log in once, reuse the session
285
316
  eds block from-design ./hero.svg --name hero # from a local export (no network)
317
+ eds block from-design --sample --name hero # bundled Kiri Bloom sample (no token, no MCP)
286
318
  eds block from-design "<figma-url>" --dry-run # just build the prompt
287
319
  ```
288
320
 
289
321
  | Flag | Description |
290
322
  |---|---|
291
323
  | `--name <name>` | Override the inferred block name |
324
+ | `--provider <type>` | Design source: `figma` \| `framer` \| `stitch` (else detected from the URL) |
292
325
  | `--source <type>` | Content source: `document` \| `ue` \| `cf` \| `mixed` |
293
326
  | `--widths <list>` | Design frame widths for preview breakpoints (e.g. `390,768,1440`) |
294
327
  | `--agent <type>` | Force `claude` \| `cursor` \| `codex` \| `none` |
@@ -296,7 +329,10 @@ eds block from-design "<figma-url>" --dry-run # just build the prompt
296
329
  | `--no-ue-model` | Skip the Universal Editor model |
297
330
  | `--screenshot` | Add a screenshot MCP call for a pixel check (opt-in — costs a call) |
298
331
  | `--mcp` | Force the Figma MCP adapter even when a REST token is set |
332
+ | `--auth` | Scrape with a logged-in session (Framer/Stitch): log in once, reuse it |
333
+ | `--auth-refresh` | Force a fresh scrape login even if a session is saved |
299
334
  | `--refresh` | Ignore the cached snapshot and re-fetch |
335
+ | `--sample` | Use the bundled Kiri Bloom sample design (no URL, token or MCP) |
300
336
  | `--serve` | Auto-start the live preview (non-interactive runs only) |
301
337
  | `--yes` | Skip confirmation prompts |
302
338
 
@@ -340,6 +376,42 @@ eds block preview hero --widths 375,768,1280 # custom breakpoints
340
376
  eds block preview hero --port 9000 --no-open
341
377
  ```
342
378
 
379
+ ### `eds block test [name]` · `eds block check [name]`
380
+
381
+ 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.
382
+
383
+ **`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`).
384
+
385
+ ```bash
386
+ eds block test # all blocks vs committed baselines
387
+ eds block test hero # one block
388
+ eds block test hero --update # (re)write baselines after an intended change
389
+ eds block test hero --design # rendered block vs its Figma design image
390
+ eds block test --threshold 0.02 # allow 2% changed pixels
391
+ ```
392
+
393
+ | Flag | Description |
394
+ |---|---|
395
+ | `--update` | (Re)write baseline screenshots instead of comparing |
396
+ | `--threshold <ratio>` | Max changed-pixel ratio before failing (default `0.01` = 1%) |
397
+ | `--design` | Compare the rendered block against its Figma design image (needs a token) |
398
+ | `--widths <list>` | Breakpoint widths (e.g. `375,768,1280`) |
399
+ | `--port <port>` | Port for the internal preview server (default `8788`) |
400
+
401
+ **`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`.
402
+
403
+ ```bash
404
+ eds block check # all blocks
405
+ eds block check hero # one block
406
+ eds block check --strict # fail on warnings too
407
+ ```
408
+
409
+ | Flag | Description |
410
+ |---|---|
411
+ | `--strict` | Fail on warnings too, not just errors |
412
+ | `--widths <list>` | Breakpoint widths (the widest is used) |
413
+ | `--port <port>` | Port for the internal preview server (default `8789`) |
414
+
343
415
  ### `eds scaffold ue` · `eds scaffold blocks`
344
416
 
345
417
  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 +669,7 @@ Tests use fixtures in `tests/fixtures/` - a sample EDS project and recorded Figm
597
669
 
598
670
  ## Roadmap
599
671
 
600
- - **Design sources** - deepen Google Stitch, Canva and Sketch support alongside Figma (the wizard's first step already picks the source), and a generic `eds setup` in place of `eds figma setup`.
672
+ - **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
673
  - **Screenshot-to-block** - build a block from a plain image (harder: no structured layout/measurements, so pixel-perfect is tougher).
602
674
  - **Tokens & sync** - design variables → CSS custom properties, and incremental re-sync of an existing block (`--update`).
603
675
  - **Headless & CI** - a direct MCP client (no agent needed) for CI/CD, plus `eds lighthouse`, `eds rum` and `eds migrate page`.