aem-eds-kit 0.4.9 → 0.4.16

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 CHANGED
@@ -6,7 +6,78 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
- ## [0.4.9] - 2026-10-08
9
+ ## [0.4.16] - 2026-10-08
10
+
11
+ ### Changed
12
+ - **`eds template new` is now authoring-aware.** It detects the model from
13
+ `fstab.yaml` / project markers (or `--authoring da|gdrive|sharepoint|ue`) and
14
+ routes the generated page: **DA** push (existing), an **importable doc** for
15
+ **Google Docs / SharePoint**, and for **Universal Editor** it registers the
16
+ seeded blocks in `component-filters.json` (so authors can add them) and points
17
+ to the AEM editable template. Completes the per-model template paths shown as
18
+ an infographic on the docs page.
19
+
20
+ ### Added
21
+ - **`eds template new <name>`** - generate EDS page **initial content** (the EDS
22
+ analog of an AEM template): a document of sections + chosen blocks + a metadata
23
+ block. Writes `templates/<name>.html` locally and, with `--push`, pushes it to
24
+ **DA (da.live)** via the source API (org/site from `.edsrc.json` or flags;
25
+ `DA_TOKEN` for protected projects). `--path`, `--title`, `--description`,
26
+ `--blocks`, `--area`. Also in the menu. (UE/crosswalk templates come next.)
27
+ - Docs: a **"From zero to a published page"** step-by-step command path.
28
+
29
+ ## [0.4.14] - 2026-10-08
30
+
31
+ ### Added
32
+ - **`eds schema block <name>` (JSON-LD)** - inject a schema.org structured-data
33
+ builder into a block's `decorate()`. Types: Article, FAQPage, BreadcrumbList,
34
+ Product, Organization, LocalBusiness, Event, VideoObject, Recipe, HowTo.
35
+ Idempotent, reads the block content via a `root` alias, appends a
36
+ `<script type="application/ld+json">` to the head. `--type`, interactive picker.
37
+ - **`eds scaffold helpers`** - write `scripts/utils.js`, picking the helpers you
38
+ want in an interactive checkbox (dependencies pulled in automatically) or by
39
+ name: `toCamelCase`, `getPagePath` / `getLanguageRootPath`, `getSiteArea`
40
+ (top-level area, e.g. blog), `getEnvironment`, `getContentTopic`, `isUEEdit` /
41
+ `isUEPreview` / `isUE`, `getMetadata`. Also in the `eds scaffold` picker.
42
+
43
+ ## [0.4.13] - 2026-10-08
44
+
45
+ ### Added
46
+ - **Model partials & helpers** - a library of reusable Universal Editor field
47
+ groups (heading, image, link, cta, cta-group, classes, eyebrow, richtext,
48
+ embed, teaser, card) built from typed field builders (correct `valueType` per
49
+ component), plus **`eds model add <block> [partials...]`** to compose them into
50
+ a block's `_<block>.json` (added by name, never duplicated). The from-design /
51
+ migrate prompt now lists the catalog so the agent reuses the standard groups
52
+ instead of inventing fields. Also in the menu.
53
+
54
+ ### Added
55
+ - **Framer** as a design source for `block from-design` (alongside Figma, Google
56
+ Stitch, Canva and Sketch) - the agent reads the project through its Framer MCP
57
+ connection. Also added a copy-paste **AI-agent setup prompt** to the landing +
58
+ README (checks Node 20+, installs the CLI, verifies).
59
+
60
+ ### Changed
61
+ - Landing version pill shows `v0.4` (minor) instead of chasing every patch.
62
+
63
+ ### Added
64
+ - **`eds track block <name>`** - instrument a block's `decorate()` with dataLayer
65
+ tracking on demand: delegated `block_click` (links/buttons, label from
66
+ `data-track` or text) and `form_submit`, pushed via `trackEvent` from
67
+ `scripts/analytics.js`. Adds the import and injects at the top of decorate,
68
+ idempotent, keeps the real parameter name. `--no-click` / `--no-submit`. Also
69
+ offered right after `block from-design` and `migrate component`, and in the menu.
70
+
71
+ ## [0.4.10] - 2026-10-08
72
+
73
+ ### Changed
74
+ - **`eds integrate gtm`** now emits a proper module instead of the inline IIFE:
75
+ `scripts/analytics.js` (exports `trackEvent` / `loadGTM`, **initialises the
76
+ dataLayer**, reads the id from `gtm-id` metadata with a configured fallback,
77
+ idempotent, `Date.now()`, no dead `<noscript>` iframe) and `scripts/page-meta.js`
78
+ (default-exported `pageMetaPush`). `delayed.js` imports both and pushes page
79
+ metadata before GTM initialises. Fixes the "dataLayer is undefined" crash of
80
+ the old snippet.
10
81
 
11
82
  ### Added
12
83
  - `eds migrate component` now pulls the component's **clientlib CSS** off disk
@@ -180,7 +251,14 @@ harness, gradient ANSI logo. Not published (superseded by 0.3.0).
180
251
  Initial CLI scaffold: `block create`, `block from-figma`, `block list`,
181
252
  `figma setup`, `doctor`, `preview`, `publish`. Not published.
182
253
 
183
- [Unreleased]: https://github.com/piotrgodycki/aem-eds-kit/compare/v0.4.9...HEAD
254
+ [Unreleased]: https://github.com/piotrgodycki/aem-eds-kit/compare/v0.4.16...HEAD
255
+ [0.4.16]: https://github.com/piotrgodycki/aem-eds-kit/releases/tag/v0.4.16
256
+ [0.4.15]: https://github.com/piotrgodycki/aem-eds-kit/releases/tag/v0.4.15
257
+ [0.4.14]: https://github.com/piotrgodycki/aem-eds-kit/releases/tag/v0.4.14
258
+ [0.4.13]: https://github.com/piotrgodycki/aem-eds-kit/releases/tag/v0.4.13
259
+ [0.4.12]: https://github.com/piotrgodycki/aem-eds-kit/releases/tag/v0.4.12
260
+ [0.4.11]: https://github.com/piotrgodycki/aem-eds-kit/releases/tag/v0.4.11
261
+ [0.4.10]: https://github.com/piotrgodycki/aem-eds-kit/releases/tag/v0.4.10
184
262
  [0.4.9]: https://github.com/piotrgodycki/aem-eds-kit/releases/tag/v0.4.9
185
263
  [0.4.8]: https://github.com/piotrgodycki/aem-eds-kit/releases/tag/v0.4.8
186
264
  [0.4.7]: https://github.com/piotrgodycki/aem-eds-kit/releases/tag/v0.4.7
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 or Sketch - 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 - 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.
14
14
 
15
15
  It lives next to `@adobe/aem-cli` (your local dev server) and handles everything around it.
16
16
 
@@ -20,6 +20,32 @@ It lives next to `@adobe/aem-cli` (your local dev server) and handles everything
20
20
  npm install -g aem-eds-kit
21
21
  ```
22
22
 
23
+ <details>
24
+ <summary><strong>Or let your AI agent install it</strong> (copy-paste prompt)</summary>
25
+
26
+ ```text
27
+ Goal:
28
+ Ensure Node.js v20 or newer is installed, then install the aem-eds-kit CLI and verify it.
29
+
30
+ Check first: run `node --version`. If the major version is 20 or higher, do not install or modify Node.js.
31
+ If Node.js is missing or older than v20, install an official Node.js release (major version 20 or higher).
32
+
33
+ Install policy: use an existing package manager only if it is already installed. Do not install Homebrew,
34
+ winget, Chocolatey, Scoop, nvm, fnm, or another package manager just for this task.
35
+ - macOS: Homebrew if already installed, otherwise the official Node.js `.pkg` installer.
36
+ - Windows: winget if already installed, otherwise the official Node.js `.msi` installer.
37
+ - Linux: the system package manager if it can install v20+, otherwise NodeSource (Debian/Ubuntu, RHEL/Fedora)
38
+ or the official Node.js standalone Linux binary. Downloads: https://nodejs.org/download/release/latest/
39
+
40
+ Verify Node: run `node --version` again; only continue if the major version is 20 or higher.
41
+ Install the CLI: run `npm install -g aem-eds-kit`. Verify: run `eds --version`.
42
+
43
+ Final step: from inside an EDS project (a folder with fstab.yaml, head.html, or scripts/scripts.js), run `eds`
44
+ for the interactive menu, or `eds init` to set up a freshly cloned Adobe EDS boilerplate.
45
+ ```
46
+
47
+ </details>
48
+
23
49
  Node.js 20 or newer. That's all the setup there is - `eds` now works in **any folder**. Step into your EDS project (anywhere with a `fstab.yaml`) and the CLI finds the project root for you:
24
50
 
25
51
  ```bash
@@ -32,7 +58,7 @@ eds block from-design "<figma-url>" --name hero
32
58
 
33
59
  ## Interactive mode
34
60
 
35
- Run `eds` with no command and it opens an **interactive menu** that walks you through every feature (generate a block from a design, 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 block from-design` (wizard), `eds scaffold`, `eds integrate`, `eds preview`. Flags and subcommands still work for CI / power users.
61
+ 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.
36
62
 
37
63
  A full A-Z reference of every command lives on the docs page: **https://piotrgodycki.github.io/aem-eds-kit/docs.html**
38
64
 
@@ -61,6 +87,41 @@ eds integrate
61
87
  eds doctor
62
88
  ```
63
89
 
90
+ ## From zero to a published page
91
+
92
+ The full path, command by command. This example targets **DA (da.live)** authoring.
93
+
94
+ ```bash
95
+ # 1. Install the CLI
96
+ npm i -g aem-eds-kit
97
+
98
+ # 2. Set up the project (pick DA, enter org + site). Writes fstab + CI + naming.
99
+ eds init --authoring da --org my-org --site my-site
100
+
101
+ # 3. Scaffold the Universal Editor config + helper functions
102
+ eds scaffold ue
103
+ eds scaffold helpers
104
+
105
+ # 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
107
+ # eds block create hero
108
+ # eds migrate component ./components/hero
109
+
110
+ # 5. Enrich a block (optional)
111
+ eds model add hero teaser # add reusable field-group partials
112
+ eds schema block hero --type Article # JSON-LD structured data
113
+ eds track block hero # dataLayer click + form-submit tracking
114
+
115
+ # 6. Generate the page (initial content) and push it to DA
116
+ eds template new homepage --blocks hero,cards --push --org my-org --site my-site
117
+
118
+ # 7. Preview, then publish
119
+ eds preview /templates/homepage
120
+ eds publish /templates/homepage
121
+ ```
122
+
123
+ Every step is also interactive when you omit the flags - run `eds` for the menu.
124
+
64
125
  ## Commands
65
126
 
66
127
  ### `eds init`
@@ -81,6 +142,25 @@ eds init --name my-site --authoring da --org my-org --site my-site --yes
81
142
  | `--no-ci` | Skip the GitHub Actions workflow |
82
143
  | `--yes` | Skip prompts; apply with flags/defaults |
83
144
 
145
+ ### `eds template new <name>`
146
+
147
+ Generate EDS page **initial content** - the EDS analog of an AEM template: a document of sections + chosen blocks + a metadata block. It always writes `templates/<name>.html`, then **routes by your authoring model** (detected from `fstab.yaml` / project markers, or `--authoring`): **DA** → push to da.live (`--push`, org/site from `.edsrc.json`/flags, `DA_TOKEN` for protected projects); **Google Docs / SharePoint** → importable doc + the external steps; **Universal Editor** → registers the seeded blocks in `component-filters.json` and points you to the AEM editable template. Interactive when flags are omitted.
148
+
149
+ ```bash
150
+ eds template new homepage # interactive (blocks, DA push)
151
+ eds template new homepage --blocks hero,cards --push --org my-org --site my-site
152
+ ```
153
+
154
+ | Flag | Description |
155
+ |---|---|
156
+ | `--blocks <list>` | Comma-separated block ids to seed |
157
+ | `--title` / `--description` / `--area` | Page title, description, metadata label |
158
+ | `--path <path>` | Content path (default `/templates/<name>`) |
159
+ | `--authoring <model>` | Force `da` \| `gdrive` \| `sharepoint` \| `ue` (else detected) |
160
+ | `--push` | Push to DA (da.live) |
161
+ | `--org` / `--site` | DA org / site (else from `.edsrc.json`) |
162
+ | `--yes` | Skip prompts |
163
+
84
164
  ### `eds migrate component [dir]`
85
165
 
86
166
  Start migrating a **classic AEM component** to EDS. Phase 1 is deterministic (no agent, no network): it parses the component's Touch UI dialog (`_cq_dialog/.content.xml`) and maps its Granite/Coral fields onto the **17 Universal Editor field types** - selects keep their options, multifields become repeatable containers, tabs are preserved - then writes `blocks/<name>/` with a UE model (`_<name>.json`), a `decorate()` stub (port the HTL logic), and a scoped CSS file to fill from the component's clientlib or its rendered page.
@@ -94,6 +174,36 @@ eds migrate component ./components/hero --name hero --clientlib ./ui.apps/.../he
94
174
 
95
175
  Dialogs map cleanly because Granite's `sling:resourceType` set is finite. The most faithful CSS actually comes from the **rendered page** (resolves LESS vars + cascade) - that capture lands in a later phase; for now the clientlib source gets you most of the way.
96
176
 
177
+ ### `eds track block <name>`
178
+
179
+ Instrument a block's `decorate()` with **dataLayer** tracking on demand: a delegated `block_click` (links/buttons, label from `data-track` or the element text) and `form_submit`, both pushed through `trackEvent` from `scripts/analytics.js` (created by `eds integrate gtm`). It adds the import, injects at the top of `decorate()`, is idempotent, and keeps the real parameter name. You're also offered it right after `block from-design` and `migrate component`.
180
+
181
+ ```bash
182
+ eds track block hero
183
+ eds track block hero --no-submit # clicks only
184
+ ```
185
+
186
+ ### `eds model add <block> [partials...]`
187
+
188
+ Compose **reusable field groups (partials)** into a block's Universal Editor model (`_<block>.json`) instead of hand-writing fields. Fields are added **by name**, so re-running never duplicates. Partials are built from typed field helpers (each sets the right `valueType`), and the same catalog is referenced in the `from-design` / `migrate` prompt so the agent reuses the standard groups.
189
+
190
+ ```bash
191
+ eds model add hero teaser # image + eyebrow + title + text + cta
192
+ eds model add cards card cta-group # pick several
193
+ eds model add hero # interactive checkbox picker
194
+ ```
195
+
196
+ Built-in partials: `heading`, `eyebrow`, `image`, `richtext`, `link`, `cta`, `cta-group`, `classes` (section styles), `embed`, `teaser`, `card`.
197
+
198
+ ### `eds schema block <name>`
199
+
200
+ Inject a **JSON-LD (schema.org) structured-data** builder into a block's `decorate()` for SEO / rich results. Pick a type - `Article`, `FAQPage`, `BreadcrumbList`, `Product`, `Organization`, `LocalBusiness`, `Event`, `VideoObject`, `Recipe`, `HowTo` - and it appends a `<script type="application/ld+json">` to the head, built from the block's content (aliased to `root`, so it's independent of the parameter name). Idempotent; some fields are heuristic or `TODO`, so review and validate with Google's Rich Results test.
201
+
202
+ ```bash
203
+ eds schema block faq --type FAQPage
204
+ eds schema block article # interactive type picker
205
+ ```
206
+
97
207
  ### `eds block create <name>`
98
208
 
99
209
  Scaffolds `blocks/<name>/` with `<name>.js`, `<name>.css`, **and a Universal Editor model `_<name>.json` by default** - so the block is authorable in UE the moment it's created. Validates kebab-case naming and checks for collisions.
@@ -107,7 +217,7 @@ The generated `_<name>.json` uses the EDS block-plugin (xwalk) format (`definiti
107
217
 
108
218
  ### `eds block from-design [design-url]`
109
219
 
110
- Translates a design - **Figma, Google Stitch, Canva or Sketch** - 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.)*
220
+ 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.)*
111
221
 
112
222
  The agent reads the design through its MCP connection (for Figma: `get_design_context`, `get_variable_defs`, `get_screenshot`), generates pixel-perfect code (JS + CSS) **and its Universal Editor model** by default, uses lightweight **placeholders** for not-yet-authored content (so the block is visible before Universal Editor takes over), then self-verifies. You see a **live, colour-coded log** with per-phase timings, and on success the **live preview starts automatically**.
113
223
 
@@ -168,6 +278,14 @@ Scaffold Universal Editor components deterministically (no agent). `eds scaffold
168
278
  ```bash
169
279
  eds scaffold ue
170
280
  eds scaffold blocks # all, or: eds scaffold blocks hero cards
281
+ eds scaffold helpers # scripts/utils.js with common EDS helpers
282
+ ```
283
+
284
+ `eds scaffold helpers` writes `scripts/utils.js` - **tick the helpers you want** in an interactive checkbox (dependencies are pulled in automatically), or pass names. Available: `toCamelCase`, `getPagePath` / `getLanguageRootPath`, `getSiteArea` (top-level area like `blog`), `getEnvironment`, `getContentTopic`, `isUEEdit` / `isUEPreview` / `isUE`, and `getMetadata`.
285
+
286
+ ```bash
287
+ eds scaffold helpers # interactive picker
288
+ eds scaffold helpers getSiteArea getEnvironment
171
289
  ```
172
290
 
173
291
  ### `eds scaffold ci`
@@ -180,7 +298,7 @@ eds scaffold ci
180
298
 
181
299
  ### `eds integrate [type]`
182
300
 
183
- Add a third-party service to `scripts/delayed.js` (the EDS-correct place - delayed phase, after LCP, zero CWV impact). Chat widgets use the facade pattern.
301
+ Add a third-party service to `scripts/delayed.js` (the EDS-correct place - delayed phase, after LCP, zero CWV impact). Chat widgets use the facade pattern. **GTM** gets a `scripts/analytics.js` module (exports `trackEvent` / `loadGTM`, initialises the dataLayer, reads the container id from the `gtm-id` metadata) plus a `scripts/page-meta.js` (default-exported `pageMetaPush`); `delayed.js` imports both and pushes page metadata before GTM initialises.
184
302
 
185
303
  ```bash
186
304
  eds integrate # interactive