@ethlete/agent-rules 0.1.0-next.30 → 0.1.0-next.32

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 (40) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +7 -1
  3. package/content/hooks/background-design-commands.py +140 -0
  4. package/content/hooks/builder-chat-words.py +74 -0
  5. package/content/hooks/context-warning.py +48 -19
  6. package/content/hooks/git-safety.py +181 -0
  7. package/content/mods/plugins/e2e-progress/.claude-plugin/plugin.json +1 -1
  8. package/content/rules/nx-layout.md +5 -2
  9. package/content/rules/subagent-models.md +2 -2
  10. package/content/skills/agent-sessions/SKILL.md +6 -4
  11. package/content/skills/agent-sessions/agent-sessions.mjs +32 -10
  12. package/content/skills/codex-subagent/SKILL.md +8 -8
  13. package/content/skills/codex-subagent/codex-agent.mjs +1 -1
  14. package/content/skills/design-exploration/SKILL.md +47 -517
  15. package/content/skills/design-exploration/reference-check-and-notes.md +92 -0
  16. package/content/skills/design-exploration/reference-flows-and-wireframes.md +78 -0
  17. package/content/skills/design-exploration/reference-inbox-and-mcp.md +54 -0
  18. package/content/skills/design-exploration/reference-order-and-design-system.md +124 -0
  19. package/content/skills/design-exploration/reference-products-and-sketches.md +199 -0
  20. package/content/skills/design-exploration/reference-shots.md +25 -0
  21. package/content/skills/git-commit/SKILL.md +10 -0
  22. package/content/skills/grilling/SKILL.md +1 -0
  23. package/content/skills/handoff/SKILL.md +20 -4
  24. package/package.json +1 -1
  25. package/src/index.js +2 -1
  26. package/src/index.js.map +1 -1
  27. package/src/lib/git-flow-repair.d.ts +1 -1
  28. package/src/lib/git-flow-start.d.ts +1 -1
  29. package/src/lib/migrate.js +2 -1
  30. package/src/lib/migrate.js.map +1 -1
  31. package/src/lib/output-style-command.d.ts +1 -1
  32. package/src/lib/prettier.d.ts +21 -0
  33. package/src/lib/prettier.js +51 -0
  34. package/src/lib/prettier.js.map +1 -0
  35. package/src/lib/sync.d.ts +1 -1
  36. package/src/lib/sync.js +9 -2
  37. package/src/lib/sync.js.map +1 -1
  38. package/src/lib/targets/hooks-shared.d.ts +3 -3
  39. package/src/lib/targets/hooks-shared.js +58 -20
  40. package/src/lib/targets/hooks-shared.js.map +1 -1
@@ -35,6 +35,11 @@ or loses only against the other variants of its question.
35
35
  for literal copies. Derive the composition from the product's own visual language; a new palette
36
36
  or spacing on the reference's layout is not a different concept.
37
37
 
38
+ 7. **Visible UI is built only from a sketch the user picked.** A new or changed element, label,
39
+ badge or layout needs a picked sketch, and the build brief names its id. "Decision" and
40
+ "regression" items are no exception. Without a picked sketch, build data and specs only and
41
+ stop at the UI.
42
+
38
43
  Confirm the step size once, at the start. Do not ask again at every stop. A task is not
39
44
  finished while the user is still talking about it.
40
45
 
@@ -46,13 +51,10 @@ finished while the user is still talking about it.
46
51
  - Your pick, one line on why.
47
52
  - Nothing else. No next step, no second finding.
48
53
 
49
- **Do not send a screenshot.** The user keeps the call open. Screenshot only for your own
50
- check that a variant renders. In a repository with `et design`, take it with
51
- `et design shot <layer>/<name> --states [--variants]`: one contact sheet of every state, and
52
- every variant of the open sketch, with a label per cell; below each variant row, a diff row marks
53
- the pixels that differ from the merged state in red, or says "no pixel change" (with ", but the markup differs" when only the markup changed, e.g. both sides miss the same content). It prints the PNG path last. `--scale 2` enlarges a small part; `--crop x,y,w,h` cuts each cell to that CSS-pixel box, to judge hairlines. `--interaction hover` forces an interaction on every cell. `--state a,b` draws only those states, to compare them side by side. With `--variants`, `--round r2` or `--variant i,j` draws only those variants next to the merged row, so the current round stays readable; it filters the picture, never the checks. With `--variants`, `--diff-props` compares each variant with the merged part drawn with the variant's state props, so changed props do not paint the diff red. It draws
54
- undimmed, whatever Studio shows. Do not write a scratch script for batch shots.
55
- `et design motion shots <layer>/<name> <motion>` draws a motion at its keyframes, in full and reduced motion, into one sheet, and writes its tracks (element, properties, start, duration, easing) as JSON next to it.
54
+ **Do not send a screenshot.** The user keeps the call open. Screenshot only for your own check that a
55
+ variant renders: `et design shot <layer>/<name> --states [--variants]` draws one contact sheet. Every
56
+ flag, the motion shots and the raw screenshot script are in {%resource:reference-shots.md%}. Do not
57
+ write a scratch script for batch shots.
56
58
 
57
59
  If a second defect appears, add it to the open list and give it one line. Do not draw it.
58
60
 
@@ -80,500 +82,44 @@ Studio no longer takes new calls. **New work goes to a product, never to a new c
80
82
  `et design new`. Old calls stay in Studio's Legacy tab as reference for moving them into a
81
83
  product. They take no picks and no new variants.
82
84
 
83
- ### Create a product
84
-
85
- ```bash
86
- et design product new <name> [--base @ethlete/components|<path>] [--from-project <name>]
87
- ```
88
-
89
- It writes the `config.json` entry and the empty layer folders. A product on `@ethlete/components`
90
- takes the SDK as its base, so its parts start from the real components rendered with `ng()`.
91
- Without a base it gets the presets phone (390x844) and desktop (1440x900). A product's own `presets`
92
- replace its base's whole: a desktop-only app lists `desktop` alone and draws no phone state. `--from-project` copies
93
- `styles`, `head`, `providers` and `themes` from an old project entry. Studio never writes
94
- `config.json`; the command does.
95
-
96
- Every frame loads the product's tokens stylesheets once, before the part's own `styles`, so a part
97
- never imports the tokens and never adds them to its `styles`. The product's config `tokens` lists
98
- those parts in load order (`["foundations/tokens"]` when left out); a listed part that does not
99
- exist yet is skipped. A product's own copy of a listed part, or a sketch of it, replaces the base's
100
- in every frame. Never list a `tokens.css` in config `styles`.
101
-
102
- A part file default-exports its `definePart(...)` and may also export named helpers, such as a piece of its
103
- markup: `import { studioMark } from '@system/foundations/logo'`. Import a piece from the part that draws it;
104
- never copy its markup into another part. A piece that uses the part's classes needs its stylesheet too
105
- (`@system/foundations/logo.css?inline`), or from the part's default export when the part sets
106
- `definePart({ styles })`: every drawing of that part gets it, so `render` returns only extra styles, or `drawing({ body })` with none. The layer
107
- rules hold for these imports as well.
108
-
109
- A component a host embeds exports its markup as such a helper, and a wrapper only its own frame needs, such as
110
- padding that makes room for a focus ring, goes in `render` alone, never in that helper: the host places the
111
- component itself and would inherit the wrapper's offset.
112
-
113
- A product whose app uses Tailwind lists one stylesheet in config `styles` that imports the app's styles and
114
- registers the drawing folders with `@source './'`. Sketches then use the app's utilities; plain CSS stays for what
115
- utilities cannot express, such as camera geometry.
116
-
117
- ### Propose a change as a sketch
118
-
119
- A change to a part, or a new part, is a **sketch**: the question is the part, the variants are the
120
- answers. Variants are drawn at the same geometry, and one variant wins only against the others.
121
-
122
- ```bash
123
- et design sketch new <layer>/<name> --variants a,b --by <model id> [--like <layer>/<name>] [--variant-note a=<text>]… [--product <p>] # each variant starts as a copy of the part
124
- et design sketch new <layer>/<name> <layer>/<name>… --variants a --by <model id> # one change across several parts: one sketch, one ready, one merge
125
- et design sketch report <layer>/<name> --variant b --by <model id> "phone" # tell Studio what you build now
126
- et design sketch report <layer>/<name> --variant b --by <model id> --done # you stopped drawing b; Studio shows its frames
127
- et design sketch check [<layer>/<name>] [--fix] # each variant laid over the product
128
- et design sketch ready <layer>/<name> --by <model id> # now the user can pick
129
- et design sketch reject <layer>/<name> --variant b [--reason <text>] --by <model id> # only when the user rejected b; no pick or merge until reopened
130
- et design sketch reopen <layer>/<name> --variant b [--reason <text>] --by <model id> # only when the user takes b back; the rejection stays in the history
131
- ```
132
-
133
- One change across several parts (an alias removal, a token rename) is one sketch with several targets: each
134
- variant holds every target, and `ready` compares them all. `ready` and `preview` also name every part a `shared/`
135
- edit reaches.
136
-
137
- Variants are alternatives. A variant never stands for a state of another variant: a hidden or
138
- collapsed mode of variant d is a further state of d, not a variant e. Before you draw a new control,
139
- look for a control that already does the job (an active rail button that toggles its panel), and
140
- draw that first.
141
-
142
- A section of an app is a page under `pages/`, never a state of the shell. An element holds its
143
- own chrome only. A sketch on an element adds no state whose difference is page content in a slot.
144
-
145
- A variant mirrors the product layout and holds only the parts it changes. Draw two to four
146
- variants, each with what it costs, and run `sketch check` before `ready`. A variant with problems
147
- cannot be picked. A part in a variant keeps every state the part has in the product: `sketch check`
148
- and `sketch ready` fail on a dropped state, and warn when two stylesheets of one part define the same class. A problem the product already had prints as `NOTE (was there before)` and fails
149
- neither. Use `sketch list` to see the open ones.
150
- `sketch check` also runs tsc over each variant with its `@shared/` and `@system/` imports, so never write a
151
- tsconfig of your own. It warns of a variant stylesheet that restyles a class of `shared/`, of a
152
- variant file nothing imports, and of a `shared/` export the variant does not import; `design check` warns of
153
- an export in a merged part's `shared/` that nothing imports, and (`STALE-REPLACE`) of a `.replace('<…')` or
154
- `.replace(/<…/)` on markup that neither the part nor a part it uses draws. To delete a file of a part, delete it in the variant: a merge deletes the
155
- product file the picked variant no longer holds.
156
-
157
- Each variant's note, what it is and what it costs, goes in with `sketch new --variant-note a=<text>`, once
158
- per variant: `sketch.json` keeps it apart from the part's `definePart({ note })`, and Studio shows it in the
159
- variant's head. A merge keeps the part's note, takes its `--note`, or gives a new part the picked variant's note.
160
- `sketch new` and `sketch variant` write their files in the checkout's Prettier format; after an edit,
161
- `sketch check --fix` formats the variants before it checks them. A sketch command
162
- without `--product` takes the product that holds the sketch.
163
-
164
- Start a new part from a close one with `--like`: `sketch new pages/inbox --like pages/system`
165
- copies the product's `pages/system` into each variant, renamed to the target and without its
166
- `madeBy`; `--like pages/system:b` copies variant b of the open sketch on it, with that sketch's
167
- `shared/` folder.
168
-
169
- Rendering for one variant lives in that variant's files. `shared/` holds only code every variant
170
- uses: do not give a shared helper a parameter, branch, import or style rule that only one variant, or
171
- a variant you dropped, needs. A merge takes `shared/` whole, so what stays there ships with the pick.
172
-
173
- Code the variants of one sketch have in common (sample data, a switch, a helper) goes in the
174
- sketch's `shared/` folder, next to the variant folders, never into copies per variant. A part in a
175
- variant imports it as `@shared/<path>`, and a shared file may import `@system/...` and
176
- `@shared/...`. A part outside a sketch may not import `@shared/`. A variant that needs a shared file
177
- changed holds its own copy at `<variant>/shared/<path>`; `@shared/<path>` finds that copy first, and a merge
178
- of that variant takes it. On a merge, `shared/` moves into
179
- the target's folder as `shared/` with its imports made relative; when no part imports it, it is
180
- dropped. With several targets, each takes only the files it imports, directly or through another
181
- shared file; a file nobody imports goes back to the target that held it, and the merge refuses one no
182
- target held. `sketch new` refuses targets whose `shared/` folders hold one path with different contents. Only the target may import it: a merge refuses while another part of the picked variant
183
- does, so move that code into the part. `sketch new` prints each file it puts in `shared/`, for example
184
- the `shared/` folder of a merged page: edit it there, as part of the sketch, not in a variant copy.
185
-
186
- ```ts
187
- // sketches/pages-flows/shared/flow-data.ts
188
- export const flows = [{ name: 'Checkout', steps: 4 }];
189
-
190
- // sketches/pages-flows/a/pages/flows/flows.ts
191
- import { flows } from '@shared/flow-data';
192
- ```
193
-
194
- An asset (a mark, logo, icon, picture or font) is one file in `.ethlete/design/<product>/assets/`,
195
- never a copy inlined into parts. A part imports it as `@assets/<file>`: the default import is a URL
196
- for `<img src>`; an SVG that must follow tokens (`currentColor`, `var(--accent)`) imports with
197
- `?raw` and goes inline, for example `@assets/icons/<name>.svg?raw`. A stylesheet, the product's
198
- `styles.css` or a part's, uses `url('@assets/<file>')`, for example in an `@font-face`. A foundation
199
- part may wrap an asset in a named export. A product finds its base product's assets too. A sketch
200
- variant adds or changes an asset in its own `<variant>/assets/` folder (`sketch new` and `sketch variant`
201
- print it next to the part file), and a merge copies it into the product's. Size an inline SVG with
202
- `svgAsset(mark, { size: 32 })` from `@design-system`, never by replacing its `width`/`height` as a
203
- string; `class` and `attrs` (`{ 'aria-hidden': 'true' }`) set the rest of the root's attributes. `design check` fails an SVG asset with no root `<svg>` or without
204
- `xmlns="http://www.w3.org/2000/svg"` (an `<img src>` and an image viewer do not draw it). The part hash behind `design check` and "changed outside a sketch" counts the bytes of
205
- the assets a part uses.
206
-
207
- Every change to a merged part goes through a sketch, also a small one: new copy, sample data, an
208
- added state. When there is nothing to choose, the sketch has one variant (`--variants a`), and the
209
- user merges it or comments on it. Never edit a merged part directly, or the user cannot compare or
210
- comment on the change in Studio. `design check` warns, and Studio marks the part "changed", when a
211
- merged part changed outside a sketch; only a merged sketch on that part clears it.
212
-
213
- A sketch on a foundations part such as `foundations/tokens` keeps the part's overview drawing: the
214
- variant adds its token group as a state, or extends that group's state. It never replaces the
215
- drawing with a demo scene, since the merge would drop every other group. A demo may be an extra state.
216
-
217
- Name the variant you work on with `--variant`. Studio marks it as drawing, and hides its frames,
218
- while the latest report names it. `sketch new` starts no report, so `report --done` follows only a report
219
- of your own; it prints the next steps. `sketch new`, `sketch variant` and each report record your
220
- model id as an author of the variants they write, and `sketch ready` records it on every variant
221
- that has no author yet. A merge adds the picked variant's authors to the `madeBy` the part file
222
- already holds, and never removes it.
223
-
224
- ### Combine variants in a new round
225
-
226
- Studio never combines variants. When the user asks for one in a comment ("solid like a, outline
227
- like b"), draw it as a new variant in a new round:
228
-
229
- ```bash
230
- et design sketch variant <layer>/<name> c --from a --by <model id> --round "Solid a, outline b" --note "r1 showed pill and square; the user wants a's solid with b's outline"
231
- ```
232
-
233
- `--from` copies a variant into the new one, sets the sketch back to in progress and clears the
234
- pick; it refuses while the decision is a discard (the user picks a variant first). Without `--round` the new variant joins the running round; with it, `--note` is required and
235
- goes on the running round: what it showed and why its variants lost. Older variants stay pickable.
236
- The command prints the notes of the previous round. Fix a round's title or note later with `sketch round <layer>/<name> <round> --title … --note … --by <model id>`; `sketch list` shows each sketch's rounds.
237
- Letters continue across rounds (r1: a, b; r2: c, d). `sketch variant <layer>/<name> c,d --from a` adds
238
- several variants at once; with `--round` they all start the new round. A new round answers the comments on the
239
- `--from` variant and marks them "addressed in round" with the new round's key. A variant without `--round` fails while the sketch has open comments and lists them: a variant that answers a comment starts a new round. Draw the combined
240
- variant and mark the sketch `ready` again. `sketch new --round <title> --note <text>` names
241
- round 1 and sets its note; `--round` without `--note` fails. `sketch ready` refuses while the running round has no note; set it with `sketch round`.
242
- `sketch ready` also shoots every state of every variant and of the product's part: when not one pixel differs
243
- in any of them, it merges the sketch itself and logs it as an `auto` entry in the product's `accepted.json`
244
- ("No visible change in any state: merged automatically."). Any difference or failed shot leaves it `ready`.
245
- A problem the product already had before the merge does not block it (the check prints it as a note); only a problem the merge adds does.
246
- Run `sketch ready` again on a `ready` sketch to repeat the check and the auto merge.
247
-
248
- Mark a sketch `ready` only when no change to it waits on anything: no open decision, no helper still to
249
- land, no "once X is decided I adapt the sketch". A pending change keeps the sketch in work and out of the
250
- merge queue: ask first, make the change, then mark it `ready`. Record the wait with
251
- `et design sketch hold <layer>/<name> --until "<what it waits on>" --by <model id>` (a `ready` sketch goes back
252
- in progress) and `sketch release` it once the change is in.
253
-
254
- ### Your model id: `--by`
255
-
256
- Every command that writes takes `--by <model id>` and fails without it: `sketch new`, `variant`, `report`,
257
- `ready`, `rebase`, `merge`, `discard`, `inbox done` and `comment reply`. The id is the exact model
258
- id as free text, for example `claude-opus-5-5`, `gpt-5.6-sol` or `gemini-3-argon`. Studio shows it
259
- on the variant, the reply and the part, so the user sees which model made what.
260
-
261
- **Never guess your id.** Use the one your prompt names. If your prompt names none and you do not
262
- know your own exact id, ask the coordinator or the user before you write.
263
-
264
- ### The user decides, Studio merges
265
-
266
- The user picks a variant, or discards the sketch, in Studio. **Studio merges on the user's click.
267
- Never run `sketch merge` or `sketch discard` yourself, and never pick a variant.** Both mark
268
- the open comments on the sketch's variants addressed: the user's click answers them. Comments on the
269
- product's parts stay. If a part the variant replaces changed
270
- in the product since the sketch was created, the merge refuses: bring each variant up to date, run
271
- `et design sketch rebase <layer>/<name>`, and mark it `ready` again. `sketch preview <layer>/<name>
272
- <variant>` lists the elements and pages a merge changes. The note on a part records why it has its
273
- current shape. The user's reason is optional: with one, the merge sets the note from it; without
274
- one, the part keeps the `note` the picked variant file holds, so write that note while you draw.
275
-
276
- After the user approves a direct edit of a merged part (no sketch), run `et design accept <layer>/<name> --product <p> --by <model id> --note <why>` so `design check` stops warning `changed outside a sketch`. Never accept an edit the user did not approve.
277
-
278
- To drop a merged part the user no longer wants (folded back into its host, say), run `et design part remove <layer>/<name> --product <p> --by <model id>`: it deletes the folder, its `merged.json` entry and its tsconfig path, and resolves its comments. It refuses while another part imports it or an open sketch targets it. Never `git rm` a part by hand.
279
-
280
- ### Read the inbox
281
-
282
- The user comments on a state of a part in Studio, at a point, or on a sketch variant. The sketch of
283
- an element also shows each page that uses it, with each variant swapped in: a comment there names
284
- the page as its part and the element's sketch variant, so change the variant, not the page.
285
-
286
- ```bash
287
- et design inbox [--json] [--product <p>] # open comments and rebases, then what waits for the user
288
- et design inbox done <id> --note <text> --by <model id> # set the part note, mark the thread addressed
289
- et design comment reply <id> --by <model id> <text> [--question] # answer a comment thread (takes --product)
290
- ```
291
-
292
- Read the inbox at the start of a session and after each sketch you mark `ready`. Answer a comment
293
- by changing the sketch or the part, then `inbox done <id> --note "…"`. The note replaces the `note` of the part the comment was made on (for a sketch variant, the product's part), so write it to explain the whole shape of the part, and pass the old note unchanged when it still holds. `done` fails without `--note`; only the user withdraws a comment without one, in Studio. `done` also stores your `--by` where the comment sat: in the authors of the sketch variant, or in the `madeBy` of the part. A pick or discard decision is listed as waiting
294
- for the user: Studio merges or discards on the user's click, so never run `sketch merge` after a pick.
295
-
296
- A comment is a thread: the user and you both reply. When a comment is unclear, ask with
297
- `comment reply --question` instead of guessing. The thread then moves to the "waiting for the user" group
298
- (`waitingForUser` in `--json`) and returns to the inbox when the user answers. A thread there is
299
- not work for you.
300
-
301
- A thread has three states. **Open** waits for an answer. **Addressed** (`addressed`: who, when, why,
302
- the round) means `inbox done`, a new round, a merge or a discard answered it: it leaves the inbox and
303
- the check, Studio shows it with an "addressed" badge, and you may still `comment reply` on it to say
304
- what you changed. A reply by the user opens it again. **Resolved** means the user closed it in Studio -
305
- only the user resolves. The file stays so the user can look back at it; a reply or `done` on it fails.
306
-
307
- Pass `--question` only when you cannot go on without the user's answer. Studio lists only those
308
- threads under "Questions for you". A report of what you did is no question: reply without the
309
- flag, and the thread shows as "answered" until the user withdraws it or replies.
310
-
311
- ### Draw a flow
312
-
313
- A flow joins states of pages into a path the user reads left to right in Studio's Flows view.
314
- It is `<product>/flows/<name>.json`; `position` and `label` are optional:
315
-
316
- ```json
317
- {
318
- "frames": [{ "part": "pages/library", "state": "empty", "position": { "x": 0, "y": 0 } }],
319
- "lines": [
320
- {
321
- "from": { "part": "pages/library", "state": "empty" },
322
- "to": { "part": "pages/film-detail", "state": "default" },
323
- "label": "user adds a film"
324
- }
325
- ]
326
- }
327
- ```
328
-
329
- Every flow line is labelled, and the element the label names is visible in the frame before it: a line
330
- labelled "user clicks 'Log in'" starts from a frame that shows a "Log in" button. A line that names
331
- nothing the reader can see, or a label for a control the page lacks, is a defect.
332
-
333
- A line may join two states of one page. A frame may name a page that exists only as an open sketch;
334
- the flow then shows its first variant. Lines hold for every preset. Without `position`, Studio
335
- lays the frames out along the lines.
336
-
337
- ### Draw a wireframe
338
-
339
- A wireframe exists to iterate fast, in minutes per round, rough enough to redraw with a client at
340
- the table. It answers one thing: which regions a screen has and what each region holds. These
341
- rules are strict:
342
-
343
- - **Keep what exists.** Before a sketch, list what the running app already does on that screen.
344
- Keep it as a labelled box, and draw only what is still open.
345
- - **One sketch per screen or flow**, never one per region or per detail. The variants differ in
346
- layout: where the regions sit and how big they are.
347
- - **Regions and names only.** A region is a box with a label; a list shows item names. Draw no
348
- counts, badges, status markers, inspectors, size labels or field lists. If a detail matters,
349
- write it as a word in the region label.
350
- - **Never polish.** Do not fix alignment, spacing or a kit gap. When the kit lacks a shape, draw a
351
- labelled box. Look at each shot only for a broken frame: overflow, a scroll bar, clipped text.
352
- - **Draw it yourself.** A wireframe round is small work: no subagent, no friction report.
353
- - **Stop early.** When the regions of the main screens are settled, the stage ends. Comments on
354
- the look of a wireframe belong to the next stage, not to a new wireframe round.
355
-
356
- A page may not import another page. To show a page inside a page ("in context"), embed it:
357
- `embedPage('pages/system', { state, width, height, scale })` from `@design-system` answers a
358
- drawing whose `body` is a frame of that page, drawn in the same product, sketch variant and theme
359
- as the embedding frame. `width` and `height` are the viewport the page is drawn at (default
360
- 1280 x 800; `height: 'auto'` fits its content), `scale` shrinks the frame. Never rebuild a page
361
- from its elements to show it.
362
-
363
- A page that has no parts yet draws grey stand-ins from the wireframe kit; pages and elements may
364
- import it, components and foundations may not:
365
-
366
- ```ts
367
- import { box, heading, textLines, image, button, input, icon, select } from '@design-system/kit';
368
- ```
369
-
370
- Signatures are in `libs/cli/design/wireframe-kit.ts`: `box(children, { direction, gap, padding, width, height, grow, plain, stackBelow, fill })`,
371
- `heading(text, { size })`, `textLines({ lines, width, size })`, `image({ width, height, ratio })`,
372
- `button(label, { primary })`, `input({ label, placeholder, width })`, `icon({ size, glyph })`,
373
- `select({ label, value, width })`, `tabs(labels, { active })`, `segmented(options, { active })`,
374
- `checkbox(label, { checked })`, `badge(text)` and `dot({ hollow, size })`. Draw a control as its
375
- type: a picker is a `select`, a section switch `tabs`, a size switch `segmented`, a count a `badge`,
376
- a status a `dot`, never a row of buttons or an empty `icon`. Give an icon a `glyph` (`'plus'`,
377
- `'close'`, `'menu'`, `'more'`, …; another name draws its first letter). Give the root box of a page or a
378
- shell `fill: true` so it is as tall as the frame, instead of a hand-written `min-height`. Draw for
379
- every preset, not one width: give a picture a `ratio` (`'2/3'`) instead of a fixed height, and give
380
- a row `stackBelow: <px>`, the width below which it stacks its children, instead of fixed widths
381
- that only fit the desktop. Never use `vh`, `dvh` or `svh` in a part: a part has no viewport of its own, so the unit measures Studio's frame, not the page. A full page is a frame of a fixed size. Put titles in `heading`, never in hand-written markup. Studio lists such a page under
382
- "Wireframes" with its kit-use count. A shell is a normal element named by purpose (`shell-main`); draw a rough one with the kit, so each
383
- page imports the shell instead of repeating it, and a shell pick lands in one file.
384
- A dialog without its own URL is an element that a page state shows ("login open"). Examples in
385
- `.ethlete/design/studio-lab`: `pages/film-detail`, `elements/shell-main`, `elements/login-dialog`,
386
- `flows/sign-in.json`.
387
-
388
- ### Check a product
389
-
390
- ```bash
391
- et design check --product <name> # layer dependencies, hard-coded colours, undefined tokens, copied components, scripted motion, tsc (open sketch variants too), render
392
- et design system --json # each part's origin, note, states, presets and problems
393
- ```
394
-
395
- Without `--product`, `check` covers every product. A part may only use its own layer and the
396
- layers below it (see "The order of a design"). Rule `FLOW` reports a misshaped flow file, a frame
397
- naming a part or state that exists neither in the product nor in an open sketch of that part, a duplicate state, and a line to a state that is not a frame of
398
- the flow. Rule `WIREFRAME-KIT` reports a component or foundation importing the kit. Pass the changed files to the check below as before.
399
-
400
- Once the other rules pass, the check draws every state in a headless Chromium on a server of its own
401
- (pages at each preset, a part with `widths` at each width, any other part fitted), and
402
- `sketch check` does the same for the open variants and the pages they show in. Each line names
403
- product, part, state, size and a selector path:
404
-
405
- - `OVERFLOW` - the frame scrolls: content wider than the frame, or taller than a preset height.
406
- - `CLIPPED` - an element with `overflow: hidden|clip` cuts its content, unless it sets
407
- `text-overflow: ellipsis` or a line clamp.
408
- - `WRAP` - text in a button, tab, badge, chip or `white-space: nowrap` box runs onto a second line.
409
- - `ZERO-SIZE` - the part root has no width or no height.
410
- - `UNKNOWN-THEME` - a `et-color--<name>` class names a colour theme no stylesheet of the frame defines, so it draws in the fallback colour.
411
- - `RENDER` - the frame refused to draw, or the part did not load.
412
-
413
- A `WARNING` line does not fail the check:
414
-
415
- - `UNDEFINED-CLASS` - a class carries a prefix the product's part CSS uses (`st-`, not the SDK's
416
- `et-`), but no stylesheet of the frame defines it. Named once, at the first part that draws it.
417
- - `GRID-COVERAGE` - some `grid` rows fill every interaction column (`rest`, `hover`, `active`,
418
- `focus-visible`, `disabled`) and others leave some out, so a state can break there unseen.
419
-
420
- A part that breaks a rule on purpose names it: `definePart({ checks: { skip: ['CLIPPED'] }, … })`;
421
- the skip covers the part wherever it is drawn. Without Playwright Chromium the check prints
422
- `RENDER CHECK SKIPPED` and passes on the other rules.
423
-
424
- A project's `config.json` entry can name `themes`, `{ "surface": [...], "color": [...] }`; a
425
- frame asked for a theme gets the `et-surface--<name>` and `et-color--<name>` classes on its root,
426
- so a drawing must take its colours from the theme tokens and never set a surface or colour class
427
- on its own root. An inner panel may set `et-surface--<name>`.
428
-
429
- `et design [checkout]` serves the frames; the checkout defaults to the working directory and
430
- `DE_PORT` overrules the port. In the ethlete SDK the user reads Studio, started with `yarn studio`,
431
- which serves the frames itself: do not start `yarn design` next to it. Studio carries its own copy
432
- of the tool, so a checkout that installs nothing still draws.
433
-
434
- Three constraints on a drawing file:
435
-
436
- - **Never import a package barrel.** The libraries resolve to source, so one barrel makes the
437
- browser request every module and the requests fail with `ERR_INSUFFICIENT_RESOURCES`. Import
438
- the one file you need.
439
- - **The fixture is shared, and a variant may not change it.**
440
- - **One file per variant**, so a broken variant breaks its own frame only.
441
-
442
- A `<script>` in a drawing never runs. For behavior give the drawing a `setup(root)` function
443
- (called once after the markup is in `root`, no cleanup, wire one delegated listener). Render each
444
- state of a prototype with `ngStates({ closed: …, open: … }, { imports })` and swap them with
445
- `setup: flow.on([{ click: '.trigger', go: 'open' }])`. To draw an open overlay, open it in the
446
- template (`<et-select [open]="true">`); `ng()` returns the real panel and the frame places it.
447
- `ngStates` wraps the states in `<div data-de-states style="display: contents">`, so a selector
448
- rule must not depend on that wrapper.
449
-
450
- **A repository with a sketch Storybook** draws every variant in the **same** story, side by
451
- side, under the real geometry the thing ships in. The default Storybook is
452
- {%storybookUrl%}; an app with its own sketch Storybook names its port in the plan file.
453
-
454
- Either way:
455
-
456
- - Sketches take inputs only and stay out of the application's build.
457
- - Prototype, never refactor. Do not touch the shipped component until the treatment is
458
- settled.
459
- - Keep the rejected variants drawn, marked as rejected.
460
-
461
- ### Notes
462
-
463
- A note explains a state: why it looks this way, what it shows. A comment is feedback that needs
464
- an answer. Write a note when nothing is asked of the reader.
465
-
466
- A note is `<product>/notes/<timestamp>-<id>.json`:
467
-
468
- ```json
469
- { "part": "button", "state": "disabled", "point": { "x": 24, "y": 8 }, "size": "mobile", "text": "Muted, not hidden." }
470
- ```
471
-
472
- - `part`, `state` and `text` are required. `point` is optional, in CSS pixels.
473
- - `size` is required when `point` is set: the preset, the CSS pixel width, or `"fitted"` the note was written at. A
474
- pointed note shows only at that size; a note without a point shows at every size.
475
- - A free note on a flow is an entry in the `notes` array of `flows/<name>.json`:
476
- `{ "id": "…", "text": "…", "at": { "x": 0, "y": -40 } }`. `at` is optional, the note's top-left
477
- corner on the flow canvas, and may be negative.
478
-
479
- ## The order of a design
480
-
481
- A product design runs in this order. Each stage settles in calls before the next starts, and
482
- each stage draws with what the stages before it settled (the wireframes draw with the kit only):
483
-
484
- 1. **Wireframes**: early, rough concepts of the main flows (a legacy call with `mode: 'wireframe'`;
485
- in a product, draw them with the wireframe kit, see "Draw a wireframe"). They show
486
- which components the product needs, not how they look. The stage ends with an inventory in
487
- the wireframe call: every part the wireframes need, each mapped to the SDK component it
488
- starts from, or marked new with the component call that draws it. The inventory is the
489
- queue of component calls:
490
-
491
- ```ts
492
- inventory: [
493
- { part: 'Search field', sdk: 'et-input' },
494
- { part: 'Match card', new: true, call: 'tomflix/components/match-card' },
495
- ],
496
- ```
497
-
498
- 2. **Foundations**: colours, colour themes and surface themes (the project's `themes` in
499
- `config.json`), plus the type scale, spacing and radius.
500
- 3. **Logo and CI**, if the project needs them.
501
- 4. **Components**, the inventory is their queue, from the SDK ones rendered with `ng()`, themed and set up for the project.
502
- Each accepted one becomes a design-system entry.
503
- 5. **Larger elements**: the shell, the navigation, headers, lists, built from the entries.
504
- 6. **Pages**, built from the elements and the entries.
505
- 7. **The working prototype**: the pages joined with `ngStates` and `flow.on`.
506
-
507
- Do not start a stage before the one above it is settled, and do not draw a page from parts that
508
- are not in the design system. If the user asks for a later stage first, say which earlier stage
509
- is missing, and draw that first.
510
-
511
- The stages map onto the layers of a product: wireframes, foundations, components, elements, pages. A settled
512
- Legacy call with a stage counts for that stage in this order.
513
-
514
- A later stage can show that an earlier one is incomplete. If a page needs a part that the system
515
- does not have, add it to the inventory. A part becomes a component only when at least two hosts
516
- draw the same case. Until then it stays in the one element or page that draws it. When a second
517
- host draws it, open a component sketch, and list in its brief every host and every case each one
518
- draws, so the component covers them all.
519
-
520
- A component documents its states per axis, not every combination: for example kind, end mark and
521
- interaction (rest, hover, focus-visible, selected, inert), plus only the combinations that look
522
- different. A smaller piece with no states of its own, such as an icon set, is a foundation asset,
523
- not a component.
524
-
525
- When each of several cases is drawn at rest and in the same interactions, build the states and their grid with
526
- `interactionRows(rows, { interactions: ['hover', 'active'], force: (props, interaction) => ({ ...props, interaction }) })`
527
- from `@design-system` and spread the result into `definePart`; never write those states and the grid by hand.
528
- `sketch check` prints `grid <rows> x <columns> ok`, or the states the grid leaves out; a state in two cells
529
- fails it as `GRID`, in `design check` too.
530
- `definePart({ interactions })` forces an interaction on the part's root only. To draw one element of the part
531
- hovered, focused, pressed or disabled, such as one row of a list, wrap that element's markup in
532
- `forceInteraction(markup, 'hover')` from `@design-system` inside `render`, driven by a prop; never write
533
- `data-et-force` by hand.
534
-
535
- ## Draw from the design system
536
-
537
- A call that invents its own button, field or row does not match the calls beside it. **Before
538
- you draw a part, look for it in this order, and draw new only when none of them has it:**
539
-
540
- 1. The product's design system, `.ethlete/design/<product>/` (and its base).
541
- 2. The real SDK components, rendered on the design server with `ng()` from `@design-explore`:
542
-
543
- ```ts
544
- const field = await ng(`<et-form-field><et-label>Name</et-label><et-input /></et-form-field>`, {
545
- imports: ['FORM_FIELD_IMPORTS', 'INPUT_IMPORTS'],
546
- });
547
- ```
548
-
549
- The template is a real Angular template, and `imports` names exports of
550
- `@ethlete/components`. The project's `providers` module in `config.json` supplies the themes.
551
- Render every component of a drawing in **one** `ng()` call: each call is a new app, so two
552
- calls repeat element ids. The server renders the built package, so in the SDK rebuild
553
- `dist` after a component change.
554
-
555
- To draw a form state (a value, an error, a touched field), give `ng()` (or `ngStates()`)
556
- `fields`. Each entry becomes a signal form field the template binds as
557
- `[formField]="fields.<name>"`. An error is a kind (`'required'`) or a kind and a message. A
558
- field shows its errors only when it is touched:
559
-
560
- ```ts
561
- const form = await ng(
562
- `<et-form-field><et-label>Email</et-label><et-input [formField]="fields.email" /></et-form-field>`,
563
- {
564
- imports: ['FORM_FIELD_IMPORTS', 'INPUT_IMPORTS'],
565
- fields: { email: { value: 'ada@', errors: [{ kind: 'email', message: 'Not an email' }], touched: true } },
566
- },
567
- );
568
- ```
569
-
570
- 3. Only then a new drawing. Build it from the two above, and say in the variant's `claim`
571
- that the part is new.
572
-
573
- A part is one folder, `<product>/<layer>/<part>/`, with its drawing and states. Read the parts of
574
- the product before the first drawing of a session. **A part exists only because the user picked a
575
- sketch.** A `chosen` verdict in an old call is not enough. Never change a part's look without a
576
- sketch the user decided.
85
+ ## Hard rules for products and sketches
86
+
87
+ - A change to a merged part, also a small one, is a **sketch**; never edit a merged part directly. When
88
+ nothing is to choose, the sketch has one variant (`--variants a`). Variants are alternatives, never a state
89
+ of another variant. Two to four variants, each with its cost; run `sketch check` before `sketch ready`.
90
+ - **Never run `sketch merge` or `sketch discard`, and never pick a variant.** Studio merges on the user's
91
+ click. After a pick or discard, do not merge. Run `sketch reject` or `reopen` only when the user did.
92
+ - Mark a sketch `ready` only when no change to it waits on anything; otherwise `sketch hold`.
93
+ - Every write command takes `--by <model id>`. **Never guess your id**: use the one your prompt names, or ask
94
+ the coordinator or the user before you write.
95
+ - Run `et design accept` only after the user approved a direct edit. Remove a part only with
96
+ `et design part remove`, never `git rm`.
97
+ - Studio takes no new calls: never run `et design new`. New work goes to a product.
98
+ - Share code between variants in the sketch's `shared/` folder only; no shared parameter or branch for one
99
+ variant. An asset is one file in `<product>/assets/`, never inlined.
100
+ - A user comment to combine variants is a new variant in a new round (`sketch variant --from --round --note`).
101
+ - Read the inbox at the start of a session and after each `ready`. Answer with `inbox done <id> --note`,
102
+ ask with `comment reply --question` only when you cannot go on. Only the user resolves a thread.
103
+ - Use the `ethlete-design` MCP tools when they are in your tool list, and call `sketch_report` before every
104
+ variant edit.
105
+ - Draw from the design system, never invent a button or field: the product's parts, then SDK components via
106
+ `ng()`, then new. Colours come from the SDK theming systems, never your own tokens. A part exists only
107
+ because the user picked a sketch.
108
+ - A wireframe is rough and fast: regions and names only, no polish, no subagent, one sketch per screen.
109
+ - Do not start a design stage before the one above it is settled: wireframes, foundations, logo and CI,
110
+ components, elements, pages, prototype.
111
+
112
+ Details, commands and examples, read on demand:
113
+
114
+ - {%resource:reference-products-and-sketches.md%}: creating a product, every `sketch` command, shared code,
115
+ assets, rounds, `--by`, the merge and accept flow. Read before the first sketch command.
116
+ - {%resource:reference-inbox-and-mcp.md%}: reading and answering comments, thread states, the MCP tools.
117
+ - {%resource:reference-flows-and-wireframes.md%}: flow JSON, the wireframe kit and its rules.
118
+ - {%resource:reference-check-and-notes.md%}: `design check` rules and warnings, drawing-file constraints,
119
+ `setup`, `ngStates`, notes.
120
+ - {%resource:reference-order-and-design-system.md%}: the stage order, component states and
121
+ `interactionRows`, `ng()` and form fields, theming rules.
122
+ - {%resource:reference-shots.md%}: every `shot` flag, motion shots, the screenshot script.
577
123
 
578
124
  ## Check before you look
579
125
 
@@ -633,22 +179,6 @@ command." You know the id because you chose the model; the sub-agent does not, a
633
179
  variant's `verdict` in an old call's `call.ts` (a product sketch needs none; the merge sets the note). It runs while you open
634
180
  the next call.
635
181
 
636
- ## Screenshots
637
-
638
- **Off by default.** The user has the call open and sends you a picture when something looks
639
- wrong. Take one only when the code cannot tell you whether two variants really differ, and
640
- never to put in front of the user. Copy {%resource:shoot-template.mjs%} to the repository
641
- root.
642
-
643
- ```bash
644
- node shoot.mjs <story-id> 1100 760 out.png
645
- ```
646
-
647
- - `waitUntil: 'networkidle'` never settles on an iframe that holds a live dev server
648
- connection. Use `'domcontentloaded'`.
649
- - `:hover`, `:focus-visible` and `:active` need a CDP session and `CSS.forcePseudoState`.
650
- Several hold open at once, so one image shows them all. The template does this.
651
-
652
182
  ## Writing it down
653
183
 
654
184
  Every settled call goes in the exploration's plan file: what won, what lost, and why. Keep