Reports
Without --format, Doctor picks the report for whoever reads it. Pass a format whenever a script needs a fixed contract:
pnpm dlx vite-doctor . --format agent
pnpm dlx vite-doctor . --format json
pnpm dlx vite-doctor . --format sarif
pnpm dlx vite-doctor . --format text
Stdout carries only the report. Anything else that writes to stdout during the run, such as a doctor.config.ts, a Vite plugin, or a Tailwind plugin that prints a banner, goes to stderr, so you can pipe the report straight into a JSON parser.
Who reads the report
Doctor picks the first reader that matches:
| Reader | Recognized by | Report |
|---|---|---|
| Agent | AI_AGENT, or the marker of an agent that runs commands for a model (Claude Code, Codex, Cursor agent, Gemini CLI, Cline, OpenCode, Augment, Amp), in a terminal or in CI. Markers that can linger in a person's shell, such as Cursor's editor terminal, count only when output goes to a pipe outside CI. | Agent report, 8,000 characters |
| CI | A CI environment with no agent marker | Complete text report |
| Terminal | Output to a terminal | Text report, 8,000 characters |
| Pipe | Anything else | Text report, 8,000 characters |
readerly does the detection, and AI_AGENT=0 turns it off. An agent gets the agent report even in CI or in a terminal it drives. When Doctor picks the agent report and stderr is a terminal, it says so on stderr.
Report Budget
Text and agent reports are Progressive Reports. They print the head in full: project, evidence, summary, and every Diagnostic Code with its count. Then they fold Diagnostics into one group per Diagnostic Code, errors before warnings. Each group shows its Rule's title, its shared remediation and evidence, and one row per Diagnostic with its location, or what it is about when it has no file. Doctor adds rows, then each Diagnostic in detail, until the report reaches its Report Budget of 8,000 characters. In CI the text report has no budget by default.
The Report Budget limits optional detail, not required content. If the required content alone exceeds the budget, the report can be longer. When the budget hides something, the report says how much and names the command that shows more. A group's more: flags rerun only its Rule, and --full prints everything in detail:
pnpm dlx vite-doctor . --max-chars 20000
pnpm dlx vite-doctor . --rules mcp/tools/require-annotation-title
pnpm dlx vite-doctor . --full
--max-chars <count> sets the budget and --full removes it; you can't combine them. Both apply to text and agent reports only. JSON and SARIF reports always contain every Diagnostic. The budget changes what a report prints, never the run, so exit codes and --max-warnings count every Diagnostic. The Plugin Surface takes the same budget as maxChars, and its report names rules and maxChars: Infinity instead of a command.
The agent report
The agent report (vite-doctor.agent/v3) groups Diagnostics by Diagnostic Code, severity, and confidence. A code can appear in several groups entries, so use codes for the complete count per code.
A group carries what its Diagnostics share: the Rule, title, severity, confidence, Diagnostic Reference URL, remediation, and evidence. Evidence that only some Diagnostics share says how many with diagnostics. A group without evidence has no evidence field. Each entry in the group's diagnostics is either a row (relative location or subject, brief or message, fix safety) or, when the budget leaves room, the whole Diagnostic with its fingerprint, evidence, data, and edit plan.
Confidence comes from the Rule:
provenfor syntax facts.type-backed,manifest-backed, orruntime-backedwhen that evidence decides the finding.heuristic-high,heuristic-medium, orheuristic-lowotherwise.
When the budget hides anything, budget reports maxChars and how many groups, rows, and detailed Diagnostics are hidden, and each group with hidden rows reports rowsHidden. Append a group's more flags to commandArgs.more to see more of it. If a compact group has no more flags, such as a baseline finding that needs full Rule coverage, use commandArgs.full to keep the original Rule selection.
Design-system findings
When a complete agent report doesn't fit the budget and has both design-system/* and other findings, Doctor budgets the other findings first. With space left, it appends design-system count entries grouped by Rule and severity, with count, the number of files, rowsHidden, and the more flags that list that Rule's Diagnostics. Count entries that don't fit go into budget.hidden with their rows. Severity doesn't change, and codes, summary, and exit codes still count every finding. A report that fits, a run with --rules or --full, and the JSON, SARIF, and text reports list design-system findings like any other group.
Score
The JSON report carries score and, per Diagnostic category, categoryScores. Each Diagnostic costs its severity's weight (blocker 15, error 8, warn 3, info 1) and the score is 100 minus the total, never below 0. No severity has a cap, so 10 warnings score 70 and 1,000 warnings score 0. The score never divides by the size of the project: a larger project with the same findings scores the same.
Set other weights in doctor.config.json, for example { "score": { "weights": { "warn": 1 } } }. Gate CI on --max-warnings and the exit code, which count Diagnostics rather than points.
Rerun commands
For automation, use the commandArgs arrays. The first item is the executable and the rest are literal arguments. Replace the <code> or <rule> item, then run the array without a shell from project.cwd. This keeps revision names and preset selectors with spaces or shell syntax intact on every platform. The commands strings are quoted templates for POSIX shells, not Windows command lines.
The commands keep the run's Rule selection, severity, analyses, baseline filtering, warning limit, cache policy, profiling, and an explicit --config path. verify replaces the Rule selector with <rule>, more drops it, and full adds --full. They omit --fix, --unsafe-fix, --watch, --max-chars, and baseline updates, so verifying never edits source or baselines. Doctor never discovers executable configuration when it builds these commands.
API callers can pass { runOptions, configFile } to createAgentReport, or as the third argument to createReport, to keep the same CLI options. A command cannot rebuild in-memory host configuration or Doctor Extensions, so repeat those runs through the original Plugin Surface.
Rules from an extension
Pass the same config when you list or explain Rules from a Doctor Extension:
pnpm vite-doctor rules --config doctor.config.ts
pnpm vite-doctor explain CUSTOM0001 --config doctor.config.ts
Both commands register the configured Rule Packs, including packs an extension's setup adds, without running Rules. Agent explanation commands keep the config path. A custom code links to the docs URL its Rule Pack's defineDoctorDiagnostics registry declares, or to the Rule's reference link. Doctor never invents a Diagnostic Reference page for a third-party code.
Nuxt modules can register Doctor Extensions through the Nuxt 4 Bridge. nuxt doctor loads them. The standalone CLI loads them only with --host-extensions, because that runs code the host registered:
pnpm vite-doctor . --host-extensions --max-warnings 0
pnpm vite-doctor explain ACME0001 --host-extensions
Agent commands keep --host-extensions when the original run used it. See Extending Doctor to write and ship Rules.