Development & Runtime

dsh-plugin-doctor

lin-cheng-lab/dsh-plugin-doctor · ★ 0

lin-cheng-lab

DSH plugin health check — inspect before installing any DSH plugin to prevent startup crashes from rc-version mismatches.

README body is shown in Chinese.

License
MIT
Added
2026-08-23
Maintenance
active
Install kind
github

No manifest check is available; listing does not imply compatibility or security review.

安装

dsh plugin --profile web add github:lin-cheng-lab/dsh-plugin-doctor

GitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试

For install and environment setup, plus plugin development tutorials, see DSH community docs ↗

README

Source README · body: zh · Read Chinese README

Table of contents
  1. 为什么需要它
  2. 安装
  3. 使用
  4. 工作原理
  5. 开发
  6. 许可

DSH 插件体检工具 —— 安装任何 DSH 插件之前,先体检再装,防止 rc 版本不匹配导致的启动崩溃。

为什么需要它

DSH 插件生态发展很快,很多插件还在快速迭代(rc 版本阶段)。插件声明的 peerDependencies(如 @deepseek-ai/dsh-tools@^0.0.1)与你本机的 DSH 版本 (如 0.1.0-rc.6)不匹配时,装进去轻则工具不工作,重则 web 界面直接起不来。

本插件把"装之前先检查"变成一条命令,输出一份体检报告:

检查项 说明
🏥 本地环境 读取本机 DSH / cordis / dsh-tools / dsh-workflow 版本
🔗 仓库可访问 插件仓库是否公开(404 直接拦下,防止装"幽灵插件")
📦 bundle 声明 是否声明 dsh.bundle.patch(官方可安装格式)
⚖️ peer 兼容性 核心:插件要求的版本 vs 本机实际版本逐项对比(semver 匹配)
🏗️ 构建产物 main 指向的入口文件是否已提交到仓库

体检结论三档:🟢 ok(可以装)· 🟡 warn(谨慎,注意风险项)· 🔴 danger(别装,装了会崩)。

安装

# 从 GitHub 安装(发布后)
dsh plugin --profile web add "github:<你的用户名>/dsh-plugin-doctor"

# 或从本地源码安装
dsh plugin --profile web add "file:/path/to/dsh-plugin-doctor"

重启 profile 后生效:

dsh --profile web

使用

安装后,向 DSH 说一句人话即可,例如:

帮我用 plugin_doctor 检查一下 dsh-external/dsh-deep-research

工具接受三种输入:

  • GitHub 仓库 URL:https://github.com/owner/repo
  • owner/repo 简写:owner/repo
  • npm 包名:@scope/name 或 name

输出示例(节选):

{
  "target": "dsh-external/dsh-deep-research",
  "verdict": "danger",
  "summary": "体检不通过,不要安装",
  "checks": [
    { "name": "本地环境", "status": "pass", "detail": "DSH 0.1.0-rc.6 · cordis 4.0.1 · dsh-tools 0.1.0-rc.6 ..." },
    { "name": "仓库可访问", "status": "pass", "detail": "github.com/dsh-external/dsh-deep-research 可访问" },
    {
      "name": "peer 兼容性",
      "status": "fail",
      "detail": "2 个 peer 依赖与本地版本不匹配(rc 不匹配风险!)",
      "items": [
        { "dep": "@deepseek-ai/dsh-tools", "required": "^0.0.1", "installed": "0.1.0-rc.6", "ok": false },
        { "dep": "@deepseek-ai/dsh-workflow", "required": "^0.0.1", "installed": "0.1.0-rc.6", "ok": false }
      ]
    }
  ],
  "recommendation": "不要安装:存在不兼容项,装进去可能导致启动崩溃。等插件更新适配后再装。"
}

工作原理

  • 网络检查走 DSH 内置 web 服务(ctx.web.fetch),不需要额外权限
  • 本机版本走 fs 服务读取全局安装的 DSH 包清单
  • semver 匹配为内置纯函数实现(零依赖),支持 ^ ~ >= <= > < = * 与多条件范围, 正确处理 prerelease(rc)版本规则
  • 工具通过 ctx.tools.register(defineTool(...)) 注册,随 profile 加载/卸载

开发

npm install --legacy-peer-deps   # 安装 typescript(跳过未发布的 @deepseek-ai peer)
npm run build                    # tsc → lib/

类型解析依赖本机 DSH 安装中的 @deepseek-ai/cordis 与 @deepseek-ai/dsh-tools:

ln -sfn <dsh安装>/node_modules/@deepseek-ai/cordis  node_modules/@deepseek-ai/cordis
ln -sfn <dsh安装>/node_modules/@deepseek-ai/dsh-tools node_modules/@deepseek-ai/dsh-tools

许可

MIT