figura-cli 0.10.1 → 0.11.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "figura-cli",
3
- "version": "0.10.1",
3
+ "version": "0.11.0",
4
4
  "description": "Command-line client for the Figura visualization SaaS",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -24,19 +24,51 @@ from your brand. To change the brand, use the `figura-brand` skill, not this one
24
24
  - Before any visual / layout / state change — a wrong fig costs seconds; a wrong
25
25
  build costs a recompile-and-screenshot loop.
26
26
 
27
+ ## Existing-first — never mock a redesign blind
28
+
29
+ **Before building, find out whether this screen already exists.** A fig that
30
+ proposes a redesign without showing what it replaces is how you "improve"
31
+ something in a vacuum — and end up rebuilding what already ships. So every time,
32
+ *first*:
33
+
34
+ - **Search the codebase** for the screen/flow you're about to mock — Grep/Glob for
35
+ the route, component, or page (an `onboarding/`, `settings/brand/` dir, a
36
+ matching route). If a real implementation exists, **Read it** and treat it as the
37
+ baseline you must show.
38
+ - **Check the team's figs** — `figura fig list --area <area>` (or
39
+ `figura_list_figs`). If a fig of this screen already exists, **`fig revise` it**
40
+ (a new version in the same chain), never a fresh duplicate.
41
+
42
+ If any prior design exists → build in **`mode: compare`** and render it as
43
+ **existing (as-is) → proposed**, grounded in the real current state. Even when the
44
+ proposal is better, it must be argued against what's there — that's the whole
45
+ point. Only build a standalone `single` fig when the screen is genuinely net-new.
46
+ Unsure whether a version already exists? **Ask the user** rather than assume
47
+ greenfield.
48
+
27
49
  ## How to fig
28
50
 
29
- 1. **Check auth** — call **`figura_whoami`** to confirm you're connected to a
30
- team. Not connected? Tell the user to run `figura login`, or add the MCP:
31
- `claude mcp add figura -- figura mcp`. (Creating / publishing figs needs the
32
- `figs:write` scope on the team a read-only token passes whoami but fails the
33
- land step.)
51
+ 1. **Verify the destination team** — call **`figura_whoami`** (or
52
+ `figura whoami --json`) and check BOTH halves before generating anything:
53
+ - **Connected?** Not connected tell the user to run `figura link` (or
54
+ `figura login`), or add the MCP: `claude mcp add figura -- figura mcp`.
55
+ (Creating / publishing figs needs the `figs:write` scope on the team — a
56
+ read-only token passes whoami but fails the land step.)
57
+ - **Bound to THIS project?** Read `binding.source` in the response. `project`
58
+ (or an explicit `env` token) → proceed, and say where the fig will land
59
+ ("figging to team *slug*"). **`global` → STOP before generating**: nothing
60
+ pins this repo to that team — the fig would land on whatever team this
61
+ machine last logged into (this is exactly how mocks have ended up on the
62
+ wrong tenant). Tell the user to run `figura link` in this repo, then
63
+ re-verify. If the response has no `binding` field (older CLI/MCP), confirm
64
+ the team slug matches this project with the user before proceeding.
34
65
 
35
66
  2. **Default — build it yourself, with YOUR Claude.** Fetch the team's design
36
67
  system — `bunx figura-cli brand --json` — and hand-build the fig's HTML against
37
68
  it, then land it with **`figura_create_fig`** (`publish: true`), setting
38
69
  `area`, `orientation` (`portrait` / `landscape` / `both`), `mode` (`single` /
39
- `compare` / `variations`), `title`, and a real description. This uses the
70
+ `compare` / `variations` default to `compare` when Existing-first turned up a
71
+ baseline), `title`, and a real description. This uses the
40
72
  caller's own Claude (the model running this skill) — no extra cost, full control
41
73
  for precise broken-vs-proposed diptychs — and applies the team's brand from the
42
74
  fetched design system. **Follow that design system verbatim; never invent brand
@@ -52,6 +84,42 @@ from your brand. To change the brand, use the `figura-brand` skill, not this one
52
84
 
53
85
  4. **Review** the returned link, share it, move on.
54
86
 
87
+ ## Presenting a redesign — overview ⇄ focus
88
+
89
+ When a fig argues a change against a current state (a shipped baseline, or
90
+ several candidate directions), build one fig with **two switchable views** —
91
+ CSS-only radio tabs, since figs carry no `<script>`:
92
+
93
+ - **Overview — side by side.** Every state at once: the honest current state
94
+ first, then each variation, as scaled-down frames in a grid. Under each: a
95
+ status chip and ONE condensed context line (`+ / –`). This view is for
96
+ scanning and picking a direction, not for reading detail. The grid must
97
+ wrap to one column before it can overflow — **a fig never scrolls
98
+ horizontally**, at any viewport.
99
+ - **Focus — full frame.** One state at a time behind state pills (Today / A /
100
+ B / …), each state framed identically so flipping states in place reads as
101
+ spot-the-difference. This is where the context lives, pinned on the frame
102
+ as annotation chips: what's broken today, what each variation improves,
103
+ what it trades away.
104
+ - **In both views:** render the current state honestly from the shipped
105
+ implementation; color-code chips by function (broken / improved /
106
+ trade-off / detail) using the team's status colors from the fetched design
107
+ system; mark the recommended variation and close with a short "my read"
108
+ arguing the pick against the others. Keep the chrome around the frames
109
+ minimal — the frames are the content; no legends (chips label themselves),
110
+ no repeated context, fluid `max-width` layout throughout.
111
+ - **Verify before publishing.** Render the fig headless at a few viewport
112
+ widths: `document.scrollWidth` must equal the viewport in every view and
113
+ state (sideways scroll = broken — beware CSS `zoom`, which leaks unzoomed
114
+ width into scrollable overflow; scale minis with `transform` in
115
+ fixed-aspect wrappers instead), and screenshot each state to check no
116
+ annotation chip covers the content it annotates.
117
+
118
+ A **wipe-slider** stays the narrow tool for exactly two states of the same
119
+ layout with pixel-level tweaks. Never ship a squeezed side-by-side as the
120
+ *only* view of desktop frames, and never a full-frame toggle as the only
121
+ view of many variations — each is one half of the pair above.
122
+
55
123
  ## Notes
56
124
 
57
125
  - **MCP unavailable** (headless / cron, or no interactive auth): fall back to the
@@ -17,15 +17,21 @@ directory). Default to the current repo.
17
17
 
18
18
  ## Prerequisites
19
19
 
20
- The user needs the `figura` CLI authenticated once (`figura login`) the brand is
20
+ The user needs this repo linked to its Figura team (`figura link`; a global
21
+ `figura login` also works but is only a machine-wide fallback) — the brand is
21
22
  written to the team that token belongs to. If a `figura` **MCP server** is
22
23
  connected, prefer its `figura_set_brand` tool over the CLI. If neither the CLI nor
23
24
  `bunx figura-cli` is available, tell the user to install it
24
25
  (`curl -fsSL https://figura.so/install.sh | bash`) and stop.
25
26
 
26
- Confirm the target team first: `figura whoami` (or the `figura_whoami` tool). The
27
- brand is **team-wide and overwrites** the current one never push without showing
28
- the user what you're about to set and getting an explicit OK.
27
+ Verify the destination team first: `figura whoami --json` (or the `figura_whoami`
28
+ tool) and check `binding.source`. `project` (or an explicit `env` token) name
29
+ the team out loud and continue. **`global` STOP**: nothing pins this repo to
30
+ that team — you could read *another product's* brand as the baseline and
31
+ overwrite *their* profile with this repo's. Tell the user to run `figura link`
32
+ here first. The brand is **team-wide and overwrites** the current one — never
33
+ push without showing the user what you're about to set and getting an explicit
34
+ OK.
29
35
 
30
36
  ## Workflow
31
37