Rsdoctor Agent CLI
rsdoctor-agent gives an agent Rspack build analysis as JSON: chunks, modules, duplicate packages and tree shaking.
- 1,152 ★ on the repository
- Last commit
- MIT
Minimal access
Why this level
- Reads a local build data file and changes nothing; the skill may install the package globally.
Install
- Works in
Manual install
pnpm add -D @rsdoctor/agent-cliThe install command from the package README, the binary is `rsdoctor-agent`.
Access and checks
How we reviewMinimal accessThe tool runs nothing and makes no network calls.
- Reads a local build data file and changes nothing; the skill may install the package globally.
This is third-party code. Review the repository files before installing.
What it does
Rsdoctor is a build analyzer for the Rspack ecosystem. The `@rsdoctor/agent-cli` package with the `rsdoctor-agent` binary reads the `rsdoctor-data.json` data file and prints results as structured JSON that an agent can easily search, filter and page through. Direct commands cover report areas: `chunks list`, `modules by-id`, `packages list`, `tree-shaking summary`, `bundle optimize` and `assets diff` for comparing two builds. The `query` command calls a catalog tool by name, for example `packages_duplicates`. The tool works as a pair with the `rsdoctor-analysis` skill from the rstackjs/agent-skills repository: the skill walks a project through build analysis and the CLI queries the resulting data. When a project builds several bundles, such as web and Node.js, the `--compiler` flag selects the compiler. In Rsdoctor 2.x the former `@rsdoctor/mcp-server` was removed and agent-cli takes over its role.
Who it is for. Frontend developers on Rspack who look for the causes of a heavy bundle and a slow build together with an agent.
Good fit when
- The bundle grew and the agent looks for the heaviest modules and packages in the build.
- The project is suspected of duplicating one package in different versions.
- Two reports before and after a change are compared with `assets diff`.
- The web and Node.js builds use two compilers and the analysis is needed for one only.
Not a fit when
- You need an interactive report with visualization, which Rsdoctor itself provides in the browser.
- The build runs on webpack or another tool outside Rstack.
- An MCP server is required, and Rsdoctor 2.x does not have one, so version 1 is needed.
Example request
Analyse this project's build through Rsdoctor and tell me in which directions the bundle size can be reduced.Limitations
The tool reads only a finished data file, so build the project first with the Rsdoctor plugin: set `output` to `mode: 'brief'` with type `json` or the `RSDOCTOR_OUTPUT='json'` variable (plugins 1.5.11 and newer). When a report has several compilers the `--compiler` flag is required. Old reports without a compiler index read without it. The `@rsdoctor/mcp-server` MCP server belongs to version 1, and agent-cli replaces it in 2.x.
How to disable. Remove the package (`pnpm remove @rsdoctor/agent-cli`) and the rsdoctor-analysis skill from the agent skills directory. The `rsdoctor-data.json` files in the project are deleted by hand.
FAQ
How do I install rsdoctor-agent?
Run `pnpm add -D @rsdoctor/agent-cli`; the binary is called `rsdoctor-agent`. Installing the package up front is optional, since the skill installs it globally when needed.
Where does rsdoctor-data.json come from?
The Rsdoctor plugin writes it during the build: in `output` set `mode: 'brief'` and `type: ['json']`. The `RSDOCTOR_OUTPUT='json'` environment variable also works for plugins 1.5.11 and newer.
How do I pick a compiler?
`rsdoctor-agent compilers list --data-file ./rsdoctor-data.json` gives the list, then pass the exact name with `--compiler`, for example `--compiler node`. The flag is written separately from the JSON in `--input`.
Where did the Rsdoctor MCP server go?
In version 2.x the `@rsdoctor/mcp-server` package was removed. For agent work use `@rsdoctor/agent-cli` and the `rsdoctor-analysis` skill. The old MCP instruction stays in the version 1 documentation.
How do I see the command schemas?
`rsdoctor-agent --describe` and `rsdoctor-agent --schema chunks.list` print descriptions and argument schemas, and `rsdoctor-agent list` returns all subcommands as machine-readable JSON.
Discussion
No questions or reviews yet.
Related
CLI toolsAn agent plugin for Rstack: configure, upgrade to v2, debug and analyse Rspack, Rsbuild, Rslib, Rspress and Rstest builds.
A CLI that scans React code without a model for state, performance, security and accessibility, gives a 0–100 score and installs a skill for agents
An agent gets the MDMA spec, prompts and validation so it can answer with forms, tables and approvals right inside Markdown
Webpack Bundle Analyzer CLI reads build statistics and shows module sizes in JavaScript bundles before and after compression.
A CLI that lets an agent inspect a running React app: component tree, props, state, hooks and render profiling
A design studio for people and agents: dsa CLI, MCP endpoint and skill to edit layouts, slides, reports and 3D together.
README in short
The Rsdoctor repository is run by the Rstack team. The agent-cli package lives in `packages/agent-cli`, and the AI documentation also describes the `llms.txt` and `llms-full.txt` files with the full documentation text.