DSH 插件体检:manifest/patch/entry/build/pack/install 校验、可被模型调用的 plugin_check、profile 宿主遮蔽与 BOM 检测、环境诊断、投毒预检。
安装
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:zoahdev/dsh-plugin-doctor
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
English
Health checks for DeepSeek Harness plugins — the practical answer to the dsh plugin check idea from RFC #1629, until the official command exists.
It works in two ways:
- CLI (
dsh-plugin-doctor/node lib/bin.js) — run it in your terminal or CI before opening a PR. - Plugin shell (
dsh plugin add) — once installed in DeepSeek Harness, the agent can call theplugin_checktool directly: "check whether this plugin is ready to publish", no shell needed.
What it checks
| Check | What it verifies | Default |
|---|---|---|
manifest |
package.json exists; dsh.bundle + dsh.bundle.patch + prepare + main present |
✅ |
patch |
cordis.patch.yml parses as YAML and contains at least one insert row with an id |
✅ |
entry |
main target exists (warns when not built yet) |
✅ |
files |
a files allowlist is declared |
✅ |
build |
pnpm run build succeeds |
--build |
pack + install + config |
pnpm pack, install into a fresh DSH_HOME profile, and confirm the plugin id in --dump-config |
--full |
profile-shadow |
a dsh profile has no real-directory @deepseek-ai/* copy shadowing the host instance (discussion #1697) |
--profile <dir> |
manifest-bom |
a dsh profile's package.json has no UTF-8 BOM (crashes dsh web at boot, discussion #1842) |
--profile <dir> |
large-files |
no profile file exceeds 100 MB (session logs can hit the ~512 MB stringify cap, discussion #1859) | --profile <dir> |
entry-points |
every installed plugin's main/exports target exists (source-copy installs without a build crash dsh web at boot, discussion #1965) |
--profile <dir> |
profile-deps |
the runtime @deepseek-ai scope is present (a bare npm install in a profile dir prunes the shared tree, discussion #2081) |
--profile <dir> |
native-modules |
koffi/node-pty are present in the runtime tree (npm 11 allow-scripts=false skips native builds, discussion #2081) |
--profile <dir> |
pre-execute-side-effects |
pre-execute listeners do not run host-level side effects before approval (heuristic lint, discussion #1863) | default pipeline |
shell-launcher |
child_process usage does not invoke explorer/start/open/powershell/cmd surfaces that can bypass approval/workspace limits (heuristic, discussions #1923/#1863) | default pipeline |
node / pnpm / dsh-path / port-3080 / win-bash |
environment diagnostics: toolchain on PATH, Web UI port free, and Windows bash resolvable for the minimal preset (discussion #1856) | --env |
Exit code is 0 when nothing failed, 1 otherwise. --json prints a machine-readable report for CI.
Evidence-first plugin audit
audit is a separate, read-only inspection mode. It never imports the target plugin, runs lifecycle scripts, installs dependencies, or contacts a registry. It reports:
- package identity, source repository metadata, local Git revision when available, and a SHA-256 digest of the inspected content;
- install/prepare/publish lifecycle scripts, declared dependency sources, and lifecycle scripts from locally installed direct dependencies;
- every Cordis patch operation, the affected entry ids and configuration keys, runtime
!!jsexpressions, and changes that disable approval or sandbox entries; - observed filesystem, network, process, environment, credential, dynamic-code, native-code, persistence, browser-storage, session-data, clipboard, and dynamic-module-loading capabilities;
- findings with stable rule ids, severity, confidence, redacted file-and-line evidence, coverage gaps, and honest limitations;
- upgrade differences when
--compare <old-directory>is supplied.
The scanner prefers the package's declared published files surface. When the declared main build output is absent, it falls back to the working tree and records that choice. Working-tree fallback skips tests, fixtures, examples, demos, ordinary JSON data, and undeclared development scripts; paths explicitly declared for publication are still scanned. Network combinations distinguish fixed external destinations from same-origin/loopback calls and dynamic destinations. Large generated bundles and source matches in distant file sections lower confidence because co-location is not proof of data flow.
CLI usage
npx dsh-plugin-doctor . # quick checks on the current directory
npx dsh-plugin-doctor --build ./my-plugin
npx dsh-plugin-doctor --full ./my-plugin
npx dsh-plugin-doctor preflight ./my-plugin # alias: build + full pipeline (discussion #1774)
npx dsh-plugin-doctor check ./my-plugin # same pipeline; matches the proposed `dsh plugin check` surface (RFC #1846)
npx dsh-plugin-doctor --json ./my-plugin
npx dsh-plugin-doctor audit ./my-plugin
npx dsh-plugin-doctor audit ./new-version --compare ./old-version --json
npx dsh-plugin-doctor audit-batch ./plugins/plugin-a ./plugins/plugin-b --json
npx dsh-plugin-doctor audit-batch ./plugins/* --markdown > plugin-ecosystem-audit.md
npx dsh-plugin-doctor --profile ~/.dsh/profiles/web # profile tripwire: host-shadowing + manifest BOM
npx dsh-plugin-doctor --env # environment diagnostics (node/pnpm/dsh PATH, port 3080)
npx dsh-plugin-doctor --env --port 8090 # probe a custom web port instead
npx dsh-plugin-doctor env explain DEEPSEEK_API_KEY # secret-safe env provenance (RFC #1953)
npx dsh-plugin-doctor env explain MY_KEY --json # machine-readable envelope; value always [redacted]
npx dsh-plugin-doctor --help
Run from the repo without installing (after pnpm build):
node lib/bin.js --full ./my-plugin
Plugin usage (agent-callable)
Install the plugin into a DeepSeek Harness profile:
dsh plugin --profile web add dsh-plugin-doctor # from npm
# or from a local build:
dsh plugin --profile web add ./dsh-plugin-doctor-1.6.0.tgz
Then ask the agent inside DSH:
检查一下这个插件能不能发布 —— 先跑 build,再做完整验证。 Check whether this plugin is ready to publish — run the build first, then do a full verification.
The agent calls the plugin_check tool (dir, optional build/full flags). The tool returns PASS/WARN/FAIL per check plus an overall ok flag.
What "full" really proves
--full does not just load the bundle. It:
- runs
pnpm packon the real project; - creates a fresh
DSH_HOMEprofile (no pollution of your real one); - runs
dsh plugin add <tarball>; - runs
dsh --dump-configand asserts the plugin id fromcordis.patch.ymlactually appears in the composed config.
CI also runs a real-registry agent-visibility check: a real Cordis context + real dsh-tools ToolRuntime + a scoped agent view, asserting plugin_check is visible through ctx.tools.schemas(scope) — the mechanism agents actually use (covers the dual-instance shadowing class from discussions #1697/#1782).
This is the same path the awesome-dsh-plugin maintainers use when they review plugin PRs.
Why it exists
- pnpm can silently link an older RC into a plugin's peer slot, and "loads fine" does not mean "works" (see the template runtime guard and troubleshooting).
- A repeatable local check (manifest → build → install → config) catches the failures that only show up on other people's machines.
- The
dsh webboot step currently runs on Windows in CI because the upstream npm CLI lacks the linux-x64pty.nodeprebuild (discussion #1686); doctor's install/config verification is platform-independent. - A profile-hoisted real-directory copy of
@deepseek-ai/dsh-toolscan shadow the host instance and crash every tool call (discussion #1697);--profileflags exactly that precondition before anything boots. - A UTF-8 BOM in a profile's
package.jsoncrashesdsh webat boot withUnexpected token(discussion #1842); themanifest-bomcheck catches it before boot. - Environment friction (missing pnpm, Node version, PATH, occupied web port) is the other big setup-time failure class;
--envturns it into one command (thedsh doctoridea from discussion #1719).
Related community tools
- moonquake2004/dsh-doctor — offline profile/session/env diagnostics with 19 checks mapped to community failure reports. Complementary: dsh-plugin-doctor covers the pre-publish plugin path, dsh-doctor covers the offline profile/session path. Its P5 check and our
profile-shadowcheck flag the same host-shadowing precondition from two sides. - iiwish/dsh-testkit — real-host plugin lifecycle testing (pack → install → boot → register → deterministic exercise → uninstall → reboot → residue) in a disposable Docker environment. Complementary: dsh-plugin-doctor is the fast local preflight, dsh-testkit is the full release-branch lifecycle gate.
CI
For plugin authors, the same checks ship as a one-line GitHub Action:
- uses: zoahdev/dsh-plugin-doctor-action@v1
with: { path: . }
See zoahdev/dsh-plugin-doctor-action.
The repository CI runs:
pnpm install --frozen-lockfile → typecheck → build → unit tests → packaged plugin-shell smoke (pack → fresh host install → load lib/plugin.js → register plugin_check → call the real handler → assert result) → CLI smoke → full doctor self-check (pack → fresh DSH_HOME profile → dsh plugin add → --dump-config).
Development
pnpm install
pnpm typecheck
pnpm build
pnpm test
pnpm test:integration
License
MIT © 2026 zoahdev
中文
dsh-plugin-doctor —— DeepSeek Harness 插件的健康检查工具,是 RFC #1629 中 dsh plugin check 提案在官方命令落地前的实际实现。
它有两种使用方式:
- CLI(
dsh-plugin-doctor/node lib/bin.js)——在终端或 CI 里跑,适合提 PR 前自检。 - 插件外壳(
dsh plugin add)——装进 DeepSeek Harness 后,agent 可以直接调用plugin_check工具:说一句"检查一下我这个插件能不能发",不用切到终端。
检查项
| 检查 | 验证内容 | 默认 |
|---|---|---|
manifest |
package.json 存在;dsh.bundle、dsh.bundle.patch、prepare、main 齐全 |
✅ |
patch |
cordis.patch.yml 是合法 YAML,且至少有一条带 id 的 insert |
✅ |
entry |
main 指向的文件存在(未构建时给 WARN) |
✅ |
files |
声明了 files 白名单 |
✅ |
build |
pnpm run build 成功 |
--build |
pack+install+config |
pnpm pack,装进全新 DSH_HOME profile,并在 --dump-config 里确认插件 id |
--full |
profile-shadow |
dsh profile 顶层没有真实目录形式的 @deepseek-ai/* 副本遮蔽宿主实例(讨论 #1697) |
--profile <dir> |
| entry-points | 已安装插件的 main/exports 指向的文件存在(未构建的源码拷贝会导致 dsh web 启动崩溃,讨论 #1965) | --profile |
node / pnpm / dsh-path / port-3080 / win-bash |
环境诊断:工具链在 PATH 上、Web UI 端口空闲、Windows bash 可解析(minimal 预设,讨论 #1856) | --env |
退出码:全部通过为 0,否则为 1。--json 输出机器可读报告,方便接入 CI。
证据优先的插件审计
audit 是独立的只读检测模式。它不会导入被检查插件,不会运行安装脚本,不会安装依赖,也不会访问软件仓库。报告包含:
- 包名、版本、源码仓库、本地 Git 版本(如果可用),以及本次实际检查内容的 SHA-256 摘要;
- install/prepare/publish 等安装生命周期脚本、依赖来源,以及本地已安装直接依赖的生命周期脚本;
- Cordis 配置修改、受影响的 entry id 和配置键、运行时
!!js表达式,以及关闭审批或沙箱的改动; - 文件、网络、进程、环境变量、凭据、动态代码、原生代码、持久化、浏览器存储、会话数据、剪贴板和动态模块加载等能力;
- 稳定规则编号、严重程度、判断把握、经过脱敏的文件与行号证据、未覆盖范围和明确限制;
- 使用
--compare <旧版本目录>时生成升级前后差异。
扫描器优先检查 package.json files 声明的实际发布内容。声明的主构建文件不存在时,才回退到工作目录,并在报告中写明。回退扫描会跳过测试、示例、普通 JSON 规则数据和未声明的开发脚本;明确声明为发布内容的路径仍会检查。联网组合会区分外部网站、地址不确定、同源接口和本机地址。大型打包文件或相距很远的代码片段会降低判断把握,因为代码放在一起不代表存在真实数据传递。
CLI 用法
npx dsh-plugin-doctor . # 对当前目录做快速检查
npx dsh-plugin-doctor --build ./my-plugin
npx dsh-plugin-doctor --full ./my-plugin
npx dsh-plugin-doctor preflight ./my-plugin # 别名:build + 全链路(讨论 #1774)
npx dsh-plugin-doctor check ./my-plugin # 同 pipeline;对应 RFC #1846 的 `dsh plugin check` 命名
npx dsh-plugin-doctor --json ./my-plugin
npx dsh-plugin-doctor audit ./my-plugin
npx dsh-plugin-doctor audit ./new-version --compare ./old-version --json
npx dsh-plugin-doctor audit-batch ./plugins/plugin-a ./plugins/plugin-b --json
npx dsh-plugin-doctor audit-batch ./plugins/* --markdown > plugin-ecosystem-audit.md
npx dsh-plugin-doctor --profile ~/.dsh/profiles/web # profile 级宿主遮蔽 tripwire
npx dsh-plugin-doctor --env # 环境诊断(node/pnpm/dsh PATH、3080 端口)
npx dsh-plugin-doctor --env --port 8090 # 探测自定义端口
npx dsh-plugin-doctor env explain DEEPSEEK_API_KEY # 密钥安全的环境变量源大排查(RFC #1953)
npx dsh-plugin-doctor --help
不全局安装也可以(先 pnpm build):
node lib/bin.js --full ./my-plugin
插件用法(agent 可直接调用)
装进 DeepSeek Harness profile:
dsh plugin --profile web add dsh-plugin-doctor # 从 npm 安装
# 或本地构建产物:
dsh plugin --profile web add ./dsh-plugin-doctor-1.5.0.tgz
然后在 DSH 里直接对 agent 说:
检查一下这个插件能不能发布 —— 先跑 build,再做完整验证。
agent 会调用 plugin_check 工具(参数 dir,可选 build/full),逐项返回 PASS/WARN/FAIL 和整体 ok 标志。
--full 真正验证了什么
不是"能加载"就算过,而是:
- 对真实项目执行
pnpm pack; - 创建全新
DSH_HOMEprofile(不污染真实配置); - 执行
dsh plugin add <tarball>; - 执行
dsh --dump-config,断言cordis.patch.yml里的插件 id 真的出现在合成配置里。
这条路径与 awesome-dsh-plugin 维护者人工审插件 PR 的流程一致。
为什么需要它
- pnpm 可能把旧 RC 静默链进插件的 peer 槽;"能加载"不等于"能用"(参见模板的运行时守卫与故障排查)。
- 本地可重复检查(manifest → build → 安装 → 配置)能提前抓出只在别人机器上才会爆的错。
- 因为上游 npm CLI 目前缺 linux-x64 的
pty.node预编译(#1686),dsh web启动冒烟在 CI 的 Windows runner 上执行;doctor 的安装/配置验证与平台无关。 - profile 顶层若出现真实目录形式的
@deepseek-ai/dsh-tools副本,会遮蔽宿主实例并让每次工具调用崩溃(#1697);--profile在启动前就能把这个前置条件抓出来。 - 环境类故障(缺 pnpm、Node 版本、PATH、Web 端口被占)是另一大 setup 期痛点;
--env一条命令全查(#1719 的dsh doctor设想)。
相关社区工具
- moonquake2004/dsh-doctor —— 离线 profile/session/env 诊断(19 项检查,映射到社区故障报告)。与 dsh-plugin-doctor 互补:我们管发布前插件路径,它管离线 profile/session 路径;它的 P5 检查与我们的
profile-shadow检查从两个方向标记同一个宿主遮蔽前置条件。 - iiwish/dsh-testkit —— 真实宿主插件生命周期测试(pack → install → boot → register → 确定性调用 → uninstall → reboot → 残留检查),在一次性 Docker 环境运行。互补:dsh-plugin-doctor 是快速的本地 preflight,dsh-testkit 是发布分支的完整生命周期门禁。
CI
仓库 CI 完整流程:
pnpm install --frozen-lockfile → typecheck → build → 单元测试 → 打包插件外壳冒烟(pack → 全新宿主安装 → 加载 lib/plugin.js → 注册 plugin_check → 真实调用 handler → 断言结果)→ CLI 冒烟 → doctor 自检(pack → 全新 DSH_HOME profile → dsh plugin add → --dump-config)。
开发
pnpm install
pnpm typecheck
pnpm build
pnpm test
pnpm test:integration
许可证
MIT © 2026 zoahdev
链接
同类插件
yjh051108/dsh-routing-suite★ 6995
一个仓库三件套:DSH 插件包的运行时注入器(注入、热重载、卸载、开发侧挂区一键转正、路由自愈,外带设置页插件管理:列出、卸载、拖入文件夹内化)、任务感知的思维模式路由 agent 预设(router-standard / router-spec / router-react)、以及分级两级任务协议(commit_star / lock_stage / revise_do / edit_plan / mark_task / redteam_verdict 六个工具,任务状态落盘)。注入器实现直接在库内,安装的是它自己的行为而不是一份依赖清单。
strukto-ai/mirage#dsh★ 3667
把文件系统与 bash 提供者换成 mirage 虚拟工作区:文件工具与 shell 命令作用于挂载的资源(RAM、S3、Redis、Slack、Gmail、Notion、Postgres)而非宿主磁盘,支持按挂载点设置读/写/执行模式、按命令选择沙箱(进程内 monty、pyodide、quickjs;远程 docker、e2b、daytona),并可在虚拟终端中安装 CLI(git、gh、slack、linear、ntn、gws,或自行注册的程序树)作为命令头词。
hust-open-atom-club/oh-dsh★ 325
社区发行版:TUI、桌面端与 Web UI 统一体验,分层安装、一步到位。
weijiafu14/pi2dsh★ 208
Pi Host ABI 兼容引擎:装一次之后,npm 上的 Pi 扩展原包经 `dsh plugin add <pi-package>` 直接作为 DSH 原生插件挂载。已在官方 DSH 上端到端验证 pi-mcp-adapter(完整 MCP 管理面:OAuth、resources、prompts、MCP Apps、elicitation、sampling)、@tintinweb/pi-subagents、pi-code、pi-hermes-memory、pi-background-tasks;`pi2dsh inspect` 在安装前报告一个包的兼容情况。
lire1131/dsh-undo-savepoint★ 167
DSH 撤销/回退系统:配置变更自动存档,一键撤销/恢复/回退到任意版本,支持 WebUI 与离线 CLI/GUI 工具(DSH 启动失败也能救)。
Fishquito7/dsh-skill-mcp-panel★ 158
在 DSH Web 设置中管理技能与 MCP 服务器:技能卡片热启停、工作区作用域、分组、批量迁移与拖拽导入,以及 stdio/HTTP MCP 增删改查、连接测试、密钥脱敏,并附带统一 dsh-panel 命令行。
社区评论
评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。