dsh-plugin-doctor:按 dsh-plugin 目录规则审计插件仓库

前言

DeepSeek Harness(DSH)生态里,插件要进社区目录,除了功能说明,还要满足一批「机械规则」:dsh.bundle 清单、bundle patch 行、与 harness 匹配的 @deepseek-ai/dsh* peer 范围、可随包分发的实现文件、仓库年龄、dsh-plugin GitHub topic 等。这些项往往在 maintainer 人工审阅之前就静默通过或静默失败。手工对照文档逐项核对既慢,也容易漏掉 prerelease harness 下的 semver 陷阱。

下面介绍维护者 Tim-ReJet 的工作流类插件 dsh-plugin-doctor:对目标仓库做只读审计,同一套引擎既注册为模型侧工具 plugin_doctor,也可独立 CLI 运行。

这是什么

dsh-plugin-doctor 是 DSH 宿主插件与 CLI,依据 dsh-plugin 主题目录 对提交项执行的机械规则,审计一个插件仓库能否在结构上满足上架要求。审计不写回被检仓库;除非显式开启网络相关选项,否则不发网络请求。

仓库:https://github.com/Tim-ReJet/dsh-plugin-doctor
目录页:https://www.skillhub.cn/plugins/Tim-ReJet/dsh-plugin-doctor

核心功能

最多运行十五项检查;具体数量取决于仓库能否解析 manifest(无可用 manifest 时检查更少),其中两项仅在对应条件存在时运行(patch 在包目录外、或 peer range 超出 checker 建模能力)。

检查 id 失败级别 读取内容(摘要)
manifest.package-json error 根或子包 package.json 存在且可解析,并声明 dsh.bundle
manifest.bundle error 声明 dsh.bundle.patch(仅 dsh.client 无法安装)
manifest.bundle-patch-file error patch 文件存在、为文件、非空
manifest.bundle-patch-location warn(条件) patch 是否在包目录内以便随包分发
manifest.bundle-patch-rows error patch 为顶层 YAML 序列,行含 id/name,且至少一行指向本包
manifest.peer-dependencies warn 官方 @deepseek-ai/* 不应放在 dependencies
manifest.peer-prerelease error 各 @deepseek-ai/dsh* peer 是否 admit 当前 harness 构建(含 prerelease 门控)
manifest.peer-range-parsed warn(条件) 无法建模的 range 语法会明示,不猜测
repo.age error 根提交最老者至少满一天(git 历史)
repo.implementation error manifest 目录下存在经 main/bin/exports/files 或 fallback 可达的实现文件
packaging.meta-bundle warn bundle 是否同时带 patch 与自身行为(仅依赖列表不算)
description.substance error package.json 有 description
description.marketing error 描述说明插件做什么,而非营销话术(词表启发式)
packaging.repository warn repository 是否指向本仓库,或无法在无 origin 时确认
repo.topic error GitHub 是否带 dsh-plugin topic(需 --network,否则跳过)

每项失败会给出具体修复建议。CLI 退出码:无 error 为 0;--strict 下 warning 也计失败;用法错误为 2。

Prerelease 相关:manifest.peer-prerelease 针对「看起来正确、却在 prerelease harness 上静默不匹配」的 range 报错;checker 对 caret、tilde、hyphen、x-range、比较符等与 node-semver 在 fixtures 表中的期望对齐,无法解析则走 manifest.peer-range-parsed。

明确不覆盖的范围(README 原文):不验证描述是否与行为一致、不做安全审计、不检查目录条目其余字段与截图规则、不判断代码是否 stub、不判断分类是否合适或是否重复、不判断维护活跃度、不依赖 npm 发布与下载量。全绿不等于 maintainer 审源码。

安装与启用

插件以当前 DSH 进程权限运行;安装前请自行查看源码与 MIT 许可证。Node 要求 >=20(见仓库 package.json)。

发布到 npm 后,向 profile 安装一次:

dsh plugin --profile web add dsh-plugin-doctor

在 npm 发布前,从 GitHub 安装:

dsh plugin --profile web add github:Tim-ReJet/dsh-plugin-doctor

两种方式都会把 bundle 层追加到该 profile 的 dsh.profile.bundles,层内插入名为 plugin-doctor 的 host 行。确认层已合成:

dsh --profile web --dump-config | grep -A 3 plugin-doctor

本地开发可对源码 checkout 用 patch 覆盖加载入口,而跳过 install(路径改为你的绝对路径):

# doctor.overlay.yml
- insert:
    - id: plugin-doctor
      name: '/absolute/path/to/dsh-plugin-doctor/src/index.js'
      config:
        path: '/absolute/path/to/the/repository/you/are/auditing'
dsh --profile web --patch ./doctor.overlay.yml

典型用法

在已 compose 该插件的会话中,让模型调用工具即可,例如:

Run plugin_doctor on this repository and fix what it reports.

返回字段包括 ok、errors、warnings、report。path、strict、network 默认来自 cordis.patch.yml 中该行的 config。

CLI(在插件仓库 checkout 内,无需 install):

node bin/dsh-plugin-doctor.mjs [path]

常用参数:

Flag 作用
--strict warning 也计入失败退出码
--network 校验 GitHub dsh-plugin topic(经 gh 或 GH_TOKEN 请求 GitHub)
--harness-version <version> 用指定 harness 版本测 peer,而非自动检测
--now <iso-date> 覆盖仓库年龄检查的时钟(测试用)
--json 输出完整 JSON
--verbose 列出通过的检查
--emit-entry 打印目录期望的 data/plugins/<owner>__<repo>.yml 条目(描述会转义以避免 YAML 标量陷阱)

仓库内还可运行 npm run doctor 对自身审计(新仓库会因 repo.age 未满一天而 exit 1,属目录规则本身)。

适用场景与注意

适合:准备向 dsh-plugin 社区目录提交或维护插件仓库的开发者,在 push 或提 PR 前做清单与 manifest 自检;CI 中可用 CLI 与 --strict/--json 做门禁。

注意:

  1. 只读审计,不改被检仓库;默认不联网,repo.topic 在未加 --network 时会报告为 skipped。
  2. 社区目录站点(如 skillhub.cn)与 DeepSeek / 幻方无官方从属关系,本文仅介绍第三方工作流插件,非「官方应用商店」内置能力。
  3. 插件 v0.1.0;GitHub 星标为 0,属早期工具,行为以仓库 README 与测试为准。

结尾

dsh-plugin-doctor 把目录上架前容易静默失败的机械规则收成一次可重复运行的审计,并单独强调 prerelease peer range 问题;适合作为 DSH 插件作者提交前的自检步骤。详情见 GitHub 仓库 与 SkillHub 目录页。

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye