shotdiff
v0.1.0
Published
See what AI changed before you accept it. Visual diff tool for AI-assisted development.
Maintainers
Readme
The Problem
You ask your AI coding tool to "fix the button styling." It does. But it also:
- Shifted your nav 3px to the left
- Changed the font weight on your headings
- Broke the mobile layout entirely
Code diffs don't show you this. You only find out when a user reports it.
The Solution
npx shotdiff snap # Take a "before" screenshot
# ... let AI make changes ...
npx shotdiff diff # See exactly what changed visuallyShotdiff captures your running app before and after changes, then generates a beautiful visual comparison with pixel-level highlighting.
Install
npm install -g shotdiff
# or use directly
npx shotdiffQuick Start
# 1. Start your dev server
npm run dev
# 2. Take a snapshot before AI changes
npx shotdiff snap
# 3. Make your AI changes (Claude, Cursor, Windsurf, whatever)
# 4. See what actually changed
npx shotdiff diffA beautiful HTML report opens in your browser with:
- Side-by-side comparison of before/after
- Slider overlay to drag and reveal changes
- Pixel diff highlight showing exactly what moved
- Change summary with percentage of affected pixels
Commands
shotdiff snap
Takes a "before" screenshot of your running app.
shotdiff snap # Default: http://localhost:3000
shotdiff snap --url http://localhost:5173 # Custom URL
shotdiff snap --width 1440 --height 900 # Custom viewport
shotdiff snap --full-page # Capture full scrollable pageshotdiff diff
Takes an "after" screenshot and shows the visual diff.
shotdiff diff # Compare against last snap
shotdiff diff --threshold 0.1 # Sensitivity (0-1, lower = more sensitive)
shotdiff diff --no-open # Don't auto-open browsershotdiff watch
Watches for file changes, auto-captures and shows diff after each change.
shotdiff watch # Watch current directory
shotdiff watch --url http://localhost:5173 # Custom URL
shotdiff watch --delay 2000 # Wait 2s after change for HMRshotdiff history
Shows all snapshots taken in this session.
shotdiff history # List all snapshots
shotdiff history --clean # Delete all snapshotsConfig
Create shotdiff.config.json in your project root:
{
"url": "http://localhost:3000",
"width": 1280,
"height": 720,
"fullPage": false,
"threshold": 0.1,
"delay": 1000,
"routes": ["/", "/dashboard", "/settings"]
}Or pass flags to any command:
| Flag | Default | Description |
|------|---------|-------------|
| --url | http://localhost:3000 | URL to capture |
| --width | 1280 | Viewport width |
| --height | 720 | Viewport height |
| --full-page | false | Capture full scrollable page |
| --threshold | 0.1 | Diff sensitivity (0-1) |
| --delay | 1000 | Delay after file change (ms) |
How It Works
- Snap captures a PNG screenshot using Playwright's Chromium
- Screenshots are stored in
.shotdiff/(add to.gitignore) - Diff uses pixelmatch for pixel-level comparison
- Results are rendered as a self-contained HTML report with inline base64 images
- No cloud, no uploads, everything stays local
Works With
Any local development server. Any framework. Any AI coding tool.
- Next.js, React, Vue, Svelte, Angular
- Claude Code, Cursor, Windsurf, Copilot, Cody
- Any URL running on localhost
Requirements
- Node.js 18+
- A running local dev server
Playwright's Chromium is downloaded automatically on first run.
Why Not Percy/Chromatic?
Those are great CI tools for visual regression testing. Shotdiff is different:
| | shotdiff | Percy/Chromatic |
|---|---------|----------------|
| Use case | Real-time AI change review | CI/CD regression testing |
| Setup | npx shotdiff snap | Config, CI integration, account |
| Cost | Free forever | Free tier, then paid |
| Where | Local, instant | Cloud, async |
| When | Before you accept AI changes | After you push code |
License
MIT
