@se-studio/skills 1.0.3 → 1.0.5

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,17 @@
1
1
  # @se-studio/skills
2
2
 
3
+ ## 1.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Version bump: patch for changed packages
8
+
9
+ ## 1.0.4
10
+
11
+ ### Patch Changes
12
+
13
+ - Version bump: patch for changed packages
14
+
3
15
  ## 1.0.3
4
16
 
5
17
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@se-studio/skills",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "SE Studio agent skills for marketing site development with Contentful CMS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -75,6 +75,16 @@ Page: /pricing [4xKj2abc | published] · om1
75
75
 
76
76
  Use `snapshot -c` for compact output (types only, no labels).
77
77
 
78
+ **Ref cheat sheet:**
79
+ | Ref | Resolves to |
80
+ |-----|-------------|
81
+ | `@root` | Root entry of the current session (works in any session type) |
82
+ | `@p0` | Root entry — alias for `@root` in **page** and **article** sessions only |
83
+ | `@c0` | Same as `@root` (first entry in depth-first traversal order) |
84
+ | `@c1`, `@c2`, … | Child entries in depth-first traversal order |
85
+
86
+ In **navigation sessions**, use `@root` or `@c0` for the nav root — `@p0` is not valid.
87
+
78
88
  ### Step 3: Read entry fields
79
89
 
80
90
  ```bash
@@ -108,10 +118,14 @@ Each token is `@ref:fieldName=value`. All values are scalar (string, boolean, nu
108
118
  cms-edit set @c0 template 3I0HxGKbUd173wIpFCsbVr --link
109
119
  ```
110
120
 
111
- **Content arrays** (topContent, content, bottomContent, contents — replace or append entry links):
121
+ **Entry link arrays** (`--links` works on any field that is an array of entry links — not just the standard page content fields):
112
122
  ```bash
123
+ # Standard page content arrays
113
124
  cms-edit set @p0 content @c1,@c2,@c3 --links
114
125
  cms-edit set @p0 bottomContent @c4 --links --append
126
+
127
+ # Navigation items array (use @root or @c0 in a nav session)
128
+ cms-edit set @root items <id1>,<id2>,<id3> --links
115
129
  ```
116
130
 
117
131
  **Rich text fields** (body, additionalCopy):
@@ -344,9 +358,16 @@ cms-edit asset set @c0 visual 5xKj2abcDef
344
358
  # Open a navigation entry
345
359
  cms-edit nav open main-navigation
346
360
 
347
- # Add an item
361
+ # Add a new item
348
362
  cms-edit nav add --label "Pricing" --slug /pricing
349
363
  cms-edit nav add --label "Docs" --href https://docs.example.com --after @c1
364
+
365
+ # Link an existing NavigationItem (share items across navigations)
366
+ cms-edit nav add --existing-id <navigationItem-entry-id>
367
+
368
+ # Clone a navigation (duplicates all items)
369
+ cms-edit nav clone <source-nav-id>
370
+ cms-edit nav clone <source-nav-id> --label "LP Nav" --slug lp-nav
350
371
  ```
351
372
 
352
373
  ## Create New Entries
@@ -436,7 +457,7 @@ cms-edit save
436
457
  ### Update an existing article
437
458
  ```bash
438
459
  cms-edit open /blog/old-title --id # or by slug
439
- cms-edit set @p0 title "New Article Title"
460
+ cms-edit set @p0 title "New Article Title" # @p0 works in article sessions too
440
461
  cms-edit set @p0 slug new-article-slug
441
462
  cms-edit set @p0 description "Updated description"
442
463
  cms-edit save
@@ -11,12 +11,73 @@ Use this skill when creating or editing **navigation** entries and their items i
11
11
 
12
12
  1. **Create** a navigation: `cms-edit create navigation --label 'Main menu'`
13
13
  2. **Open** the nav: `cms-edit nav open <slug-or-id>` (or after create, use the printed open command)
14
- 3. **Add** items: `cms-edit nav add --label "Pricing" --slug /pricing` or `--label "Docs" --href https://docs.example.com`; use `--after @cN` to insert after a ref.
15
- 4. **Set** nav item fields (use snapshot refs): `cms-edit set @c1 label "New label"`, `cms-edit set @c1 page <entry-id> --link`, `cms-edit set @c1 externalUrl "https://..."`.
16
- 5. **Remove** an item: `cms-edit remove @cN`
17
- 6. **Save**: `cms-edit save`
14
+ 3. **Add items** (new or existing):
15
+ ```bash
16
+ # Create a new nav item with a page link
17
+ cms-edit nav add --label "Pricing" --slug /pricing
18
18
 
19
- Navigation entries are often linked from templates as **menu** or **footer**; set those with `set ... menu <nav-id> --link` from a template session.
19
+ # Create a new nav item with an external URL
20
+ cms-edit nav add --label "Docs" --href https://docs.example.com --after @c1
21
+
22
+ # Link an EXISTING NavigationItem entry (e.g. to share items across navigations)
23
+ cms-edit nav add --existing-id <navigationItem-entry-id>
24
+ cms-edit nav add --existing-id <id> --after @c1
25
+ ```
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):
28
+ ```bash
29
+ cms-edit set @root items <id1>,<id2>,<id3> --links
30
+ ```
31
+ 6. **Remove** an item: `cms-edit remove @cN`
32
+ 7. **Save**: `cms-edit save`
33
+
34
+ ## Cloning a navigation
35
+
36
+ To duplicate a navigation and all its items (e.g. for a landing page variant):
37
+
38
+ ```bash
39
+ cms-edit nav clone <source-nav-id>
40
+ # Optional: provide a custom label/slug for the clone
41
+ cms-edit nav clone <source-nav-id> --label "LP Navigation" --slug lp-nav
42
+ ```
43
+
44
+ This creates new copies of every NavigationItem and links them into the new navigation. Prints the new navigation ID and an `open` command.
45
+
46
+ ## Session refs
47
+
48
+ In a navigation session, the root navigation entry is **`@c0`** (or the universal alias **`@root`**). The `@p0` alias only works in page/article sessions.
49
+
50
+ ```bash
51
+ cms-edit nav open main-navigation
52
+ cms-edit snapshot # root is @c0; items are @c1, @c2, …
53
+ cms-edit read @root # same as @c0
54
+ ```
55
+
56
+ ## Visual fields (media wrapper)
57
+
58
+ Visual fields expect a **`media` Entry link**, not a direct Asset ID. `cms-edit asset set` now auto-creates the wrapper:
59
+
60
+ ```bash
61
+ cms-edit asset set @c0 visual <asset-id>
62
+ # → auto-creates a media entry wrapping the asset, then sets visual to that entry
63
+ ```
64
+
65
+ If you need to create the media wrapper manually:
66
+ ```bash
67
+ cms-edit create media <asset-id> # prints the media entry ID
68
+ cms-edit set @c0 visual <media-entry-id> --link
69
+ ```
70
+
71
+ ## Linking navigation from a template
72
+
73
+ Navigation entries are often linked from templates as **menu** or **footer**:
74
+
75
+ ```bash
76
+ cms-edit open <template-id> --id
77
+ cms-edit set @root menu <nav-entry-id> --link
78
+ cms-edit set @root footer <footer-nav-id> --link
79
+ cms-edit save
80
+ ```
20
81
 
21
82
  ## Related skills
22
83
 
@@ -117,39 +117,44 @@ Large client-only packages here inflate server cold-start time. Check for missin
117
117
  | 20.19+ or 22+ | `lighthouse@13` |
118
118
 
119
119
  Chrome path:
120
- - Linux / WSL: `/usr/bin/google-chrome`
120
+ - Linux / WSL: `google-chrome-stable` (binary is `/usr/bin/google-chrome-stable`)
121
121
  - macOS: Lighthouse finds it automatically
122
122
 
123
123
  ### Run against key page types
124
124
 
125
- Substitute `<SITE_URL>` with the production (or preview) domain.
125
+ Use the script-based approach. It spawns one Chrome instance, audits all pages, then prints a delta table vs the previous run.
126
+
127
+ **Setup — copy the script template:**
128
+
129
+ ```bash
130
+ mkdir -p scripts
131
+ cp node_modules/@se-studio/skills/skills/performance-audit/lighthouse.ts scripts/lighthouse.ts
132
+ ```
133
+
134
+ Or copy from `apps/example-se2026/scripts/lighthouse.ts` in the se-core-product monorepo if you have it available.
135
+
136
+ **Customise `PAGES` for the project** — edit the `PAGES` array near the top of the script. Choose representative pages: homepage, a list/index page, and a detail page. Use the sitemap to identify good candidates:
137
+
138
+ ```bash
139
+ curl -s <SITE_URL>/sitemap.xml | grep -oP 'https://[^<]+'
140
+ # or for this stack:
141
+ curl -s <SITE_URL>/marketing/sitemap.xml | grep -oP 'https://[^<]+'
142
+ curl -s <SITE_URL>/marketing/sitemap-unindexed.xml | grep -oP 'https://[^<]+'
143
+ ```
144
+
145
+ **Install dependencies (if not present):**
146
+
147
+ ```bash
148
+ pnpm add -D lighthouse tsx
149
+ ```
150
+
151
+ **Run:**
126
152
 
127
153
  ```bash
128
- mkdir -p .lighthouse
129
-
130
- # Homepage
131
- npx lighthouse@12 <SITE_URL>/ \
132
- --chrome-path /usr/bin/google-chrome \
133
- --chrome-flags="--headless=new --no-sandbox --disable-gpu --disable-dev-shm-usage" \
134
- --only-categories=performance,accessibility,best-practices,seo \
135
- --output json --output-path .lighthouse/home.json --quiet
136
-
137
- # A list or index page
138
- npx lighthouse@12 <SITE_URL>/blog/ \
139
- --chrome-path /usr/bin/google-chrome \
140
- --chrome-flags="--headless=new --no-sandbox --disable-gpu --disable-dev-shm-usage" \
141
- --only-categories=performance,accessibility,best-practices,seo \
142
- --output json --output-path .lighthouse/list.json --quiet
143
-
144
- # A detail page (pick a URL from the sitemap)
145
- npx lighthouse@12 <DETAIL_URL> \
146
- --chrome-path /usr/bin/google-chrome \
147
- --chrome-flags="--headless=new --no-sandbox --disable-gpu --disable-dev-shm-usage" \
148
- --only-categories=performance,accessibility,best-practices,seo \
149
- --output json --output-path .lighthouse/detail.json --quiet
154
+ npx tsx scripts/lighthouse.ts
150
155
  ```
151
156
 
152
- To find page URLs: `curl -s <SITE_URL>/sitemap.xml | grep -oP 'https://[^<]+'`
157
+ The script writes JSON to `.lighthouse/<page>.json`, overwrites each run, and prints a delta table showing score changes vs the previous run.
153
158
 
154
159
  ### Extract scores from JSON
155
160
 
@@ -309,21 +314,20 @@ Verify audience browser share before applying — check analytics for any legacy
309
314
 
310
315
  ## Tracking baselines
311
316
 
312
- Save Lighthouse JSON to `.lighthouse/<page>.json`. After each round of fixes, save to `.lighthouse/<page>-v2.json`, `v3.json`, etc.
317
+ The script shows score deltas automatically each run — no separate comparison script needed. The delta column (`▲`/`▼`/`·`) reflects the difference from the JSON that existed before the run started.
313
318
 
314
- Compare LCP across versions:
315
- ```bash
316
- node -e "
317
- const v1 = JSON.parse(require('fs').readFileSync('.lighthouse/home.json','utf8'));
318
- const v2 = JSON.parse(require('fs').readFileSync('.lighthouse/home-v2.json','utf8'));
319
- const lcp = a => (a.audits['largest-contentful-paint'].numericValue/1000).toFixed(2)+'s';
320
- const perf = a => Math.round(a.categories.performance.score * 100);
321
- console.log('Home LCP: v1=' + lcp(v1) + ' → v2=' + lcp(v2));
322
- console.log('Home Perf: v1=' + perf(v1) + ' → v2=' + perf(v2));
323
- "
319
+ Add `.lighthouse/` to `.gitignore` — committing it adds large JSON files that the script already overwrites each run:
320
+
321
+ ```
322
+ # .gitignore
323
+ .lighthouse/
324
324
  ```
325
325
 
326
- Commit `.lighthouse/` to git for team-visible historical baselines.
326
+ To preserve a snapshot before a major deploy, copy it manually:
327
+
328
+ ```bash
329
+ cp -r .lighthouse .lighthouse-pre-deploy
330
+ ```
327
331
 
328
332
  ---
329
333
 
@@ -331,7 +335,8 @@ Commit `.lighthouse/` to git for team-visible historical baselines.
331
335
 
332
336
  | Error | Cause | Fix |
333
337
  |---|---|---|
334
- | `Unable to connect to Chrome` | Lighthouse can't find Chrome binary | Add `--chrome-path /usr/bin/google-chrome` |
338
+ | `tcp_socket_win.cc: bind() … Only one usage of each socket address` or Chrome fails to start in WSL | WSL PATH resolves the **Windows** Chrome binary, which spawns as a Windows process and can't bind the DevTools port — passing `--chrome-path` to a one-shot `npx lighthouse` call doesn't help | Use the script approach: spawn `google-chrome-stable` (Linux binary) directly with `--no-sandbox --remote-debugging-port=9222`, then connect Lighthouse via `--port=9222` (see the script template above) |
339
+ | `Unable to connect to Chrome` (non-WSL) | Lighthouse can't find Chrome binary | Set `CHROME_BIN` in the script to the correct binary path |
335
340
  | Lighthouse fails on Node 20.18.x | Requires lighthouse@12 | Use `npm i -g lighthouse@12` |
336
341
  | `ANALYZE=true next build` fails | `next.config.ts` export not wrapped | Ensure `export default withBundleAnalyzer(nextConfig)` |
337
342
  | Speed Insights shows no data | Wrong layout, or not deployed to production | Must be in root `src/app/layout.tsx`; requires production traffic |