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 目錄頁。

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

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

小夜