dsh-plugin-check:DSH 插件仓库只读健康检查

前言

DSH 生态里插件仓库越来越多,清单协议、patch 格式、TypeScript 构建配置、hub 收录状态各自有一套约定。人工逐条对照容易漏项,CI 或模型侧也缺少统一门禁。下面介绍 omdsh-dev/dsh-plugin-check:对插件目录做静态扫描,输出合规报告与修复建议,不修改、不构建被检查仓库。

这是什么

dsh-plugin-checkomdsh-dev 维护,在 SkillHub 分类为联网工具目录页)。它在 DSH 中注册 plugin_check 工具(row id:tool-plugin-check),扫描单个或批量插件仓库,诊断清单协议、patch 格式、构建陷阱与 hub 收录状态,统一输出 JSON 文本报告。

设计要点:

  • 只读:仅使用 readdir / stat / readFile,不改动被检仓库
  • 零业务依赖:运行时只用 Node 内置模块(fs / path / child_process
  • 不执行 tsc:构建相关检查全部靠静态文本扫描

许可为 MIT;npm 包名 @omdsh-dev/dsh-plugin-check,当前版本 0.1.0,要求 Node ^22.19.0 || >=24.0.0

核心功能

三种 action

action 作用
check 检查单个插件仓库目录,返回 verdict / errors / warnings / suggestions
scan 扫描父目录下所有带 package.jsondsh-* 插件仓库,汇总报告
schema 输出全部检测项清单与判定标准,供模型或人工核对

工具参数:

参数 类型 必填 说明
action string check / scan / schema
path string 插件目录(check)或父目录(scan);默认当前工作目录
strict boolean 为 true 时 warning 升级为 error 并影响 verdict;默认 false

形态识别与 33 项检测

工具按仓库形态(registry / skill / collection / tool-bundle / bundle / infra / unknown)套用不同检查集,共 33 项,覆盖四类问题:

类别 典型 error 典型 warning
清单协议 no-manifest、invalid-name-format、missing-main-or-types、no-patch incomplete-files、missing-peer、no-bundle-decl
patch 格式 malformed-patch、patch-name-mismatch、duplicate-row-id unexpected-fields
构建陷阱 no-source-entry、no-tsconfig、missing-ts-ext-imports、lib-layout-mismatch、stale-ts-imports missing-rewrite-imports、types-path-mismatch、implicit-node-types、no-build-script
生态合规(Profile Bundle) core-row-id、missing-profile-install-example、manual-install-only、core-modification-required
hub 收录 not-in-hub(hub 检查被跳过时标注为 info,不算 warning)

判定规则:

  • verdict:0 个 error → pass;有 error → fail;仅 warning → warn
  • checks 字段记录固定检查项的执行结果(total / passed / failed / warned / skipped),而非 issue 条数

命名策略上,invalid-name-format 仅表示 npm 格式错误;合法的个人 scoped / unscoped 名称只会产生 non-org-recommended-name(warning)。推荐范围为 @deepseek-ai/*@dsh-external/*@omdsh/*dsh-*

hub 检查与安全模型

hub 收录检查离线优先:先读本地 hub catalog(DSH_HUB_SOURCEcwd/hub/),再通过 gh 读取公开 omdsh-dev/dsh-hub-workshop/catalog.json;兼容 dsh-hub-index/v0.4 与旧 repos[].name 格式。全部失败时静默降级为 skipped,报告如实标注,不记为 warning。

安装与启用

推荐通过 Profile Bundle 安装到 DSH 0.1.1-rc.1(npm)profile。web 与 headless 是不同 profile:dsh run 默认使用 headless,在 web 安装不会自动覆盖 headless。

交互式(web)profile:

dsh plugin --profile web add github:omdsh-dev/dsh-plugin-check

一次性任务(headless)profile:

dsh plugin --profile headless add github:omdsh-dev/dsh-plugin-check

包内 dsh.bundle.patch 会在安装后把插件加入 profile 的 layer stack。缺失的 peer 依赖(cordis@deepseek-ai/dsh-tools)由 profile 的 healed profiles/node_modules 回退安装提供。

本地构建后用 tarball 安装(不依赖 GitHub):

npm pack
dsh plugin --profile web add <npm pack 产物 tarball 路径>

验证是否加载成功:

dsh --profile web --dump-config | grep tool-plugin-check

启动 DSH(npm 0.1.1-rc.1 线,lib 生产模式):

npx -p @deepseek-ai/dsh@0.1.1-rc.1 dsh web

典型用法

检查单个插件仓库:

plugin_check { action: "check", path: "C:/Users/admin/Desktop/dshext/dsh-tool-csv" }
   {"repo":"dsh-tool-csv","kind":"tool-bundle","verdict":"pass","checks":{"total":24,"passed":24,...}}

扫描父目录下全部 dsh-* 插件:

plugin_check { action: "scan", path: "C:/Users/admin/Desktop/dshext" }
  → {"root":"...","scanned":11,"reports":[...]}

通过 DSH 会话调用:

dsh run "使用 plugin_check 工具检查一个插件仓库"

查看全部检测项定义:

plugin_check { action: "schema" }

适用场景与注意

适合谁

  • 插件作者在提交前自检清单、patch、构建配置与 Profile Bundle 合规性
  • CI 或模型工作流中对 dsh-* 仓库目录跑门禁,拿结构化 JSON 报告
  • 维护 hub catalog 前批量 scan 父目录,定位不合规仓库

使用前注意

  • 插件以当前 DSH 进程的权限运行;安装前应阅读 GitHub 源码 与 MIT 许可证
  • hub 检查依赖本地 catalog 或 gh 访问公开仓库;环境不满足时 hub 项会 skipped,不影响其他检查
  • 旧版 monorepo 集成、不支持 Profile Bundle 的快照,需参考 README「手动安装与旧版本兼容」段落
  • SkillHub 为独立社区目录,与 DeepSeek / 幻方无官方从属关系

结尾

dsh-plugin-check 把组织内实测踩过的清单、patch、构建与 hub 合规问题收敛成可自动执行的只读门禁。装好 profile 后,对目标目录调用 plugin_check 即可拿到 verdict 与修复建议。

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

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

小夜