dsh-lean-router 1.0.3 → 1.0.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.
@@ -0,0 +1,322 @@
1
+ // dsh-lean-router - 技能面板(宿主侧命令输出形态)
2
+ //
3
+ // 背景:客户端插件(真面板)在真机上始终加载不了,见 issue #2 的排除链。本模块先把面板的
4
+ // 信息价值用命令输出交付;客户端修好后,这里的数据组装逻辑可直接复用到 UI。
5
+ //
6
+ // 用法:
7
+ // /panel 总览(本轮 + 分组技能表 + 从未命中摘要)
8
+ // /panel skills 完整技能表(含全关)
9
+ // /panel round 本轮门控明细
10
+ // /panel stats 历史命中统计(按活跃度排序)
11
+ // /panel never 从未命中的完整清单
12
+ // /panel all 总览,但不隐藏全关技能
13
+ //
14
+ // 数据源:
15
+ // - 31 技能与开关 = assets/skills.matrix.json(包内矩阵,唯一事实源)
16
+ // - 本轮命中 = getAuditChannel().entries()(skillgate 内存环形缓冲)
17
+ // - 历史统计 = readAuditEntries(auditPath)(审计 JSONL 回放)
18
+ import { readFileSync } from "node:fs";
19
+ import { dirname, join } from "node:path";
20
+ import { fileURLToPath } from "node:url";
21
+ import { defaultAuditPath, readAuditEntries } from "./audit-sink.js";
22
+ import { aggregateStats } from "./audit-commands.js";
23
+ import { getAuditChannel } from "./skillgate.js";
24
+
25
+ const ROOT = dirname(dirname(fileURLToPath(import.meta.url)));
26
+ const REPLAY_MAX = 2000;
27
+ const NEVER_PREVIEW = 10;
28
+
29
+ /** 场景顺序与中文名:分组表的展示顺序。 */
30
+ const SCENES = [
31
+ ["engineering", "工程"],
32
+ ["process", "流程"],
33
+ ["research", "研究"],
34
+ ["meta", "元交互"],
35
+ ];
36
+
37
+ export const VIEWS = ["summary", "skills", "round", "stats", "never"];
38
+
39
+ /** 读包内技能矩阵;读不到返回 null(面板降级而不是报错)。 */
40
+ export function loadMatrix(root) {
41
+ try {
42
+ return JSON.parse(readFileSync(join(root ?? ROOT, "assets", "skills.matrix.json"), "utf8"));
43
+ } catch {
44
+ return null;
45
+ }
46
+ }
47
+
48
+ /** 显示宽度:中日韩与全角字符算两列。 */
49
+ export function displayWidth(text) {
50
+ const s = String(text ?? "");
51
+ let w = 0;
52
+ for (const ch of s) w += /[\u3000-\u9fff\uff00-\uffef]/.test(ch) ? 2 : 1;
53
+ return w;
54
+ }
55
+
56
+ /** 按显示宽度补齐,保证表格在等宽字体下不错位。 */
57
+ function pad(text, width) {
58
+ const s = String(text ?? "");
59
+ return s + " ".repeat(Math.max(0, width - displayWidth(s)));
60
+ }
61
+
62
+ function countSwitches(skills) {
63
+ let model = 0;
64
+ let user = 0;
65
+ let off = 0;
66
+ for (const s of skills) {
67
+ if (s.model) model += 1;
68
+ if (s.user) user += 1;
69
+ if (!s.model && !s.user) off += 1;
70
+ }
71
+ return { model, user, off, total: skills.length };
72
+ }
73
+
74
+ /** 本轮摘要:最后一条 skillgate-round。 */
75
+ function renderCurrentRound(entries, detailed) {
76
+ const last = [...entries].reverse().find((e) => e && e.kind === "skillgate-round");
77
+ if (!last) return ["--- 本轮 ---", "(尚无门控记录:gate 未启用,或本轮还没走到门控)"];
78
+
79
+ const d = last.decision ?? {};
80
+ const auto = Array.isArray(d.auto) ? d.auto : [];
81
+ const hint = Array.isArray(d.hint) ? d.hint : [];
82
+ const deg = Array.isArray(d.degradations) ? d.degradations : [];
83
+ const budget = last.config?.tokenBudget;
84
+ const est = last.estTokens ?? d.estTokens;
85
+
86
+ const lines = [
87
+ "--- 本轮 ---",
88
+ "turn " + String(last.turn ?? "?") +
89
+ " · band " + String(last.band ?? "?") +
90
+ (last.complex ? " · 复杂任务" : "") +
91
+ (budget !== undefined ? " · token " + String(est ?? "?") + "/" + String(budget) : ""),
92
+ "自动入选:" + (auto.length ? auto.join(", ") : "(无)"),
93
+ "近场提示:" + (hint.length ? hint.join(", ") : "(无)"),
94
+ ];
95
+ if (deg.length) {
96
+ lines.push("软降级:" + deg.map((x) => (typeof x === "string" ? x : x?.name ?? "?")).join(", "));
97
+ }
98
+
99
+ const scored = (Array.isArray(last.scores) ? last.scores : [])
100
+ .filter((s) => typeof s?.score === "number" && s.score > 0)
101
+ .sort((a, b) => b.score - a.score);
102
+
103
+ if (scored.length) {
104
+ if (detailed) {
105
+ lines.push("得分构成:");
106
+ for (const s of scored.slice(0, 10)) {
107
+ const sig = s.signals ?? {};
108
+ const cat = sig.category ?? {};
109
+ const kws = Array.isArray(sig.keywords) ? sig.keywords : [];
110
+ lines.push(
111
+ " " + pad(s.name, 24) +
112
+ "总分 " + String(s.score) +
113
+ " · 类别 " + String(cat.points ?? 0) +
114
+ (cat.scene ? "(" + String(cat.scene) + ")" : "") +
115
+ " · 关键词 " + (kws.length ? kws.join("/") : "无") +
116
+ (cat.complex ? " · 复杂加成" : "")
117
+ );
118
+ }
119
+ } else {
120
+ lines.push("得分:" + scored.slice(0, 5).map((s) => s.name + "(" + s.score + ")").join(" "));
121
+ }
122
+ }
123
+ return lines;
124
+ }
125
+
126
+ /** 单行技能。 */
127
+ function skillRow(s, st) {
128
+ return (
129
+ pad(s.name, 30) +
130
+ pad(s.model ? "开" : "关", 7) +
131
+ pad(s.user ? "开" : "关", 6) +
132
+ pad(String(st ? st.hits : 0), 5) +
133
+ pad(String(st ? st.auto : 0), 6) +
134
+ String(st ? st.hint : 0)
135
+ );
136
+ }
137
+
138
+ const TABLE_HEAD =
139
+ pad("技能", 30) + pad("model", 7) + pad("user", 6) + pad("词", 5) + pad("自动", 6) + "提示";
140
+ const TABLE_RULE = "-".repeat(displayWidth(TABLE_HEAD));
141
+
142
+ /** 按场景分组的技能表;hideOff=true 时隐藏 model 与 user 全关的技能。 */
143
+ function renderGroupedSkills(skills, statsByName, hideOff) {
144
+ const lines = [];
145
+ let hidden = 0;
146
+ const known = new Set(SCENES.map((s) => s[0]));
147
+ const groups = [...SCENES];
148
+ const extras = [...new Set(skills.map((s) => s.scenario).filter((x) => x && !known.has(x)))];
149
+ for (const e of extras) groups.push([e, e]);
150
+
151
+ for (const [scene, label] of groups) {
152
+ const inGroup = skills.filter((s) => (s.scenario ?? "other") === scene);
153
+ if (!inGroup.length) continue;
154
+ const shown = [];
155
+ for (const s of inGroup) {
156
+ if (hideOff && !s.model && !s.user) {
157
+ hidden += 1;
158
+ continue;
159
+ }
160
+ shown.push(s);
161
+ }
162
+ if (!shown.length) continue;
163
+ lines.push("--- " + label + "(" + shown.length + " 个)---");
164
+ lines.push(TABLE_HEAD);
165
+ lines.push(TABLE_RULE);
166
+ for (const s of shown) lines.push(skillRow(s, statsByName.get(s.name)));
167
+ lines.push("");
168
+ }
169
+ if (hidden > 0) {
170
+ lines.push("(另有 " + hidden + " 个 model 与 user 全关的技能已隐藏:/panel skills 查看全部)");
171
+ }
172
+ return lines;
173
+ }
174
+
175
+ /** 历史统计:按活跃度(自动+提示+关键词)排序。 */
176
+ function renderStats(stats, rounds) {
177
+ if (!stats.length) return ["--- 历史统计 ---", "(还没有门控记录)"];
178
+ const sorted = [...stats].sort(
179
+ (a, b) => b.hits + b.auto + b.hint - (a.hits + a.auto + a.hint) || a.name.localeCompare(b.name)
180
+ );
181
+ const lines = [
182
+ "--- 历史统计(" + rounds + " 轮)---",
183
+ pad("技能", 30) + pad("轮次", 7) + pad("词", 5) + pad("自动", 6) + pad("提示", 6) + "降级",
184
+ "-".repeat(30 + 7 + 5 + 6 + 6 + 4),
185
+ ];
186
+ for (const r of sorted) {
187
+ lines.push(
188
+ pad(r.name, 30) +
189
+ pad(String(r.rounds), 7) +
190
+ pad(String(r.hits), 5) +
191
+ pad(String(r.auto), 6) +
192
+ pad(String(r.hint), 6) +
193
+ String(r.degraded)
194
+ );
195
+ }
196
+ return lines;
197
+ }
198
+
199
+ /** 从未命中(关键词/自动/提示都为 0)。 */
200
+ function neverHit(skills, statsByName) {
201
+ return skills.filter((s) => {
202
+ const st = statsByName.get(s.name);
203
+ return !st || st.hits + st.auto + st.hint === 0;
204
+ });
205
+ }
206
+
207
+ function renderNever(skills, statsByName, full) {
208
+ const never = neverHit(skills, statsByName);
209
+ if (!never.length) return ["--- 从未命中 ---", "(无:每个技能都至少命中过一次)"];
210
+ if (full) {
211
+ const lines = ["--- 从未命中(" + never.length + " 个)---"];
212
+ for (const s of never) lines.push(" " + pad(s.name, 30) + (s.scenarioZh ?? s.scenario ?? ""));
213
+ return lines;
214
+ }
215
+ const preview = never.slice(0, NEVER_PREVIEW).map((s) => s.name).join(", ");
216
+ const more = never.length > NEVER_PREVIEW ? " …(共 " + never.length + " 个,/panel never 看全部)" : "";
217
+ return ["--- 从未命中(" + never.length + " 个)---", preview + more];
218
+ }
219
+
220
+ /** 解析命令参数:第一个词是视图,出现 all 则不隐藏全关。 */
221
+ export function parsePanelArgs(raw) {
222
+ const tokens = String(raw ?? "").trim().split(/\s+/).filter(Boolean);
223
+ let view = "summary";
224
+ let all = false;
225
+ for (const t of tokens) {
226
+ const low = t.toLowerCase();
227
+ if (low === "all") {
228
+ all = true;
229
+ continue;
230
+ }
231
+ if (VIEWS.includes(low)) view = low;
232
+ }
233
+ return { view, all };
234
+ }
235
+
236
+ /**
237
+ * 渲染面板文本。
238
+ * options: { root?, auditPath?, view?, all? }
239
+ */
240
+ export function renderSkillsPanel(options) {
241
+ const matrix = loadMatrix(options?.root);
242
+ const auditPath = options?.auditPath ?? defaultAuditPathSafe();
243
+ const view = options?.view ?? "summary";
244
+ const all = options?.all === true;
245
+
246
+ if (!matrix || !Array.isArray(matrix.skills)) {
247
+ return "技能面板:读不到 assets/skills.matrix.json,无法渲染。";
248
+ }
249
+ const skills = matrix.skills;
250
+ const c = countSwitches(skills);
251
+
252
+ const replay = readAuditEntries(auditPath, { limit: REPLAY_MAX });
253
+ const history = replay.entries.filter((e) => e && e.kind === "skillgate-round");
254
+ const stats = aggregateStats(history);
255
+ const statsByName = new Map(stats.map((r) => [r.name, r]));
256
+
257
+ let live = [];
258
+ try {
259
+ live = getAuditChannel().entries() ?? [];
260
+ } catch {
261
+ live = [];
262
+ }
263
+
264
+ const auditState = replay.missing ? "未生成(gate 未启用或还没跑过一轮)" : history.length + " 轮";
265
+
266
+ const header = [
267
+ "=== 技能面板(lean-router)===",
268
+ "技能 " + c.total + " · model 开 " + c.model + " · user 开 " + c.user + " · 全关 " + c.off,
269
+ "门控:已启用 · 历史审计 " + auditState,
270
+ "审计文件:" + auditPath,
271
+ "",
272
+ ];
273
+
274
+ let body;
275
+ if (view === "round") {
276
+ body = renderCurrentRound(live, true);
277
+ } else if (view === "skills") {
278
+ body = renderGroupedSkills(skills, statsByName, false);
279
+ } else if (view === "stats") {
280
+ body = renderStats(stats, history.length);
281
+ } else if (view === "never") {
282
+ body = renderNever(skills, statsByName, true);
283
+ } else {
284
+ body = [
285
+ ...renderCurrentRound(live, false),
286
+ "",
287
+ ...renderGroupedSkills(skills, statsByName, !all),
288
+ ...renderNever(skills, statsByName, false),
289
+ ];
290
+ }
291
+
292
+ return [...header, ...body].join("\n").replace(/\n+$/, "");
293
+ }
294
+
295
+ function defaultAuditPathSafe() {
296
+ try {
297
+ return defaultAuditPath();
298
+ } catch {
299
+ return "(未知路径)";
300
+ }
301
+ }
302
+
303
+ /** 命令入口:/panel [summary|skills|round|stats|never] [all] */
304
+ export async function executeSkillsPanelCommand(invocation, context) {
305
+ try {
306
+ const { view, all } = parsePanelArgs(invocation?.rawInput ?? "");
307
+ return {
308
+ kind: "success",
309
+ text: renderSkillsPanel({
310
+ root: context?.root,
311
+ auditPath: context?.auditPath ?? defaultAuditPathSafe(),
312
+ view,
313
+ all,
314
+ }),
315
+ };
316
+ } catch (error) {
317
+ return {
318
+ kind: "error",
319
+ text: "技能面板渲染失败:" + (error instanceof Error ? error.message : String(error)),
320
+ };
321
+ }
322
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-lean-router",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "lean 省 token × 思考链路由 × code_run 工具遮蔽 × mattpocock 技能自动调用的 DSH cordis 插件(单 bundle:预设+配套技能)",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -10,7 +10,10 @@
10
10
  "./router": "./lib/router.js",
11
11
  "./toolface": "./lib/toolface/index.js",
12
12
  "./lean/delivery-gate": "./lib/lean/delivery-gate.js",
13
- "./lean/tool-concurrency": "./lib/lean/tool-concurrency.js"
13
+ "./lean/tool-concurrency": "./lib/lean/tool-concurrency.js",
14
+ "./client": {
15
+ "default": "./lib/client.js"
16
+ }
14
17
  },
15
18
  "files": [
16
19
  "lib",
@@ -34,7 +37,7 @@
34
37
  "url": "git+https://github.com/ShawnSun-Debug/dsh-lean-router.git"
35
38
  },
36
39
  "engines": {
37
- "dsh": ">=0.2.1-rc.5 <0.2.3-0"
40
+ "dsh": ">=0.2.1-rc.5 <0.2.4-0"
38
41
  },
39
42
  "scripts": {
40
43
  "test": "node --test \"test/*.test.mjs\"",
@@ -46,6 +49,9 @@
46
49
  "dsh": {
47
50
  "bundle": {
48
51
  "patch": "./cordis.patch.yml"
52
+ },
53
+ "client": {
54
+ "platform": "web"
49
55
  }
50
56
  },
51
57
  "keywords": [
@@ -57,10 +63,10 @@
57
63
  "skills"
58
64
  ],
59
65
  "dependencies": {
60
- "@deepseek-ai/dsh-tool-executor-native": "^0.2.2-alpha.3"
66
+ "@deepseek-ai/dsh-tool-executor-native": ">=0.2.2-alpha.3 <0.2.4-0"
61
67
  },
62
68
  "peerDependencies": {
63
- "@deepseek-ai/cordis": "~4.1.0"
69
+ "@deepseek-ai/cordis": ">=4.1.0-0 <4.3.0-0"
64
70
  },
65
71
  "devDependencies": {
66
72
  "js-yaml": "^4.1.0"
@@ -4,12 +4,20 @@
4
4
  # 入口子路径 dsh-lean-router/router 需要 package.json exports 增补 "./router": "./lib/router.js"
5
5
  # (package.json 为共享文件,由 master 统一集成;见 lib/router.js ROUTER_INJECTION_NOTES.patchEntry)
6
6
  - insert:
7
+ # 1.0.5 修:宿主层裸包名行(对照 dsh-cost-meter 的 "one host row")。
8
+ # 没有这一行,客户端模块扫描看不到 dsh.client -> 客户端 bundle 不加载 -> 无顶栏按钮。
9
+ # config.provider=false:不重复注册 skill provider(预设层已注册)。
10
+ - id: lean-router-client-host
11
+ name: dsh-lean-router
7
12
  - id: lean-router-router
8
13
  name: dsh-lean-router/router
9
14
  config:
10
15
  hooks: true
11
16
  commands: false
12
17
  diligenceEvery: 10
18
+ # 1.0.5 修:每轮门控必须开,否则 skillgate 不跑 -> 审计零条目、审计文件从不生成。
19
+ # 依据 lib/router.js:345(cfg.hooks && cfg.gate 才建 runner)与 lib/router.js:194。
20
+ gate: true
13
21
  - id: lean-router-commands
14
22
  name: dsh-lean-router/router
15
23
  config:
@@ -13,6 +13,8 @@ test("package.json 骨架字段", async () => {
13
13
  assert.equal(pkg.license, "MIT");
14
14
  assert.equal(pkg.type, "module");
15
15
  assert.equal(pkg.main, "lib/index.js");
16
- assert.equal(pkg.engines.dsh, ">=0.2.1-rc.5 <0.2.3-0");
16
+ // 上限 <0.2.4-0:DSH 用 semver.satisfies(..., { includePrerelease: true }) 校验,
17
+ // 旧的 <0.2.3-0 会把 0.2.3-alpha.2 判为不兼容并拦截激活。
18
+ assert.equal(pkg.engines.dsh, ">=0.2.1-rc.5 <0.2.4-0");
17
19
  assert.equal(pkg.dsh.bundle.patch, "./cordis.patch.yml");
18
20
  });
@@ -185,7 +185,11 @@ test("/band:显示/改档/auto 回退/非法值报错", async () => {
185
185
  // 无参显示
186
186
  const shown = band.handler({ agent: agentA, rawInput: "" });
187
187
  assert.equal(shown.kind, "success");
188
- assert.ok(shown.text.includes("auto (unset"));
188
+ assert.ok(shown.text.includes("▲ auto"), "第一行必须是一行状态");
189
+ assert.ok(shown.text.includes("| 档位 |"), "三带差异必须用表格展示");
190
+ assert.ok(shown.text.includes("最近一次自动分类:暂无"), "没有用户消息时给出明确说明");
191
+ assert.ok(shown.text.includes("下一条消息自动分类"), "未分类时来源说明为自动");
192
+ assert.ok(shown.text.includes("**▲ auto**"), "当前档位在表格里用 ▲ 粗体标记");
189
193
  // 改档
190
194
  const set = band.handler({ agent: agentA, rawInput: "react task = 发布 MVP" });
191
195
  assert.equal(set.kind, "success");
@@ -0,0 +1,114 @@
1
+ // 技能面板(命令输出形态)的单元测试:断言结构与关键事实,不锁死排版细节。
2
+ import { test } from "node:test";
3
+ import assert from "node:assert/strict";
4
+ import { mkdtempSync, writeFileSync } from "node:fs";
5
+ import { tmpdir } from "node:os";
6
+ import { join } from "node:path";
7
+ import {
8
+ renderSkillsPanel,
9
+ loadMatrix,
10
+ parsePanelArgs,
11
+ executeSkillsPanelCommand,
12
+ displayWidth,
13
+ } from "../lib/skills-panel.js";
14
+
15
+ function tmpAudit(lines) {
16
+ const dir = mkdtempSync(join(tmpdir(), "lean-router-panel-"));
17
+ const p = join(dir, "audit.jsonl");
18
+ writeFileSync(p, lines.map((l) => JSON.stringify(l)).join("\n") + "\n", "utf8");
19
+ return p;
20
+ }
21
+
22
+ const MISSING = () => join(tmpdir(), "missing-" + Date.now() + "-" + Math.random() + ".jsonl");
23
+
24
+ function roundEntry(over) {
25
+ return {
26
+ seq: 1,
27
+ v: 1,
28
+ kind: "skillgate-round",
29
+ turn: 1,
30
+ band: "react",
31
+ scores: [
32
+ { name: "code-review", score: 3, signals: { category: { scene: "engineering", points: 2 }, keywords: [] } },
33
+ { name: "tdd", score: 1, signals: { category: { scene: "engineering", points: 1 }, keywords: [] } },
34
+ ],
35
+ decision: { auto: ["code-review"], hint: [], degradations: [] },
36
+ config: { tokenBudget: 8000, charsPerToken: 4 },
37
+ ...over,
38
+ };
39
+ }
40
+
41
+ test("loadMatrix 读到 31 个技能", () => {
42
+ const m = loadMatrix();
43
+ assert.ok(m && Array.isArray(m.skills));
44
+ assert.equal(m.skills.length, 31);
45
+ });
46
+
47
+ test("总览包含四类信息", () => {
48
+ const text = renderSkillsPanel({ auditPath: MISSING() });
49
+ assert.match(text, /=== 技能面板/);
50
+ assert.match(text, /技能 31/);
51
+ assert.match(text, /--- 本轮 ---/);
52
+ assert.match(text, /--- 工程(/);
53
+ assert.match(text, /--- 从未命中/);
54
+ });
55
+
56
+ test("按场景分组:工程与流程两组都在", () => {
57
+ const text = renderSkillsPanel({ auditPath: MISSING(), view: "skills" });
58
+ assert.match(text, /--- 工程(/);
59
+ assert.match(text, /--- 流程(/);
60
+ assert.match(text, /--- 元交互(/);
61
+ });
62
+
63
+ test("技能名列不被最长名字撑破(表头与分隔线对齐)", () => {
64
+ const text = renderSkillsPanel({ auditPath: MISSING(), view: "skills" });
65
+ const lines = text.split("\n");
66
+ const i = lines.findIndex((l) => l.includes("自动") && l.includes("提示") && l.startsWith("技能"));
67
+ assert.ok(i >= 0, "应有表头行");
68
+ const rule = lines[i + 1];
69
+ assert.equal(displayWidth(lines[i]), displayWidth(rule), "表头与分隔线显示宽度应一致");
70
+ const row = lines.find((l) => l.startsWith("improve-codebase-architecture"));
71
+ assert.ok(row, "最长技能名应有行");
72
+ assert.ok(
73
+ displayWidth(row) <= displayWidth(rule),
74
+ "最长技能名那一行不应超出分隔线(名字列宽度够用)"
75
+ );
76
+ assert.ok(displayWidth(row) >= displayWidth(rule) - 4, "该行也不应明显短于分隔线");
77
+ });
78
+
79
+ test("审计缺失时降级而不抛错", () => {
80
+ const text = renderSkillsPanel({ auditPath: MISSING() });
81
+ assert.match(text, /未生成/);
82
+ });
83
+
84
+ test("历史统计按技能聚合", () => {
85
+ const text = renderSkillsPanel({ auditPath: tmpAudit([roundEntry({})]) });
86
+ assert.match(text, /1 轮/);
87
+ const row = text.split("\n").find((l) => l.startsWith("code-review"));
88
+ assert.ok(row);
89
+ });
90
+
91
+ test("stats 视图含轮次/自动/提示列", () => {
92
+ const text = renderSkillsPanel({ auditPath: tmpAudit([roundEntry({})]), view: "stats" });
93
+ assert.match(text, /--- 历史统计(1 轮)---/);
94
+ assert.match(text, /轮次/);
95
+ });
96
+
97
+ test("round 视图给得分构成", () => {
98
+ const text = renderSkillsPanel({ auditPath: MISSING(), view: "round" });
99
+ assert.match(text, /尚无门控记录/);
100
+ });
101
+
102
+ test("parsePanelArgs 解析视图与 all", () => {
103
+ assert.deepEqual(parsePanelArgs(""), { view: "summary", all: false });
104
+ assert.deepEqual(parsePanelArgs("skills"), { view: "skills", all: false });
105
+ assert.deepEqual(parsePanelArgs("all"), { view: "summary", all: true });
106
+ assert.deepEqual(parsePanelArgs(" stats ALL "), { view: "stats", all: true });
107
+ assert.deepEqual(parsePanelArgs("bogus"), { view: "summary", all: false });
108
+ });
109
+
110
+ test("命令入口返回 success", async () => {
111
+ const out = await executeSkillsPanelCommand({ rawInput: "" }, { auditPath: MISSING() });
112
+ assert.equal(out.kind, "success");
113
+ assert.match(out.text, /技能面板/);
114
+ });