From f5f57b46698b05bc26aecdad252a00e303d0271f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=AB=E6=88=91=E5=B0=8F=E6=9D=A8=E5=90=8C=E5=AD=A6?= Date: Fri, 18 Sep 2026 22:26:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20dsh=20plugin=20add=20=E6=94=B9=E7=94=A8?= =?UTF-8?q?=20GitHub=20tar.gz=EF=BC=8C=E9=81=BF=E5=85=8D=20pnpm=20?= =?UTF-8?q?=E6=8A=8A=20zip=20=E5=BD=93=20gzip=20=E8=A7=A3=20(#26)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- README.md | 34 +++++++++++++++++++--------------- README.zh-CN.md | 33 +++++++++++++++++++-------------- lib/update.js | 9 +++++---- 3 files changed, 43 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 6b02cf8..2c60d91 100644 --- a/README.md +++ b/README.md @@ -97,11 +97,13 @@ After install: Web **Apply / Restart / Uninstall** affect Web only. Desktop **Apply / Restart / Uninstall** affect the desktop app only — they do not launch `dsh web`. > 🌐 **Plugin hub:** [DeepSeek Harness Hub](https://deepseek.stream/plugins/dsh-purge) (docs only — **do not** install via `deepseek.stream/api/plugins/download?...`; that URL is not a pnpm tarball and fails with `ERR_PNPM_TARBALL_EXTRACT`) +> +> `dsh plugin add ` hands the URL to pnpm as a **remote tarball**. Use GitHub `master.tar.gz`. A `.zip` archive is ZIP, not gzip, and fails with `ERR_PNPM_TARBALL_DECODE_GZIP` ([#26](https://github.com/YuJunZhiXue/dsh-purge/issues/26)). ### Web (default) ```sh -dsh plugin --profile web add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip +dsh plugin --profile web add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz ``` If this directory is already a clone: @@ -117,7 +119,7 @@ Then stop `dsh web`, start it again, and **Apply** on the Web Settings page. If Open community [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop) and run this in the **built-in terminal** (`dsh` is the desktop wrapper; default profile is `desktop`): ```sh -dsh plugin add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip +dsh plugin add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz ``` Do not use official `dsh plugin --profile desktop` on PATH (it is rejected). Do not use `dsh://` (that is the official EXE). @@ -127,7 +129,7 @@ Then quit the tray, reopen `DSH Desktop.exe`, and **Apply** on the **desktop** S From a system terminal, use the app’s own CLI. Locate `DSH Desktop.exe` from the running process or the default install locations: ```powershell -$zip = "https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip" +$zip = "https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz" $exe = (Get-Process -Name "DSH Desktop" -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty Path) if (-not $exe) { $exe = @( @@ -146,7 +148,7 @@ $env:DSH_DESKTOP_DEFAULT_PROFILE = "desktop" & $exe --expose-internals $cli plugin add $zip ``` -For a custom install folder, set `$exe` to `DSH Desktop.exe` in that folder. The zip is the default source so a local path with spaces cannot split the command. +For a custom install folder, set `$exe` to `DSH Desktop.exe` in that folder. The tarball URL is the default source so a local path with spaces cannot split the command. ### Hand this to an AI (install only) @@ -164,7 +166,7 @@ Install the DeepSeek Harness plugin `dsh-purge`. Confirm the host first and inst If `dsh` is not on PATH, tell the user and stop. ```sh -dsh plugin --profile web add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip +dsh plugin --profile web add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz ``` If this directory is already a clone, use `dsh plugin --profile web add .`. @@ -176,13 +178,13 @@ Do not use official `dsh plugin --profile desktop` on PATH. Do not use `dsh://`. Default: already inside Desktop’s built-in terminal: ```sh -dsh plugin add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip +dsh plugin add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz ``` From a system terminal: use the running `DSH Desktop` process Path, or the default locations `%LOCALAPPDATA%\Programs\DSH Desktop\DSH Desktop.exe`, `%ProgramFiles%\DSH Desktop\DSH Desktop.exe`. Do not scan the whole disk. Then: ```powershell -$zip = "https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip" +$zip = "https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz" $exe = (Get-Process -Name "DSH Desktop" -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty Path) if (-not $exe) { $exe = @( @@ -204,7 +206,7 @@ $env:DSH_DESKTOP_DEFAULT_PROFILE = "desktop" **Official Harness desktop EXE** ```sh -dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip +dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz ``` After the command finishes, tell the user to fully quit and restart the host they just installed into, then **Apply** on that host’s Settings page. Do not Apply Web from Desktop or Desktop from Web. Then stop. @@ -220,19 +222,19 @@ If the **official DeepSeek Harness desktop client (EXE)** is installed, the butt CLI equivalent: ```sh -dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip +dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz ```

🌐 Open Hub page  ·  - 🚀 Install in desktop client + 🚀 Install in desktop client

🔗 **Raw protocol URL:** ``` -dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.7&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.zip +dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.7&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz ``` **Web trigger example:** @@ -248,7 +250,7 @@ export function installDshPurgeToDesktop() { version: '1.1.7', repo: 'YuJunZhiXue/dsh-purge', permissions: '系统提示词注入, 本机补丁, 设置页', - downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip', + downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz', }); const deepLink = `dsh://plugin/install?${params.toString()}`; @@ -264,7 +266,7 @@ export function installDshPurgeToDesktop() { **HTML link:** ```html - + 🚀 Install in desktop client ``` @@ -278,7 +280,7 @@ export function installDshPurgeToDesktop() { | version | `1.1.7` | Semver | | repo | `YuJunZhiXue/dsh-purge` | GitHub repo | | permissions | `系统提示词注入, 本机补丁, 设置页` | Requested permissions | -| downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip` | Zip URL | +| downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz` | GitHub tarball (not `.zip`) | ### Manual install @@ -533,6 +535,7 @@ node --check lib/host.js node --check lib/rewind.js node --check client.js node --test test/surface.test.js +node --test test/update-spec.test.js ``` --- @@ -612,7 +615,8 @@ If nothing is found, set `DSH_BASE` / `DSH_DESKTOP_INSTALL`. No files are change ### 1.1.7 -- Install docs split **Web / Desktop** defaults: Web uses official `dsh --profile web`; Desktop uses the built-in terminal `dsh plugin add `. +- **#26:** `dsh plugin add` / in-app update use GitHub `master.tar.gz`. A `.zip` URL is not a pnpm tarball (`ERR_PNPM_TARBALL_DECODE_GZIP`). Local overlay still downloads the zip for `tar` / Expand-Archive. +- Install docs split **Web / Desktop** defaults: Web uses official `dsh --profile web`; Desktop uses the built-in terminal `dsh plugin add `. - Desktop Apply / Restart / Uninstall only touch the running desktop install tree, not official Web / npm-global. - Desktop package root follows the running `DSH Desktop.exe` (default or custom install folder). diff --git a/README.zh-CN.md b/README.zh-CN.md index 70662c7..09f3d81 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -94,11 +94,13 @@ Web 端和桌面端**分开装、分开清洗**,互不影响。 Web 的「应用 / 重启 / 卸载」只动 Web。桌面端的「应用 / 重启 / 卸载」只动桌面应用,不会去拉 `dsh web`。 > 🌐 **插件生态市场**:[DeepSeek Harness Hub](https://deepseek.stream/plugins/dsh-purge)(只看介绍;**不要**用 `deepseek.stream/api/plugins/download?...`,那个地址不是 pnpm 能解的 tar,会报 `ERR_PNPM_TARBALL_EXTRACT`) +> +> `dsh plugin add ` 会把地址交给 pnpm 当 **远程 tarball**。请用 GitHub 的 `master.tar.gz`。`.zip` 是 ZIP 不是 gzip,会报 `ERR_PNPM_TARBALL_DECODE_GZIP`([#26](https://github.com/YuJunZhiXue/dsh-purge/issues/26))。 ### Web 端(默认) ```sh -dsh plugin --profile web add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip +dsh plugin --profile web add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz ``` 当前目录已是本仓库时: @@ -114,7 +116,7 @@ dsh plugin --profile web add . 打开社区 [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop),在**自带终端**里执行(这里的 `dsh` 是桌面包装脚本,默认 profile 就是 `desktop`): ```sh -dsh plugin add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip +dsh plugin add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz ``` 不要用 PATH 上的官方 `dsh plugin --profile desktop`(会被拒绝)。不要用 `dsh://`(那是官方 EXE)。 @@ -124,7 +126,7 @@ dsh plugin add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/maste 从系统终端安装时,用桌面端自带 CLI。按正在运行的进程、默认安装位置定位 `DSH Desktop.exe`: ```powershell -$zip = "https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip" +$zip = "https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz" $exe = (Get-Process -Name "DSH Desktop" -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty Path) if (-not $exe) { $exe = @( @@ -143,7 +145,7 @@ $env:DSH_DESKTOP_DEFAULT_PROFILE = "desktop" & $exe --expose-internals $cli plugin add $zip ``` -自定义安装目录时,把 `$exe` 换成该目录下的 `DSH Desktop.exe`。默认用 zip,避免本地路径空格把命令拆开。 +自定义安装目录时,把 `$exe` 换成该目录下的 `DSH Desktop.exe`。默认用 tar.gz 地址,避免本地路径空格把命令拆开。 ### 交给 AI 安装(只装插件) @@ -161,7 +163,7 @@ $env:DSH_DESKTOP_DEFAULT_PROFILE = "desktop" `dsh` 不在 PATH 就告诉用户后停止。 ```sh -dsh plugin --profile web add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip +dsh plugin --profile web add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz ``` 当前目录已是本仓库时改用 `dsh plugin --profile web add .`。 @@ -173,13 +175,13 @@ dsh plugin --profile web add https://github.com/YuJunZhiXue/dsh-purge/archive/re 默认:已在桌面端自带终端里时直接跑: ```sh -dsh plugin add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip +dsh plugin add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz ``` 从系统终端安装时:用正在运行的 `DSH Desktop` 进程 Path,或默认位置 `%LOCALAPPDATA%\Programs\DSH Desktop\DSH Desktop.exe`、`%ProgramFiles%\DSH Desktop\DSH Desktop.exe`。不要全盘扫描。然后: ```powershell -$zip = "https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip" +$zip = "https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz" $exe = (Get-Process -Name "DSH Desktop" -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty Path) if (-not $exe) { $exe = @( @@ -201,7 +203,7 @@ $env:DSH_DESKTOP_DEFAULT_PROFILE = "desktop" **官方 Harness 桌面 EXE** ```sh -dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip +dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz ``` 命令结束后,提醒:完全退出并重启刚装的那个宿主,再在该宿主设置页点「应用」。Web 和桌面端不要交叉点应用。然后停止。 @@ -217,19 +219,19 @@ dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archiv 命令行等价: ```sh -dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip +dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz ```

🌐 打开插件市场页  ·  - 🚀 唤起客户端一键安装 + 🚀 唤起客户端一键安装

🔗 **原生协议链接:** ``` -dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.7&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.zip +dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.7&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz ``` **网页端(前端)触发代码示例:** @@ -245,7 +247,7 @@ export function installDshPurgeToDesktop() { version: '1.1.7', repo: 'YuJunZhiXue/dsh-purge', permissions: '系统提示词注入, 本机补丁, 设置页', - downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip', + downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz', }); const deepLink = `dsh://plugin/install?${params.toString()}`; @@ -261,7 +263,7 @@ export function installDshPurgeToDesktop() { **HTML 静态链接方式:** ```html - + 🚀 唤起客户端一键安装 ``` @@ -275,7 +277,7 @@ export function installDshPurgeToDesktop() { | version | `1.1.7` | 语义化版本号 | | repo | `YuJunZhiXue/dsh-purge` | GitHub 仓库 | | permissions | `系统提示词注入, 本机补丁, 设置页` | 申请权限 | -| downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip` | zip 下载直链 | +| downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz` | GitHub tarball(不要用 `.zip`) | ### 手动配置安装 @@ -528,6 +530,7 @@ node --check lib/index.js node --check lib/core.js node --check lib/rewind.js node --check client.js +node --test test/update-spec.test.js ``` --- @@ -599,6 +602,8 @@ prompt-inject.md 有内容? ──是──> 原样写入 dsh-purge systemPrompt ### 1.1.7 +- **#26:** `dsh plugin add` / 插件内更新改用 GitHub `master.tar.gz`。`.zip` 不是 pnpm tarball,会报 `ERR_PNPM_TARBALL_DECODE_GZIP`。本地覆盖安装仍下载 zip 给 `tar` / Expand-Archive。 + - 安装文档按 **Web 端 / 桌面端** 分开写默认命令:Web 用官方 `dsh --profile web`;桌面端默认在自带终端 `dsh plugin add `。 - 桌面端清洗、重启、卸载只针对当前桌面进程的安装树,不碰官方 Web / npm-global。 - 桌面端安装目录按运行中的 `DSH Desktop.exe` 定位,默认位置或自定义目录都可以。 diff --git a/lib/update.js b/lib/update.js index 0a858c6..0e2d710 100644 --- a/lib/update.js +++ b/lib/update.js @@ -11,6 +11,7 @@ import { cliInvocation } from "./desktop.js"; const REPO = "YuJunZhiXue/dsh-purge"; const BRANCH = "master"; const ZIP_URL = `https://github.com/${REPO}/archive/refs/heads/${BRANCH}.zip`; +export const TARBALL_URL = `https://github.com/${REPO}/archive/refs/heads/${BRANCH}.tar.gz`; const GITHUB_SPEC = `github:${REPO}#${BRANCH}`; const PLUGIN_ROOT = path.resolve(fileURLToPath(new URL(".", import.meta.url)), ".."); const COPY_NAMES = [ @@ -204,15 +205,15 @@ export function runDshPlugin(profile, args) { }); } -function addSpecFor(spec) { +export function pluginAddSpec(spec) { const s = String(spec || ""); - if (/\.zip(\b|$)/i.test(s) || /^https?:\/\//i.test(s)) return ZIP_URL; + if (/\.(zip|tgz|tar\.gz)(\b|$)/i.test(s) || /^https?:\/\//i.test(s)) return TARBALL_URL; if (/^github:/i.test(s) || /github\.com\/.+\.git/i.test(s)) return GITHUB_SPEC; return ""; } function dshReinstall(profile, spec) { - const addSpec = addSpecFor(spec); + const addSpec = pluginAddSpec(spec); if (addSpec) { runDshPlugin(profile, ["add", "--force", addSpec]); return; @@ -220,7 +221,7 @@ function dshReinstall(profile, spec) { try { runDshPlugin(profile, ["update", "dsh-purge"]); } catch { - runDshPlugin(profile, ["add", "--force", ZIP_URL]); + runDshPlugin(profile, ["add", "--force", TARBALL_URL]); } }