Browser automation tool for Cursor AI to inspect and debug hot-reload development websites.
- macOS (for clipboard/paste features)
- Cursor AI (primary use case)
- Node.js 18+
- Yarn (preferred package manager)
- DevWatch Server - Headless browser with HTTP API
- DevWatch CLI (
dw) - Terminal client for fast interactions
┌─────────────────┐ HTTP API ┌──────────────────────┐
│ dw (client) │ ◄────────────► │ DevWatch Server │
│ • Screenshots │ │ • Playwright browser │
│ • Error capture │ │ • Persistent state │
│ • Zero deps │ │ • API endpoints │
└─────────────────┘ └──────────────────────┘
npm i
npm run setup
npm start# Install/update CLI
./deployToBin.sh
# Quick status check
dw check
# Take a screenshot
dw screenshotPORT- Server port (default: 8787)TARGET_URL- Target webpage to control (default: http://localhost:5173)BROWSER- Browser to use: firefox, chromium, webkit (default: firefox)
For easy access in Cursor, run dw help-ai or copy this reference:
# DevWatch CLI Commands
Available DevWatch commands for browser automation and debugging:
## Quick Status
- `dw check` - Quick status check (HMR-aware, exits on first error)
- `dw fast-check` - ⚡ Ultra-fast status check (< 1 second, optimized)
## Page Control
- `dw state` - Get page state information
- `dw refresh` - Refresh the page
- `dw hard-refresh` - Hard refresh with cache clear
- `dw force-reload` - Force reload for fresh module loading
- `dw nuclear-reload` - 🚀 NUCLEAR: Clear ALL caches like Firefox Dev Tools
- `dw navigate <url>` - Navigate to a URL
- `dw sync-url <url>` - Sync headless browser to specific URL
## Screenshots
- `dw screenshot [filename] [delayMs]` - Take viewport screenshot
- `dw fullshot [filename] [delayMs]` - Take full page screenshot
- `dw click-screenshot <selector> [text] [delayMs] [filename] [--clipboard] [--paste]` - Click element and screenshot
- `--clipboard` copies image to clipboard (macOS)
- `--paste` auto-pastes into Cursor (requires Accessibility permissions)
## Console Logs
- `dw logs [type] [limit]` - Get console logs (types: error, warn, info, log, debug)
- `dw errors` - Get only error logs
- `dw clear-logs` - Clear console log buffer
- `dw export-logs [filename]` - Export logs to text file
## Page Interaction
- `dw click <selector> [text]` - Click an element
- `dw fill <selector> <value>` - Fill an input field
- `dw type <text> [delay]` - Type text with optional delay
- `dw hover <selector>` - Hover over an element
- `dw scroll [x] [y]` - Scroll the page (default: 0, 500)
## JavaScript Execution
- `dw eval <code>` - Execute JavaScript code in page context
## Debugging
- `dw debug` - Get comprehensive debug information
- `dw match-firefox` - Match Firefox Developer Edition state exactly
- `dw sync-firefox [url]` - EXACT Firefox sync with fresh page instance
- `dw force-modules` - Force all module scripts to load and show errors
- `dw capture-errors` - Proven error capture with fresh page instance
## Examples
```bash
# Quick status check
dw check
# Screenshots
dw screenshot
dw click-screenshot "button" "Submit" --paste # Click, screenshot, paste to Cursor
# Page interaction
dw click "#login-button"
dw fill "#email" "test@example.com"
dw scroll 0 500
# Debugging
dw errors
dw nuclear-reload # For stubborn cache issuesEnvironment: Set DEVWATCH_URL to use different server (default: http://127.0.0.1:8787)
---
## DevWatch CLI (dw)
The CLI lives at `~/bin/dw` and is also checked into this repo as `./dw` for safekeeping.
- Default server URL: `http://127.0.0.1:8787`
- Override with: `export DEVWATCH_URL=http://host:port`
### Installation / update
- Local copy: `./dw`
- Deploy helper: `./deployToBin.sh` copies `./dw` to `~/bin/dw` and makes it executable.
- Usage:
```bash
./deployToBin.sh
```
- Ensure `~/bin` is on your PATH.
### Usage
```bash
dw <command> [options]
dw check— Quick status check (HMR-aware, exits non-zero on first error)dw fast-check— Ultra-fast status check (< 1s, optimized)
dw state— Get page state informationdw refresh— Refresh the pagedw hard-refresh— Hard refresh with cache clear (slower)dw force-reload— Force reload for fresh module loading (slower)dw nuclear-reload— NUCLEAR: Clear ALL caches like Firefox Dev Toolsdw navigate <url>— Navigate to a URLdw sync-url <url>— Sync headless browser to a specific URL
dw screenshot [filename] [delayMs]— Viewport screenshot- You can also pass the delay first:
dw screenshot 1500 my.png
- You can also pass the delay first:
dw fullshot [filename] [delayMs]— Full page screenshot- Same flexible args order as
screenshot
- Same flexible args order as
dw click-screenshot <selector> [text] [delayMs] [filename] [--clipboard] [--paste]- Clicks an element (optionally filtering by inner text), waits delay, then screenshots
- If
--clipboardis provided, the image is copied to the clipboard (macOS AppleScript) - If
--pasteis provided, it will also activate Cursor and paste the image (requires Accessibility permissions) - Default delay: 2000ms when unspecified
Examples:
# Viewport screenshot with default name
dw screenshot
# Full page screenshot with filename and delay
dw fullshot page.png 1000
# Delay-first order works too
dw screenshot 1500 shot.png
# Click a Submit button and save/paste screenshot
dw click-screenshot "button" "Submit" 2000 submit.png
# Copy screenshot to clipboard instead of saving to file
dw click-screenshot "#save" --clipboard
# Click, screenshot, copy to clipboard and attempt to auto-paste into Cursor
# (Enable System Settings > Privacy & Security > Accessibility for Terminal)
dw click-screenshot ".result" --pasteNotes on clipboard/paste:
- A temporary file is stored at
/tmp/devwatch-screenshot.pngduring the operation and removed after. --pasteuses AppleScript to bring Cursor to the foreground and send Cmd+V, then Return.
dw logs [type] [limit]— Get console logs (types: error, warn, info, log, debug)dw errors— Get only error logsdw clear-logs— Clear console log bufferdw export-logs [filename]— Export logs to text file
dw click <selector> [text]— Click an elementdw fill <selector> <value>— Fill an input fielddw type <text> [delay]— Type text with optional delaydw hover <selector>— Hover over an elementdw scroll [x] [y]— Scroll the page (default: 0, 500)
dw eval <code>— Execute JavaScript code in page context
dw debug— Get comprehensive debug informationdw match-firefox— Match Firefox Developer Edition state (clear caches and reload)dw sync-firefox [url]— EXACT Firefox sync with fresh page instancedw force-modules— Force all module scripts to load and show errorsdw capture-errors— Proven error capture (fresh page with comprehensive capture)
These endpoints back the CLI and are available directly for scripted use.
Get current page state (title, URL, dimensions)
Get screenshot of current page as PNG
Get console logs since timestamp
Get network events since timestamp
Find DOM elements by selector and optional text
{"selector": "button", "text": "Click me"}Click an element
{"selector": "button", "text": "Submit"}Type text with optional delay
{"text": "Hello world", "delay": 50}Fill input field
{"selector": "#email", "value": "test@example.com"}Hover over element
{"selector": ".tooltip-trigger"}Scroll page
{"x": 0, "y": 500}Execute JavaScript in page context
{"js": "return document.title"}# Get page state
curl http://localhost:8787/state
# Take screenshot
curl http://localhost:8787/frame > screenshot.png
# Click a button
curl -X POST http://localhost:8787/click -H "Content-Type: application/json" \
-d '{"selector":"button","text":"Submit"}'
# Fill a form
curl -X POST http://localhost:8787/fill -H "Content-Type: application/json" \
-d '{"selector":"#email","value":"test@example.com"}'If DevWatch saves you time in your development workflow, consider buying me a coffee!
Other ways to support:
- ⭐ Star this repository - Helps others discover the project
- 🐛 Report issues - Help improve the tool
- 🚀 Contribute code - Pull requests welcome!
- 📢 Share with others - Spread the word about DevWatch
Built with ❤️ for developers using AI assistants and hot-reload workflows.