@luolingp/request-doctor 0.12.1 → 0.12.2

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.1
5
+ **版本**:0.12.2
6
6
 
7
7
  ---
8
8
 
@@ -1,7 +1,7 @@
1
1
  # 软件设计说明
2
2
 
3
3
  **产品名称**:request-doctor(请求急救员)
4
- **版本**:0.12.1
4
+ **版本**:0.12.2
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.1
4
+ **版本**:0.12.2
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` | 8 | /doctor why 与 list:判定、理由、缺符号、环境、全貌 | 缺导出判为需要重启;其它失败不误判;多次累积不覆盖 |
66
- | **合计** | **169** | **全部通过** |
65
+ | `test/verdict-report.test.mjs` | 11 | why 与 list:判定、理由、缺符号、环境、空清单自动扫描 | 缺导出判为需要重启;其它失败不误判;多次累积不覆盖 |
66
+ | **合计** | **172** | **全部通过** |
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,其余按职能分散,合计 169。
216
+ 31 个测试文件逐个单独执行,每个都有用例且全部通过,不存在因导入失败而静默跳过的文件。用例数分布:compat.test.mjs 17、plugin.test.mjs 15、compat-env.test.mjs 14、classify.test.mjs 13,其余按职能分散,合计 172。
@@ -1,7 +1,7 @@
1
1
  # 软件安装部署说明
2
2
 
3
3
  **产品名称**:request-doctor(请求急救员)
4
- **版本**:0.12.1
4
+ **版本**:0.12.2
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.1
4
+ **版本**:0.12.2
5
5
  **编制依据**:GB/T 8567-2006《计算机软件文档编制规范》6.5
6
6
 
7
7
  ---
@@ -1,7 +1,7 @@
1
1
  # 软件质量度量报告
2
2
 
3
3
  **产品名称**:request-doctor(请求急救员)
4
- **版本**:0.12.1
4
+ **版本**:0.12.2
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-29T14:43:27.596Z",
3
+ "generatedAt": "2026-10-29T15:17:19.719Z",
4
4
  "scope": {
5
5
  "files": 30,
6
- "totalLines": 5064,
7
- "sourceLines": 3686,
8
- "commentLines": 917
6
+ "totalLines": 5084,
7
+ "sourceLines": 3698,
8
+ "commentLines": 923
9
9
  },
10
10
  "measures": {
11
- "commentDensity": 24.88,
12
- "duplicationPercent": 4.94,
13
- "functionCount": 382,
11
+ "commentDensity": 24.96,
12
+ "duplicationPercent": 4.99,
13
+ "functionCount": 384,
14
14
  "maxComplexity": 10,
15
15
  "maxFunctionLines": 59,
16
16
  "maxFileLines": 500,
17
- "averageComplexity": 3.88
17
+ "averageComplexity": 3.86
18
18
  },
19
19
  "limits": {
20
20
  "maxComplexity": 10,
package/index.js CHANGED
@@ -17,7 +17,7 @@
17
17
  // 因此能显示出来,不用发明新的事件类型。
18
18
  //
19
19
  // 这个文件是装配处:只管生命周期和监听器,具体判断都在 lib/ 里。
20
- import { explainVerdict, formatList } from './lib/verdict-report.js';
20
+ import { explainVerdict, listAudited } from './lib/verdict-report.js';
21
21
  import { parseRetryConfig } from './lib/classify.js';
22
22
  import { collectPackageFacts, entryPathOf } from './lib/compat-repair.js';
23
23
  import { unmetPeers } from './lib/compat.js';
@@ -342,7 +342,7 @@ async function runDoctorCommand(invocation, deps) {
342
342
  if (sub === 'allow') return allowVersionCommand(rest.join(' '), deps);
343
343
  // why 回答「这个插件为什么被判为不可兼容」,答案就在最近一轮审计里。
344
344
  // list 列出所有审计过的插件,先看全貌再用 why 追问。
345
- if (sub === 'list') return formatList(deps);
345
+ if (sub === 'list') return listAudited(deps);
346
346
  if (sub === 'why') return explainVerdict(rest.join(' '), deps);
347
347
  return summarizeRepairs(deps);
348
348
  }
@@ -1,5 +1,10 @@
1
1
  import { linesText } from './text-lines.js';
2
2
 
3
+ // 最近一轮审计的清单。没扫过就是空数组。
4
+ function auditedOf(deps) {
5
+ return deps.diagnostics?.versionScan?.audited ?? [];
6
+ }
7
+
3
8
  // 讲清某个插件为什么被拦下。
4
9
  //
5
10
  // 审计把判定、理由、缺的符号都记在诊断里,平时只在整轮扫描的输出里一闪而过。
@@ -10,7 +15,7 @@ import { linesText } from './text-lines.js';
10
15
  // @returns {{kind: string, text: string}} 命令结果。
11
16
  export function explainVerdict(name, deps) {
12
17
  if (name === '') return { kind: 'error', text: 'usage: /doctor why <包名>' };
13
- const audited = deps.diagnostics?.versionScan?.audited ?? [];
18
+ const audited = auditedOf(deps);
14
19
  const hit = audited.find((item) => item.name === name);
15
20
  if (hit === undefined) return { kind: 'error', text: missingText(name, audited) };
16
21
  return { kind: 'success', text: linesText(reportLines(hit)) };
@@ -38,9 +43,24 @@ function advice(verdict) {
38
43
  return ' 结论:要修得先让它要的东西能被提供;缺符号时本插件会尝试装入插件声明的旧版本。';
39
44
  }
40
45
 
46
+ // /doctor list 的入口:没有扫描结果就先扫一轮。
47
+ //
48
+ // 刚启动时诊断里什么都没有,直接说「还没有结果」等于把活推回给用户。
49
+ // 扫描本身是幂等的,顺手做掉更省事。
50
+ export async function listAudited(deps) {
51
+ if (auditedOf(deps).length === 0 && deps.versionRepair !== undefined) {
52
+ try {
53
+ await deps.versionRepair.run('list');
54
+ } catch {
55
+ // 扫描失败不影响回答:下面会如实说还没结果。
56
+ }
57
+ }
58
+ return formatList(deps);
59
+ }
60
+
41
61
  // 列出所有被审计过的插件:不先知道包名也能看现状。
42
62
  export function formatList(deps) {
43
- const audited = deps.diagnostics?.versionScan?.audited ?? [];
63
+ const audited = auditedOf(deps);
44
64
  if (audited.length === 0) return { kind: 'success', text: '还没有扫描结果,先执行 /doctor 或等下一轮扫描' };
45
65
 
46
66
  const lines = [`已审计 ${audited.length} 个插件:`];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luolingp/request-doctor",
3
- "version": "0.12.1",
3
+ "version": "0.12.2",
4
4
  "description": "自动修复客户端引起的请求失败,并让版本不匹配的 DSH 插件能装上、能跑起来。",
5
5
  "keywords": [
6
6
  "dsh-plugin",