npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

devtools-ai

v0.3.4

Published

CLI middleware that gives AI coding agents eyes on browser DevTools

Readme

devtools-ai

Give AI coding agents eyes on browser DevTools.

devtools-ai is a CLI middleware tool that launches a headless browser, navigates to one or more URLs, captures network traffic and console output, and writes a structured report that AI coding agents can consume. Use it to diagnose runtime errors, failed API calls, and visual issues without opening a browser manually.


Install

npm install -g devtools-ai

Chromium is downloaded automatically on first run via Playwright.


Quick Start

1. Check for errors on a local dev server:

devtools-ai run http://localhost:3000 --preset errors

2. Take a screenshot after clicking a button:

devtools-ai run http://localhost:3000 --preset visual --click "#login-btn"

3. Flag slow API responses and output raw JSON:

devtools-ai run http://localhost:3000/api/users --json --slow 500

Presets

Presets are named flag bundles that match common debugging scenarios. Use --preset <name> and override individual flags as needed.

| Preset | Use when... | What it captures | |----------------|-------------------------------------|--------------------------------------------------------------| | errors | App crashes or API returns errors | 4xx/5xx responses + console errors, no response bodies | | console-only | Debugging JS exceptions | All console output, no network bodies | | visual | Checking if UI renders correctly | Screenshot + console errors, no network bodies | | api-debug | Debugging API request/response data | 4xx/5xx on /api/* routes with full response bodies | | full | Need everything | All network, all console, screenshot, full bodies |


Flag Reference

Capture Control

| Flag | Default | Description | |-------------------------------|-------------------------------|--------------------------------------------------------------| | --preset <name> | none | Use a preset: errors, console-only, visual, api-debug, full | | --filter <codes> | all | Status codes to capture: 4xx,5xx, 400,500, all, none| | --route <pattern> | * | URL path filter: /api/*, /auth/** | | --console <levels> | error,warn | Console levels: error, warn,error,log, all | | --no-bodies | false | Strip response bodies from output (saves tokens) | | --console-only | false | Only capture console output, skip network entirely | | --screenshot | false | Save a PNG screenshot, path included in output | | --max-body <bytes> | 10240 | Truncate response bodies beyond this size | | --block-resources <types> | stylesheet,image,font,media | Block these resource types from loading | | --timeout <ms> | 5000 | Max wait time after navigation (ms) | | --slow <ms> | none | Flag requests slower than this threshold (ms) | | --json | false | Output raw JSON instead of XML-wrapped format |

Interaction

| Flag | Description | |----------------------|--------------------------------------------------------------| | --click <selector> | Click an element by CSS selector (repeatable) | | --eval <js> | Execute JavaScript on the page (repeatable) |

Execution order: navigate, wait, clicks (in order), evals (in order), extra wait, capture.

Use multiple --click and --eval flags for multi-step interactions:

devtools-ai run http://localhost:3000 \
  --click "#username" \
  --eval "document.querySelector('#username').value='test'" \
  --click "#submit"

Wait Strategies

| Flag | Description | |-------------------------------|--------------------------------------------------------------| | --wait-for networkidle | Wait until no network requests for 500ms (default) | | --wait-for load | Wait for window load event | | --wait-for domcontentloaded | Wait for DOMContentLoaded event | | --wait-for selector::<sel> | Wait until a CSS selector matches an element | | --wait-for-console <pattern>| Wait until a console message contains this string |

Browser and Request Configuration

| Flag | Default | Description | |--------------------|-------------|--------------------------------------------------------------| | --viewport <WxH> | 1280x720 | Browser viewport size | | --headers <json> | {} | Extra HTTP headers as a JSON string | | --cookie <value> | none | Cookie to set before navigation | | --no-redact | false | Disable PII/token redaction (local debugging only) | | --output <dir> | .devtools-ai/| Output directory | | --config <path> | .devtools-ai.config.json | Config file path |


Multi-URL Support

Capture multiple pages in a single session by passing multiple URLs:

devtools-ai run http://localhost:3000 http://localhost:3000/about http://localhost:3000/api/health

Each URL is navigated in sequence. Network and console output from all pages is combined into a single report.


Config File

Create a .devtools-ai.config.json file in your project root to set defaults, headers, cookies, and auth flows. Generate a starter config with:

devtools-ai config init

Full Example

{
  "defaults": {
    "filter": "4xx,5xx",
    "route": "/api/*",
    "console": "error,warn",
    "timeout": 8000,
    "waitFor": "networkidle",
    "maxBody": 20480,
    "blockResources": ["stylesheet", "image", "font", "media"],
    "viewport": "1920x1080",
    "output": ".devtools-ai/"
  },
  "redaction": {
    "enabled": true,
    "patterns": {
      "emails": true,
      "ipv4": true,
      "jwts": true
    },
    "headerRedact": ["authorization", "cookie", "set-cookie"]
  },
  "headers": {
    "X-Custom-Header": "my-value"
  },
  "cookies": ["session=abc123; Path=/; Domain=localhost"],
  "auth": {
    "url": "http://localhost:3000/login",
    "steps": [
      { "action": "fill", "selector": "#email", "value": "[email protected]" },
      { "action": "fill", "selector": "#password", "value": "password123" },
      { "action": "click", "selector": "#login-btn" },
      { "action": "wait", "strategy": "networkidle" }
    ]
  }
}

CLI flags always take priority over config file defaults.


Auth Flows

Authentication is configured exclusively through the config file (not CLI flags). When an auth block is present, devtools-ai navigates to the auth URL and executes the steps in order before proceeding to the target URL(s).

Supported step actions:

| Action | Fields | Description | |---------|----------------------|----------------------------------------------| | fill | selector, value | Type a value into an input field | | click | selector | Click an element | | wait | strategy | Wait using a strategy (e.g., networkidle) | | eval | value | Execute arbitrary JavaScript |

Example: Login Before Capture

{
  "auth": {
    "url": "http://localhost:3000/login",
    "steps": [
      { "action": "fill", "selector": "#email", "value": "[email protected]" },
      { "action": "fill", "selector": "#password", "value": "secret" },
      { "action": "click", "selector": "button[type=submit]" },
      { "action": "wait", "strategy": "networkidle" }
    ]
  }
}

After auth completes, session cookies are preserved for all subsequent URL navigations.


Output Format

By default, output is a JSON object wrapped in randomized XML tags, written to .devtools-ai/latest.xml. The XML wrapping prevents AI models from confusing the report with their own output.

Use --json to output raw JSON without XML wrapping (written to .devtools-ai/latest.json).

Structure

{
  "devtools_ai": {
    "session": { ... },
    "network": [ ... ],
    "console": [ ... ],
    "summary": { ... },
    "screenshot_path": "..."
  }
}

The output file path is printed to stdout so the invoking agent can locate and read it.


Commands

| Command | Description | |----------------------------|----------------------------------------------| | devtools-ai run <urls...> | Capture network and console from one or more URLs | | devtools-ai describe | Print a machine-readable capabilities document | | devtools-ai config init | Generate a starter config file |


License

Commercial license. 2 seats per license (one work machine, one personal machine). See LICENSE for full terms. Purchase at devtoolsai.gumroad.com/l/ijdql.