dsh-plugin-checker
v1.0.1
Published
Detect updates for installed third-party (non-builtin) DSH plugins, ask the user, and update them from the Web GUI.
Maintainers
Readme
dsh-plugin-checker
检测已安装的第三方(非内置)DSH 插件是否有更新,在 Web GUI 询问用户是否更新,并反馈更新成功 / 更新失败。
功能
- 扫描:识别
$DSH_HOME/profiles/node_modules里已安装的非内置插件(判定标准:package.json 含dsh字段,且不属于官方@deepseek-ai/*命名空间,排除自身) - 对比:逐个查询 npm registry 最新版,semver 语义比较(正确处理
rc/beta预发布号),标记有更新的插件 - 询问:Web GUI 顶部横幅列出可更新插件(名称 +
installed → latest),可单个更新或全部更新,操作前 confirm 确认 - 反馈:更新成功(绿)显示"已更新到 X",更新失败(红)显示失败原因;支持重试
- 每 6 小时自动复查;"重新检查"走
?fresh=1强制刷新
架构
- Host 半身(
lib/index.js):GET /dsh-plugin-checker/status.json— 扫描 + 版本对比(npm 查询带 5 分钟 TTL 缓存)POST /dsh-plugin-checker/update— 更新指定插件(body{ confirm: true, name },仅允许已安装的非内置插件)
- Client 半身(
lib/client.js):shell.overlay横幅,跟随 DSH 界面语言(zh / en,其余回退中文)
更新机制(布局无关)
你的机器可能用 junction 省 C 盘(
@deepseek-ai/*链接到部署目录),其它机器可能是真实拷贝。本插件不假设存储形态:
- 在临时目录执行
npm install <pkg>@latest(干净环境,不触碰 profiles 其它包) - 替换前用
lstat检测目标是否为符号链接(junction):是则只删链接、拷贝真实副本,避免自拷贝陷阱 - 旧版本自动备份到
profiles/node_modules/.dsh-plugin-backups/<pkg>-<时间戳>/ - 新版本拷贝到
profiles/node_modules/<pkg>,缺失的新增依赖一并合并
绝不直接对 profiles 执行 npm install --prefix(会清空整个 node_modules,详见项目经验记录)。
安装
包是 profile bundle(manifest 声明 dsh.bundle.patch):
# 1) 安装到 profile(真实拷贝或 npm 安装)
npm i dsh-plugin-checker
# 2) 在 $DSH_HOME/profiles/web/cordis.patch.yml 加一行- insert:
- id: dsh-plugin-checker
name: 'dsh-plugin-checker'然后应用 patch(或重启 dsh web)并刷新页面。
Notes
- 非 npm 插件(未发布到 registry 的本地插件,如部分自研插件)会被标记
onNpm: false并跳过更新检测 - 更新后部分插件需要重启
dsh web才生效(与 dsh-update-checker 的重启/看门狗机制配合使用) - 写操作均要求
{ confirm: true },防误触发
License
MIT
