@moonquake2004/dsh-doctor 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.
package/README.md CHANGED
@@ -69,6 +69,8 @@ With `--envelope` (doctor-contract mode): `0` = all pass · `1` = any WARN · `2
69
69
 
70
70
  ## Related community tools
71
71
 
72
+ > **dsh-doctor/v1 vocabulary r5 compatible** — drafted by [@ciceroyang](https://github.com/ciceroyang) (ciceroyang/dsh-doctor), reviewed by [@sjh9714](https://github.com/sjh9714) (dsh-win32) and [@moonquake2004](https://github.com/moonquake2004) ([#1719](https://github.com/deepseek-ai/deepseek-harness/discussions/1719)). Our `node`/`pnpm` checks emit the vocabulary names with r5 semantics (pass/warn/fail/skip; `summary.skip` always present).
73
+
72
74
  - [zoahdev/dsh-plugin-doctor](https://github.com/zoahdev/dsh-plugin-doctor) — pre-publish plugin bundle health checks (manifest/patch/entry/files/build/pack+fresh-profile install) plus a `profile-shadow` tripwire for host-shadowing (author/CI side). Complementary to this tool's user-side profile/session/env diagnostics; its `profile-shadow` and our P5 flag the same host-shadowing precondition from two sides.
73
75
  - [boyin111-1/dsh-doctor](https://github.com/boyin111-1/dsh-doctor) — sibling offline diagnostic, cross-verified against the same broken fixtures.
74
76
 
package/README.zh.md CHANGED
@@ -64,6 +64,8 @@ node dsh-doctor.mjs --no-catalog # 不拉远程目录(只用内置副
64
64
 
65
65
  ## 相关社区工具
66
66
 
67
+ > **dsh-doctor/v1 词汇表 r5 兼容** —— 起草 [@ciceroyang](https://github.com/ciceroyang)(ciceroyang/dsh-doctor),审阅 [@sjh9714](https://github.com/sjh9714)(dsh-win32)与 [@moonquake2004](https://github.com/moonquake2004)([#1719](https://github.com/deepseek-ai/deepseek-harness/discussions/1719))。我们的 `node`/`pnpm` 检查按 r5 语义输出词汇名(pass/warn/fail/skip;`summary.skip` 常驻)。
68
+
67
69
  - [zoahdev/dsh-plugin-doctor](https://github.com/zoahdev/dsh-plugin-doctor) —— 发布前插件 bundle 健康检查(manifest/patch/entry/files/build/pack+全新 profile 安装)+ 宿主遮蔽 `profile-shadow` 哨兵(作者/CI 侧)。与本工具的用户侧 profile/session/env 诊断互补;它的 `profile-shadow` 与我们的 P5 从两个方向标记同一个宿主遮蔽前置条件。
68
70
  - [boyin111-1/dsh-doctor](https://github.com/boyin111-1/dsh-doctor) —— 同生态位离线诊断兄弟实现,用同一批坏 fixture 交叉验证。
69
71
 
package/dsh-doctor.mjs CHANGED
@@ -108,12 +108,19 @@ function resolveProfile(name) {
108
108
  }
109
109
 
110
110
  /* ================= env ================= */
111
+ /** v1 词汇表 r5(#1719)node 语义:pass = 满足 ^22.19.0 || >=24.0.0(root package.json engines),其余 warn——无民间 fail 阈值。 */
112
+ function nodeInSupportedRange(v) {
113
+ const m = /^v?(\d+)\.(\d+)\.(\d+)/.exec(String(v));
114
+ if (!m) return false;
115
+ const major = Number(m[1]); const minor = Number(m[2]);
116
+ return (major === 22 && minor >= 19) || major >= 24;
117
+ }
111
118
  function checkEnv() {
112
119
  if (!wants('env')) return;
113
120
  const find = (cmd) => { for (const w of process.platform === 'win32' ? ['where'] : ['which']) { const r = spawnSync(w, [cmd]); if (r.status === 0) { const p = String(r.stdout).split(/\r?\n/)[0].trim(); if (p) return p; } } return null; };
114
121
  for (const cmd of ['node', 'pnpm', 'zstd']) {
115
122
  const p = find(cmd);
116
- report('env', `E1-${cmd}`, !!p, p ? `${cmd}: ${p}` : `${cmd} 不在 PATH(${cmd === 'node' ? '创建会话会失败 #1270' : cmd === 'pnpm' ? 'dsh plugin 不可用' : '会话日志解压不可用'})`, p ? undefined : `安装 ${cmd} 或加入 PATH`);
123
+ report('env', `E1-${cmd}`, !!p, p ? `${cmd}: ${p}` : `${cmd} 不在 PATH(${cmd === 'node' ? '创建会话会失败 #1270' : cmd === 'pnpm' ? 'dsh plugin 不可用(corepack 可恢复:corepack enable pnpm)' : '会话日志解压不可用'})`, p ? undefined : (cmd === 'pnpm' ? 'corepack enable pnpm 或安装 pnpm 后加入 PATH' : `安装 ${cmd} 或加入 PATH`));
117
124
  }
118
125
  const envFile = join(HOME, '.env');
119
126
  if (existsSync(envFile)) {
@@ -121,7 +128,13 @@ function checkEnv() {
121
128
  report('env', 'E2-env', !isDir, isDir ? `${envFile} 是目录,dsh 启动会报 failed to load .env: EISDIR(#71)` : `${envFile} 正常`, isDir ? '删除或改名该目录' : undefined);
122
129
  }
123
130
  const nv = spawnSync('node', ['-e', 'console.log(process.version)']);
124
- if (nv.status === 0) report('env', 'E3-node', true, `node ${String(nv.stdout).trim()}`, undefined);
131
+ if (nv.status === 0) {
132
+ const version = String(nv.stdout).trim();
133
+ const supported = nodeInSupportedRange(version);
134
+ report('env', 'E3-node', supported,
135
+ supported ? `node ${version}(满足 ^22.19.0 || >=24.0.0,root package.json engines)` : `node ${version} 不在支持范围(^22.19.0 || >=24.0.0)——会话日志读取等能力受限`,
136
+ supported ? undefined : '升级 node 到 ^22.19.0 或 >=24.0.0(root package.json engines,见 #2259)');
137
+ }
125
138
 
126
139
  // E4:node-pty 原生模块完整性(#1219:pty.node 缺失 → dsh web 启动失败)
127
140
  const ptyDirs = [];
@@ -749,6 +762,9 @@ function scanAllSessions() {
749
762
  const REMOTE_CATALOG_URL = 'https://raw.githubusercontent.com/moonquake2004/dsh-doctor/main/plugin/checks.json';
750
763
  const CATALOG_TTL_MS = 6 * 60 * 60 * 1000; // 6h:新检查最长 6h 内自动生效
751
764
  const catalogSeverity = new Map(); // catalog 检查 id → severity('error' | 'warn')
765
+ // v1 词汇表 r5 对齐(#1719):E1-pnpm 缺失=warn(corepack 可恢复)、E3-node 越界=warn(EBADENGINE 语义)——均不翻退出码
766
+ catalogSeverity.set('E1-pnpm', 'warn');
767
+ catalogSeverity.set('E3-node', 'warn');
752
768
 
753
769
  function bundledCatalog() {
754
770
  const p = new URL('./checks.json', import.meta.url);
@@ -1102,7 +1118,7 @@ async function run() {
1102
1118
  if (jsonOut && process.argv.includes('--envelope')) {
1103
1119
  // v1 契约信封(dsh doctor 规格,zoahdev/doctor 对齐):status 小写 + 退出码 0/1/2
1104
1120
  const st = (r) => (!r.ok ? (catalogSeverity.get(r.id) === 'warn' ? 'warn' : 'fail') : 'pass');
1105
- const summary = { pass: 0, warn: 0, fail: 0 };
1121
+ const summary = { pass: 0, warn: 0, fail: 0, skip: 0 }; // skip 常驻(v1 词汇表 r5:#1719),当前无平台作用域检查所以恒为 0
1106
1122
  const checks = results.map((r) => { summary[st(r)]++; return { name: r.id, status: st(r), detail: r.detail }; });
1107
1123
  const exitCode = summary.fail > 0 ? 2 : summary.warn > 0 ? 1 : 0;
1108
1124
  console.log(JSON.stringify({
@@ -1142,4 +1158,4 @@ async function run() {
1142
1158
  // 直接执行(CLI:根目录薄封装、plugin 本体、npm bin 均可);被 import(测试/宿主)时不自动运行
1143
1159
  if (process.argv[1] && /^dsh-doctor(\.mjs)?$/.test(basename(process.argv[1]))) run();
1144
1160
 
1145
- export { loadCatalog, bundledCatalog, validCatalog, expandPath, globCount, checkCatalog };
1161
+ export { loadCatalog, bundledCatalog, validCatalog, expandPath, globCount, checkCatalog, nodeInSupportedRange };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moonquake2004/dsh-doctor",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Offline diagnostic for DeepSeek Harness — 25 built-in + 5 catalog checks across env/profile/session (Layer A checks-as-data), self-update (Layer B), and a semi-automatic LLM observer (Layer C, --observe); Doctor panel in web UI settings.",
5
5
  "main": "lib/index.js",
6
6
  "files": [