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

agent-output-optimizer

v0.1.3

Published

Agent-optimized output for Vite. Emits compact JSON when running inside an AI agent (Claude Code, Cursor, Devin, etc.).

Readme

agent-output-optimizer

Agent-optimized output for Vite. Detects AI coding agents and replaces verbose build output with compact, structured JSON.

Inspired by PAO for PHP.


Why

When an AI agent (Claude Code, Cursor, Devin, Gemini CLI, etc.) runs vite build or vite dev, the agent's context window gets flooded with hundreds of lines of ASCII tables, ANSI color codes, chunk reports, and stack traces it has to parse anyway.

agent-output-optimizer detects these environments automatically and swaps the output for a single-line JSON that the agent can parse in one step — freeing tokens and improving fix accuracy.

When a human runs the same command, the output is completely unchanged.

Install

npm install -D agent-output-optimizer
# or
pnpm add -D agent-output-optimizer

Requires Vite 5, 6, 7, or 8.

Usage

// vite.config.ts
import { defineConfig } from 'vite';
import optimizer from 'agent-output-optimizer';

export default defineConfig({
  plugins: [
    optimizer(),
    // ...your other plugins
  ],
});

That's it. No config needed. The plugin activates only when an AI agent is detected.

What you get

Build — successful

{"mode":"build","result":"passed","duration_ms":2120}

Build — failed

{
  "mode": "build",
  "result": "failed",
  "duration_ms": 1972,
  "errors": [
    {
      "message": "Could not load ../../../resources/js/routess",
      "code": "UNLOADABLE_DEPENDENCY",
      "file": "resources/js/pages/dashboard.tsx",
      "line": 4,
      "column": 27
    }
  ]
}

Dev server

{"mode":"dev","ready":true,"url":"http://localhost:5173","port":5173,"duration_ms":6}

HMR (opt-in)

{"mode":"hmr","file":"resources/js/pages/dashboard.tsx","modules":1}

Options

optimizer({
  force: false,    // force-enable even if no agent detected
  disable: false,  // force-disable even if agent detected
  chunks: false,   // include per-chunk size/gzip info in build output
  gzip: true,      // compute gzip sizes when chunks is true
  hmr: false,      // emit a JSON line per HMR update
});

chunks: true — bundle-size auditing

{
  "mode": "build",
  "result": "passed",
  "duration_ms": 2254,
  "chunks": [
    { "file": "assets/app-BatQDfhm.js", "size": 230317, "gzip": 65235 },
    { "file": "assets/app-BwJKfC5G.css", "size": 91182, "gzip": 15164 }
  ]
}

Detected agents

Auto-detects via environment variables and filesystem markers:

| Agent | Detection | |---|---| | Claude Code | CLAUDECODE, CLAUDE_CODE | | Cursor | CURSOR_AGENT, CURSOR_TRACE_ID, CURSOR_EXTENSION_HOST_ROLE | | Gemini CLI | GEMINI_CLI | | Codex CLI | CODEX_SANDBOX, CODEX_CI, CODEX_THREAD_ID | | GitHub Copilot | COPILOT_CLI, COPILOT_MODEL, COPILOT_ALLOW_ALL, COPILOT_GITHUB_TOKEN | | Antigravity | ANTIGRAVITY_AGENT | | Augment CLI | AUGMENT_AGENT | | OpenCode | OPENCODE_CLIENT, OPENCODE | | Amp | AMP_CURRENT_THREAD_ID | | Pi | PI_CODING_AGENT | | Kiro CLI | KIRO_AGENT_PATH | | Replit | REPL_ID | | Devin | /opt/.devin file | | Generic | AI_AGENT |

What it does

  • Silences Vite's default CLI output (banner, progress, chunk tables, stack traces).
  • Strips ANSI escape codes and box-drawing characters from error messages.
  • Extracts structured error info (file, line, column, plugin, error code) from both rollup/rolldown error objects and formatted frames.
  • Intercepts process.stderr.write so Vite's CLI-level error prints don't leak after the JSON.
  • Emits exactly one JSON line per build on stdout, regardless of project size.

License

MIT