dsh-checker
开发工具 活跃维护

dsh-checker

d4go/dsh-checker

集成dsh使用后可在对应界面新增更新检查按钮,支持一键检测当前版本可用更新,帮助开发者及时确认是否需要升级依赖,无需手动查询版本信息,操作简单直接。

1
Stars 标星
0
Forks 分支
1
Watchers 关注
0
Open Issues
JavaScript
主要语言
MIT
开源协议
58 KB
仓库大小
1 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:d4go/dsh-checker
git clone https://github.com/d4go/dsh-checker.git
git clone git@github.com:d4go/dsh-checker.git
README.md main

dsh-checker

English | 中文

Update checker for DeepSeek Harness (dsh).

It adds a Check for updates button to the Web UI session header — right
before the shipped Session log button, wearing the exact same style — and
opens a centered dialog with the result:

  • already the latest release → a short confirmation;
  • newer release on npm → the version delta plus the exact upgrade commands for
    your platform (Linux / macOS / Windows), each with a one-click copy button;
  • lookup failed → the error, so you know the check actually ran.

The dialog is bilingual (中文 / English) and follows the language
configured in dsh settings (locale.preference), falling back to the
browser's language the same way the dsh UI itself does.

How it works

dsh-checker is a Cordis host plugin with three moving parts:

Piece Role
lib/main.js Stable loader shim (never edit). Imports lib/plugin.js?bust=<config.bust> so a config-only patch reload hot-deploys new code without restarting dsh.
lib/plugin.js Registers GET /dsh-checker/status (installed vs. latest version, platform-appropriate commands, configured locale) and GET /dsh-checker/banner.js, and injects the script tag into the served index.html.
lib/banner.js Browser UI, read from disk on every request: places the header button before Session log (borrowing its CSS class verbatim), renders the centered modal, runs a silent cached check on page load, and handles copy/dismiss.

Version detection resolves the installed @deepseek-ai/dsh package from the
running process itself (entry-script anchors plus well-known global npm
roots), so it works for global installs on Linux, macOS and Windows. The
latest release is detected by querying npm registries for the newest
published version across every dist-tag
(latest, next, …) — so a new
pre-release like 0.1.0-rc.8 on the next channel is never hidden — with a
5-minute host-side cache; an explicit button click always bypasses the cache.
Registries are tried in order with an automatic fallback
(registry.npmjs.org, then the registry.npmmirror.com mirror — npmjs.org is
frequently unreachable from CN hosting), overridable via config.registryUrls.

The upgrade command defaults per platform and can be overridden per
deployment. Only the install command is shown by default — dsh is not
necessarily registered as a service on the host, so no restart command is
assumed; when it is missing, the dialog shows a plain note to restart whatever
runs dsh instead:

Platform Install (default)
Linux sudo npm install -g @deepseek-ai/dsh@latest
macOS sudo npm install -g @deepseek-ai/dsh@latest
Windows npm install -g @deepseek-ai/dsh@latest

Running dsh under a service manager? Set restartCommand in the entry config
(e.g. systemctl --user restart deepseek-dsh-web) and it is shown as the
second, copyable command.

Install

Requirements: dsh 0.1.0-rc era builds with the webServer service (any
recent release), Node ≥ 22.

Option A — clone and mount (quick start)

git clone https://github.com/d4go/dsh-checker.git ~/dsh-checker

Append to ~/.dsh/cordis.patch.yml (or a profile's cordis.patch.yml),
fixing the path:

- insert:
    - id: dsh-checker
      name: /home/you/dsh-checker/lib/main.js
      config:
        bust: 1

The user patch layer is hot-watched: save the file and the plugin mounts
without restarting dsh. Refresh the page.

Option B — install into the profile as a package

dsh plugin --profile web add github:d4go/dsh-checker

then mount it with a profile-relative name:

- insert:
    - id: dsh-checker
      name: ./node_modules/dsh-checker/lib/main.js
      config:
        bust: 1

Configuration

Entry config keys:

Key Default Meaning
bust 0 Bump to hot-deploy edits of lib/plugin.js.
installCommand platform default Overrides the upgrade command shown first.
restartCommand (none) Optional second command for deployments that run dsh under a service manager; set "" to hide it.
previewUpdate false Preview mode: pretend a newer version exists (no registry lookup) so the upgrade dialog can be tried out.
registryUrls npmjs then npmmirror Custom registry base URLs, tried in order; the first reachable one wins.

HTTP surface

  • GET /dsh-checker/status — JSON: { ok, platform, locale, current, latest, latestTag, upToDate, commands, checkedAt } (add ?refresh=1 to force a fresh registry lookup).
  • GET /dsh-checker/locale — JSON: { ok, locale }; the banner polls it so the UI language follows dsh settings live.
  • GET /dsh-checker/banner.js — the UI script.

Uninstall

Remove the insert block from your patch file (hot-applied), then delete the
clone. Everything lives outside the dsh installation, so dsh upgrades neither
touch nor require it.

Development

  • lib/banner.js edits: refresh the page — no bump, no reload.
  • lib/plugin.js edits: bump bust in the patch config — the shim imports a
    fresh module URL through config-only HMR.
  • npm run check syntax-checks all three modules.

License

MIT