flatbread-cli 0.4.0 → 0.7.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 +75 -11
- package/dist/flatbread.mjs +1254 -292
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,12 +29,13 @@ flatbread share --publish # after review, upload to the signed-in si
|
|
|
29
29
|
flatbread login | logout | whoami # sign the CLI in to a site (device flow)
|
|
30
30
|
|
|
31
31
|
flatbread share --pr <url> # link the pull request this run belongs to (https)
|
|
32
|
+
flatbread share --from <n|words> # share only the part from prompt n (or the prompt with these words)
|
|
32
33
|
|
|
33
34
|
flatbread view # write the Execution Brief and CAPSULE.md beside the newest artifact
|
|
34
35
|
|
|
35
36
|
flatbread pull <id-or-url> # print a published run's Context Capsule
|
|
36
37
|
flatbread pull <id-or-url> --out <f> # or write it to a file
|
|
37
|
-
flatbread mcp # stdio MCP server: flatbread_search_traces, flatbread_get_capsule
|
|
38
|
+
flatbread mcp # stdio MCP server: flatbread_search_traces, flatbread_get_capsule, flatbread_share
|
|
38
39
|
|
|
39
40
|
flatbread hook install # offer the share at the end of a Claude Code turn
|
|
40
41
|
flatbread hook status # where it is installed, and what it has seen
|
|
@@ -113,9 +114,9 @@ moves the whole scratch directory (the store becomes `<tmp>/store`).
|
|
|
113
114
|
`flatbread login`, or set BOTH `FLATBREAD_API_URL` and `FLATBREAD_API_TOKEN`. The URL
|
|
114
115
|
and the token resolve independently, each falling back to the stored login, and a
|
|
115
116
|
STORED token is never offered to a site that did not issue it. Being signed in is not
|
|
116
|
-
permission to upload: that is what `--publish` is for. `packages/cli/src/publish.ts` is the only file
|
|
117
|
-
|
|
118
|
-
all four packages, and
|
|
117
|
+
permission to upload: that is what `--publish` is for. `packages/cli/src/publish.ts` is the only file that uploads; the
|
|
118
|
+
files allowed to make any request are a fixed list the verify suite enforces by name across
|
|
119
|
+
all four packages, and publish.ts refuses to send a token over plain `http` to anything but
|
|
119
120
|
loopback. A publish failure never invalidates the local record; it is reported.
|
|
120
121
|
|
|
121
122
|
Visibility is `private` unless a human raises it - in the review UI, or from the owner
|
|
@@ -168,15 +169,69 @@ reload the VS Code window) afterwards.
|
|
|
168
169
|
A connected tool is not a used one: in a real session the agent read the tool list and implemented
|
|
169
170
|
the fix without searching. So setup also writes a skill that says when to search - before the first
|
|
170
171
|
edit, after a failure - to `~/.claude/skills/flatbread/SKILL.md` (or under `$CLAUDE_CONFIG_DIR`) and
|
|
171
|
-
`~/.agents/skills/flatbread/SKILL.md`, the shared skills folder Codex
|
|
172
|
-
|
|
172
|
+
`~/.agents/skills/flatbread/SKILL.md`, the shared skills folder Codex, Cursor and Gemini CLI read.
|
|
173
|
+
Where Antigravity is installed it also goes inside a plugin
|
|
174
|
+
(`~/.gemini/config/plugins/flatbread/`, with its `plugin.json`), and where OpenCode is installed to
|
|
175
|
+
`~/.config/opencode/skills/flatbread/SKILL.md`. A file there that flatbread did not write is left alone.
|
|
176
|
+
|
|
177
|
+
The other agents get the MCP server too, each only if it is installed (its folder exists): Codex as a
|
|
178
|
+
`[mcp_servers.flatbread]` table in `~/.codex/config.toml` (or `$CODEX_HOME`), Cursor in
|
|
179
|
+
`~/.cursor/mcp.json`, Antigravity in `~/.gemini/config/mcp_config.json`. Same rules as Claude Code's
|
|
180
|
+
file, and in the TOML every other line, comment and table stays where it was. `--no-mcp` skips every
|
|
181
|
+
server and every skill.
|
|
182
|
+
|
|
183
|
+
### Share this run from the chat (agent first)
|
|
184
|
+
|
|
185
|
+
When a run went well, say so in the same chat: "share this run", "share to flatbread", or
|
|
186
|
+
"flatbread share". The skill tells the agent to call the MCP tool `flatbread_share`. Flatbread
|
|
187
|
+
finds this session, parses and scans it in the background, and opens the review page in your
|
|
188
|
+
browser. The agent's reply says the page is open; nothing has been saved or uploaded yet.
|
|
189
|
+
|
|
190
|
+
- **Confirm is the only gate.** You read the matches, pick what to keep and the visibility, then
|
|
191
|
+
Confirm. Cancel, or no answer within 30 minutes, keeps nothing.
|
|
192
|
+
- **The page you land on is the receipt:** the link when it was uploaded (or why it was not -
|
|
193
|
+
not signed in, no site set, the upload failed), the run's ID, and its manage token, shown
|
|
194
|
+
once. The agent is never sent the token.
|
|
195
|
+
- **The share request is not part of the run.** The last turn's `flatbread_share` call is cut,
|
|
196
|
+
and so is the prompt that only asked for it. "Fix it, then share it" keeps the fix.
|
|
197
|
+
- **A part of a long session:** "share this run from the prompt where I asked about the retry
|
|
198
|
+
helper" - the agent passes `from` as a prompt number or words from that prompt, and the run
|
|
199
|
+
starts there. The page has a **Starts at** list to change it before Confirm. Words that match
|
|
200
|
+
no prompt, or more than one, come back to the agent as the list of prompts to choose from.
|
|
201
|
+
- **One review at a time.** Asking again while a page is open returns that same page.
|
|
202
|
+
- `publish: false` keeps it on this machine; the default uploads on Confirm when this machine is
|
|
203
|
+
signed in (`flatbread login`).
|
|
204
|
+
|
|
205
|
+
How the session is found: first by the session ID the agent puts in its environment
|
|
206
|
+
(`CLAUDE_CODE_SESSION_ID`, `CODEX_SESSION_ID`), when the MCP server can see it - not yet
|
|
207
|
+
measured, so it is not relied on; then the newest session of this folder; then the newest
|
|
208
|
+
session of the agent named in `harness`. The review page says which one it took ("Found as").
|
|
209
|
+
|
|
210
|
+
The same thing by hand: `flatbread share` (newest session), `flatbread share --from 7`.
|
|
211
|
+
|
|
212
|
+
### When your agent skips Flatbread
|
|
213
|
+
|
|
214
|
+
The skill makes searching likely, not certain. Measured on 2026-10-19 with the same folder and
|
|
215
|
+
the same sentence: Codex read the skill and searched before its first edit; Claude Code (Sonnet
|
|
216
|
+
5.5) had the skill loaded and went straight to the edit. Flatbread does not search on every prompt
|
|
217
|
+
by itself, on purpose: that would send each prompt's words to the site whether or not you wanted a
|
|
218
|
+
search, add a network round trip before every reply, spend a call on prompts that need none, and
|
|
219
|
+
put unrelated runs into the agent's context. So when it matters, ask for it:
|
|
220
|
+
|
|
221
|
+
- say it in the prompt: "Search Flatbread first, then fix the retry helper in app.ts", or
|
|
222
|
+
"use the flatbread skill";
|
|
223
|
+
- or add one line to the project's `CLAUDE.md` (Claude Code), `AGENTS.md` (Codex, Cursor) or
|
|
224
|
+
your agent's own rules file, so every session there gets it:
|
|
225
|
+
`Before your first edit, search Flatbread (flatbread_search_traces) for a run that already did this task.`
|
|
173
226
|
|
|
174
227
|
`setup --dry-run` writes nothing. `setup --uninstall` removes the handlers, the MCP entry, the skill and
|
|
175
228
|
the hook, and puts a chained hook back byte for byte. `FLATBREAD_HOOK_DISABLED=1` stops every capture.
|
|
176
229
|
|
|
177
230
|
`flatbread search <words>` answers from this machine's shared runs, its captured runs, then the
|
|
178
231
|
site - the same text the MCP tool returns. Words are matched as typed, and by stem ("retry" finds
|
|
179
|
-
"retries" and "retrying").
|
|
232
|
+
"retries" and "retrying"). When no run has every word, the runs sharing the most of them are
|
|
233
|
+
listed under `Closest, by words in common`, each with how many it shares - an agent words a
|
|
234
|
+
task as a task, not as a title. `--local` leaves the site out; a site that did not answer is said, and
|
|
180
235
|
exits 1.
|
|
181
236
|
|
|
182
237
|
`pull` and `mcp` only read. A token from `flatbread login` goes only to the site that issued it;
|
|
@@ -302,9 +357,10 @@ another codebase, and no copy should ever suggest it does.
|
|
|
302
357
|
|
|
303
358
|
# Sharing: `flatbread share`
|
|
304
359
|
|
|
305
|
-
The command exists to put a human gate in front of the data.
|
|
306
|
-
|
|
307
|
-
|
|
360
|
+
The command exists to put a human gate in front of the data. Nothing leaves the
|
|
361
|
+
machine before Confirm: the review runs offline, and only a fixed list of files may
|
|
362
|
+
make a request at all (upload, sign-in, search, pull), which a test asserts by
|
|
363
|
+
grepping the sources.
|
|
308
364
|
|
|
309
365
|
```
|
|
310
366
|
parse the session -> scan every string -> review in the browser -> write a sanitized draft
|
|
@@ -318,7 +374,9 @@ parse the session -> scan every string -> review in the browser -> write a
|
|
|
318
374
|
3. Serve one page on `http://127.0.0.1:4321` (then 4322-4325 if busy).
|
|
319
375
|
4. You tick any match to KEEP its original text; everything else is redacted.
|
|
320
376
|
5. You pick visibility: `private` (default), `unlisted`, `public`.
|
|
321
|
-
6. Confirm writes `packages/cli/.tmp/last-share.json
|
|
377
|
+
6. Confirm writes `packages/cli/.tmp/last-share.json`, keeps the run under its own ID, and
|
|
378
|
+
with `--publish` (or from the agent's `flatbread_share`) uploads it. Cancel writes nothing.
|
|
379
|
+
7. `--from <n|words>` starts the run at that prompt; the page can change it before Confirm.
|
|
322
380
|
|
|
323
381
|
## The redaction engine
|
|
324
382
|
|
|
@@ -391,6 +449,12 @@ An offline machine can run the whole review.
|
|
|
391
449
|
- **Side:** every match with a rule label, a preview of the original capped at 24
|
|
392
450
|
characters, and the field path. `redact all` / `keep all` buttons, the visibility
|
|
393
451
|
radio, and Confirm / Cancel.
|
|
452
|
+
- **Starts at:** when the session has more than one prompt, a list of them; picking one
|
|
453
|
+
reloads the page for the part from that prompt (`?from=N`). A start it did not offer is
|
|
454
|
+
refused (400).
|
|
455
|
+
- **After Confirm:** a receipt - "Shared" with the link, or "Saved on this machine" with the
|
|
456
|
+
reason nothing was uploaded - plus the run's ID and its manage token, shown once. A second
|
|
457
|
+
Confirm is refused (409).
|
|
394
458
|
|
|
395
459
|
The page shows unredacted secrets when you tick KEEP, by design — you cannot
|
|
396
460
|
review what you cannot see. That is why it binds `127.0.0.1` only and is never
|