Skip to main content
Q

dsh-plugin-auto-update

qiaoqiaohua666/dsh-plugin-auto-update

Fully automatic plugin updater — after DSH starts it scans the market for newer registry versions of installed plugins and installs them without asking (include/exclude whitelist, dry-run preview, and a scan event included).

Install

dsh plugin --profile web add github:qiaoqiaohua666/dsh-plugin-auto-update

README

Plugin auto-update

DSH 启动后自动识别插件市场,检索你已安装的插件是否有新版本,并逐个自动更新。

Behavior(行为)

  • 插件激活(= 每次 profile 启动)后等待 startDelayMs(默认 30 秒),随后执行一次扫描。
  • 扫描先识别市场/注册源(pluginManager.registries() + 可选的 pluginMarket.listIndexes()), 再读取 pluginManager.listBundles(),只保留 你安装的 registry 插件: installed === true && update === 'registry'。随发行版附带、未安装、Git 安装的插件一律不碰。
  • 对每个候选调用 listVersions(name)(该接口只返回比已安装版本新的版本,最新在前), 选出第一个声明了 dsh.bundle、兼容当前 DSH、非 prerelease(除非 skipPrerelease: false)、 非 deprecated(除非 skipDeprecated: false)的版本。
  • dryRun: false(默认)时通过 pluginManager.updateBundle(name, version, { registry }) 逐个更新, 并透传 listVersions 实际应答的注册源(官方推荐),避免退回默认源导致版本不一致;串行执行, 因为 bundle 更新会占用 profile 包锁。
  • rescanIntervalMs 设为大于 0 会周期性复查;默认 0 表示每次启动只扫描一次。

Configuration(配置)

在 cordis.patch.yml 本插件行的 config 里设置:

字段默认含义
startDelayMs30000首次扫描前的等待毫秒数。
rescanIntervalMs0周期性复查间隔毫秒;0 表示禁用。
skipPrereleasetrue不更新到 prerelease 版本。
skipDeprecatedtrue不更新到 deprecated 版本。
dryRunfalse只报告、不安装。
include[]只处理这些 bundle 名;空表示全部。
exclude[]这些 bundle 名永不更新。

Events(事件)

每次扫描结束后插件会发出 plugin-auto-update/scan 事件,负载为 { market, candidates, updated, skipped, failed, restartRequired, dryRun }。 其中 updated[].application 为 'applied' 或 'restart-required'(后者会带 restartReason), failed[] 额外带 application(overridden/failed/cancelled)、diagnostic 与回滚信息 restoredTo。

Related plugins