mockpit 2.0.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 +60 -212
- package/bin/demoData.js +2 -2
- package/bin/initDesign.js +6 -6
- package/bin/mockpit.js +407 -187
- package/bin/poster.js +377 -0
- package/dist/mcp/server.js +80 -24
- package/dist/server/answerAdditions.d.ts +7 -0
- package/dist/server/answerAdditions.js +76 -0
- package/dist/server/apiViews.d.ts +289 -52
- package/dist/server/apiViews.js +189 -81
- package/dist/server/app.d.ts +7 -2
- package/dist/server/app.js +2845 -832
- 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 +1 -1
- package/dist/server/decisionList.d.ts +45 -0
- package/dist/server/decisionList.js +302 -0
- package/dist/server/decisions.d.ts +4 -4
- package/dist/server/decisions.js +9 -9
- package/dist/server/designGuide.d.ts +5 -5
- package/dist/server/designGuide.js +128 -67
- package/dist/server/embeds.d.ts +3 -1
- package/dist/server/embeds.js +31 -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 +35 -13
- package/dist/server/feedbackBatch.js +111 -47
- package/dist/server/fills.d.ts +4 -0
- package/dist/server/fills.js +55 -1
- 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 +39 -10
- 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 +5 -1
- package/dist/server/mcpHttp.js +16 -11
- package/dist/server/mcpSpec.js +118 -46
- package/dist/server/parts.js +9 -1
- package/dist/server/run.d.ts +1 -1
- package/dist/server/run.js +25 -16
- package/dist/server/runApi.d.ts +3 -3
- package/dist/server/runApi.js +25 -19
- package/dist/server/sqlStore.d.ts +112 -96
- package/dist/server/sqlStore.js +906 -172
- 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 +226 -72
- package/dist/server/types.js +73 -78
- package/extensions/mockpit.js +89 -72
- package/guide/AGENT_SETUP.md +13 -1
- package/guide/packs/design-craft.md +2 -3
- package/guide/topics/asks.md +106 -62
- package/guide/topics/feedback.md +126 -119
- package/guide/topics/html.md +17 -24
- package/guide/topics/http.md +41 -41
- package/guide/topics/knobs.md +7 -10
- package/guide/topics/scripts.md +22 -33
- package/guide/topics/surfaces.md +39 -48
- package/opencode/mockpit.js +120 -0
- package/opencode/package.json +8 -0
- package/package.json +4 -3
- package/skills/launch-video/SKILL.md +11 -11
- package/skills/mockpit/SKILL.md +26 -22
- package/viewer/dist/index.html +9 -9
package/README.md
CHANGED
|
@@ -1,263 +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 declared, 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
|
-
##
|
|
24
|
+
## Quickstart
|
|
26
25
|
|
|
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 variants, 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 declared with `data-part`, in a given state |
|
|
41
|
-
| Feedback | Each comment reaches the agent as it's written | Picks, tuned values, borrowed parts 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`, `edit`, `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
|
-
one state at a time.
|
|
50
|
-
2. **Ask.** The agent asks what it can't decide alone: which variant, 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 part with fills: one `data-part`, a
|
|
56
|
-
`data-fill` per alternative) is asked about once; a part inside a fill is
|
|
57
|
-
asked only while that fill is chosen. Variants the agent forgot to ask about
|
|
58
|
-
get a built-in **Which variant?**.
|
|
59
|
-
3. **Tune.** Parts the agent declared are selectable on the stage. Tune lists
|
|
60
|
-
them with the knobs it declared for each, a **Borrow** line for a part
|
|
61
|
-
another variant 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 **Use this /
|
|
65
|
-
Revise** 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, borrowed parts, comments)
|
|
69
|
-
on its next write, its next `feedback` call, or from `mockpit watch` under a
|
|
70
|
-
background monitor. It publishes the next version. Versions are named by
|
|
71
|
-
their variant's own number ("Dark #2"); the version bar walks the history,
|
|
72
|
-
and **Use this** puts an older one back in use. Variants that lost are
|
|
73
|
-
archived, not deleted.
|
|
74
|
-
|
|
75
|
-
**Home** lists the project's mocks with a thumbnail, their states and how many
|
|
76
|
-
questions are open, with "Answer next ›" to jump to the first one. Dark and
|
|
77
|
-
light themes, toggled from the top bar. On a phone or an iPad in portrait the
|
|
78
|
-
design is a canvas you pan and pinch, at each width the agent names (or one you
|
|
79
|
-
pick: Phone 390, Tablet 744, Desktop 820, Wide 1280) side by side, and the
|
|
80
|
-
questions float over it in a card you can snap to a corner, a side or the
|
|
81
|
-
bottom, or tuck against an edge. On a desktop, Inspect opens the stage full
|
|
82
|
-
screen to pan and pinch-zoom it.
|
|
83
|
-
|
|
84
|
-
## Quick start
|
|
85
|
-
|
|
86
|
-
Requires Node 22.18 or newer.
|
|
26
|
+
Needs Node 22.18 or newer.
|
|
87
27
|
|
|
88
28
|
```sh
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
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
|
|
93
32
|
```
|
|
94
33
|
|
|
95
|
-
Point your agent at it
|
|
34
|
+
Point your agent at it, once per repo:
|
|
96
35
|
|
|
97
36
|
```sh
|
|
98
37
|
curl -s http://localhost:8228/setup >> AGENTS.md
|
|
38
|
+
mockpit init # reads the repo's tokens, fonts and kit
|
|
99
39
|
```
|
|
100
40
|
|
|
101
|
-
Then
|
|
102
|
-
|
|
103
|
-
states and three variants, with questions, knobs and declared parts.
|
|
104
|
-
|
|
105
|
-
MCP, the Pi extension and the Claude Code plugin are covered in
|
|
106
|
-
**[docs/connecting-agents.md](docs/connecting-agents.md)**.
|
|
107
|
-
|
|
108
|
-
## What a mock can show
|
|
109
|
-
|
|
110
|
-
A version is an ordered list of **surfaces**, and one version can carry several.
|
|
111
|
-
Html is what design mocks use and the only kind with parts and knobs; the others
|
|
112
|
-
render the same way on the stage.
|
|
113
|
-
|
|
114
|
-
<table>
|
|
115
|
-
<tr>
|
|
116
|
-
<td width="50%" valign="top">
|
|
117
|
-
<img src="docs/surfaces/01-html.png" width="100%" alt="html surface">
|
|
118
|
-
<p><b><code>html</code></b>: markup the agent authors, rendered in a sandbox and themed by your design system.</p>
|
|
119
|
-
</td>
|
|
120
|
-
<td width="50%" valign="top">
|
|
121
|
-
<img src="docs/surfaces/02-markdown.png" width="100%" alt="markdown surface">
|
|
122
|
-
<p><b><code>markdown</code></b>: prose, tables and fenced code.</p>
|
|
123
|
-
</td>
|
|
124
|
-
</tr>
|
|
125
|
-
<tr>
|
|
126
|
-
<td width="50%" valign="top">
|
|
127
|
-
<img src="docs/surfaces/03-diff.png" width="100%" alt="diff surface">
|
|
128
|
-
<p><b><code>diff</code></b>: a patch as a syntax-highlighted code review (unified or split).</p>
|
|
129
|
-
</td>
|
|
130
|
-
<td width="50%" valign="top">
|
|
131
|
-
<img src="docs/surfaces/07-mermaid.png" width="100%" alt="mermaid surface">
|
|
132
|
-
<p><b><code>mermaid</code></b>: diagram source rendered to SVG in the viewer palette.</p>
|
|
133
|
-
</td>
|
|
134
|
-
</tr>
|
|
135
|
-
</table>
|
|
136
|
-
|
|
137
|
-
There are also `terminal` (ANSI output), `image` (uploaded assets), `json`
|
|
138
|
-
(collapsible tree) and `code` (shiki-highlighted source with line numbers).
|
|
139
|
-
|
|
140
|
-
## Agent verbs
|
|
141
|
-
|
|
142
|
-
Ten verbs, the same on every tier with the same fields: a zero-dependency CLI
|
|
143
|
-
for agents with only a shell, MCP over stdio or streamable HTTP at `/mcp`, and
|
|
144
|
-
plain HTTP. None of them waits for the user.
|
|
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).
|
|
145
43
|
|
|
146
|
-
|
|
147
|
-
| --------------------- | -------------------- | --------------------------------------------------- |
|
|
148
|
-
| `mockpit publish` | `publish` | `POST /api/mocks` |
|
|
149
|
-
| `mockpit ask` | `ask` | `POST /api/mocks/:id/asks` |
|
|
150
|
-
| `mockpit read [slug]` | `read` | `GET /api/mocks`, `GET /api/mocks/:id` |
|
|
151
|
-
| `mockpit feedback` | `feedback` | `GET /api/feedback?session=…` |
|
|
152
|
-
| `mockpit say` | `say` | `POST /api/mocks/:id/say` |
|
|
153
|
-
| `mockpit edit` | `edit` | `PATCH /api/mocks/:id`, `PATCH /api/projects/:name` |
|
|
154
|
-
| `mockpit export` | `export` | `GET /api/mocks/:id/export` |
|
|
155
|
-
| `mockpit upload` | `upload` | `POST /api/assets` |
|
|
156
|
-
| `mockpit guide` | `guide` | `GET /agent-howto` |
|
|
157
|
-
| `mockpit run` | `run` (`?mode=code`) | `POST /api/run` |
|
|
158
|
-
|
|
159
|
-
The CLI adds `mockpit init` (detect the repo's design system, once per repo)
|
|
160
|
-
and `mockpit watch` (one line per Send, for a background monitor).
|
|
161
|
-
|
|
162
|
-
- **`publish` is the one write.** It creates the mock, state or variant, or the
|
|
163
|
-
next version of an existing one. Send `html`, the full ordered `surfaces`
|
|
164
|
-
list (an entry that is only `{id}` keeps that surface), or `parts` to replace
|
|
165
|
-
just the declared elements.
|
|
166
|
-
- **`feedback` returns at once** with what the user sent since the agent last
|
|
167
|
-
heard, plus `pending`: whether each mock is open in the viewer and how far the user's
|
|
168
|
-
draft has got (`2 of 3 answered`). Every write returns `feedback` too, and
|
|
169
|
-
each Send is delivered exactly once across all of them.
|
|
170
|
-
- **Questions are nudged.** A publish that leaves several variants with no
|
|
171
|
-
question binding them returns a nudge and a ready `suggestedAsk`.
|
|
172
|
-
|
|
173
|
-
A typical turn:
|
|
44
|
+
## A turn
|
|
174
45
|
|
|
175
46
|
```sh
|
|
176
|
-
mockpit publish --
|
|
177
|
-
mockpit publish --
|
|
178
|
-
mockpit ask
|
|
179
|
-
# the agent says where to look and
|
|
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:
|
|
180
51
|
mockpit feedback
|
|
181
52
|
```
|
|
182
53
|
|
|
183
|
-
|
|
184
|
-
document an agent reads before its first publish. Reference topics (`knobs`,
|
|
185
|
-
`asks`, `surfaces`, `html`, `feedback`, `http`, `scripts`) are at
|
|
186
|
-
`/agent-howto?topic=<id>`; `/guide` is the `html` topic. `run` executes one
|
|
187
|
-
script against the same verbs on the server, so publishing variants and asking
|
|
188
|
-
take one call; `/mcp?mode=code` serves it as the only tool, for connectors
|
|
189
|
-
without a codemode of their own.
|
|
54
|
+
## What you can do with an answer
|
|
190
55
|
|
|
191
|
-
|
|
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.
|
|
192
63
|
|
|
193
|
-
|
|
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.
|
|
194
66
|
|
|
195
|
-
|
|
196
|
-
| ------------- | ------------------------------- | ------------------------------------- |
|
|
197
|
-
| Core | built in | everyone: how mockpit works, no taste |
|
|
198
|
-
| Packs | built in, off by default | whoever turns one on (`design-craft`) |
|
|
199
|
-
| Your rules | `~/.mockpit/rules.md` | you, in every project |
|
|
200
|
-
| Project rules | `.mockpit/rules.md` in the repo | anyone designing that repo |
|
|
67
|
+
## What it shows
|
|
201
68
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
rules` sends the project's file to the server; `mockpit init` does it too.
|
|
205
|
-
[`examples/rules.md`](examples/rules.md) is the maintainer's own, symlinked to
|
|
206
|
-
`~/.mockpit/rules.md`.
|
|
69
|
+
Html with parts and knobs, plus markdown, diff, terminal, image, mermaid, json and code. All of
|
|
70
|
+
it renders in a sandboxed frame.
|
|
207
71
|
|
|
208
|
-
|
|
72
|
+
<table>
|
|
73
|
+
<tr>
|
|
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>
|
|
76
|
+
</tr>
|
|
77
|
+
</table>
|
|
209
78
|
|
|
210
|
-
|
|
211
|
-
Cloudflare Workers when your agent and browser are on different machines. See
|
|
212
|
-
**[docs/deploying.md](docs/deploying.md)**.
|
|
79
|
+
## Agent side
|
|
213
80
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
`MOCKPIT_LOG` to another path, or to `off` to disable it; on Workers it goes to
|
|
218
|
-
Workers Logs. `node scripts/inspect.ts` in a checkout reads it alongside the
|
|
219
|
-
database and Claude Code transcripts.
|
|
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.
|
|
220
84
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
`
|
|
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.
|
|
224
88
|
|
|
225
|
-
##
|
|
89
|
+
## Where it runs
|
|
226
90
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
ids and sequence numbers, so agents' feedback cursors carry over. Comments a
|
|
230
|
-
user was still drafting become the mock's draft. Deployed Durable Objects
|
|
231
|
-
migrate the same way.
|
|
232
|
-
- **The JSON store is gone.** If you run with `MOCKPIT_STORE=json`, start your
|
|
233
|
-
current version once without it **before upgrading**:
|
|
234
|
-
`env -u MOCKPIT_STORE mockpit serve` (keep `MOCKPIT_DATA`/`MOCKPIT_DB` if you
|
|
235
|
-
set them). That first SQLite boot copies `~/.mockpit/mockpit.json` into
|
|
236
|
-
`~/.mockpit/mockpit.db`, as long as the database is still empty; then upgrade.
|
|
237
|
-
The JSON file is left untouched either way.
|
|
238
|
-
- **`--item` is now `--mock`** (`mockpit publish --mock <slug> --state <s>
|
|
239
|
-
--variant <v>`), and the MCP tools are named by verb (`publish`, `ask`,
|
|
240
|
-
`read`, `feedback`, `say`, `export`, `upload`, `guide`).
|
|
241
|
-
- **Removed:** the item, post, snippet and session-page routes
|
|
242
|
-
(`/api/projects/:name/items`, `/api/posts`, `/api/surfaces`, `/api/snippets`,
|
|
243
|
-
`/session/:id`, `/p/:id`), `?part=`, the item/post MCP tools and their
|
|
244
|
-
deprecated aliases (`publish_item`, `publish_post`, `publish_surface`, …), the
|
|
245
|
-
CLI's `page`, `list`, `sessions`, `update`, per-kind shortcuts (`markdown`,
|
|
246
|
-
`diff`, …), `test-post` and `trace*` commands, the github/gruvbox/one themes
|
|
247
|
-
and the embed engine. Agents should re-fetch `/agent-howto`; refresh pasted
|
|
248
|
-
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).
|
|
249
93
|
|
|
250
94
|
## Development
|
|
251
95
|
|
|
252
96
|
```sh
|
|
253
|
-
|
|
254
|
-
npm
|
|
255
|
-
npm run
|
|
256
|
-
npm run format
|
|
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
|
|
257
101
|
```
|
|
258
102
|
|
|
259
|
-
|
|
103
|
+
Architecture and rules: [AGENTS.md](AGENTS.md).
|
|
104
|
+
|
|
105
|
+
## Credits
|
|
260
106
|
|
|
261
|
-
|
|
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.
|
|
262
110
|
|
|
263
111
|
[MIT](LICENSE). The original sideshow copyright is retained.
|
package/bin/demoData.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Seed content for `mockpit demo`: the Writer
|
|
1
|
+
// Seed content for `mockpit demo`: the Writer design — four states of one
|
|
2
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
|
|
|
@@ -103,7 +103,7 @@ export const DEMO = {
|
|
|
103
103
|
{
|
|
104
104
|
id: "tone",
|
|
105
105
|
text: "Quiet, dark or editorial?",
|
|
106
|
-
scope: "
|
|
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;
|