@xiaoyuyu6420/dsh-backup 0.8.0 → 0.9.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.
package/README.md CHANGED
@@ -2,59 +2,128 @@
2
2
 
3
3
  [![dsh-plugin](https://img.shields.io/badge/ecosystem-dsh--plugin-8b5cf6)](https://github.com/topics/dsh-plugin)
4
4
  [![npm](https://img.shields.io/npm/v/@xiaoyuyu6420/dsh-backup)](https://www.npmjs.com/package/@xiaoyuyu6420/dsh-backup)
5
+ [![Downloads](https://img.shields.io/npm/dw/@xiaoyuyu6420/dsh-backup)](https://www.npmjs.com/package/@xiaoyuyu6420/dsh-backup)
5
6
  [![Publish to npm](https://github.com/xiaoyuyu6420/dsh-backup/actions/workflows/publish.yml/badge.svg)](https://github.com/xiaoyuyu6420/dsh-backup/actions/workflows/publish.yml)
6
7
  [![license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
7
8
 
8
9
  English | [简体中文](README.zh.md)
9
10
 
10
- **dsh-backup is a DeepSeek Harness (DSH) plugin that backs up and restores `~/.dsh` with a single command.**
11
+ **Your entire DeepSeek Harness (DSH) workspace lives in one folder: `~/.dsh`. One failed upgrade, one accidental delete, one new laptop — without a backup, sessions, settings and skills are all gone. dsh-backup gives them back with one command.**
11
12
 
12
- Sessions, settings, skills, and plugin config all live in `~/.dsh`. Delete it by accident, break a config, or move to a new machine — with a backup, you get it all back. Credentials never enter an archive; scheduled backups and GitHub sync are supported (details in the [advanced guide](docs/advanced.zh.md), Chinese).
13
+ ```sh
14
+ dsh plugin --profile web add @xiaoyuyu6420/dsh-backup # install
15
+ # restart dsh web, then type:
16
+ /backup # → a verified archive lands in ~/Desktop/dsh-backups/
17
+ ```
18
+
19
+ Real output from a fresh v0.9.0 install:
20
+
21
+ ```text
22
+ 备份完成: dsh-20260826-195150036.tar.gz
23
+ sha256: 8f9ae6322ef782d21554981cf4547220d5bb3e64d7964a883317415ad54e3cbb
24
+ 轮换删除 0 份(保留 7 份)
25
+ ```
26
+
27
+ Prefer clicking? There's a visual panel in `dsh web` → Settings → Plugins → Backup: list, verify, restore, delete, edit settings — no restart.
28
+
29
+ ![Backup panel](docs/assets/panel-backups.png)
30
+
31
+ ## Why you want this
32
+
33
+ | Fear | What dsh-backup does about it |
34
+ |---|---|
35
+ | "An upgrade broke my setup" | Auto-takes a `dsh-pre-upgrade-` snapshot the moment the host version changes — try the new release, roll back if it bites |
36
+ | "I deleted / broke something" | `/backup restore latest --dry-run` previews exactly what comes back; a failed restore auto-rolls-back and shows a result receipt |
37
+ | "DSH won't even boot anymore" | Every backup drops a zero-dependency **rescue console** (`dsh-rescue` / `rescue.mjs`, or double-click「点我恢复」) next to the archives — a web UI that restores outside of DSH |
38
+ | "My API keys will end up in a cloud backup" | Credentials are redacted from archives by default; plaintext only ever lives in a local vault on your machine |
39
+ | "My session logs got corrupted" | `/backup doctor` scans and repairs session logs from a known-good backup; corrupt files are quarantined before they rotate away |
40
+ | "I got a new machine" | GitHub sync: `/backup github pull` fetches remote archives, `restore --sync-deps` reinstalls plugins |
41
+ | "Backups rot silently" | Every archive ships a sha256; `/backup verify all` checks integrity; daily/weekly tiered retention keeps useful history longer |
42
+ | "I'll forget to back up" | `/backup auto 12` — every 12 hours, survives restarts, rotates old copies (default keep 7) |
43
+
44
+ ![Backup settings](docs/assets/panel-settings.png)
13
45
 
14
46
  ## Install
15
47
 
48
+ Requires macOS / Linux / Windows 10+ (ships `tar`) and DSH `0.1.1-rc.2` or compatible.
49
+
16
50
  ```sh
17
51
  dsh plugin --profile web add @xiaoyuyu6420/dsh-backup
18
- # or from GitHub:
52
+ # or straight from GitHub:
19
53
  dsh plugin --profile web add github:xiaoyuyu6420/dsh-backup
20
54
  ```
21
55
 
22
- Then restart `dsh web`. Requires macOS / Linux / Windows 10+ (ships `tar`) and DSH `0.1.1-rc.2` or compatible.
56
+ Restart `dsh web` afterwards.
23
57
 
24
58
  ## Quickstart
25
59
 
26
60
  1. Install (above) and restart `dsh web`
27
- 2. Run `/backup`
28
- 3. Done — the archive lands in `~/Desktop/dsh-backups/`, named with a timestamp
61
+ 2. Type `/backup`
62
+ 3. Done — the archive lands in `~/Desktop/dsh-backups/`, timestamped, with a `.sha256` next to it
29
63
 
30
- Want it on a schedule? `/backup auto 12` every 12 hours, keeps going across restarts.
64
+ Want it on a schedule? `/backup auto 12` (every 12 hours; `off` stops it, `status` checks it).
31
65
 
32
- ## Commands
66
+ ## Command cheat sheet
33
67
 
34
68
  | Task | Command |
35
69
  |---|---|
36
70
  | Back up now | `/backup` |
37
- | Schedule | `/backup auto 12` (`off` to stop, `status` to check) |
38
- | Restore | `/backup restore latest` (`--dry-run` to preview) |
71
+ | Schedule (survives restarts) | `/backup auto 12` · `off` · `status` |
72
+ | Restore (preview first) | `/backup restore latest --dry-run` |
73
+ | Restore for real | `/backup restore latest` |
39
74
  | List backups | `/backup list` |
40
75
  | Verify integrity | `/backup verify [prefix\|all]` |
41
- | Delete | `/backup delete <prefix\|latest>` |
42
- | Keep N copies (default 7) | `/backup --keep N` |
43
-
44
- Prefer clicking? There's a visual panel in `dsh web` settings.
76
+ | Check & repair session logs | `/backup doctor` · `--repair [prefix\|latest]` |
77
+ | **Rescue when DSH won't boot** | double-click「点我恢复」in the backup dir, or `dsh-rescue` / `node rescue.mjs` |
78
+ | Delete / retention | `/backup delete <prefix\|latest>` · `/backup --keep N` (default 7) |
45
79
 
46
80
  ## New machine
47
81
 
48
- Prerequisite: GitHub sync was configured on the old one ([setup](docs/advanced.zh.md#github-同步可选)).
82
+ Prerequisite: GitHub sync was configured on the old one ([setup](docs/advanced.zh.md#github-同步可选), Chinese).
49
83
 
50
84
  1. Install the plugin, set the same `githubRepo`
51
85
  2. `/backup github pull` — fetch the remote backups
52
86
  3. `/backup restore latest --sync-deps` — restore and reinstall plugin dependencies
53
87
  4. Restart `dsh`
54
88
 
89
+ ## FAQ
90
+
91
+ **Are my API keys / credentials inside the archive?**
92
+ No. Known credential files are redacted before archiving; the plaintext stays in a local vault that never leaves the machine. Restoring puts them back.
93
+
94
+ **What exactly gets backed up?**
95
+ Everything under `~/.dsh` — sessions, settings, skills, plugin config — minus your exclude patterns and `node_modules`.
96
+
97
+ **I messed up `~/.dsh` and now `dsh` won't start. Am I out of options?**
98
+ No — that's exactly what the rescue channel is for. Every backup writes `rescue.mjs` and a double-clickable launcher (`点我恢复.command` / `.bat` / `.sh`) into the backup directory. It runs on plain Node, no DSH required, and serves a local web UI to browse and restore archives.
99
+
100
+ **Windows support?**
101
+ Yes — Windows 10+ with the bundled `tar`. The rescue launcher becomes a `.bat` file.
102
+
103
+ **Where do backups go by default?**
104
+ `~/Desktop/dsh-backups/` — change it any time in the panel (Settings → Plugins → Backup) or via settings; takes effect immediately, no restart.
105
+
106
+ ## Feedback
107
+
108
+ Tried it? Tell us what broke, what's missing, what you liked — it directly shapes the roadmap:
109
+
110
+ - 💬 [Share feedback (GitHub Discussions)](https://github.com/xiaoyuyu6420/dsh-backup/discussions)
111
+ - 🐛 [Report a bug](https://github.com/xiaoyuyu6420/dsh-backup/issues)
112
+
113
+ ## What's new
114
+
115
+ <details>
116
+ <summary>Recent releases</summary>
117
+
118
+ - **0.9.0** — `/backup doctor` session-log health check with targeted repair; out-of-process rescue channel (`dsh-rescue` / launcher in the backup dir) that works even when the host won't boot; restore auto-rollback with a result-oriented receipt; smart backup: pre-upgrade snapshots on host train changes, quarantine of corrupt session logs before they rotate away, tiered daily/weekly retention.
119
+ - **0.8.0** — edit backup settings right in the panel (destination, retention, exclude patterns), saved instantly to `settings.yaml`, no restart; stale edits get a conflict warning instead of silent overwrite.
120
+ - **0.7.x** — credential redaction with a local vault; cross-machine restore.
121
+
122
+ </details>
123
+
55
124
  ## More
56
125
 
57
- Retention policy, credential redaction, GitHub sync, restore safeguards, config reference, troubleshooting, and development notes — in the [advanced guide](docs/advanced.zh.md) (Chinese).
126
+ Retention policy, credential redaction internals, GitHub sync, restore safeguards, config reference, troubleshooting, and development notes — in the [advanced guide](docs/advanced.zh.md) (Chinese). Cross-runtime compatibility notes: [compatibility.md](docs/compatibility.md).
58
127
 
59
128
  ## Acknowledgements
60
129
 
package/README.zh.md CHANGED
@@ -2,46 +2,80 @@
2
2
 
3
3
  [![dsh-plugin](https://img.shields.io/badge/ecosystem-dsh--plugin-8b5cf6)](https://github.com/topics/dsh-plugin)
4
4
  [![npm](https://img.shields.io/npm/v/@xiaoyuyu6420/dsh-backup)](https://www.npmjs.com/package/@xiaoyuyu6420/dsh-backup)
5
+ [![Downloads](https://img.shields.io/npm/dw/@xiaoyuyu6420/dsh-backup)](https://www.npmjs.com/package/@xiaoyuyu6420/dsh-backup)
5
6
  [![Publish to npm](https://github.com/xiaoyuyu6420/dsh-backup/actions/workflows/publish.yml/badge.svg)](https://github.com/xiaoyuyu6420/dsh-backup/actions/workflows/publish.yml)
6
7
  [![license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
7
8
 
8
9
  [English](README.md) | 简体中文
9
10
 
10
- **dsh-backup 是 DeepSeek Harness(DSH)的备份插件:一条命令备份 `~/.dsh`,一条命令恢复。**
11
+ **你所有的 DSH 工作数据都在一个目录里:`~/.dsh`。一次升级失败、一次误删、一次换电脑——没有备份,会话、设置、技能全没了。dsh-backup 用一条命令把它们找回来。**
11
12
 
12
- 会话记录、设置、技能、插件配置全在 `~/.dsh` 一个目录里。误删了、改坏了、换电脑了——有备份就能找回来。密码等敏感文件不进备份包,还支持定时自动备份和 GitHub 云同步(细节见[进阶文档](docs/advanced.zh.md))。
13
+ ```sh
14
+ dsh plugin --profile web add @xiaoyuyu6420/dsh-backup # 安装
15
+ # 重启 dsh web,然后输入:
16
+ /backup # → 一份带校验的备份落在 ~/Desktop/dsh-backups/
17
+ ```
18
+
19
+ v0.9.0 全新安装的真实输出:
20
+
21
+ ```text
22
+ 备份完成: dsh-20260826-195150036.tar.gz
23
+ sha256: 8f9ae6322ef782d21554981cf4547220d5bb3e64d7964a883317415ad54e3cbb
24
+ 轮换删除 0 份(保留 7 份)
25
+ ```
26
+
27
+ 不想敲命令也行:`dsh web` → 设置 → 插件 → 备份 里有可视化面板——列备份、校验、恢复、删除、改设置,全都立即生效不用重启。
28
+
29
+ ![备份面板](docs/assets/panel-backups.png)
30
+
31
+ ## 它替你挡掉哪些事
32
+
33
+ | 你担心的 | dsh-backup 做的事 |
34
+ |---|---|
35
+ | 「升级把环境搞坏了」 | 宿主版本一变就自动拍 `dsh-pre-upgrade-` 快照——放心试新版,坏了随时回滚 |
36
+ | 「我误删 / 改坏了东西」 | `/backup restore latest --dry-run` 先预览要恢复什么再动手;恢复失败自动回滚并给出结果回执 |
37
+ | 「DSH 根本起不来了」 | 每次备份都会往备份目录放一个零依赖的**救援控制台**(`dsh-rescue` / `rescue.mjs`,或双击「点我恢复」)——不依赖 DSH 的网页版恢复界面 |
38
+ | 「API Key 会被传到云上吗」 | 凭据默认脱敏,不进备份包;明文只存本机 vault,永不离开这台机器 |
39
+ | 「会话日志损坏了」 | `/backup doctor` 体检并从备份定点修复;损坏文件先隔离再入档,防止轮换把好副本也带走 |
40
+ | 「换新电脑了」 | GitHub 同步:`/backup github pull` 拉回云端备份,`restore --sync-deps` 顺手重装插件 |
41
+ | 「备份悄悄坏了没人知道」 | 每份归档带 sha256,`/backup verify all` 随时体检;每日/每周分级保留,留得住有用的历史 |
42
+ | 「我会忘记备份」 | `/backup auto 12`——每 12 小时自动跑,重启不中断,旧副本自动轮换(默认保留 7 份) |
43
+
44
+ ![备份设置](docs/assets/panel-settings.png)
13
45
 
14
46
  ## 安装
15
47
 
48
+ 要求:macOS / Linux / Windows 10+(自带 `tar`),DSH `0.1.1-rc.2` 或兼容版本。
49
+
16
50
  ```sh
17
51
  dsh plugin --profile web add @xiaoyuyu6420/dsh-backup
18
- # 或者从 GitHub 安装:
52
+ # 或者直接从 GitHub 安装:
19
53
  dsh plugin --profile web add github:xiaoyuyu6420/dsh-backup
20
54
  ```
21
55
 
22
- 装完重启 `dsh web`。要求:macOS / Linux / Windows 10+(自带 `tar`),DSH `0.1.1-rc.2` 或兼容版本。
56
+ 装完重启 `dsh web`。
23
57
 
24
58
  ## 快速上手
25
59
 
26
60
  1. 按上面装好插件,重启 `dsh web`
27
61
  2. 输入 `/backup`
28
- 3. 搞定 —— 备份出现在 `~/Desktop/dsh-backups/`,文件名带时间戳
62
+ 3. 搞定 —— 备份出现在 `~/Desktop/dsh-backups/`,文件名带时间戳,旁边一份 `.sha256`
29
63
 
30
- 想定时自动跑?`/backup auto 12`(每 12 小时一次,重启不中断)。
64
+ 想定时自动跑?`/backup auto 12`(每 12 小时一次;`off` 关闭,`status` 看状态)。
31
65
 
32
66
  ## 命令速查
33
67
 
34
68
  | 场景 | 命令 |
35
69
  |---|---|
36
70
  | 立即备份 | `/backup` |
37
- | 定时备份 | `/backup auto 12`(`off` 关闭,`status` 看状态) |
38
- | 恢复 | `/backup restore latest`(`--dry-run` 先预览) |
71
+ | 定时备份(重启不中断) | `/backup auto 12` · `off` · `status` |
72
+ | 恢复(先预览) | `/backup restore latest --dry-run` |
73
+ | 正式恢复 | `/backup restore latest` |
39
74
  | 列出备份 | `/backup list` |
40
- | 校验是否完好 | `/backup verify [前缀\|all]` |
41
- | 删除某份备份 | `/backup delete <前缀\|latest>` |
42
- | 保留份数(默认 7) | `/backup --keep N` |
43
-
44
- 不想敲命令?`dsh web` 设置里有可视化面板。
75
+ | 校验完整性 | `/backup verify [前缀\|all]` |
76
+ | 会话日志体检/修复 | `/backup doctor` · `--repair [前缀\|latest]` |
77
+ | **DSH 起不来时自救** | 双击备份目录里的「点我恢复」,或 `dsh-rescue` / `node rescue.mjs` |
78
+ | 删除 / 保留策略 | `/backup delete <前缀\|latest>` · `/backup --keep N`(默认 7) |
45
79
 
46
80
  ## 换新电脑
47
81
 
@@ -52,9 +86,44 @@ dsh plugin --profile web add github:xiaoyuyu6420/dsh-backup
52
86
  3. `/backup restore latest --sync-deps` —— 恢复并重装插件依赖
53
87
  4. 重启 `dsh`
54
88
 
89
+ ## 常见问题
90
+
91
+ **API Key / 密码会进备份包吗?**
92
+ 不会。已知的凭据文件打包前会脱敏,明文留在本机 vault 里不离开这台机器;恢复时自动还原。
93
+
94
+ **到底备份了什么?**
95
+ `~/.dsh` 下的全部——会话、设置、技能、插件配置——减去你配置的排除模式和 `node_modules`。
96
+
97
+ **我把 `~/.dsh` 搞坏了,`dsh` 都启动不了,还有救吗?**
98
+ 有——这正是救援通道的用途。每次备份都会往备份目录写 `rescue.mjs` 和双击启动器(macOS `.command` / Windows `.bat` / Linux `.sh`)。它只用普通 Node 就能跑,不需要 DSH,起一个本地网页让你浏览和恢复备份。
99
+
100
+ **支持 Windows 吗?**
101
+ 支持——Windows 10+(用系统自带 `tar`),救援启动器是 `.bat` 文件。
102
+
103
+ **备份默认放哪?**
104
+ `~/Desktop/dsh-backups/`——在面板(设置 → 插件 → 备份)里随时可改,立即生效不用重启。
105
+
106
+ ## 反馈
107
+
108
+ 用过吗?哪里坏了、缺什么、喜欢什么,都欢迎说——反馈直接决定路线图:
109
+
110
+ - 💬 [分享反馈(GitHub Discussions)](https://github.com/xiaoyuyu6420/dsh-backup/discussions)
111
+ - 🐛 [报告问题](https://github.com/xiaoyuyu6420/dsh-backup/issues)
112
+
113
+ ## 更新日志
114
+
115
+ <details>
116
+ <summary>最近的版本</summary>
117
+
118
+ - **0.9.0** —— `/backup doctor` 会话日志体检与定点修复;宿主起不来也能用的进程外救援通道(备份目录里的 dsh-rescue / 双击启动器);恢复失败自动回滚与结果导向回执;智能备份:宿主升级前自动快照、损坏会话先隔离再入档、每日/每周分级保留。
119
+ - **0.8.0** —— 面板里直接改备份设置(目录、保留份数、排除模式),立即生效写入 settings.yaml 不用重启;两处同时改有冲突提示,不会静默覆盖。
120
+ - **0.7.x** —— 凭据脱敏(本机 vault)、跨机恢复。
121
+
122
+ </details>
123
+
55
124
  ## 更多
56
125
 
57
- 定时备份策略、敏感文件脱敏、GitHub 同步、恢复的保护机制、配置参考、故障排查、开发说明——都在[进阶文档](docs/advanced.zh.md)。
126
+ 定时备份策略、敏感文件脱敏、GitHub 同步、恢复保护机制、配置参考、故障排查、开发说明——都在[进阶文档](docs/advanced.zh.md)。跨运行时兼容性说明:[compatibility.md](docs/compatibility.md)
58
127
 
59
128
  ## 致谢
60
129