@se-studio/project-build 1.0.105 → 1.0.107
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 +13 -0
- package/dist/cms-capture-screenshots.js +13 -5
- package/dist/cms-capture-screenshots.js.map +1 -1
- package/dist/cms-generate-collection-guidelines.js +35 -4
- package/dist/cms-generate-collection-guidelines.js.map +1 -1
- package/dist/cms-merge-guidelines.js +2 -0
- package/dist/cms-merge-guidelines.js.map +1 -1
- package/dist/generate-showcase-mocks.js +68 -8
- package/dist/generate-showcase-mocks.js.map +1 -1
- package/dist/loadTailwindConfig.d.ts +33 -0
- package/dist/loadTailwindConfig.d.ts.map +1 -0
- package/dist/loadTailwindConfig.js +112 -0
- package/dist/loadTailwindConfig.js.map +1 -0
- package/package.json +2 -2
- package/skills/contentful-cms/cms-guidelines/README.md +147 -0
- package/skills/contentful-cms/cms-guidelines/colour-hint-prompt.md +77 -0
- package/skills/contentful-cms/cms-guidelines/evaluation-prompt.md +84 -0
- package/skills/contentful-cms/cms-guidelines/generate-component-guidelines.md +126 -0
- package/skills/contentful-cms/cms-guidelines/generation-prompt.md +231 -0
- package/skills/contentful-cms/cms-guidelines/validation-prompt.md +170 -0
- package/skills/contentful-cms/cms-guidelines/variant-loop.md +189 -0
- package/skills/contentful-cms/cms-guidelines/variant-proposal-prompt.md +131 -0
- package/skills/contentful-cms/core/SKILL.md +501 -0
- package/skills/contentful-cms/generate-all-guidelines/SKILL.md +313 -0
- package/skills/contentful-cms/generate-cms-guidelines/SKILL.md +14 -8
- package/skills/contentful-cms/manifest.json +7 -0
- package/skills/contentful-cms/navigation/SKILL.md +18 -0
- package/skills/contentful-cms/rich-text/SKILL.md +23 -0
- package/skills/contentful-cms/screenshots/SKILL.md +41 -0
- package/skills/contentful-cms/templates/SKILL.md +16 -0
- package/skills/contentful-cms/update-cms-guidelines/SKILL.md +335 -0
- package/skills/se-marketing-sites/curate-showcase-mocks/SKILL.md +6 -3
- package/skills/se-marketing-sites/register-cms-features/SKILL.md +1 -1
|
@@ -0,0 +1,147 @@
|
|
|
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](.cursor/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](.cursor/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 [`.cursor/skills/contentful-cms/generate-cms-guidelines/SKILL.md`](.cursor/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-field-list` | Parse TypeScript types → `field-list.json` |
|
|
79
|
+
| `cms-capture-screenshots` | Capture component screenshots for variant evaluation |
|
|
80
|
+
| `cms-update-colour-hints` | Upsert a colour hint in `colour-hints.json` |
|
|
81
|
+
| `cms-generate-collection-guidelines` | **New** — generate all collection/external `.md` files from a discovery URL |
|
|
82
|
+
| `cms-merge-guidelines` | Merge all fragments → `COMPONENT_GUIDELINES_FOR_LLM.md` |
|
|
83
|
+
|
|
84
|
+
All CLIs are provided by `@se-studio/contentful-cms`. Run `pnpm build` from the repo root to ensure they are built and linked.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## `cms-generate-collection-guidelines`
|
|
89
|
+
|
|
90
|
+
New project-independent CLI. Reads the discovery API and writes collection and external guideline fragments without any app-specific hardcoding.
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
cms-generate-collection-guidelines \
|
|
94
|
+
--discovery-url http://localhost:3010/api/cms/discovery/ \
|
|
95
|
+
--app-dir apps/example-brightline
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Options:
|
|
99
|
+
|
|
100
|
+
| Flag | Description |
|
|
101
|
+
|---|---|
|
|
102
|
+
| `--discovery-url <url>` | Discovery API URL (required). App must be running. |
|
|
103
|
+
| `--app-dir <path>` | App directory (default: cwd). |
|
|
104
|
+
|
|
105
|
+
Outputs:
|
|
106
|
+
- `docs/cms-guidelines/collections/<slug>.md` for every collection
|
|
107
|
+
- `docs/cms-guidelines/externals/<slug>.md` for every external
|
|
108
|
+
- Updates `generated/cms-discovery/colour-hints.json`
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Pipeline document index
|
|
113
|
+
|
|
114
|
+
| File | Purpose |
|
|
115
|
+
|---|---|
|
|
116
|
+
| `generate-component-guidelines.md` | Full pipeline overview: Phases A–F |
|
|
117
|
+
| `variant-loop.md` | Phase A: propose variants → screenshot → evaluate |
|
|
118
|
+
| `variant-proposal-prompt.md` | LLM prompt: propose showcase variants |
|
|
119
|
+
| `evaluation-prompt.md` | LLM prompt: evaluate screenshot diversity |
|
|
120
|
+
| `generation-prompt.md` | Phase B: three-step guideline generation |
|
|
121
|
+
| `colour-hint-prompt.md` | Phase C: derive colour application hint |
|
|
122
|
+
| `validation-prompt.md` | Phase D: 9-check guideline validation |
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Output files (per app)
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
<appDir>/
|
|
130
|
+
docs/cms-guidelines/
|
|
131
|
+
components/ # one .md per componentType
|
|
132
|
+
collections/ # one .md per collectionType
|
|
133
|
+
externals/ # one .md per externalComponentType
|
|
134
|
+
COMPONENT_GUIDELINES_FOR_LLM.md # merged document
|
|
135
|
+
generated/cms-discovery/
|
|
136
|
+
field-list.json
|
|
137
|
+
colour-hints.json
|
|
138
|
+
accepted-variants/
|
|
139
|
+
components/ # one .json per component type
|
|
140
|
+
collections/ # one .json per collection type
|
|
141
|
+
externals/ # one .json per external component type
|
|
142
|
+
screenshots/
|
|
143
|
+
components/ # PNG screenshots for components
|
|
144
|
+
collections/ # PNG screenshots for collections
|
|
145
|
+
externals/ # PNG screenshots for externals
|
|
146
|
+
index.json # file field uses subpath e.g. "components/hero-default.png"
|
|
147
|
+
```
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
```
|
|
@@ -0,0 +1,84 @@
|
|
|
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}/`.
|
|
@@ -0,0 +1,126 @@
|
|
|
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 |
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# Generation Prompt — Code + Screenshots → Guideline Block
|
|
2
|
+
|
|
3
|
+
**Step 5.1 — Multi-step prompts for generating one guideline fragment.**
|
|
4
|
+
|
|
5
|
+
Run as a **Cursor agent task**. The agent reads the component source, screenshots, and field
|
|
6
|
+
metadata, then writes a self-contained markdown guideline fragment in the target format.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Inputs
|
|
11
|
+
|
|
12
|
+
| Input | Source |
|
|
13
|
+
|---|---|
|
|
14
|
+
| Component source file | `src/project/components/<TypeName>.tsx` |
|
|
15
|
+
| Field metadata (used fields + types + enums) | `generated/cms-discovery/field-list.json` |
|
|
16
|
+
| Project theme (palette + typography + grid) | `generated/cms-discovery/theme-context.md` |
|
|
17
|
+
| Accepted screenshots | `generated/cms-discovery/accepted-variants/{components\|collections\|externals}/<type-slug>.json` + image files |
|
|
18
|
+
| Target format example | `tmp/component-guidelines-target-format.md` (Hero example) |
|
|
19
|
+
| Mapping reference | `generated/cms-discovery/mapping.md` |
|
|
20
|
+
| SizingInformation source | `src/lib/SizingInformation.ts` |
|
|
21
|
+
| Section wrapper source | `src/framework/Section.tsx` (for backgroundColour/textColour behaviour) |
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Step 1 of 3 — Describe the screenshots
|
|
26
|
+
|
|
27
|
+
**Prompt:**
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
You are documenting a CMS component for a marketing site.
|
|
31
|
+
|
|
32
|
+
I will give you screenshots of the component in different states, and the component's
|
|
33
|
+
accepted variant list. Describe what you see in each screenshot.
|
|
34
|
+
|
|
35
|
+
Component: <COMPONENT_TYPE>
|
|
36
|
+
|
|
37
|
+
Accepted variants (from accepted-variants/{components|collections|externals}/<type-slug>.json):
|
|
38
|
+
<ACCEPTED_VARIANTS_JSON>
|
|
39
|
+
|
|
40
|
+
Project theme (from generated/cms-discovery/theme-context.md):
|
|
41
|
+
<THEME_CONTEXT>
|
|
42
|
+
|
|
43
|
+
For each variant, describe:
|
|
44
|
+
- The visual layout (columns, stack, full-width, etc.)
|
|
45
|
+
- The elements visible (heading, eyebrow, body, links, visual/image, background colour)
|
|
46
|
+
- The typography appearance (large heading, small body text, etc.)
|
|
47
|
+
- The colour scheme (background colour, text colour, whether the visual is tinted)
|
|
48
|
+
- Anything notable (animations not applicable in screenshots, spacing gaps, alignment)
|
|
49
|
+
|
|
50
|
+
Be precise. Write one short paragraph per variant (3–5 sentences). No code references.
|
|
51
|
+
Only use colour names from the site palette (listed in the theme context above) and
|
|
52
|
+
typography class names (h1–h6, p2, p3 etc. from the typography scale above).
|
|
53
|
+
|
|
54
|
+
Output format: one section per variant, headed by ## <label>.
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Step 2 of 3 — Extract behaviour and fields from code
|
|
60
|
+
|
|
61
|
+
**Prompt:**
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
You are writing CMS component documentation.
|
|
65
|
+
|
|
66
|
+
I will give you the source code of a Next.js component. Extract all behaviour
|
|
67
|
+
rules for the documentation. Do NOT quote or reference the code — translate
|
|
68
|
+
the code behaviour into plain English rules that a non-developer can follow.
|
|
69
|
+
|
|
70
|
+
Component source:
|
|
71
|
+
<COMPONENT_SOURCE>
|
|
72
|
+
|
|
73
|
+
SizingInformation.ts source (shows how index affects heading level and section spacing):
|
|
74
|
+
<SIZING_INFORMATION_SOURCE>
|
|
75
|
+
|
|
76
|
+
Section.tsx source (shows how backgroundColour and textColour are applied):
|
|
77
|
+
<SECTION_SOURCE>
|
|
78
|
+
|
|
79
|
+
Field mapping reference (mapping.md — shows how CMS fields map to app props):
|
|
80
|
+
<MAPPING_SOURCE>
|
|
81
|
+
|
|
82
|
+
Project theme (palette, typography, grid from generated/cms-discovery/theme-context.md):
|
|
83
|
+
<THEME_CONTEXT>
|
|
84
|
+
|
|
85
|
+
Extract and write:
|
|
86
|
+
1. FIELDS: For each field in USED_FIELDS, write one row: field name, type, what it does when
|
|
87
|
+
set, what happens when it is empty. Use only typography class names and colour names as
|
|
88
|
+
code snippets. No file paths.
|
|
89
|
+
2. BEHAVIOUR: Any behaviour that depends on position (index), variant (flipped), or other
|
|
90
|
+
logic. E.g. "When this is the first block on the page, the heading renders as <h1>".
|
|
91
|
+
3. IMPACT: What visually changes when content changes (longer text, add/remove visual, etc.).
|
|
92
|
+
4. TYPOGRAPHY: Which typography classes (h1–h6, p2, p3, h4, etc.) are applied to each element.
|
|
93
|
+
5. COLOUR APPLICATION: How backgroundColour and textColour are applied. Section-wide? Per-card?
|
|
94
|
+
|
|
95
|
+
Output each section clearly labelled (## Fields, ## Behaviour, ## Impact, ## Typography,
|
|
96
|
+
## Colour Application). No code blocks. No file references. Plain English only (except
|
|
97
|
+
typography class names and colour names).
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Step 3 of 3 — Merge into guideline block
|
|
103
|
+
|
|
104
|
+
**Prompt:**
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
You are writing a self-contained CMS component guideline fragment.
|
|
108
|
+
|
|
109
|
+
Below are two inputs:
|
|
110
|
+
A) Screenshot descriptions for each variant of <COMPONENT_TYPE>.
|
|
111
|
+
B) Extracted behaviour rules from the source code.
|
|
112
|
+
|
|
113
|
+
Also provided:
|
|
114
|
+
- The target format example (Hero guideline from tmp/component-guidelines-target-format.md).
|
|
115
|
+
- The field list from generated/cms-discovery/field-list.json.
|
|
116
|
+
- The project theme from generated/cms-discovery/theme-context.md (palette names + typography scale).
|
|
117
|
+
- The screenshot index from docs/cms-guidelines/screenshots/index.json (lists captured screenshots).
|
|
118
|
+
- The app's devBaseUrl from .contentful-cms.json (e.g. "http://localhost:3010").
|
|
119
|
+
|
|
120
|
+
Produce a single markdown fragment for <COMPONENT_TYPE> following EXACTLY this structure:
|
|
121
|
+
|
|
122
|
+
# <ComponentType>
|
|
123
|
+
(one-line summary of what it is and when to use it)
|
|
124
|
+
|
|
125
|
+
## Screenshots
|
|
126
|
+
|
|
127
|
+
(For each accepted variant that has a captured screenshot in index.json, include an image link.
|
|
128
|
+
Use the devBaseUrl from .contentful-cms.json for the host.
|
|
129
|
+
Use the `file` field from index.json VERBATIM as the ?file= value — it may include a subdirectory
|
|
130
|
+
prefix such as `components/` or `collections/`. Do NOT reconstruct the path from the type slug. Format:)
|
|
131
|
+
|
|
132
|
+
| Variant | Preview |
|
|
133
|
+
|---------|---------|
|
|
134
|
+
| Default |  |
|
|
135
|
+
| Navy |  |
|
|
136
|
+
|
|
137
|
+
(Only include variants present in index.json. If no screenshots exist, write: "No screenshots captured yet. Run cms-capture-screenshots to generate them.")
|
|
138
|
+
|
|
139
|
+
## What it looks like
|
|
140
|
+
(describe layout, columns, stacking, visible elements — based on screenshot descriptions)
|
|
141
|
+
|
|
142
|
+
## Typography
|
|
143
|
+
(typography classes for heading, body, subtitle — bullets only)
|
|
144
|
+
|
|
145
|
+
## Colours
|
|
146
|
+
(how backgroundColour/textColour apply — section-wide? per-card? valid palette values)
|
|
147
|
+
|
|
148
|
+
## Used fields
|
|
149
|
+
(table: Field | Type | Effect when set | Effect when empty/removed)
|
|
150
|
+
|
|
151
|
+
## Behaviour
|
|
152
|
+
(position/index rules, variant differences, anything that depends on content logic)
|
|
153
|
+
|
|
154
|
+
## Impact of content changes
|
|
155
|
+
(table or bullets: what changes when you add/remove/change specific fields)
|
|
156
|
+
|
|
157
|
+
Rules:
|
|
158
|
+
- SELF-CONTAINED. A reader with no code access must fully understand the component.
|
|
159
|
+
- No source code references, no file paths, no "see Hero.tsx".
|
|
160
|
+
- Only use typography class names (from theme-context.md, e.g. h1–h6, p2, p3) and colour
|
|
161
|
+
names (from theme-context.md palette) as code-like snippets. Everything else is plain English.
|
|
162
|
+
- For the ## Colours section, list the valid palette colour names from theme-context.md — do
|
|
163
|
+
NOT invent colour names or describe them generically.
|
|
164
|
+
- If a field is listed in USED_FIELDS but has no visual effect when empty, say
|
|
165
|
+
"No visible effect when empty" in the table.
|
|
166
|
+
- Collections: add a section for card-level fields and describe how the number of cards
|
|
167
|
+
affects layout.
|
|
168
|
+
- External components: omit screenshots and the Screenshots section; describe parameters instead.
|
|
169
|
+
- Screenshot links use the devBaseUrl from .contentful-cms.json — they resolve when the dev
|
|
170
|
+
server is running and are useful for both human reviewers and AI assistants.
|
|
171
|
+
|
|
172
|
+
Output raw markdown only. Start with "# <ComponentType>". No preamble.
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## External component variant
|
|
178
|
+
|
|
179
|
+
For external components (no showcase), replace Step 1 with:
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
The component has no screenshots (not yet in the showcase). Instead, describe what
|
|
183
|
+
the component likely looks like based on its name and parameters alone. Mark this
|
|
184
|
+
section with a note: "(Visual description estimated from code; no screenshots available.)"
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
All other steps are the same.
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## After generation
|
|
192
|
+
|
|
193
|
+
After the LLM produces the fragment:
|
|
194
|
+
|
|
195
|
+
1. Save to `docs/cms-guidelines/components/<type-slug>.md`
|
|
196
|
+
(or `collections/` or `externals/` as appropriate).
|
|
197
|
+
2. Run validation (Step 5.3 prompt).
|
|
198
|
+
3. If validation passes, run merge: `pnpm run cms-guidelines:merge`
|
|
199
|
+
4. Commit both files.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Cursor agent task prompt
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
Generate the CMS guideline fragment for <COMPONENT_TYPE>.
|
|
207
|
+
|
|
208
|
+
Files to read:
|
|
209
|
+
- src/project/components/<TypeName>.tsx (or collections/<TypeName>.tsx)
|
|
210
|
+
- generated/cms-discovery/field-list.json
|
|
211
|
+
- generated/cms-discovery/theme-context.md (palette + typography + grid — use for all colour and font references)
|
|
212
|
+
- generated/cms-discovery/mapping.md
|
|
213
|
+
- generated/cms-discovery/accepted-variants/{components|collections|externals}/<type-slug>.json
|
|
214
|
+
- docs/cms-guidelines/screenshots/index.json (to know which screenshots exist)
|
|
215
|
+
- .contentful-cms.json (to get devBaseUrl for screenshot links)
|
|
216
|
+
- src/lib/SizingInformation.ts
|
|
217
|
+
- src/framework/Section.tsx
|
|
218
|
+
- tmp/component-guidelines-target-format.md (example format)
|
|
219
|
+
|
|
220
|
+
Images to analyse:
|
|
221
|
+
- docs/cms-guidelines/screenshots/<type-slug>-*.png (all accepted variant screenshots)
|
|
222
|
+
|
|
223
|
+
Follow the three-step generation process in generation-prompt.md:
|
|
224
|
+
1. Describe screenshots.
|
|
225
|
+
2. Extract behaviour from code.
|
|
226
|
+
3. Merge into guideline fragment (include ## Screenshots section with image links using devBaseUrl).
|
|
227
|
+
|
|
228
|
+
Save the output to docs/cms-guidelines/components/<type-slug>.md.
|
|
229
|
+
Then run: pnpm run cms-guidelines:merge
|
|
230
|
+
Then commit: git add docs/cms-guidelines/ && git commit -m "chore(bl): generate guideline for <TypeName>"
|
|
231
|
+
```
|