@pro-vi/designer 0.3.0 → 0.3.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/README.md +71 -145
- package/package.json +3 -2
- package/scripts/postinstall.mjs +4 -0
- package/skills/designer-loop/SKILL.md +5 -3
package/README.md
CHANGED
|
@@ -1,106 +1,81 @@
|
|
|
1
1
|
# designer
|
|
2
2
|
|
|
3
|
-
MCP + CLI
|
|
3
|
+
MCP + CLI that lets your coding agent drive **[claude.ai/design](https://claude.ai/design)** (Claude's wireframe + hi-fi design tool, no API) with full context of your codebase — capabilities, data shape, existing tokens fed into every prompt.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Human describes intent → agent surveys codebase and prompts Claude Design → hands you the URL → iterate → `designer_handoff` bundles the result (README + chats + HTML + JSX) back into your repo.
|
|
6
|
+
|
|
7
|
+
> **Status:** v0.3.0, early. macOS only.
|
|
6
8
|
|
|
7
9
|
## Stance
|
|
8
10
|
|
|
9
|
-
- **Single-vendor, single-purpose.** Only `claude.ai/design`.
|
|
10
|
-
-
|
|
11
|
-
- **
|
|
12
|
-
- **URL is the default taste path.** `designer_prompt` returns a live claude.ai/design URL
|
|
13
|
-
- **Artifacts land on disk.** Every iteration +
|
|
11
|
+
- **Single-vendor, single-purpose.** Only `claude.ai/design`.
|
|
12
|
+
- **Real Chrome via CDP.** Sidesteps Cloudflare + Google SSO.
|
|
13
|
+
- **Capabilities drive design.** Agent surveys the codebase (entities, operations, states, tokens) and feeds them into every prompt. Intent tells Claude Design *how*; the codebase tells it *what*. See the [designer-loop skill](skills/designer-loop/SKILL.md).
|
|
14
|
+
- **URL is the default taste path.** `designer_prompt` returns a live claude.ai/design URL with working tweak sliders and variant switcher.
|
|
15
|
+
- **Artifacts land on disk.** Every iteration + handoff saves under `./artifacts/{key}/`.
|
|
14
16
|
|
|
15
17
|
## Install
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
git clone https://github.com/pro-vi/designer.git && cd designer
|
|
21
|
-
npm install
|
|
22
|
-
./bin/designer setup
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
Optional — make `designer` available globally:
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npm link
|
|
29
|
-
designer setup # now works from any cwd
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
`designer setup` is idempotent and auto-progresses:
|
|
19
|
+
### Prerequisites
|
|
33
20
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
3. Asks you to Cmd+Q Chrome if a non-debug Chrome is running (polls until quit).
|
|
37
|
-
4. Launches a dedicated debug Chrome (`--remote-debugging-port=9222`, profile at `~/.chrome-designer-profile/`).
|
|
38
|
-
5. Polls until you sign in to Claude and reach `/design`.
|
|
39
|
-
6. Installs the `designer-loop` skill at `~/.claude/skills/designer-loop/` unless one is already present (respects bootstrap/dotfiles-managed symlinks).
|
|
40
|
-
7. Registers the MCP with Claude Code at user scope.
|
|
21
|
+
- macOS, Node 20+, Google Chrome at `/Applications/Google Chrome.app`.
|
|
22
|
+
- `agent-browser` on PATH: `npm i -g agent-browser` (or `brew install agent-browser`).
|
|
41
23
|
|
|
42
|
-
|
|
24
|
+
### Three paths
|
|
43
25
|
|
|
44
|
-
|
|
26
|
+
All land at `designer setup`.
|
|
45
27
|
|
|
46
|
-
|
|
28
|
+
```bash
|
|
29
|
+
# A. Trial — no install
|
|
30
|
+
npx -y @pro-vi/designer setup
|
|
47
31
|
|
|
48
|
-
|
|
32
|
+
# B. Daily use
|
|
33
|
+
npm i -g @pro-vi/designer && designer setup
|
|
49
34
|
|
|
50
|
-
|
|
35
|
+
# C. Hacking on it
|
|
36
|
+
git clone https://github.com/pro-vi/designer.git && cd designer
|
|
37
|
+
npm install && ./bin/designer setup
|
|
38
|
+
```
|
|
51
39
|
|
|
52
|
-
###
|
|
40
|
+
### What `designer setup` does
|
|
53
41
|
|
|
54
|
-
|
|
42
|
+
1. Verify deps (lockfile-hash compare).
|
|
43
|
+
2. Check `agent-browser` on PATH.
|
|
44
|
+
3. Ask you to quit a non-debug Chrome (polls until done).
|
|
45
|
+
4. Launch debug Chrome (`--remote-debugging-port=9222`, profile at `~/.chrome-designer-profile/`).
|
|
46
|
+
5. Poll until you sign in and land on `/design`.
|
|
47
|
+
6. Install the `designer-loop` skill at `~/.claude/skills/designer-loop/` (skipped if already present — respects dotfile symlinks).
|
|
48
|
+
7. Register the MCP with Claude Code (user scope).
|
|
55
49
|
|
|
56
|
-
|
|
50
|
+
Re-run anytime — idempotent. Verify with `designer doctor`.
|
|
57
51
|
|
|
58
|
-
|
|
52
|
+
### MCP only (skip the CLI)
|
|
59
53
|
|
|
60
54
|
```bash
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
curl -s http://127.0.0.1:9222/json/version | head # verify CDP
|
|
64
|
-
export DESIGNER_CDP=9222 # only needed for direct CLI use
|
|
65
|
-
claude mcp add --transport stdio designer \
|
|
66
|
-
-- env DESIGNER_CDP=9222 "$PWD/bin/designer" mcp serve
|
|
55
|
+
claude mcp add --scope user --transport stdio designer \
|
|
56
|
+
-- env DESIGNER_CDP=9222 npx -y @pro-vi/designer mcp serve
|
|
67
57
|
```
|
|
68
58
|
|
|
69
|
-
|
|
59
|
+
Still needs debug Chrome running (`npx -y @pro-vi/designer setup` handles it).
|
|
70
60
|
|
|
71
|
-
|
|
61
|
+
### Notes
|
|
72
62
|
|
|
73
|
-
|
|
74
|
-
|
|
63
|
+
- **Dedicated profile.** Chrome 136+ blocks `--remote-debugging-port` on the default profile. Login to `~/.chrome-designer-profile/` persists.
|
|
64
|
+
- **Auto-launch.** MCP auto-launches debug Chrome on the first tool call if the profile exists.
|
|
65
|
+
- **Bot detection.** Real Chrome + user-controlled login — not headless. Cloudflare + Google OAuth see a normal session. First login may trigger a Google new-device prompt.
|
|
66
|
+
- **`DESIGNER_CDP=9222`** is embedded in the MCP registration. Only export it in your shell if you invoke the CLI directly.
|
|
75
67
|
|
|
76
|
-
|
|
68
|
+
## CLI
|
|
77
69
|
|
|
78
|
-
Typical loop:
|
|
79
|
-
designer setup (once per machine)
|
|
80
|
-
designer session --action create --name "X" --key x start a project
|
|
81
|
-
designer prompt "design the …" --key x prints 'Taste here: <url>' ← open that
|
|
82
|
-
designer prompt - --key x < follow-up.txt iterate until human says yes
|
|
83
|
-
designer handoff --key x bundle for code implementation
|
|
84
70
|
```
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
designer
|
|
90
|
-
designer help handoff # same
|
|
71
|
+
designer setup (once per machine)
|
|
72
|
+
designer session --action create --name "X" --key x start a project
|
|
73
|
+
designer prompt "design the …" --key x prints 'Taste here: <url>'
|
|
74
|
+
designer prompt - --key x < follow-up.txt iterate
|
|
75
|
+
designer handoff --key x bundle for code implementation
|
|
91
76
|
```
|
|
92
77
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
Prompts accept three input modes:
|
|
96
|
-
|
|
97
|
-
```bash
|
|
98
|
-
designer prompt "short text" --key feat-x # positional
|
|
99
|
-
designer prompt --prompt-file ./brief.md --key feat-x # from file
|
|
100
|
-
cat follow-up.txt | designer prompt - --key feat-x # stdin
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
Output of `prompt` and `snapshot` leads with `Taste here: <url>` above the JSON — the URL is the default taste path.
|
|
78
|
+
Every verb has `--help`. `--key <k>` isolates parallel sessions (state at `~/.designer/sessions.json`). Prompts accept positional, `--prompt-file`, or stdin (`-`).
|
|
104
79
|
|
|
105
80
|
## MCP
|
|
106
81
|
|
|
@@ -108,103 +83,54 @@ Six tools, registered at user scope by `designer setup`:
|
|
|
108
83
|
|
|
109
84
|
| Tool | Purpose |
|
|
110
85
|
|---|---|
|
|
111
|
-
| `designer_session` | Enter / inspect / transition.
|
|
112
|
-
| `designer_prompt` | Modify the design (HTML-diff wait).
|
|
113
|
-
| `designer_ask` | Q&A with the assistant
|
|
114
|
-
| `designer_list` | `
|
|
115
|
-
| `designer_snapshot` | Capture current
|
|
116
|
-
| `designer_handoff` | Export →
|
|
117
|
-
|
|
118
|
-
Registration:
|
|
119
|
-
|
|
120
|
-
```bash
|
|
121
|
-
claude mcp add --transport stdio designer \
|
|
122
|
-
-- env DESIGNER_CDP=9222 \
|
|
123
|
-
/Users/provi/Development/_projs/designer/bin/designer mcp serve
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
(`designer setup` runs this. After `npm link` it collapses to `designer mcp serve`.)
|
|
86
|
+
| `designer_session` | Enter / inspect / transition. Returns stored state + `currentUrl` + `availableFiles`. |
|
|
87
|
+
| `designer_prompt` | Modify the design (HTML-diff wait). Returns `url`, `newFiles`, `activeFile`, `failureMode`, `htmlPath`, `chatReply`. |
|
|
88
|
+
| `designer_ask` | Q&A with the assistant, no file changes. |
|
|
89
|
+
| `designer_list` | `projects` or `files` (flat-only — see quirks). |
|
|
90
|
+
| `designer_snapshot` | Capture current file. Paths + hash by default; `includeHtml: true` inlines. |
|
|
91
|
+
| `designer_handoff` | Export → download + extract tar.gz. Auto-repairs em-dash filename bugs. |
|
|
127
92
|
|
|
128
93
|
## The loop
|
|
129
94
|
|
|
130
95
|
```
|
|
131
96
|
1. Intent → human describes what they want to feel / change
|
|
132
|
-
2.
|
|
133
|
-
|
|
134
|
-
|
|
97
|
+
2. Survey → agent reads the target repo: entities, operations, states,
|
|
98
|
+
failure modes, existing tokens — capability facts, verbatim
|
|
99
|
+
3. Relay → designer_prompt = intent + capabilities, minimal faithful prompt
|
|
100
|
+
4. Taste → hand the human the returned URL; they react in their own words
|
|
135
101
|
5. Interpret → next designer_prompt (modify) or designer_ask (clarify)
|
|
136
102
|
6. Repeat 3-5 → until human says "that's it"
|
|
137
103
|
7. Promote → designer_handoff — bundle is the decision record
|
|
138
104
|
```
|
|
139
105
|
|
|
140
|
-
Full guidance in
|
|
106
|
+
Full guidance in [`skills/designer-loop/SKILL.md`](skills/designer-loop/SKILL.md).
|
|
141
107
|
|
|
142
108
|
## Tasting harness
|
|
143
109
|
|
|
144
|
-
Fallback
|
|
110
|
+
Fallback when the live URL's IDE chrome eats viewport. Requires a prior handoff.
|
|
145
111
|
|
|
146
112
|
```bash
|
|
147
113
|
designer tasting --key <key>
|
|
148
114
|
```
|
|
149
115
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
Default path for tasting is the live URL. Use tasting when: full-viewport comparison matters, Claude didn't build its own `index.html` gallery, or the IDE chrome is distracting.
|
|
116
|
+
Writes `tasting.html` with variant tabs + 1/2/3 shortcuts + persistent notes, serves locally, opens the browser.
|
|
153
117
|
|
|
154
118
|
## Operations
|
|
155
119
|
|
|
156
|
-
- `designer doctor` — diagnose
|
|
157
|
-
- `designer health` — probe
|
|
158
|
-
|
|
159
|
-
## Layout
|
|
160
|
-
|
|
161
|
-
```
|
|
162
|
-
designer/
|
|
163
|
-
├── package.json
|
|
164
|
-
├── tsconfig.json # type-check only
|
|
165
|
-
├── tsconfig.build.json # tsc → dist/
|
|
166
|
-
├── bin/designer # bash wrapper, prefers dist/ then tsx
|
|
167
|
-
├── mcp-server.ts # MCP stdio server (exports startMcpServer)
|
|
168
|
-
├── cli.ts # same verbs, directly runnable; rich --help
|
|
169
|
-
├── designer-controller.ts # core flow: session, prompt, ask, snapshot, handoff
|
|
170
|
-
├── browser.ts # thin wrapper over agent-browser subprocess
|
|
171
|
-
├── cdp-ensure.ts # auto-launches debug Chrome on first tool call
|
|
172
|
-
├── tasting.ts # tasting.html generator + http.server
|
|
173
|
-
├── ui-anchors.ts # every DOM / URL / structural dependency, enumerated
|
|
174
|
-
├── setup.ts # designer setup verb
|
|
175
|
-
├── session-store.ts # per-session state at ~/.designer/
|
|
176
|
-
├── artifact-store.ts # writes HTML/PNG/JSON under ./artifacts/{key}/
|
|
177
|
-
├── repo-root.ts # package.json walk so source + compiled both resolve resources
|
|
178
|
-
├── selectors.json # DOM selectors for the claude.ai/design surface
|
|
179
|
-
├── scripts/
|
|
180
|
-
│ ├── designer-chrome.sh # standalone Chrome launcher
|
|
181
|
-
│ └── probe.ts # manual DOM exploration helper
|
|
182
|
-
├── skills/
|
|
183
|
-
│ └── designer-loop/SKILL.md # the skill, copied to ~/.claude/skills/ by setup
|
|
184
|
-
├── artifacts/ # generated outputs (gitignored)
|
|
185
|
-
└── dist/ # tsc build output (gitignored; published on npm)
|
|
186
|
-
```
|
|
120
|
+
- `designer doctor` — diagnose setup state. Exits 2 on failure.
|
|
121
|
+
- `designer health` — probe 17 UI anchors. Wire into cron to catch claude.ai UI regressions.
|
|
187
122
|
|
|
188
123
|
## Known quirks
|
|
189
124
|
|
|
190
|
-
- **Folder-organized variants.**
|
|
191
|
-
- **React-controlled inputs.** `agent-browser fill` doesn't fire React's synthetic input event
|
|
192
|
-
- **Em-dash handoff filenames.** Claude's handoff pipeline
|
|
193
|
-
- **
|
|
194
|
-
- **UI regressions.** Claude has moved critical buttons mid-development (Export → Share dropdown). `designer health` is the early-warning system; run it periodically.
|
|
125
|
+
- **Folder-organized variants.** The live file-list scrape is flat-only; nested files invisible until `designer_handoff`. `designer_prompt` auto-appends *"no subfolders."* Bundle + `designer tasting` are folder-aware.
|
|
126
|
+
- **React-controlled inputs.** `agent-browser fill` doesn't fire React's synthetic `input` event; we use the native value-setter + `dispatchEvent` + JS `.click()`.
|
|
127
|
+
- **Em-dash handoff filenames.** Claude's handoff pipeline sometimes writes `—` in hrefs but `-` in filenames. `designer_handoff` detects and repairs.
|
|
128
|
+
- **UI regressions.** Claude has moved critical buttons mid-development (Export → Share). Run `designer health` periodically.
|
|
195
129
|
|
|
196
|
-
##
|
|
130
|
+
## Credits
|
|
197
131
|
|
|
198
|
-
|
|
132
|
+
Built on [`agent-browser`](https://github.com/ctate/agent-browser) by [@ctatedev](https://x.com/ctatedev).
|
|
199
133
|
|
|
200
|
-
|
|
201
|
-
npm publish --access public
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
`prepublishOnly` runs `tsc --noEmit` + `tsc -p tsconfig.build.json`. `files` whitelist in `package.json` keeps the tarball under 35KB. Published package will support:
|
|
134
|
+
## License
|
|
205
135
|
|
|
206
|
-
|
|
207
|
-
npx @pro-vi/designer setup # trial
|
|
208
|
-
npm i -g @pro-vi/designer && designer setup # daily use
|
|
209
|
-
claude mcp add --transport stdio designer -- designer mcp serve # MCP
|
|
210
|
-
```
|
|
136
|
+
[MIT](LICENSE).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pro-vi/designer",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "MCP + CLI for autonomous iteration of claude.ai/design — drives the design surface via agent-browser, downloads handoff bundles, and exposes a tasting harness for full-viewport variant comparison.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"check": "tsc --noEmit",
|
|
34
34
|
"build": "tsc -p tsconfig.build.json",
|
|
35
35
|
"prepublishOnly": "npm run check && npm run build",
|
|
36
|
-
"postinstall": "node
|
|
36
|
+
"postinstall": "node scripts/postinstall.mjs",
|
|
37
37
|
"probe": "tsx scripts/probe.ts"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"bin/",
|
|
54
54
|
"skills/",
|
|
55
55
|
"scripts/designer-chrome.sh",
|
|
56
|
+
"scripts/postinstall.mjs",
|
|
56
57
|
"selectors.json",
|
|
57
58
|
"README.md",
|
|
58
59
|
"LICENSE"
|
|
@@ -53,7 +53,7 @@ Orient in the claude.ai/design surface:
|
|
|
53
53
|
|
|
54
54
|
1. `designer_session({ key })` — returns stored state + `availableFiles`. If `stored.designUrl` exists, you're resuming; otherwise create one with a sensible default name derived from the intent (don't interview for a project name).
|
|
55
55
|
2. For existing projects: `designer_snapshot({ filename })` per file of interest. You get `htmlPath` — read it only if deep inspection is warranted.
|
|
56
|
-
3.
|
|
56
|
+
3. **Survey capabilities — this is the primary source of design, not an afterthought.** Before relaying any intent, read the target repo for what the system actually DOES: entities and their fields, operations / endpoints, states (loading / empty / error / success), failure modes, hard constraints (auth, rate limits, offline cases), and existing design tokens. The design EXPRESSES these capabilities — the human's feeling-shaped intent only tells you *how*; the codebase tells you *what*. Transfer capability facts into the prompt verbatim; don't filter them down to what you think matters aesthetically. If there's no codebase yet (greenfield intake), say so in the prompt so Claude Design doesn't invent constraints.
|
|
57
57
|
|
|
58
58
|
A one-line brief is fine ("I see X; here's the prompt I'm about to send"). Don't turn it into design-by-interview.
|
|
59
59
|
|
|
@@ -65,9 +65,9 @@ Guide, don't constrain. The prompt gives Claude enough to make good decisions, n
|
|
|
65
65
|
|
|
66
66
|
| Guide (include) | Constrain (omit) |
|
|
67
67
|
|---|---|
|
|
68
|
-
|
|
|
68
|
+
| **Capability context**: what the product does, entities + fields, operations, states, failure modes | Color palette (unless it's a hard brand token) |
|
|
69
69
|
| User's situation / primary action | Type treatment, font feel |
|
|
70
|
-
| Entities, field names, copy that must appear | Layout direction, whitespace rules |
|
|
70
|
+
| Entities, field names, copy that must appear verbatim | Layout direction, whitespace rules |
|
|
71
71
|
| Adjacent surfaces / what must NOT change | Tone adjectives ("contemplative", "trustworthy") unless paired with a concrete lever |
|
|
72
72
|
| Hard brand tokens (palette, type, existing component names) as non-negotiables | Visual hierarchy choices |
|
|
73
73
|
| Quantity + shape of variants ("3 full-page files", "20 on a wrapping grid") | Variant names (let Claude pick) |
|
|
@@ -184,6 +184,7 @@ Never override with "but best practice says..." — capture the tension in the d
|
|
|
184
184
|
## Guardrails
|
|
185
185
|
|
|
186
186
|
- **Read before relaying** (Phase 2). Call `designer_session` first — it returns `availableFiles`.
|
|
187
|
+
- **Transfer capabilities, don't summarize them.** When the codebase has real endpoints / entities / states, drop them into the prompt unabridged. Summarizing is filtering — you're quietly making design decisions Claude Design should make.
|
|
187
188
|
- **Guide, don't constrain.** Scope + data + hard brand tokens in; aesthetic choices out.
|
|
188
189
|
- **Lock brand explicitly.** Claude won't guess your palette.
|
|
189
190
|
- **Let Claude name variants** from the problem domain.
|
|
@@ -193,6 +194,7 @@ Never override with "but best practice says..." — capture the tension in the d
|
|
|
193
194
|
|
|
194
195
|
## Anti-Patterns
|
|
195
196
|
|
|
197
|
+
- **Designing before reading capabilities.** Booting the loop without surveying the target repo produces designs that look good and don't fit the system. Phase 2 step 3 is load-bearing.
|
|
196
198
|
- **Interviewing about aesthetics.** Scope questions are fine when intent is genuinely unclear; taste questions aren't yours to ask.
|
|
197
199
|
- **Proposing variants of your own.** Claude Design proposes. You relay.
|
|
198
200
|
- **Constraining where Claude should have room.** Brand tokens are constraints; palette feelings and layout hunches aren't.
|