Vercel Doctor

CLI 参考

Vercel Doctor 的全部命令行选项与参数。

用法

npx -y vercel-doctor@latest [directory] [options]

directory 参数默认为 .(当前目录)。

选项

FlagDescription
-v, --versionDisplay the current version
--no-lintSkip billing lint rules
--no-dead-codeSkip dead code detection (Knip)
--verboseShow file paths and line numbers per rule
--scoreOutput only the numeric score (useful for CI)
-y, --yesSkip interactive prompts, scan all workspace projects
--project <name>Select specific workspace project(s), comma-separated
--diff [base]Scan only files changed vs the base branch
--offlineSkip anonymous telemetry used for score calculation

示例

扫描当前目录

npx -y vercel-doctor@latest .

使用详细输出扫描

npx -y vercel-doctor@latest . --verbose

显示每个诊断对应的文件路径和行号。

仅扫描变更文件

npx -y vercel-doctor@latest . --diff

自动检测基准分支。也可指定基准:

npx -y vercel-doctor@latest . --diff main

扫描指定工作区项目

npx -y vercel-doctor@latest . --project web

多个项目:

npx -y vercel-doctor@latest . --project web,api

跳过死代码检测

npx -y vercel-doctor@latest . --no-dead-code

CI 使用

npx -y vercel-doctor@latest . --yes --score

--yes 跳过交互式提示。与 --score 一起使用时,仅输出数字分数,便于在脚本和流水线中使用。

编程 API

Vercel Doctor 也导出编程 API:

import { run } from "vercel-doctor/api";

Oxlint 插件

账单检查规则可单独作为 Oxlint 插件使用:

import plugin from "vercel-doctor/oxlint-plugin";
Edit on GitHub

Last updated on

On this page