dsh-plugin-snapshot 0.1.0 → 0.1.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 +54 -13
  2. package/README.md +77 -43
  3. package/package.json +8 -1
package/README.en.md CHANGED
@@ -1,37 +1,76 @@
1
1
  # dsh-plugin-snapshot
2
2
 
3
- Pre-upgrade snapshots, one-step rollback and a static health check for DeepSeek Harness plugins.
3
+ **Pre-upgrade snapshots, one-step rollback and a static health check for DeepSeek Harness plugins.**
4
4
 
5
- The built-in plugin_manager already installs, removes and toggles plugins. This plugin adds what it does not: a verifiable recovery point before you change anything, a way back when an upgrade goes wrong, and a clear view of which plugins collide.
5
+ One plugin, three tools.
6
+
7
+ - npm: https://www.npmjs.com/package/dsh-plugin-snapshot
8
+ - repo: https://github.com/Uesccda/dsh-plugin-snapshot
9
+ - compatible with DSH 0.2.0+ (tested on 0.2.2-rc.1)
10
+
11
+ ---
12
+
13
+ ## What problem it solves
14
+
15
+ | The trouble you hit | What this does |
16
+ | --- | --- |
17
+ | A plugin upgrade fails halfway: manifests changed, dependencies not installed, unknown state | Takes a snapshot with fingerprint and hashes before upgrading, so you can always go back |
18
+ | Dozens of plugins installed, no idea which collide or whose compatibility claim is stale | One scan reports installed / enabled / missing / incompatible / untested, plus a review priority |
19
+ | No idea which plugins have newer versions, and afraid of auto-upgrading to a beta | Lists updatable items and marks prereleases separately instead of mixing them in |
20
+
21
+ It deliberately does **not** install, remove or toggle plugins: that is what the built-in plugin_manager is for. Two implementations fighting over the same profile is the most common source of breakage in this ecosystem.
22
+
23
+ ---
24
+
25
+ ## The three tools
26
+
27
+ | Tool | Does | Writes |
28
+ | --- | --- | --- |
29
+ | plugin_snapshot | create / list / restore snapshots of the profile manifests | only its own data dir, plus the three manifests on restore |
30
+ | plugin_doctor | static diagnostic: install state, author-declared compatibility, duplicate patch ids, missing packages | read-only |
31
+ | plugin_updates | compares the version resolved in pnpm-lock.yaml against the registry | read-only |
32
+
33
+ ---
34
+
35
+ ## Usage
36
+
37
+ Just talk to the model:
38
+
39
+ - "Take a snapshot before upgrading my plugins"
40
+ - "Check my installed plugins for problems"
41
+ - "Which plugins have updates available?"
42
+ - "That upgrade failed, roll back to before it"
43
+
44
+ ---
6
45
 
7
46
  ## Install
8
47
 
9
48
  dsh plugin add dsh-plugin-snapshot
10
49
 
11
- Restart DSH (or let HMR pick it up), then the three tools are available.
12
-
13
- ## Tools
50
+ Restart DSH afterwards. Remove with:
14
51
 
15
- ### plugin_snapshot
52
+ dsh plugin remove dsh-plugin-snapshot
16
53
 
17
- Create, list and restore snapshots of the profile manifests (package.json, pnpm-lock.yaml, pnpm-workspace.yaml).
54
+ ---
18
55
 
19
- Every snapshot carries a manifest with the profile fingerprint, creation time, and per-file sha256. Restoring verifies the fingerprint first, so a snapshot from another profile is rejected; a hash mismatch only warns, because you may have edited the manifest by hand.
56
+ ## What a snapshot contains
20
57
 
21
- ### plugin_updates
58
+ The three profile manifests (package.json, pnpm-lock.yaml, pnpm-workspace.yaml) plus a manifest.json recording the profile fingerprint, creation time, per-file existence and sha256.
22
59
 
23
- Read-only version check. Compares the version resolved in pnpm-lock.yaml against the registry and reports updatable / major / uptodate / prerelease / failed / manual. Prereleases are never suggested, and GitHub sources are always flagged for manual review.
60
+ Restoring verifies the fingerprint first, so a snapshot from another profile is rejected. A hash mismatch only warns, because you may have edited the manifest by hand.
24
61
 
25
- ### plugin_doctor
62
+ Snapshots do **not** include node_modules. Dependencies must be reinstalled after a restore.
26
63
 
27
- Static diagnostic: declared vs installed vs enabled, author-declared DSH compatibility (an explicit incompatible is reported as incompatible, never as probably fine), duplicate cordis.patch.yml ids, missing packages and unparseable manifests. The returned priority is a rule-weighted score, not a crash probability.
64
+ ---
28
65
 
29
66
  ## Where data lives
30
67
 
31
68
  ~/.dsh-plugin-snapshot/snapshots/<timestamp>/
32
69
  ~/.dsh-plugin-snapshot/logs/
33
70
 
34
- Nothing else is written except the three profile manifests on restore. node_modules and the bundles list are never touched, and DSH is never started or stopped.
71
+ Nothing else is written except the three profile manifests on restore.
72
+
73
+ ---
35
74
 
36
75
  ## Limitations
37
76
 
@@ -39,6 +78,8 @@ Nothing else is written except the three profile manifests on restore. node_modu
39
78
  - Diagnostics are static evidence, not runtime verification
40
79
  - No scheduler: the plugin only exists while DSH runs
41
80
 
81
+ ---
82
+
42
83
  ## License
43
84
 
44
85
  MIT
package/README.md CHANGED
@@ -1,84 +1,118 @@
1
1
  # dsh-plugin-snapshot
2
2
 
3
- 给 DeepSeek Harness 的插件做**升级前快照、一键回滚和静态体检**。
3
+ **给 DeepSeek Harness 的插件做升级前快照、一键回滚和静态体检。**
4
4
 
5
- DSH 官方的 plugin_manager 已经能装、卸、启停插件;本插件只补它没有的那一块:**改动之前先存一份能验身份的恢复点,出问题能退回来,装完之后能看清谁跟谁冲突**。
5
+ 一个插件,三个工具。
6
6
 
7
- ## 为什么需要它
7
+ - npm: https://www.npmjs.com/package/dsh-plugin-snapshot
8
+ - 仓库: https://github.com/Uesccda/dsh-plugin-snapshot
9
+ - 兼容: DSH 0.2.0 及以上(已在 0.2.2-rc.1 实测)
8
10
 
9
- 插件升级失败时最难受的不是报错,而是"清单已经改了、依赖没装完、不知道回到了什么状态"。本插件在每次升级前把 profile 的三份清单(package.json / pnpm-lock.yaml / pnpm-workspace.yaml)存成一份带指纹与哈希的快照,任何时候都能退回去。
11
+ ---
12
+
13
+ ## 它解决什么问题
14
+
15
+ | 你会遇到的麻烦 | 这个插件怎么处理 |
16
+ | --- | --- |
17
+ | 升级插件失败,清单已经改了、依赖没装完,不知道回到了什么状态 | 升级前先存一份带指纹和哈希的快照,任何时候都能退回去 |
18
+ | 装了几十个插件,不知道谁跟谁冲突、谁的兼容声明已经过期 | 一次扫描给出:已装/已启用/缺失/不兼容/未验证,以及检查优先级 |
19
+ | 不知道哪些插件有新版本,又怕自动升到测试版 | 列出可更新项,预发布版本单独标注、不混进"可升级"里 |
20
+
21
+ 它**不负责**安装、卸载、启停插件——那是 DSH 自带的 plugin_manager 的事。两套实现打架是插件市场里最常见的坑,这里直接避开。
22
+
23
+ ---
24
+
25
+ ## 三个工具
26
+
27
+ | 工具 | 做什么 | 会不会写文件 |
28
+ | --- | --- | --- |
29
+ | plugin_snapshot | 创建快照 / 列出快照 / 恢复到某个快照 | 只写自己的数据目录,恢复时覆盖 profile 的三份清单 |
30
+ | plugin_doctor | 静态体检:安装状态、作者声明的兼容性、patch id 冲突、缺失的包 | 纯只读 |
31
+ | plugin_updates | 以 lockfile 解析出的版本为基准,查 registry 有没有新版本 | 纯只读 |
32
+
33
+ ---
34
+
35
+ ## 怎么用(对话示例)
36
+
37
+ 你不用记命令,直接跟模型说:
38
+
39
+ - **"升级插件前先给我打个快照"** → 调用 plugin_snapshot 的 create,返回快照名
40
+ - **"看看我这些插件有没有问题"** → 调用 plugin_doctor,给出 48 个插件的体检结果
41
+ - **"哪些插件可以升级"** → 调用 plugin_updates,列出可更新项
42
+ - **"刚才那次升级失败了,退回到升级前"** → 调用 plugin_snapshot 的 restore
43
+
44
+ ---
10
45
 
11
46
  ## 安装
12
47
 
13
48
  dsh plugin add dsh-plugin-snapshot
14
49
 
15
- 装好后重启 DSH(或启用 HMR 时自动生效),三个工具随即可用。
50
+ 装完重启 DSH(启用 HMR 时自动生效),三个工具随即可用。
16
51
 
17
- ## 提供的工具
52
+ 卸载:
18
53
 
19
- ### plugin_snapshot
54
+ dsh plugin remove dsh-plugin-snapshot
20
55
 
21
- 快照的创建、列表与恢复。
56
+ ---
22
57
 
23
- - action = "create":把当前 profile 的三份清单存成一份快照,返回快照名
24
- - action = "list":列出全部快照(时间、依赖数、是否带 manifest)
25
- - action = "restore" + name:恢复到指定快照;恢复前会先自动给现状再存一份
58
+ ## 兼容性
26
59
 
27
- 每份快照都带 manifest:profile 指纹、创建时间、每个文件的存在性与 sha256。恢复时会先校验指纹——**别的 profile 的快照会被拒绝**;文件摘要对不上只告警(你可能手工改过清单)。
60
+ 本插件声明支持 DSH 0.2.0 及以上,并在 0.2.2-rc.1 实测通过:
28
61
 
29
- ### plugin_updates
62
+ 0.2.2-rc.1 compatible
63
+ 0.2.1 compatible
64
+ 0.2.0+ compatible
30
65
 
31
- 只读的版本检测。
66
+ 如果你在别的 DSH 版本上使用,plugin_doctor 会如实显示为「未验证」而不是假装兼容。
32
67
 
33
- - 以 pnpm-lock.yaml 里解析出来的版本为基准,去 registry 查候选版本
34
- - 输出每个插件的状态:updatable / major / uptodate / prerelease / failed / manual
35
- - 预发布版本不会被建议升级;主版本变更、GitHub 源一律标成需人工确认
68
+ ---
36
69
 
37
- ### plugin_doctor
70
+ ## 快照里存了什么
38
71
 
39
- 静态体检。
72
+ profile 目录下的三份清单:
40
73
 
41
- - 已声明 vs 已安装 vs 已启用,三者分开列
42
- - 按插件作者声明判定 DSH 版本兼容性:**明确写 incompatible 的判成不兼容,绝不显示成"大概率可用"**
43
- - 重复的 cordis.patch.yml 行 id、缺失的包、无法解析的清单
44
- - 给出"检查优先级"(规则加权,不是崩溃概率)
74
+ package.json
75
+ pnpm-lock.yaml
76
+ pnpm-workspace.yaml
77
+
78
+ 每份快照额外带一个 manifest.json,记录:profile 指纹、创建时间、每个文件是否存在、每个文件的 sha256。
79
+
80
+ 恢复时会先比对 profile 指纹——**别的 profile 的快照会被拒绝**,避免把 A 环境的清单写进 B。文件摘要对不上只告警,因为你可能手工改过清单。
81
+
82
+ ⚠️ 快照**不包含 node_modules**。恢复之后需要让包管理器重新安装依赖。
83
+
84
+ ---
45
85
 
46
86
  ## 数据放在哪
47
87
 
48
88
  ~/.dsh-plugin-snapshot/snapshots/<时间戳>/
49
89
  ~/.dsh-plugin-snapshot/logs/
50
90
 
51
- 只写这两个目录,以及恢复时写回 profile 的三份清单。不碰 node_modules,不改 bundles 清单,不启动或关闭 DSH。
52
-
53
- ## 安全边界
91
+ 只写这两个目录,以及恢复时写回 profile 的三份清单。不碰 node_modules、不改 bundles 清单、不启动或关闭 DSH。
54
92
 
55
- - plugin_updates 与 plugin_doctor 是**纯只读**:只读文件、只发 GET 请求
56
- - plugin_snapshot 的 create 只写自己的数据目录;restore 需要显式传 name,且只覆盖三份清单
57
- - 不实现安装/卸载/启停——那是官方 plugin_manager 的职责,避免两套实现互相打架
93
+ ---
58
94
 
59
- ## 配置
60
-
61
- 可选,写进 profile 的插件配置:
95
+ ## 安全边界
62
96
 
63
- | 字段 | 默认 | 说明 |
64
- | --- | --- | --- |
65
- | profileDir | 自动定位 | 显式指定 profile 目录 |
66
- | registry | registry.npmjs.org | 检测用的源,也可用 DSH_REGISTRY |
67
- | dataDir | ~/.dsh-plugin-snapshot | 快照与日志目录 |
68
- | snapshotsKeep | 7 | 保留份数 |
69
- | concurrency | 8 | 检测并发 |
97
+ - plugin_doctor 与 plugin_updates 是**纯只读**:只读文件、只发 GET 请求
98
+ - plugin_snapshot 的 create 只写自己的数据目录;restore 必须显式传 name
99
+ - 不调用 pnpm、不修改依赖树、不结束任何进程
70
100
 
71
- profile 定位顺序:配置 > 环境变量 DSH_PROFILE_DIR > ~/.dsh/profiles/desktop > 扫描 profiles 目录取最近修改的。
101
+ ---
72
102
 
73
103
  ## 已知限制
74
104
 
75
- - 快照只覆盖三份清单,不含 node_modules。恢复之后仍需让包管理器重新安装依赖
105
+ - 快照只覆盖三份清单,不含 node_modules
76
106
  - 诊断基于静态扫描与作者声明,不代表运行时验证
77
- - 不做定时任务:插件只在 DSH 运行时存在
107
+ - 没有定时任务:插件只在 DSH 运行时存在
108
+
109
+ ---
78
110
 
79
111
  ## 开发
80
112
 
81
- npm test # 5 项自测,用 stub 顶替 @deepseek-ai/dsh-tools
113
+ npm test # 5 项自测,用 stub 顶替 @deepseek-ai/dsh-tools
114
+
115
+ ---
82
116
 
83
117
  ## 许可
84
118
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-snapshot",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "description": "Pre-update snapshots, one-step rollback and conflict diagnostics for DeepSeek Harness profile plugins.",
6
6
  "keywords": [
@@ -33,6 +33,13 @@
33
33
  "dsh": {
34
34
  "bundle": {
35
35
  "patch": "./cordis.patch.yml"
36
+ },
37
+ "compatibility": {
38
+ "dshReleases": {
39
+ "0.2.2-rc.1": "compatible",
40
+ "0.2.1": "compatible",
41
+ "0.2.0+": "compatible"
42
+ }
36
43
  }
37
44
  },
38
45
  "peerDependencies": {