@se-studio/project-build 1.0.105 → 1.0.106
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
package/package.json
CHANGED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: generate-all-guidelines
|
|
3
|
+
description: Generates CMS guidelines for every component, collection, and external in one automated run. Handles bulk screenshot capture upfront, then uses parallel subagents for guideline generation. Use when setting up a new project or after significant changes across many component types.
|
|
4
|
+
license: Private
|
|
5
|
+
metadata:
|
|
6
|
+
author: se-core-product
|
|
7
|
+
version: "1.0.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
|
+
## When to use
|
|
17
|
+
|
|
18
|
+
- First-time guideline generation for a new project
|
|
19
|
+
- Bulk regeneration after major refactoring
|
|
20
|
+
- Adding screenshot links to an existing set of guidelines that has no screenshots yet
|
|
21
|
+
|
|
22
|
+
Use the **generate-cms-guidelines** skill (`single` or `merge-only` mode) for incremental updates after this initial run.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Prerequisites
|
|
27
|
+
|
|
28
|
+
All of these must be true before starting. Check each one.
|
|
29
|
+
|
|
30
|
+
1. **Dev server is running** at the app's port. Confirm:
|
|
31
|
+
```bash
|
|
32
|
+
curl -sL http://localhost:<PORT>/api/cms/discovery/ | head -c 100
|
|
33
|
+
```
|
|
34
|
+
Should return JSON starting with `{"components":[`.
|
|
35
|
+
|
|
36
|
+
2. **`agent-browser` is installed** (needed for screenshot capture):
|
|
37
|
+
```bash
|
|
38
|
+
agent-browser --version
|
|
39
|
+
# If missing: npm install -g agent-browser && agent-browser install
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
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.
|
|
43
|
+
|
|
44
|
+
4. **Field list generated:**
|
|
45
|
+
```bash
|
|
46
|
+
pnpm run cms-discovery:field-list
|
|
47
|
+
# or from repo root: pnpm --filter <appName> exec cms-generate-field-list --app-dir .
|
|
48
|
+
```
|
|
49
|
+
Produces `src/generated/cms-discovery/field-list.json`.
|
|
50
|
+
|
|
51
|
+
5. **LLM pre-pass run** — `src/generated/cms-discovery/accepted-variants/` must contain JSON files (one per component type). These are written by `generate-showcase-mocks`. If the directory is empty or missing, run:
|
|
52
|
+
```bash
|
|
53
|
+
pnpm generate-showcase-mocks
|
|
54
|
+
# or: node node_modules/@se-studio/project-build/dist/generate-showcase-mocks.js
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Inputs
|
|
60
|
+
|
|
61
|
+
| Input | Example |
|
|
62
|
+
|-------|---------|
|
|
63
|
+
| App directory (absolute or repo-relative) | `apps/example-se2026` or `/home/nick/source/se/se-website-2026` |
|
|
64
|
+
| Discovery URL | `http://localhost:3012/api/cms/discovery/` |
|
|
65
|
+
| Port | `3012` |
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Pipeline Overview
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
Phase 0 — Discover Fetch all type names from the discovery API
|
|
73
|
+
Phase 1 — Screenshots Bulk capture all component screenshots in one loop (CLI only, no LLM)
|
|
74
|
+
Phase 2 — Collections Generate collection + external guideline fragments (CLI only)
|
|
75
|
+
Phase 3 — Components Parallel subagents: Phase B (write) + C (colour) + D (validate) per type
|
|
76
|
+
Phase 4 — Merge cms-merge-guidelines (single CLI call)
|
|
77
|
+
Phase 5 — Commit git add + commit
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Phases 1 and 2 are purely mechanical — they run fast and require no LLM supervision.
|
|
81
|
+
Phase 3 is where parallel subagents do the guideline writing.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Phase 0 — Discover all types
|
|
86
|
+
|
|
87
|
+
Fetch the discovery endpoint and collect the full list of component type names.
|
|
88
|
+
Store this as your working list.
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
curl -sL http://localhost:<PORT>/api/cms/discovery/ > /tmp/discovery.json
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
From the JSON:
|
|
95
|
+
- `data.components[].name` — component types needing Phases 1 + 3
|
|
96
|
+
- `data.collections[].name` — collection types (Phase 2 handles these)
|
|
97
|
+
- `data.externals[].name` — external types (Phase 2 handles these)
|
|
98
|
+
|
|
99
|
+
Compute each component's slug: `typeName.toLowerCase().replace(/\s+/g, '-').replace(/[()]/g, '')`
|
|
100
|
+
|
|
101
|
+
**Skip check:** For each component, check if BOTH of these already exist:
|
|
102
|
+
- `<appDir>/docs/cms-guidelines/components/<slug>.md`
|
|
103
|
+
- `<appDir>/docs/cms-guidelines/screenshots/index.json` has an entry for this type
|
|
104
|
+
|
|
105
|
+
If both exist, skip that component (already done). Only process the unfinished ones.
|
|
106
|
+
To force-regenerate all, ignore this check.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Phase 1 — Bulk screenshot capture (all components at once)
|
|
111
|
+
|
|
112
|
+
This is the key step that makes the full run fast. Instead of capturing screenshots one
|
|
113
|
+
type at a time inside each subagent, we capture everything upfront in a tight loop.
|
|
114
|
+
|
|
115
|
+
For each component type name that needs processing, run:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# Check if accepted-variants file exists for this type
|
|
119
|
+
SLUG="<type-slug>"
|
|
120
|
+
VARIANTS_FILE="<appDir>/src/generated/cms-discovery/accepted-variants/${SLUG}.json"
|
|
121
|
+
|
|
122
|
+
if [ -f "$VARIANTS_FILE" ]; then
|
|
123
|
+
cms-capture-screenshots --variants "$VARIANTS_FILE" --app-dir <appDir>
|
|
124
|
+
else
|
|
125
|
+
# Fall back to default variants for the type
|
|
126
|
+
cms-capture-screenshots --type "<TYPE_NAME>" --app-dir <appDir>
|
|
127
|
+
fi
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Run all of these sequentially (screenshots require the browser to be driven one at a time).
|
|
131
|
+
`cms-capture-screenshots` automatically updates `docs/cms-guidelines/screenshots/index.json` after each run.
|
|
132
|
+
|
|
133
|
+
**If `agent-browser` is not available:** the command degrades to printing URLs only.
|
|
134
|
+
Install it first: `npm install -g agent-browser && agent-browser install`.
|
|
135
|
+
|
|
136
|
+
After all captures, confirm `docs/cms-guidelines/screenshots/index.json` exists and has entries.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Phase 2 — Collections and externals (CLI, no subagents needed)
|
|
141
|
+
|
|
142
|
+
Run once — this regenerates all collection guidelines and creates any missing external templates:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
cms-generate-collection-guidelines \
|
|
146
|
+
--discovery-url http://localhost:<PORT>/api/cms/discovery/ \
|
|
147
|
+
--app-dir <appDir>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
This writes `docs/cms-guidelines/collections/*.md` and creates stub `docs/cms-guidelines/externals/*.md` for any new externals.
|
|
151
|
+
|
|
152
|
+
**External schemas:** If any new `externals/*.md` stubs were created, fill in their
|
|
153
|
+
`## Fields & Schema` and `## Usage` sections manually before continuing (or after the full run).
|
|
154
|
+
The rest of the pipeline doesn't depend on them being complete.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Phase 3 — Component guidelines (parallel subagents)
|
|
159
|
+
|
|
160
|
+
Launch subagents in batches of **4 in parallel**. Each subagent handles one component type
|
|
161
|
+
through Phases B, C, and D only (screenshots are already done from Phase 1).
|
|
162
|
+
|
|
163
|
+
### Subagent prompt template
|
|
164
|
+
|
|
165
|
+
For each component type, use this prompt (fill in `<COMPONENT_TYPE>`, `<APP_DIR>`, `<PORT>`):
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
Generate the CMS guideline fragment for <COMPONENT_TYPE>.
|
|
169
|
+
Target app directory: <APP_DIR>
|
|
170
|
+
|
|
171
|
+
IMPORTANT: Screenshots have already been captured. Skip Phase A entirely.
|
|
172
|
+
Go straight to Phase B.
|
|
173
|
+
|
|
174
|
+
Files to read before starting:
|
|
175
|
+
- packages/contentful-cms/skills/cms-guidelines/generation-prompt.md (Phase B instructions)
|
|
176
|
+
- packages/contentful-cms/skills/cms-guidelines/colour-hint-prompt.md (Phase C instructions)
|
|
177
|
+
- packages/contentful-cms/skills/cms-guidelines/validation-prompt.md (Phase D instructions)
|
|
178
|
+
- <APP_DIR>/src/project/components/<TypeName>.tsx (component source)
|
|
179
|
+
- <APP_DIR>/src/generated/cms-discovery/field-list.json
|
|
180
|
+
- <APP_DIR>/src/generated/cms-discovery/accepted-variants/<type-slug>.json
|
|
181
|
+
- <APP_DIR>/docs/cms-guidelines/screenshots/index.json (which screenshots exist)
|
|
182
|
+
- <APP_DIR>/.contentful-cms.json (get devBaseUrl for screenshot links)
|
|
183
|
+
|
|
184
|
+
=== Phase B: Generate guideline ===
|
|
185
|
+
Follow generation-prompt.md (three-step process).
|
|
186
|
+
The guideline MUST include a ## Screenshots table using devBaseUrl from .contentful-cms.json.
|
|
187
|
+
Only include variants present in screenshots/index.json.
|
|
188
|
+
Save output to <APP_DIR>/docs/cms-guidelines/components/<type-slug>.md.
|
|
189
|
+
|
|
190
|
+
=== Phase C: Colour hint ===
|
|
191
|
+
Follow colour-hint-prompt.md.
|
|
192
|
+
Run:
|
|
193
|
+
cms-update-colour-hints --app-dir <APP_DIR> \
|
|
194
|
+
--type "<COMPONENT_TYPE>" --hint "<hint>" --notes "<brief reason>"
|
|
195
|
+
|
|
196
|
+
=== Phase D: Validate ===
|
|
197
|
+
Follow validation-prompt.md. Apply fixes until APPROVED.
|
|
198
|
+
|
|
199
|
+
Do NOT run merge — that runs once after all components complete.
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Batch execution
|
|
203
|
+
|
|
204
|
+
Process all unfinished components in batches:
|
|
205
|
+
- Launch 4 subagents simultaneously
|
|
206
|
+
- Wait for all 4 to complete before launching the next batch
|
|
207
|
+
- If any subagent fails or times out, note the type name and re-run it individually
|
|
208
|
+
using the **generate-cms-guidelines** skill in `single` mode
|
|
209
|
+
|
|
210
|
+
Typical time per component: 3–6 minutes (mostly LLM time for generation + validation).
|
|
211
|
+
Typical total time for 15 components in batches of 4: ~25–35 minutes.
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Phase 4 — Merge
|
|
216
|
+
|
|
217
|
+
After all subagents complete, rebuild the combined document:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
cms-merge-guidelines --app-dir <appDir>
|
|
221
|
+
# or from the app directory:
|
|
222
|
+
pnpm run cms-guidelines:merge
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Open `docs/cms-guidelines/COMPONENT_GUIDELINES_FOR_LLM.md` and do a quick sanity check:
|
|
226
|
+
- Does it contain all expected types?
|
|
227
|
+
- Do the screenshot image links look correct (using the right port)?
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Phase 5 — Commit
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
git add <appDir>/docs/cms-guidelines/ <appDir>/src/generated/cms-discovery/
|
|
235
|
+
git commit -m "chore(<appName>): generate all CMS guidelines with screenshots"
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## Handling failures and partial runs
|
|
241
|
+
|
|
242
|
+
The pipeline is designed to be resumable. If it stops partway through:
|
|
243
|
+
|
|
244
|
+
- **Phase 1 failed for some types:** Re-run `cms-capture-screenshots` for just those types.
|
|
245
|
+
`index.json` is additive — it won't remove entries from previous runs.
|
|
246
|
+
- **Phase 3 subagent failed:** Use `generate-cms-guidelines` skill in `single` mode for that type.
|
|
247
|
+
- **Phase 2 not run yet:** Re-run `cms-generate-collection-guidelines` — it's idempotent for collections.
|
|
248
|
+
- **Phase 4 merge not run:** Just run `cms-merge-guidelines` — it reads whatever `.md` files exist.
|
|
249
|
+
|
|
250
|
+
To re-run everything for a single type after fixing a problem:
|
|
251
|
+
```bash
|
|
252
|
+
# Re-capture screenshots
|
|
253
|
+
cms-capture-screenshots --type "<TYPE_NAME>" --app-dir <appDir>
|
|
254
|
+
# Then use generate-cms-guidelines skill (single mode) for the guideline
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Quick reference — full command sequence
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
# 0. Prerequisites check
|
|
263
|
+
curl -sL http://localhost:<PORT>/api/cms/discovery/ | head -c 100
|
|
264
|
+
agent-browser --version
|
|
265
|
+
|
|
266
|
+
# 1. Bulk screenshots (repeat for each component type)
|
|
267
|
+
cms-capture-screenshots --variants src/generated/cms-discovery/accepted-variants/<slug>.json --app-dir <appDir>
|
|
268
|
+
|
|
269
|
+
# 2. Collections + externals
|
|
270
|
+
cms-generate-collection-guidelines \
|
|
271
|
+
--discovery-url http://localhost:<PORT>/api/cms/discovery/ \
|
|
272
|
+
--app-dir <appDir>
|
|
273
|
+
|
|
274
|
+
# 3. [Parallel subagents — see Phase 3 above]
|
|
275
|
+
|
|
276
|
+
# 4. Merge
|
|
277
|
+
cms-merge-guidelines --app-dir <appDir>
|
|
278
|
+
|
|
279
|
+
# 5. Commit
|
|
280
|
+
git add docs/cms-guidelines/ src/generated/cms-discovery/
|
|
281
|
+
git commit -m "chore: generate all CMS guidelines"
|
|
282
|
+
```
|
|
@@ -22,7 +22,7 @@ Guidelines are only meaningful when the showcase is populated with realistic dat
|
|
|
22
22
|
```bash
|
|
23
23
|
pnpm --filter <appName> generate-showcase
|
|
24
24
|
```
|
|
25
|
-
This writes `src/
|
|
25
|
+
This writes `src/generated/showcase-examples.json` to the app.
|
|
26
26
|
3. **Curate showcase mocks:** Follow the [curate-showcase-mocks skill](.cursor/skills/se-marketing-sites/curate-showcase-mocks/SKILL.md) to produce `showcase-mocks.json`.
|
|
27
27
|
4. **Generate field list:**
|
|
28
28
|
```bash
|
|
@@ -89,7 +89,7 @@ export type CmsColourName = NonNullable<TypeComponentFields['backgroundColour']>
|
|
|
89
89
|
|
|
90
90
|
## The Showcase
|
|
91
91
|
|
|
92
|
-
Registering a component automatically adds it to the CMS Showcase (usually available at `/cms
|
|
92
|
+
Registering a component automatically adds it to the CMS Showcase (usually available at `/cms/showcase` in development). This allows you to view the component in isolation using its mock data.
|
|
93
93
|
|
|
94
94
|
* Ensure your `mock` object in the registration is complete and realistic.
|
|
95
95
|
* The showcase helps verify that `usedFields` and `UnusedChecker` are working correctly.
|