# codex-plugin-doctor 中文文档

规范地址：https://npmcn.com/package/codex-plugin-doctor/

版本：1\.91\.0
npm 元数据更新时间：2026-11-03T08:02:30.973Z
中文译文更新时间：2026-11-03T08:38:29.055Z
软件包许可：MIT

本文由上游 README 机器翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/codex-plugin-doctor
原文对照：https://npmcn.com/package/codex-plugin-doctor/?lang=original
项目主页：https://github.com/Esquetta/CodexPluginDoctor#readme
源码仓库：https://github.com/Esquetta/CodexPluginDoctor

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：1.6 MB，299 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- Node.js 要求：\>=22
- 运行依赖：4 个
- 首次发布：2026-04-29T09:03:56.005Z
- 最新版本发布：2026-11-03T08:02:30.644Z
- 已发布版本数：131（近 12 个月 131 个）

## 中文简介

用于Codex插件、技能和MCP包的CLI-first验证器具有运行时MCP协议验证。

## 安装

```sh
npm install codex-plugin-doctor
```

也可以使用：`pnpm add codex-plugin-doctor`、`yarn add codex-plugin-doctor`、`bun add codex-plugin-doctor`

## README

# Codex插件医生

[![CI](https://github.com/Esquetta/CodexPluginDoctor/actions/workflows/ci.yml/badge.svg)](https://github.com/Esquetta/CodexPluginDoctor/actions/workflows/ci.yml) [![npm version](https://img.shields.io/npm/v/codex-plugin-doctor.svg)](https://www.npmjs.com/package/codex-plugin-doctor) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://npmcn.com/package/codex-plugin-doctor/LICENSE) [![GitHub release](https://img.shields.io/github/v/release/Esquetta/CodexPluginDoctor)](https://github.com/Esquetta/CodexPluginDoctor/releases)

在您发布Codex插件、技能和MCP服务器之前检查它们的CLI 包、它的安全性，以及（如果允许的话）正在运行的MCP服务器。

```bash
npx codex-plugin-doctor check path/to/plugin
```

指向一个文件夹 `.codex-plugin/plugin.json`． 在其 `.mcp.json` 退出时状态为1，报告如下（建议修改命令）：

```text
Codex Plugin Doctor
===================
Status: FAIL
Target: /path/to/plugin
Summary: 1 fail, 0 warn, 1 total

Failures
--------
✖ plugin.security.hard_coded_secret
  Message: The MCP server `dangerServer` contains a hard-coded secret-like env value for `OPENAI_API_KEY`.
  Impact: Hard-coded credentials inside plugin bundles increase leakage risk and make secure rotation difficult.
  Suggested fix: Replace the literal value for `OPENAI_API_KEY` with an environment reference or injected secret outside the package.
  Fingerprint: 21da7c75027f0811929d49253412a0f20694d974f141d0421410c89ee29c8b72
  Evidence: serverName=dangerServer, configPath=.mcp.json, envKey=OPENAI_API_KEY, envValue=[REDACTED]
```

添加 `--runtime` 也可以启动插件的MCP服务器并调用它们。它运行 包的自己的代码，所以它是可选的，和 `--sandbox docker` 隔离本地Node.js工作室 服务器。没有插件在手？ `npx codex-plugin-doctor check --installed` 检查那些 在Codex插件缓存中。

## 检查什么

-   **包:** `.codex-plugin/plugin.json`、技能布线及 `SKILL.md` 元数据, `.mcp.json` 结构、描述质量、硬编码的秘密和逃离包的路径。
-   **安全** （`security .`): shell包装器、编码命令、远程内容的记分卡 管道连接到shell中，以及普通HTTP传输。
-   **运行服务器** （`--runtime`): MCP握手，然后是工具、资源、提示和 分页，带有记分卡和一致性报告。
-   **突发的变化:** [MCP快照](https://npmcn.com/package/codex-plugin-doctor/docs/guides/mcp-snapshot.md) 比较工具、提示、 和资源模板与一个提交的基线，在拉请求评论和发布 笔记。
-   **其他客户** （`compat . --all --scorecard`): MCP配置是否有效，是否可以 添加到克劳德桌面，光标，克莱恩，和这台机器上的风帆。
-   **远程服务器和发布：** 可选 [远程MCP准备就绪](https://npmcn.com/package/codex-plugin-doctor/docs/architecture/remote-mcp-readiness.md)， [MCP注册表准备情况](https://npmcn.com/package/codex-plugin-doctor/docs/architecture/mcp-registry-readiness.md)，以及离线 [公共目录预飞行](https://npmcn.com/package/codex-plugin-doctor/docs/architecture/public-directory-submission-preflight.md)。

看到 [CLI参考](https://npmcn.com/package/codex-plugin-doctor/docs/guides/cli-reference.md) 有关更多命令和示例，请参见 `codex-plugin-doctor --help` 对他们所有人来说 `codex-plugin-doctor explain <finding-id>` 为 规则是什么意思。

## 安装

```bash
npm install -g codex-plugin-doctor
codex-plugin-doctor self-test
codex-plugin-doctor check .
codex-plugin-doctor check . --runtime
codex-plugin-doctor mcp path/to/mcp-package
```

## GitHub行动

```yaml
name: Validate Codex plugin

on:
  pull_request:

permissions:
  contents: read

jobs:
  doctor:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
        with:
          persist-credentials: false
      - uses: Esquetta/CodexPluginDoctor@v1.91.0
        with:
          version: "1.91.0"
          path: .
          runtime: "true"
          policy: codex-publish
```

`runtime: "true"` 运行包的代码，因此该作业保留一个只读令牌。 `codex-plugin-doctor init-ci .` 为您编写工作流。看到 [GitHub动作用法](https://npmcn.com/package/codex-plugin-doctor/docs/guides/github-action.md) 对于报告，拉取请求注释，和 输入。

## 文档

-   [CLI参考](https://npmcn.com/package/codex-plugin-doctor/docs/guides/cli-reference.md)
-   [GitHub动作用法](https://npmcn.com/package/codex-plugin-doctor/docs/guides/github-action.md)
-   [MCP快照](https://npmcn.com/package/codex-plugin-doctor/docs/guides/mcp-snapshot.md)
-   [版本控制](https://npmcn.com/package/codex-plugin-doctor/docs/guides/release-gating.md)
-   [规则目录](https://npmcn.com/package/codex-plugin-doctor/docs/rules/catalog.md)
-   [官方插件组件](https://npmcn.com/package/codex-plugin-doctor/docs/architecture/official-plugin-components.md)
-   [实际验证](https://npmcn.com/package/codex-plugin-doctor/docs/guides/real-world-validation.md)
-   [例子](https://npmcn.com/package/codex-plugin-doctor/examples/README.md)
-   [更新日志](https://npmcn.com/package/codex-plugin-doctor/CHANGELOG.md)
-   [所有文档](https://npmcn.com/package/codex-plugin-doctor/docs/README.md)

## 1.0稳定

1.0行是插件作者和CI消费者的稳定兼容性基准。

-   公共JSON模式表面和现有规则id /默认严重性在1.0之前都被视为稳定的。
-   运行时探测仍然是可选的，因为它执行包本地MCP服务器。
-   除非主版本另有说明，否则新功能将保持添加状态。

看到 [文档索引](https://npmcn.com/package/codex-plugin-doctor/docs/README.md) 有关架构、使用、安全性和贡献者指南。

## 贡献

欢迎投稿。开始 [贡献](https://npmcn.com/package/codex-plugin-doctor/CONTRIBUTING.md), [安全策略](https://npmcn.com/package/codex-plugin-doctor/SECURITY.md), [行为准则](https://npmcn.com/package/codex-plugin-doctor/CODE_OF_CONDUCT.md)，和 [验证调优问题模板](https://npmcn.com/package/codex-plugin-doctor/.github/ISSUE_TEMPLATE/validation_tuning.yml)。 `npm run release-check` 运行释放预飞行；看到 [版本控制和发布](https://npmcn.com/package/codex-plugin-doctor/docs/contributing/releasing.md)。

## 支持

如果这个工具节省了你的时间，GitHub的明星和赞助有助于表明项目值得继续下去。

-   在GitHub上标记存储库。
-   通过资源库资助链接使用GitHub赞助商。
-   为假阳性或假阴性打开验证调优问题。

## 常见问题

### codex-plugin-doctor 是什么？

用于Codex插件、技能和MCP包的CLI-first验证器具有运行时MCP协议验证。

### 如何安装 codex-plugin-doctor？

在项目目录运行 npm install codex-plugin-doctor，或使用 pnpm add / yarn add / bun add。它还提供命令行工具 codex-plugin-doctor，可以用 npx codex-plugin-doctor 直接运行。

### codex-plugin-doctor 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### codex-plugin-doctor 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### codex-plugin-doctor 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=22。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### codex-plugin-doctor 可以商用吗？

codex-plugin-doctor 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### codex-plugin-doctor 还在维护吗？

最新版本 1\.91\.0 发布于 2026/11/03（今天）；至今共发布 131 个版本，其中过去 12 个月发布了 131 个；首次发布于 2026/04/29。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

