@bruc3van/dsh-doctor 0.5.0 → 0.5.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.en.md +141 -29
- package/README.md +84 -24
- package/package.json +1 -1
- package/skills/dsh-plugin-upgrade/references/migration-map.md +1 -1
package/README.en.md
CHANGED
|
@@ -15,38 +15,108 @@ npm install --global @bruc3van/dsh-doctor
|
|
|
15
15
|
dsh-doctor diagnose
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
Or run without installing:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npx @bruc3van/dsh-doctor diagnose
|
|
22
|
+
```
|
|
23
|
+
|
|
18
24
|
The default target is `$DSH_HOME/profiles/web`, falling back to `~/.dsh`. Use `--dsh-command /path/to/dsh` for a special installation or `--harness-root /path/to/deepseek-harness` for a source checkout.
|
|
19
25
|
|
|
20
|
-
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Plugin migration: 0.1.1 → 0.1.2
|
|
29
|
+
|
|
30
|
+
### migrate commands
|
|
21
31
|
|
|
22
32
|
Doctor ships a versioned `dsh-v0.1.1-rc.2 → dsh-v0.1.2-alpha.2` migration catalog and exposes three auditable stages:
|
|
23
33
|
|
|
24
34
|
```sh
|
|
25
|
-
|
|
35
|
+
# Stage 1: read-only analysis of source, type imports, manifest, client graph, and build artifacts
|
|
36
|
+
dsh-doctor migrate analyze /path/to/plugin \
|
|
37
|
+
--from dsh-v0.1.1-rc.2 \
|
|
38
|
+
--to dsh-v0.1.2-alpha.2 \
|
|
39
|
+
--harness-root /path/to/deepseek-harness
|
|
40
|
+
|
|
41
|
+
# Stage 2: preview exact rewrites; add --yes to write and create timestamped backups
|
|
42
|
+
dsh-doctor migrate apply /path/to/plugin --safe \
|
|
43
|
+
--harness-root /path/to/deepseek-harness
|
|
44
|
+
dsh-doctor migrate apply /path/to/plugin --safe --yes \
|
|
45
|
+
--harness-root /path/to/deepseek-harness
|
|
46
|
+
|
|
47
|
+
# Stage 3: static, build, and isolated runtime verification in order
|
|
48
|
+
dsh-doctor migrate verify /path/to/plugin --level static \
|
|
49
|
+
--harness-root /path/to/deepseek-harness
|
|
50
|
+
dsh-doctor migrate verify /path/to/plugin --level build --yes \
|
|
51
|
+
--harness-root /path/to/deepseek-harness
|
|
52
|
+
dsh-doctor migrate verify /path/to/plugin --level runtime --yes \
|
|
53
|
+
--harness-root /path/to/deepseek-harness
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Run `dsh-doctor migrations list` to confirm the CLI contains this exact version pair before starting. Without a local install, `npx --package=@bruc3van/dsh-doctor dsh-doctor migrations list` works the same.
|
|
57
|
+
|
|
58
|
+
### Stage details
|
|
59
|
+
|
|
60
|
+
**analyze**: Uses the TypeScript AST so it sees type-only imports that disappear from JavaScript bundles. Also checks package metadata, client graph declarations, and build artifacts. A clean bundle alone does not imply compatibility.
|
|
61
|
+
|
|
62
|
+
**apply --safe**: Rewrites only catalog-confirmed exact-equivalent symbols, pins non-removed DSH development dependencies to the target version, and creates timestamped backups. It may add dependencies required by exact symbol moves but does not automatically change existing peer ranges. Session, Workspace, Conversation, and pending-interaction ownership changes are left as `MIG_SEMANTIC_API_CHANGE` and are never mechanically replaced.
|
|
63
|
+
|
|
64
|
+
**verify**:
|
|
65
|
+
|
|
66
|
+
| Level | What it does |
|
|
67
|
+
|---|---|
|
|
68
|
+
| `static` | Uses the TypeScript AST to inspect source/imports, manifest, client graph, and build artifacts without running project scripts |
|
|
69
|
+
| `build` | Executes plugin build scripts and verifies the artifact (`build` or `pack:check` must succeed; `test`/`typecheck` alone is insufficient proof of a publishable artifact) |
|
|
70
|
+
| `runtime` | Packs the real plugin tarball, installs it under a temporary `DSH_HOME` via the target CLI into a fresh web profile, verifies CLI version, profile manifest, installed package, activated bundle, effective config, and performs an activation smoke; never touches the normal `~/.dsh` |
|
|
71
|
+
|
|
72
|
+
The highest achievable gate is `analyzed` → `source-migrated` → `artifact-verified` → `runtime-verified`. `runtime-verified` still does not prove real UI, lifecycle, or business behavior. Failed workspaces are retained and reported; successful ones are cleaned up by default.
|
|
73
|
+
|
|
74
|
+
### Key API changes
|
|
75
|
+
|
|
76
|
+
`@deepseek-ai/dsh-client-runtime` was removed with **no aggregate replacement**. Capabilities migrate to:
|
|
77
|
+
|
|
78
|
+
| Concern | 0.1.2 owner | Migration |
|
|
79
|
+
|---|---|---|
|
|
80
|
+
| store engine and equality helpers | `dsh-client-store` | exact (catalog-listed symbols) |
|
|
81
|
+
| Cordis client context type | `@deepseek-ai/cordis` `Context` | exact; preserve local aliases |
|
|
82
|
+
| session control / list / commands | `dsh-api-session-controller/client` | semantic (developer judgment required) |
|
|
83
|
+
| workspace state / commands | `dsh-api-workspace-controller/client` | semantic |
|
|
84
|
+
| conversation assembly | `dsh-client-ui-conversation/client` | semantic |
|
|
85
|
+
| pending-interaction state | domain UI packages aggregated by `ui-session` | semantic |
|
|
86
|
+
|
|
87
|
+
`@deepseek-ai/dsh-host-apiproxy` was also removed with no compatible substitute. Browser operations use their natural generated Remote owners through API Remotes/API Gateway contributions.
|
|
88
|
+
|
|
89
|
+
### dsh-plugin-upgrade skill
|
|
90
|
+
|
|
91
|
+
The package ships the [`dsh-plugin-upgrade` skill](skills/dsh-plugin-upgrade/SKILL.md) so coding agents (such as Claude Code) can drive the full migration workflow without collapsing any safety gate. The skill triggers when a plugin developer asks for migration, compatibility assessment, API replacement, peer dependency updates, artifact rebuilds, or DSH 0.1.2 runtime verification.
|
|
26
92
|
|
|
27
|
-
|
|
28
|
-
dsh-doctor migrate apply /path/to/plugin --safe --yes --harness-root /path/to/deepseek-harness
|
|
93
|
+
Install it directly from the GitHub repository into a supported coding agent:
|
|
29
94
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
dsh-doctor migrate verify /path/to/plugin --level runtime --yes --harness-root /path/to/deepseek-harness
|
|
95
|
+
```sh
|
|
96
|
+
npx skills add bruc3van/dsh-doctor
|
|
33
97
|
```
|
|
34
98
|
|
|
35
|
-
|
|
99
|
+
The repository currently exposes one skill, so the `skills` CLI discovers and installs `dsh-plugin-upgrade`; add `--skill dsh-plugin-upgrade` to select it explicitly. This installs the agent skill, not a global DSH Doctor CLI. The skill uses an existing `dsh-doctor` command when available and falls back to the matching `npx @bruc3van/dsh-doctor` workflow when it is not installed.
|
|
36
100
|
|
|
37
|
-
|
|
101
|
+
---
|
|
38
102
|
|
|
39
|
-
|
|
103
|
+
## Diagnosis
|
|
40
104
|
|
|
41
|
-
|
|
105
|
+
### Diagnosis model
|
|
42
106
|
|
|
43
|
-
|
|
107
|
+
`diagnose` composes the configuration from an empty tree in the same order as current DSH:
|
|
44
108
|
|
|
45
109
|
```text
|
|
46
110
|
bundle layers → profile cordis.patch.yml → home cordis.patch.yml → CLI overlays
|
|
47
111
|
```
|
|
48
112
|
|
|
49
|
-
The JSON report retains `currentDefaultTree`, `currentEffectiveTree`, field-level provenance, replaced sources, and paths removed by whole-`config` replacement. It diagnoses
|
|
113
|
+
The JSON report retains `currentDefaultTree`, `currentEffectiveTree`, field-level provenance, replaced sources, and paths removed by whole-`config` replacement. It diagnoses:
|
|
114
|
+
|
|
115
|
+
- stale patches, missing targets, wrong name assertions;
|
|
116
|
+
- duplicate entry ids and duplicate plugin mounts;
|
|
117
|
+
- higher-layer disabling, structural replacement, whole group/config overrides;
|
|
118
|
+
- bundle declaration conflicts with profile activation state;
|
|
119
|
+
- plugin versions, artifacts, client contracts, dependencies, and runtime issues.
|
|
50
120
|
|
|
51
121
|
Every `pluginDiagnoses[]` object keeps current `status` separate from `recovery`. Being removable does not make an incompatible plugin compatible.
|
|
52
122
|
|
|
@@ -56,11 +126,15 @@ dsh-doctor diagnose --json
|
|
|
56
126
|
dsh-doctor diagnose --check-updates
|
|
57
127
|
```
|
|
58
128
|
|
|
59
|
-
Only `--check-updates` and `recover` contact the npm registry. Offline diagnosis reports `update.status: "not-checked"
|
|
129
|
+
Only `--check-updates` and `recover` contact the npm registry. Offline diagnosis reports `update.status: "not-checked"` and never turns "not checked" into "no compatible version."
|
|
130
|
+
|
|
131
|
+
---
|
|
60
132
|
|
|
61
|
-
##
|
|
133
|
+
## Recovery decisions
|
|
62
134
|
|
|
63
|
-
|
|
135
|
+
### Compatible-version search
|
|
136
|
+
|
|
137
|
+
Doctor checks all published manifests instead of trusting `latest`, then selects the highest version whose declared peer ranges accept the resolvable active DSH packages. This is a manifest-declared candidate only, not proof from a real startup or UI test.
|
|
64
138
|
|
|
65
139
|
```sh
|
|
66
140
|
dsh-doctor recover @scope/plugin --action check-update
|
|
@@ -68,7 +142,7 @@ dsh-doctor recover @scope/plugin --action update # preview
|
|
|
68
142
|
dsh-doctor recover @scope/plugin --action update --yes # exact version
|
|
69
143
|
```
|
|
70
144
|
|
|
71
|
-
|
|
145
|
+
### Quarantine
|
|
72
146
|
|
|
73
147
|
When no compatible release is available, generate and test a temporary overlay first:
|
|
74
148
|
|
|
@@ -78,20 +152,32 @@ dsh-doctor recover @scope/plugin --action quarantine --output ./plugin-quarantin
|
|
|
78
152
|
dsh --profile web --patch ./plugin-quarantine.yml
|
|
79
153
|
```
|
|
80
154
|
|
|
81
|
-
Doctor only generates
|
|
155
|
+
Doctor only generates an overlay when every active entry is precisely mapped, has a unique non-empty id and an exact name assertion, and the bundle does not rewrite entries owned by another layer. Core bundles, declared client dependents, and plugins statically detected as runtime Service providers with unproven dependents require manual review. The overlay disables all known active entries, causing both host and client sources to exit composition.
|
|
82
156
|
|
|
83
157
|
After testing the overlay, persistence is separately gated:
|
|
84
158
|
|
|
85
159
|
```sh
|
|
160
|
+
# Preview the exact diff first
|
|
86
161
|
dsh-doctor recover @scope/plugin --action persist-quarantine --verified
|
|
162
|
+
|
|
163
|
+
# Write to profile/cordis.patch.yml after explicit confirmation
|
|
87
164
|
dsh-doctor recover @scope/plugin --action persist-quarantine --verified --yes
|
|
88
165
|
```
|
|
89
166
|
|
|
90
|
-
Persistence appends the final winning profile-layer disable override and refuses the write when a home or CLI overlay would still outrank it. It then recomposes the configuration and verifies every exact target is disabled; failed verification returns a nonzero exit code. The write rechecks SHA-256 and atomically replaces the profile patch. An existing patch gets a `.dsh-doctor-<timestamp>.bak`; a first-time file gets a `.rollback.json` containing its target and created-content hash,
|
|
167
|
+
Persistence appends the final winning profile-layer disable override and refuses the write when a home or CLI overlay would still outrank it. It then recomposes the configuration and verifies every exact target is disabled; failed verification returns a nonzero exit code. The write rechecks SHA-256 and atomically replaces the profile patch. An existing patch gets a `.dsh-doctor-<timestamp>.bak`; a first-time file gets a `.rollback.json` containing its target and created-content hash, enabling deletion rollback only while the file is unchanged.
|
|
91
168
|
|
|
92
|
-
Preview and explicitly restore that backup or rollback record
|
|
169
|
+
Preview and explicitly restore that backup or rollback record:
|
|
93
170
|
|
|
94
|
-
|
|
171
|
+
```sh
|
|
172
|
+
dsh-doctor recover @scope/plugin --action rollback-quarantine \
|
|
173
|
+
--backup /path/to/cordis.patch.yml.dsh-doctor-...bak
|
|
174
|
+
dsh-doctor recover @scope/plugin --action rollback-quarantine \
|
|
175
|
+
--backup /path/to/cordis.patch.yml.dsh-doctor-...bak --yes
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Doctor only accepts timestamped recovery files belonging to the selected profile patch.
|
|
179
|
+
|
|
180
|
+
### Safe removal
|
|
95
181
|
|
|
96
182
|
Removal is always explicit and can never be inferred by legacy `--fix --yes`:
|
|
97
183
|
|
|
@@ -100,33 +186,59 @@ dsh-doctor recover @scope/plugin --action remove # impact preview
|
|
|
100
186
|
dsh-doctor recover @scope/plugin --action remove --yes
|
|
101
187
|
```
|
|
102
188
|
|
|
103
|
-
Automatic removal requires a direct profile dependency, a readable lockfile, a non-core bundle, no manual mount or dangling patch that would remain, and a working current DSH CLI. Before the official
|
|
189
|
+
Automatic removal requires a direct profile dependency, a readable lockfile, a non-core bundle, no manual mount or dangling patch that would remain, and a working current DSH CLI. Before the official command runs, Doctor saves a redacted diagnostic snapshot and quarantine overlay:
|
|
190
|
+
|
|
191
|
+
```sh
|
|
192
|
+
dsh plugin --profile web remove @scope/plugin
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
It then re-diagnoses dependency, bundle-layer, and active-entry absence and reports the exact rollback install command. Static analysis cannot prove the absence of dynamic Service dependencies, external data, or regressions in every real workflow. Restart the profile and validate its main functions after any bundle update or removal.
|
|
104
196
|
|
|
105
|
-
|
|
197
|
+
---
|
|
106
198
|
|
|
107
199
|
## Baselines
|
|
108
200
|
|
|
201
|
+
Save a baseline before upgrading, then compare plugin versions, compatibility state, Harness state, and finding changes afterwards:
|
|
202
|
+
|
|
109
203
|
```sh
|
|
110
204
|
dsh-doctor baseline create
|
|
111
205
|
dsh-doctor baseline compare
|
|
206
|
+
|
|
207
|
+
# Custom path
|
|
112
208
|
dsh-doctor baseline create --output ./before-upgrade.json
|
|
209
|
+
dsh-doctor baseline compare --output ./before-upgrade.json
|
|
113
210
|
```
|
|
114
211
|
|
|
115
|
-
The default baseline is `.dsh-doctor/baseline.json` inside the profile. It
|
|
212
|
+
The default baseline is `.dsh-doctor/baseline.json` inside the profile. It supplements current evidence and is never required for diagnosis.
|
|
116
213
|
|
|
117
214
|
## Legacy confirmed repairs
|
|
118
215
|
|
|
119
216
|
`--fix` and `--repair` remain compatible with deterministic 0.1.x install, update, and bundle-manifest repairs. They never quarantine or remove a plugin. File actions are hash-checked, backed up, and atomically replaced; commands use fixed argv and the selected `DSH_HOME`.
|
|
120
217
|
|
|
121
|
-
|
|
218
|
+
```sh
|
|
219
|
+
dsh-doctor --fix
|
|
220
|
+
dsh-doctor --fix --yes --json
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Output and exit codes
|
|
122
226
|
|
|
123
227
|
Text output supports Chinese and English. `--json` keeps stable English codes and complete non-secret evidence; plugin `config` values and other common secret fields are replaced with `[REDACTED]`.
|
|
124
228
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
229
|
+
| Exit code | Meaning |
|
|
230
|
+
|---|---|
|
|
231
|
+
| `0` | No blocking error, or an explicit action passed static verification |
|
|
232
|
+
| `1` | A possible startup blocker remains, or recovery verification is incomplete |
|
|
233
|
+
| `2` | Argument, environment, or action execution failure |
|
|
234
|
+
|
|
235
|
+
## Security boundaries
|
|
128
236
|
|
|
129
|
-
|
|
237
|
+
- Does not execute third-party plugins or evaluate `!!js`; diagnosis parses configuration structure but redacts every plugin `config` value plus other common secret fields from JSON, baselines, and recovery snapshots; text reports do not print configuration values.
|
|
238
|
+
- Registry compatibility is declarative only; it does not prove a real startup or UI test.
|
|
239
|
+
- Dynamic Service dependencies, external side effects, real UI behavior, and business workflows require user validation.
|
|
240
|
+
- Precise patch edits only operate on structures Doctor can safely parse and locate; ambiguous cases are refused automatically.
|
|
241
|
+
- After adding, updating, or removing a bundle, a running profile does not automatically change its bundle set — a restart is required.
|
|
130
242
|
|
|
131
243
|
## Development
|
|
132
244
|
|
package/README.md
CHANGED
|
@@ -23,22 +23,28 @@ npx @bruc3van/dsh-doctor diagnose
|
|
|
23
23
|
|
|
24
24
|
默认检查 `$DSH_HOME/profiles/web`;未设置 `DSH_HOME` 时使用 `~/.dsh`。特殊安装可用 `--dsh-command /path/to/dsh` 指定实际 CLI,源码工作区可用 `--harness-root /path/to/deepseek-harness`。
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 插件迁移:0.1.1 → 0.1.2
|
|
29
|
+
|
|
30
|
+
### migrate 命令
|
|
27
31
|
|
|
28
32
|
Doctor 内置 `dsh-v0.1.1-rc.2 → dsh-v0.1.2-alpha.2` 的版本化迁移目录,并把升级拆成三个可审计阶段:
|
|
29
33
|
|
|
30
34
|
```sh
|
|
31
|
-
# 1
|
|
35
|
+
# 阶段 1:只读分析源码、类型导入、manifest、client graph 与构建产物
|
|
32
36
|
dsh-doctor migrate analyze /path/to/plugin \
|
|
37
|
+
--from dsh-v0.1.1-rc.2 \
|
|
38
|
+
--to dsh-v0.1.2-alpha.2 \
|
|
33
39
|
--harness-root /path/to/deepseek-harness
|
|
34
40
|
|
|
35
|
-
# 2
|
|
41
|
+
# 阶段 2:预览精确改写;加 --yes 才写入并创建时间戳备份
|
|
36
42
|
dsh-doctor migrate apply /path/to/plugin --safe \
|
|
37
43
|
--harness-root /path/to/deepseek-harness
|
|
38
44
|
dsh-doctor migrate apply /path/to/plugin --safe --yes \
|
|
39
45
|
--harness-root /path/to/deepseek-harness
|
|
40
46
|
|
|
41
|
-
# 3
|
|
47
|
+
# 阶段 3:依次完成静态、构建和隔离运行时验证
|
|
42
48
|
dsh-doctor migrate verify /path/to/plugin --level static \
|
|
43
49
|
--harness-root /path/to/deepseek-harness
|
|
44
50
|
dsh-doctor migrate verify /path/to/plugin --level build --yes \
|
|
@@ -47,15 +53,58 @@ dsh-doctor migrate verify /path/to/plugin --level runtime --yes \
|
|
|
47
53
|
--harness-root /path/to/deepseek-harness
|
|
48
54
|
```
|
|
49
55
|
|
|
50
|
-
|
|
56
|
+
可用 `dsh-doctor migrations list` 确认当前 CLI 包含所需版本对;如未安装,`npx --package=@bruc3van/dsh-doctor dsh-doctor migrations list` 也可完成确认。
|
|
57
|
+
|
|
58
|
+
### 各阶段说明
|
|
59
|
+
|
|
60
|
+
**analyze**:使用 TypeScript AST 扫描,能识别不会出现在 JavaScript bundle 中的 `import type`;同时检查 package 元数据、client graph 声明和构建产物,不因 bundle 干净就推断兼容。
|
|
61
|
+
|
|
62
|
+
**apply --safe**:只迁移 catalog 标记为精确等价的符号,将非移除的 DSH 开发依赖固定到目标版本,并创建时间戳备份。可能补充精确符号迁移所需的新依赖,但不会自动修改已有 peer 范围。Session、Workspace、Conversation 和 pending interaction 属于所有权及生命周期变化,保留为 `MIG_SEMANTIC_API_CHANGE`,不做机械替换。
|
|
63
|
+
|
|
64
|
+
**verify**:
|
|
51
65
|
|
|
52
|
-
|
|
66
|
+
| 级别 | 执行内容 |
|
|
67
|
+
|---|---|
|
|
68
|
+
| `static` | 使用 TypeScript AST 检查源码/import、manifest、client graph 与构建产物,不执行项目脚本 |
|
|
69
|
+
| `build` | 执行插件构建脚本,验证产物(需 `build` 或 `pack:check` 成功;仅有 `test`/`typecheck` 不足以证明发布产物) |
|
|
70
|
+
| `runtime` | 打真实 tarball,在临时 `DSH_HOME` 中通过目标 CLI 安装到全新 web profile,核验 CLI 版本、profile manifest、已安装包、bundle 激活与有效配置,执行激活 smoke;不触碰普通用户的 `~/.dsh` |
|
|
53
71
|
|
|
54
|
-
|
|
72
|
+
最高状态为 `analyzed` → `source-migrated` → `artifact-verified` → `runtime-verified`。`runtime-verified` 仍不能替代真实 UI、生命周期与业务行为的验证。失败现场会保留并报告路径;成功后默认清理。
|
|
55
73
|
|
|
56
|
-
|
|
74
|
+
### 主要 API 变化
|
|
57
75
|
|
|
58
|
-
`
|
|
76
|
+
`@deepseek-ai/dsh-client-runtime` 已移除,**没有聚合替代包**,各能力迁往:
|
|
77
|
+
|
|
78
|
+
| 原能力 | 0.1.2 归属 | 迁移方式 |
|
|
79
|
+
|---|---|---|
|
|
80
|
+
| store 引擎与 equality helpers | `dsh-client-store` | 精确(catalog 已列举符号) |
|
|
81
|
+
| Cordis 客户端 context 类型 | `@deepseek-ai/cordis` `Context` | 精确;保留本地别名 |
|
|
82
|
+
| session 控制/列表/命令 | `dsh-api-session-controller/client` | 语义(需开发者判断) |
|
|
83
|
+
| workspace 状态/命令 | `dsh-api-workspace-controller/client` | 语义 |
|
|
84
|
+
| conversation 组装 | `dsh-client-ui-conversation/client` | 语义 |
|
|
85
|
+
| pending interaction 状态 | ui-session 聚合的各 UI 包 | 语义 |
|
|
86
|
+
|
|
87
|
+
`@deepseek-ai/dsh-host-apiproxy` 也已移除,无兼容替代,浏览器操作改用 API Remotes/API Gateway 原生 Remote 所有者。
|
|
88
|
+
|
|
89
|
+
### dsh-plugin-upgrade skill
|
|
90
|
+
|
|
91
|
+
包内同时提供 [`dsh-plugin-upgrade` skill](skills/dsh-plugin-upgrade/SKILL.md),供编码 Agent(如 Claude Code)驱动完整迁移流程,确保不折叠任何安全阶段门控。Skill 描述触发条件:插件开发者寻求迁移、兼容性评估、API 替换、peer 依赖更新、产物重建或 DSH 0.1.2 运行时验证。
|
|
92
|
+
|
|
93
|
+
可直接从 GitHub 仓库安装到本机支持的编码 Agent:
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
npx skills add bruc3van/dsh-doctor
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
仓库当前只提供一个 skill,`skills` CLI 会发现并安装 `dsh-plugin-upgrade`;需要显式选择时可加 `--skill dsh-plugin-upgrade`。该命令只安装 Agent skill,不会全局安装 DSH Doctor CLI;skill 会优先使用现有 `dsh-doctor`,不存在时按流程通过 `npx @bruc3van/dsh-doctor` 调用匹配的 CLI。
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 诊断
|
|
104
|
+
|
|
105
|
+
### 诊断模型
|
|
106
|
+
|
|
107
|
+
`diagnose` 从空树开始,按当前 DSH 的正式顺序组合配置:
|
|
59
108
|
|
|
60
109
|
```text
|
|
61
110
|
bundle layers → profile cordis.patch.yml → home cordis.patch.yml → CLI overlays
|
|
@@ -77,11 +126,15 @@ dsh-doctor diagnose --json
|
|
|
77
126
|
dsh-doctor diagnose --check-updates
|
|
78
127
|
```
|
|
79
128
|
|
|
80
|
-
只有 `--check-updates` 和 `recover` 会访问 npm registry。离线诊断只报告 `update.status: "not-checked"
|
|
129
|
+
只有 `--check-updates` 和 `recover` 会访问 npm registry。离线诊断只报告 `update.status: "not-checked"`,绝不会把"未检查"写成"没有兼容版本"。
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## 恢复决策
|
|
81
134
|
|
|
82
|
-
|
|
135
|
+
### 兼容版本检查
|
|
83
136
|
|
|
84
|
-
Doctor 会检查所有已发布版本的 manifest,而不是只看 `latest`,并选出声明兼容当前可解析 DSH package
|
|
137
|
+
Doctor 会检查所有已发布版本的 manifest,而不是只看 `latest`,并选出声明兼容当前可解析 DSH package 版本的最高版本。结论仅表示"manifest 声明兼容的候选版本",不代表已经通过真实启动或 UI 验证。
|
|
85
138
|
|
|
86
139
|
```sh
|
|
87
140
|
dsh-doctor recover @scope/plugin --action check-update
|
|
@@ -89,7 +142,7 @@ dsh-doctor recover @scope/plugin --action update # 只预览
|
|
|
89
142
|
dsh-doctor recover @scope/plugin --action update --yes # 执行精确版本
|
|
90
143
|
```
|
|
91
144
|
|
|
92
|
-
|
|
145
|
+
### 临时与持久隔离
|
|
93
146
|
|
|
94
147
|
没有兼容版本时,默认先生成临时 overlay,再用实际 profile 验证其余功能:
|
|
95
148
|
|
|
@@ -111,17 +164,20 @@ dsh-doctor recover @scope/plugin --action persist-quarantine --verified
|
|
|
111
164
|
dsh-doctor recover @scope/plugin --action persist-quarantine --verified --yes
|
|
112
165
|
```
|
|
113
166
|
|
|
114
|
-
持久写入会追加 profile 层最终生效的禁用覆盖;如果 home 或 CLI overlay 等更高层仍会覆盖它,Doctor 会在写入前拒绝。写入后重新组合配置并逐个验证目标 entry 确实处于 disabled 状态;验证失败会返回非零退出码。写入前重新校验 SHA-256 并原子替换文件。已有 patch 会创建 `.dsh-doctor-<timestamp>.bak`;首次新建 patch 会创建 `.rollback.json
|
|
167
|
+
持久写入会追加 profile 层最终生效的禁用覆盖;如果 home 或 CLI overlay 等更高层仍会覆盖它,Doctor 会在写入前拒绝。写入后重新组合配置并逐个验证目标 entry 确实处于 disabled 状态;验证失败会返回非零退出码。写入前重新校验 SHA-256 并原子替换文件。已有 patch 会创建 `.dsh-doctor-<timestamp>.bak`;首次新建 patch 会创建 `.rollback.json`,其中记录目标文件和创建内容哈希,以便只在文件未被再次修改时执行删除式回滚。
|
|
115
168
|
|
|
116
|
-
|
|
169
|
+
可先预览并显式恢复备份或回滚记录:
|
|
117
170
|
|
|
118
171
|
```sh
|
|
119
|
-
dsh-doctor recover @scope/plugin --action rollback-quarantine
|
|
120
|
-
|
|
121
|
-
|
|
172
|
+
dsh-doctor recover @scope/plugin --action rollback-quarantine \
|
|
173
|
+
--backup /path/to/cordis.patch.yml.dsh-doctor-...bak
|
|
174
|
+
dsh-doctor recover @scope/plugin --action rollback-quarantine \
|
|
175
|
+
--backup /path/to/cordis.patch.yml.dsh-doctor-...bak --yes
|
|
122
176
|
```
|
|
123
177
|
|
|
124
|
-
|
|
178
|
+
Doctor 只接受属于当前 profile patch 的时间戳恢复文件。
|
|
179
|
+
|
|
180
|
+
### 安全删除
|
|
125
181
|
|
|
126
182
|
删除是独立动作,永远不会由通用 `--fix --yes` 推断:
|
|
127
183
|
|
|
@@ -138,6 +194,8 @@ dsh plugin --profile web remove @scope/plugin
|
|
|
138
194
|
|
|
139
195
|
成功后重新诊断并分别验证 dependency、bundle layer 和活跃 entry 已消失,同时保留原版本的精确回滚安装命令。静态检查无法证明不存在动态 Service 依赖、外部数据残留或所有真实业务流程都正常;完成后仍须重启 profile 并验证主要功能。
|
|
140
196
|
|
|
197
|
+
---
|
|
198
|
+
|
|
141
199
|
## 历史基线
|
|
142
200
|
|
|
143
201
|
升级前保存基线,升级后比较插件版本、兼容状态、Harness 与 finding 变化:
|
|
@@ -155,22 +213,24 @@ dsh-doctor baseline compare --output ./before-upgrade.json
|
|
|
155
213
|
|
|
156
214
|
## 旧版确认式修复
|
|
157
215
|
|
|
158
|
-
`--fix` / `--repair` 继续兼容 0.1.x 的确定性 install、update 与 bundle manifest
|
|
216
|
+
`--fix` / `--repair` 继续兼容 0.1.x 的确定性 install、update 与 bundle manifest 修复,不会触发 quarantine、持久化隔离或删除。文件动作展示路径并创建备份,命令使用固定 argv、绑定当前 `DSH_HOME`,任一步失败都会停止后续动作。
|
|
159
217
|
|
|
160
218
|
```sh
|
|
161
219
|
dsh-doctor --fix
|
|
162
220
|
dsh-doctor --fix --yes --json
|
|
163
221
|
```
|
|
164
222
|
|
|
165
|
-
|
|
223
|
+
---
|
|
166
224
|
|
|
167
225
|
## 输出与退出码
|
|
168
226
|
|
|
169
227
|
文本支持中文和英文,优先级为 `--lang`、`DSH_DOCTOR_LANG`、DSH 设置和系统 locale。`--json` 始终保留稳定英文 code 和完整的非秘密证据;插件 `config` 值和其他常见秘密字段会替换为 `[REDACTED]`。
|
|
170
228
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
229
|
+
| 退出码 | 含义 |
|
|
230
|
+
|---|---|
|
|
231
|
+
| `0` | 没有阻断错误,或显式动作成功且静态验证通过 |
|
|
232
|
+
| `1` | 仍有可能阻断启动的问题,或恢复后静态状态不完整 |
|
|
233
|
+
| `2` | 参数、运行环境或动作执行失败 |
|
|
174
234
|
|
|
175
235
|
## 安全边界
|
|
176
236
|
|
package/package.json
CHANGED
|
@@ -29,4 +29,4 @@ Session snapshots no longer own Conversation views or all pending-interaction fa
|
|
|
29
29
|
|
|
30
30
|
For `MIG_PATCH_TARGET_CHANGED`, first confirm the Harness checkout is exact and its tag scan succeeded. Then compare the old and target web profile bundle patches: remove an obsolete override only when the old row disappeared without a replacement, or update the id when upstream deliberately renamed/moved the row. Do not guess a replacement id from a similar name.
|
|
31
31
|
|
|
32
|
-
The machine-readable source of truth is the [
|
|
32
|
+
The machine-readable source of truth ships with DSH Doctor. Confirm the installed CLI exposes this exact version pair with `dsh-doctor migrations list`; the canonical catalog source is also available in the [DSH Doctor repository](https://github.com/bruc3van/dsh-doctor/tree/master/migrations/dsh-v0.1.1-rc.2__dsh-v0.1.2-alpha.2).
|