@se-studio/skills 1.7.13 → 1.7.15
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 +16 -0
- package/package.json +1 -1
- package/references/contentful-cms-cms-guidelines/html-component-authoring.md +15 -1
- package/skills/contentful-cms-core/SKILL.md +10 -3
- package/skills/contentful-cms-navigation/SKILL.md +29 -3
- package/skills/contentful-cms-sync-schema/SKILL.md +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @se-studio/skills
|
|
2
2
|
|
|
3
|
+
## 1.7.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Document HtmlComponent externalScripts in cms-edit playbooks and reject non-array JSON on Array-of-Symbol set.
|
|
8
|
+
|
|
9
|
+
## 1.7.14
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 531e8ca: Add HtmlComponent `externalScripts` so editors can list allowlisted script URLs that load with next/script before customJs.
|
|
14
|
+
|
|
15
|
+
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.
|
|
16
|
+
|
|
17
|
+
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.
|
|
18
|
+
|
|
3
19
|
## 1.7.13
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ description: Guidelines for authoring HTML content in HtmlComponent CMS entries.
|
|
|
4
4
|
license: Private
|
|
5
5
|
metadata:
|
|
6
6
|
author: se-core-product
|
|
7
|
-
version: "1.
|
|
7
|
+
version: "1.2.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# HtmlComponent Authoring Guide
|
|
@@ -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,19 @@ 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
|
+
|
|
261
|
+
In cms-edit, `externalScripts` is an Array of Symbol — set it with `--json`, never a scalar string:
|
|
262
|
+
|
|
263
|
+
```
|
|
264
|
+
cms_edit ["set", "@cN", "externalScripts", "--json", "[\"/html-components/feature/lib.js\"]"]
|
|
265
|
+
```
|
|
266
|
+
|
|
253
267
|
---
|
|
254
268
|
|
|
255
269
|
## 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` / `
|
|
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 (
|
|
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 (
|
|
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
|
|
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
|
-
|
|
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.
|
|
@@ -88,6 +88,7 @@ Standard order when diff shows these gaps:
|
|
|
88
88
|
| 6 | `17-add-article-authors.js` | `article.authors` array + backfill from `author` |
|
|
89
89
|
| 7 | `21-add-article-bottom-content.js` | `article.bottomContent` array (idempotent; clones `content` link types) |
|
|
90
90
|
| 8 | `25-add-meta-field.js` | Optional Long text `meta` JSON bag on template/page/article/tag/person and related types. Idempotent. Unused until filled. |
|
|
91
|
+
| 9 | `28-add-html-component-external-scripts.js` | Optional `externalScripts` (array of URL strings) on existing `htmlComponent`. Idempotent. Greenfield spaces that run migration 12 after this change already get the field. |
|
|
91
92
|
|
|
92
93
|
Site-specific (run only when diff shows missing field **and** app uses it):
|
|
93
94
|
|