figura-cli 0.16.0 → 0.16.1
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/dist/index.js +119 -118
- package/package.json +1 -1
- package/skills/fig/SKILL.md +68 -6
package/package.json
CHANGED
package/skills/fig/SKILL.md
CHANGED
|
@@ -47,6 +47,44 @@ point. Only build a standalone `single` fig when the screen is genuinely net-new
|
|
|
47
47
|
Unsure whether a version already exists? **Ask the user** rather than assume
|
|
48
48
|
greenfield.
|
|
49
49
|
|
|
50
|
+
### Reconstruct the baseline from SOURCE — required, no screenshot
|
|
51
|
+
|
|
52
|
+
The existing/current/broken frame of a `compare` fig must be a **faithful
|
|
53
|
+
recreation of what actually ships**, not a hand-approximation — an approximated
|
|
54
|
+
"before" quietly rebuilds a strawman and the diptych argues against a screen that
|
|
55
|
+
doesn't exist. So when you build the baseline state and **no screenshot is
|
|
56
|
+
provided**, studying the source and rebuilding its layout is a **REQUIRED step**,
|
|
57
|
+
not optional reading:
|
|
58
|
+
|
|
59
|
+
1. **Locate the screen** — Grep/Glob for the route dir, the `page`/`route`
|
|
60
|
+
file, and the component(s) it renders (e.g. `apps/*/src/app/<route>/page.tsx`
|
|
61
|
+
plus imported views).
|
|
62
|
+
2. **Read the component file(s)** and extract the real structure:
|
|
63
|
+
- the **JSX/TSX element hierarchy and order** (containers → sections →
|
|
64
|
+
controls, top to bottom);
|
|
65
|
+
- the **class names / style modules / design tokens** on each element
|
|
66
|
+
(`flex`/`grid`, spacing, radii, colors) — these are the layout;
|
|
67
|
+
- the **imported UI primitives** (`Button`, `Input`, `Card`, …) and *their*
|
|
68
|
+
rendered shape (a `variant="cta"` white pill vs an `outline` button is a
|
|
69
|
+
visible difference — open the primitive if unsure);
|
|
70
|
+
- **conditional branches** — auth-provider variants, stages, empty/error/
|
|
71
|
+
loading states — and decide which branch the baseline depicts (state it);
|
|
72
|
+
- the **real copy and labels** (headings, placeholders, button text, error
|
|
73
|
+
banners) verbatim, not paraphrased.
|
|
74
|
+
3. **Rebuild that layout as the baseline** — real element hierarchy, real
|
|
75
|
+
controls, real copy, real spacing — so the "before" frame matches the shipped
|
|
76
|
+
screen line-for-line, then drift only the *proposed* frame.
|
|
77
|
+
4. **Fallback (only if the source genuinely can't be located/read):**
|
|
78
|
+
approximate, and **caption the baseline as an approximation** (a chip / note on
|
|
79
|
+
the frame: "approximated — source not found") so no one mistakes a guess for
|
|
80
|
+
the shipped UI.
|
|
81
|
+
|
|
82
|
+
This is what "grounded in the real current state" above means: the baseline is
|
|
83
|
+
**source-faithful by reconstruction**, or it is explicitly labelled a guess —
|
|
84
|
+
never a silent approximation. It applies to **both** the hand-build path and the
|
|
85
|
+
server render below — on a server render you can't read the repo *for* the engine,
|
|
86
|
+
so you hand it the studied structure in the brief (see step 3, "Server render").
|
|
87
|
+
|
|
50
88
|
## How to fig
|
|
51
89
|
|
|
52
90
|
1. **Verify the destination team** — call **`figura_whoami`** (or
|
|
@@ -110,6 +148,19 @@ greenfield.
|
|
|
110
148
|
on brand). Never pick this path on your own to save effort: it costs credits
|
|
111
149
|
and hand-built figs track the brand better.
|
|
112
150
|
|
|
151
|
+
**The engine CANNOT read your repo — carry the studied baseline in the brief.**
|
|
152
|
+
`figura_generate_fig` runs server-side against the team brand; it has no access
|
|
153
|
+
to the caller's filesystem, so for a `compare`/existing state it would otherwise
|
|
154
|
+
*guess* the "before" too. Close the seam yourself: do the source study from
|
|
155
|
+
"Reconstruct the baseline from SOURCE" above **first**, then pass the
|
|
156
|
+
reconstructed structure into the `prompt` brief as an explicit "before" spec —
|
|
157
|
+
the file you grounded it in, the element order top-to-bottom, the real controls
|
|
158
|
+
and primitive shapes, the branch depicted, and the verbatim copy/labels. The
|
|
159
|
+
`prompt` is free NL text, so this needs no extra parameter — the studied layout
|
|
160
|
+
just becomes the baseline half of the brief (the proposed half describes the
|
|
161
|
+
change). If you truly couldn't locate the source, say so in the brief and label
|
|
162
|
+
the baseline an approximation, same as the hand-build fallback.
|
|
163
|
+
|
|
113
164
|
4. **Open the HOSTED fig for approval — never a local file.** Run
|
|
114
165
|
`figura fig open <id>` (the id `figura_create_fig`/`figura_generate_fig` just
|
|
115
166
|
returned). It opens **`viewUrl`** in the reviewer's browser — the actual
|
|
@@ -173,7 +224,9 @@ truncation, and doesn't need a library):
|
|
|
173
224
|
as annotation chips: what's broken today, what each variation improves,
|
|
174
225
|
what it trades away.
|
|
175
226
|
- **In both views:** render the current state honestly from the shipped
|
|
176
|
-
implementation
|
|
227
|
+
implementation — **reconstructed from source** per "Reconstruct the baseline
|
|
228
|
+
from SOURCE" (no screenshot ⇒ study the component file(s) and rebuild the real
|
|
229
|
+
layout, don't approximate); color-code chips by function (broken / improved /
|
|
177
230
|
trade-off / detail) using the team's status colors from the fetched design
|
|
178
231
|
system; mark the recommended variation and close with a short "my read"
|
|
179
232
|
arguing the pick against the others. Keep the chrome around the frames
|
|
@@ -255,11 +308,20 @@ with two things you do **not** hand-write:
|
|
|
255
308
|
|
|
256
309
|
So when you **hand-build** a fig (the default path), do your part of the contract:
|
|
257
310
|
|
|
258
|
-
- **
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
311
|
+
- **Bare mobile screen — and ONLY then:** when the fig's HTML *is* one raw app
|
|
312
|
+
screen (no masthead, no state pills, no hand-drawn `.fig-device` frames — the
|
|
313
|
+
Figura viewer draws the iPhone shell around it), size the body to the exact
|
|
314
|
+
logical screen and emit `<meta name="figura:artboard" content="WxH">` matching
|
|
315
|
+
it (iPhone portrait `393x852` / landscape `852x393`). For OS-chrome insets
|
|
316
|
+
prefer `var(--fig-safe-top, 59px)` / `.fig-safe-top` over hardcoded pixels —
|
|
317
|
+
the stamp fills the value, the fallback keeps you correct if the kit is absent.
|
|
318
|
+
- **A document-style fig NEVER gets an artboard.** The artboard meta is the
|
|
319
|
+
viewer's opt-in signal for "size me to exactly WxH and wrap me in a device
|
|
320
|
+
shell" — stamped on an overview ⇄ focus redesign page (or any compare /
|
|
321
|
+
variations document with its own masthead, pills, or hand-drawn device
|
|
322
|
+
frames), it crams the whole document into a phone frame. A document fig
|
|
323
|
+
renders full-page precisely because it carries NO artboard meta, even when
|
|
324
|
+
every screen it depicts is a mobile app.
|
|
263
325
|
- **Always:** emit `<meta name="figura:context" content="...">` (design intent).
|
|
264
326
|
- **Optional but valued:** if the fig grounds a specific feature or flag, emit
|
|
265
327
|
`<meta name="figura:feature" content="<flag-or-slug>">` so it links back to the
|