@luolingp/request-doctor 0.12.3 → 0.12.5

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  **产品名称**:request-doctor(请求急救员)
4
4
  **产品标识**:request-doctor
5
- **版本**:0.12.3
5
+ **版本**:0.12.5
6
6
 
7
7
  ---
8
8
 
@@ -1,7 +1,7 @@
1
1
  # 软件设计说明
2
2
 
3
3
  **产品名称**:request-doctor(请求急救员)
4
- **版本**:0.12.3
4
+ **版本**:0.12.5
5
5
  **编制依据**:GB/T 8567-2006《计算机软件文档编制规范》6.2
6
6
 
7
7
  ---
@@ -1,7 +1,7 @@
1
1
  # 软件测试报告
2
2
 
3
3
  **产品名称**:request-doctor(请求急救员)
4
- **版本**:0.12.3
4
+ **版本**:0.12.5
5
5
  **编制依据**:GB/T 8567-2006《计算机软件文档编制规范》6.6;GB/T 8566-2007 验证与确认过程
6
6
 
7
7
  ---
@@ -62,8 +62,8 @@
62
62
  | `test/client-half.test.mjs` | 5 | 客户端半:模块身份、注入声明、apply 注册、组件能渲染 |
63
63
  | `test/diagnostics.test.mjs` | 3 | 快照可选写入:不配置不写盘、突发合并、坏路径不致命 |
64
64
  | `test/restart-notice.test.mjs` | 3 |
65
- | `test/verdict-report.test.mjs` | 13 | why 与 list:判定、理由、环境、自动扫描、扫描中不误报 | 缺导出判为需要重启;其它失败不误判;多次累积不覆盖 |
66
- | **合计** | **174** | **全部通过** |
65
+ | `test/verdict-report.test.mjs` | 18 | why 与 list:判定、理由、环境、自动扫描、分组排序 | 缺导出判为需要重启;其它失败不误判;多次累积不覆盖 |
66
+ | **合计** | **179** | **全部通过** |
67
67
 
68
68
  执行结果:
69
69
 
@@ -213,4 +213,4 @@
213
213
 
214
214
  ### 7.2 分文件执行结果
215
215
 
216
- 31 个测试文件逐个单独执行,每个都有用例且全部通过,不存在因导入失败而静默跳过的文件。用例数分布:compat.test.mjs 17、plugin.test.mjs 15、compat-env.test.mjs 14、classify.test.mjs 13,其余按职能分散,合计 174。
216
+ 31 个测试文件逐个单独执行,每个都有用例且全部通过,不存在因导入失败而静默跳过的文件。用例数分布:compat.test.mjs 17、plugin.test.mjs 15、compat-env.test.mjs 14、classify.test.mjs 13,其余按职能分散,合计 179。
@@ -1,7 +1,7 @@
1
1
  # 软件安装部署说明
2
2
 
3
3
  **产品名称**:request-doctor(请求急救员)
4
- **版本**:0.12.3
4
+ **版本**:0.12.5
5
5
  **编制依据**:GB/T 8567-2006《计算机软件文档编制规范》6.7
6
6
 
7
7
  ---
@@ -1,7 +1,7 @@
1
1
  # 软件用户手册
2
2
 
3
3
  **产品名称**:request-doctor(请求急救员)
4
- **版本**:0.12.3
4
+ **版本**:0.12.5
5
5
  **编制依据**:GB/T 8567-2006《计算机软件文档编制规范》6.5
6
6
 
7
7
  ---
@@ -221,9 +221,15 @@ dsh-hyper-tools@0.1.0:incompatible
221
221
 
222
222
  ```
223
223
  已审计 3 个插件:
224
- dsh-hyper-tools incompatible 真实旧版本 3 个(需重启):@de…
225
- ok-plugin compatible
226
- demo incompatible
224
+
225
+ 需要处理 1 个:
226
+ dsh-hyper-tools incompatible 真实旧版本 3 个(需重启):@deepseek…
227
+
228
+ 可以直接用 2 个:
229
+ dsh-fast-mode compatible
230
+ dsh-ssh-ops compatible 薄垫片 5 个
227
231
  ```
228
232
 
233
+ 需要处理的排在前面,兼容的排在后面。
234
+
229
235
  列表里只留环境提示的前半句,完整内容用 `/doctor why` 看。
@@ -1,7 +1,7 @@
1
1
  # 软件质量度量报告
2
2
 
3
3
  **产品名称**:request-doctor(请求急救员)
4
- **版本**:0.12.3
4
+ **版本**:0.12.5
5
5
  **度量标准**:GB/T 45717-2025《信息技术 软件测量 软件质量测量 自动化的源代码质量测度》
6
6
  **度量工具**:`tools/quality-measure.mjs`(本仓库自带,可复现)
7
7
 
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "standard": "GB/T 45717-2025 信息技术 软件测量 软件质量测量 自动化的源代码质量测度",
3
- "generatedAt": "2026-10-29T15:23:43.097Z",
3
+ "generatedAt": "2026-10-29T15:36:30.169Z",
4
4
  "scope": {
5
5
  "files": 31,
6
- "totalLines": 5103,
7
- "sourceLines": 3706,
8
- "commentLines": 930
6
+ "totalLines": 5128,
7
+ "sourceLines": 3720,
8
+ "commentLines": 936
9
9
  },
10
10
  "measures": {
11
- "commentDensity": 25.09,
12
- "duplicationPercent": 4.91,
13
- "functionCount": 385,
11
+ "commentDensity": 25.16,
12
+ "duplicationPercent": 4.94,
13
+ "functionCount": 387,
14
14
  "maxComplexity": 10,
15
15
  "maxFunctionLines": 59,
16
16
  "maxFileLines": 500,
17
- "averageComplexity": 3.86
17
+ "averageComplexity": 3.85
18
18
  },
19
19
  "limits": {
20
20
  "maxComplexity": 10,
@@ -18,12 +18,22 @@ import { ensureAudited } from './scan-bridge.js';
18
18
  // @param {string} name - 插件包名。
19
19
  // @param {object} deps - 组合根传进来的依赖,只需要 diagnostics。
20
20
  // @returns {{kind: string, text: string}} 命令结果。
21
- export function explainVerdict(name, deps) {
21
+ export async function explainVerdict(name, deps) {
22
22
  if (name === '') return { kind: 'error', text: 'usage: /doctor why <包名>' };
23
- const audited = auditedOf(deps);
24
- const hit = audited.find((item) => item.name === name);
25
- if (hit === undefined) return { kind: 'error', text: missingText(name, audited) };
26
- return { kind: 'success', text: linesText(reportLines(hit)) };
23
+ const found = find(name, deps);
24
+ if (found !== undefined) return { kind: 'success', text: linesText(reportLines(found)) };
25
+
26
+ // 和 list 一样:没有扫描结果就先扫一轮,正在扫就告诉用户等一下。
27
+ const state = await ensureAudited(deps.versionRepair);
28
+ if (state.busy === true) return { kind: 'success', text: BUSY_TEXT };
29
+ const again = find(name, deps);
30
+ if (again !== undefined) return { kind: 'success', text: linesText(reportLines(again)) };
31
+ return { kind: 'error', text: missingText(name, auditedOf(deps)) };
32
+ }
33
+
34
+ // 在最近一轮审计里按包名找一条。
35
+ function find(name, deps) {
36
+ return auditedOf(deps).find((item) => item.name === name);
27
37
  }
28
38
 
29
39
  // 一条一条拼出结论:判定、理由、缺的符号、环境,最后给一句能照做的建议。
@@ -60,21 +70,36 @@ export async function listAudited(deps) {
60
70
  }
61
71
 
62
72
  // 列出所有被审计过的插件:不先知道包名也能看现状。
73
+ //
74
+ // 按判定分组输出:需要处理的排在前面。混在一起时,扫一眼看不出问题在哪。
63
75
  export function formatList(deps) {
64
76
  const audited = auditedOf(deps);
65
77
  if (audited.length === 0) return { kind: 'success', text: '还没有扫描结果,先执行 /doctor 或等下一轮扫描' };
66
78
 
67
- const lines = [`已审计 ${audited.length} 个插件:`];
79
+ const broken = audited.filter((item) => item.verdict !== 'compatible');
80
+ const fine = audited.filter((item) => item.verdict === 'compatible');
68
81
  const width = Math.max(...audited.map((item) => item.name.length));
69
- for (const item of audited) {
70
- const name = item.name.padEnd(width);
71
- const where = item.environment === undefined ? '' : ` ${firstClause(item.environment)}`;
72
- lines.push(` ${name} ${item.verdict}${where}`);
73
- }
82
+
83
+ const lines = [`已审计 ${audited.length} 个插件:`];
84
+ if (broken.length > 0) pushGroup(lines, `需要处理 ${broken.length} 个`, broken, width);
85
+ if (fine.length > 0) pushGroup(lines, `可以直接用 ${fine.length} 个`, fine, width);
74
86
  lines.push('', '用 /doctor why <包名> 看某个插件的完整理由。');
75
87
  return { kind: 'success', text: linesText(lines) };
76
88
  }
77
89
 
90
+ // 一个小标题加若干行。
91
+ function pushGroup(lines, title, items, width) {
92
+ lines.push('', `${title}:`);
93
+ for (const item of items) lines.push(` ${rowOf(item, width)}`);
94
+ }
95
+
96
+ // 一行:名字对齐,后面跟判定和环境提示。
97
+ function rowOf(item, width) {
98
+ const name = item.name.padEnd(width);
99
+ const where = item.environment === undefined ? '' : ` ${firstClause(item.environment)}`;
100
+ return `${name} ${item.verdict}${where}`;
101
+ }
102
+
78
103
  // 长句在列表里只留前半句,完整内容留给 why。
79
104
  function firstClause(text) {
80
105
  const cut = text.split(';')[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luolingp/request-doctor",
3
- "version": "0.12.3",
3
+ "version": "0.12.5",
4
4
  "description": "自动修复客户端引起的请求失败,并让版本不匹配的 DSH 插件能装上、能跑起来。",
5
5
  "keywords": [
6
6
  "dsh-plugin",