@se-studio/contentful-cms 1.0.42 → 1.0.44

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/contentful-cms Changelog
2
2
 
3
+ ## 1.0.44
4
+
5
+ ### Patch Changes
6
+
7
+ - Version bump: patch for changed packages
8
+
9
+ ## 1.0.43
10
+
11
+ ### Patch Changes
12
+
13
+ - Version bump: patch for changed packages
14
+
3
15
  ## 1.0.42
4
16
 
5
17
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@se-studio/contentful-cms",
3
- "version": "1.0.42",
3
+ "version": "1.0.44",
4
4
  "description": "CLI tool for AI agents to read and edit Contentful draft content without publish permissions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,60 +0,0 @@
1
- ---
2
- name: "Alt Text Audit"
3
- description: "Audit and improve image alt text across site pages using cms-edit, with brand-aware terminology and accessibility best practices."
4
- ---
5
-
6
- # Skill: contentful-cms — Alt Text Audit
7
-
8
- Use this skill when auditing or improving **image alt text** across a site's pages using `cms-edit`. Works with any brand context skill for customer-specific terminology.
9
-
10
- ## Brand Context
11
-
12
- Before starting, check if a brand context skill is available (e.g., "OM1 Brand Context", "Something Else Brand Context"). If so, use its terminology, image interpretation guidelines, and brand voice when writing alt text.
13
-
14
- If no brand context is available, ask the user about any brand-specific terms before proceeding.
15
-
16
- ## Workflow
17
-
18
- 1. **Get all pages**: `cms-edit sitemap`
19
- 2. **For each page** (or a specific page if the user specified one):
20
- a. `cms-edit open /<slug>`
21
- b. `cms-edit snapshot` — identify components with visual/image/media fields
22
- c. For each image-bearing component:
23
- - `cms-edit read @ref` to inspect fields
24
- - Check `altText` on any image/visual references
25
- - `cms-edit read @ref visual` to see asset details if needed
26
- d. **Flag** images with:
27
- - Missing alt text (empty or null)
28
- - Generic alt text ("image", "photo", "banner", "screenshot", "img", "picture")
29
- - Alt text that doesn't use brand terminology (if brand context available)
30
- - Alt text over 125 characters
31
- e. **Generate** improved alt text following the guidelines below
32
- f. `cms-edit set @ref altText "new alt text"`
33
- g. `cms-edit diff` to review, then `cms-edit save`
34
-
35
- ## Alt Text Guidelines
36
-
37
- 1. **Be specific and descriptive** — describe what is actually in the image
38
- 2. **Use brand terminology** — refer to the brand context for correct terms
39
- 3. **Keep under 125 characters** — screen readers truncate longer text
40
- 4. **Don't start with** "Image of", "Photo of", "Picture of"
41
- 5. **Decorative images** — set alt to "" (empty string) for dividers, background patterns
42
- 6. **Context matters** — describe the image's purpose on the page, not just its visual content
43
- 7. **Include relevant actions** — if people are doing something meaningful, describe it
44
-
45
- ## Reading Page Content
46
-
47
- To understand a page before auditing its images, use `fetch_page_markdown` (from the site-workflows MCP server) with the page slug.
48
-
49
- ## Output
50
-
51
- Present a summary table when complete:
52
-
53
- | Page | Component | Old Alt Text | New Alt Text | Status |
54
- |------|-----------|-------------|-------------|--------|
55
-
56
- Where Status is: Updated, Skipped (decorative), Already Good, or Needs Review.
57
-
58
- ## Related skills
59
-
60
- See the **core** skill for the full cms-edit workflow (open, snapshot, read, set, save).
@@ -1,166 +0,0 @@
1
- # CMS Guidelines Generation
2
-
3
- This directory contains the pipeline prompts and documentation for generating CMS component guideline fragments for any app in the monorepo.
4
-
5
- ---
6
-
7
- ## What are CMS guidelines?
8
-
9
- Guidelines are short markdown fragments — one per CMS type — that describe how each component or collection looks, what fields it uses, how colours are applied, and how it behaves. They are merged into `docs/cms-guidelines/COMPONENT_GUIDELINES_FOR_LLM.md`, a single document used to give LLMs accurate context about the app's component library.
10
-
11
- ---
12
-
13
- ## Lifecycle: From content to guidelines
14
-
15
- 1. **Build the site** — implement all components and collections; ensure all content is correct and published in Contentful.
16
- 2. **Generate showcase data** — pull real Contentful data into the app's showcase:
17
- ```bash
18
- pnpm --filter <appName> generate-showcase
19
- ```
20
- This writes `src/generated/showcase-examples.json`.
21
- 3. **Curate showcase mocks** — run the [curate-showcase-mocks skill](.agents/skills/se-marketing-sites-curate-showcase-mocks/SKILL.md) to select the best examples into `showcase-mocks.json`. This makes the showcase (and screenshots) show realistic content.
22
- 4. **Generate field list** — parse TypeScript types to produce structured field metadata:
23
- ```bash
24
- # From the app directory:
25
- pnpm run cms-discovery:field-list
26
-
27
- # Or from repo root:
28
- pnpm --filter <appName> exec cms-generate-field-list --app-dir .
29
- ```
30
- 5. **Generate guidelines** — run the [Generate CMS guidelines skill](.agents/skills/contentful-cms-generate-cms-guidelines/SKILL.md).
31
-
32
- Steps 1–3 only need to be repeated when content or component code changes significantly. Step 4 only needs to be repeated when TypeScript types change. Step 5 can be re-run at any time.
33
-
34
- ---
35
-
36
- ## How to run guideline generation
37
-
38
- Use the Cursor skill at [`.agents/skills/contentful-cms-generate-cms-guidelines/SKILL.md`](.agents/skills/contentful-cms-generate-cms-guidelines/SKILL.md). It supports three modes:
39
-
40
- | Mode | When to use |
41
- |---|---|
42
- | `full` | First-time generation, or regenerate everything |
43
- | `single` | Regenerate one component after code changes |
44
- | `merge-only` | Rebuild `COMPONENT_GUIDELINES_FOR_LLM.md` after manual fragment edits |
45
-
46
- **Example: full from scratch for `example-om1`**
47
-
48
- Start the app:
49
- ```bash
50
- pnpm --filter example-om1 dev
51
- ```
52
-
53
- Then invoke the skill with:
54
- - App directory: `apps/example-om1`
55
- - Mode: `full`
56
- - Discovery URL: `http://localhost:3013/api/cms/discovery/`
57
-
58
- **Example: single component**
59
-
60
- Invoke the skill with:
61
- - App directory: `apps/example-se2026`
62
- - Mode: `single`
63
- - Type name: `Hero`
64
- - Discovery URL: `http://localhost:3012/api/cms/discovery/`
65
-
66
- **Example: merge only**
67
-
68
- ```bash
69
- cms-merge-guidelines --app-dir apps/example-om1
70
- ```
71
-
72
- ---
73
-
74
- ## CLIs used by this pipeline
75
-
76
- | CLI | Purpose |
77
- |---|---|
78
- | `cms-generate-html-style-guide` | Generate `html-component-style-guide.md` from `tailwind.config.json` + `globals.css` |
79
- | `cms-generate-field-list` | Parse TypeScript types → `field-list.json` |
80
- | `cms-capture-screenshots` | Capture component screenshots for variant evaluation |
81
- | `cms-update-colour-hints` | Upsert a colour hint in `colour-hints.json` |
82
- | `cms-generate-collection-guidelines` | Generate all collection/external `.md` files from a discovery URL |
83
- | `cms-merge-guidelines` | Merge all fragments → `COMPONENT_GUIDELINES_FOR_LLM.md` |
84
-
85
- All CLIs are provided by `@se-studio/project-build`. Run `pnpm build` from the repo root to ensure they are built and linked.
86
-
87
- ---
88
-
89
- ## `cms-generate-html-style-guide`
90
-
91
- Generates `docs/cms-guidelines/html-component-style-guide.md` — a design system reference for any LLM or developer authoring HTML in `HtmlComponent` CMS entries.
92
-
93
- Does not require a running dev server. Reads only local files:
94
- - `tailwind.config.json` → colour palette, typography classes, grid configuration
95
- - `src/app/globals.css` → custom utilities, RTF class names, CSS custom properties
96
-
97
- ```bash
98
- # From the app directory:
99
- pnpm cms-generate-html-style-guide
100
- ```
101
-
102
- The output file is a **static fragment** — not generated by the LLM component pipeline. It is automatically included as a preamble in `COMPONENT_GUIDELINES_FOR_LLM.md` when `cms-merge-guidelines` runs. Regenerate it whenever the design system changes.
103
-
104
- ---
105
-
106
- ## `cms-generate-collection-guidelines`
107
-
108
- New project-independent CLI. Reads the discovery API and writes collection and external guideline fragments without any app-specific hardcoding.
109
-
110
- ```bash
111
- cms-generate-collection-guidelines \
112
- --discovery-url http://localhost:3010/api/cms/discovery/ \
113
- --app-dir apps/example-brightline
114
- ```
115
-
116
- Options:
117
-
118
- | Flag | Description |
119
- |---|---|
120
- | `--discovery-url <url>` | Discovery API URL (required). App must be running. |
121
- | `--app-dir <path>` | App directory (default: cwd). |
122
-
123
- Outputs:
124
- - `docs/cms-guidelines/collections/<slug>.md` for every collection
125
- - `docs/cms-guidelines/externals/<slug>.md` for every external
126
- - Updates `generated/cms-discovery/colour-hints.json`
127
-
128
- ---
129
-
130
- ## Pipeline document index
131
-
132
- | File | Purpose |
133
- |---|---|
134
- | `generate-component-guidelines.md` | Full pipeline overview: Phases A–F |
135
- | `variant-loop.md` | Phase A: propose variants → screenshot → evaluate |
136
- | `variant-proposal-prompt.md` | LLM prompt: propose showcase variants |
137
- | `evaluation-prompt.md` | LLM prompt: evaluate screenshot diversity |
138
- | `generation-prompt.md` | Phase B: three-step guideline generation |
139
- | `colour-hint-prompt.md` | Phase C: derive colour application hint |
140
- | `validation-prompt.md` | Phase D: 9-check guideline validation |
141
-
142
- ---
143
-
144
- ## Output files (per app)
145
-
146
- ```
147
- <appDir>/
148
- docs/cms-guidelines/
149
- html-component-style-guide.md # design system reference (auto-generated; static fragment)
150
- components/ # one .md per componentType
151
- collections/ # one .md per collectionType
152
- externals/ # one .md per externalComponentType
153
- COMPONENT_GUIDELINES_FOR_LLM.md # merged document (includes style guide as preamble)
154
- generated/cms-discovery/
155
- field-list.json
156
- colour-hints.json
157
- accepted-variants/
158
- components/ # one .json per component type
159
- collections/ # one .json per collection type
160
- externals/ # one .json per external component type
161
- screenshots/
162
- components/ # PNG screenshots for components
163
- collections/ # PNG screenshots for collections
164
- externals/ # PNG screenshots for externals
165
- index.json # file field uses subpath e.g. "components/hero-default.png"
166
- ```
@@ -1,77 +0,0 @@
1
- # Colour Hint Prompt
2
-
3
- **Step 5.2 — Produce a structured colour hint per CMS type.**
4
-
5
- The colour hint is a short machine-readable label describing how `backgroundColour` and
6
- `textColour` are applied in this component. It is stored in
7
- `generated/cms-discovery/colour-hints.json` and served by the discovery API.
8
-
9
- ---
10
-
11
- ## Purpose
12
-
13
- The colour hint helps tools and LLMs quickly understand how colours work without reading
14
- the full guideline. For example:
15
-
16
- - `"section"` → the colour applies to the full-width section (both copy and visual columns).
17
- - `"card"` → the colour is applied per-card inside a collection.
18
- - `"none"` → this type does not use backgroundColour/textColour.
19
-
20
- ---
21
-
22
- ## Valid hint values
23
-
24
- | Value | Meaning |
25
- |---|---|
26
- | `"section"` | backgroundColour/textColour apply to the full-width section wrapper (most components) |
27
- | `"card"` | Colours apply per-card (collection items); section has no colour |
28
- | `"section+card"` | Both section-level and card-level colours exist |
29
- | `"none"` | The type does not use backgroundColour or textColour |
30
-
31
- ---
32
-
33
- ## Prompt (to run as part of generation)
34
-
35
- ```
36
- You are writing a colour hint for a CMS component documentation system.
37
-
38
- Component: <COMPONENT_TYPE>
39
- Component source:
40
- <COMPONENT_SOURCE>
41
-
42
- Section.tsx source (shows how backgroundColour/textColour are applied at section level):
43
- <SECTION_SOURCE>
44
-
45
- Look at how backgroundColour and textColour are used in the source.
46
-
47
- Rules:
48
- - If backgroundColour/textColour are in USED_FIELDS AND passed to a Section wrapper (or
49
- similar full-width wrapper): hint = "section"
50
- - If backgroundColour/textColour are applied per-card in a collection: hint = "card"
51
- - If both are true: hint = "section+card"
52
- - If neither backgroundColour nor textColour is in USED_FIELDS: hint = "none"
53
-
54
- Output JSON only:
55
- {
56
- "typeName": "<COMPONENT_TYPE>",
57
- "colourApplication": "section",
58
- "notes": "backgroundColour and textColour applied to the full Section wrapper."
59
- }
60
- ```
61
-
62
- ---
63
-
64
- ## Script to update colour-hints.json
65
-
66
- Run the script after generating each component:
67
-
68
- ```bash
69
- cms-update-colour-hints --type "Hero" --hint "section" \
70
- --notes "backgroundColour and textColour applied to the full Section wrapper."
71
- ```
72
-
73
- Or provide an LLM-generated JSON file:
74
-
75
- ```bash
76
- cms-update-colour-hints --from /tmp/hero-colour-hint.json
77
- ```
@@ -1,84 +0,0 @@
1
- # Evaluation Prompt — Screenshot Differences
2
-
3
- **Step 4.3 — Prompt for evaluating whether captured screenshots are suitably different.**
4
-
5
- The evaluation step is used by the orchestrator (Step 4.4) to decide whether to accept the
6
- current set of screenshots, or to request additional variants (up to the 2×N cap).
7
-
8
- ---
9
-
10
- ## When to run
11
-
12
- After `cms-capture-screenshots` has captured a batch of screenshots, feed them to an LLM with
13
- this prompt. The LLM inspects the images and returns a verdict.
14
-
15
- ---
16
-
17
- ## Prompt
18
-
19
- ```
20
- You are reviewing a set of component screenshots for CMS documentation purposes.
21
-
22
- Your task: decide whether this set of screenshots is "suitably different" — meaning
23
- each screenshot looks visually distinct enough that a reader could tell them apart,
24
- and together they cover the important visual states of the component.
25
-
26
- Component: <COMPONENT_TYPE>
27
- Screenshots (attached as images):
28
- <LIST OF {label, path, description} PAIRS>
29
-
30
- Rules:
31
- 1. Two screenshots are "not different enough" if they look nearly identical — same layout,
32
- same colours, same content, just minor text length differences.
33
- 2. The set is "suitably different" if:
34
- - At least two screenshots have clearly different layouts (e.g. one has a visual, one does not), OR
35
- - At least two screenshots have clearly different colour schemes (e.g. one light, one dark), OR
36
- - At least two screenshots show clearly different content (e.g. one full, one minimal).
37
- 3. A set with only one screenshot is NEVER "suitably different" — we need at least two variants.
38
-
39
- Output JSON only:
40
- {
41
- "suitablyDifferent": true,
42
- "reason": "Short explanation of why the set is or is not diverse enough.",
43
- "acceptedVariants": ["default", "navy", "no-visual"],
44
- "rejectedVariants": ["minimal"],
45
- "suggestions": [
46
- "The 'minimal' variant looks too similar to 'no-visual'. Try a variant with a tinted background
47
- instead, e.g. Pine background."
48
- ]
49
- }
50
-
51
- - acceptedVariants: labels of screenshots that are good to keep.
52
- - rejectedVariants: labels that are too similar to others or not useful.
53
- - suggestions: optional list of new variant ideas to try if suitablyDifferent is false
54
- (or if any variant was rejected).
55
- - If suitablyDifferent is true, suggestions can be empty.
56
- ```
57
-
58
- ---
59
-
60
- ## Output contract
61
-
62
- ```json
63
- {
64
- "suitablyDifferent": true,
65
- "reason": "The default and navy variants have clearly different colour schemes. The no-visual variant shows a different layout. Together they document the main visual states.",
66
- "acceptedVariants": ["default", "navy", "no-visual"],
67
- "rejectedVariants": ["minimal"],
68
- "suggestions": [
69
- "Consider replacing 'minimal' with a Pine background variant to show a green colour scheme."
70
- ]
71
- }
72
- ```
73
-
74
- ---
75
-
76
- ## How the orchestrator uses this
77
-
78
- 1. If `suitablyDifferent === true` AND all variants are accepted → stop; use the accepted set.
79
- 2. If `suitablyDifferent === false` OR any variants were rejected:
80
- - If `attempts < 2 × N` → use `suggestions` to generate additional variant params; capture
81
- the new screenshots; re-evaluate.
82
- - If `attempts >= 2 × N` → stop; use `acceptedVariants` from the best evaluation so far.
83
- 3. The final accepted set is written to `generated/cms-discovery/accepted-variants/{components|collections|externals}/<type-slug>.json`
84
- and the screenshots are committed to `docs/cms-guidelines/screenshots/{components|collections|externals}/`.
@@ -1,126 +0,0 @@
1
- # Generate Component Guidelines — Full Pipeline (Step 5.4)
2
-
3
- **End-to-end pipeline for one component:** variant loop → generate → colour hint → validate → merge → commit.
4
-
5
- ---
6
-
7
- ## What this produces
8
-
9
- For one CMS type (e.g. Hero):
10
-
11
- | Output | Location |
12
- |---|---|
13
- | Variant screenshots | `docs/cms-guidelines/screenshots/components/hero-*.png` |
14
- | Accepted variant list | `generated/cms-discovery/accepted-variants/components/hero.json` |
15
- | Guideline fragment | `docs/cms-guidelines/components/hero.md` |
16
- | Colour hint entry | `generated/cms-discovery/colour-hints.json` |
17
- | Merged full doc (updated) | `docs/cms-guidelines/COMPONENT_GUIDELINES_FOR_LLM.md` |
18
-
19
- ---
20
-
21
- ## Cursor agent task prompt
22
-
23
- **Assign to a Cursor subagent. Provide:**
24
- - This file
25
- - `variant-loop.md` (in the same skills/cms-guidelines/ directory)
26
- - `generation-prompt.md`
27
- - `colour-hint-prompt.md`
28
- - `validation-prompt.md`
29
- - `docs/cms-guidelines/LAYOUT.md`
30
- - `tmp/component-guidelines-target-format.md`
31
-
32
- **Task prompt:**
33
-
34
- ```
35
- Run the full guideline generation pipeline for <COMPONENT_TYPE>.
36
- Target app: <APP_DIR> (all paths relative to that directory).
37
-
38
- === Phase A: Variant loop ===
39
- Follow variant-loop.md.
40
- 1. Read src/project/components/<TypeName>.tsx (or collections/<TypeName>.tsx).
41
- 2. Read generated/cms-discovery/field-list.json for field metadata.
42
- 3. Propose N=5 variants using the prompt in variant-proposal-prompt.md.
43
- 4. Capture screenshots:
44
- cms-capture-screenshots --variants /tmp/<type-slug>-variants.json --app-dir <APP_DIR>
45
- 5. Evaluate screenshots using evaluation-prompt.md.
46
- - If not suitably different and attempts < 2×N: capture new suggestions, re-evaluate.
47
- - When done: save accepted list to generated/cms-discovery/accepted-variants/{components|collections|externals}/<type-slug>.json
48
-
49
- === Phase B: Generate guideline ===
50
- Follow generation-prompt.md.
51
- 1. Describe screenshots (Step 1 prompt).
52
- 2. Extract behaviour from code (Step 2 prompt).
53
- 3. Merge into guideline block (Step 3 prompt).
54
- 4. Save output to docs/cms-guidelines/components/<type-slug>.md.
55
- (Collections → collections/<type-slug>.md, externals → externals/<type-slug>.md)
56
-
57
- === Phase C: Colour hint ===
58
- Follow colour-hint-prompt.md.
59
- Derive the colour application hint (section/card/section+card/none) from the source.
60
- Run:
61
- cms-update-colour-hints --app-dir <APP_DIR> \
62
- --type "<COMPONENT_TYPE>" --hint "<hint>" --notes "<brief reason>"
63
-
64
- === Phase D: Validate ===
65
- Follow validation-prompt.md.
66
- 1. Read the generated fragment and the component source.
67
- 2. Run the 9-check validation.
68
- 3. If NEEDS REVISION: apply fixes to the fragment and re-run validation.
69
- 4. Repeat until APPROVED.
70
-
71
- === Phase E: Merge ===
72
- cms-merge-guidelines --app-dir <APP_DIR>
73
- This updates docs/cms-guidelines/COMPONENT_GUIDELINES_FOR_LLM.md.
74
-
75
- === Phase F: Commit ===
76
- git add docs/cms-guidelines/ generated/cms-discovery/
77
- git commit -m "chore: generate guidelines for <COMPONENT_TYPE>"
78
- ```
79
-
80
- ---
81
-
82
- ## Manual pipeline (for Hero — already partially done)
83
-
84
- Hero has a hand-written guideline fragment (Step 3.1), accepted variant screenshots
85
- (Step 4.2), and colour hints (Step 5.2). To complete the pipeline manually:
86
-
87
- ```bash
88
- # Phase D: Validate hero.md (hand-written)
89
- # Use: validation-prompt.md + src/project/components/Hero.tsx
90
- # Apply any fixes to docs/cms-guidelines/components/hero.md
91
-
92
- # Phase E: Merge
93
- cms-merge-guidelines
94
-
95
- # Phase F: Commit
96
- git add docs/cms-guidelines/ generated/cms-discovery/
97
- git commit -m "chore: complete Hero guideline pipeline"
98
- ```
99
-
100
- ---
101
-
102
- ## For all components (full site run)
103
-
104
- To generate guidelines for all components and collections:
105
-
106
- 1. Get the list of all types from the discovery API:
107
- ```
108
- GET /api/cms/discovery
109
- ```
110
- 2. For each type in components[], collections[], externals[], run this pipeline.
111
- 3. After all types: run merge and commit the final COMPONENT_GUIDELINES_FOR_LLM.md.
112
-
113
- A full run typically takes 5–10 minutes per component (mostly LLM time) and
114
- 30–60 minutes total for a typical site.
115
-
116
- ---
117
-
118
- ## npm scripts summary
119
-
120
- | Script | What it does |
121
- |---|---|
122
- | `pnpm run cms-discovery:field-list` | Generate `generated/cms-discovery/field-list.json` from TypeScript types |
123
- | `pnpm run cms-guidelines:screenshots` | Capture screenshots for a type (interactive) |
124
- | `pnpm run cms-guidelines:merge` | Merge per-type files into COMPONENT_GUIDELINES_FOR_LLM.md |
125
- | `cms-update-colour-hints` | Upsert a colour hint in colour-hints.json |
126
- | `cms-capture-screenshots` | Capture screenshots for a type |