@hyzyn/dsh-safe 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.en.md +36 -18
  2. package/README.md +36 -18
  3. package/package.json +1 -1
package/README.en.md CHANGED
@@ -16,13 +16,16 @@ Requires Node >= 20 and a local `dsh` command. Zero runtime dependencies.
16
16
 
17
17
  ## Quick Start
18
18
 
19
- Just replace `dsh` with `dsh-safe`:
19
+ Just swap `dsh` for `dsh-safe` — `-u` (update-and-boot) is recommended: when dsh has a new version it upgrades and restores quarantined plugins first; when dsh is already latest it behaves exactly like a plain start:
20
20
 
21
21
  ```bash
22
- dsh-safe web # same as dsh web, with auto-quarantine
22
+ dsh-safe -u web # recommended: update then boot (with auto-quarantine)
23
+ dsh-safe web # no update check, boot with auto-quarantine
23
24
  dsh-safe --profile tui --patch ./extra.yml
24
25
  ```
25
26
 
27
+ `-u` adds one version check per boot (needs network; on check failure it just warns and boots anyway) — offline or scripted environments can use the second line.
28
+
26
29
  Sample output (shown with a zh locale: a broken plugin is quarantined, then startup retries):
27
30
 
28
31
  ```
@@ -32,20 +35,23 @@ Error: dsh: plugin tree failed to load: failed to apply loader entry smoke-broke
32
35
  [dsh-safe] 重试启动…
33
36
  ```
34
37
 
35
- ## Commands
38
+ ## Commands & Options
36
39
 
37
- ```
38
- dsh-safe <dsh args…> wrap and run dsh
39
- dsh-safe -u [dsh args…] upgrade dsh first (skip if latest), then boot
40
- dsh-safe list [--profile <name>] show quarantined plugins (defaults to all profiles)
41
- dsh-safe restore --profile <name> (--id <id> | --all) [--dry-run]
42
- re-enable auto-disabled plugins (after a fixed plugin upgrade)
43
- dsh-safe update [-y] [--to <ver>] [--self] [--no-restore] [--pm npm|pnpm]
44
- upgrade dsh and dsh-safe itself, auto-restore quarantined plugins
45
- dsh-safe help
46
- ```
40
+ ### Subcommands
41
+
42
+ | Command | Description |
43
+ | --- | --- |
44
+ | `dsh-safe <dsh args…>` | wrap and run dsh (swap `dsh` for `dsh-safe`) |
45
+ | `dsh-safe -u [update options] [dsh args…]` | upgrade dsh and dsh-safe itself first (skip if latest), then boot in wrap mode; `--update` is an alias |
46
+ | `dsh-safe update [options]` | upgrade only, no boot — options below |
47
+ | `dsh-safe list [--profile <name>]` | show quarantined plugins (defaults to all profiles) |
48
+ | `dsh-safe restore --profile <name> (--id <id> \| --all) [--dry-run]` | re-enable auto-disabled plugins (after a fixed plugin upgrade) |
49
+ | `dsh-safe help` (`-h` / `--help`) | show help |
50
+ | `dsh-safe --version` (`-V`) | show version |
47
51
 
48
- Wrapper-mode options (must come before the profile / subcommand):
52
+ Every short flag has an equivalent long form (`-u` = `--update`, `-y` = `--yes`, `-h` = `--help`, `-V` = `--version`); single letters use `-`, words use `--`.
53
+
54
+ ### Wrapper-mode options (must come before the first positional argument)
49
55
 
50
56
  | Option | Description |
51
57
  | --- | --- |
@@ -53,13 +59,25 @@ Wrapper-mode options (must come before the profile / subcommand):
53
59
  | `--max-retries <n>` | Max startup retries after an auto-quarantine (default 2; `0` means pass through without quarantining) |
54
60
  | `--allow-first-party` | Allow auto-disabling first-party `@deepseek-ai/*` plugins (skipped by default; handle manually) |
55
61
 
56
- Upgrading dsh: `dsh-safe update` auto-detects the dsh package name and install method (npm / pnpm global installs), compares against the latest version and runs the upgrade for you, then automatically restores all quarantined plugins — any still incompatible under the new dsh will be auto-quarantined again on the next start. `--to <version>` pins a target version (also how you roll back), `--no-restore` skips the restore, `-y` skips the confirmation.
62
+ ### update / -u options (after `-u` or `update`; wrapper flags before the dsh args still apply)
57
63
 
58
- update / -u also checks dsh-safe's own version and upgrades whichever is outdated (single install command); `--self` updates dsh-safe only. Additionally, every wrapped boot checks for a new dsh-safe version at most once a day and prints a one-line notice (fully silent on check failure); disable with `DSH_SAFE_NO_UPDATE_CHECK=1`.
64
+ | Option | Description |
65
+ | --- | --- |
66
+ | `-y` / `--yes` | Skip the upgrade confirmation (required in non-interactive terminals) |
67
+ | `--to <version>` | Target dsh version, also how you roll back (explicit downgrades allowed); dsh-safe itself always upgrades to the latest |
68
+ | `--self` | Update dsh-safe itself only; dsh and quarantine state untouched |
69
+ | `--no-restore` | Do not auto-restore quarantined plugins after upgrading dsh |
70
+ | `--pm <npm\|pnpm>` | Force the package manager (auto-detected by default) |
59
71
 
60
- For daily use, just make `dsh-safe -u web` your start command: boots immediately when dsh is already latest (one version check), upgrades + restores first when an update is available, and only warns (still boots) if the update check itself fails. `-u` accepts update options (e.g. `-u -y web`) and wrapper flags (e.g. `-u --max-retries 0 web`).
72
+ ### Environment variables
73
+
74
+ | Variable | Description |
75
+ | --- | --- |
76
+ | `DSH_SAFE_LANG=zh\|en` | Force message language (defaults to `LC_ALL` / `LC_MESSAGES` / `LANG` / `LANGUAGE`) |
77
+ | `DSH_SAFE_NO_UPDATE_CHECK=1` | Disable the at-most-daily dsh-safe new-version notice on boot |
78
+ | `DSH_HOME` | dsh home directory (dsh's own variable; the quarantine ledger and patch paths follow it) |
61
79
 
62
- Messages follow `LC_ALL` / `LC_MESSAGES` / `LANG` / `LANGUAGE` (`zh*` Chinese, otherwise English); force with `DSH_SAFE_LANG=zh|en`.
80
+ How upgrading works: `dsh-safe update` auto-detects the dsh package name and install method (npm / pnpm global installs), compares against the latest version and runs the upgrade for you, then automatically restores all quarantined plugins — any still incompatible under the new dsh will be auto-quarantined again on the next start. For daily use, just make `dsh-safe -u web` your start command: boots immediately when dsh is already latest (one version check), upgrades + restores first when an update is available, and only warns (still boots) if the update check itself fails. `-u` accepts update options (e.g. `-u -y web`) and wrapper flags (e.g. `-u --max-retries 0 web`).
63
81
 
64
82
  ## How It Works
65
83
 
package/README.md CHANGED
@@ -16,13 +16,16 @@ npm install -g @hyzyn/dsh-safe
16
16
 
17
17
  ## 快速开始
18
18
 
19
- 把平时的 `dsh` 换成 `dsh-safe` 即可:
19
+ 把平时的 `dsh` 换成 `dsh-safe` 即可,推荐直接用 `-u`(更新并启动):dsh 有新版本时先升级并恢复被隔离的插件再启动,已最新时和普通启动完全一样:
20
20
 
21
21
  ```bash
22
- dsh-safe web # 等价于 dsh web,带自动隔离
22
+ dsh-safe -u web # 推荐:更新并启动(含自动隔离)
23
+ dsh-safe web # 不检查更新,直接带自动隔离启动
23
24
  dsh-safe --profile tui --patch ./extra.yml
24
25
  ```
25
26
 
27
+ `-u` 每次启动多做一次版本检查(需要联网,检查失败只告警、照常启动);离线或脚本环境用第二行即可。
28
+
26
29
  输出示例(坏插件被自动隔离后重试):
27
30
 
28
31
  ```
@@ -32,20 +35,23 @@ Error: dsh: plugin tree failed to load: failed to apply loader entry smoke-broke
32
35
  [dsh-safe] 重试启动…
33
36
  ```
34
37
 
35
- ## 命令
38
+ ## 命令与参数
36
39
 
37
- ```
38
- dsh-safe <dsh 参数…> 包装运行 dsh
39
- dsh-safe -u [dsh 参数…] 先升级 dsh(已最新则跳过),再启动
40
- dsh-safe list [--profile <名>] 查看隔离名单(缺省列出全部 profile)
41
- dsh-safe restore --profile <名> (--id <id> | --all) [--dry-run]
42
- 恢复被自动禁用的插件(升级修复后使用)
43
- dsh-safe update [-y] [--to <版本>] [--self] [--no-restore] [--pm npm|pnpm]
44
- 升级 dsh 与 dsh-safe 自身,并自动恢复被隔离的插件
45
- dsh-safe help
46
- ```
40
+ ### 子命令
41
+
42
+ | 命令 | 说明 |
43
+ | --- | --- |
44
+ | `dsh-safe <dsh 参数…>` | 包装运行 dsh(把平时的 `dsh` 换成 `dsh-safe`) |
45
+ | `dsh-safe -u [update 选项] [dsh 参数…]` | 先升级 dsh 与 dsh-safe 自身(已最新则跳过),再按包装模式启动;`--update` 等价 |
46
+ | `dsh-safe update [选项]` | 只升级不启动,选项见下 |
47
+ | `dsh-safe list [--profile <名>]` | 查看隔离名单(缺省列出全部 profile) |
48
+ | `dsh-safe restore --profile <名> (--id <id> \| --all) [--dry-run]` | 恢复被自动禁用的插件(升级修复后使用) |
49
+ | `dsh-safe help`(`-h` / `--help`) | 显示帮助 |
50
+ | `dsh-safe --version`(`-V`) | 显示版本 |
47
51
 
48
- 包装模式选项(必须写在 profile / 子命令之前):
52
+ 短选项都有等价的长形式(`-u` = `--update`、`-y` = `--yes`、`-h` = `--help`、`-V` = `--version`);单字母用 `-`,多字母用 `--`。
53
+
54
+ ### 包装模式选项(必须写在第一个位置参数之前)
49
55
 
50
56
  | 选项 | 说明 |
51
57
  | --- | --- |
@@ -53,13 +59,25 @@ dsh-safe help
53
59
  | `--max-retries <n>` | 自动隔离后最多重试启动的次数(默认 2;`0` 表示不隔离只透传) |
54
60
  | `--allow-first-party` | 允许自动禁用 `@deepseek-ai/*` 第一方插件(默认跳过,需手动处理) |
55
61
 
56
- 升级 dsh:`dsh-safe update` 自动探测 dsh 的包名与安装方式(npm / pnpm 全局安装)、对比最新版本后代跑升级,完成后自动恢复所有被隔离的插件——新 dsh 下仍不兼容的会在下次启动时再次被自动隔离。`--to <版本>` 指定目标版本(也是回滚方式),`--no-restore` 跳过恢复,`-y` 跳过确认。
62
+ ### update / -u 选项(写在 `-u` `update` 之后;其前的包装旗标照常生效)
57
63
 
58
- update / -u 会同时检查 dsh-safe 自身的版本,谁旧升谁(一条安装命令);`--self` 只更新 dsh-safe。另外每次包装启动时最多每天一次检查 dsh-safe 新版并提示一行(检查失败完全静默),`DSH_SAFE_NO_UPDATE_CHECK=1` 关闭。
64
+ | 选项 | 说明 |
65
+ | --- | --- |
66
+ | `-y` / `--yes` | 跳过升级确认(非交互终端必须显式加 `-y`) |
67
+ | `--to <版本>` | 指定 dsh 的目标版本,也是回滚方式(显式允许降级);dsh-safe 自身始终升到最新 |
68
+ | `--self` | 只更新 dsh-safe 自身,不动 dsh 与隔离状态 |
69
+ | `--no-restore` | 升级 dsh 后不自动恢复被隔离的插件 |
70
+ | `--pm <npm\|pnpm>` | 强制指定包管理器(缺省自动探测) |
59
71
 
60
- 日常把 `dsh-safe -u web` 当启动命令即可:dsh 已是最新时直接启动(仅一次版本检查),有更新时先升级并恢复隔离再启动,更新检查失败只告警、照常启动。`-u` 后可接 update 的选项(如 `-u -y web`)与包装旗标(如 `-u --max-retries 0 web`)。
72
+ ### 环境变量
73
+
74
+ | 变量 | 说明 |
75
+ | --- | --- |
76
+ | `DSH_SAFE_LANG=zh\|en` | 强制提示信息语言(缺省跟随 `LC_ALL` / `LC_MESSAGES` / `LANG` / `LANGUAGE`) |
77
+ | `DSH_SAFE_NO_UPDATE_CHECK=1` | 关闭启动时每天最多一次的 dsh-safe 新版提示 |
78
+ | `DSH_HOME` | dsh 的 home 目录(dsh 自己的环境变量;隔离台账与各 patch 路径随之) |
61
79
 
62
- 提示信息语言跟随 `LC_ALL` / `LC_MESSAGES` / `LANG` / `LANGUAGE`(`zh*` 为中文,其余英文),也可用环境变量 `DSH_SAFE_LANG=zh|en` 强制指定。
80
+ 升级行为:`dsh-safe update` 自动探测 dsh 的包名与安装方式(npm / pnpm 全局安装)、对比最新版本后代跑升级,完成后自动恢复所有被隔离的插件——新 dsh 下仍不兼容的会在下次启动时再次被自动隔离。日常把 `dsh-safe -u web` 当启动命令即可:dsh 已是最新时直接启动(仅一次版本检查),有更新时先升级并恢复隔离再启动,更新检查失败只告警、照常启动。`-u` 后可接 update 的选项(如 `-u -y web`)与包装旗标(如 `-u --max-retries 0 web`)。
63
81
 
64
82
  ## 工作原理
65
83
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyzyn/dsh-safe",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "dsh 启动保险丝:社区插件不兼容导致 dsh 启动失败时,自动禁用坏插件并重试",
5
5
  "type": "module",
6
6
  "license": "MIT",