proofed-cli 0.2.0 → 0.2.2

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 CHANGED
@@ -1,340 +1,127 @@
1
1
  <div align="center">
2
2
 
3
- <img src="https://raw.githubusercontent.com/t1dem/proofed/main/site/public/favicon.svg" width="64" alt="">
3
+ <img src="https://raw.githubusercontent.com/t1dem/proofed/main/site/public/favicon.svg" width="56" alt="">
4
4
 
5
5
  # Proofed
6
6
 
7
- **Check the user flows a pull request touches before you merge it.**
7
+ **Kane CLI opens the app from a pull request and checks that its user flows work.<br>When a flow breaks, an agent fixes the code. Only a fix that Kane has checked lands in the PR.**
8
8
 
9
- Kane CLI runs the user flows a pull request touches. Proofed posts local recordings or cloud recording notes on the PR.<br>
10
- When a flow breaks, Claude Code or OpenAI Codex fixes it, and the fix is pushed only after Kane has watched it pass.
9
+ <!-- video: put "[**▶ Video (3 min)**](URL) · " at the start of the next line -->
10
+ [**Recorded run (1 min)**](https://proofed.neptunescodm.workers.dev/try/9) · [Break it yourself (live, 8–14 min)](https://proofed.neptunescodm.workers.dev/try) · [Install](https://proofed.neptunescodm.workers.dev/install) · [For judges](#for-judges)
11
11
 
12
- [Website](https://proofed.neptunescodm.workers.dev) · [**Break it yourself**](https://proofed.neptunescodm.workers.dev/try) · [Dashboard demo](https://proofed.neptunescodm.workers.dev/app?demo) · [Install on GitHub](https://proofed.neptunescodm.workers.dev/install) · [CLI](#locally-and-from-an-ai-agent)
12
+ [![Test CLI](https://github.com/t1dem/proofed/actions/workflows/test.yml/badge.svg)](https://github.com/t1dem/proofed/actions/workflows/test.yml) [![npm](https://img.shields.io/npm/v/proofed-cli)](https://www.npmjs.com/package/proofed-cli)
13
13
 
14
- <sub>Built for the Kane CLI hackathon, November 2026.</sub>
15
-
16
- <br>
17
-
18
- <img src="https://raw.githubusercontent.com/t1dem/proofed/main/docs/devices.png" width="880" alt="The Proofed dashboard in a browser and on a phone: pull requests grouped into Needs you, Kane is checking, Claude is fixing and Passed">
14
+ <img src="https://raw.githubusercontent.com/t1dem/proofed/main/docs/devices.png" width="880" alt="The Proofed dashboard in a browser and on a phone, on sample data: pull requests grouped into Needs you, Kane is checking, Fixing and Passed">
19
15
 
20
16
  </div>
21
17
 
22
- <br>
23
-
24
- <table>
25
- <tr>
26
- <th width="50%">✗ Kane catches the break</th>
27
- <th width="50%">✓ Kane confirms Claude's fix</th>
28
- </tr>
29
- <tr>
30
- <td><img src="https://github.com/t1dem/proofed-demo-store/raw/proofed-clips/pr-12/c1aaa79-43757307941/free-shipping.gif" alt="Kane opens the bag: a €44.50 order ships free"></td>
31
- <td><img src="https://github.com/t1dem/proofed-demo-store/raw/proofed-clips/pr-12/f54f1b5-43757307941/free-shipping.gif" alt="Kane opens the bag after the fix: shipping is €4.90, then Free above €50"></td>
32
- </tr>
33
- <tr>
34
- <td>A €44.50 bag ships free, though free shipping starts at €50.</td>
35
- <td>Claude changed one line in <code>src/pricing.ts</code>. Shipping is €4.90 again.</td>
36
- </tr>
37
- </table>
38
-
39
- <p align="center"><sub>From <a href="https://github.com/t1dem/proofed-demo-store/pull/12">demo-store #12</a>: 8.5 minutes from opening the pull request to the fixed report.</sub></p>
40
-
41
- ## For judges
42
-
43
- Four pull requests on the [demo store](https://github.com/t1dem/proofed-demo-store) each break one flow. All four have already run:
44
-
45
- | PR | What Kane found | What happened next |
18
+ | Web · [Excalidraw #11974](https://github.com/excalidraw/excalidraw/pull/11974) | Android · [AnkiDroid #20889](https://github.com/ankidroid/Anki-Android/pull/20889) | Electron · [MarkText #5276](https://github.com/marktext/marktext/pull/5276) |
46
19
  |---|---|---|
47
- | [#5](https://github.com/t1dem/proofed-demo-store/pull/5) | The promo code `welcome10` in lowercase is rejected | Fixed on the first attempt ([`c242f6c`](https://github.com/t1dem/proofed-demo-store/commit/c242f6c)) |
48
- | [#9](https://github.com/t1dem/proofed-demo-store/pull/9) | The confirmation page charges €13.00 instead of €17.90 | Kane rejected the first attempt, the second passed ([`f9fa5a6`](https://github.com/t1dem/proofed-demo-store/commit/f9fa5a6)) |
49
- | [#11](https://github.com/t1dem/proofed-demo-store/pull/11) | The + button in the bag leaves the quantity at 1 | Fixed on the first attempt ([`9999a0d`](https://github.com/t1dem/proofed-demo-store/commit/9999a0d)), 8.5 minutes |
50
- | [#12](https://github.com/t1dem/proofed-demo-store/pull/12) | A €44.50 bag ships free | Fixed on the first attempt ([`f54f1b5`](https://github.com/t1dem/proofed-demo-store/commit/f54f1b5)), 8.5 minutes |
51
-
52
- To watch one run live, open [Break it yourself](https://proofed.neptunescodm.workers.dev/try). It needs no account and takes 8 to 14 minutes.
20
+ | <img src="https://github.com/t1dem/excalidraw/raw/proofed-clips/pr-1/af2468d-44301665790/dismiss-menus.gif" width="290" alt="Kane clicks the canvas, the main menu stays open"> | <img src="https://github.com/t1dem/Anki-Android/raw/proofed-clips/pr-1/76f468b-44372076531/select-deck-in-browser-search.gif" width="290" alt="Kane picks All decks, the filter doesn't change"> | <img src="https://github.com/t1dem/marktext/raw/proofed-clips/pr-1/d3b59fb-44369043777/heading-fold-across-tabs.gif" width="290" alt="Kane switches tabs, the folded heading unfolds"> |
21
+ | The main menu stays open after a click on the canvas. Codex fixed it, [Kane confirmed](https://github.com/t1dem/excalidraw/pull/1). | A deck picked in search doesn't change the filter. Codex fixed it, [Kane confirmed](https://github.com/t1dem/Anki-Android/pull/1). | A folded heading unfolds after switching tabs. Codex fixed it, [Kane confirmed](https://github.com/t1dem/marktext/pull/1). |
53
22
 
54
- <img src="https://raw.githubusercontent.com/t1dem/proofed/main/docs/try-run.jpg" alt="A finished run on /try: Kane caught a break, Claude fixed it, Kane confirmed. The fix and a before and after comparison of the page.">
23
+ <p align="center"><sub>Three of nine merged open-source pull requests that shipped a bug. <a href="#bugs-from-real-projects">All nine</a>.<br>Built with Codex, Claude Code and Factory Droid for the <a href="https://www.kaneclihack.sh/">KaneCLI Online Hackathon</a>, November 12–26, 2026. Kane CLI 0.10.4.</sub></p>
55
24
 
56
- To run Proofed on your machine, with a signed-in [Kane CLI](https://www.npmjs.com/package/@testmuai/kane-cli), Node 22.18+, Chrome, ffmpeg and pnpm (`npm install -g pnpm`):
57
-
58
- ```sh
59
- git clone https://github.com/t1dem/proofed-demo-store
60
- cd proofed-demo-store
61
- npx proofed-cli check "the promo code welcome10 takes 10% off"
62
- ```
25
+ ## For judges
63
26
 
64
- The [dashboard demo](https://proofed.neptunescodm.workers.dev/app?demo) needs no sign-in. In [demo-store #11](https://github.com/t1dem/proofed-demo-store/pull/11#issuecomment-6897672103), Kane caught a broken quantity button, Claude fixed it, and Kane confirmed both affected scenarios passed. Proofed also checks its own pull requests.
27
+ | Criterion | Where to look | Time |
28
+ |---|---|---|
29
+ | **Bar 1: runs end to end** | [Recorded run](https://proofed.neptunescodm.workers.dev/try/9): a PR is opened, Kane catches the bug, Claude fixes it, Kane confirms. Or [run it yourself](https://proofed.neptunescodm.workers.dev/try), no account needed | 1 min · 8–14 min |
30
+ | **Bar 2: Kane caught something** | [Nine regressions](#bugs-from-real-projects) that maintainers merged: web, Android and Electron | 2 min |
31
+ | **Bar 3 and Closed loop: the agent and Kane talked to each other** | [demo-store #9](https://github.com/t1dem/proofed-demo-store/pull/9): Kane rejected Claude's first fix, the second one passed and landed in the PR | 1 min |
32
+ | **Ships** | GitHub App, Action, [`proofed-cli`](https://www.npmjs.com/package/proofed-cli) on npm, MCP server, Stop hook for Claude Code | |
33
+ | **Verified** | Kane caught 13 bugs out of 13 and confirmed 13 fixes: nine in open-source projects and four in the demo store. A Kane pass without a check, or a pass the page text contradicts, is marked "not checked". [Six Kane failures and what we do about them](#what-we-ran-into-with-kane-cli) | 2 min |
34
+ | **Craft** | Three steps to a PR with the setup and scenarios Kane has already passed: sign in, save the keys, install the GitHub App. `--dry-run` is free. A PR that touches no scenario costs 0 credits | |
35
+ | **Three roles of Kane** | Checks every PR. Works inside the agent's session through `proofed check`, MCP and the Stop hook. Checked this repository's own PRs: 52 runs | |
65
36
 
66
- ### Bugs from real projects
37
+ ## Bugs from real projects
67
38
 
68
- Nine merged pull requests from open-source projects, each of which shipped a bug that was fixed upstream later. Each one is replayed in a copy of its repository with Proofed added. On every replay Kane caught the bug, Codex GPT-6.2 Sol at medium effort fixed it, and Kane checked the fix before it was pushed to the PR.
39
+ Nine merged pull requests from open-source projects. Each one shipped a bug that the maintainers fixed later. For each project we wrote one scenario for the broken user flow and replayed the PR in a copy of the repository with Proofed. In all nine cases Kane caught the bug, Codex GPT-6.2 Sol (medium) fixed it, and Kane checked the fix before it landed in the PR.
69
40
 
70
- | Pull request | Target | What broke | Replay with Proofed | Fixed upstream |
71
- |---|---|---|---|---|
72
- | [omni-tools #32](https://github.com/iib0011/omni-tools/pull/32) | Web | The numbers 1, 2 and 4 on separate lines add up to 0 instead of 7 | [Caught, fixed on the first attempt](https://github.com/t1dem/omni-tools/pull/1) | [#428](https://github.com/iib0011/omni-tools/pull/428), 567 days later |
73
- | [frontend-mini-challenges #264](https://github.com/sadanandpai/frontend-mini-challenges/pull/264) | Web | Delete leaves the todo item in the list | [Caught, fixed on the first attempt](https://github.com/t1dem/frontend-mini-challenges/pull/1) | [#338](https://github.com/sadanandpai/frontend-mini-challenges/pull/338), 28 days later |
74
- | [Excalidraw #11974](https://github.com/excalidraw/excalidraw/pull/11974) | Web | The main menu stays open after a click on the canvas | [Caught, fixed on the first attempt](https://github.com/t1dem/excalidraw/pull/1) | [#12053](https://github.com/excalidraw/excalidraw/pull/12053), 12 days later |
75
- | [OpenCalc #520](https://github.com/Darkempire78/OpenCalc/pull/520) | Android emulator | A decimal point typed into the first number of 2×0.5 is ignored | [Caught, fixed on the second attempt](https://github.com/t1dem/OpenCalc/pull/1) | [#538](https://github.com/Darkempire78/OpenCalc/pull/538), 81 days later |
76
- | [Quillpad #396](https://github.com/quillpad/quillpad/pull/396) | Android emulator | Back in a note sends the app to the background instead of the notes list | [Caught, fixed on the first attempt](https://github.com/t1dem/quillpad/pull/1) | [#406](https://github.com/quillpad/quillpad/pull/406), 24 days later |
77
- | [AnkiDroid #20889](https://github.com/ankidroid/Anki-Android/pull/20889) | Android emulator | A deck picked in the card browser search doesn't change the deck filter | [Caught, fixed on the first attempt](https://github.com/t1dem/Anki-Android/pull/1) | [#23110](https://github.com/ankidroid/Anki-Android/pull/23110), 180 days later |
78
- | [Zettlr #6001](https://github.com/Zettlr/Zettlr/pull/6001) | Electron | A blank line between paragraphs loses its ¶ mark | [Caught, fixed on the first attempt](https://github.com/t1dem/Zettlr/pull/1) | [#6024](https://github.com/Zettlr/Zettlr/pull/6024), 7 days later |
79
- | [Zettlr #6031](https://github.com/Zettlr/Zettlr/pull/6031) | Electron | Typing an empty Pandoc span turns off the highlighting in the note | [Caught, fixed on the first attempt](https://github.com/t1dem/zettlr-pandoc/pull/1) | [#6448](https://github.com/Zettlr/Zettlr/pull/6448), 211 days later |
80
- | [MarkText #5276](https://github.com/marktext/marktext/pull/5276) | Electron | A folded heading unfolds after switching tabs | [Caught, fixed on the first attempt](https://github.com/t1dem/marktext/pull/1) | [#6060](https://github.com/marktext/marktext/pull/6060), 24 days later |
41
+ | PR | Where | What broke | Fix by the agent and the maintainers |
42
+ |---|---|---|---|
43
+ | [omni-tools #32](https://github.com/iib0011/omni-tools/pull/32) | Web | [1, 2 and 4 on separate lines add up to 0 instead of 7](https://github.com/t1dem/omni-tools/pull/1) | Agent: +1 −1. The maintainers rewrote the function and added a test ([#428](https://github.com/iib0011/omni-tools/pull/428), 567 days later) |
44
+ | [frontend-mini-challenges #264](https://github.com/sadanandpai/frontend-mini-challenges/pull/264) | Web | [A deleted task stays in the list](https://github.com/t1dem/frontend-mini-challenges/pull/1) | Agent: +3 −3. The maintainers also reworked the component ([#338](https://github.com/sadanandpai/frontend-mini-challenges/pull/338), 28 days later) |
45
+ | [Excalidraw #11974](https://github.com/excalidraw/excalidraw/pull/11974) | Web | [The main menu stays open after a click on the canvas](https://github.com/t1dem/excalidraw/pull/1) | The maintainers added a test ([#12053](https://github.com/excalidraw/excalidraw/pull/12053), 12 days later) |
46
+ | [OpenCalc #520](https://github.com/Darkempire78/OpenCalc/pull/520) | Android | [The decimal point in the first number of 2×0.5 is ignored](https://github.com/t1dem/OpenCalc/pull/1) | [#538](https://github.com/Darkempire78/OpenCalc/pull/538), 81 days later |
47
+ | [Quillpad #396](https://github.com/quillpad/quillpad/pull/396) | Android | [Back in a note sends the app to the background instead of the notes list](https://github.com/t1dem/quillpad/pull/1) | The same +2 lines ([#406](https://github.com/quillpad/quillpad/pull/406), 24 days later) |
48
+ | [AnkiDroid #20889](https://github.com/ankidroid/Anki-Android/pull/20889) | Android | [A deck picked in the card browser search doesn't change the filter](https://github.com/t1dem/Anki-Android/pull/1) | The maintainers added a test ([#23110](https://github.com/ankidroid/Anki-Android/pull/23110), 180 days later) |
49
+ | [Zettlr #6001](https://github.com/Zettlr/Zettlr/pull/6001) | Electron | [A blank line between paragraphs loses its ¶ mark](https://github.com/t1dem/Zettlr/pull/1) | [#6024](https://github.com/Zettlr/Zettlr/pull/6024), 7 days later |
50
+ | [Zettlr #6031](https://github.com/Zettlr/Zettlr/pull/6031) | Electron | [An empty Pandoc span turns off highlighting in the note](https://github.com/t1dem/zettlr-pandoc/pull/1) | [#6448](https://github.com/Zettlr/Zettlr/pull/6448), 211 days later |
51
+ | [MarkText #5276](https://github.com/marktext/marktext/pull/5276) | Electron | [A folded heading unfolds after switching tabs](https://github.com/t1dem/marktext/pull/1) | The maintainers added tests ([#6060](https://github.com/marktext/marktext/pull/6060), 24 days later) |
81
52
 
82
- The web replays ran on GitHub's Ubuntu runners. The Android and Electron replays ran on a self-hosted Apple Silicon Mac, Android on an Android 14 emulator.
53
+ In eight of the nine cases the agent edited the same files as the maintainers. In MarkText it also changed `store/editor.ts`. In four cases the maintainers added a test along with the fix; the agent wrote no tests. The web replays ran on GitHub's Ubuntu runners, Android and Electron on our own Apple Silicon Mac (Android 14 in the emulator).
83
54
 
84
- ## How it works
55
+ ## Demo store
85
56
 
86
- <picture>
87
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/t1dem/proofed/main/docs/flow-dark.svg">
88
- <img src="https://raw.githubusercontent.com/t1dem/proofed/main/docs/flow-light.svg" alt="Pull request, then Kane runs the flows it touches in Chrome, then a report with clips on the PR. If a flow broke, Claude fixes it and Kane re-checks; the fix is pushed on a pass, otherwise Claude tries again, up to 3 times.">
89
- </picture>
57
+ Four PRs in the [demo store](https://github.com/t1dem/proofed-demo-store), each hiding a bug in an ordinary-looking change. Kane caught all four bugs and confirmed all four of the agent's fixes.
90
58
 
91
- - Only the scenarios whose `paths` the diff touches run.
92
- - For web, a start page that crashes on load fails at once, with the browser's error and a screenshot, at no Kane credits.
93
- - For web, Kane doesn't record video, so Proofed records Chrome itself. The clip cuts the waiting, shows where Kane clicked and zooms in on what it checks.
94
- - When Kane blames the test without a failed assertion, the scenario shows as "not checked". A failed check that Kane blames on the scenario runs a second time; two failures stay failed.
95
- - A fix starts when someone ticks **Fix with Claude** or **Fix with Codex**, or on its own with [Fix automatically](#fix-automatically) on.
96
- - Each attempt rebuilds and re-checks the broken flows and affected neighbors. The final check reuses the last attempt's results on the same tree and rebuilds only when scenarios still need to run, before committing and pushing.
97
- - The fix commit's `Fixed-by:` line names the model.
98
-
99
- ## Scenarios
100
-
101
- One Markdown file per flow in `.proofed/scenarios/`, in plain English. `paths` says which files it guards; without it, the scenario runs on every PR.
102
-
103
- ```md
104
- ---
105
- name: Promo code total
106
- paths: [src/pricing.ts, src/pages/Cart.tsx]
107
- url: /
108
- ---
109
- Add Ethiopia Guji to the bag twice and the Hand Grinder once.
110
- Open the bag, type the promo code welcome10 in lowercase and apply it.
111
- Check that the discount is −€9.10, shipping is Free and the total is €81.90.
112
- ```
113
-
114
- Put the exact text the page should show in quotes in the last check (`Check that the total is "€81.90".`): Proofed then compares it with the page itself ([Text checks](#text-checks-and-uncertain-passes)).
115
-
116
- ## Commands
117
-
118
- Comment on a PR. Only people with write access can run them.
119
-
120
- | Comment | What happens |
59
+ | PR | What Kane found |
121
60
  |---|---|
122
- | `/proofed` | Check the PR again |
123
- | `/proofed <what to check>` | Kane checks just that, e.g. `/proofed the kettle goes into the bag at €45.00` |
124
- | `/proofed fix` | Fix with the repository's selected provider and model |
125
- | `/proofed fix opus high` | This one fix with Claude Opus at high effort |
126
- | `/proofed fix sol high` | This one fix with Codex GPT-6.2 Sol at high effort |
127
- | `/proofed fix codex` | This one fix with Codex GPT-6.2 Sol |
61
+ | [#5](https://github.com/t1dem/proofed-demo-store/pull/5) | The promo code `welcome10` in lowercase is rejected |
62
+ | [#9](https://github.com/t1dem/proofed-demo-store/pull/9) | The confirmation page charges €13.00 instead of €17.90 |
63
+ | [#11](https://github.com/t1dem/proofed-demo-store/pull/11) | The + button in the bag leaves the quantity at 1 |
64
+ | [#12](https://github.com/t1dem/proofed-demo-store/pull/12) | A €44.50 bag ships free, though free shipping starts at €50 |
128
65
 
129
- The repo's provider, model and effort are set in the [dashboard](https://proofed.neptunescodm.workers.dev/app), under Settings in the repo's model menu. The two icons switch between Claude and Codex. Without a choice, fixes use Claude Haiku 5.5 at xhigh effort. The same choice writes scenarios on the setup PR.
66
+ ## Install
130
67
 
131
- ## Fix automatically
132
-
133
- By default a fix waits for someone to tick **Fix with Claude** or **Fix with Codex**. With **Fix automatically** on, it starts as soon as Kane sees a scenario fail. It doesn't start:
134
-
135
- - on draft pull requests,
136
- - on pushes by bots, so the fixer's own commit doesn't start another fix,
137
- - on a run Kane marked "not checked".
68
+ 1. Sign in at [proofed.neptunescodm.workers.dev](https://proofed.neptunescodm.workers.dev/app) and save your TestMu keys and a Claude token or OpenAI API key.
69
+ 2. Install the [GitHub App](https://proofed.neptunescodm.workers.dev/install) on a repository. Proofed opens a PR with the workflow and saves the keys as encrypted GitHub Actions secrets (Settings → Secrets and variables → Actions).
70
+ 3. In that PR the agent writes up to five scenarios for the app's main flows. Only the ones Kane passed are committed.
138
71
 
139
- In the [dashboard](https://proofed.neptunescodm.workers.dev/app), open Settings, click the model menu in the repo's row (it reads like "Haiku 5.5 · xhigh") and turn on **Fix automatically** at the bottom. Or with the GitHub CLI:
72
+ Locally and from an agent:
140
73
 
141
74
  ```sh
142
- gh variable set PROOFED_AUTOFIX --body true --repo owner/repo # on
143
- gh variable delete PROOFED_AUTOFIX --repo owner/repo # off
144
- ```
145
-
146
- ## Locally and from an AI agent
147
-
148
- `proofed check` runs the same check on your machine, against the change you haven't pushed yet: the scenarios its files touch, with Kane CLI on their configured targets. A coding agent can run it before it says a UI change is done.
149
-
150
- Web checks need Node 22.18 or later, Chrome, [Kane CLI](https://www.npmjs.com/package/@testmuai/kane-cli) signed in (`kane-cli login`) and ffmpeg for the clips.
151
-
152
- Install it with `npm install -g proofed-cli` (or `pnpm add -g`, `bun add -g`), or run it once with `npx proofed-cli`.
153
-
154
- The command is `proofed`. Run `proofed doctor` to see what's missing. The package ships built JavaScript and has no install scripts. From a clone, `npm link` runs the TypeScript source instead.
155
-
156
- In the app's repo:
157
-
158
- | Command | What it does |
159
- |---|---|
160
- | `proofed doctor` | Checks Node, Git, the scenarios, Kane CLI and its login, credits, Chrome, ffmpeg and the app, each with a fix |
161
- | `proofed list` | Every scenario, whether the change touches it and whether its pass is cached |
162
- | `proofed check` | Runs the scenarios the change touches; `proofed check "the cart total updates"` checks just that |
163
-
164
- In a repo that already runs Proofed on its PRs, `proofed check` needs no flags. `--dry-run` shows what would run and the credit estimate, for free. How the check finds the app, the exit codes, the JSON output and a sample run are in [docs/cli.md](https://github.com/t1dem/proofed/blob/main/docs/cli.md).
165
-
166
- For an agent, add this to the app's `AGENTS.md` or `CLAUDE.md`:
167
-
168
- ```md
169
- ## Checking UI changes
170
-
171
- Run the one command the task needs; `proofed check` checks its own setup first.
172
- - Check the change: `proofed check --json`. One scenario: `proofed check --only <id> --json`.
173
- - A behavior no scenario covers: `proofed check "<what>" --json`.
174
- - To plan without spending credits, add `--dry-run`: it shows what would run and `estimatedCredits`.
175
- - Only to ask which scenarios a change touches and their cost: `proofed list --json`.
176
- - Only for setup questions: `proofed doctor --json`.
177
- Allow at least 10 minutes for a check. stdout is one JSON document; progress is on stderr.
178
- Exit 0: passed or nothing ran. On `failed`, read `reason` and `diagnosis`, fix and run `rerun`.
179
- `failedCheck: "scenario_doubted"` is Kane's opinion: review the scenario's expectations.
180
- `not_checked` is not a pass. On `error`, retry `rerun` once. Exit 3: follow `error.fix`.
181
- Checks spend Kane credits; planning does not. Use `--no-retry` when another attempt is forbidden.
75
+ npx proofed-cli check # the scenarios the current change touches
76
+ npx proofed-cli check --dry-run # what would run and how many credits, for free
182
77
  ```
183
78
 
184
- ### MCP and the Claude Code Stop hook
185
-
186
- Start your editor or MCP client in the app's repository root. In Claude Code, add this to the project's `.mcp.json`.
79
+ For Claude Code, add this to the project's `.mcp.json`:
187
80
 
188
81
  ```json
189
82
  {"mcpServers":{"proofed":{"command":"npx","args":["-y","proofed-cli","mcp"]}}}
190
83
  ```
191
84
 
192
- For Codex, add this to `config.toml`.
193
-
194
- ```toml
195
- [mcp_servers.proofed]
196
- command = "npx"
197
- args = ["-y", "proofed-cli", "mcp"]
198
- tool_timeout_sec = 900
199
- ```
200
-
201
- To run affected checks automatically when Claude Code is about to stop, add this to `.claude/settings.json`.
202
-
203
- ```json
204
- {
205
- "hooks": {
206
- "Stop": [
207
- {"hooks": [{"type": "command", "command": "npx -y proofed-cli hook claude-stop", "timeout": 900}]}
208
- ]
209
- }
210
- }
211
- ```
212
-
213
- `proofed_list`, `proofed_doctor` and dry runs are free. Checks spend Kane credits unless the pass is cached. The Stop hook asks Claude to continue after a failure, up to three times per session. See [agent setup and behavior](docs/cli.md#mcp-and-the-claude-code-stop-hook).
214
-
215
- ## Setup
216
-
217
- 1. Sign in at [proofed.neptunescodm.workers.dev](https://proofed.neptunescodm.workers.dev/app) and save your TestMu keys and a Claude token or OpenAI API key.
218
- 2. Install the GitHub App on a repo. Proofed opens a PR with the workflow and puts the keys into the repo's secrets.
219
- 3. On that PR, the selected provider writes up to five scenarios for the app's main flows. Only the ones Kane saw pass are committed.
220
-
221
- One-click setup detects Gradle Android apps and configures checks on real cloud devices. This setup is not yet verified on a real device plan.
222
-
223
- A web scenario takes 1 to 4 minutes and is estimated at 30 Kane credits the first time. Mobile and desktop costs are unknown without history. A fix attempt re-runs the broken scenarios and affected neighboring scenarios before pushing.
224
-
225
- <details>
226
- <summary><b>Setting it up by hand</b></summary>
227
-
228
- <br>
229
-
230
- Add `LT_USERNAME` and `LT_ACCESS_KEY` (TestMu: Settings → Keys) and either `CLAUDE_CODE_OAUTH_TOKEN` (from `claude setup-token`) or `CODEX_API_KEY` (an OpenAI API key) to the repo secrets. If you use Codex, choose a Codex model in Proofed's repository settings or set the repository Actions variable `PROOFED_PROVIDER` to `codex` before running the workflow.
231
-
232
- Then add one workflow. The whole file, working, is [proofed-demo-store's](https://github.com/t1dem/proofed-demo-store/blob/main/.github/workflows/proofed.yml); the part that matters:
233
-
234
- ```yaml
235
- on:
236
- pull_request:
237
- issue_comment:
238
- types: [created, edited]
239
- permissions: { contents: write, pull-requests: write, issues: write, statuses: write, id-token: write }
240
- jobs:
241
- proofed:
242
- if: # PR events, /proofed comments from people with write access, and a ticked box (see the demo store)
243
- runs-on: ubuntu-latest
244
- concurrency:
245
- group: proofed-${{ github.event.pull_request.number || github.event.issue.number }}
246
- # A new push cancels a stale check, but not the push of the fix: that run waits for the fix run.
247
- cancel-in-progress: ${{ github.event_name == 'pull_request' && github.actor != 'proofed-by-kane[bot]' }}
248
- steps:
249
- - uses: t1dem/proofed@main
250
- with:
251
- url: http://localhost:4173
252
- install: npm ci
253
- build: npm run build
254
- serve: npm run preview
255
- lt-username: ${{ secrets.LT_USERNAME }}
256
- lt-access-key: ${{ secrets.LT_ACCESS_KEY }}
257
- claude-code-oauth-token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
258
- codex-api-key: ${{ secrets.CODEX_API_KEY }}
259
- vars: ${{ toJSON(vars) }}
260
- ```
261
-
262
- - `vars` hands the action every Actions variable of the repo, so a new setting from the dashboard works without editing the workflow.
263
- - `id-token: write` lets the fixer push the fix commit as the Proofed GitHub App, so your other workflows run on the fix commit without waiting for approval. Without it the fix is pushed with `GITHUB_TOKEN`.
264
- - Clips go to a `proofed-clips` branch of the same repo, so the GIFs render in the comment with no storage of your own, in private repos too.
265
- - Claude aliases: `haiku`, `sonnet`, `opus`, `fable`. A version such as `opus 5.1` and full Claude IDs are accepted. Effort: `low`, `medium`, `high`, `xhigh`, `max`.
266
- - Codex aliases: `sol`, `terra`, `astra`, `luna`. Full IDs: `gpt-6.2-sol`, `gpt-6.1-sol`, `gpt-6.1-terra`, `gpt-6-astra`, `gpt-6-luna`. Effort: `low`, `medium`, `high`, `xhigh`, `max`; Sol, Terra and Astra also accept `ultra`.
267
- - Actions variables `PROOFED_PROVIDER`, `PROOFED_MODEL`, `PROOFED_EFFORT` and `PROOFED_AUTOFIX` store the menu choice. The provider can be inferred from the model. Existing Claude workflows and their checkbox label keep working. To enable Codex in an installed workflow, add `codex-api-key: ${{ secrets.CODEX_API_KEY }}` and let its edited-comment condition match `- [x] **Fix with Codex**` as well as `- [x] **Fix with Claude**`.
268
- - Codex CLI is installed only for Codex runs. `codex exec` reads `CODEX_API_KEY`; local runs can also use `codex login`. Its workspace-write sandbox blocks command network access and writes outside the workspace, and Proofed restores changes to scenarios and workflows before checking a fix.
269
- - The checkout keeps no token in `.git/config` (`persist-credentials: false`); the push hands the token to git itself. Claude and Codex start without the job's tokens. A change that still contains one is discarded before it is built or checked, and the agent's answer is masked before it reaches the PR or the dashboard.
270
-
271
- </details>
272
-
273
- ## Mobile and desktop apps
274
-
275
- A scenario can set `target: ios`, `android` or `desktop`; scenarios without it stay web checks.
276
-
277
- - **Local iOS and Android** need an Apple Silicon Mac (macOS arm64), a built app, Kane's managed dependencies and one device you booted yourself, picked by `device` and `os_version`. GitHub Actions can use a self-hosted `[self-hosted, macOS, ARM64]` runner. `proofed doctor --target ios` (or `android`) lists what is missing and installs nothing.
278
- - **Cloud iOS and Android** run on real TestMu devices from Linux, macOS or Windows. The plan must include real-device automation. These runs give Kane's screenshots, without a Proofed MP4.
279
- - **Desktop** is experimental and covers one Electron Chromium window: give `launch` (or `app`) and `cdp_endpoint`. Native menus, OS file dialogs, Safari, Tauri and WKWebView are not supported.
280
- - **Fixing** uses the same checkbox and auto-fix setting on every target. Set `build` to produce the artifact in `app`, or the desktop code started by `launch`. Each check installs, uploads or launches the rebuild. `url` and `serve` are needed only for web scenarios. Pre-uploaded `APP…` IDs and desktop endpoints without a launch command or app path cannot verify a rebuild, so the report says why fixing didn't run.
281
-
282
- Commands and Android cloud, self-hosted Android and macOS Electron Actions examples: [docs/cli.md](https://github.com/t1dem/proofed/blob/main/docs/cli.md#github-actions-examples).
283
- Real-run verification by target and host is listed in [Platform support](https://github.com/t1dem/proofed/blob/main/docs/cli.md#platform-support).
85
+ ## How it works
284
86
 
285
- ## Limits
87
+ <picture>
88
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/t1dem/proofed/main/docs/flow-dark.svg">
89
+ <img src="https://raw.githubusercontent.com/t1dem/proofed/main/docs/flow-light.svg" alt="Pull request, then Kane runs the scenarios it touches in Chrome, then a report with clips on the PR. If a scenario broke, Codex fixes it and Kane checks again, up to 3 attempts.">
90
+ </picture>
286
91
 
287
- - **Kane's verdict on the same failure varies.** On [#6](https://github.com/t1dem/proofed-demo-store/pull/6) the check that [#9](https://github.com/t1dem/proofed-demo-store/pull/9) reports as a break came back twice as "the test may be wrong". Without a failed check, Proofed shows such a run as not confirmed and starts no fix. A failed `assert:` that Kane blames on the scenario is run a second time, and stays a failure when it fails again.
288
- - **Fixes need room in the selected provider's usage limit.** On [#7](https://github.com/t1dem/proofed-demo-store/pull/7) and [#8](https://github.com/t1dem/proofed-demo-store/pull/8) it ran out: Kane caught the break, no fix followed, and the report says so.
289
- - **Only flows with a scenario are checked.** A scenario whose `paths` miss a file isn't picked when that file changes.
290
- - **Slow next to unit tests.** One to four minutes of Kane per scenario, plus a build and a re-check per fix attempt.
92
+ - A scenario is one Markdown file per user flow in `.proofed/scenarios/`, in plain English. Its `paths` field says which files it guards: such a scenario runs only when the diff touches those files. A scenario without `paths` runs on every PR.
93
+ - For web, Kane doesn't record video, so Proofed records Chrome itself: it cuts the waiting, shows where Kane clicked and zooms in on what it checks.
94
+ - A fix starts when someone ticks **Fix with Claude** or **Fix with Codex** in the comment, or on its own with [Fix automatically](docs/setup.md#fix-automatically) on.
291
95
 
292
96
  ## What we ran into with Kane CLI
293
97
 
294
- What went wrong in real runs, and what Proofed does about it.
98
+ What went wrong in real runs and what Proofed does about it.
295
99
 
296
100
  | What happened | What Proofed does | Where |
297
101
  |---|---|---|
298
- | Asked something vague, Kane waited and reported a pass | A pass with no `assert` step counts as "not checked" | `src/check/run.ts` |
299
- | Kane routed around a broken button and passed | Kane is told to do each step once, with no other way to the goal | `src/check/run.ts` |
300
- | A run was still going after 361 seconds | A 360-second wall-clock limit over Kane's own `--timeout 300`; `timeout_minutes` in a scenario raises both | `src/kane/kane.ts` |
301
- | Kane's children outlived a plain kill and held the output open | Kane runs in its own process group, killed as a whole | `src/kane/kane.ts` |
302
- | On a page that was fine, Kane reported a heading as not visible and blamed the scenario | A failed check Kane blames on the scenario is run a second time; two failures stay failed; a failure followed by a pass is not checked | `src/check/run.ts` |
303
- | In 13 of 36 parallel starts, a scenario exited within seconds | One `kane-cli login` before the scenarios, and one retry; the retry always reached a verdict | `action.yml`, `src/check/run.ts` |
304
-
305
- ### Text checks and uncertain passes
102
+ | On a vague request Kane waited and returned "passed" | A pass without an `assert` step counts as "not checked" | `src/check/run.ts` |
103
+ | Kane went around a broken button and passed | Kane is told to do each step once, without workarounds | `src/check/run.ts` |
104
+ | A run was still going after 361 seconds | A 360-second limit on top of Kane's own `--timeout 300`; `timeout_minutes` in a scenario raises both | `src/kane/kane.ts` |
105
+ | Kane's child processes survived a normal kill and held the output | Kane runs in its own process group and is killed as a whole | `src/kane/kane.ts` |
106
+ | On a normal page Kane said the heading wasn't visible and blamed the scenario | Such a check runs again. Two failures stay a failure; a failure and a pass are "not checked" | `src/check/run.ts` |
107
+ | In 13 of 36 parallel runs a scenario finished within seconds | One `kane-cli login` before the scenarios, and one retry. The retry always reached a verdict | `action.yml`, `src/check/run.ts` |
306
108
 
307
- For web runs, Proofed compares Kane's pass on the scenario's last check with the page text. It costs no Kane credits.
308
-
309
- - **What is compared.** Text in quotes anywhere in the last check, such as `Check that the total is "€81.90".` Without quotes, only the shape `Check that A contains B.` (or `shows`, `lists`, `includes`), and only for a side of two or more words that reads like on-screen text: `Check that Vos outils favoris contains Générateur de token.` compares both names, `Check that the favorites section contains Token generator.` compares only `Token generator`.
310
- - **When.** Proofed reads the page as Kane starts the assert for that check and again as it finishes it. A text counts as missing only when both reads lack it.
311
- - **What is read.** All visible text in the document, not just the part in view: open shadow roots, same-origin frames, input values and placeholders, the chosen option of a select, image `alt`, `aria-label` and `title`, SVG text and CSS `content`. Case, spaces and quote or dash styles don't matter.
312
- - **What a contradiction does.** A missing text turns Kane's pass into "not checked", and the reason names the text. Nothing is ever turned into a failure.
313
- - **What is left to Kane.** Negative checks ("no longer", "not"), other wordings, colours, layout, and whether the text is in the right place. A page with a visible canvas, video, embedded object, cross-origin frame, registered custom element without an open shadow root, or CSS counter can't contradict Kane, since its text may not be readable. Images and icons don't stop the comparison, so a check whose text exists only as pixels in an image can end up "not checked".
314
-
315
- If a failed assert is retried because Kane doubts the scenario, two failures stay failed. A failure followed by a pass is "not checked", and both runs' reasons are kept.
316
-
317
- ### Credit figures
318
-
319
- `credits` is Kane's own estimate, retries included, and is labelled as an estimate in the terminal, the reports and the dashboard (`creditsSource: "kane_estimate"` in JSON). An interrupted run can spend credits before Kane reports any cost.
320
-
321
- Proofed can also read the free `kane-cli balance` before and after a scenario and report the account's debit as `accountBalance`. That figure covers the whole account: other activity on the account can contribute to it, so attribution to the scenario is unknown. Proofed drops it when it detects overlapping Proofed runs on the same machine; it cannot detect remote account activity.
322
- ## Code
323
-
324
- Node 22.18+ runs the checkout's TypeScript directly, so the GitHub Action needs no build or package install. `pnpm build` emits the CLI and its imports to `dist/` for npm; `npm pack` builds it automatically. `pnpm typecheck` and `pnpm test` check the source. `pnpm check:package` builds a tarball, checks its contents, installs it into a temporary prefix and runs its version and help, then removes its temp files.
109
+ ## Limits
325
110
 
326
- Releasing to npm is manual: [docs/release.md](https://github.com/t1dem/proofed/blob/main/docs/release.md).
111
+ - **Kane's verdict on the same failure varies.** On [#6](https://github.com/t1dem/proofed-demo-store/pull/6) the same check that [#9](https://github.com/t1dem/proofed-demo-store/pull/9) shows as a break came back twice as "the test may be wrong". Without a failed check, Proofed marks such a run unconfirmed and doesn't start a fix.
112
+ - **Kane doesn't catch every bug.** In two more replays, IT-Tools [#1202](https://github.com/CorentinTh/it-tools/pull/1202) and [#710](https://github.com/CorentinTh/it-tools/pull/710), Kane passed on the broken code.
113
+ - **A fix needs room in the provider's usage limit.** On [#7](https://github.com/t1dem/proofed-demo-store/pull/7) and [#8](https://github.com/t1dem/proofed-demo-store/pull/8) the limit ran out: Kane caught the bug, no fix followed, and the report says so.
114
+ - **Slower than unit tests.** One to four minutes of Kane per scenario, plus a build and a re-check per fix attempt.
115
+ - **Desktop is experimental:** one Electron window. Cloud iOS and Android devices aren't yet verified on a real plan.
327
116
 
328
- Before deploying the Worker, run `pnpm exec wrangler d1 migrations apply proofed --remote` from `site/`. This applies migration `0008_codex_key.sql` before the Worker needs the `codex_key` column. Then run `pnpm deploy` from `site/`.
117
+ ## Documentation
329
118
 
330
- | File | What it does |
331
- |---|---|
332
- | `src/action/cli.ts` | The PR check |
333
- | `src/fix/fix.ts` | The fix loop |
334
- | `src/check/run.ts` | One scenario: target preparation, recording, Kane, clip |
335
- | `src/fix/generate.ts` | The setup PR's first scenarios |
336
- | `src/action/mode.ts` | Decides what an event asks for |
337
- | `site/` | The dashboard, `/try` and the Cloudflare Worker behind them |
119
+ - [Manual setup, Codex, Fix automatically](docs/setup.md)
120
+ - [CLI, MCP and the Stop hook](docs/cli.md)
121
+ - [Mobile and desktop apps](docs/cli.md#platform-support)
122
+ - [Text checks and uncertain passes](docs/setup.md#text-checks-and-uncertain-passes)
123
+ - [Credits](docs/cli.md#credits)
124
+ - [Code and releases](docs/release.md)
338
125
 
339
126
  ## License
340
127
 
package/dist/check/run.js CHANGED
@@ -57,7 +57,13 @@ export function focusWords(end) {
57
57
  const checked = (steps) => steps.some((s) => s.status === "done" && /^assert:/i.test(s.remark));
58
58
  // A later successful result for the same step supersedes a failed attempt at that step.
59
59
  const failedAssert = (steps) => steps.findLast((s, i) => s.status === "failed" && /^assert:/i.test(s.remark) && !steps.slice(i + 1).some((later) => later.step === s.step && later.status === "done"));
60
+ // Kane ends such a run as "failed" too, but it never looked at the app: a second run can't help and
61
+ // there is nothing for a fixer to fix.
62
+ const outOfCredits = (end) => end?.reason_code === "infra_error.credits_exhausted";
63
+ const OUT_OF_CREDITS = "The TestMu account Kane runs on is out of credits, so nothing was checked. Top it up, or use the keys of an account that has credits.";
60
64
  function reconciledEnd(end, steps) {
65
+ if (end && outOfCredits(end))
66
+ return { ...end, reason: OUT_OF_CREDITS };
61
67
  const failed = end?.status === "passed" && failedAssert(steps);
62
68
  return failed && end ? { ...end, status: "failed", reason: failed.remark } : end;
63
69
  }
@@ -65,7 +71,7 @@ export function outcomeOf(end, steps) {
65
71
  // A vague objective lets Kane open the page, wait, and call that a pass.
66
72
  if (end?.status === "passed")
67
73
  return failedAssert(steps) ? "failed" : checked(steps) ? "passed" : "unsure";
68
- if (end?.status !== "failed" || INFRA.test(end.reason ?? ""))
74
+ if (end?.status !== "failed" || INFRA.test(end.reason ?? "") || end.reason_code?.startsWith("infra_error."))
69
75
  return "error";
70
76
  // An unresolved false assertion is a failure even when Kane blames the scenario.
71
77
  return end.verdict?.family === "automation_bug" && !failedAssert(steps) ? "unsure" : "failed";
@@ -73,9 +79,12 @@ export function outcomeOf(end, steps) {
73
79
  const RECHECK = "the check failed, but Kane blames the scenario; running it once more to be sure";
74
80
  // Kane is good at reaching a goal, so on its own it routes around a broken button (a key press, another
75
81
  // link) and passes. A user who clicks the button and gets the wrong screen has found a bug.
76
- const NO_WORKAROUNDS = "Do each step once, the way it is described. If a click or a key press does something other than what " +
77
- "the step expects, the check fails: don't retry it, and don't reach the goal another way (other " +
78
- "buttons, links, keyboard shortcuts, typing the URL). Waiting for a slow page to load is fine.";
82
+ // Worded as rules, not a condition: Kane once made "if a click does something other than what the
83
+ // step expects" a checkpoint to verify before the first step, and the run ended unchecked.
84
+ const NO_WORKAROUNDS = "Rules for doing the steps above, not steps or checks of their own: do each step once, the way it is " +
85
+ "described. When a click or a key press does something other than what the step expects, that step " +
86
+ "fails: don't retry it, and don't reach the goal another way (other buttons, links, keyboard " +
87
+ "shortcuts, typing the URL). Waiting for a slow page to load is fine.";
79
88
  export function kaneObjective(objective) {
80
89
  return `${objective}\n\n${NO_WORKAROUNDS}`;
81
90
  }
@@ -89,7 +98,7 @@ export async function runScenario(scenario, o) {
89
98
  return runOnce(scenario, o);
90
99
  };
91
100
  const settle = async (result) => {
92
- for (let i = 2; i <= (o.noRetry ? 1 : o.attempts ?? 2) && result.outcome === "error" && !result.notSignedIn && !stopping(); i++) {
101
+ for (let i = 2; i <= (o.noRetry ? 1 : o.attempts ?? 2) && result.outcome === "error" && !result.notSignedIn && !outOfCredits(result.end) && !stopping(); i++) {
93
102
  result = await again(result, result.error ?? "infra error");
94
103
  }
95
104
  return result;
package/dist/fix/codex.js CHANGED
@@ -2,13 +2,17 @@ import { executableCommand } from "../process.js";
2
2
  import { pathValue } from "../which.js";
3
3
  // One headless Codex run, shared by the fixer and scenario writer.
4
4
  import { spawnSync } from "node:child_process";
5
- import { mkdtempSync, readFileSync, rmSync } from "node:fs";
5
+ import { mkdirSync, mkdtempSync, readFileSync, rmSync } from "node:fs";
6
6
  import { tmpdir } from "node:os";
7
7
  import { join } from "node:path";
8
8
  export function askCodex(prompt, o) {
9
9
  const dir = mkdtempSync(join(tmpdir(), "proofed-codex-"));
10
10
  try {
11
11
  const output = join(dir, "answer.txt");
12
+ // The sandbox can't write the system temp dir. Without a temp dir of its own the agent
13
+ // pointed TMPDIR at the repo, and tsx and Node caches ended up in the fix commit.
14
+ const tmp = join(dir, "tmp");
15
+ mkdirSync(tmp);
12
16
  // Keep job tokens and unrelated provider keys out of the agent process.
13
17
  const env = Object.fromEntries(["PATH", "PATHEXT", "HOME", "USERPROFILE", "LOCALAPPDATA", "APPDATA", "USER", "TMPDIR", "TMP", "TEMP", "SystemRoot", "CODEX_HOME", "CODEX_API_KEY"]
14
18
  .flatMap((name) => pathValue(process.env, name) === undefined ? [] : [[name, pathValue(process.env, name)]]));
@@ -22,6 +26,8 @@ export function askCodex(prompt, o) {
22
26
  "-c", "sandbox_workspace_write.network_access=false",
23
27
  "-c", 'shell_environment_policy.inherit="none"',
24
28
  "-c", `shell_environment_policy.set.PATH=${JSON.stringify(env.PATH ?? "/usr/bin:/bin")}`,
29
+ ...["TMPDIR", "TMP", "TEMP"].flatMap((name) => ["-c", `shell_environment_policy.set.${name}=${JSON.stringify(tmp)}`]),
30
+ "-c", `sandbox_workspace_write.writable_roots=[${JSON.stringify(tmp)}]`,
25
31
  "-c", "sandbox_workspace_write.exclude_slash_tmp=true",
26
32
  "-c", "sandbox_workspace_write.exclude_tmpdir_env_var=true",
27
33
  "-c", `model_reasoning_effort=${JSON.stringify(o.effort)}`,
package/dist/secrets.js CHANGED
@@ -10,12 +10,19 @@ const VALUES = ["GITHUB_TOKEN", "GH_TOKEN", "LT_ACCESS_KEY", "CLAUDE_CODE_OAUTH_
10
10
  export function withoutJobSecrets(env, keep = []) {
11
11
  return Object.fromEntries(Object.entries(env).filter(([name]) => keep.includes(name) || !JOB_SECRETS.includes(name)));
12
12
  }
13
- // Only read the auth file that the action staged for this run.
13
+ // The Codex login while the fix loop keeps it off disk for the app's build and server (fixworkspace.ts),
14
+ // so output from that time is still masked.
15
+ let heldCodexAuth;
16
+ export const holdCodexAuth = (auth) => { heldCodexAuth = auth; };
17
+ // Only read the auth file that the action staged for this run. While the login is held, a file in its
18
+ // place is the app's, not the login.
14
19
  function codexAuth(env) {
15
20
  if (env.CODEX_AUTH_JSON)
16
21
  return env.CODEX_AUTH_JSON;
17
22
  if (!env.PROOFED_CODEX_HOME)
18
23
  return undefined;
24
+ if (heldCodexAuth !== undefined)
25
+ return heldCodexAuth;
19
26
  try {
20
27
  return readFileSync(join(env.PROOFED_CODEX_HOME, "auth.json"), "utf8");
21
28
  }
@@ -68,6 +68,36 @@ async function required(bin, args, timeout) {
68
68
  throw new Error(result.text);
69
69
  return result.text;
70
70
  }
71
+ // Kane can think for a minute while the device screen stands still, and the device records all of it. Each still
72
+ // stretch keeps its first second, so a six-minute run plays in about half a minute with every change in it.
73
+ // Small changes, such as a blinking text cursor, count as still. The screen the run ends on stays longer: it shows
74
+ // what the check was about before the GIF loops.
75
+ const NATIVE_FPS = 10;
76
+ const STILL_HOLD = 1;
77
+ const END_HOLD = 3;
78
+ export async function squeezeStills(input, output, length, timeout) {
79
+ const text = await required("ffmpeg", ["-hide_banner", "-nostats", "-i", input, "-vf", "scale=270:-2,freezedetect=n=-50dB:d=1.5", "-f", "null", "-"], timeout);
80
+ const cuts = [];
81
+ const cut = (from, to, hold = STILL_HOLD) => {
82
+ if (to - from > hold)
83
+ cuts.push(`between(t,${(from + hold).toFixed(2)},${to.toFixed(2)})`);
84
+ };
85
+ let start;
86
+ for (const [, edge, at] of text.matchAll(/freeze_(start|end): ([\d.]+)/g)) {
87
+ if (edge === "start")
88
+ start = Number(at);
89
+ else if (start !== undefined) {
90
+ cut(start, Number(at));
91
+ start = undefined;
92
+ }
93
+ }
94
+ // The recording can end on a still screen.
95
+ if (start !== undefined)
96
+ cut(start, length, END_HOLD);
97
+ if (cuts.length === 0)
98
+ return renameSync(input, output);
99
+ await required("ffmpeg", ["-y", "-i", input, "-vf", `select='not(${cuts.join("+")})',setpts=N/${NATIVE_FPS}/TB`, "-c:v", "libx264", "-pix_fmt", "yuv420p", "-movflags", "+faststart", output], timeout);
100
+ }
71
101
  async function nativeRecorder(target, dir, id) {
72
102
  // Transferring and encoding long recordings can take minutes on CI runners.
73
103
  const recordingTimeout = 10 * 60 * 1000;
@@ -169,24 +199,32 @@ async function nativeRecorder(target, dir, id) {
169
199
  const list = join(dir, "segments.txt");
170
200
  writeFileSync(list, segments.map((f) => `file '${f.replaceAll("\\", "/").replaceAll("'", "'\\''")}'`).join("\n"));
171
201
  const mp4 = join(dir, "clip.mp4"), jpg = join(dir, "clip.jpg"), gif = join(dir, "clip.gif");
172
- const untrimmed = join(dir, "clip-untrimmed.mp4");
202
+ const untrimmed = join(dir, "clip-untrimmed.mp4"), whole = join(dir, "clip-whole.mp4");
173
203
  try {
174
204
  // Use a constant frame rate so the thumbnail seek finds a frame even when the Android screen stops changing.
175
- await required("ffmpeg", ["-y", "-f", "concat", "-safe", "0", "-i", list, "-vf", "fps=10,scale=trunc(iw/2)*2:trunc(ih/2)*2", "-c:v", "libx264", "-bf", "0", "-pix_fmt", "yuv420p", untrimmed], recordingTimeout);
205
+ await required("ffmpeg", ["-y", "-f", "concat", "-safe", "0", "-i", list, "-vf", `fps=${NATIVE_FPS},scale=trunc(iw/2)*2:trunc(ih/2)*2`, "-c:v", "libx264", "-bf", "0", "-pix_fmt", "yuv420p", untrimmed], recordingTimeout);
176
206
  const { text } = await command("ffmpeg", ["-hide_banner", "-i", untrimmed], process.env, recordingTimeout);
177
207
  const duration = /^\s*Duration: (\d+):(\d{2}):(\d{2}\.\d+),/m.exec(text);
178
- const seconds = duration ? Number(duration[1]) * 3600 + Number(duration[2]) * 60 + Number(duration[3]) : 0;
208
+ let seconds = duration ? Number(duration[1]) * 3600 + Number(duration[2]) * 60 + Number(duration[3]) : 0;
179
209
  // Kane closes the app at the end, so cut away the launcher frames.
180
- if (seconds > 3)
181
- await required("ffmpeg", ["-y", "-i", untrimmed, "-t", (seconds - 1.5).toFixed(2), "-c", "copy", mp4], recordingTimeout);
210
+ if (seconds > 3) {
211
+ await required("ffmpeg", ["-y", "-i", untrimmed, "-t", (seconds - 1.5).toFixed(2), "-c", "copy", whole], recordingTimeout);
212
+ seconds -= 1.5;
213
+ }
182
214
  else
183
- renameSync(untrimmed, mp4);
215
+ renameSync(untrimmed, whole);
216
+ await squeezeStills(whole, mp4, seconds, recordingTimeout).catch((error) => {
217
+ log(`Kept the whole recording: ${error instanceof Error ? error.message : error}`);
218
+ renameSync(whole, mp4);
219
+ });
184
220
  }
185
221
  finally {
186
222
  rmSync(untrimmed, { force: true });
223
+ rmSync(whole, { force: true });
187
224
  }
188
225
  await required("ffmpeg", ["-y", "-sseof", "-0.1", "-i", mp4, "-frames:v", "1", jpg], recordingTimeout);
189
- await required("ffmpeg", ["-y", "-i", mp4, "-vf", "fps=6,scale=480:-1", gif], recordingTimeout);
226
+ // The same palette as web clips: the default one dithers gradients into noise.
227
+ await required("ffmpeg", ["-y", "-i", mp4, "-vf", `fps=${NATIVE_FPS},scale=480:-1:flags=lanczos,split[a][b];[a]palettegen=max_colors=96:stats_mode=diff[p];[b][p]paletteuse=dither=bayer:bayer_scale=4:diff_mode=rectangle`, gif], recordingTimeout);
190
228
  return { mp4, jpg, gif };
191
229
  })();
192
230
  },
package/docs/cli.md CHANGED
@@ -1,6 +1,26 @@
1
1
  # proofed check
2
2
 
3
- The reference for `proofed check`. Installation is in the [README](../README.md#locally-and-from-an-ai-agent).
3
+ The reference for `proofed check`.
4
+
5
+ ## Install
6
+
7
+ `proofed check` runs the same check on your machine, against the change you haven't pushed yet: the scenarios its files touch, with Kane CLI on their configured targets. A coding agent can run it before it says a UI change is done.
8
+
9
+ Web checks need Node 22.18 or later, Chrome, [Kane CLI](https://www.npmjs.com/package/@testmuai/kane-cli) signed in (`kane-cli login`) and ffmpeg for the clips.
10
+
11
+ Install it with `npm install -g proofed-cli` (or `pnpm add -g`, `bun add -g`), or run it once with `npx proofed-cli`.
12
+
13
+ The command is `proofed`. Run `proofed doctor` to see what's missing. The package ships built JavaScript and has no install scripts. From a clone, `npm link` runs the TypeScript source instead.
14
+
15
+ In the app's repo:
16
+
17
+ | Command | What it does |
18
+ |---|---|
19
+ | `proofed doctor` | Checks Node, Git, the scenarios, Kane CLI and its login, credits, Chrome, ffmpeg and the app, each with a fix |
20
+ | `proofed list` | Every scenario, whether the change touches it and whether its pass is cached |
21
+ | `proofed check` | Runs the scenarios the change touches; `proofed check "the cart total updates"` checks just that |
22
+
23
+ In a repo that already runs Proofed on its PRs, `proofed check` needs no flags. `--dry-run` shows what would run and the credit estimate, for free.
4
24
 
5
25
  ## What it checks
6
26
 
@@ -47,6 +67,24 @@ covers. Text that is a scenario's id or name is refused with exit 3 and the `--o
47
67
  `--dry-run` to run it. Allow at least 10 minutes. Read `reason`, `diagnosis` and `rerun`
48
68
  when a scenario fails. `not_checked` is not a pass. On exit 3, follow `error.fix`.
49
69
 
70
+ For an agent, add this to the app's `AGENTS.md` or `CLAUDE.md`:
71
+
72
+ ```md
73
+ ## Checking UI changes
74
+
75
+ Run the one command the task needs; `proofed check` checks its own setup first.
76
+ - Check the change: `proofed check --json`. One scenario: `proofed check --only <id> --json`.
77
+ - A behavior no scenario covers: `proofed check "<what>" --json`.
78
+ - To plan without spending credits, add `--dry-run`: it shows what would run and `estimatedCredits`.
79
+ - Only to ask which scenarios a change touches and their cost: `proofed list --json`.
80
+ - Only for setup questions: `proofed doctor --json`.
81
+ Allow at least 10 minutes for a check. stdout is one JSON document; progress is on stderr.
82
+ Exit 0: passed or nothing ran. On `failed`, read `reason` and `diagnosis`, fix and run `rerun`.
83
+ `failedCheck: "scenario_doubted"` is Kane's opinion: review the scenario's expectations.
84
+ `not_checked` is not a pass. On `error`, retry `rerun` once. Exit 3: follow `error.fix`.
85
+ Checks spend Kane credits; planning does not. Use `--no-retry` when another attempt is forbidden.
86
+ ```
87
+
50
88
  ## MCP and the Claude Code Stop hook
51
89
 
52
90
  `proofed mcp` serves tools over stdio. Start the client in the repository root so Proofed finds the project's scenarios and app settings.
@@ -249,7 +287,8 @@ actual inventory; the examples do not install a runtime or choose a device for y
249
287
  Native recording uses `simctl recordVideo` or `adb shell screenrecord`. Android segments
250
288
  are limited to 175 seconds and concatenated after pulling them. ffmpeg produces MP4,
251
289
  final JPG and GIF without changing portrait orientation or adding a cursor or zoom.
252
- Segment boundaries may have a gap. A recording failure is reported separately and
290
+ Each stretch where the screen stands still keeps its first second, so a run in which Kane
291
+ thinks for minutes plays in well under a minute. Segment boundaries may have a gap. A recording failure is reported separately and
253
292
  preserves Kane's verdict. Cloud recordings are not available through this adapter.
254
293
  Only Proofed's remote recording files are removed, after a successful pull.
255
294
 
@@ -281,7 +320,7 @@ of uploaded IDs and explicitly reused desktop sessions still work.
281
320
 
282
321
  ### GitHub Actions examples
283
322
 
284
- Use the PR/comment triggers, permissions and concurrency from the [README workflow](../README.md#setup).
323
+ Use the PR/comment triggers, permissions and concurrency from the [setup workflow](setup.md#setup).
285
324
  Pass `vars: ${{ toJSON(vars) }}` to carry the dashboard's **Fix automatically** setting.
286
325
  Set the matching `target` in the scenario frontmatter; the action's `target` input
287
326
  filters scenario files. Prepare SDKs and devices before the action; Proofed installs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proofed-cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Check web, Android and Electron app scenarios with Kane CLI before you call a change done.",
5
5
  "repository": {
6
6
  "type": "git",