@se-studio/contentful-cms 1.0.12 → 1.0.14
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 +12 -0
- package/package.json +1 -1
- package/skills/cms-guidelines/README.md +9 -2
- package/skills/cms-guidelines/evaluation-prompt.md +2 -2
- package/skills/cms-guidelines/generate-component-guidelines.md +3 -3
- package/skills/cms-guidelines/generation-prompt.md +23 -9
- package/skills/cms-guidelines/variant-loop.md +17 -12
- package/skills/cms-guidelines/variant-proposal-prompt.md +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @se-studio/contentful-cms Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Bulk version bump: patch for all packages
|
|
8
|
+
|
|
9
|
+
## 1.0.13
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Bulk version bump: patch for all packages
|
|
14
|
+
|
|
3
15
|
## 1.0.12
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -135,6 +135,13 @@ Outputs:
|
|
|
135
135
|
generated/cms-discovery/
|
|
136
136
|
field-list.json
|
|
137
137
|
colour-hints.json
|
|
138
|
-
accepted-variants/
|
|
139
|
-
|
|
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"
|
|
140
147
|
```
|
|
@@ -80,5 +80,5 @@ Output JSON only:
|
|
|
80
80
|
- If `attempts < 2 × N` → use `suggestions` to generate additional variant params; capture
|
|
81
81
|
the new screenshots; re-evaluate.
|
|
82
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
|
|
84
|
-
and the screenshots are committed to `docs/cms-guidelines/screenshots/`.
|
|
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}/`.
|
|
@@ -10,8 +10,8 @@ For one CMS type (e.g. Hero):
|
|
|
10
10
|
|
|
11
11
|
| Output | Location |
|
|
12
12
|
|---|---|
|
|
13
|
-
| Variant screenshots | `docs/cms-guidelines/screenshots/hero-*.png` |
|
|
14
|
-
| Accepted variant list | `generated/cms-discovery/accepted-variants/hero.json` |
|
|
13
|
+
| Variant screenshots | `docs/cms-guidelines/screenshots/components/hero-*.png` |
|
|
14
|
+
| Accepted variant list | `generated/cms-discovery/accepted-variants/components/hero.json` |
|
|
15
15
|
| Guideline fragment | `docs/cms-guidelines/components/hero.md` |
|
|
16
16
|
| Colour hint entry | `generated/cms-discovery/colour-hints.json` |
|
|
17
17
|
| Merged full doc (updated) | `docs/cms-guidelines/COMPONENT_GUIDELINES_FOR_LLM.md` |
|
|
@@ -44,7 +44,7 @@ Follow variant-loop.md.
|
|
|
44
44
|
cms-capture-screenshots --variants /tmp/<type-slug>-variants.json --app-dir <APP_DIR>
|
|
45
45
|
5. Evaluate screenshots using evaluation-prompt.md.
|
|
46
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/<type-slug>.json
|
|
47
|
+
- When done: save accepted list to generated/cms-discovery/accepted-variants/{components|collections|externals}/<type-slug>.json
|
|
48
48
|
|
|
49
49
|
=== Phase B: Generate guideline ===
|
|
50
50
|
Follow generation-prompt.md.
|
|
@@ -13,7 +13,8 @@ metadata, then writes a self-contained markdown guideline fragment in the target
|
|
|
13
13
|
|---|---|
|
|
14
14
|
| Component source file | `src/project/components/<TypeName>.tsx` |
|
|
15
15
|
| Field metadata (used fields + types + enums) | `generated/cms-discovery/field-list.json` |
|
|
16
|
-
|
|
|
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 |
|
|
17
18
|
| Target format example | `tmp/component-guidelines-target-format.md` (Hero example) |
|
|
18
19
|
| Mapping reference | `generated/cms-discovery/mapping.md` |
|
|
19
20
|
| SizingInformation source | `src/lib/SizingInformation.ts` |
|
|
@@ -33,9 +34,12 @@ accepted variant list. Describe what you see in each screenshot.
|
|
|
33
34
|
|
|
34
35
|
Component: <COMPONENT_TYPE>
|
|
35
36
|
|
|
36
|
-
Accepted variants (from accepted-variants/<type-slug>.json):
|
|
37
|
+
Accepted variants (from accepted-variants/{components|collections|externals}/<type-slug>.json):
|
|
37
38
|
<ACCEPTED_VARIANTS_JSON>
|
|
38
39
|
|
|
40
|
+
Project theme (from generated/cms-discovery/theme-context.md):
|
|
41
|
+
<THEME_CONTEXT>
|
|
42
|
+
|
|
39
43
|
For each variant, describe:
|
|
40
44
|
- The visual layout (columns, stack, full-width, etc.)
|
|
41
45
|
- The elements visible (heading, eyebrow, body, links, visual/image, background colour)
|
|
@@ -44,7 +48,8 @@ For each variant, describe:
|
|
|
44
48
|
- Anything notable (animations not applicable in screenshots, spacing gaps, alignment)
|
|
45
49
|
|
|
46
50
|
Be precise. Write one short paragraph per variant (3–5 sentences). No code references.
|
|
47
|
-
Only use colour names from the site palette
|
|
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).
|
|
48
53
|
|
|
49
54
|
Output format: one section per variant, headed by ## <label>.
|
|
50
55
|
```
|
|
@@ -74,6 +79,9 @@ Section.tsx source (shows how backgroundColour and textColour are applied):
|
|
|
74
79
|
Field mapping reference (mapping.md — shows how CMS fields map to app props):
|
|
75
80
|
<MAPPING_SOURCE>
|
|
76
81
|
|
|
82
|
+
Project theme (palette, typography, grid from generated/cms-discovery/theme-context.md):
|
|
83
|
+
<THEME_CONTEXT>
|
|
84
|
+
|
|
77
85
|
Extract and write:
|
|
78
86
|
1. FIELDS: For each field in USED_FIELDS, write one row: field name, type, what it does when
|
|
79
87
|
set, what happens when it is empty. Use only typography class names and colour names as
|
|
@@ -105,6 +113,7 @@ B) Extracted behaviour rules from the source code.
|
|
|
105
113
|
Also provided:
|
|
106
114
|
- The target format example (Hero guideline from tmp/component-guidelines-target-format.md).
|
|
107
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).
|
|
108
117
|
- The screenshot index from docs/cms-guidelines/screenshots/index.json (lists captured screenshots).
|
|
109
118
|
- The app's devBaseUrl from .contentful-cms.json (e.g. "http://localhost:3010").
|
|
110
119
|
|
|
@@ -116,12 +125,14 @@ Produce a single markdown fragment for <COMPONENT_TYPE> following EXACTLY this s
|
|
|
116
125
|
## Screenshots
|
|
117
126
|
|
|
118
127
|
(For each accepted variant that has a captured screenshot in index.json, include an image link.
|
|
119
|
-
Use the devBaseUrl from .contentful-cms.json for the host.
|
|
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:)
|
|
120
131
|
|
|
121
132
|
| Variant | Preview |
|
|
122
133
|
|---------|---------|
|
|
123
|
-
| Default |  |
|
|
135
|
+
| Navy |  |
|
|
125
136
|
|
|
126
137
|
(Only include variants present in index.json. If no screenshots exist, write: "No screenshots captured yet. Run cms-capture-screenshots to generate them.")
|
|
127
138
|
|
|
@@ -146,8 +157,10 @@ Use the devBaseUrl from .contentful-cms.json for the host. Format:)
|
|
|
146
157
|
Rules:
|
|
147
158
|
- SELF-CONTAINED. A reader with no code access must fully understand the component.
|
|
148
159
|
- No source code references, no file paths, no "see Hero.tsx".
|
|
149
|
-
- Only use typography class names (h1–h6, p2, p3
|
|
150
|
-
as code-like snippets. Everything else is plain English.
|
|
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.
|
|
151
164
|
- If a field is listed in USED_FIELDS but has no visual effect when empty, say
|
|
152
165
|
"No visible effect when empty" in the table.
|
|
153
166
|
- Collections: add a section for card-level fields and describe how the number of cards
|
|
@@ -195,8 +208,9 @@ Generate the CMS guideline fragment for <COMPONENT_TYPE>.
|
|
|
195
208
|
Files to read:
|
|
196
209
|
- src/project/components/<TypeName>.tsx (or collections/<TypeName>.tsx)
|
|
197
210
|
- generated/cms-discovery/field-list.json
|
|
211
|
+
- generated/cms-discovery/theme-context.md (palette + typography + grid — use for all colour and font references)
|
|
198
212
|
- generated/cms-discovery/mapping.md
|
|
199
|
-
- generated/cms-discovery/accepted-variants/<type-slug>.json
|
|
213
|
+
- generated/cms-discovery/accepted-variants/{components|collections|externals}/<type-slug>.json
|
|
200
214
|
- docs/cms-guidelines/screenshots/index.json (to know which screenshots exist)
|
|
201
215
|
- .contentful-cms.json (to get devBaseUrl for screenshot links)
|
|
202
216
|
- src/lib/SizingInformation.ts
|
|
@@ -23,7 +23,7 @@ or manually follow the steps below.
|
|
|
23
23
|
▼
|
|
24
24
|
┌──────────────────────────────────────────────────┐
|
|
25
25
|
│ Step 2: Capture screenshots │
|
|
26
|
-
│ → docs/cms-guidelines/screenshots/<
|
|
26
|
+
│ → docs/cms-guidelines/screenshots/{mode}s/<n>.png│
|
|
27
27
|
└──────────────────────┬───────────────────────────┘
|
|
28
28
|
│
|
|
29
29
|
▼
|
|
@@ -53,6 +53,7 @@ or manually follow the steps below.
|
|
|
53
53
|
**Assign this task to a Cursor subagent.** Provide:
|
|
54
54
|
- `apps/example-brightline/src/project/components/<TypeName>.tsx` (component source)
|
|
55
55
|
- `generated/cms-discovery/field-list.json` (field metadata including enum values)
|
|
56
|
+
- `generated/cms-discovery/theme-context.md` (palette + typography — authoritative colour names)
|
|
56
57
|
- `scripts/guidelines/variant-proposal-prompt.md` (variant proposal instructions)
|
|
57
58
|
- `scripts/guidelines/evaluation-prompt.md` (evaluation instructions)
|
|
58
59
|
- `scripts/guidelines/capture-screenshots.mjs` (screenshot tool)
|
|
@@ -63,9 +64,10 @@ or manually follow the steps below.
|
|
|
63
64
|
```
|
|
64
65
|
Run the variant loop for <TypeName>:
|
|
65
66
|
|
|
66
|
-
1. PROPOSE: Read the component source file
|
|
67
|
-
scripts/guidelines/variant-proposal-prompt.md, produce a variants.json
|
|
68
|
-
Use N = 5 (or fewer if the component is simple).
|
|
67
|
+
1. PROPOSE: Read the component source file, field list, and theme-context.md (for palette names).
|
|
68
|
+
Using the instructions in scripts/guidelines/variant-proposal-prompt.md, produce a variants.json
|
|
69
|
+
for <TypeName>. Use N = 5 (or fewer if the component is simple).
|
|
70
|
+
IMPORTANT: use only colour names from theme-context.md — do NOT invent colour names.
|
|
69
71
|
|
|
70
72
|
2. CAPTURE: Run:
|
|
71
73
|
node scripts/guidelines/capture-screenshots.mjs --variants /tmp/variants.json
|
|
@@ -80,8 +82,9 @@ Run the variant loop for <TypeName>:
|
|
|
80
82
|
- If 2×N attempts reached: accept the best acceptedVariants set seen.
|
|
81
83
|
|
|
82
84
|
4. WRITE ACCEPTED LIST: Save the final accepted variant list to:
|
|
83
|
-
generated/cms-discovery/accepted-variants/<type-slug>.json
|
|
84
|
-
|
|
85
|
+
generated/cms-discovery/accepted-variants/{components|collections|externals}/<type-slug>.json
|
|
86
|
+
Use the `mode` field to pick the subdir: component → components/, collection → collections/, external → externals/.
|
|
87
|
+
Format: { "typeName": "<TypeName>", "mode": "<mode>", "variants": [...] }
|
|
85
88
|
|
|
86
89
|
5. COMMIT: git add docs/cms-guidelines/screenshots/ generated/cms-discovery/
|
|
87
90
|
git commit -m "chore(bl): variant screenshots for <TypeName>"
|
|
@@ -122,7 +125,7 @@ Example for Hero:
|
|
|
122
125
|
node scripts/guidelines/capture-screenshots.mjs --variants /tmp/hero-variants.json
|
|
123
126
|
```
|
|
124
127
|
|
|
125
|
-
Saves to `docs/cms-guidelines/screenshots/hero-*.png
|
|
128
|
+
Saves to `docs/cms-guidelines/screenshots/components/hero-*.png` (or `collections/` for collection types).
|
|
126
129
|
|
|
127
130
|
### 3 — Evaluate
|
|
128
131
|
|
|
@@ -134,8 +137,10 @@ If not suitably different: replace rejected screenshots with suggestions, re-cap
|
|
|
134
137
|
### 4 — Save accepted list
|
|
135
138
|
|
|
136
139
|
```bash
|
|
137
|
-
|
|
138
|
-
|
|
140
|
+
# Use the appropriate subdir based on mode: components/, collections/, or externals/
|
|
141
|
+
mkdir -p generated/cms-discovery/accepted-variants/components
|
|
142
|
+
# Write manually or via script — e.g. for a component:
|
|
143
|
+
# generated/cms-discovery/accepted-variants/components/hero.json
|
|
139
144
|
```
|
|
140
145
|
|
|
141
146
|
### 5 — Commit
|
|
@@ -157,13 +162,13 @@ git commit -m "chore(bl): variant screenshots for Hero"
|
|
|
157
162
|
{
|
|
158
163
|
"label": "default",
|
|
159
164
|
"description": "All fields populated, no colour override.",
|
|
160
|
-
|
|
161
|
-
|
|
165
|
+
"screenshotPath": "docs/cms-guidelines/screenshots/components/hero-default.png",
|
|
166
|
+
"showcaseParams": {}
|
|
162
167
|
},
|
|
163
168
|
{
|
|
164
169
|
"label": "navy",
|
|
165
170
|
"description": "Navy background + Off White text.",
|
|
166
|
-
"screenshotPath": "docs/cms-guidelines/screenshots/hero-navy.png",
|
|
171
|
+
"screenshotPath": "docs/cms-guidelines/screenshots/components/hero-navy.png",
|
|
167
172
|
"showcaseParams": { "backgroundColour": "Navy", "textColour": "Off White" }
|
|
168
173
|
}
|
|
169
174
|
]
|
|
@@ -14,8 +14,9 @@ variants (like flipped). The screenshots are then used to write the "What it loo
|
|
|
14
14
|
- **Component source file:** full contents of `src/project/components/<Type>.tsx` (or
|
|
15
15
|
`src/project/collections/<Type>.tsx`).
|
|
16
16
|
- **Used fields:** the `USED_FIELDS` or `FIELD_KEYS` from the source file.
|
|
17
|
-
- **Palette:**
|
|
18
|
-
|
|
17
|
+
- **Palette:** colour names from `generated/cms-discovery/theme-context.md` (generated by
|
|
18
|
+
`cms-generate-collection-guidelines` from `tailwind.config.json`). This is the authoritative
|
|
19
|
+
source — use it in preference to `field-list.json` or `generated/colors.ts`.
|
|
19
20
|
- **N:** number of variants to propose (typically 4–6 for a component, up to 8 for complex ones).
|
|
20
21
|
|
|
21
22
|
The LLM should output **N variants** in JSON format (see below).
|
|
@@ -35,12 +36,15 @@ should be able to tell them apart at a glance.
|
|
|
35
36
|
Component source:
|
|
36
37
|
<COMPONENT_SOURCE>
|
|
37
38
|
|
|
38
|
-
Palette (
|
|
39
|
+
Palette (from generated/cms-discovery/theme-context.md — use ONLY these names):
|
|
40
|
+
Background colours (backgroundColour):
|
|
39
41
|
<BACKGROUND_COLOURS>
|
|
40
42
|
|
|
41
|
-
Text
|
|
43
|
+
Text colours (textColour, i.e. foreground colours):
|
|
42
44
|
<TEXT_COLOURS>
|
|
43
45
|
|
|
46
|
+
Do NOT invent or paraphrase colour names. Use the exact names from theme-context.md.
|
|
47
|
+
|
|
44
48
|
Rules:
|
|
45
49
|
1. Always include a "default" variant with all optional fields populated and no colour override.
|
|
46
50
|
2. Include at least one variant per important "missing field" state (e.g. no visual, no links).
|