mockpit 1.3.0 → 2.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 +61 -45
- package/bin/demoData.js +3 -3
- package/bin/mockpit.js +327 -52
- package/dist/mcp/server.js +35 -0
- package/dist/server/apiViews.d.ts +308 -23
- package/dist/server/apiViews.js +60 -19
- package/dist/server/app.d.ts +4 -1
- package/dist/server/app.js +608 -119
- package/dist/server/codeWorker.js +2 -1
- package/dist/server/decisions.d.ts +5 -5
- package/dist/server/decisions.js +10 -9
- package/dist/server/designGuide.d.ts +6 -2
- package/dist/server/designGuide.js +77 -43
- package/dist/server/embeds.d.ts +1 -0
- package/dist/server/embeds.js +30 -4
- package/dist/server/feedbackBatch.d.ts +6 -6
- package/dist/server/feedbackBatch.js +18 -11
- package/dist/server/guidance.d.ts +23 -0
- package/dist/server/guidance.js +71 -0
- package/dist/server/index.js +10 -1
- package/dist/server/mcpHttp.d.ts +3 -0
- package/dist/server/mcpHttp.js +32 -0
- package/dist/server/mcpSpec.d.ts +2 -1
- package/dist/server/mcpSpec.js +74 -24
- package/dist/server/postSurfaces.js +3 -0
- package/dist/server/run.js +6 -1
- package/dist/server/runApi.d.ts +3 -3
- package/dist/server/runApi.js +16 -12
- package/dist/server/sqlStore.d.ts +10 -3
- package/dist/server/sqlStore.js +230 -16
- package/dist/server/types.d.ts +46 -17
- package/dist/server/types.js +34 -11
- package/extensions/mockpit.js +179 -16
- package/guide/packs/design-craft.md +35 -0
- package/guide/topics/asks.md +60 -56
- package/guide/topics/feedback.md +104 -74
- package/guide/topics/html.md +5 -11
- package/guide/topics/http.md +6 -3
- package/guide/topics/knobs.md +2 -2
- package/guide/topics/scripts.md +2 -2
- package/guide/topics/surfaces.md +28 -10
- package/package.json +1 -4
- package/skills/launch-video/SKILL.md +1 -1
- package/skills/mockpit/SKILL.md +18 -10
- package/viewer/dist/index.html +8 -7
package/README.md
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
**A design-decision loop for terminal coding agents.**
|
|
4
4
|
|
|
5
5
|
Your agent publishes a mock (a page or a component) in each of its UI states and
|
|
6
|
-
in a few parallel
|
|
7
|
-
questions beside it: pick a
|
|
8
|
-
comments on the parts it
|
|
6
|
+
in a few parallel variants. It shows up live in your browser with the agent's
|
|
7
|
+
questions beside it: pick a variant from pictures, tune the knobs it exposed, leave
|
|
8
|
+
comments on the parts it declared, then press **Send**, at your own pace. Nothing
|
|
9
9
|
the agent calls waits for you: it gets the whole batch once and revises.
|
|
10
10
|
|
|
11
11
|
<table>
|
|
@@ -13,11 +13,11 @@ the agent calls waits for you: it gets the whole batch once and revises.
|
|
|
13
13
|
<td width="50%" valign="top">
|
|
14
14
|
<picture>
|
|
15
15
|
<source media="(prefers-color-scheme: dark)" srcset="docs/mockpit-dark.png">
|
|
16
|
-
<img width="100%" alt="The Writer mock on its first question,
|
|
16
|
+
<img width="100%" alt="The Writer mock on its first question, Which variant?: the Writing state on the stage with a numbered question pin, the row of four UI states below it, and the panel offering three variants (Quiet, Dark, Editorial) as picture options" src="docs/mockpit-light.png">
|
|
17
17
|
</picture>
|
|
18
18
|
</td>
|
|
19
19
|
<td width="50%" valign="top">
|
|
20
|
-
<img width="100%" alt="Animated demo: the agent publishes the Writer mock; the user previews the three
|
|
20
|
+
<img width="100%" alt="Animated demo: the agent publishes the Writer mock; the user previews the three variants on the stage, picks Quiet, answers where the trim goes, borrows a part from another variant and presses Send; the top bar reads Sent, Not seen yet, then Delivered once the agent reads the feedback; the agent replies and publishes its next version" src="docs/mockpit-demo.gif">
|
|
21
21
|
</td>
|
|
22
22
|
</tr>
|
|
23
23
|
</table>
|
|
@@ -34,42 +34,43 @@ mockpit turns that into a design-decision loop:
|
|
|
34
34
|
|
|
35
35
|
| | sideshow | mockpit |
|
|
36
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
|
|
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
38
|
| Questions | Free-text comments | The agent asks; you answer in place, picking from pictures of each option |
|
|
39
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
|
|
41
|
-
| Feedback | Each comment reaches the agent as it's written | Picks, tuned values,
|
|
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
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`
|
|
43
|
+
| Agent verbs | Post-level: `publish`, `update`, `wait`, `comment` | Mock-level, never blocking: `publish`, `ask`, `read`, `feedback`, `say`, `edit`, `export`, `upload`, `guide`, `run` |
|
|
44
44
|
|
|
45
45
|
## The loop
|
|
46
46
|
|
|
47
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
|
-
|
|
50
|
-
2. **Ask.** The agent asks what it can't decide alone: which
|
|
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
51
|
panel goes, which of two layouts. The question lives in the mock, not in
|
|
52
52
|
chat; the agent tells you where to look and ends its turn. Options bound to
|
|
53
53
|
a variant or to knob values render as pictures; hovering one previews it on
|
|
54
54
|
the stage, clicking picks it, and the part it changed is outlined. A
|
|
55
|
-
region the agent drew several ways (a
|
|
56
|
-
per alternative) is asked about once; a
|
|
57
|
-
while that fill is chosen. Variants the agent forgot to ask about
|
|
58
|
-
built-in **Which
|
|
59
|
-
3. **Tune.** Parts the agent
|
|
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
60
|
them with the knobs it declared for each, a **Borrow** line for a part
|
|
61
|
-
another
|
|
61
|
+
another variant draws differently, plus a comment field. Presets
|
|
62
62
|
save a set of tuned values in your browser.
|
|
63
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 **
|
|
65
|
-
Revise
|
|
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
66
|
then **Delivered** once the agent has it. If it isn't picked up, tell your
|
|
67
67
|
agent you've answered.
|
|
68
|
-
5. **Revise.** The agent gets one reply (answers, tuned values,
|
|
68
|
+
5. **Revise.** The agent gets one reply (answers, tuned values, borrowed parts, comments)
|
|
69
69
|
on its next write, its next `feedback` call, or from `mockpit watch` under a
|
|
70
|
-
background monitor. It publishes the next version
|
|
71
|
-
|
|
72
|
-
|
|
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.
|
|
73
74
|
|
|
74
75
|
**Home** lists the project's mocks with a thumbnail, their states and how many
|
|
75
76
|
questions are open, with "Answer next ›" to jump to the first one. Dark and
|
|
@@ -99,7 +100,7 @@ curl -s http://localhost:8228/setup >> AGENTS.md
|
|
|
99
100
|
|
|
100
101
|
Then run `mockpit init` once per repo and ask the agent to "mock this up on
|
|
101
102
|
mockpit". No agent handy? `mockpit demo` seeds the Writer: one mock in four
|
|
102
|
-
states and three
|
|
103
|
+
states and three variants, with questions, knobs and declared parts.
|
|
103
104
|
|
|
104
105
|
MCP, the Pi extension and the Claude Code plugin are covered in
|
|
105
106
|
**[docs/connecting-agents.md](docs/connecting-agents.md)**.
|
|
@@ -138,21 +139,22 @@ There are also `terminal` (ANSI output), `image` (uploaded assets), `json`
|
|
|
138
139
|
|
|
139
140
|
## Agent verbs
|
|
140
141
|
|
|
141
|
-
|
|
142
|
+
Ten verbs, the same on every tier with the same fields: a zero-dependency CLI
|
|
142
143
|
for agents with only a shell, MCP over stdio or streamable HTTP at `/mcp`, and
|
|
143
144
|
plain HTTP. None of them waits for the user.
|
|
144
145
|
|
|
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
|
|
153
|
-
| `mockpit
|
|
154
|
-
| `mockpit
|
|
155
|
-
| `mockpit
|
|
146
|
+
| CLI | MCP | HTTP |
|
|
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` |
|
|
156
158
|
|
|
157
159
|
The CLI adds `mockpit init` (detect the repo's design system, once per repo)
|
|
158
160
|
and `mockpit watch` (one line per Send, for a background monitor).
|
|
@@ -160,32 +162,49 @@ and `mockpit watch` (one line per Send, for a background monitor).
|
|
|
160
162
|
- **`publish` is the one write.** It creates the mock, state or variant, or the
|
|
161
163
|
next version of an existing one. Send `html`, the full ordered `surfaces`
|
|
162
164
|
list (an entry that is only `{id}` keeps that surface), or `parts` to replace
|
|
163
|
-
just the
|
|
165
|
+
just the declared elements.
|
|
164
166
|
- **`feedback` returns at once** with what the user sent since the agent last
|
|
165
167
|
heard, plus `pending`: whether each mock is open in the viewer and how far the user's
|
|
166
168
|
draft has got (`2 of 3 answered`). Every write returns `feedback` too, and
|
|
167
169
|
each Send is delivered exactly once across all of them.
|
|
168
|
-
- **
|
|
169
|
-
binding them returns a nudge and a ready `suggestedAsk`.
|
|
170
|
+
- **Questions are nudged.** A publish that leaves several variants with no
|
|
171
|
+
question binding them returns a nudge and a ready `suggestedAsk`.
|
|
170
172
|
|
|
171
173
|
A typical turn:
|
|
172
174
|
|
|
173
175
|
```sh
|
|
174
176
|
mockpit publish --mock writer --state "Writing" --variant quiet --html quiet.html
|
|
175
177
|
mockpit publish --mock writer --state "Writing" --variant dark --html dark.html
|
|
176
|
-
mockpit ask --mock writer "
|
|
178
|
+
mockpit ask --mock writer "Quiet or dark?" --option Quiet=quiet --option Dark=dark
|
|
177
179
|
# the agent says where to look and ends its turn; once you've answered:
|
|
178
180
|
mockpit feedback
|
|
179
181
|
```
|
|
180
182
|
|
|
181
183
|
The running server serves the brief at `/agent-howto`: one short, project-aware
|
|
182
184
|
document an agent reads before its first publish. Reference topics (`knobs`,
|
|
183
|
-
`asks`, `surfaces`, `html`, `
|
|
185
|
+
`asks`, `surfaces`, `html`, `feedback`, `http`, `scripts`) are at
|
|
184
186
|
`/agent-howto?topic=<id>`; `/guide` is the `html` topic. `run` executes one
|
|
185
187
|
script against the same verbs on the server, so publishing variants and asking
|
|
186
188
|
take one call; `/mcp?mode=code` serves it as the only tool, for connectors
|
|
187
189
|
without a codemode of their own.
|
|
188
190
|
|
|
191
|
+
## Guidance
|
|
192
|
+
|
|
193
|
+
Agents read one brief before their first publish, in layers. Higher wins:
|
|
194
|
+
|
|
195
|
+
| Layer | Where | Who gets it |
|
|
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 |
|
|
201
|
+
|
|
202
|
+
A rules file has `## Rules` (always followed) and `## Suggestions` (aimed for),
|
|
203
|
+
and turns packs on with `packs: [design-craft]` in its frontmatter. `mockpit
|
|
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`.
|
|
207
|
+
|
|
189
208
|
## Run it anywhere
|
|
190
209
|
|
|
191
210
|
It runs locally as a small Node server (SQLite at `~/.mockpit/mockpit.db`), or on
|
|
@@ -232,12 +251,9 @@ The server app is importable from `mockpit/server` (`createApp`, `SqlStore`,
|
|
|
232
251
|
|
|
233
252
|
```sh
|
|
234
253
|
npm run dev # server with watch + viewer watch build
|
|
235
|
-
npm test # Node unit/API/store tests + viewer unit tests
|
|
236
|
-
npm run test:worker # local workerd + Durable Object integration
|
|
237
254
|
npm run typecheck # node + workers + viewer
|
|
238
255
|
npm run lint # oxlint
|
|
239
256
|
npm run format # oxfmt
|
|
240
|
-
npm run test:e2e # Playwright, chromium + webkit (bridge, mock screen, decide flow)
|
|
241
257
|
```
|
|
242
258
|
|
|
243
259
|
The architecture and contributor rules are in [AGENTS.md](AGENTS.md).
|
package/bin/demoData.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Seed content for `mockpit demo`: the Writer mock — four states of one
|
|
2
|
-
// writing app, each drawn in three
|
|
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,8 +101,8 @@ export const DEMO = {
|
|
|
101
101
|
},
|
|
102
102
|
asks: [
|
|
103
103
|
{
|
|
104
|
-
id: "
|
|
105
|
-
text: "
|
|
104
|
+
id: "tone",
|
|
105
|
+
text: "Quiet, dark or editorial?",
|
|
106
106
|
scope: "mock",
|
|
107
107
|
options: [
|
|
108
108
|
{ label: "Quiet", variant: "quiet" },
|