@luolingp/request-doctor 0.12.0 → 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.
- package/docs/01-/350/275/257/344/273/266/351/234/200/346/261/202/350/247/204/346/240/274/350/257/264/346/230/216.md +1 -1
- package/docs/02-/350/275/257/344/273/266/350/256/276/350/256/241/350/257/264/346/230/216.md +1 -1
- package/docs/03-/350/275/257/344/273/266/346/265/213/350/257/225/346/212/245/345/221/212.md +4 -4
- package/docs/04-/345/256/211/350/243/205/351/203/250/347/275/262/350/257/264/346/230/216.md +1 -1
- package/docs/05-/347/224/250/346/210/267/346/211/213/345/206/214.md +17 -2
- package/docs/06-/350/275/257/344/273/266/350/264/250/351/207/217/345/272/246/351/207/217/346/212/245/345/221/212.md +1 -1
- package/docs/quality-report.json +9 -9
- package/index.js +4 -2
- package/lib/text-lines.js +9 -0
- package/lib/verdict-report.js +46 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# 软件测试报告
|
|
2
2
|
|
|
3
3
|
**产品名称**:request-doctor(请求急救员)
|
|
4
|
-
**版本**:0.12.
|
|
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` |
|
|
66
|
-
| **合计** | **
|
|
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,其余按职能分散,合计
|
|
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.
|
|
4
|
+
**版本**:0.12.2
|
|
5
5
|
**编制依据**:GB/T 8567-2006《计算机软件文档编制规范》6.5
|
|
6
6
|
|
|
7
7
|
---
|
|
@@ -211,4 +211,19 @@ dsh-hyper-tools@0.1.0:incompatible
|
|
|
211
211
|
结论:要修得先让它要的东西能被提供;缺符号时本插件会尝试装入插件声明的旧版本。
|
|
212
212
|
```
|
|
213
213
|
|
|
214
|
-
判定为兼容但界面里装不上时,它也会告诉你该走 `/doctor install`。查不到这个插件时会列出已经审计过的插件名。
|
|
214
|
+
判定为兼容但界面里装不上时,它也会告诉你该走 `/doctor install`。查不到这个插件时会列出已经审计过的插件名。
|
|
215
|
+
|
|
216
|
+
想先看全貌:
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
/doctor list
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
已审计 3 个插件:
|
|
224
|
+
dsh-hyper-tools incompatible 真实旧版本 3 个(需重启):@de…
|
|
225
|
+
ok-plugin compatible
|
|
226
|
+
demo incompatible
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
列表里只留环境提示的前半句,完整内容用 `/doctor why` 看。
|
package/docs/quality-report.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"standard": "GB/T 45717-2025 信息技术 软件测量 软件质量测量 自动化的源代码质量测度",
|
|
3
|
-
"generatedAt": "2026-10-
|
|
3
|
+
"generatedAt": "2026-10-29T15:17:19.719Z",
|
|
4
4
|
"scope": {
|
|
5
|
-
"files":
|
|
6
|
-
"totalLines":
|
|
7
|
-
"sourceLines":
|
|
8
|
-
"commentLines":
|
|
5
|
+
"files": 30,
|
|
6
|
+
"totalLines": 5084,
|
|
7
|
+
"sourceLines": 3698,
|
|
8
|
+
"commentLines": 923
|
|
9
9
|
},
|
|
10
10
|
"measures": {
|
|
11
|
-
"commentDensity": 24.
|
|
12
|
-
"duplicationPercent": 4.
|
|
13
|
-
"functionCount":
|
|
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.
|
|
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 } 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';
|
|
@@ -210,7 +210,7 @@ function registerDoctorCommand(ctx, deps) {
|
|
|
210
210
|
commandCtx.commands.register({
|
|
211
211
|
name: 'doctor',
|
|
212
212
|
description: 'Show request-doctor repair activity, repair version mismatches now, or prepare a plugin for installation',
|
|
213
|
-
input: { hint: 'install <path-or-package> | allow <package@version> | why <package>' },
|
|
213
|
+
input: { hint: 'install <path-or-package> | allow <package@version> | why <package> | list' },
|
|
214
214
|
handler: async (invocation) => runDoctorCommand(invocation, deps),
|
|
215
215
|
}),
|
|
216
216
|
'request-doctor: /doctor command',
|
|
@@ -341,6 +341,8 @@ async function runDoctorCommand(invocation, deps) {
|
|
|
341
341
|
// allow 只授权、不安装:给那些想继续在图形界面里点安装的人用。
|
|
342
342
|
if (sub === 'allow') return allowVersionCommand(rest.join(' '), deps);
|
|
343
343
|
// why 回答「这个插件为什么被判为不可兼容」,答案就在最近一轮审计里。
|
|
344
|
+
// list 列出所有审计过的插件,先看全貌再用 why 追问。
|
|
345
|
+
if (sub === 'list') return listAudited(deps);
|
|
344
346
|
if (sub === 'why') return explainVerdict(rest.join(' '), deps);
|
|
345
347
|
return summarizeRepairs(deps);
|
|
346
348
|
}
|
package/lib/verdict-report.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import { linesText } from './text-lines.js';
|
|
2
|
+
|
|
3
|
+
// 最近一轮审计的清单。没扫过就是空数组。
|
|
4
|
+
function auditedOf(deps) {
|
|
5
|
+
return deps.diagnostics?.versionScan?.audited ?? [];
|
|
6
|
+
}
|
|
7
|
+
|
|
1
8
|
// 讲清某个插件为什么被拦下。
|
|
2
9
|
//
|
|
3
10
|
// 审计把判定、理由、缺的符号都记在诊断里,平时只在整轮扫描的输出里一闪而过。
|
|
@@ -8,10 +15,10 @@
|
|
|
8
15
|
// @returns {{kind: string, text: string}} 命令结果。
|
|
9
16
|
export function explainVerdict(name, deps) {
|
|
10
17
|
if (name === '') return { kind: 'error', text: 'usage: /doctor why <包名>' };
|
|
11
|
-
const audited = deps
|
|
18
|
+
const audited = auditedOf(deps);
|
|
12
19
|
const hit = audited.find((item) => item.name === name);
|
|
13
20
|
if (hit === undefined) return { kind: 'error', text: missingText(name, audited) };
|
|
14
|
-
return { kind: 'success', text: reportLines(hit)
|
|
21
|
+
return { kind: 'success', text: linesText(reportLines(hit)) };
|
|
15
22
|
}
|
|
16
23
|
|
|
17
24
|
// 一条一条拼出结论:判定、理由、缺的符号、环境,最后给一句能照做的建议。
|
|
@@ -35,3 +42,40 @@ function advice(verdict) {
|
|
|
35
42
|
if (verdict === 'compatible') return ' 结论:可以装。装不上就是管理器那边的检查没过,用 /doctor install 走本插件的路径。';
|
|
36
43
|
return ' 结论:要修得先让它要的东西能被提供;缺符号时本插件会尝试装入插件声明的旧版本。';
|
|
37
44
|
}
|
|
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
|
+
|
|
61
|
+
// 列出所有被审计过的插件:不先知道包名也能看现状。
|
|
62
|
+
export function formatList(deps) {
|
|
63
|
+
const audited = auditedOf(deps);
|
|
64
|
+
if (audited.length === 0) return { kind: 'success', text: '还没有扫描结果,先执行 /doctor 或等下一轮扫描' };
|
|
65
|
+
|
|
66
|
+
const lines = [`已审计 ${audited.length} 个插件:`];
|
|
67
|
+
const width = Math.max(...audited.map((item) => item.name.length));
|
|
68
|
+
for (const item of audited) {
|
|
69
|
+
const name = item.name.padEnd(width);
|
|
70
|
+
const where = item.environment === undefined ? '' : ` ${firstClause(item.environment)}`;
|
|
71
|
+
lines.push(` ${name} ${item.verdict}${where}`);
|
|
72
|
+
}
|
|
73
|
+
lines.push('', '用 /doctor why <包名> 看某个插件的完整理由。');
|
|
74
|
+
return { kind: 'success', text: linesText(lines) };
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// 长句在列表里只留前半句,完整内容留给 why。
|
|
78
|
+
function firstClause(text) {
|
|
79
|
+
const cut = text.split(';')[0];
|
|
80
|
+
return cut.length > 24 ? `${cut.slice(0, 24)}…` : cut;
|
|
81
|
+
}
|