dsh-plugin-updates:按安裝來源檢查、且只提示當前 DSH 能加載的插件更新

前言

在 DSH web profile 裏裝插件多了之後,「有沒有新版本」往往靠 npm 名字或隨手 pnpm update 判斷。兩類問題很常見:同名 npm 包與本地 link:、github: 安裝撞名,檢查器會報假更新;插件最新版要求的 DSH core 比你正在跑的新,裝上去可能直接把 Web UI 打空白。下面介紹社區插件 @lucagiftzek/dsh-plugin-updates(loader 行 id 爲 plugin-updates):只做通知,不安裝、不改 profile、不拉起子進程,並按依賴 specifier 與當前運行中的 DSH 版本篩出真正可考慮的 release。

這是什麼

維護者 lucagiftzek 在 GitHub 開源的 dsh-plugin-updates,npm 包名爲 @lucagiftzek/dsh-plugin-updates(裸名 dsh-plugin-updates 在 npm 上已被無關數據包占用)。分類上屬於 DSH 社區目錄中的聯網工具;當前 package 版本爲 0.1.2,許可證 MIT。

一句話定位:DeepSeek Harness web profile 插件,告訴你已安裝插件裏哪些有更新,且該更新當前 DSH core 實際能加載;分類依據是 package.json 裏的 specifier(^1.2.0、link:、github:、release tarball URL 等),不是裸包名。

核心功能

只通知、不代勞

插件不會替你執行安裝,不會編輯 profile,也不會運行子進程。發現可更新項後,界面提供 Copy command(帶內存上限的 apply 命令,避免在繁忙機器上裸跑 pnpm add 喫光內存);是否執行由你決定。

按 specifier 分類,避免同名誤報

  • registry(semver range、dist-tag、npm: 別名):走配置的 npm registry(默認 https://registry.npmjs.org,須在 host allowlist 內)。
  • github: / git+https://github.com/…:對照 GitHub tags 與默認分支 HEAD,pinned commit 從 pnpm-lock.yaml 讀取。
  • https://github.com/…/releases/download/…tgz:對照 GitHub releases。
  • link:、file:、workspace::本地項;僅在 upstream 映射或開啓 checkOwnRemotes 時與遠端比較。
  • 其他 git 主機或 tarball 主機:標爲 manual,需人工處理。

與運行中 DSH core 的兼容門控

對每個候選版本:若聲明瞭 engines.dsh,以該 range 爲準;否則檢查所有 @deepseek-ai/dsh 與 @deepseek-ai/dsh-* 的 peer range 是否滿足當前 core(semver.satisfies,含 prerelease 規則,與 DSH 0.2.1 loader 一致)。通過門控的最新穩定版纔會作爲「可安裝更新」提供;需要更高 core 的版本會並列展示說明(例如「0.28.2 needs a newer core」),不會當作可應用項。若你聲明的 range(如 ^0.7.4)重新 resolve 會落到 core 喫不住的版本,會單獨標記,避免誤跑裸 pnpm update。

界面與輔助能力

  • 側欄 Updates 標籤頁(依賴 tab 宿主 dsh-better-sidebar,未裝可先裝;README 示例裏將其列爲可選前置)。分組結果、npm/releases/changelog/compare 鏈接,以及 Check now、Ignore this version、Snooze、Copy command;可選角標計數(默認只計 update-compatible)。
  • Settings 中可配檢查間隔、registry、holds、upstream、notes、snooze 等(見下節)。
  • 只讀 agent 工具:plugin_updates、plugin_updates_doctor。
  • HTTP:GET /dsh-plugin-updates/api/doctor,以及 bundled doctor skill。
  • 默認零配置即可工作。

狀態與策略

每個包會有明確狀態,例如 up-to-date、update-compatible、update-needs-newer-core、held、snoozed、unreachable 等;查詢失敗爲 unreachable,不會誤報爲已最新。支持 holds(按包 semver 範圍跳過某版本,可帶 when dsh <range>)、per-package notes、安裝後提醒(afterInstall)。

安裝與啓用

環境要求(來自 package.json):Node >= 22.5,DSH >= 0.1.5-rc.1 且 < 0.3.0。瀏覽器端可熱更新;服務端半部分僅在啓動時加載,改插件後需重啓 dsh web。

README 給出的安裝順序示例:若尚未安裝側欄 tab 宿主,可先裝 dsh-better-sidebar,再裝本插件。

dsh plugin --profile web add dsh-better-sidebar   # the tab host, skip if installed
dsh plugin --profile web add @lucagiftzek/dsh-plugin-updates
# or from GitHub: dsh plugin --profile web add github:lucagiftzek/dsh-plugin-updates
# restart dsh web, then open the Updates tab

也可僅用 npm 或 GitHub 其一:

dsh plugin --profile web add @lucagiftzek/dsh-plugin-updates
# or from GitHub: dsh plugin --profile web add github:lucagiftzek/dsh-plugin-updates
# then restart dsh web: the server half loads at start only

包聲明瞭 dsh.bundle,dsh plugin add 後會出現在 dsh.profile.bundles。本地開發可用 link:/absolute/path/to/dsh-plugin-updates(需在該目錄 npm install --omit=dev)。

不卸載即可關閉:在 profile 的 cordis.patch.yml 中對 - id: plugin-updates 設 disabled: true,或設置環境變量 DSH_PLUGIN_UPDATES_DISABLE=1。

典型用法

  1. 按上文命令安裝並重啓 dsh web。
  2. 打開側欄 Updates 標籤,查看分組列表與角標(若啓用 badge)。
  3. 點擊 Check now 立即拉取;對暫不處理的版本用 Snooze 或 Ignore this version。
  4. 對標記爲 update-compatible 的項,用 Copy command 複製建議命令,在終端自行執行(插件不會代裝)。
  5. 在 Settings(DSH 0.1.5 爲 settings.yaml 的 dsh-plugin-updates 命名空間;0.2.x 爲 profile cordis.patch.yml 裏 plugin-updates 行)按需調整間隔、registry、GitHub token 環境變量名等。

常用配置項(節選,默認值以 README 爲準):

Key Default 含義
enabled true 總開關
intervalHours 12 自動檢查間隔(小時,最小 1)
initialDelaySeconds 60 啓動後首次檢查延遲
registry https://registry.npmjs.org registry 基址
githubTokenEnv "" 存放 GitHub token 的環境變量名(非 token 本身,僅用於 api.github.com)
holds / upstream / notes seeded 跳過版本、link 插件對應 upstream、結果旁備註
checkOwnRemotes false 是否用 plain local 插件的 github.com origin 比較
snoozeDays 7 默認 snooze 天數

Agent 或運維側可調用只讀工具 plugin_updates、plugin_updates_doctor,或訪問 GET /dsh-plugin-updates/api/doctor 做自檢。

適用場景與注意

適合誰:長期在 web profile 裏維護較多 DSH 插件、安裝來源混用 npm / GitHub / link:,又希望更新前知道「是不是同名包」「當前 core 能不能喫」的開發者。

權限與安全:插件以當前 dsh 進程權限運行,會按配置訪問 registry 與 api.github.com(可選 token 僅經環境變量名注入)。安裝前應閱讀 源碼與 LICENSE,確認符合你的環境與合規要求。社區目錄 SkillHub 插件頁 與 GitHub 倉庫由社區維護,與 DeepSeek / 幻方無官方從屬關係。

侷限:僅通知;不兼容 core 的版本只作說明;部分來源標爲 manual 需人工覈對;DSH 0.1.5 core 無獨立門控時,兼容結果爲「declared compatible」而非「verified」。

結尾

dsh-plugin-updates 把插件更新檢查從「按名字搜 npm」改成「按 specifier 追真實來源」,並用與 loader 一致的規則過濾掉當前 core 無法加載的版本,適合作爲 web profile 裏的只讀更新雷達。詳情與變更見 GitHub 倉庫,目錄入口見 SkillHub:lucagiftzek/dsh-plugin-updates。

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

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

小夜