{"id":51889502,"url":"https://github.com/zumerlab/snapeye","last_synced_at":"2026-07-26T02:30:23.616Z","repository":{"id":358773639,"uuid":"1241799104","full_name":"zumerlab/snapeye","owner":"zumerlab","description":"Tiny bridge that gives an AI coding agent eyes on your running web app: snapDOM in the browser, a two-endpoint HTTP handler on the server, PNG on disk.","archived":false,"fork":false,"pushed_at":"2026-05-19T01:44:37.000Z","size":45,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-19T03:47:27.100Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/zumerlab/snapeye","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zumerlab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-17T20:38:30.000Z","updated_at":"2026-05-19T02:19:32.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/zumerlab/snapeye","commit_stats":null,"previous_names":["zumerlab/snapeye"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/zumerlab/snapeye","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zumerlab%2Fsnapeye","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zumerlab%2Fsnapeye/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zumerlab%2Fsnapeye/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zumerlab%2Fsnapeye/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zumerlab","download_url":"https://codeload.github.com/zumerlab/snapeye/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zumerlab%2Fsnapeye/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35898941,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-26T02:00:06.503Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-07-26T02:30:22.675Z","updated_at":"2026-07-26T02:30:23.606Z","avatar_url":"https://github.com/zumerlab.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SnapEye\n\n**Gives an AI coding agent eyes on a running web app.**\n\nURL to PNG on disk → the agent reads it and keeps editing.\nNo bundled browser automation, no baseline diffing, no framework runtime.\nA [snapDOM](https://github.com/zumerlab/snapdom) client + a two-endpoint HTTP handler — that's it.\n\n[Quickstart](#quickstart) ·\n[AGENTS.md snippet](#add-to-your-agentsmd) ·\n[Setup](#setup) ·\n[Triggers](#trigger-captures) ·\n[Options](#options) ·\n[Frameworks](#framework-integration) ·\n[Contract](#the-contract) ·\n[Recipes](#recipes)\n\n## Quickstart\n\nIf SnapEye is already wired into the project, an agent only needs this:\n\n```sh\nopen \"http://localhost:8080/?snap=home\"\n# then read .snapeye/home.png\n```\n\nTo wire it into a new project, three small pieces:\n\n```sh\nnpm install --save-dev @zumer/snapeye @zumer/snapdom\n```\n\n```js\n// client — somewhere in the app bundle\nimport { snapdom } from '@zumer/snapdom'\nimport { attachSnapEye } from '@zumer/snapeye/client'\nattachSnapEye({ snapdom })\n```\n\n```js\n// server — before the host app's routing\nimport { createSnapEyeHandler } from '@zumer/snapeye/server'\nconst snapEye = createSnapEyeHandler({ dir: '.snapeye' })\n// in your request handler:  if (await snapEye(req, res)) return\n```\n\nCapture from any of: URL (`?snap=name`), JS (`window.snapeye.snap('name')`),\nor hotkey (`Shift + S`).\n\n## Add to your AGENTS.md\n\nSo your agent knows SnapEye exists and how to use it, append the snippet\nbelow to your project's `AGENTS.md`, `CLAUDE.md`, `.cursorrules`, or\nequivalent. Adjust the URL/port to your dev setup.\n\n````markdown\n## UI Verification with SnapEye\n\nThis project has SnapEye wired into the dev server. Use it to *see* the\nrendered UI instead of inferring it from the DOM or CSS.\n\n### Capture a screen\n\n```sh\nopen \"http://localhost:8080/?snap=home\"\n```\n\nThis writes `.snapeye/home.png`. Read it with your image-reading tool.\n\n### Capture programmatically\n\n```js\nawait window.snapeye.snap('hero')\nawait window.snapeye.snap('checkout', document.querySelector('.checkout'))\n```\n\n### Loop\n\n1. Make the UI change.\n2. Trigger a capture (`?snap=\u003cname\u003e` or `snap()` call).\n3. Read `.snapeye/\u003cname\u003e.png`.\n4. If the PNG is missing or stale, check dev server stdout for\n   `[browser] ...` lines.\n\nNames are sanitized to `[a-z0-9._-]`. Output dir defaults to `.snapeye/`.\n````\n\n## Setup\n\n### Install\n\n```sh\nnpm install --save-dev @zumer/snapeye @zumer/snapdom\n```\n\n`@zumer/snapdom` is a required peer dependency.\n\n### Browser\n\n```js\nimport { snapdom } from '@zumer/snapdom'\nimport { attachSnapEye } from '@zumer/snapeye/client'\n\nattachSnapEye({ snapdom })\n```\n\nAttaches:\n\n```js\nwindow.snapeye.snap(name, target?)\nwindow.snapeye.log(level, ...args)\nwindow.snapeye.options\n```\n\n### Server\n\n```js\nimport { createServer } from 'node:http'\nimport { createSnapEyeHandler } from '@zumer/snapeye/server'\n\nconst snapEye = createSnapEyeHandler({ dir: '.snapeye' })\n\ncreateServer(async (req, res) =\u003e {\n  if (await snapEye(req, res)) return\n  // host app routing\n}).listen(8080)\n```\n\nHandler signature:\n\n```ts\n(req: import('node:http').IncomingMessage,\n res: import('node:http').ServerResponse) =\u003e Promise\u003cboolean\u003e\n```\n\nReturns `true` when it handled the request.\n\n## Trigger Captures\n\n```sh\n# URL — best for agents\nopen \"http://localhost:8080/?snap=home\"\n```\n\n```js\n// Programmatic\nawait window.snapeye.snap('hero')\nawait window.snapeye.snap('checkout', document.querySelector('.checkout'))\n```\n\n```text\nShift + S captures the default target.\n```\n\nAfter capture, read `.snapeye/\u003cname\u003e.png`.\n\n## Options\n\n### Client\n\n```js\nattachSnapEye({\n  snapdom,                         // required\n  endpoint: '/__snapeye__',        // must match server prefix\n  autoOnQuery: true,               // ?snap=foo captures after load\n  forwardConsole: true,            // mirrors console.* to /log\n  errorOverlay: true,              // top bar for errors/rejections\n  defaultTarget: () =\u003e document.documentElement,\n  hideSelectors: ['.dev-only'],    // temporarily hidden during capture\n  snapdomOptions: { dpr: 1, scale: 1 },\n  hotkey: 'S'                      // Shift + S; set null to disable\n})\n```\n\n### Server\n\n```js\ncreateSnapEyeHandler({\n  dir: '.snapeye',\n  prefix: '/__snapeye__',\n  log: (line) =\u003e console.log(line), // pass null to silence\n  onSnap: ({ name, path, bytes }) =\u003e {},\n  onLog: ({ line }) =\u003e {}\n})\n```\n\n## Framework Integration\n\n### Vite\n\n```js\nimport { createSnapEyeHandler } from '@zumer/snapeye/server'\n\nexport default {\n  plugins: [{\n    name: 'snapeye',\n    configureServer (server) {\n      const handler = createSnapEyeHandler({ dir: '.snapeye' })\n      server.middlewares.use(async (req, res, next) =\u003e {\n        if (!(await handler(req, res))) next()\n      })\n    }\n  }]\n}\n```\n\n### Express / Connect\n\n```js\nconst snapEye = createSnapEyeHandler({ dir: '.snapeye' })\n\napp.use(async (req, res, next) =\u003e {\n  if (!(await snapEye(req, res))) next()\n})\n```\n\nDo not pass Fetch `Request`/`Response` directly — the handler expects\nNode `IncomingMessage` / `ServerResponse`. Fetch-native runtimes need a\nsmall adapter.\n\n## The Contract\n\nTwo POST endpoints under `/__snapeye__`:\n\n| Method | Path                       | Body         | Side effect                       |\n| ------ | -------------------------- | ------------ | --------------------------------- |\n| POST   | `/__snapeye__/snap?name=X` | `image/png`  | Writes `\u003cdir\u003e/X.png`              |\n| POST   | `/__snapeye__/log`         | `text/plain` | Prints stdout as `[browser] ...`  |\n\n`name` is sanitized to `[a-z0-9._-]`; invalid characters become `_`.\nMissing names become `snap-\u003ctimestamp\u003e`. `\u003cdir\u003e` defaults to `.snapeye`.\n\nThis is the stable contract. Anything that produces these POSTs is a\nvalid client.\n\n## Agent Loop\n\n```bash\n# 1. Start fresh\nrm -rf .snapeye\nnpm run dev \u003e /tmp/dev.log 2\u003e\u00261 \u0026\n\n# 2. Trigger the route\nopen \"http://localhost:8080/?snap=home\"\n\n# 3. Read the result\n# .snapeye/home.png\n```\n\nIf the capture is stale or missing:\n\n- Check `/tmp/dev.log` for `[browser] ...` output.\n- Confirm the client is loaded.\n- Confirm the server `prefix` matches the client `endpoint`.\n- Confirm the output directory is the one you're reading.\n\nSnapEye intentionally does not navigate your app. For multi-route\ncaptures, drive routing yourself and call `window.snapeye.snap(name)`\nafter each route has rendered.\n\n## What It Does Not Do\n\n- No visual regression baseline — see `@zumer/snapdiff` or a recipe.\n- No bundled headless mode — drive Playwright/Puppeteer yourself.\n- No auth — mount on localhost / dev servers only.\n- No Fetch-native server adapter in core.\n- No MCP server (may ship as a sibling package, not in core).\n- No TypeScript declarations yet.\n\n## Recipes\n\nThe core stays small. Optional patterns live in [`RECIPES.md`](RECIPES.md):\n\n- `agent-map` — annotated Set-of-Mark PNG + element metadata JSON.\n- `snapdiff` — compare the current capture with the previous one.\n- `namespace` — isolate multiple agents writing to the same server.\n\n## License\n\n[MIT](LICENSE) — © [Zumerlab](https://github.com/zumerlab)\n\n## For Humans\n\nSnapEye is useful if you want an agent to verify real rendered UI\nwithout asking you to describe the screen: wire the client into your\ndev page, mount the server handler on localhost, open a route with\n`?snap=name`, and the agent gets a PNG it can inspect. If you need\npixel-perfect screenshots, regression history, auth, or navigation\norchestration, use Playwright or a dedicated visual-testing tool\nalongside SnapEye rather than expanding the core.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzumerlab%2Fsnapeye","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzumerlab%2Fsnapeye","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzumerlab%2Fsnapeye/lists"}