@se-studio/project-build 1.0.131 → 1.0.133

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +13 -14
  3. package/package.json +2 -4
  4. package/dist/management/sync-skills.d.ts +0 -4
  5. package/dist/management/sync-skills.d.ts.map +0 -1
  6. package/dist/management/sync-skills.js +0 -97
  7. package/dist/management/sync-skills.js.map +0 -1
  8. package/dist/seskills.d.ts +0 -9
  9. package/dist/seskills.d.ts.map +0 -1
  10. package/dist/seskills.js +0 -32
  11. package/dist/seskills.js.map +0 -1
  12. package/skills/contentful-cms/alt-text-audit/SKILL.md +0 -60
  13. package/skills/contentful-cms/cms-guidelines/README.md +0 -166
  14. package/skills/contentful-cms/cms-guidelines/colour-hint-prompt.md +0 -77
  15. package/skills/contentful-cms/cms-guidelines/evaluation-prompt.md +0 -84
  16. package/skills/contentful-cms/cms-guidelines/generate-component-guidelines.md +0 -126
  17. package/skills/contentful-cms/cms-guidelines/generation-prompt.md +0 -231
  18. package/skills/contentful-cms/cms-guidelines/html-component-authoring.md +0 -401
  19. package/skills/contentful-cms/cms-guidelines/validation-prompt.md +0 -170
  20. package/skills/contentful-cms/cms-guidelines/variant-loop.md +0 -189
  21. package/skills/contentful-cms/cms-guidelines/variant-proposal-prompt.md +0 -131
  22. package/skills/contentful-cms/core/SKILL.md +0 -793
  23. package/skills/contentful-cms/generate-all-guidelines/SKILL.md +0 -313
  24. package/skills/contentful-cms/generate-cms-guidelines/SKILL.md +0 -313
  25. package/skills/contentful-cms/image-guide/SKILL.md +0 -240
  26. package/skills/contentful-cms/manifest.json +0 -11
  27. package/skills/contentful-cms/navigation/SKILL.md +0 -23
  28. package/skills/contentful-cms/rich-text/SKILL.md +0 -96
  29. package/skills/contentful-cms/schema-org/SKILL.md +0 -74
  30. package/skills/contentful-cms/screenshots/SKILL.md +0 -46
  31. package/skills/contentful-cms/seo-descriptions/SKILL.md +0 -54
  32. package/skills/contentful-cms/templates/SKILL.md +0 -21
  33. package/skills/contentful-cms/update-cms-guidelines/SKILL.md +0 -348
  34. package/skills/se-marketing-sites/cms-routes-and-appshared/SKILL.md +0 -99
  35. package/skills/se-marketing-sites/create-collection/SKILL.md +0 -295
  36. package/skills/se-marketing-sites/create-component/SKILL.md +0 -250
  37. package/skills/se-marketing-sites/create-page/SKILL.md +0 -129
  38. package/skills/se-marketing-sites/curate-showcase-mocks/SKILL.md +0 -343
  39. package/skills/se-marketing-sites/handling-media/SKILL.md +0 -195
  40. package/skills/se-marketing-sites/lib-cms-structure/SKILL.md +0 -83
  41. package/skills/se-marketing-sites/register-cms-features/SKILL.md +0 -95
  42. package/skills/se-marketing-sites/styling-system/SKILL.md +0 -122
@@ -1,313 +0,0 @@
1
- ---
2
- name: generate-all-guidelines
3
- description: Full-site CMS guideline run — bulk screenshots (components + collections), CLI collection/externals, then Phase B/C/D for every component. After update-cms-guidelines fresh/clean slate, do not skip types or git-restore component fragments.
4
- license: Private
5
- metadata:
6
- author: se-core-product
7
- version: "1.1.0"
8
- ---
9
-
10
- # Generate All Guidelines (Full Site Run)
11
-
12
- Generates CMS guidelines for every registered type in one orchestrated run.
13
- The workflow front-loads all screenshot capture so parallel subagents can go
14
- straight to guideline writing without waiting for screenshots one by one.
15
-
16
- ## Full regeneration vs partial resume
17
-
18
- | Caller intent | What to do |
19
- |---|---|
20
- | **Parent skill:** `update-cms-guidelines` mode **`fresh`** (after **clean slate**) | **Ignore** the Phase 0 “skip if fragment + screenshot exist” rule for components — there must be **no** pre-existing `components/<slug>.md`. Capture **every** discovery component (Phase 1) and **every** discovery collection (Phase 1b). Run Phase 3 for **every** component (overwrite all `components/*.md`). |
21
- | **Partial resume** (crashed mid-run, or only some types failed) | Use the skip check in Phase 0 only for types that are **already complete** (fragment + `index.json` rows with `mode` `component`). Finish missing types only. |
22
- | **Invalid shortcut for “total regen”** | Restoring `docs/cms-guidelines/components/*.md` from git instead of Phase 3 — **never** when the user asked for a full regeneration. |
23
-
24
- ## When to use
25
-
26
- - First-time guideline generation for a new project
27
- - **`fresh` full regeneration** after **update-cms-guidelines** clean slate
28
- - Bulk regeneration after major refactoring (prefer **`fresh`** if prose and screenshots should both be renewed)
29
- - Adding screenshot links to an existing set of guidelines that has no screenshots yet (partial — still run Phase 3 only for types missing fragments)
30
-
31
- Use the **generate-cms-guidelines** skill (`single` or `merge-only` mode) for small incremental edits; use **`sync`** in **update-cms-guidelines** when registrations change (**including stale removal**).
32
-
33
- ---
34
-
35
- ## Prerequisites
36
-
37
- All of these must be true before starting. Check each one.
38
-
39
- 1. **Dev server is running** at the app's port. Confirm:
40
- ```bash
41
- curl -sL http://localhost:<PORT>/api/cms/discovery/ | head -c 100
42
- ```
43
- Should return JSON starting with `{"components":[`.
44
-
45
- 2. **`agent-browser` is installed** (needed for screenshot capture):
46
- ```bash
47
- agent-browser --version
48
- # If missing: npm install -g agent-browser && agent-browser install
49
- ```
50
-
51
- 3. **Showcase pipeline completed** — `src/generated/showcase-mocks.json` must contain real content (not just `{}` stubs). If empty, run the **curate-showcase-mocks** skill first.
52
-
53
- 4. **Field list generated:**
54
- ```bash
55
- pnpm run cms-discovery:field-list
56
- # or from repo root: pnpm --filter <appName> exec cms-generate-field-list --app-dir .
57
- ```
58
- Produces `generated/cms-discovery/field-list.json` (discovery API reads from here).
59
-
60
- 5. **LLM pre-pass run** — `src/generated/cms-discovery/accepted-variants/` must contain JSON files in subdirs (`components/`, `collections/`, `externals/`). These are written by `generate-showcase-mocks`. If the directory is empty or missing, run:
61
- ```bash
62
- pnpm generate-showcase-mocks
63
- # or: node node_modules/@se-studio/project-build/dist/generate-showcase-mocks.js
64
- ```
65
-
66
- ---
67
-
68
- ## Inputs
69
-
70
- | Input | Example |
71
- |-------|---------|
72
- | App directory (absolute or repo-relative) | `apps/example-se2026` or `/home/nick/source/se/se-website-2026` |
73
- | Discovery URL | `http://localhost:3012/api/cms/discovery/` |
74
- | Port | `3012` |
75
-
76
- ---
77
-
78
- ## Pipeline Overview
79
-
80
- ```
81
- Phase 0 — Discover Fetch all type names from the discovery API
82
- Phase 1 — Screenshots Bulk capture all component screenshots (CLI only, no LLM)
83
- Phase 1b — Screenshots Bulk capture all collection screenshots (same; required for a complete full run)
84
- Phase 2 — Collections Generate collection + external guideline fragments (CLI only)
85
- Phase 3 — Components Parallel subagents: Phase B (write) + C (colour) + D (validate) per type
86
- Phase 4 — Merge cms-merge-guidelines (single CLI call)
87
- Phase 5 — Commit git add + commit
88
- ```
89
-
90
- Phases 1, 1b, and 2 are purely mechanical — they run fast and require no LLM supervision.
91
- Phase 3 is where parallel subagents do the guideline writing.
92
-
93
- ---
94
-
95
- ## Phase 0 — Discover all types
96
-
97
- Fetch the discovery endpoint and collect the full list of component type names.
98
- Store this as your working list.
99
-
100
- ```bash
101
- curl -sL http://localhost:<PORT>/api/cms/discovery/ > /tmp/discovery.json
102
- ```
103
-
104
- From the JSON (top-level keys from `/api/cms/discovery/`):
105
- - `components[].name` — component types needing Phases 1 + 3
106
- - `collections[].name` — collection types (Phase 1 screenshots + Phase 2 markdown)
107
- - `externals[].name` — external types (Phase 2 handles markdown; screenshots only if your app captures them)
108
-
109
- Compute each component's slug: `typeName.toLowerCase().replace(/\s+/g, '-').replace(/[()]/g, '')`
110
-
111
- **Skip check (partial runs only):** For each component, if **both** of these already exist, you may skip that component:
112
- - `<appDir>/docs/cms-guidelines/components/<slug>.md`
113
- - `<appDir>/docs/cms-guidelines/screenshots/index.json` has an entry for this component (`mode` `component`)
114
-
115
- If both exist, skip that component (already done). Only process the unfinished ones.
116
-
117
- **Full regeneration (`fresh` after clean slate):** **Do not apply** this skip check — process **all** discovery components.
118
-
119
- **Note:** Same **display name** can exist as both a component and a collection (e.g. FAQ). `cms-capture-screenshots` indexes entries by `mode::typeName::variant`; keep both screenshot sets when both exist.
120
-
121
- ---
122
-
123
- ## Phase 1 — Bulk screenshot capture (all components at once)
124
-
125
- This is the key step that makes the full run fast. Instead of capturing screenshots one
126
- type at a time inside each subagent, we capture everything upfront in a tight loop.
127
-
128
- For each component type name that needs processing, run:
129
-
130
- ```bash
131
- # Check if accepted-variants file exists for this type (check both components/ and collections/)
132
- SLUG="<type-slug>"
133
- VARIANTS_FILE="<appDir>/src/generated/cms-discovery/accepted-variants/components/${SLUG}.json"
134
- if [ ! -f "$VARIANTS_FILE" ]; then
135
- VARIANTS_FILE="<appDir>/src/generated/cms-discovery/accepted-variants/collections/${SLUG}.json"
136
- fi
137
-
138
- if [ -f "$VARIANTS_FILE" ]; then
139
- cms-capture-screenshots --variants "$VARIANTS_FILE" --app-dir <appDir>
140
- else
141
- # Fall back to default variants for the type
142
- cms-capture-screenshots --type "<TYPE_NAME>" --app-dir <appDir>
143
- fi
144
- ```
145
-
146
- Run all of these sequentially (screenshots require the browser to be driven one at a time).
147
- `cms-capture-screenshots` automatically updates `docs/cms-guidelines/screenshots/index.json` after each run.
148
-
149
- **If `agent-browser` is not available:** the command degrades to printing URLs only.
150
- Install it first: `npm install -g agent-browser && agent-browser install`.
151
-
152
- After all captures, confirm `docs/cms-guidelines/screenshots/index.json` exists and has entries.
153
-
154
- ### Phase 1b — Collection screenshots (required for a complete full run)
155
-
156
- Repeat the same loop for **each** `collections[].name` from discovery:
157
-
158
- - Resolve `accepted-variants/collections/<slug>.json` (same slug rules as Phase 0).
159
- - If missing, add a minimal variant file (e.g. single `default` variant) so capture can run, or run `generate-showcase-mocks` / manual backfill — see **curate-showcase-mocks** / **update-cms-guidelines** `fresh`.
160
-
161
- ```bash
162
- cms-capture-screenshots --variants "<appDir>/src/generated/cms-discovery/accepted-variants/collections/<slug>.json" --app-dir <appDir>
163
- ```
164
-
165
- **Full regeneration:** capture **every** collection. **Partial resume:** only collections that are new or that you intentionally refreshed.
166
-
167
- ---
168
-
169
- ## Phase 2 — Collections and externals (CLI, no subagents needed)
170
-
171
- Run once — this regenerates all collection guidelines and creates any missing external templates:
172
-
173
- ```bash
174
- cms-generate-collection-guidelines \
175
- --discovery-url http://localhost:<PORT>/api/cms/discovery/ \
176
- --app-dir <appDir>
177
- ```
178
-
179
- This writes `docs/cms-guidelines/collections/*.md` and creates stub `docs/cms-guidelines/externals/*.md` for any new externals.
180
-
181
- **External schemas:** If any new `externals/*.md` stubs were created, fill in their
182
- `## Fields & Schema` and `## Usage` sections manually before continuing (or after the full run).
183
- The rest of the pipeline doesn't depend on them being complete.
184
-
185
- ---
186
-
187
- ## Phase 3 — Component guidelines (parallel subagents)
188
-
189
- Launch subagents in batches of **4 in parallel**. Each subagent handles one component type
190
- through Phases B, C, and D only (screenshots are already done from Phases 1 and 1b).
191
-
192
- ### Subagent prompt template
193
-
194
- For each component type, use this prompt (fill in `<COMPONENT_TYPE>`, `<APP_DIR>`, `<PORT>`):
195
-
196
- ```
197
- Generate the CMS guideline fragment for <COMPONENT_TYPE>.
198
- Target app directory: <APP_DIR>
199
-
200
- IMPORTANT: Screenshots have already been captured. Skip Phase A entirely.
201
- Go straight to Phase B.
202
-
203
- Files to read before starting:
204
- - packages/contentful-cms/skills/cms-guidelines/generation-prompt.md (Phase B instructions)
205
- - packages/contentful-cms/skills/cms-guidelines/colour-hint-prompt.md (Phase C instructions)
206
- - packages/contentful-cms/skills/cms-guidelines/validation-prompt.md (Phase D instructions)
207
- - <APP_DIR>/src/project/components/<TypeName>.tsx (component source)
208
- - <APP_DIR>/generated/cms-discovery/field-list.json
209
- - <APP_DIR>/src/generated/cms-discovery/accepted-variants/{components|collections|externals}/<type-slug>.json
210
- - <APP_DIR>/docs/cms-guidelines/screenshots/index.json (which screenshots exist)
211
- - <APP_DIR>/.contentful-cms.json (get devBaseUrl for screenshot links)
212
-
213
- === Phase B: Generate guideline ===
214
- Follow generation-prompt.md (three-step process).
215
- The guideline MUST include a ## Screenshots table using devBaseUrl from .contentful-cms.json.
216
- Only include variants present in screenshots/index.json.
217
- Save output to <APP_DIR>/docs/cms-guidelines/components/<type-slug>.md.
218
-
219
- === Phase C: Colour hint ===
220
- Follow colour-hint-prompt.md.
221
- Run:
222
- cms-update-colour-hints --app-dir <APP_DIR> \
223
- --type "<COMPONENT_TYPE>" --hint "<hint>" --notes "<brief reason>"
224
-
225
- === Phase D: Validate ===
226
- Follow validation-prompt.md. Apply fixes until APPROVED.
227
-
228
- Do NOT run merge — that runs once after all components complete.
229
- ```
230
-
231
- ### Batch execution
232
-
233
- Process all unfinished components in batches:
234
- - Launch 4 subagents simultaneously
235
- - Wait for all 4 to complete before launching the next batch
236
- - If any subagent fails or times out, note the type name and re-run it individually
237
- using the **generate-cms-guidelines** skill in `single` mode
238
-
239
- Typical time per component: 3–6 minutes (mostly LLM time for generation + validation).
240
- Typical total time for 15 components in batches of 4: ~25–35 minutes.
241
-
242
- ---
243
-
244
- ## Phase 4 — Merge
245
-
246
- After all subagents complete, rebuild the combined document:
247
-
248
- ```bash
249
- cms-merge-guidelines --app-dir <appDir>
250
- # or from the app directory:
251
- pnpm run cms-guidelines:merge
252
- ```
253
-
254
- Open `docs/cms-guidelines/COMPONENT_GUIDELINES_FOR_LLM.md` and do a quick sanity check:
255
- - Does it contain all expected types?
256
- - Do the screenshot image links look correct (using the right port)?
257
-
258
- ---
259
-
260
- ## Phase 5 — Commit
261
-
262
- ```bash
263
- git add <appDir>/docs/cms-guidelines/ <appDir>/src/generated/cms-discovery/
264
- git commit -m "chore(<appName>): generate all CMS guidelines with screenshots"
265
- ```
266
-
267
- ---
268
-
269
- ## Handling failures and partial runs
270
-
271
- The pipeline is designed to be resumable. If it stops partway through:
272
-
273
- - **Phase 1 failed for some types:** Re-run `cms-capture-screenshots` for just those types.
274
- `index.json` is additive — it won't remove entries from previous runs.
275
- - **Phase 3 subagent failed:** Use `generate-cms-guidelines` skill in `single` mode for that type.
276
- - **Phase 2 not run yet:** Re-run `cms-generate-collection-guidelines` — it's idempotent for collections.
277
- - **Phase 4 merge not run:** Just run `cms-merge-guidelines` — it reads whatever `.md` files exist.
278
-
279
- To re-run everything for a single type after fixing a problem:
280
- ```bash
281
- # Re-capture screenshots
282
- cms-capture-screenshots --type "<TYPE_NAME>" --app-dir <appDir>
283
- # Then use generate-cms-guidelines skill (single mode) for the guideline
284
- ```
285
-
286
- ---
287
-
288
- ## Quick reference — full command sequence
289
-
290
- ```bash
291
- # 0. Prerequisites check
292
- curl -sL http://localhost:<PORT>/api/cms/discovery/ | head -c 100
293
- agent-browser --version
294
-
295
- # 1. Bulk screenshots (repeat for each type — use the mode subdir)
296
- cms-capture-screenshots --variants src/generated/cms-discovery/accepted-variants/components/<slug>.json --app-dir <appDir>
297
- # or for collections:
298
- cms-capture-screenshots --variants src/generated/cms-discovery/accepted-variants/collections/<slug>.json --app-dir <appDir>
299
-
300
- # 2. Collections + externals
301
- cms-generate-collection-guidelines \
302
- --discovery-url http://localhost:<PORT>/api/cms/discovery/ \
303
- --app-dir <appDir>
304
-
305
- # 3. [Parallel subagents — see Phase 3 above]
306
-
307
- # 4. Merge
308
- cms-merge-guidelines --app-dir <appDir>
309
-
310
- # 5. Commit
311
- git add docs/cms-guidelines/ src/generated/cms-discovery/
312
- git commit -m "chore: generate all CMS guidelines"
313
- ```
@@ -1,313 +0,0 @@
1
- ---
2
- name: "contentful-cms:generate-cms-guidelines"
3
- description: "Generate, regenerate, or merge CMS guideline markdown fragments for any app in the monorepo."
4
- ---
5
-
6
- # Skill: Generate CMS Guidelines
7
-
8
- Use this skill when you need to generate, regenerate, or merge CMS guideline markdown fragments for any app in the monorepo.
9
-
10
- **Orchestration:** For a **true full clean regeneration** (wipe artifacts, all screenshots, **new** component prose for every type, stale removal policy), use **`update-cms-guidelines`** (mode **`fresh`**) — not this skill’s `full` mode alone. This skill’s **`full`** mode follows **generate-all-guidelines**, which may **skip** types that already have fragments unless you are doing a **partial resume**.
11
-
12
- **Incremental:** If registrations changed, start with **`update-cms-guidelines`** mode **`sync`** so **removed** types are deleted (fragments, PNGs, index rows) before you add or refresh individual types with **`single`** here.
13
-
14
- ---
15
-
16
- ## When to use this skill
17
-
18
- - **Full site (first time or after clean slate):** Prefer invoking **`update-cms-guidelines`** → **`fresh`** (clean slate + **generate-all-guidelines**). Use this skill’s **`full`** only when aligned with that pipeline (no skip / post-clean-slate).
19
- - **Single type:** Regenerating the guideline for one component, collection, or external (e.g. after editing the component code).
20
- - **Merge only:** Rebuilding `COMPONENT_GUIDELINES_FOR_LLM.md` after manual edits to guideline fragments.
21
- - **Vague “regenerate everything”:** Ask whether the user means **`fresh`** (clean + rewrite all component guidelines) or **`sync`** + targeted updates — see **update-cms-guidelines**.
22
-
23
- ---
24
-
25
- ## Prerequisite: Showcase lifecycle
26
-
27
- Guidelines are only meaningful when the showcase is populated with realistic data. Complete these steps **before** running guideline generation for the first time:
28
-
29
- 1. **Build the site** and ensure all content is correct and published in Contentful.
30
- 2. **Generate showcase data:**
31
- ```bash
32
- pnpm --filter <appName> generate-showcase
33
- ```
34
- This writes `src/generated/showcase-examples.json` to the app.
35
- 3. **Curate showcase mocks:** Follow the [curate-showcase-mocks skill](.agents/skills/se-marketing-sites-curate-showcase-mocks/SKILL.md) to produce `showcase-mocks.json`.
36
- 4. **Generate field list:**
37
- ```bash
38
- # From the app directory:
39
- pnpm run cms-discovery:field-list
40
- # Or from repo root:
41
- pnpm --filter <appName> exec cms-generate-field-list --app-dir .
42
- ```
43
- This writes `generated/cms-discovery/field-list.json`.
44
-
45
- ---
46
-
47
- ## Inputs
48
-
49
- | Input | Description |
50
- |---|---|
51
- | **App directory** | Repo-relative path, e.g. `apps/example-om1` or `apps/example-se2026` |
52
- | **Mode** | `full` \| `single` \| `merge-only` |
53
- | **Type name** | Required for `single` mode — the exact type name from discovery, e.g. `"Hero"` or `"Cards Grid"` |
54
- | **Discovery URL** | URL to the live app's discovery endpoint, e.g. `http://localhost:3013/api/cms/discovery/` |
55
-
56
- **App ports** (app must be running for `full` and `single` modes):
57
-
58
- | App | Port | Discovery URL |
59
- |---|---|---|
60
- | example-brightline | 3010 | `http://localhost:3010/api/cms/discovery/` |
61
- | example-se2026 | 3012 | `http://localhost:3012/api/cms/discovery/` |
62
- | example-om1 | 3013 | `http://localhost:3013/api/cms/discovery/` |
63
- | example-empty | 3014 | `http://localhost:3014/api/cms/discovery/` |
64
- | example-brightlifekids | 3015 | `http://localhost:3015/api/cms/discovery/` |
65
-
66
- ---
67
-
68
- ## Mode: full
69
-
70
- Run all steps from scratch. Generates guidelines for all collections, externals, and components.
71
-
72
- ### Step 1 — Verify prerequisites
73
-
74
- Confirm that:
75
- - The app is running (check `http://localhost:<port>/api/cms/discovery/` returns JSON).
76
- - `generated/cms-discovery/field-list.json` exists in the app directory.
77
- - Showcase has been generated (see Prerequisite section above).
78
-
79
- ### Step 2 — Generate collections and externals
80
-
81
- Run the project-independent generator. It reads discovery, writes all `collections/*.md`, creates any missing `externals/*.md` templates, and updates `colour-hints.json`:
82
-
83
- ```bash
84
- cms-generate-collection-guidelines \
85
- --discovery-url <discoveryUrl> \
86
- --app-dir <appDir>
87
- ```
88
-
89
- **Overwrite behaviour:**
90
- - **Collections:** always overwritten (regenerated from discovery on each run).
91
- - **Externals:** created only if the file does not exist. Existing external files are preserved to protect hand-authored schema documentation.
92
-
93
- ### Step 2b — Fill in external component schemas (first time only)
94
-
95
- For each external component file created in `docs/cms-guidelines/externals/`, open the file and fill in the **Fields & Schema** and **Usage** sections. These files are not regenerated once created, so the schema documentation you add here is permanent.
96
-
97
- For each external type:
98
- 1. Check the Contentful content type schema (or ask the project owner) for the list of fields, their types, and purpose.
99
- 2. Replace the `<!-- TODO: ... -->` block in `## Fields & Schema` with a filled-in Markdown table.
100
- 3. Replace the `## Usage` placeholder with a short description of how to add and configure the component via `cms-edit`.
101
- 4. Commit the completed files to version control.
102
-
103
- Example of a completed `## Fields & Schema` section:
104
-
105
- ```markdown
106
- ## Fields & Schema
107
-
108
- | Field | Type | Required | Notes |
109
- |-------|------|----------|-------|
110
- | externalComponentType | Symbol | Yes | Must be set to `ResearchChart` |
111
- | data | Object | No | Chart config payload — see project data-viz spec |
112
- | cmsLabel | Symbol | Yes | Internal label for CMS authoring |
113
- ```
114
-
115
- ### Step 3 — Generate component guidelines
116
-
117
- For each component in discovery order, run the full per-component pipeline defined in
118
- [`packages/contentful-cms/skills/cms-guidelines/generate-component-guidelines.md`](../../../packages/contentful-cms/skills/cms-guidelines/generate-component-guidelines.md).
119
-
120
- To find unfinished components:
121
- 1. Fetch `<discoveryUrl>` and collect all `components[].name` values.
122
- 2. Compute slug for each: `name.toLowerCase().replace(/\s+/g, '-').replace(/[()]/g, '')`.
123
- 3. Check which slugs lack a corresponding file in `<appDir>/docs/cms-guidelines/components/<slug>.md`.
124
- 4. Process only the unfinished ones (or all, if regenerating).
125
-
126
- **For each unfinished component** (process in batches of 5 if preferred):
127
-
128
- Run a Cursor subagent with this prompt, substituting `<COMPONENT_TYPE>` and `<APP_DIR>`:
129
-
130
- ```
131
- Run the full guideline generation pipeline for <COMPONENT_TYPE>.
132
- Target app: <APP_DIR> (all paths relative to repo root / that directory).
133
-
134
- Read these pipeline docs first (they are in packages/contentful-cms/skills/cms-guidelines/):
135
- - generate-component-guidelines.md (overall pipeline)
136
- - variant-loop.md (Phase A: variant loop)
137
- - generation-prompt.md (Phase B: generation)
138
- - colour-hint-prompt.md (Phase C: colour hint)
139
- - validation-prompt.md (Phase D: validation)
140
-
141
- === Phase A: Variant loop ===
142
- Follow variant-loop.md.
143
- 1. Read src/project/components/<TypeName>.tsx (or collections/<TypeName>.tsx).
144
- 2. Read generated/cms-discovery/field-list.json for field metadata.
145
- 3. Propose 5 variants using variant-proposal-prompt.md.
146
- 4. Capture screenshots:
147
- cms-capture-screenshots --variants /tmp/<type-slug>-variants.json --app-dir <APP_DIR>
148
- This also updates docs/cms-guidelines/screenshots/index.json automatically.
149
- 5. Evaluate screenshots using evaluation-prompt.md.
150
- When done: save accepted list to generated/cms-discovery/accepted-variants/{components|collections|externals}/<type-slug>.json
151
- (choose subdir based on mode: component → components/, collection → collections/, external → externals/)
152
-
153
- === Phase B: Generate guideline ===
154
- Follow generation-prompt.md.
155
- 1. Describe screenshots (Step 1 prompt).
156
- 2. Extract behaviour from code (Step 2 prompt).
157
- 3. Merge into guideline block (Step 3 prompt).
158
- IMPORTANT: Read docs/cms-guidelines/screenshots/index.json and .contentful-cms.json first.
159
- The guideline must include a ## Screenshots section with image links:
160
- ![Default](<devBaseUrl>/cms/screenshot?file={components|collections|externals}/<type-slug>-default.png)
161
- Use the `file` field from index.json (which includes the mode subpath).
162
- Only include variants present in index.json. Use devBaseUrl from .contentful-cms.json.
163
- 4. Save to docs/cms-guidelines/components/<type-slug>.md.
164
-
165
- === Phase C: Colour hint ===
166
- Follow colour-hint-prompt.md.
167
- Run:
168
- cms-update-colour-hints --app-dir <APP_DIR> \
169
- --type "<COMPONENT_TYPE>" --hint "<hint>" --notes "<brief reason>"
170
-
171
- === Phase D: Validate ===
172
- Follow validation-prompt.md. Apply fixes until APPROVED.
173
-
174
- Do NOT run merge yet — merge runs once after all components.
175
- ```
176
-
177
- ### Step 4 — Merge
178
-
179
- After all components are done, run merge:
180
-
181
- ```bash
182
- cms-merge-guidelines --app-dir <appDir>
183
- ```
184
-
185
- Or from the app directory: `pnpm run cms-guidelines:merge`
186
-
187
- ### Step 5 — Commit (optional)
188
-
189
- ```bash
190
- git add <appDir>/docs/cms-guidelines/ <appDir>/generated/cms-discovery/
191
- git commit -m "chore(<app>): generate all CMS guidelines"
192
- ```
193
-
194
- ---
195
-
196
- ## Mode: single
197
-
198
- Regenerate the guideline for one type. Useful after editing a component's code.
199
-
200
- ### Step 1 — Fetch discovery to determine type category
201
-
202
- ```bash
203
- curl -sL '<discoveryUrl>' | node -e "
204
- const data = JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));
205
- const name = '<TYPE_NAME>';
206
- const inComponents = data.components.some(c => c.name === name);
207
- const inCollections = data.collections.some(c => c.name === name);
208
- const inExternals = data.externals.some(c => c.name === name);
209
- console.log(inComponents ? 'component' : inCollections ? 'collection' : inExternals ? 'external' : 'not found');
210
- "
211
- ```
212
-
213
- ### Step 2a — If component
214
-
215
- Run the full per-component pipeline (Phases A–D) from the subagent prompt in Mode: full → Step 3, for just this one type.
216
-
217
- ### Step 2b — If collection or external
218
-
219
- For a **collection:** re-run the generator — it always overwrites collection files:
220
-
221
- ```bash
222
- cms-generate-collection-guidelines \
223
- --discovery-url <discoveryUrl> \
224
- --app-dir <appDir>
225
- ```
226
-
227
- For an **external:** the generator will not overwrite an existing file. Edit `docs/cms-guidelines/externals/<slug>.md` directly, updating the `## Fields & Schema` and `## Usage` sections as needed. If you need to regenerate from the template (e.g. for a new external), delete the file first and re-run the generator, then fill in the schema sections.
228
-
229
- ### Step 3 — Merge
230
-
231
- ```bash
232
- cms-merge-guidelines --app-dir <appDir>
233
- ```
234
-
235
- ---
236
-
237
- ## Mode: merge-only
238
-
239
- Use when guideline fragments have been edited manually or generated outside this skill.
240
-
241
- ```bash
242
- cms-merge-guidelines --app-dir <appDir>
243
- ```
244
-
245
- Or from the app directory: `pnpm run cms-guidelines:merge`
246
-
247
- This rebuilds `docs/cms-guidelines/COMPONENT_GUIDELINES_FOR_LLM.md` from all existing `components/*.md`, `collections/*.md`, and `externals/*.md` fragments.
248
-
249
- ---
250
-
251
- ## Output files
252
-
253
- All produced under `<appDir>`:
254
-
255
- | File | Description |
256
- |---|---|
257
- | `docs/cms-guidelines/components/<slug>.md` | Per-component guideline fragment (includes screenshot links) |
258
- | `docs/cms-guidelines/collections/<slug>.md` | Per-collection guideline fragment |
259
- | `docs/cms-guidelines/externals/<slug>.md` | Per-external guideline fragment |
260
- | `docs/cms-guidelines/screenshots/index.json` | Index of all captured screenshots (type, variant, file, date) |
261
- | `docs/cms-guidelines/COMPONENT_GUIDELINES_FOR_LLM.md` | Merged full document (includes screenshot links) |
262
- | `generated/cms-discovery/accepted-variants/{components\|collections\|externals}/<slug>.json` | Accepted variant list (per type, in mode subdir) |
263
- | `generated/cms-discovery/colour-hints.json` | Colour application hints for all types |
264
-
265
- ### Screenshot links in guidelines
266
-
267
- Each component guideline contains a `## Screenshots` section with image links:
268
-
269
- ```markdown
270
- ## Screenshots
271
-
272
- | Variant | Preview |
273
- |---------|---------|
274
- | Default | ![Default](http://localhost:3010/cms/screenshot?file=components/hero-default.png) |
275
- | Navy | ![Navy](http://localhost:3010/cms/screenshot?file=components/hero-navy.png) |
276
- ```
277
-
278
- These links:
279
- - Resolve when the dev server is running (the `/cms/screenshot` route serves the PNG files)
280
- - Use the `devBaseUrl` from `.contentful-cms.json` for the host
281
- - Work for both human reviewers browsing the guidelines and AI assistants reading the markdown
282
- - Are preserved in `COMPONENT_GUIDELINES_FOR_LLM.md` when `cms-merge-guidelines` runs
283
-
284
- ---
285
-
286
- ## Pipeline reference
287
-
288
- All per-component pipeline docs live in `packages/contentful-cms/skills/cms-guidelines/`:
289
-
290
- | File | Purpose |
291
- |---|---|
292
- | `generate-component-guidelines.md` | Full pipeline overview (Phases A–F) |
293
- | `variant-loop.md` | Phase A: propose → screenshot → evaluate |
294
- | `variant-proposal-prompt.md` | LLM prompt for proposing variants |
295
- | `evaluation-prompt.md` | LLM prompt for evaluating screenshots |
296
- | `generation-prompt.md` | Phase B: three-step guideline generation |
297
- | `colour-hint-prompt.md` | Phase C: derive colour application hint |
298
- | `validation-prompt.md` | Phase D: 9-check validation |
299
-
300
- ---
301
-
302
- ## New CLI reference
303
-
304
- ```
305
- cms-generate-collection-guidelines --discovery-url <url> --app-dir <path>
306
- ```
307
-
308
- | Flag | Description |
309
- |---|---|
310
- | `--discovery-url <url>` | Discovery API URL (required). App must be running. |
311
- | `--app-dir <path>` | App directory (default: cwd). |
312
-
313
- Writes `docs/cms-guidelines/collections/*.md`, `docs/cms-guidelines/externals/*.md`, and updates `generated/cms-discovery/colour-hints.json`. Project-independent: works for any app in the monorepo.