# SnapEye **Capture. Compare. Record. Visual tools for coding agents.** SnapEye is a small, deterministic visual toolbelt built on [SnapDOM](https://github.com/zumerlab/snapdom). A coding agent runs one command, gets a JSON answer, and only opens an image when the JSON says it should: ```sh $ npx snapeye diff dashboard --target '#dashboard' { "status": "ok", "diff": { "changed": false, "changedRatio": 0, ... } } ``` SnapEye does not navigate, click, reason, call a model, or orchestrate an agent. ## Install ```sh npm install --save-dev @zumer/snapeye @zumer/snapdom@latest ``` SnapEye supports SnapDOM `^2.24.10 || ^3.0.0-0`, including v3 prereleases. The development dependency stays on the published v2 release. To verify a local compiled v3 build without replacing it: ```sh SNAPDOM_TEST_PATH=../snapdom-v3/dist/snapdom.mjs SNAPDOM_EXPECTED_MAJOR=3 npm run test:browser ``` Capture and diff invalidate SnapDOM's style caches by default so CSSOM-only changes are captured. Set `snapdomOptions.invalidate: false` only to deliberately test memoization. SnapEye ignores reusable `snapdomOptions.canvas` targets so recording frames retain independent pixels. Recheck existing v2 baselines when upgrading the renderer; approve replacements only after inspecting the changes. ### Any Vite app ```js import { defineConfig } from 'vite' import { snapeye } from '@zumer/snapeye/vite' export default defineConfig({ plugins: [snapeye()] }) ``` That is the whole setup, including for frameworks that render their own HTML. Vite's `transformIndexHtml` hook only fires for pages Vite itself serves, so Astro, Nuxt, SvelteKit, Remix and Qwik would never receive the client — and the failure is silent: `/__snapeye/health` answers `ok` while `window.snapeye` never exists and every operation burns its timeout. Rather than ship an adapter per framework, the plugin injects the client into any HTML the dev server sends. Verified on a real Astro + Starlight site. Those frameworks own the Vite config, so the plugin goes where they keep it: ```js // astro.config.mjs · nuxt.config.ts · svelte.config.js … export default defineConfig({ vite: { plugins: [snapeye()] } }) ``` If a host ever does not receive the client, check it directly — this is the one setup failure worth ruling out first: ```sh curl -s -H 'Accept: text/html' localhost:5173 | grep -c data-snapeye-client # expect 1 ``` Configuration is intentionally small: ```js snapeye({ root: '.snapeye', // relative to Vite's project root maxRuns: 20, client: { forwardConsole: false, // mirror the page console to the Vite terminal errorOverlay: false, // in-page overlay for uncaught errors hotkey: false, // Shift + captures a baseline hotkeyName: 'current' // baseline that hotkey capture replaces } }) ``` The `client` options are the injected runtime's only in-page side effects, and all of them are off by default: SnapEye does not patch `console`, does not draw over the page, and does not take a key away from the application unless asked. Unknown or malformed options throw instead of being ignored. Enabling `hotkey` makes Shift + that key run a real `capture()`, replacing the `hotkeyName` baseline. It is deliberately inert while typing into an input, textarea, select, or contenteditable element, and while any other modifier is held. ### A page with no dev server An issue repro, a scratch file, a static export: pass the file (or a directory) to `--serve` and SnapEye hosts it for the length of that run, client injected, nothing to configure. Vite must be installed; it is the same plugin applied to a folder. ```sh npx snapeye capture issue-493 --serve repro/issue.html --target '#test' npx snapeye capture issue-493 --serve repro/issue.html --target '#test' --snapdom ../snapdom/dist npx snapeye serve repro/issue.html # stays up; prints the URL for other commands ``` `--snapdom` points the client, and any `