1.1.76: 适配 pnpm 安装(codeload + postinstall 写 bundles)

This commit is contained in:
叫我小杨同学 committed 2026-10-24 01:11:24 +08:00
1 parent 1b0a2391ca
commit 7dd16def6d
5 files changed
+178 -44

No files matched your search

+51 -19
View File
@@ -4,7 +4,7 @@
<h1 align="center">⚔️ DeepSeek Harness cybersecurity red-team tool (dsh-purge)</h1>
<p align="center"><strong>Version 1.1.75</strong></p>
<p align="center"><strong>Version 1.1.76</strong></p>
<p align="center">
<em>DeepSeek Harness jailbreak: every model, swap prompts per model. Default prompt for 小码酱. Please star ⭐ If you build on this, see Attribution required.</em>
@@ -57,7 +57,7 @@ The author's personal channel: [t.me/LLM_PoJia](https://t.me/LLM_PoJia). Notes a
## What this is
**dsh-purge** is a cybersecurity red-team plugin for the official [DeepSeek Harness](https://www.deepseek.com/harness/) already installed on your machine. **1.1.75** targets **DSH 0.2.1-rc.2** (0.2.0 still works). Official **Web** (`dsh web`) and the official **desktop EXE** are both supported. Install and Apply them separately.
**dsh-purge** is a cybersecurity red-team plugin for the official [DeepSeek Harness](https://www.deepseek.com/harness/) already installed on your machine. **1.1.76** targets **DSH 0.2.1-rc.2** (0.2.0 still works). Official **Web** (`dsh web`) and the official **desktop EXE** are both supported. Install and Apply them separately.
Harness does more than forward a prompt. It rewrites prompts, approval gates, sandbox policy, and session migration at runtime. Asking only “will the model answer” treats a host-layer block as a model refusal. This plugin separates those two layers on your own install, for controlled evaluation and for seeing which default policy is too tight.
@@ -131,9 +131,9 @@ This repo is [Apache License 2.0](./LICENSE). Forks and redistributions must kee
## Supported hosts
**1.1.75 targets DSH 0.2.1-rc.2.** 0.2.0 still works. Do not apply it to 0.1.x.
**1.1.76 targets DSH 0.2.1-rc.2.** 0.2.0 still works. Do not apply it to 0.1.x.
- **dsh 0.2.1-rc.2** (official desktop / official `dsh web`): use **1.1.75**. Fixes `{{cwd}}` / `[cwd]` crash, patch #40 match, dropped `toolFilter`, host `dsh-tools` resolve, hostFs fd, desktop helper self-kill, `file:` archive update, Ctrl+Enter steer.
- **dsh 0.2.1-rc.2** (official desktop / official `dsh web`): use **1.1.76**. Fixes `{{cwd}}` / `[cwd]` crash, patch #40 match, dropped `toolFilter`, host `dsh-tools` resolve, hostFs fd, desktop helper self-kill, `file:` archive update, Ctrl+Enter steer.
- **dsh 0.2.0-rc.2**: use **1.1.40** or newer; this line also installs.
- **dsh 0.1.7** (incl. rc.1 / rc.2): use **1.1.39** or older — pick the tag on [Releases](https://github.com/YuJunZhiXue/dsh-purge/releases).
@@ -143,7 +143,7 @@ Unmatched patches stay pending or skipped; nothing is rewritten blindly.
## Install
Follow the three steps below. **Do not use the plugin marketplace.** One-click install on [dsh-plugin.org](https://dsh-plugin.org) or in Settings → Plugin Market fails with `already queued: dsh-purge` and never runs a command. There is no npm package; do not `pnpm add dsh-purge`, and do not `github:yujunzhixue/dsh-purge`.
Follow the three steps below. **Do not use the plugin marketplace.** One-click install on [dsh-plugin.org](https://dsh-plugin.org) or in Settings → Plugin Market fails with `already queued: dsh-purge` and never runs a command. The name `dsh-purge` is not on the npm registry; do not `pnpm add dsh-purge`. If this machine only has pnpm, use the pnpm URL in step 2.
### 1. Which host are you running?
@@ -154,26 +154,44 @@ Official `dsh web` and the official desktop EXE are installed and patched **sepa
| Official `dsh web` | `web` | First command below |
| Official desktop EXE | `desktop` | Second command below |
### 2. Add the plugin with one command
### 2. Add it to the profile (`dsh` or pnpm-only)
Web:
Use `codeload.github.com`. Do not use `github.com/.../archive`: that 302 makes pnpm fail with `fetch failed`.
**If you have `dsh`:**
```sh
dsh plugin --profile web add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz
dsh plugin --profile web add https://codeload.github.com/YuJunZhiXue/dsh-purge/tar.gz/refs/heads/master
```
Desktop:
Use `desktop` instead of `web` for the EXE. If this directory is already a clone, use `.` instead of the URL.
**pnpm only (no `dsh` required):** run this inside the profile you actually use, not the repo root.
```sh
dsh plugin --profile desktop add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz
cd "$DSH_HOME/profiles/web" # desktop: profiles/desktop
pnpm add https://codeload.github.com/YuJunZhiXue/dsh-purge/tar.gz/refs/heads/master
```
If this directory is already a clone, use `.` instead of the URL, e.g. `dsh plugin --profile web add .`. If `dsh` is not on PATH, use [Manual install](#manual) or a terminal from the desktop install folder.
Windows PowerShell:
```powershell
cd "$env:USERPROFILE\.dsh\profiles\web" # desktop: profiles\desktop
pnpm add https://codeload.github.com/YuJunZhiXue/dsh-purge/tar.gz/refs/heads/master
```
`pnpm add` fetches the package; `postinstall` writes `dsh-purge` into `dsh.profile.bundles`. If you passed `--ignore-scripts`, run:
```sh
node node_modules/dsh-purge/scripts/ensure-profile-bundle.mjs
```
Success: `node_modules/dsh-purge/package.json` exists and `"dsh-purge"` is in that profile's `bundles`. If neither `dsh` nor pnpm is available, use [Manual install](#manual).
For the desktop client you can also click the button (`dsh://` deep link; it still downloads the same tarball):
<p align="center">
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.75&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"><strong>Install in desktop client</strong></a>
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.76&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%2Fcodeload.github.com%2FYuJunZhiXue%2Fdsh-purge%2Ftar.gz%2Frefs%2Fheads%2Fmaster"><strong>Install in desktop client</strong></a>
</p>
### 3. Three more clicks after the command
@@ -194,11 +212,19 @@ Web controls affect Web only; desktop controls affect the desktop app only. Do n
### If the market says `already queued: dsh-purge`
Stop clicking the market. Use the tarball command in step 2. If the CLI also says it is already there:
Stop clicking the market. Use `dsh plugin add` or pnpm from step 2 again. If the CLI also says it is already there:
```sh
dsh plugin --profile desktop remove dsh-purge
dsh plugin --profile desktop add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz
dsh plugin --profile desktop add https://codeload.github.com/YuJunZhiXue/dsh-purge/tar.gz/refs/heads/master
```
pnpm only:
```sh
cd "$DSH_HOME/profiles/desktop"
pnpm remove dsh-purge
pnpm add https://codeload.github.com/YuJunZhiXue/dsh-purge/tar.gz/refs/heads/master
```
Swap `desktop` for `web` on Web. Then do step 3.
@@ -212,17 +238,23 @@ Paste the block below to a local assistant. It should only run the install comma
<!-- AI-AGENT-START -->
Install the DeepSeek Harness plugin `dsh-purge` into the Web profile only. Do not scan the whole disk, do not read or edit other files, do not apply settings, and do not restart the app. Do not install into the desktop profile. Do not use the plugin marketplace or `github:yujunzhixue/dsh-purge`.
Install the DeepSeek Harness plugin `dsh-purge` into the Web profile only. Do not scan the whole disk, do not read or edit other files, do not apply settings, and do not restart the app. Do not install into the desktop profile. Do not use the plugin marketplace. The name is not on the npm registry; do not `pnpm add dsh-purge`.
**Web (official `dsh web`)**
If `dsh` is not on PATH, tell the user and stop.
If `dsh` is on PATH:
```sh
dsh plugin --profile web add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz
dsh plugin --profile web add https://codeload.github.com/YuJunZhiXue/dsh-purge/tar.gz/refs/heads/master
```
If this directory is already a clone, use `dsh plugin --profile web add .`. There is no npm package; do not `pnpm add dsh-purge`.
If `dsh` is missing and pnpm is available, `cd` into `$DSH_HOME/profiles/web` (often `~/.dsh/profiles/web`) and run:
```sh
pnpm add https://codeload.github.com/YuJunZhiXue/dsh-purge/tar.gz/refs/heads/master
```
If this directory is already a clone and `dsh` exists, use `dsh plugin --profile web add .`. If neither `dsh` nor pnpm is available, tell the user and stop.
After the command finishes, tell the user to fully quit and restart `dsh web`, then open **dsh-purge** beside the session title and **Apply** on **Clean**. Then stop.
@@ -541,7 +573,7 @@ The author's personal channel: [t.me/LLM_PoJia](https://t.me/LLM_PoJia). Notes a
- Scope is rendered copy, defaults, and runtime logic inside local `@deepseek-ai/*` packages, plus override files and rule sets under the harness home.
- After an upgrade, unmatched originals show as skipped. Apply still completes, and those files are left unchanged.
- Third-party plugin *source repos* outside `@deepseek-ai` are left alone (CMD silence may **best-effort** patch installed doctor / market / liangshen / mnemon at runtime).
- Install from the GitHub archive (no npm package, no plugin market): `dsh plugin --profile web add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz` (use profile `desktop` for the EXE). From this repo, `add .`.
- Install from the GitHub tarball (the name is not on npm; skip the plugin market). With `dsh`: `dsh plugin --profile web add https://codeload.github.com/YuJunZhiXue/dsh-purge/tar.gz/refs/heads/master`. pnpm only: `pnpm add` that URL inside `$DSH_HOME/profiles/web`. Use `desktop` for the EXE. From this repo, `add .`.
---
+53 -21
View File
@@ -4,7 +4,7 @@
<h1 align="center">⚔️ DeepSeek Harness 网络安全红队工具(dsh-purge)</h1>
<p align="center"><strong>Version 1.1.75</strong></p>
<p align="center"><strong>Version 1.1.76</strong></p>
<p align="center">
<em>DeepSeek Harness 破甲:让所有模型都能破甲,不同模型可换不同提示词;默认提示词面向国模「小码酱」。Jailbreak for every model — swap prompts per model. 求 Star 收藏 ⭐ 如要二开,请查看署名要求部分</em>
@@ -57,7 +57,7 @@
## 介绍
**dsh-purge** 是装在本机官方 [DeepSeek Harness](https://www.deepseek.com/harness/) 上的网络安全红队评测插件。当前 **1.1.75** 已适配 **DSH 0.2.1-rc.2**(0.2.0 仍可用)。官方 **Web**(`dsh web`)和官方 **桌面端**(EXE)都支持,两边分开装、分开应用。
**dsh-purge** 是装在本机官方 [DeepSeek Harness](https://www.deepseek.com/harness/) 上的网络安全红队评测插件。当前 **1.1.76** 已适配 **DSH 0.2.1-rc.2**(0.2.0 仍可用)。官方 **Web**(`dsh web`)和官方 **桌面端**(EXE)都支持,两边分开装、分开应用。
Harness 不只是把问题交给模型。它还会在运行时改提示词、审批门、沙箱和会话格式。只看「模型答不答」,会把宿主拦截误当成模型拒绝。这个插件在你自己的安装里把这两层分开,用来做受控评测,也用来看默认策略该不该收紧。
@@ -133,9 +133,9 @@ Harness 不只是把问题交给模型。它还会在运行时改提示词、审
## 适配范围
**1.1.75 已适配 DSH 0.2.1-rc.2**,0.2.0 仍可用。不要拿它去打 0.1.x。
**1.1.76 已适配 DSH 0.2.1-rc.2**,0.2.0 仍可用。不要拿它去打 0.1.x。
- **dsh 0.2.1-rc.2**(官方桌面 / 官方 `dsh web`):用 **1.1.75**。已修 `{{cwd}}` / `[cwd]` 整轮失败、补丁 #40 命中、`toolFilter` 废弃、`dsh-tools` 解析、hostFs fd、桌面换包自杀、`file:` 归档更新、Ctrl+Enter 插话。
- **dsh 0.2.1-rc.2**(官方桌面 / 官方 `dsh web`):用 **1.1.76**。已修 `{{cwd}}` / `[cwd]` 整轮失败、补丁 #40 命中、`toolFilter` 废弃、`dsh-tools` 解析、hostFs fd、桌面换包自杀、`file:` 归档更新、Ctrl+Enter 插话。
- **dsh 0.2.0-rc.2**:用 **1.1.40** 及以上;本页这档也能装。
- **dsh 0.1.7**(含 rc.1 / rc.2):用 **1.1.39** 及更早 —— 在 [Releases](https://github.com/YuJunZhiXue/dsh-purge/releases) 里选对应标签。
@@ -145,7 +145,7 @@ Harness 不只是把问题交给模型。它还会在运行时改提示词、审
## 安装
按下面三步走。**不要走插件市场**:[dsh-plugin.org](https://dsh-plugin.org) 或设置里的「插件市场」一键安装会报 `already queued: dsh-purge`,命令也走不成。npm 上没有这个包,不要 `pnpm add dsh-purge`,也不要 `github:yujunzhixue/dsh-purge`。
按下面三步走。**不要走插件市场**:[dsh-plugin.org](https://dsh-plugin.org) 或设置里的「插件市场」一键安装会报 `already queued: dsh-purge`,命令也走不成。npm 仓库没有 `dsh-purge` 这个名字,不要 `pnpm add dsh-purge`;本机只有 pnpm 时走第 2 步里的 pnpm 地址。
### 1. 看你开的是哪一端
@@ -156,26 +156,44 @@ Harness 不只是把问题交给模型。它还会在运行时改提示词、审
| 官方 `dsh web` | `web` | 下面第一条 |
| 官方桌面 EXE | `desktop` | 下面第二条 |
### 2. 一条命令装进 profile
### 2. 装进 profile(有 `dsh` 或只有 pnpm,走一条)
Web:
压缩包走 `codeload.github.com`,不要用 `github.com/.../archive`:后者 302,pnpm 会 `fetch failed`。
**有 `dsh`:**
```sh
dsh plugin --profile web add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz
dsh plugin --profile web add https://codeload.github.com/YuJunZhiXue/dsh-purge/tar.gz/refs/heads/master
```
桌面:
桌面把 `web` 换成 `desktop`。当前目录已是本仓库时,把网址换成 `.`。
**只有 pnpm(没有 `dsh` 也行):** 进正在用的那个 profile,不要在仓库根执行。
```sh
dsh plugin --profile desktop add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz
cd "$DSH_HOME/profiles/web" # 桌面改 profiles/desktop
pnpm add https://codeload.github.com/YuJunZhiXue/dsh-purge/tar.gz/refs/heads/master
```
当前目录已经是本仓库时,把网址换成 `.`,例如 `dsh plugin --profile web add .`。`dsh` 不在 PATH 时走 [手动安装](#manual),或在桌面安装目录里开终端。
Windows PowerShell:
桌面客户端也可以点按钮(`dsh://` 唤起,下的仍是上面那个压缩包):
```powershell
cd "$env:USERPROFILE\.dsh\profiles\web" # 桌面改 profiles\desktop
pnpm add https://codeload.github.com/YuJunZhiXue/dsh-purge/tar.gz/refs/heads/master
```
`pnpm add` 会拉包;`postinstall` 再把 `dsh-purge` 写进 `dsh.profile.bundles`。若加了 `--ignore-scripts`,再跑:
```sh
node node_modules/dsh-purge/scripts/ensure-profile-bundle.mjs
```
成功标志:`node_modules/dsh-purge/package.json` 在,且 profile 的 `bundles` 里有 `"dsh-purge"`。`dsh` 和 pnpm 都没有时走 [手动安装](#manual)。
桌面客户端也可以点按钮(`dsh://` 唤起,下的仍是同一份压缩包):
<p align="center">
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.75&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"><strong>唤起客户端一键安装</strong></a>
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.76&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%2Fcodeload.github.com%2FYuJunZhiXue%2Fdsh-purge%2Ftar.gz%2Frefs%2Fheads%2Fmaster"><strong>唤起客户端一键安装</strong></a>
</p>
### 3. 装完还要做这三下
@@ -196,14 +214,22 @@ Web 的按钮只动 Web,桌面的只动桌面。不要在一个里面点另一
### 市场报 `already queued: dsh-purge` 时
不要再点市场。按第 2 步用压缩包命令装。命令也说已经有了,就先卸再装:
不要再点市场。按第 2 步用 `dsh plugin add` 或 pnpm 再装一遍。命令也说已经有了,就先卸再装:
```sh
dsh plugin --profile desktop remove dsh-purge
dsh plugin --profile desktop add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz
dsh plugin --profile desktop add https://codeload.github.com/YuJunZhiXue/dsh-purge/tar.gz/refs/heads/master
```
Web 把两处 `desktop` 都换成 `web`。然后再走第 3 步。
只有 pnpm 时:
```sh
cd "$DSH_HOME/profiles/desktop"
pnpm remove dsh-purge
pnpm add https://codeload.github.com/YuJunZhiXue/dsh-purge/tar.gz/refs/heads/master
```
Web 把 `desktop` 换成 `web`。然后再走第 3 步。
### 交给助手安装
@@ -214,17 +240,23 @@ Web 把两处 `desktop` 都换成 `web`。然后再走第 3 步。
<!-- AI-AGENT-START -->
安装 DeepSeek Harness 插件 `dsh-purge`,只装到 Web profile。不要全盘搜索,不要读或改其它文件,不要应用设置,也不要重启应用。不要装到桌面 profile。不要走插件市场,不要 `github:yujunzhixue/dsh-purge`。
安装 DeepSeek Harness 插件 `dsh-purge`,只装到 Web profile。不要全盘搜索,不要读或改其它文件,不要应用设置,也不要重启应用。不要装到桌面 profile。不要走插件市场。npm 仓库没有这个包名,不要 `pnpm add dsh-purge`。
**Web 端(官方 `dsh web`)**
`dsh` 不在 PATH 就告诉用户后停止。
有 `dsh`:
```sh
dsh plugin --profile web add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz
dsh plugin --profile web add https://codeload.github.com/YuJunZhiXue/dsh-purge/tar.gz/refs/heads/master
```
当前目录已是本仓库时改用 `dsh plugin --profile web add .`。没有 npm 包,不要 `pnpm add dsh-purge`。
没有 `dsh`、只有 pnpm:找到 `$DSH_HOME/profiles/web`(常见 `~/.dsh/profiles/web`),在该目录执行:
```sh
pnpm add https://codeload.github.com/YuJunZhiXue/dsh-purge/tar.gz/refs/heads/master
```
当前目录已是本仓库且有 `dsh` 时改用 `dsh plugin --profile web add .`。`dsh` 和 pnpm 都没有再告诉用户后停止。
命令结束后,提醒用户:完全退出并重启 `dsh web`,再点会话标题旁的 **dsh-purge**,在「清洗」里点「应用」。然后停止。
@@ -550,7 +582,7 @@ flowchart TD
- 改动范围是本机 `@deepseek-ai/*` 包里的渲染文案、默认策略和执行逻辑,以及用户目录下的覆盖文件与规则集。
- 升级后原文对不上会显示跳过,这次应用仍算完成,不会乱改。
- 不改动非 `@deepseek-ai` 的第三方插件源仓库(启动时的 CMD 无感会**尽力**修补已装的 doctor / market / 梁神 / mnemon,属运行时补丁)。
- 安装走 GitHub 归档(npm 上没有这个包,也不要走插件市场):`dsh plugin --profile web add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz`(桌面端把 profile 换成 `desktop`)。当前目录已是本仓库时 `add .`。
- 安装走 GitHub 压缩包(npm 仓库没有这个名字,也不要走插件市场)。有 `dsh`:`dsh plugin --profile web add https://codeload.github.com/YuJunZhiXue/dsh-purge/tar.gz/refs/heads/master`。只有 pnpm:在 `$DSH_HOME/profiles/web` 里 `pnpm add` 同一地址。桌面把 `web` 换成 `desktop`。当前目录已是本仓库时 `add .`。
---
+5 -4
View File
@@ -1,6 +1,6 @@
{
"name": "dsh-purge",
"version": "1.1.75",
"version": "1.1.76",
"description": "DeepSeek Harness 破甲:让所有模型都能破甲,不同模型可换不同提示词;默认提示词面向国模「小码酱」。Jailbreak for every model — swap prompts per model. 求 Star 收藏 ⭐ 如要二开,请查看署名要求部分",
"type": "module",
"main": "lib/index.js",
@@ -35,7 +35,8 @@
],
"scripts": {
"embed-prompt": "node scripts/embed-default-prompt.mjs",
"build:client": "node scripts/build-client.mjs"
"build:client": "node scripts/build-client.mjs",
"postinstall": "node scripts/ensure-profile-bundle.mjs"
},
"license": "Apache-2.0",
"keywords": [
@@ -78,8 +79,8 @@
},
"install": {
"preferred": "tarball",
"tarball": "https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz",
"zip": "https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip",
"tarball": "https://codeload.github.com/YuJunZhiXue/dsh-purge/tar.gz/refs/heads/master",
"zip": "https://codeload.github.com/YuJunZhiXue/dsh-purge/zip/refs/heads/master",
"git": "https://github.com/YuJunZhiXue/dsh-purge.git"
}
},
+12
View File
@@ -1,3 +1,15 @@
# 1.1.76
## 中文
- 版本 **1.1.76**。适配只走 pnpm 的机器:在 profile 目录 `pnpm add` codeload 压缩包即可,`postinstall` 自动把 `dsh-purge` 写进 `bundles`。
- 安装地址改成 `codeload.github.com`,避开 `github.com/archive` 的 302(pnpm 会 `fetch failed`)。不要 `pnpm add dsh-purge`(npm 仓库没有这个名字)。
## English
- **1.1.76**. pnpm-only hosts: `pnpm add` the codeload tarball inside the profile; `postinstall` writes `dsh-purge` into `bundles`.
- Install URL is `codeload.github.com` so pnpm does not die on the `github.com/archive` 302. Do not `pnpm add dsh-purge` — that name is not on the npm registry.
# 1.1.75
## 中文
+57
View File
@@ -0,0 +1,57 @@
#!/usr/bin/env node
/**
* pnpm add 只写 dependencies,不会把插件写进 dsh.profile.bundles。
* 装进 DSH profile 时补上这一笔;在插件仓库里跑 pnpm install 则跳过。
*/
import fs from "node:fs";
import path from "node:path";
const NAME = "dsh-purge";
function readJson(fp) {
try {
return JSON.parse(fs.readFileSync(fp, "utf8"));
} catch {
return null;
}
}
function isProfilePkg(pkg) {
if (!pkg || typeof pkg !== "object") return false;
if (typeof pkg.name === "string" && pkg.name.startsWith("dsh-profile-")) return true;
return Array.isArray(pkg.dsh?.profile?.bundles);
}
function findProfileDir() {
const seeds = [process.env.INIT_CWD, process.env.npm_config_local_prefix, process.cwd()].filter(Boolean);
for (const seed of seeds) {
let dir = path.resolve(seed);
for (let i = 0; i < 8; i += 1) {
if (isProfilePkg(readJson(path.join(dir, "package.json")))) return dir;
const parent = path.dirname(dir);
if (parent === dir) break;
dir = parent;
}
}
return "";
}
const profileDir = findProfileDir();
if (!profileDir) process.exit(0);
const fp = path.join(profileDir, "package.json");
const pkg = readJson(fp);
if (!pkg) {
process.stderr.write(`dsh-purge: cannot read ${fp}\n`);
process.exit(1);
}
pkg.dsh = pkg.dsh && typeof pkg.dsh === "object" ? pkg.dsh : {};
pkg.dsh.profile = pkg.dsh.profile && typeof pkg.dsh.profile === "object" ? pkg.dsh.profile : {};
const bundles = Array.isArray(pkg.dsh.profile.bundles) ? pkg.dsh.profile.bundles : [];
if (bundles.includes(NAME)) {
process.stdout.write(`dsh-purge: already in bundles (${profileDir})\n`);
process.exit(0);
}
pkg.dsh.profile.bundles = [...bundles, NAME];
fs.writeFileSync(fp, `${JSON.stringify(pkg, null, 2)}\n`, "utf8");
process.stdout.write(`dsh-purge: appended to bundles (${profileDir})\n`);