storybranch

For coding agents

Agent snippets

Paste the note into that repo’s AGENTS.md, and the ignore rules into the app that owns the baselines.

AGENTS.md

Exit 1 on the first run is the baseline set. Approve only when a person asked for it.

## storybranch `@adriangohjw/storybranch` is a dev dependency. Storybook must already be running at your `--url`, or built so `storybranch test --build` can serve `storybook-static/`. Run `npm run visual` from the package that has `.storybook/` (or pass `--cwd`). - `visual` runs `storybranch test --url <storybook>`. CI can run `storybook build && storybranch test --build` instead. Exit 1 means a visual diff. In a terminal you get scan time, a status summary, and one `->` row per snapshot, plus `storybranch review at …`; in CI/non-TTY you get `missing baseline`, `pixels`, `size`, or `stale` per snapshot. A clean run prints `ok`. - Default browser is `chrome`. Filenames end in `__chrome.png`, `__firefox.png`, `__edge.png`, or `__safari.png`. Extra browsers come from `storybranch.config.json` or `storybranch.config.ts` in that package, or from `--browsers`. `webkit` is an alias for `safari`. Linux WebKit shots do not match macOS; pin the runner OS. - Read `.storybranch/report.json` in that package (`new`, `changed`, `unchanged`, `stale`, `error`). - The first run lists every shot as `new` in the summary (or `missing baseline` lines in CI). - Commit only `.storybranch/baseline/` in that package. Ignore `actual/`, `diff/`, and `report.json`. - Run `npm run visual:approve` only when asked to accept the shots. `visual:review` and `--open` are for a person.

.gitignore

Keep .storybranch/baseline/ tracked.

.storybranch/actual/ .storybranch/diff/ .storybranch/report.json