@se-studio/skills 1.7.13 → 1.7.14

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
@@ -1,5 +1,15 @@
1
1
  # @se-studio/skills
2
2
 
3
+ ## 1.7.14
4
+
5
+ ### Patch Changes
6
+
7
+ - 531e8ca: Add HtmlComponent `externalScripts` so editors can list allowlisted script URLs that load with next/script before customJs.
8
+
9
+ Same-origin `/html-components/….js` is always allowed; extra HTTPS hosts are opt-in via `htmlComponentExternalScriptHosts`. Run migration 28 on each customer space after publishing these packages.
10
+
11
+ HSD follow-up: bump packages, run 28 on space `gqa3p93n5wse`, set the readiness HtmlComponent to `["/html-components/specialized-transport-readiness/jspdf.umd.min.js"]`, remove the `createElement('script')` loader from `jsContent`, and pass `externalScripts` through the dual-read converter if it is still in use.
12
+
3
13
  ## 1.7.13
4
14
 
5
15
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@se-studio/skills",
3
- "version": "1.7.13",
3
+ "version": "1.7.14",
4
4
  "description": "SE Studio agent skills for marketing site development with Contentful CMS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -51,6 +51,7 @@ Without this import the safelist has no effect and the spacing classes in the Co
51
51
  | `rawHtml` | ✓ | Text | The HTML markup. Use Tailwind classes; never inline `style=` for colours/typography/layout. |
52
52
  | `customCss` | — | Text | Scoped CSS. Rules are automatically prefixed with `[data-hc-id="<id>"]` — they cannot pollute other components. Use for responsive layout (`@media` queries), `:hover`, `::before`/`::after`, and any utility class not in the confirmed-safe list. |
53
53
  | `customJs` | — | Text | JavaScript loaded via Next.js `<Script>`. A `hcRoot` variable pointing to this component's root element is automatically injected — use it to scope all queries. Use sparingly. |
54
+ | `externalScripts` | — | List of URLs | Allowlisted script URLs loaded with `next/script` **before** `customJs`. Same-origin `/html-components/….js` always; extra HTTPS hosts only if the site sets `htmlComponentExternalScriptHosts`. Max 10. Do not paste CDN tags into HTML. |
54
55
  | `markdownContent` | — | Text | Plain text for search indexing. **Always fill this** so the component appears in site search. |
55
56
  | `isHero` | — | Boolean | `true` if the HTML contains an `<h1>`. Moves this block to the top of the page content flow. |
56
57
  | `fullWidth` | — | Boolean | `true` for edge-to-edge (full-bleed) layouts that break out of the column grid. |
@@ -250,6 +251,13 @@ var section = document.querySelector('[data-hc-id]');
250
251
  - Avoid `document.getElementById` unless the ID is guaranteed unique across the whole page.
251
252
  - Default `scriptStrategy` is `afterInteractive` — runs after page hydration. Use `lazyOnload` for non-critical third-party widgets.
252
253
 
254
+ Put third-party libraries in **`externalScripts`**, not `createElement('script')` inside `customJs`. Allowed values:
255
+
256
+ - Same-origin paths matching `/html-components/` + a `.js` filename (no `..`, no query string).
257
+ - HTTPS URLs whose hostname is listed in `CmsRendererConfig.htmlComponentExternalScriptHosts` (default empty). Disallowed URLs are not loaded (preview/dev logs a warning).
258
+
259
+ The renderer waits until those scripts have loaded (`next/script` `onReady`) before running `customJs`. The same URL on two HtmlComponents shares one `next/script` id (`hc-ext-<hash>`). If the site has a Content-Security-Policy, allowlisted hosts must match `script-src`.
260
+
253
261
  ---
254
262
 
255
263
  ## Common Patterns
@@ -70,7 +70,7 @@ cms-edit open --include-chrome --page-slug /pricing
70
70
 
71
71
  `open` / `peek` fetch the page (or article) tree and the template entry, but **not** template `menu` / `footer` / navigation. Edit nav with `nav open`. Pass `--include-chrome` only when you need those trees.
72
72
 
73
- **Flat lookup flags:** provide **exactly one** primary flag per `open` / `resolve` / `nav open`. See `cms-edit help lookup`. Run `cms-edit index sync` so catalog types resolve from the local index.
73
+ **Flat lookup flags:** provide **exactly one** primary flag per `open` / `peek` / `resolve`. `nav open` uses **`--nav-id` or `--nav-name` only** (not `--id`). See `cms-edit help lookup`. Run `cms-edit index sync` so catalog types resolve from the local index.
74
74
 
75
75
  ### Step 2: Read the snapshot
76
76
 
@@ -399,8 +399,9 @@ JSON output for upload (`CMS_EDIT_JSON=1`): `{ ok, id, fileName, url, mediaId?,
399
399
  ## Navigation
400
400
 
401
401
  ```bash
402
- # Open a navigation entry (navigation uses `name`, not slug)
402
+ # Open a navigation entry (not --id). Navigation uses `name`, not slug.
403
403
  cms-edit nav open --nav-name "Main navigation"
404
+ cms-edit nav open --nav-id <navigation-entry-id>
404
405
 
405
406
  # Add a new item
406
407
  cms-edit nav add --label "Pricing" --slug /pricing
@@ -409,11 +410,17 @@ cms-edit nav add --label "Docs" --href https://docs.example.com --after @c1
409
410
  # Link an existing NavigationItem (share items across navigations)
410
411
  cms-edit nav add --existing-id <navigationItem-entry-id>
411
412
 
412
- # Clone a navigation (duplicates all items)
413
+ # Clone a navigation (first-level items only; nested children stay shared)
413
414
  cms-edit nav clone <source-nav-id>
414
415
  cms-edit nav clone <source-nav-id> --label "LP Nav" --slug lp-nav
415
416
  ```
416
417
 
418
+ Template **`menu`** is site-wide. **`page.menu`** overrides one page. Header CTAs are often nested under a wrapper and **shared**. Before `set` on a nav item, ask whether the change is global or page-specific. Page-specific: new NavigationItem + cloned/new menu on `page.menu` — do not mutate the shared entry.
419
+
420
+ `peek` is one-shot. `open` / `nav open` persist. `preview urls /slug` follows that slug even if session `_mcp` is another page.
421
+
422
+ The items array field may be `entries`, `items`, or `navigationItems` — inspect `read @root` before `set @root … --links`.
423
+
417
424
  ## Create New Entries
418
425
 
419
426
  ```bash
@@ -24,8 +24,10 @@ Use this skill when creating or editing **navigation** entries and their items i
24
24
  cms-edit nav add --existing-id <id> --after @c1
25
25
  ```
26
26
  4. **Set** nav item fields (use snapshot refs): `cms-edit set @c1 title "New label"`, `cms-edit set @c1 internal <page-entry-id> --link`, `cms-edit set @c1 link "https://..."`.
27
- 5. **Set the items array directly** (e.g. to replace all items at once):
27
+ 5. **Set the items array directly** (e.g. to replace all items at once). The array field is **`entries`**, **`items`**, or **`navigationItems`** depending on the space — use `snapshot` / `read @root` to see which exists. Do not invent `items` on spaces that use `entries`:
28
28
  ```bash
29
+ cms-edit set @root entries <id1>,<id2>,<id3> --links
30
+ # generic spaces:
29
31
  cms-edit set @root items <id1>,<id2>,<id3> --links
30
32
  ```
31
33
  6. **Remove** an item: `cms-edit remove @cN`
@@ -33,7 +35,7 @@ Use this skill when creating or editing **navigation** entries and their items i
33
35
 
34
36
  ## Cloning a navigation
35
37
 
36
- To duplicate a navigation and all its items (e.g. for a landing page variant):
38
+ To duplicate a navigation (e.g. for a page-specific menu via `page.menu`):
37
39
 
38
40
  ```bash
39
41
  cms-edit nav clone <source-nav-id>
@@ -41,7 +43,23 @@ cms-edit nav clone <source-nav-id>
41
43
  cms-edit nav clone <source-nav-id> --label "LP Navigation" --slug lp-nav
42
44
  ```
43
45
 
44
- This creates new copies of every NavigationItem and links them into the new navigation. Prints the new navigation ID and an `open` command.
46
+ Clone copies **first-level** NavigationItem entries. Nested `navigationItems` (children of a “Nav items” wrapper, often the header CTA) stay as **shared links**. Editing a nested child on the copy edits every menu that links it.
47
+
48
+ `--label` is written to `name` and/or `adminLabel` and/or `label` **only when those fields exist** on the navigation content type.
49
+
50
+ ## Shared vs page-specific edits
51
+
52
+ - Template **`menu`** is site-wide. **`page.menu`** (and article/type menu fields where present) override one page.
53
+ - The header CTA is often the **last** item and may be nested under a wrapper.
54
+ - **Before `set` on a nav item:** ask whether the change is **global** or **page-specific**.
55
+ - Global → edit the shared NavigationItem.
56
+ - Page-specific → new NavigationItem + link it on a cloned (or new) menu, then set `page.menu`. Do not mutate the shared entry.
57
+
58
+ ## Sessions vs peek / preview
59
+
60
+ - `peek` is one-shot (no session). `open` and `nav open` persist.
61
+ - `cms-edit nav open --nav-id <id>` or `--nav-name "…"` — **not** `--id`.
62
+ - `preview urls /slug` follows that slug even if a leftover MCP session is another page (`sessionRootIgnored` in JSON). Use `--session` to isolate concurrent work.
45
63
 
46
64
  ## Session refs
47
65
 
@@ -79,6 +97,14 @@ cms-edit set @root footer <footer-nav-id> --link
79
97
  cms-edit save
80
98
  ```
81
99
 
100
+ Page-specific override:
101
+
102
+ ```bash
103
+ cms-edit open --page-slug /caregiver-hub
104
+ cms-edit set @root menu <cloned-or-new-nav-id> --link
105
+ cms-edit save
106
+ ```
107
+
82
108
  ## Related skills
83
109
 
84
110
  See the **core** skill for session, refs, and all commands. For templates that use menu/footer see the **templates** skill.