Loading...
Loading...
Captures before/after screenshots of web pages for visual comparison in PRs. Use when user says "take before and after", "screenshot comparison", "visual diff", "PR screenshots", or after making visual UI changes.
npx skill4agent add juangadm/pre-post pre-postPackage:Visual diff tool for PRs — fastest path from code change to visual documentation.pre-post
--full--markdown--responsive--mobile--tablet# Detect running dev server
lsof -i :3000 2>/dev/null || lsof -i :3001 2>/dev/null || lsof -i :5173 2>/dev/null || lsof -i :8080 2>/dev/null# Check production URL is accessible
curl -s -o /dev/null -w "%{http_code}" "<production-url>"# Detect affected routes from git diff
npx pre-post detect/blog/[slug]/dashboard/settings# Single route, desktop only
npx pre-post compare \
--before-base https://prod.com \
--after-base http://localhost:3000 \
--routes /dashboard \
--output /tmp/pre-post
# Multiple routes, responsive (desktop + mobile)
npx pre-post compare \
--before-base https://prod.com \
--after-base http://localhost:3000 \
--routes /dashboard,/settings,/ \
--responsive \
--output /tmp/pre-postbrowser_resize(1280, 800)
browser_navigate("https://prod.com/dashboard")
browser_wait_for(time: 3)
browser_take_screenshot(filename: "/tmp/pre-post/dashboard-desktop-before.png")
browser_navigate("http://localhost:3000/dashboard")
browser_wait_for(time: 3)
browser_take_screenshot(filename: "/tmp/pre-post/dashboard-desktop-after.png")
# Mobile
browser_resize(375, 812)
browser_navigate("https://prod.com/dashboard")
browser_wait_for(time: 3)
browser_take_screenshot(filename: "/tmp/pre-post/dashboard-mobile-before.png")
browser_navigate("http://localhost:3000/dashboard")
browser_wait_for(time: 3)
browser_take_screenshot(filename: "/tmp/pre-post/dashboard-mobile-after.png")# Upload and generate markdown
mkdir -p /tmp/pre-post
./scripts/upload-and-copy.sh /tmp/pre-post/before.png /tmp/pre-post/after.png --markdownnpx pre-post <before.png> <after.png> --markdown## Visual Changes
### `/dashboard`
<details open>
<summary>Desktop (1280x800)</summary>
| Pre | Post |
|:---:|:----:|
|  |  |
</details>
<details>
<summary>Mobile (375x812)</summary>
| Pre | Post |
|:---:|:----:|
|  |  |
</details>
---
*Captured by [pre-post](https://github.com/juangadm/pre-post)*# Get current PR
gh pr view --json number,body
# Append screenshots to PR body
gh pr edit <number> --body "<existing-body>
<generated-markdown>"gh# Basic usage (two URLs)
pre-post site.com localhost:3000
# Detect routes from git diff
pre-post detect
pre-post detect --framework nextjs-app
# Compare with auto-detected routes
pre-post run --before-base https://prod.com --after-base http://localhost:3000
# Compare specific routes
pre-post compare --before-base URL --after-base URL --routes /dashboard,/settings
# Responsive (desktop + mobile)
pre-post compare --before-base URL --after-base URL --responsive
# From existing images
pre-post before.png after.png --markdown
# Via npx
npx pre-post detect
npx pre-post compare --before-base URL --after-base URL| Flag | Description |
|---|---|
| Mobile viewport (375x812) |
| Tablet viewport (768x1024) |
| Custom viewport |
| Full scrollable page |
| CSS selector to capture |
| Desktop + mobile capture |
| Explicit route list (comma-separated) |
| Max detected routes (default: 5) |
| Force framework detection |
| Production URL |
| Localhost URL |
| Output directory (default: ~/Downloads) |
| Upload images & output markdown |
| Upload endpoint (overrides git-native default) |
.pre-post/# Default (git-native — commits to PR branch, works on any repo)
./scripts/upload-and-copy.sh before.png after.png --markdown
# Explicit override for external storage:
IMAGE_ADAPTER=0x0st ./scripts/upload-and-copy.sh before.png after.png --markdown| Error | Fix |
|---|---|
| |
| |
| 401/403 on production URL | See pre-flight section above |
| Element not found | Verify selector exists on page |
| No changed files detected | Specify routes manually with |
| Could not determine commit SHA | Ensure |