@se-studio/skills 1.0.39 → 1.0.40

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,23 @@
1
1
  # @se-studio/skills
2
2
 
3
+ ## 1.0.40
4
+
5
+ ### Patch Changes
6
+
7
+ - Add ordered `article.authors` CMS field support (first author = primary) with shared helpers in `@se-studio/core-data-types`: `getArticleAuthors`, `getPrimaryArticleAuthor`, `formatArticleAuthorNames`, and `normalizeResolvedArticleAuthors`. Legacy single `author` remains populated as `authors[0]` during migration.
8
+
9
+ **@se-studio/contentful-rest-api** — Resolve and normalize `authors` on full articles and article links; include `fields.authors` in link-only fetches. Related-articles scoring matches any listed co-author.
10
+
11
+ **@se-studio/core-ui** — Structured data context exposes multi-author JSON-LD (`article.authors`); related-articles fallback uses all article authors. Omits authors without a display name.
12
+
13
+ **@se-studio/search** / **@se-studio/markdown-renderer** — Index and export comma-separated multi-author bylines via `formatArticleAuthorNames`.
14
+
15
+ **@se-studio/contentful-cms** — Fetch and audit entry trees traverse `authors` links; shared `linkedEntryFields` module deduplicates traversal logic.
16
+
17
+ **@se-studio/skills** — Add `contentful-cms-sync-schema` skill; document multi-author Schema.org variables.
18
+
19
+ Run migration `scripts/migrations/17-add-article-authors.js` on live spaces after deploying packages.
20
+
3
21
  ## 1.0.39
4
22
 
5
23
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@se-studio/skills",
3
- "version": "1.0.39",
3
+ "version": "1.0.40",
4
4
  "description": "SE Studio agent skills for marketing site development with Contentful CMS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -42,7 +42,8 @@ Create JSON-LD templates using these standard Mustache variables:
42
42
  - `{{slug}}` — page slug
43
43
  - `{{publishDate}}` — article publish date
44
44
  - `{{updatedAt}}` — last modification date
45
- - `{{authorName}}` — article author name
45
+ - `{{authorName}}` — primary article author name (first in `authors`)
46
+ - `{{#article.authors}}` — multi-author JSON-LD (`name`, `url` per author)
46
47
  - `{{heroImageUrl}}` — primary image URL
47
48
  - `{{customerName}}` — from brand context
48
49
  - `{{siteUrl}}` — from brand context
@@ -0,0 +1,132 @@
1
+ ---
2
+ name: contentful-cms-sync-schema
3
+ description: "Audit Contentful schema drift vs golden export, write descriptive diff reports, and build migration runbooks. Use when syncing a customer space to core schema or before running scripts/migrations."
4
+ ---
5
+
6
+ # Sync Contentful schema to core
7
+
8
+ Use when a customer Contentful space should match the **structural** core schema (content types, fields, non-enum validations). Do **not** use for full enum alignment of `componentType` / `collectionType` — each site keeps its own component names.
9
+
10
+ ## Golden reference
11
+
12
+ | Artifact | Purpose |
13
+ |----------|---------|
14
+ | `docs/schema-export.json` | Structural golden (Pedestal `h4s3ip99qawo` / `master`) |
15
+ | `docs/blank-schema.json` | New-project **bootstrap only** — not the sync target |
16
+
17
+ Refresh golden:
18
+
19
+ ```bash
20
+ contentful space export \
21
+ --space-id h4s3ip99qawo \
22
+ --environment-id master \
23
+ --management-token "$CONTENTFUL_MANAGEMENT_TOKEN" \
24
+ --skip-content --skip-webhooks --skip-roles --skip-tags \
25
+ --content-file docs/schema-export.json
26
+ ```
27
+
28
+ ## Workflow
29
+
30
+ ### 1. Resolve target space
31
+
32
+ From the app’s `.env.local`:
33
+
34
+ - `CONTENTFUL_SPACE_ID`
35
+ - `CONTENTFUL_ENVIRONMENT_NAME` (or `CONTENTFUL_ENVIRONMENT`)
36
+
37
+ Use `CONTENTFUL_MANAGEMENT_TOKEN` from the environment (global).
38
+
39
+ ### 2. Export target schema
40
+
41
+ ```bash
42
+ contentful space export \
43
+ --space-id "$CONTENTFUL_SPACE_ID" \
44
+ --environment-id "$CONTENTFUL_ENVIRONMENT_NAME" \
45
+ --management-token "$CONTENTFUL_MANAGEMENT_TOKEN" \
46
+ --skip-content --skip-webhooks --skip-roles --skip-tags \
47
+ --content-file docs/schema-audit/<site>.json
48
+ ```
49
+
50
+ ### 3. Mechanical compare
51
+
52
+ ```bash
53
+ node scripts/compare-contentful-schema.mjs \
54
+ --golden docs/schema-export.json \
55
+ --target docs/schema-audit/<site>.json \
56
+ --out docs/schema-audit/<site>-diff.json \
57
+ --summary docs/schema-audit/<site>-summary.md
58
+ ```
59
+
60
+ Read `<site>-diff.json`. Enum-only diffs on `componentType`, `collectionType`, `externalComponentType` are **informational**.
61
+
62
+ ### 4. Write descriptive report
63
+
64
+ Create or update **`docs/schema-audit/<site>.md`** with:
65
+
66
+ 1. **Summary** — space id, environment, counts; what is safe to auto-migrate vs needs review.
67
+ 2. **Missing content types** — purpose, editor impact, migration script.
68
+ 3. **Missing fields** — per field: type, why golden has it (use `scripts/schema-descriptions-data.js`, `specs/CONTENT_MODEL.md`), suggested migration from `scripts/migrations/`.
69
+ 4. **Extra types/fields** — site-specific; **keep** unless product says remove (e.g. Brightline analytics fields).
70
+ 5. **Field mismatches** — non-enum differences (colour palettes, RTF validations). Usually **optional** alignment; do not block structural migrations.
71
+ 6. **Migration runbook** — ordered list with dry-run commands (see below).
72
+ 7. **Post-migration checks** — re-export, re-compare, `pnpm generate:types`, `cms-edit schema component`.
73
+
74
+ ### 5. Apply migrations (human approval)
75
+
76
+ **Never** `contentful space import` a full export onto a live space with content (webhook 409s, enum risk). Use **`contentful space migration`** only.
77
+
78
+ Standard order when diff shows these gaps:
79
+
80
+ | Order | Script | Adds |
81
+ |-------|--------|------|
82
+ | 1 | `12-add-html-component.js` | `htmlComponent` content type + array link validations |
83
+ | 2 | `13-add-tag-type-fields.js` | TagType index page fields (includes `htmlComponent` in topContent) |
84
+ | 2b | `13-add-tag-type-fields-no-html.js` | Same as 13 **without** `htmlComponent` in topContent — use for Brightline / BLK while htmlComponent is WIP |
85
+ | 3 | `14-add-tag-show-field.js` | `show` on tag / tagType |
86
+ | 4 | `16-add-navigation-item-long-text.js` | `navigationItem.longText` |
87
+ | 5 | `15-add-slug-regexp-validation.js` | Slug format validation |
88
+ | 6 | `17-add-article-authors.js` | `article.authors` array + backfill from `author` |
89
+
90
+ Site-specific (run only when diff shows missing field **and** app uses it):
91
+
92
+ | Script | Scope |
93
+ |--------|--------|
94
+ | `02-add-breadcrumb-title.js` | breadcrumbTitle on page/article/tag/custom |
95
+ | `05-add-phone-number-brightline.js` | **Brightline spaces only** |
96
+ | `06-add-tracking-event-name-brightline.js` | **Brightline spaces only** |
97
+ | `03`–`11`, `07`–`10` | External component / link extensions — check diff |
98
+
99
+ Gaps with **no** script (e.g. `navigationItem.longText`, `media.gradient` on Pedestal): flag in report; add `scripts/migrations/16+` before applying if required.
100
+
101
+ Dry-run:
102
+
103
+ ```bash
104
+ contentful space migration \
105
+ --space-id "$CONTENTFUL_SPACE_ID" \
106
+ --environment-id "$CONTENTFUL_ENVIRONMENT_NAME" \
107
+ --management-token "$CONTENTFUL_MANAGEMENT_TOKEN" \
108
+ scripts/migrations/12-add-html-component.js
109
+ ```
110
+
111
+ Remove dry-run flags only after reviewing output. Re-run compare until **missing types/fields** are cleared (extras and enum diffs may remain).
112
+
113
+ ### 6. App follow-up
114
+
115
+ In the customer app directory:
116
+
117
+ ```bash
118
+ pnpm generate:types
119
+ pnpm type-check
120
+ ```
121
+
122
+ ## Safety rules
123
+
124
+ - Do **not** shrink `componentType` / `collectionType` `in` lists on live spaces.
125
+ - Migration **15** does not fix existing invalid slug **entries** — editors must fix on save.
126
+ - Legacy media spaces (separate `video` / `illustration` types instead of `media`) need a **separate** consolidation project — not this skill’s default scope.
127
+
128
+ ## Related docs
129
+
130
+ - `docs/DEVELOPMENT.md` — Contentful migrations section
131
+ - `docs/schema-audit/README.md` — artifact layout
132
+ - `site-workflows-project-cleanup` skill — `clean-schema` for **new** empty spaces only