find-plugin:在 DSH 中搜索并受控安装社区插件

前言

DSH 的扩展能力可以拆成插件,但社区插件分散在 GitHub。一个仓库标了 topic:dsh-plugin,并不等于它可用,也不等于它值得信任。如果手动完成搜索、核对 bundle、审查生命周期脚本、固定版本、修改 profile、确认加载,步骤会比较多。

find-plugin 面向这条链路:它在 DSH 中注册工具,先搜索社区插件,再做静态检查和风险披露,经过 DSH approval 后固定 commit 安装,并校验安装结果。

这是什么

find-plugin 是由 graceen2331-prog 维护的 DSH 插件,许可证为 MIT。它注册两个 DSH 工具:find_plugininstall_plugin

V1 直接依赖 GitHub 和 DSH 官方 plugin manager,不引入 registry、embedding、数据库或 Web UI。

核心功能

find_plugin

find_plugin 接收:

{ query: string }

它只搜索 GitHub topic:dsh-plugin,本地关键词排序,最多返回 5 项。返回字段包括仓库名称、描述、stars、更新时间、GitHub URL、package name 与 bundle patch。

它会检查根 package.jsondsh.bundle.patch 和 patch 引用的构建入口,列出 installpreparepostinstall 及明显风险,并过滤归档或禁用仓库、bundle/profile 混用、危险路径、空 patch、缺失构建产物等无效候选。

GitHub 未认证搜索额度较低。可选通过 DSH_FIND_PLUGIN_GITHUB_TOKENGITHUB_TOKENGH_TOKEN 提供 token,且 token 只发送给 api.github.com

install_plugin

install_plugin 接收:

{
  owner: string
  repo: string
  profile?: string
}

profile 默认为 web。执行时,它会获取 default branch 的完整 commit SHA,并在该 SHA 上重新验证 bundle;在 DSH approval 中展示仓库、package、目标 profile、固定 SHA、生命周期脚本和风险;只有 allowed-once 才继续。

安装时,通过 DSH 官方 plugin manager 安装 github:<owner>/<repo>#<40-char-sha>,并使用 --ignore-scripts。之后验证 profile dependency、SHA pin、dsh.profile.bundles、bundle patch 和官方 --dump-config

安装成功后返回 restartRequired: true;V1 默认当前 runtime 不会热加载新增 bundle。

安装与启用

前置要求:

  • Node.js 20 或更高版本。
  • pnpm 必须在 PATH 中可用,因为当前 DSH 官方 plugin manager 会在 profile 目录中调用 pnpm

安装到 web profile:

npx @deepseek-ai/dsh plugin --profile web add github:graceen2331-prog/find-plugin

然后启动或重启 Web surface:

npx @deepseek-ai/dsh web

经过上面的步骤,插件会注册 find_plugininstall_plugin 两个 DSH 工具。本仓库已提交 lib/ 构建产物;安装和运行不依赖本包自身的 prepareinstallpostinstall

典型用法

在 DSH 中调用 find_plugin 时传入 { query: string }。拿到候选仓库后,可以用 install_plugin 安装其中一个,传入 { owner: string, repo: string, profile?: string }profile 不传时默认 web

对于开发或验证,仓库提供以下命令:

pnpm install --ignore-scripts
pnpm test
pnpm pack

发布前应在空的 DSH_HOME 中执行前面的 GitHub 安装命令,重启 Web surface,并从 DSH tool registry 确认两个工具已经注册。

适用场景与注意

适合在 DSH 中查找社区插件,并在安装前完成检查、审批和固定 commit。需要注意:GitHub topic 不是信任信号;静态检查只能过滤明显问题,不能替代完整源码审计。

DSH 插件最终在 Harness 进程内运行,拥有该进程权限,并不是安全沙箱。

V1 永不执行依赖的生命周期脚本;依赖 prepare 才生成运行文件、且没有提交构建后 JS 的插件会被过滤或加载失败。固定顶层仓库 commit 可以防止检查与安装之间的 branch 移动,但不等于完整的供应链证明。approval 是一次性授权;拒绝、取消或没有可用 approval channel 时不会安装。

安装前建议检查源码、许可证和仓库状态。find_plugin 的未认证搜索额度较低,如需要可选用 token;token 只发送给 api.github.com

结尾

find-plugin 的价值在于把社区插件的安装动作放进一个可检查、可批准、可固定 commit 的流程里。它不是替代源码审计,也不是把 DSH 插件隔离成沙箱,而是减少手动核对和版本漂移带来的常见错误。

GitHub 仓库:

https://github.com/graceen2331-prog/find-plugin

目录页(插件线索):

https://www.skillhub.cn/plugins/graceen2331-prog/find-plugin
羽毛球分组比赛记分
小程序二维码

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

小夜