mockpit 1.3.0 → 3.0.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/README.md +66 -202
- package/bin/demoData.js +5 -5
- package/bin/initDesign.js +6 -6
- package/bin/mockpit.js +687 -192
- package/bin/poster.js +377 -0
- package/dist/mcp/server.js +110 -19
- package/dist/server/answerAdditions.d.ts +7 -0
- package/dist/server/answerAdditions.js +76 -0
- package/dist/server/apiViews.d.ts +563 -41
- package/dist/server/apiViews.js +223 -74
- package/dist/server/app.d.ts +10 -2
- package/dist/server/app.js +3284 -782
- package/dist/server/appIcon.js +15 -5
- package/dist/server/appIconPng.js +3 -3
- package/dist/server/askNudges.js +1 -1
- package/dist/server/cdnInline.d.ts +8 -0
- package/dist/server/cdnInline.js +638 -0
- package/dist/server/codeWorker.js +2 -1
- package/dist/server/decisionList.d.ts +45 -0
- package/dist/server/decisionList.js +302 -0
- package/dist/server/decisions.d.ts +8 -8
- package/dist/server/decisions.js +18 -17
- package/dist/server/designGuide.d.ts +10 -6
- package/dist/server/designGuide.js +173 -78
- package/dist/server/embeds.d.ts +4 -1
- package/dist/server/embeds.js +57 -6
- package/dist/server/eventLog.d.ts +2 -2
- package/dist/server/eventLog.js +11 -11
- package/dist/server/events.d.ts +9 -6
- package/dist/server/feedbackBatch.d.ts +38 -16
- package/dist/server/feedbackBatch.js +121 -50
- package/dist/server/fills.d.ts +4 -0
- package/dist/server/fills.js +55 -1
- package/dist/server/guidance.d.ts +23 -0
- package/dist/server/guidance.js +71 -0
- package/dist/server/handoff.d.ts +4 -1
- package/dist/server/handoff.js +8 -2
- package/dist/server/icons.js +1 -1
- package/dist/server/index.js +49 -11
- package/dist/server/jump.d.ts +21 -0
- package/dist/server/jump.js +175 -0
- package/dist/server/knobs.d.ts +3 -3
- package/dist/server/knobs.js +6 -6
- package/dist/server/mcpHttp.d.ts +8 -1
- package/dist/server/mcpHttp.js +44 -7
- package/dist/server/mcpSpec.d.ts +2 -1
- package/dist/server/mcpSpec.js +172 -50
- package/dist/server/parts.js +9 -1
- package/dist/server/postSurfaces.js +3 -0
- package/dist/server/run.d.ts +1 -1
- package/dist/server/run.js +31 -17
- package/dist/server/runApi.d.ts +3 -3
- package/dist/server/runApi.js +34 -24
- package/dist/server/sqlStore.d.ts +117 -94
- package/dist/server/sqlStore.js +1089 -141
- package/dist/server/standings.d.ts +25 -0
- package/dist/server/standings.js +113 -0
- package/dist/server/surfacePage.d.ts +6 -9
- package/dist/server/surfacePage.js +361 -86
- package/dist/server/types.d.ts +252 -69
- package/dist/server/types.js +87 -69
- package/extensions/mockpit.js +245 -65
- package/guide/AGENT_SETUP.md +13 -1
- package/guide/packs/design-craft.md +34 -0
- package/guide/topics/asks.md +117 -69
- package/guide/topics/feedback.md +156 -119
- package/guide/topics/html.md +19 -32
- package/guide/topics/http.md +43 -40
- package/guide/topics/knobs.md +7 -10
- package/guide/topics/scripts.md +24 -35
- package/guide/topics/surfaces.md +50 -41
- package/opencode/mockpit.js +120 -0
- package/opencode/package.json +8 -0
- package/package.json +4 -6
- package/skills/launch-video/SKILL.md +12 -12
- package/skills/mockpit/SKILL.md +35 -23
- package/viewer/dist/index.html +9 -8
package/README.md
CHANGED
|
@@ -1,247 +1,111 @@
|
|
|
1
1
|
# mockpit
|
|
2
2
|
|
|
3
|
-
**A design
|
|
3
|
+
**A design loop for terminal coding agents. Your agent shows designs in your browser and asks
|
|
4
|
+
its questions there. You answer in place and press Send once.**
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
comments on the parts it marked, then press **Send**, at your own pace. Nothing
|
|
9
|
-
the agent calls waits for you: it gets the whole batch once and revises.
|
|
6
|
+
The agent publishes a screen in its states and a few variants, then ends its turn. You compare
|
|
7
|
+
them from pictures, tune knobs, comment on parts and keep the runners-up. One Send gives the
|
|
8
|
+
agent the whole reply. Nothing it calls waits for you.
|
|
10
9
|
|
|
11
10
|
<table>
|
|
12
11
|
<tr>
|
|
13
12
|
<td width="50%" valign="top">
|
|
14
13
|
<picture>
|
|
15
14
|
<source media="(prefers-color-scheme: dark)" srcset="docs/mockpit-dark.png">
|
|
16
|
-
<img width="100%" alt="The Writer
|
|
15
|
+
<img width="100%" alt="The Writer design asking Quiet, dark or editorial?, with the three variants as picture answers beside the stage" src="docs/mockpit-light.png">
|
|
17
16
|
</picture>
|
|
18
17
|
</td>
|
|
19
18
|
<td width="50%" valign="top">
|
|
20
|
-
<img width="100%" alt="Animated demo: the
|
|
19
|
+
<img width="100%" alt="Animated demo: the user keeps Dark, hides Editorial, picks Quiet, answers where the trim goes and presses Send; the reply shows Not seen yet, then Delivered, and the agent publishes version 2" src="docs/mockpit-demo.gif">
|
|
21
20
|
</td>
|
|
22
21
|
</tr>
|
|
23
22
|
</table>
|
|
24
23
|
|
|
25
|
-
##
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
[Ben Vinegar](https://github.com/benvinegar), sponsored by
|
|
29
|
-
[Modem](https://modem.dev). The renderer, sandboxing, MCP/CLI/HTTP tiers and
|
|
30
|
-
Cloudflare deploy all come from that work. Thank you.
|
|
31
|
-
|
|
32
|
-
Upstream is a live visual surface where agents post renders and you comment.
|
|
33
|
-
mockpit turns that into a design-decision loop:
|
|
34
|
-
|
|
35
|
-
| | sideshow | mockpit |
|
|
36
|
-
| ------------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
|
37
|
-
| Structure | A stream of posts per session | **project › mock › state › variant › version**: a repo, a page or component by slug, its UI states, parallel looks, history |
|
|
38
|
-
| Questions | Free-text comments | The agent asks; you answer in place, picking from pictures of each option |
|
|
39
|
-
| Tuning | — | Knobs the agent declares (sliders, colours, springs…) on [tunekit](https://github.com/fabiogaliano/tunekit), live on the stage |
|
|
40
|
-
| Comments | Text on a post | Anchored on a **part** the agent marked with `data-part`, in a given state |
|
|
41
|
-
| Feedback | Each comment reaches the agent as it's written | Picks, tuned values, mix and comments stay drafts until you **Send**, then go out as one reply |
|
|
42
|
-
| Design system | Built-in viewer themes | `mockpit init` detects the repo's tokens, fonts and kit so the agent's markup matches your codebase |
|
|
43
|
-
| Agent verbs | Post-level: `publish`, `update`, `wait`, `comment` | Mock-level, never blocking: `publish`, `ask`, `read`, `feedback`, `say`, `export`, `upload`, `guide`, `run` |
|
|
44
|
-
|
|
45
|
-
## The loop
|
|
46
|
-
|
|
47
|
-
1. **Publish.** The agent publishes each state of the mock ("Writing", "Lab
|
|
48
|
-
open") in one or more variants ("quiet", "dark"). One stage shows the mock;
|
|
49
|
-
the strip under it switches states.
|
|
50
|
-
2. **Ask.** The agent asks what it can't decide alone: which look, where a
|
|
51
|
-
panel goes, which of two layouts. The question lives in the mock, not in
|
|
52
|
-
chat; the agent tells you where to look and ends its turn. Options bound to
|
|
53
|
-
a variant or to knob values render as pictures; hovering one previews it on
|
|
54
|
-
the stage, clicking picks it, and the part it changed is outlined. A
|
|
55
|
-
region the agent drew several ways (a slot: one `data-part`, a `data-fill`
|
|
56
|
-
per alternative) is asked about once; a slot inside a fill is asked only
|
|
57
|
-
while that fill is chosen. Variants the agent forgot to ask about get a
|
|
58
|
-
built-in **Which one?**.
|
|
59
|
-
3. **Tune.** Parts the agent marked are selectable on the stage. Tune lists
|
|
60
|
-
them with the knobs it declared for each, a **Borrow** line for a part
|
|
61
|
-
another look draws differently, plus a comment field. Presets
|
|
62
|
-
save a set of tuned values in your browser.
|
|
63
|
-
4. **Send.** Everything above is a draft (it survives a reload) until one
|
|
64
|
-
**Send**. A mock with a single variant and no questions gets **Accept /
|
|
65
|
-
Revise / Drop** instead. The Send lands in the Thread as **Not seen yet**,
|
|
66
|
-
then **Delivered** once the agent has it. If it isn't picked up, tell your
|
|
67
|
-
agent you've answered.
|
|
68
|
-
5. **Revise.** The agent gets one reply (answers, tuned values, mix, comments)
|
|
69
|
-
on its next write, its next `feedback` call, or from `mockpit watch` under a
|
|
70
|
-
background monitor. It publishes the next version; the frame header's `v3 ▾` lists the history,
|
|
71
|
-
and an older version opens under a banner with "restore as vN". Looks that
|
|
72
|
-
lost are archived, not deleted.
|
|
73
|
-
|
|
74
|
-
**Home** lists the project's mocks with a thumbnail, their states and how many
|
|
75
|
-
questions are open, with "Answer next ›" to jump to the first one. Dark and
|
|
76
|
-
light themes, toggled from the top bar. On a phone or an iPad in portrait the
|
|
77
|
-
design is a canvas you pan and pinch, at each width the agent names (or one you
|
|
78
|
-
pick: Phone 390, Tablet 744, Desktop 820, Wide 1280) side by side, and the
|
|
79
|
-
questions float over it in a card you can snap to a corner, a side or the
|
|
80
|
-
bottom, or tuck against an edge. On a desktop, Inspect opens the stage full
|
|
81
|
-
screen to pan and pinch-zoom it.
|
|
82
|
-
|
|
83
|
-
## Quick start
|
|
84
|
-
|
|
85
|
-
Requires Node 22.18 or newer.
|
|
24
|
+
## Quickstart
|
|
25
|
+
|
|
26
|
+
Needs Node 22.18 or newer.
|
|
86
27
|
|
|
87
28
|
```sh
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
npm link # puts the `mockpit` CLI on your PATH
|
|
29
|
+
npm i -g mockpit
|
|
30
|
+
mockpit serve --open # http://localhost:8228
|
|
31
|
+
mockpit demo # seeds a sample design to click through
|
|
92
32
|
```
|
|
93
33
|
|
|
94
|
-
Point your agent at it
|
|
34
|
+
Point your agent at it, once per repo:
|
|
95
35
|
|
|
96
36
|
```sh
|
|
97
37
|
curl -s http://localhost:8228/setup >> AGENTS.md
|
|
38
|
+
mockpit init # reads the repo's tokens, fonts and kit
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Then ask it to "design this up on mockpit". Claude Code, Codex, OpenCode, Pi and MCP setup:
|
|
42
|
+
[docs/connecting-agents.md](docs/connecting-agents.md).
|
|
43
|
+
|
|
44
|
+
## A turn
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
mockpit publish --design writer --state Writing --variant quiet --html quiet.html
|
|
48
|
+
mockpit publish --design writer --state Writing --variant dark --html dark.html
|
|
49
|
+
mockpit ask --design writer "Quiet or dark?" --option Quiet=quiet --option Dark=dark
|
|
50
|
+
# the agent says where to look and stops. After your Send:
|
|
51
|
+
mockpit feedback
|
|
98
52
|
```
|
|
99
53
|
|
|
100
|
-
|
|
101
|
-
mockpit". No agent handy? `mockpit demo` seeds the Writer: one mock in four
|
|
102
|
-
states and three looks, with questions, knobs and marked parts.
|
|
54
|
+
## What you can do with an answer
|
|
103
55
|
|
|
104
|
-
|
|
105
|
-
**
|
|
56
|
+
- **Pick** from pictures. Hover to preview it on the stage.
|
|
57
|
+
- **Keep** runners-up. After Send they stay beside the design, one click from Use this instead.
|
|
58
|
+
- **Hide** what you don't want, with a reason if you like. The agent won't offer it again.
|
|
59
|
+
- **Ask for more** answers without sending the rest of your draft.
|
|
60
|
+
- **Save a set** of answers across questions, like Warm or Quiet, and switch between sets.
|
|
61
|
+
- **Tune** the knobs the agent declared, **borrow** a part from another variant, and
|
|
62
|
+
**comment** on any part.
|
|
106
63
|
|
|
107
|
-
|
|
64
|
+
Studio puts every variant side by side. Home groups a project's ideas, screens, flows and
|
|
65
|
+
components, and Needs you lists what's waiting on you.
|
|
108
66
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
67
|
+
## What it shows
|
|
68
|
+
|
|
69
|
+
Html with parts and knobs, plus markdown, diff, terminal, image, mermaid, json and code. All of
|
|
70
|
+
it renders in a sandboxed frame.
|
|
112
71
|
|
|
113
72
|
<table>
|
|
114
73
|
<tr>
|
|
115
|
-
<td width="50%"
|
|
116
|
-
|
|
117
|
-
<p><b><code>html</code></b>: markup the agent authors, rendered in a sandbox and themed by your design system.</p>
|
|
118
|
-
</td>
|
|
119
|
-
<td width="50%" valign="top">
|
|
120
|
-
<img src="docs/surfaces/02-markdown.png" width="100%" alt="markdown surface">
|
|
121
|
-
<p><b><code>markdown</code></b>: prose, tables and fenced code.</p>
|
|
122
|
-
</td>
|
|
123
|
-
</tr>
|
|
124
|
-
<tr>
|
|
125
|
-
<td width="50%" valign="top">
|
|
126
|
-
<img src="docs/surfaces/03-diff.png" width="100%" alt="diff surface">
|
|
127
|
-
<p><b><code>diff</code></b>: a patch as a syntax-highlighted code review (unified or split).</p>
|
|
128
|
-
</td>
|
|
129
|
-
<td width="50%" valign="top">
|
|
130
|
-
<img src="docs/surfaces/07-mermaid.png" width="100%" alt="mermaid surface">
|
|
131
|
-
<p><b><code>mermaid</code></b>: diagram source rendered to SVG in the viewer palette.</p>
|
|
132
|
-
</td>
|
|
74
|
+
<td width="50%"><img src="docs/surfaces/01-html.png" width="100%" alt="html surface"></td>
|
|
75
|
+
<td width="50%"><img src="docs/surfaces/03-diff.png" width="100%" alt="diff surface"></td>
|
|
133
76
|
</tr>
|
|
134
77
|
</table>
|
|
135
78
|
|
|
136
|
-
|
|
137
|
-
(collapsible tree) and `code` (shiki-highlighted source with line numbers).
|
|
138
|
-
|
|
139
|
-
## Agent verbs
|
|
140
|
-
|
|
141
|
-
Nine verbs, the same on every tier with the same fields: a zero-dependency CLI
|
|
142
|
-
for agents with only a shell, MCP over stdio or streamable HTTP at `/mcp`, and
|
|
143
|
-
plain HTTP. None of them waits for the user.
|
|
144
|
-
|
|
145
|
-
| CLI | MCP | HTTP |
|
|
146
|
-
| --------------------- | -------------------- | -------------------------------------- |
|
|
147
|
-
| `mockpit publish` | `publish` | `POST /api/mocks` |
|
|
148
|
-
| `mockpit ask` | `ask` | `POST /api/mocks/:id/asks` |
|
|
149
|
-
| `mockpit read [slug]` | `read` | `GET /api/mocks`, `GET /api/mocks/:id` |
|
|
150
|
-
| `mockpit feedback` | `feedback` | `GET /api/feedback?session=…` |
|
|
151
|
-
| `mockpit say` | `say` | `POST /api/mocks/:id/say` |
|
|
152
|
-
| `mockpit export` | `export` | `GET /api/mocks/:id/export` |
|
|
153
|
-
| `mockpit upload` | `upload` | `POST /api/assets` |
|
|
154
|
-
| `mockpit guide` | `guide` | `GET /agent-howto` |
|
|
155
|
-
| `mockpit run` | `run` (`?mode=code`) | `POST /api/run` |
|
|
156
|
-
|
|
157
|
-
The CLI adds `mockpit init` (detect the repo's design system, once per repo)
|
|
158
|
-
and `mockpit watch` (one line per Send, for a background monitor).
|
|
159
|
-
|
|
160
|
-
- **`publish` is the one write.** It creates the mock, state or variant, or the
|
|
161
|
-
next version of an existing one. Send `html`, the full ordered `surfaces`
|
|
162
|
-
list (an entry that is only `{id}` keeps that surface), or `parts` to replace
|
|
163
|
-
just the marked elements.
|
|
164
|
-
- **`feedback` returns at once** with what the user sent since the agent last
|
|
165
|
-
heard, plus `pending`: whether each mock is open in the viewer and how far the user's
|
|
166
|
-
draft has got (`2 of 3 answered`). Every write returns `feedback` too, and
|
|
167
|
-
each Send is delivered exactly once across all of them.
|
|
168
|
-
- **Asks are nudged.** A publish that leaves several variants with no ask
|
|
169
|
-
binding them returns a nudge and a ready `suggestedAsk`.
|
|
170
|
-
|
|
171
|
-
A typical turn:
|
|
79
|
+
## Agent side
|
|
172
80
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
mockpit
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
mockpit
|
|
179
|
-
|
|
81
|
+
Eleven verbs, the same on the zero-dependency CLI, MCP (stdio, or HTTP at `/mcp`) and plain
|
|
82
|
+
HTTP: `publish`, `ask`, `read`, `feedback`, `say`, `move`, `edit`, `export`, `upload`,
|
|
83
|
+
`guide`, `run`. `mockpit watch` wakes a waiting agent on each Send.
|
|
84
|
+
|
|
85
|
+
Agents read a short brief before their first publish (`/agent-howto`). Add your own taste in
|
|
86
|
+
`~/.mockpit/rules.md`, or per repo in `.mockpit/rules.md`.
|
|
87
|
+
[`examples/rules.md`](examples/rules.md) is one.
|
|
88
|
+
|
|
89
|
+
## Where it runs
|
|
180
90
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
`asks`, `surfaces`, `html`, `reply`, `http`, `scripts`) are at
|
|
184
|
-
`/agent-howto?topic=<id>`; `/guide` is the `html` topic. `run` executes one
|
|
185
|
-
script against the same verbs on the server, so publishing variants and asking
|
|
186
|
-
take one call; `/mcp?mode=code` serves it as the only tool, for connectors
|
|
187
|
-
without a codemode of their own.
|
|
188
|
-
|
|
189
|
-
## Run it anywhere
|
|
190
|
-
|
|
191
|
-
It runs locally as a small Node server (SQLite at `~/.mockpit/mockpit.db`), or on
|
|
192
|
-
Cloudflare Workers when your agent and browser are on different machines. See
|
|
193
|
-
**[docs/deploying.md](docs/deploying.md)**.
|
|
194
|
-
|
|
195
|
-
The server keeps an event log, one JSON line per agent call, viewer write and
|
|
196
|
-
live-feed connection (ids and shapes, never content), at
|
|
197
|
-
`~/.mockpit/events.jsonl` next to the database. It rolls over at 10 MB. Set
|
|
198
|
-
`MOCKPIT_LOG` to another path, or to `off` to disable it; on Workers it goes to
|
|
199
|
-
Workers Logs. `node scripts/inspect.ts` in a checkout reads it alongside the
|
|
200
|
-
database and Claude Code transcripts.
|
|
201
|
-
|
|
202
|
-
The server app is importable from `mockpit/server` (`createApp`, `SqlStore`,
|
|
203
|
-
`createSqliteStorage`). The embeddable viewer engine (`mockpit/viewer-embed`,
|
|
204
|
-
`mountViewer`) is gone: the viewer is self-hosted only.
|
|
205
|
-
|
|
206
|
-
## Migrating from 0.x
|
|
207
|
-
|
|
208
|
-
- **SQLite workspaces migrate in place on first boot.** Each item becomes a
|
|
209
|
-
single-state mock with its variants and version history; comments keep their
|
|
210
|
-
ids and sequence numbers, so agents' feedback cursors carry over. Comments a
|
|
211
|
-
user was still drafting become the mock's draft. Deployed Durable Objects
|
|
212
|
-
migrate the same way.
|
|
213
|
-
- **The JSON store is gone.** If you run with `MOCKPIT_STORE=json`, start your
|
|
214
|
-
current version once without it **before upgrading**:
|
|
215
|
-
`env -u MOCKPIT_STORE mockpit serve` (keep `MOCKPIT_DATA`/`MOCKPIT_DB` if you
|
|
216
|
-
set them). That first SQLite boot copies `~/.mockpit/mockpit.json` into
|
|
217
|
-
`~/.mockpit/mockpit.db`, as long as the database is still empty; then upgrade.
|
|
218
|
-
The JSON file is left untouched either way.
|
|
219
|
-
- **`--item` is now `--mock`** (`mockpit publish --mock <slug> --state <s>
|
|
220
|
-
--variant <v>`), and the MCP tools are named by verb (`publish`, `ask`,
|
|
221
|
-
`read`, `feedback`, `say`, `export`, `upload`, `guide`).
|
|
222
|
-
- **Removed:** the item, post, snippet and session-page routes
|
|
223
|
-
(`/api/projects/:name/items`, `/api/posts`, `/api/surfaces`, `/api/snippets`,
|
|
224
|
-
`/session/:id`, `/p/:id`), `?part=`, the item/post MCP tools and their
|
|
225
|
-
deprecated aliases (`publish_item`, `publish_post`, `publish_surface`, …), the
|
|
226
|
-
CLI's `page`, `list`, `sessions`, `update`, per-kind shortcuts (`markdown`,
|
|
227
|
-
`diff`, …), `test-post` and `trace*` commands, the github/gruvbox/one themes
|
|
228
|
-
and the embed engine. Agents should re-fetch `/agent-howto`; refresh pasted
|
|
229
|
-
setup blocks from `/setup`.
|
|
91
|
+
Locally, a small Node server with SQLite at `~/.mockpit/mockpit.db`. When the agent and browser
|
|
92
|
+
are on different machines, deploy it to Cloudflare Workers: [docs/deploying.md](docs/deploying.md).
|
|
230
93
|
|
|
231
94
|
## Development
|
|
232
95
|
|
|
233
96
|
```sh
|
|
234
|
-
|
|
235
|
-
npm
|
|
236
|
-
npm run
|
|
237
|
-
npm run typecheck
|
|
238
|
-
npm run lint # oxlint
|
|
239
|
-
npm run format # oxfmt
|
|
240
|
-
npm run test:e2e # Playwright, chromium + webkit (bridge, mock screen, decide flow)
|
|
97
|
+
git clone https://github.com/fabiogaliano/mockpit && cd mockpit
|
|
98
|
+
npm install
|
|
99
|
+
npm run dev # server + viewer watch build
|
|
100
|
+
npm run typecheck && npm run lint && npm run format:check
|
|
241
101
|
```
|
|
242
102
|
|
|
243
|
-
|
|
103
|
+
Architecture and rules: [AGENTS.md](AGENTS.md).
|
|
104
|
+
|
|
105
|
+
## Credits
|
|
244
106
|
|
|
245
|
-
|
|
107
|
+
A fork of [sideshow](https://github.com/modem-dev/sideshow) by
|
|
108
|
+
[Ben Vinegar](https://github.com/benvinegar), sponsored by [Modem](https://modem.dev). The
|
|
109
|
+
renderer, sandboxing, agent tiers and Cloudflare deploy started there.
|
|
246
110
|
|
|
247
111
|
[MIT](LICENSE). The original sideshow copyright is retained.
|
package/bin/demoData.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// Seed content for `mockpit demo`: the Writer
|
|
2
|
-
// writing app, each drawn in three
|
|
1
|
+
// Seed content for `mockpit demo`: the Writer design — four states of one
|
|
2
|
+
// writing app, each drawn in three variants, with its parts marked so the viewer
|
|
3
3
|
// can show questions, tuning and part comments. Dependency-free like the CLI.
|
|
4
4
|
|
|
5
5
|
const LOOKS = {
|
|
@@ -101,9 +101,9 @@ export const DEMO = {
|
|
|
101
101
|
},
|
|
102
102
|
asks: [
|
|
103
103
|
{
|
|
104
|
-
id: "
|
|
105
|
-
text: "
|
|
106
|
-
scope: "
|
|
104
|
+
id: "tone",
|
|
105
|
+
text: "Quiet, dark or editorial?",
|
|
106
|
+
scope: "design",
|
|
107
107
|
options: [
|
|
108
108
|
{ label: "Quiet", variant: "quiet" },
|
|
109
109
|
{ label: "Dark", variant: "dark" },
|
package/bin/initDesign.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
//
|
|
5
5
|
// The point of this file is that the agent never assembles a design set by
|
|
6
6
|
// hand: init reads what the repo already declares (Tailwind, shadcn, a `:root`
|
|
7
|
-
// token block, fonts), turns it into the project's
|
|
7
|
+
// token block, fonts), turns it into the project's DesignSystem, and writes a
|
|
8
8
|
// starter file the agent copies from. Everything here is deterministic — no
|
|
9
9
|
// model in the loop.
|
|
10
10
|
|
|
@@ -257,11 +257,11 @@ function hasTailwind(cwd) {
|
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
/**
|
|
260
|
-
* Inspect a repo and derive the project's
|
|
260
|
+
* Inspect a repo and derive the project's DesignSystem inputs.
|
|
261
261
|
* Never throws on a hostile/odd tree — an undetectable repo returns the
|
|
262
262
|
* builtin kit with no palette, which is a perfectly good starting point.
|
|
263
263
|
*/
|
|
264
|
-
export async function
|
|
264
|
+
export async function detectDesignSystem(cwd) {
|
|
265
265
|
const { paletteFromCssVars } = await loadThemes();
|
|
266
266
|
const budget = { left: MAX_FILES };
|
|
267
267
|
const cssFiles = findCssFiles(cwd, budget);
|
|
@@ -818,13 +818,13 @@ const STARTER_TOKENS = [
|
|
|
818
818
|
* tokens, and one icon in use. `iconSets` are the prefixes the server resolves
|
|
819
819
|
* for this project.
|
|
820
820
|
*/
|
|
821
|
-
export function renderStarter(
|
|
822
|
-
const kit =
|
|
821
|
+
export function renderStarter(designSystem, iconSets = ["lucide", "mage"]) {
|
|
822
|
+
const kit = designSystem?.kit ?? "builtin";
|
|
823
823
|
const bodies = { tailwind: TAILWIND_BODY, basecoat: BASECOAT_BODY };
|
|
824
824
|
const body = (bodies[kit] ?? BUILTIN_BODY).replace("ICON_SLOT", '<i icon="lucide:check"></i>');
|
|
825
825
|
// Show the tokens an agent reaches for first. A repo's block is usually led
|
|
826
826
|
// by sizing/easing tokens, so surface the semantic colors ahead of them.
|
|
827
|
-
const props = customProps(
|
|
827
|
+
const props = customProps(designSystem?.cssVars ?? "");
|
|
828
828
|
const rank = (name) => {
|
|
829
829
|
const i = STARTER_TOKENS.indexOf(name);
|
|
830
830
|
return i === -1 ? STARTER_TOKENS.length : i;
|