@rt-tools/agent-kit 0.32.0 → 0.34.0

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 (75) hide show
  1. package/README.md +8 -7
  2. package/assets/agents/goal-critic.md +67 -0
  3. package/assets/agents/product-strategist.md +90 -0
  4. package/assets/agents/qa-engineer.md +3 -0
  5. package/assets/checks/board.github.mjs +27 -0
  6. package/assets/checks/check-specs.mjs +11 -2
  7. package/assets/checks/rt-kit-checks.config.mjs +6 -0
  8. package/assets/checks/spec-common.mjs +6 -3
  9. package/assets/checks/spec-scenarios.mjs +9 -1
  10. package/assets/checks/task-new.github.mjs +6 -0
  11. package/assets/checks/tree-assignment.mjs +11 -3
  12. package/assets/defaults/project.sh +10 -81
  13. package/assets/defaults/push.sh +100 -0
  14. package/assets/docs/GLOSSARY.md +4 -0
  15. package/assets/hooks/browser-guard-no-other-drivers.sh +6 -3
  16. package/assets/hooks/claim-guard.sh +6 -6
  17. package/assets/hooks/dispatch.sh +56 -3
  18. package/assets/hooks/exam-guard.sh +1 -1
  19. package/assets/hooks/git-guard-delivery-body.sh +25 -3
  20. package/assets/hooks/git-guard-delivery-folder.sh +17 -1
  21. package/assets/hooks/git-guard-delivery-merged.sh +65 -0
  22. package/assets/hooks/git-guard-delivery-pipeline.sh +99 -0
  23. package/assets/hooks/git-guard-delivery.sh +22 -8
  24. package/assets/hooks/git-guard-main.sh +17 -4
  25. package/assets/hooks/git-guard-push-ahead.sh +89 -0
  26. package/assets/hooks/git-guard-push-marks.sh +99 -0
  27. package/assets/hooks/git-guard-push-tests.sh +101 -83
  28. package/assets/hooks/git-guard-tree-assignment.sh +1 -1
  29. package/assets/hooks/grill-gate-options.sh +50 -0
  30. package/assets/hooks/grill-gate.sh +9 -1
  31. package/assets/hooks/pre-push.sh +113 -0
  32. package/assets/hooks/push-set.sh +150 -0
  33. package/assets/hooks/push-sign.sh +433 -0
  34. package/assets/hooks/rerun-guard.sh +14 -6
  35. package/assets/hooks/turn-exit-guard.sh +2 -2
  36. package/assets/hooks/turn-exit-patterns.sh +4 -3
  37. package/assets/hooks/turn-exit-verdict.sh +18 -1
  38. package/assets/hooks/waiting-turn-guard.sh +2 -1
  39. package/assets/hooks/write-targets.sh +21 -0
  40. package/assets/patterns/dependencies-upgrade.md +5 -1
  41. package/assets/patterns/git-workflow-commit.github.md +14 -0
  42. package/assets/patterns/git-workflow-pr-body.github.md +20 -3
  43. package/assets/patterns/git-workflow-pr.azure.md +30 -0
  44. package/assets/patterns/git-workflow-pr.github.md +57 -1
  45. package/assets/patterns/git-workflow-pr.gitlab.md +33 -0
  46. package/assets/patterns/mockups-measure.needs-mockups.md +19 -3
  47. package/assets/patterns/reuse-first-extend.md +5 -0
  48. package/assets/patterns/task-flow-close.md +27 -16
  49. package/assets/patterns/task-flow-start.md +5 -4
  50. package/assets/pitfalls/task-flow.md +4 -0
  51. package/assets/rules/browser-verification.md +4 -0
  52. package/assets/rules/dependencies.md +3 -1
  53. package/assets/rules/deploy-flow.azure.md +5 -0
  54. package/assets/rules/deploy-flow.github.md +5 -0
  55. package/assets/rules/deploy-flow.gitlab.md +5 -0
  56. package/assets/rules/git-workflow.azure.md +15 -0
  57. package/assets/rules/git-workflow.github.md +15 -0
  58. package/assets/rules/git-workflow.gitlab.md +15 -0
  59. package/assets/rules/mockups.needs-mockups.md +13 -5
  60. package/assets/rules/reuse-first.md +3 -0
  61. package/assets/rules/task-flow.md +21 -16
  62. package/assets/rules/testing.md +5 -0
  63. package/assets/samples/tasks/_template/plan.md +7 -0
  64. package/assets/skills/interface-review-annotate.needs-mockups.md +142 -0
  65. package/assets/skills/interface-review-icons.needs-app.md +136 -0
  66. package/assets/skills/interface-review-motion-states.needs-app.md +230 -0
  67. package/assets/skills/interface-review-motion.needs-app.md +209 -0
  68. package/assets/skills/interface-review-performance.needs-app.md +110 -0
  69. package/assets/skills/interface-review-principles.needs-app.md +263 -0
  70. package/assets/skills/interface-review-surfaces.needs-app.md +249 -0
  71. package/assets/skills/interface-review.needs-app.md +199 -0
  72. package/assets/skills/write-a-skill.md +16 -3
  73. package/assets/workflows/feature.js +33 -5
  74. package/assets/workflows/plan.js +71 -4
  75. package/package.json +1 -1
@@ -131,6 +131,18 @@ flowchart TD
131
131
  person, a task by the work queue, and both read with a token other than the creating one.
132
132
  - **A refusal is read before it is bypassed by a second way.** It can be an early sign of a write
133
133
  limit, and a bypass by another call carries the sign away: the discrepancy surfaces at the owner.
134
+ - **A push is sent only by the path the push guard stands on.** A terminal, a process or a script
135
+ started outside the session carries the same command past the gate, unless the tree wired the
136
+ git hook `pre-push`: then git runs the set there too. A send cut off by the session's end is
137
+ asked of the host and repeated by the same path.
138
+ - **A review of a foreign branch starts with the gate set run on its tip.** Reading the diff misses
139
+ what the set judges by the whole tree: a word, a file limit. A check that stands only on an edit,
140
+ such as the wording one, is run over the changed texts apart. The output goes into the review,
141
+ and a later push into that branch is run again.
142
+ - **Where neither the session's push guard nor the git hook fires, the set is run whole, as read
143
+ at the minute of the run.** It is read from the state review or from the tree profile together with the package
144
+ default it calls. A list from memory, from a copy made earlier or from the profile alone drops
145
+ checks: the profile names the set, the task names only the work.
134
146
  - **The branch number and the PR title number are checked on the spot, the task state — by the
135
147
  board.** The format is read from the command text and works offline; the second tier needs
136
148
  something to ask with.
@@ -219,6 +231,9 @@ flowchart TD
219
231
  - **A push into a branch that has an open PR is followed by rereading its body.** The statement
220
232
  about a green run names the tip by its sha, and moving the tip makes it false in silence: no check
221
233
  reads a PR body.
234
+ - **On remarks to a PR the person is asked whether to answer under them, and after a yes each one
235
+ gets an answer.** Edits alone leave the discussion silent, and the person reads the whole diff
236
+ again. The word holds for that PR, not for the next.
222
237
  - **The draft is not lifted while the PR has no review.** The guard reads the requested reviewer and
223
238
  the review left: a lifted draft reads as "may be merged", and there is nobody to merge.
224
239
  - **The PR merge is pressed by a person, not by the work's executor.** Button and merge call are
@@ -112,6 +112,9 @@ flowchart TD
112
112
  - **A push into a branch that has an open PR is followed by rereading its body.** The statement
113
113
  about a green run names the tip by its sha, and moving the tip makes it false in silence: no check
114
114
  reads a PR body.
115
+ - **On remarks to a PR the person is asked whether to answer under them, and after a yes each one
116
+ gets an answer.** Edits alone leave the discussion silent, and the person reads the whole diff
117
+ again. The word holds for that PR, not for the next.
115
118
  - **The draft is lifted by a separate call — `glab mr update <номер> --ready`.** With it the
116
119
  executor answers for readiness: checks passed, no rework left, the work matches the task. Lifting
117
120
  the draft and asking to merge are one turn, not two days.
@@ -188,6 +191,18 @@ flowchart TD
188
191
  assembly with: the "set before push" section prints it whole, one command per line, and names
189
192
  beside it what the default printed and the set did not take. A tree writing its override blind
190
193
  added a repeat to it.
194
+ - **A push is sent only by the path the push guard stands on.** A terminal, a process or a script
195
+ started outside the session carries the same command past the gate, unless the tree wired the
196
+ git hook `pre-push`: then git runs the set there too. A send cut off by the session's end is
197
+ asked of the host and repeated by the same path.
198
+ - **A review of a foreign branch starts with the gate set run on its tip.** Reading the diff misses
199
+ what the set judges by the whole tree: a word, a file limit. A check that stands only on an edit,
200
+ such as the wording one, is run over the changed texts apart. The output goes into the review,
201
+ and a later push into that branch is run again.
202
+ - **Where neither the session's push guard nor the git hook fires, the set is run whole, as read
203
+ at the minute of the run.** It is read from the state review or from the tree profile together with the package
204
+ default it calls. A list from memory, from a copy made earlier or from the profile alone drops
205
+ checks: the profile names the set, the task names only the work.
191
206
  - **An exclusion reason naming a task is judged on whether that task is alive.** A deferral with a
192
207
  term and one without look the same until someone asks the number; a dead number in the reason
193
208
  makes the exclusion perpetual without saying a line about it. Asked by the same tier as the task
@@ -2,7 +2,7 @@
2
2
  name: mockups
3
3
  kind: rule
4
4
  law: mockups
5
- description: Rule under the mockups law. Load when a screen is drawn or changed in a design tool, before the first frame and before the mockups are shown to the owner. Names the kit copy, the spec read before drawing, the agreement checked against mockups. Pattern mockups-measure.
5
+ description: Rule under the mockups law. Load when a screen is drawn or changed in a design tool, before the mockups are shown to the owner and when a design file is audited. Names the kit copy, the spec read before drawing, the agreement checked against mockups. Pattern mockups-measure.
6
6
  ---
7
7
 
8
8
  # Mockups — how it works here
@@ -16,6 +16,7 @@ the code is written; here — what it is called in this tree, where it lives and
16
16
  | ----------------------------------- | ---------------------------------------------------------------------------- |
17
17
  | mockup | a frame on a sheet of the design tool |
18
18
  | the screen the mockup draws | the page or panel in the application that carries the same name |
19
+ | a sheet of the design file | a file page, never a page of the application |
19
20
  | the description of the behaviour | the domain spec in `docs/specs/<domain>/` |
20
21
  | the agreement | the product agreement of the task, `docs/specs/<domain>/proposed/<feature>/` |
21
22
  | approved | shown to the owner and accepted in their words |
@@ -38,7 +39,7 @@ flowchart TD
38
39
  B -->|No| D[A sample is asked per screen]
39
40
  C --> E{A component of the kit goes on the sheet}
40
41
  D --> E
41
- E -->|Yes| F[Its lines and spacing are checked against the kit styles in code]
42
+ E -->|Yes| F[It is measured in the running showcase and compared with the copy by numbers]
42
43
  E -->|No| G[The frames are drawn]
43
44
  F --> G
44
45
  G --> H[The coordinates of the frames are measured]
@@ -52,9 +53,11 @@ flowchart TD
52
53
  ## How the law applies here
53
54
 
54
55
  - **A kit component on a design-tool sheet is a copy of the kit, and the copy drifts.** The source
55
- of look is the kit's styles in code. Before a component from the sheet goes into a mockup, its
56
- visible lines and spacing are checked against the kit's styles. A divergence is a question to the
57
- owner, and the answer is fixed once in the copy.
56
+ of look is the kit's styles in code. Before a component from the sheet goes into a mockup, it is
57
+ measured in the running showcase, and its sizes, alignment and controls are compared with the
58
+ bounds of the copy's nodes by numbers. Reading the styles does not show what the layout computes:
59
+ the height of a row, where unselected items sit, a control that replaces an icon. A divergence is
60
+ a question to the owner, and the answer is fixed once in the copy.
58
61
  - **A mockup of behaviour the tree already has starts with reading the spec of its domain.** A
59
62
  screen in a design tool looks like work without code, so exploration stops at the sheet of earlier
60
63
  mockups. How a payment is taken, what a window asks and which fields a form holds are already
@@ -66,6 +69,11 @@ flowchart TD
66
69
  owner as a question. Found after the code, it costs a code edit and an agreement edit together.
67
70
  - **A mockup is measured by node coordinates before it is shown.** The technique is the pattern
68
71
  `mockups-measure`.
72
+ - **An audit of a design file is accepted only when every file page that draws a kit component is
73
+ captured, measured and compared with the code of that component.** Names, properties and the list
74
+ of variants say what a node is called, not what it draws: an arc drawn as a sector and a rounded
75
+ field drawn as a capsule keep correct names. The technique and the report are the pattern
76
+ `mockups-measure`.
69
77
  - **A design-tool call asks the rules gate for this rule,** like the browser driver does for its
70
78
  own: without that the measurement pattern stays unread for the whole mockup task.
71
79
 
@@ -116,6 +116,9 @@ flowchart TD
116
116
  when the tree has no such kind at all. A hardcoded value is refused by neither linter, build nor
117
117
  test: it is syntactically valid and simply does not belong to this tree — that is how a demo
118
118
  value from the vendor's documentation leaves for the production build.
119
+ - **A logo of a foreign service is taken, not drawn.** It is taken from the owner of the mark or
120
+ from an open icon set, in a mockup the same as in code. A drawn mark next to the service name
121
+ reads as that service's logo, and a person at the screen does not recognise it.
119
122
 
120
123
  ## What of the law is not here
121
124
 
@@ -32,7 +32,7 @@ with a guard does.
32
32
  | the epic plan | a record outside the task folder: the folder dies with the merge, the epic outlives it; the directory — in the rule's companion |
33
33
  | the task folder before the task is created | `docs/tasks/_draft-<slug>/` — outside history while there is no number |
34
34
  | exploration | an `Explore` or `general-purpose` session before the first question to the owner |
35
- | the plan review by roles | `.claude/workflows/plan.js` — need, agreement, critique, plan |
35
+ | the plan review by roles | `.claude/workflows/plan.js` — need, points, agreement, critique, plan, goal |
36
36
 
37
37
  ## Where it lives
38
38
 
@@ -207,7 +207,7 @@ flowchart TD
207
207
  A finding named by no exit condition goes to the section on what the work does not do, and is
208
208
  filed as a task.
209
209
  - **Done work is marked only in the progress.** "Where we stand" is rewritten by every session, not
210
- appended: it is the first thing the next session reads.
210
+ appended.
211
211
  - **The plan names the steps of every stage, and the progress mirrors them with a mark each.** The
212
212
  plan is not edited after it is written, the marks change every turn; a line nobody can call done
213
213
  is not a step.
@@ -227,11 +227,11 @@ flowchart TD
227
227
  whole or does not take it. Work outside an epic exists only by
228
228
  the owner's word about that work, said about that work.
229
229
  - **The epic branch is taken before the first task of the epic, not with it.** Taken later, it
230
- leaves the first task standing on the main branch.
230
+ leaves the first task on the main branch.
231
231
  - **The epic card moves to in progress by the same turn that takes its first task.** The owner
232
- follows the epic by one card: left where it was declared, the card reads as never started.
232
+ follows the epic by one card: left in place, it reads as never started.
233
233
  - **The next task is taken from the epic plan, and the queue list is asked only where there is no
234
- epic.** By a list of numbers someone else's epic cannot be told from one's own.
234
+ epic.** A list of numbers does not tell someone else's epic from one's own.
235
235
  - **Which epic this working copy leads is read from the table of assignments, and the owner writes
236
236
  it.** A card of the queue is not an order; a guard refuses every call that takes work until
237
237
  their word.
@@ -240,18 +240,23 @@ flowchart TD
240
240
  - **The tasks of an epic are created all at once, by the same turn as the epic itself.** Creating
241
241
  them one at a time hides the volume.
242
242
  - **A task of an epic is linked to the epic card as a sub-issue, not only named in the plan.** The
243
- board reads no text: without the link a task of an epic looks exactly like a task outside one.
244
- Closed tasks are linked too — the share of what is done counts them.
245
-
243
+ board reads no text: without the link it looks like a task outside one. Closed tasks are linked.
246
244
  - **The epic plan names how the branches of its tasks stand, on a par with their order.** Two
247
- arrangements: each branch from the epic branch, or a stack — each from the previous. The
248
- arrangement written in the plan is the epic's decision, not that of whoever creates the branch.
245
+ arrangements: each branch from the epic branch, or a stack — each from the previous. The written
246
+ arrangement binds whoever creates the branch.
247
+ - **The plan names the points: the epic its milestone, the task the change a person will see.** The
248
+ role `product-strategist` tries to prove the miss in planning and before the PR. A proved miss is
249
+ fixed or named to the owner; no pipeline stops. Every PR body carries the table of points.
250
+ - **Work is judged by the role `goal-critic` against the owner's words.** A plan is no evidence to
251
+ it, its reply is not edited, and the PR body carries its table.
252
+ - **A mission is set by the owner.** A session only proposes a wording from its analysis and waits
253
+ for approval.
249
254
  - **The PR of the epic opens when its last folder is taken apart, and not a task earlier.** A folder
250
- left in the epic branch reaches the main branch with it. Until then the epic branch is not
251
- offered to a person at all — the merge button on it means the whole epic.
252
- - **The epic plan lies where it is found without the network and after the merge.** The card does
253
- not hold the task order, and the task folder dies with the merge. What the owner names along the
254
- way is appended there by the turn that accepted it.
255
+ left in the epic branch reaches the main branch with it. Until then nobody is offered the epic
256
+ branch: its button means the whole epic.
257
+ - **The epic plan lies where it is found without the network and after the merge.** The card holds
258
+ no task order, and the folder dies with the merge. What the owner names along the way is appended
259
+ there by the turn that took it.
255
260
  - **Building by a sample begins with reading the sample itself, whole, by walking the directories.**
256
261
  - **What acts on the tree, not on the edit, lies outside the index.** The path to the sample and the
257
262
  permission to work outside the epic do not belong to the branch and live next to the handover. A
@@ -289,7 +294,7 @@ The guard judges by the edit paths, not by whether the work changes behaviour. A
289
294
  sign of its own: the appraisal "behaviour does not change" would be assigned by whoever it hinders.
290
295
 
291
296
  Nothing of the grill itself is checked: the guard sees a file edit and knows nothing of the
292
- exploration, the six questions or the answers. An empty table passes the same as a filled one.
297
+ exploration, the six questions or the answers.
293
298
 
294
299
  The conversation guard judges shared words between the question's topic and the owner's last
295
300
  message, not meaning; its refusal names the lawful move.
@@ -105,6 +105,11 @@ flowchart TD
105
105
  settings — contacts, sender address, keys of external services — the seed does not create
106
106
  either: they are entered in the application. What is needed rarely is switched on by a sign in
107
107
  the environment, not seeded for all.
108
+ - **An edit of a build step or of the pipeline is checked from scratch, and its PR waits for the run
109
+ on itself.** A cached build answers from what an earlier build left, and the edit looks green
110
+ while a clean runner fails on it. So the build runs twice past the cache with its output removed
111
+ between the runs, and its time is compared with the wait limit of whoever calls it. The request to
112
+ merge names the run on the PR itself: a fix of the pipeline merged unrun broke it a second time.
108
113
  - **A created check goes into the push gate or the pipeline, not only into the umbrella target.**
109
114
  The umbrella target is run by hand, and a check that lives only there answers whoever
110
115
  remembered it: such a check's silence reads as its green answer. Three checks stood outside the
@@ -13,6 +13,13 @@ stands `**Behaviour:** unchanged — <the owner's reason>`; an empty reason is n
13
13
  After it is written this file is not edited. A stage revision goes to `progress.md` as a decision
14
14
  along the way.
15
15
 
16
+ ## Points
17
+
18
+ - **A:** <where the product stands now>
19
+ - **This task reaches:** <the change a person will see>
20
+ - **Sign:** <the command, the page or the number that shows it, and who sees it>
21
+ - **Milestone G of the epic:** <the point named in the epic plan>
22
+
16
23
  ## Task footprint
17
24
 
18
25
  <What the work touches. Filled in by the exploration before the grill and confirmed by the owner.
@@ -0,0 +1,142 @@
1
+ ---
2
+ name: interface-review-annotate
3
+ description: Puts the findings of an interface review on a Figma canvas as cards beside the frame: card anatomy, the Plugin API build sequence, placement, connectors. Load when a reviewed Figma frame is to be annotated. The review itself is in interface-review.
4
+ ---
5
+
6
+ # Annotate the frame
7
+
8
+ ## When to use
9
+
10
+ - An interface review by `interface-review` ran on a Figma frame, and its findings table is ready.
11
+ - The annotations of an earlier review are to be replaced after a re-run.
12
+
13
+ Every row in the findings table also lands on the canvas as a card. Cards go on one top-level layer
14
+ named `Interface review`, in the empty space to the left and right of the frame — never on top of
15
+ the design, and never overlapping the frame's own titles or chrome.
16
+
17
+ Never reparent, edit, lock, or restyle the frames under review. Annotations are additive; the review
18
+ is otherwise read-only.
19
+
20
+ ## Card anatomy
21
+
22
+ Each card is a vertical auto-layout frame: `280px` fixed width, height hugging its contents, `12px`
23
+ padding, `8px` item spacing, `8px` corner radius, `oklch(1 0 0)` fill, `1px` `oklch(0 0 0 / 0.08)`
24
+ stroke.
25
+
26
+ Three stacked children, in order:
27
+
28
+ 1. **Severity pill** — hug-width rounded rect, `4px` radius, `2px` vertical and `6px` horizontal
29
+ padding, filled with the severity color below. Label is the severity word in uppercase, `9px`,
30
+ weight `600`, `0.04em` letter-spacing.
31
+ 2. **Title** — `#4 CTA contrast`. The finding number, then a three-to-five-word summary. `12px`,
32
+ weight `600`, `oklch(0.15 0 0)`.
33
+ 3. **Body** — one or two sentences: what is wrong, then what to do. `11px`, weight `400`,
34
+ line-height `1.4`, `oklch(0.45 0 0)`. Cap at `240` characters; the full reasoning stays in the
35
+ findings table.
36
+
37
+ | Severity | Pill fill | Pill text |
38
+ | --- | --- | --- |
39
+ | `HIGH` | `oklch(0.577 0.245 27.325)` red | `oklch(1 0 0)` white |
40
+ | `MEDIUM` | `oklch(0.705 0.213 47.604)` orange | `oklch(0.15 0 0)` near-black |
41
+ | `LOW` | `oklch(0.852 0.199 91.936)` yellow | `oklch(0.15 0 0)` near-black |
42
+
43
+ White on orange and yellow measures below 4.5:1; use the near-black. The pill names the severity in
44
+ words, so color never carries it alone and no separate legend is needed.
45
+
46
+ ## Building the card
47
+
48
+ Hug sizing is not the default, and children only participate in auto-layout once appended. Follow
49
+ this sequence exactly:
50
+
51
+ ```js
52
+ await figma.loadFontAsync({ family: "Inter", style: "Semi Bold" });
53
+ await figma.loadFontAsync({ family: "Inter", style: "Regular" });
54
+
55
+ const card = figma.createFrame();
56
+ card.layoutMode = "VERTICAL"; // must come before any sizing property
57
+ card.primaryAxisSizingMode = "AUTO"; // hug height
58
+ card.counterAxisSizingMode = "FIXED"; // fixed width
59
+ card.resize(280, card.height);
60
+ card.verticalPadding = 12;
61
+ card.horizontalPadding = 12;
62
+ card.itemSpacing = 8;
63
+
64
+ // Children must be appended to the card. Creating a node and setting its
65
+ // x/y puts it on the canvas as a sibling: the card then hugs to nothing
66
+ // and its contents float outside the frame.
67
+ card.appendChild(pill);
68
+ card.appendChild(title);
69
+ card.appendChild(body);
70
+
71
+ // Text wraps to the card width and grows downward
72
+ for (const text of [title, body]) {
73
+ text.layoutAlign = "STRETCH";
74
+ text.textAutoResize = "HEIGHT";
75
+ }
76
+
77
+ // The pill hugs its own label instead of stretching
78
+ pill.layoutMode = "HORIZONTAL";
79
+ pill.primaryAxisSizingMode = "AUTO";
80
+ pill.counterAxisSizingMode = "AUTO";
81
+ pill.layoutAlign = "INHERIT";
82
+ pillLabel.textAutoResize = "WIDTH_AND_HEIGHT";
83
+
84
+ // x and y are ignored on auto-layout children. Position the card only.
85
+ card.x = gutterX;
86
+ card.y = stackY;
87
+ ```
88
+
89
+ Load every font with `figma.loadFontAsync` before setting `characters`. Text set with an unloaded
90
+ font measures at zero, so the card hugs to nothing.
91
+
92
+ Gate on the result before positioning anything else:
93
+
94
+ ```js
95
+ if (card.children.length !== 3 || card.height < 56) {
96
+ throw new Error(
97
+ `Finding ${n}: card built empty — ${card.children.length} children, ${card.height}px tall`
98
+ );
99
+ }
100
+ ```
101
+
102
+ A correctly built card is at least `56px` tall. Anything near `26px` is padding with no content in
103
+ between.
104
+
105
+ | Symptom | Cause |
106
+ | --- | --- |
107
+ | Card hugs to ~`26px` with contents floating outside it | Children created but never `appendChild`ed to the card |
108
+ | Every card is the same height | `primaryAxisSizingMode` left at `FIXED` |
109
+ | Card is as wide as its longest line | `counterAxisSizingMode` left at `AUTO` |
110
+ | Body text runs off the card on one line | Text missing `layoutAlign = "STRETCH"` and `textAutoResize = "HEIGHT"` |
111
+ | Pill spans the full card width | Pill missing `AUTO` sizing on both axes |
112
+ | Children ignore the positions you set | Expected — auto-layout owns child position; set `x`/`y` on the card only |
113
+
114
+ ## Placement
115
+
116
+ Cards sit in two gutters: one starting `80px` to the left of the frame, one `80px` to the right.
117
+ Assign each card to the gutter nearer its target node, then within a gutter sort by the target's
118
+ vertical position and stack top to bottom with `16px` between cards. If a stack would run past the
119
+ frame's bottom edge, move the overflow to the other gutter rather than shrinking cards or letting
120
+ them overlap.
121
+
122
+ Position cards only after all children are appended and sized; a card's final height is not known
123
+ until then.
124
+
125
+ Draw a `1.5px` dashed connector from the card's inner edge to the target node's nearest edge,
126
+ stroked in that finding's severity color, routed as a single elbow: horizontal out of the card, then
127
+ horizontal into the node. End it with a `4px` dot on the node, not an arrowhead. A finding that spans
128
+ the whole flow gets no connector.
129
+
130
+ Card and connector for one finding are grouped together and named `#4 MEDIUM Layout`.
131
+
132
+ ## Scale
133
+
134
+ The values above assume a frame between `1000px` and `1600px` wide. Outside that range, multiply
135
+ every annotation dimension and type size by `frameWidth / 1400` so cards stay readable at the zoom
136
+ level where the whole frame fits on screen.
137
+
138
+ ## Re-running
139
+
140
+ Delete the existing `Interface review` layer before drawing the new one. Annotations replace; they
141
+ never stack. If the file is view-only or the user asked for the report only, output the table alone
142
+ and say the frame was not annotated.
@@ -0,0 +1,136 @@
1
+ ---
2
+ name: interface-review-icons
3
+ description: Icon recipes for an interface review: stroke matched to text weight, one SVG recolored per state, outline by default and fill when active, render size, RTL mirroring. Load when an icon finding is worded or fixed. Icon swaps are in interface-review-motion-states.
4
+ ---
5
+
6
+ # Icons
7
+
8
+ Icon weight, states, sizing, and direction: the details that make icons sit naturally in an
9
+ interface.
10
+
11
+ ## When to use
12
+
13
+ - A finding of `interface-review` is about an icon that looks too heavy or too thin, separate icon
14
+ assets per state, filled icons everywhere, an icon that blurs at small size, or an arrow that
15
+ points the wrong way in RTL.
16
+
17
+ ## Match Icon Stroke to Text Weight
18
+
19
+ An icon next to text should carry the same optical weight as the text, or the pair looks mismatched:
20
+ a hairline icon beside semibold text reads as broken, a heavy icon beside regular text shouts.
21
+
22
+ | Adjacent text | Icon stroke width (24px grid) |
23
+ | --- | --- |
24
+ | Regular (400), 14–16px | `1.5px` |
25
+ | Medium/Semibold (500–600) | `2px` |
26
+ | Bold (700), or emphasized standalone | `2.5px` |
27
+
28
+ ```html
29
+ <!-- Good: stroke tuned to the label weight -->
30
+ <button class="flex items-center gap-2 font-semibold">
31
+ <PlusIcon stroke-width="2" class="size-4" />
32
+ New project
33
+ </button>
34
+
35
+ <!-- Bad: default 1.5px stroke against a bold label -->
36
+ <button class="flex items-center gap-2 font-bold">
37
+ <PlusIcon stroke-width="1.5" class="size-4" />
38
+ New project
39
+ </button>
40
+ ```
41
+
42
+ Two related consistency rules:
43
+
44
+ - **One optical strategy per surface.** Do not mix icon libraries with incompatible stroke
45
+ conventions on one toolbar. If the chosen library intentionally supports stroke variants, match
46
+ them to adjacent text as above; otherwise preserve the set's native stroke and use size or color
47
+ for emphasis.
48
+ - **Size icons relative to the text's cap height**, typically `1em`–`1.25em` when inline with text,
49
+ so the pair scales together.
50
+
51
+ ## One SVG, Recolored per State
52
+
53
+ Never ship separate icon assets for default/hover/selected/disabled states. Use a single SVG drawn
54
+ with `currentColor` and let CSS state drive the color:
55
+
56
+ ```html
57
+ <!-- Good: one asset, states are CSS -->
58
+ <svg fill="none" stroke="currentColor" stroke-width="2">…</svg>
59
+ ```
60
+
61
+ ```css
62
+ .icon-button { color: oklch(0.552 0.016 285.938); }
63
+ .icon-button:hover { color: oklch(0.21 0.006 285.885); }
64
+ .icon-button[aria-pressed="true"] { color: oklch(0.623 0.188 259.815); }
65
+ .icon-button:disabled { opacity: 0.4; }
66
+ ```
67
+
68
+ ```html
69
+ <!-- Tailwind -->
70
+ <button class="text-zinc-500 hover:text-zinc-900 aria-pressed:text-blue-600 disabled:opacity-40">
71
+ <BookmarkIcon />
72
+ </button>
73
+ ```
74
+
75
+ Hardcoded fills inside the SVG (`fill="#666"`) break this; strip them to `currentColor` when
76
+ importing icons.
77
+
78
+ ## Outline Default, Fill Active
79
+
80
+ When an icon set offers outline and filled variants, use them as a state pair, not interchangeably:
81
+
82
+ | Variant | Use for |
83
+ | --- | --- |
84
+ | Outline | Default state: toolbars, list rows, inline with text |
85
+ | Fill | Selected/active state: the active tab, a toggled bookmark, a liked heart |
86
+
87
+ ```tsx
88
+ // Good: variant communicates state
89
+ <TabIcon variant={isActive ? "solid" : "outline"} />
90
+
91
+ // Bad: filled icons everywhere, so the active tab has no state signal
92
+ <TabIcon variant="solid" />
93
+ ```
94
+
95
+ The swap between variants is a contextual icon animation; use the exact cross-fade values in
96
+ `interface-review-motion-states`.
97
+
98
+ ## Design at Render Size
99
+
100
+ An icon that looks great at 48px can collapse into mush at 16px. Details that read at large sizes
101
+ (thin interior lines, tight counters, fine texture) blur or alias when small.
102
+
103
+ - Test every icon at the smallest size it will render (often `16px`); it must stay recognizable
104
+ there.
105
+ - Prefer simplified glyphs for small contexts over scaling down detailed artwork.
106
+ - Keep icons on the pixel grid at their render size: a 16px icon drawn on a 24px grid with
107
+ fractional scaling renders soft. Use the icon set's native grid sizes (`16`, `20`, `24`) rather
108
+ than arbitrary scales.
109
+ - Always SVG, never raster, so the same asset stays crisp at every density.
110
+
111
+ ## Icons in RTL
112
+
113
+ Under `dir="rtl"`, flip icons whose meaning is tied to reading direction, and leave the rest alone:
114
+
115
+ | Flip | Don't flip |
116
+ | --- | --- |
117
+ | Back/forward arrows, chevrons in navigation | Logos and brand marks |
118
+ | Text-block glyphs (alignment, lists, indent) | Checkmarks |
119
+ | Speaker/volume waves (emanate in reading direction) | Physical objects: clocks, cups, pencils |
120
+ | "Send" style directional glyphs | Media playback (play/rewind refer to tape direction, convention keeps them LTR) |
121
+
122
+ ```css
123
+ /* Good: mirror only direction-dependent icons */
124
+ [dir="rtl"] .icon-directional {
125
+ scale: -1 1;
126
+ }
127
+ ```
128
+
129
+ ```html
130
+ <!-- Tailwind -->
131
+ <ChevronRightIcon class="icon-directional rtl:-scale-x-100" />
132
+ ```
133
+
134
+ Analyze composite icons part by part: a badge or slash overlay may keep its position even when the
135
+ base glyph flips. Accessible names for icon-only buttons are covered by the accessibility principles
136
+ in `interface-review-principles`.