dsh-lean-router 1.1.0 → 2.0.0
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/NOTICE.md +2 -4
- package/README.en.md +47 -43
- package/README.md +45 -41
- package/cordis.patch.yml +4 -26
- package/docs/agents/domain.md +1 -1
- package/docs/architecture.en.md +51 -86
- package/docs/architecture.md +46 -77
- package/docs/changelog.en.md +24 -1
- package/docs/changelog.md +24 -1
- package/docs/configuration.en.md +25 -56
- package/docs/configuration.md +14 -45
- package/docs/install.en.md +2 -2
- package/docs/install.md +2 -2
- package/docs/quickstart.en.md +29 -34
- package/docs/quickstart.md +11 -16
- package/docs/release-checklist.en.md +3 -4
- package/docs/release-checklist.md +5 -6
- package/docs//350/267/257/347/224/261-/350/256/276/350/256/241/350/257/264/346/230/216.md +2 -2
- package/lib/index.js +9 -61
- package/lib/router.js +15 -148
- package/package.json +4 -15
- package/presets/base/frag-lean.patch.yml +1 -5
- package/presets/base/frag-preset.patch.yml +1 -3
- package/presets/base/frag-router.patch.yml +1 -12
- package/presets/base/frag-toolface.patch.yml +0 -2
- package/presets/base/lean-router.patch.yml +1 -4
- package/scripts/doctor.mjs +15 -10
- package/test/integration-preset.test.mjs +4 -3
- package/test/plugin-entry.test.mjs +15 -50
- package/test/router.test.mjs +7 -47
- package/assets/gating.weights.json +0 -13
- package/assets/skills/ask-matt/PHASE-BOUNDARIES.md +0 -55
- package/assets/skills/ask-matt/SKILL.md +0 -80
- package/assets/skills/ask-matt/agents/openai.yaml +0 -5
- package/assets/skills/chief-of-staff/SKILL.md +0 -76
- package/assets/skills/chief-of-staff/agents/openai.yaml +0 -5
- package/assets/skills/code-review/SKILL.md +0 -91
- package/assets/skills/code-review/agents/openai.yaml +0 -5
- package/assets/skills/codebase-design/DEEPENING.md +0 -37
- package/assets/skills/codebase-design/DESIGN-IT-TWICE.md +0 -44
- package/assets/skills/codebase-design/SKILL.md +0 -116
- package/assets/skills/codebase-design/agents/openai.yaml +0 -5
- package/assets/skills/diagnosing-bugs/SKILL.md +0 -140
- package/assets/skills/diagnosing-bugs/agents/openai.yaml +0 -5
- package/assets/skills/diagnosing-bugs/scripts/hitl-loop.template.sh +0 -44
- package/assets/skills/domain-modeling/ADR-FORMAT.md +0 -47
- package/assets/skills/domain-modeling/GLOSSARY-FORMAT.md +0 -60
- package/assets/skills/domain-modeling/SKILL.md +0 -76
- package/assets/skills/domain-modeling/agents/openai.yaml +0 -5
- package/assets/skills/grilling/SKILL.md +0 -52
- package/assets/skills/grilling/agents/openai.yaml +0 -5
- package/assets/skills/handoff/SKILL.md +0 -17
- package/assets/skills/handoff/agents/openai.yaml +0 -5
- package/assets/skills/implement/SKILL.md +0 -55
- package/assets/skills/implement/agents/openai.yaml +0 -5
- package/assets/skills/improve-codebase-architecture/HTML-REPORT.md +0 -123
- package/assets/skills/improve-codebase-architecture/SKILL.md +0 -72
- package/assets/skills/improve-codebase-architecture/agents/openai.yaml +0 -5
- package/assets/skills/loop-me/SKILL.md +0 -33
- package/assets/skills/loop-me/agents/openai.yaml +0 -5
- package/assets/skills/pr/CREDITS.md +0 -3
- package/assets/skills/pr/SKILL.md +0 -172
- package/assets/skills/pr/agents/openai.yaml +0 -5
- package/assets/skills/prototype/LOGIC.md +0 -67
- package/assets/skills/prototype/SKILL.md +0 -28
- package/assets/skills/prototype/UI.md +0 -112
- package/assets/skills/prototype/agents/openai.yaml +0 -5
- package/assets/skills/research/SKILL.md +0 -14
- package/assets/skills/research/agents/openai.yaml +0 -5
- package/assets/skills/retro/SKILL.md +0 -45
- package/assets/skills/retro/agents/openai.yaml +0 -5
- package/assets/skills/setup-matt-pocock-skills/SKILL.md +0 -121
- package/assets/skills/setup-matt-pocock-skills/agents/openai.yaml +0 -5
- package/assets/skills/setup-matt-pocock-skills/domain.md +0 -51
- package/assets/skills/setup-matt-pocock-skills/issue-tracker-github.md +0 -50
- package/assets/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md +0 -46
- package/assets/skills/setup-matt-pocock-skills/issue-tracker-local.md +0 -30
- package/assets/skills/setup-matt-pocock-skills/triage-labels.md +0 -15
- package/assets/skills/setup-ts-deep-modules/SKILL.md +0 -103
- package/assets/skills/setup-ts-deep-modules/agents/openai.yaml +0 -5
- package/assets/skills/setup-ts-deep-modules/dependency-cruiser.config.cjs +0 -95
- package/assets/skills/software-factory/EXAMPLE-TASKS.md +0 -80
- package/assets/skills/software-factory/GIT-HOSTS.md +0 -84
- package/assets/skills/software-factory/OBSERVABILITY-PLATFORMS.md +0 -75
- package/assets/skills/software-factory/RUNNERS.md +0 -94
- package/assets/skills/software-factory/SKILL.md +0 -99
- package/assets/skills/software-factory/TICKET-TRACKERS.md +0 -85
- package/assets/skills/tdd/SKILL.md +0 -40
- package/assets/skills/tdd/agents/openai.yaml +0 -5
- package/assets/skills/tdd/mocking.md +0 -59
- package/assets/skills/tdd/tests.md +0 -77
- package/assets/skills/teach/GLOSSARY-FORMAT.md +0 -35
- package/assets/skills/teach/LEARNING-RECORD-FORMAT.md +0 -46
- package/assets/skills/teach/MISSION-FORMAT.md +0 -31
- package/assets/skills/teach/RESOURCES-FORMAT.md +0 -32
- package/assets/skills/teach/SKILL.md +0 -141
- package/assets/skills/teach/agents/openai.yaml +0 -5
- package/assets/skills/to-questionnaire/SKILL.md +0 -55
- package/assets/skills/to-questionnaire/agents/openai.yaml +0 -5
- package/assets/skills/to-spec/SKILL.md +0 -76
- package/assets/skills/to-spec/agents/openai.yaml +0 -5
- package/assets/skills/to-tickets/SKILL.md +0 -106
- package/assets/skills/to-tickets/agents/openai.yaml +0 -5
- package/assets/skills/triage/AGENT-BRIEF.md +0 -207
- package/assets/skills/triage/OUT-OF-SCOPE.md +0 -105
- package/assets/skills/triage/SKILL.md +0 -113
- package/assets/skills/triage/agents/openai.yaml +0 -5
- package/assets/skills/wait-what/SKILL.md +0 -8
- package/assets/skills/wait-what/agents/openai.yaml +0 -5
- package/assets/skills/wayfinder/SKILL.md +0 -129
- package/assets/skills/wayfinder/agents/openai.yaml +0 -5
- package/assets/skills/wizard/SKILL.md +0 -46
- package/assets/skills/wizard/agents/openai.yaml +0 -5
- package/assets/skills/wizard/template.sh +0 -223
- package/assets/skills/writing-beats/SKILL.md +0 -44
- package/assets/skills/writing-beats/agents/openai.yaml +0 -5
- package/assets/skills/writing-for-agents/SKILL-MECHANICS.md +0 -22
- package/assets/skills/writing-for-agents/SKILL.md +0 -83
- package/assets/skills/writing-for-agents/agents/openai.yaml +0 -5
- package/assets/skills/writing-fragments/SKILL.md +0 -80
- package/assets/skills/writing-fragments/agents/openai.yaml +0 -5
- package/assets/skills/writing-shape/SKILL.md +0 -59
- package/assets/skills/writing-shape/agents/openai.yaml +0 -5
- package/assets/skills.matrix.json +0 -311
- package/docs/HANDOFF-2026-11-22.md +0 -155
- package/docs/matrix.en.md +0 -57
- package/docs/matrix.md +0 -57
- package/docs//346/212/200/350/203/275/351/227/250/346/216/247-/350/256/276/350/256/241/350/257/264/346/230/216.md +0 -134
- package/docs//351/235/242/346/235/277-/350/256/276/350/256/241/350/257/264/346/230/216.md +0 -205
- package/lib/audit-commands.js +0 -289
- package/lib/audit-sink.js +0 -137
- package/lib/client.js +0 -203
- package/lib/gate-runner.js +0 -179
- package/lib/skill-provider.js +0 -167
- package/lib/skillgate.js +0 -396
- package/lib/skills-panel.js +0 -322
- package/scripts/check-drift.mjs +0 -24
- package/skills.manifest.json +0 -287
- package/test/audit-commands.test.mjs +0 -325
- package/test/audit-sink.test.mjs +0 -150
- package/test/client-plugin.test.mjs +0 -117
- package/test/gate-run.test.mjs +0 -173
- package/test/manifest.test.mjs +0 -25
- package/test/provider.test.mjs +0 -21
- package/test/skillgate-provider.test.mjs +0 -122
- package/test/skillgate.test.mjs +0 -217
- package/test/skills-panel.test.mjs +0 -114
- package/ui/go.json +0 -19
package/lib/skills-panel.js
DELETED
|
@@ -1,322 +0,0 @@
|
|
|
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/scripts/check-drift.mjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// dsh-lean-router - 副本漂移检查(票 02;仅 warn)
|
|
2
|
-
import { readdir, readFile } from "node:fs/promises";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import { homedir } from "node:os";
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
6
|
-
|
|
7
|
-
const ROOT = fileURLToPath(new URL("..", import.meta.url));
|
|
8
|
-
|
|
9
|
-
export async function drift() {
|
|
10
|
-
const userDir = join(homedir(), ".dsh", "skills");
|
|
11
|
-
const entries = await readdir(join(ROOT, "assets", "skills"), { withFileTypes: true });
|
|
12
|
-
let diffs = 0;
|
|
13
|
-
for (const e of entries) {
|
|
14
|
-
if (!e.isDirectory()) continue;
|
|
15
|
-
const local = await readFile(join(ROOT, "assets", "skills", e.name, "SKILL.md"), "utf8").catch(() => null);
|
|
16
|
-
const remote = await readFile(join(userDir, e.name, "SKILL.md"), "utf8").catch(() => null);
|
|
17
|
-
if (local !== remote) { diffs++; console.log("[drift] " + e.name + (remote ? " 与 ~/.dsh/skills 不一致" : " 上游缺失")); }
|
|
18
|
-
}
|
|
19
|
-
console.log(diffs === 0 ? "[check-drift] 无漂移" : "[check-drift] " + diffs + " 个差异(warn-only)");
|
|
20
|
-
return diffs;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const isMain = process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1];
|
|
24
|
-
if (isMain) await drift();
|
package/skills.manifest.json
DELETED
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"_meta": {
|
|
3
|
-
"generated_at": "2026-11-20T13:28:52.279Z",
|
|
4
|
-
"count": 31
|
|
5
|
-
},
|
|
6
|
-
"skills": [
|
|
7
|
-
{
|
|
8
|
-
"name": "ask-matt",
|
|
9
|
-
"description": "Ask which /command fits your situation. A router over the installed skills, all of which are invoked by the user, never by the model.",
|
|
10
|
-
"dir": "ask-matt",
|
|
11
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
12
|
-
"model": false,
|
|
13
|
-
"user": true,
|
|
14
|
-
"scenario": "meta"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"name": "chief-of-staff",
|
|
18
|
-
"description": "Pursue a long-running goal in a single session by co-ordinating subagents.",
|
|
19
|
-
"dir": "chief-of-staff",
|
|
20
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
21
|
-
"model": true,
|
|
22
|
-
"user": true,
|
|
23
|
-
"scenario": "process"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"name": "code-review",
|
|
27
|
-
"description": "Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/spec asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to \\\"review since X\\\".",
|
|
28
|
-
"dir": "code-review",
|
|
29
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
30
|
-
"model": true,
|
|
31
|
-
"user": true,
|
|
32
|
-
"scenario": "engineering"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"name": "codebase-design",
|
|
36
|
-
"description": "Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.",
|
|
37
|
-
"dir": "codebase-design",
|
|
38
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
39
|
-
"model": true,
|
|
40
|
-
"user": true,
|
|
41
|
-
"scenario": "engineering"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"name": "diagnosing-bugs",
|
|
45
|
-
"description": "Diagnosis loop for hard bugs and performance regressions. Use when the user says \"diagnose\"/\"debug this\", or reports something broken/throwing/failing/slow.",
|
|
46
|
-
"dir": "diagnosing-bugs",
|
|
47
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
48
|
-
"model": true,
|
|
49
|
-
"user": false,
|
|
50
|
-
"scenario": "engineering"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"name": "domain-modeling",
|
|
54
|
-
"description": "Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.",
|
|
55
|
-
"dir": "domain-modeling",
|
|
56
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
57
|
-
"model": true,
|
|
58
|
-
"user": false,
|
|
59
|
-
"scenario": "engineering"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"name": "grilling",
|
|
63
|
-
"description": "Grill the user relentlessly about a plan, decision, or idea until you share an understanding. Use when the user wants to stress-test their thinking, or says \"grill\". With --docs it also writes ADRs and GLOSSARY.md as decisions land.",
|
|
64
|
-
"dir": "grilling",
|
|
65
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
66
|
-
"model": false,
|
|
67
|
-
"user": true,
|
|
68
|
-
"scenario": "meta"
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
"name": "handoff",
|
|
72
|
-
"description": "Compact the current conversation into a handoff document for another agent to pick up.",
|
|
73
|
-
"dir": "handoff",
|
|
74
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
75
|
-
"model": true,
|
|
76
|
-
"user": true,
|
|
77
|
-
"scenario": "process"
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"name": "implement",
|
|
81
|
-
"description": "Implement a piece of work from a spec plus its tickets, or a single ticket. Drives tdd per ticket, lands everything on one integration branch, closes with code-review.",
|
|
82
|
-
"dir": "implement",
|
|
83
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
84
|
-
"model": true,
|
|
85
|
-
"user": true,
|
|
86
|
-
"scenario": "engineering"
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
"name": "improve-codebase-architecture",
|
|
90
|
-
"description": "Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.",
|
|
91
|
-
"dir": "improve-codebase-architecture",
|
|
92
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
93
|
-
"model": true,
|
|
94
|
-
"user": true,
|
|
95
|
-
"scenario": "engineering"
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
"name": "loop-me",
|
|
99
|
-
"description": "Grill me about specs for the workflows I want to build, within this workspace.",
|
|
100
|
-
"dir": "loop-me",
|
|
101
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
102
|
-
"model": false,
|
|
103
|
-
"user": true,
|
|
104
|
-
"scenario": "meta"
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
"name": "pr",
|
|
108
|
-
"description": "Use when writing a PR body.",
|
|
109
|
-
"dir": "pr",
|
|
110
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
111
|
-
"model": true,
|
|
112
|
-
"user": true,
|
|
113
|
-
"scenario": "process"
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
"name": "prototype",
|
|
117
|
-
"description": "Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.",
|
|
118
|
-
"dir": "prototype",
|
|
119
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
120
|
-
"model": false,
|
|
121
|
-
"user": true,
|
|
122
|
-
"scenario": "engineering"
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
"name": "research",
|
|
126
|
-
"description": "Investigate a question against high-trust primary sources and capture the findings as a Markdown file in the repo. Use when the user wants a topic researched, docs or API facts gathered, or reading legwork delegated to a background agent.",
|
|
127
|
-
"dir": "research",
|
|
128
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
129
|
-
"model": true,
|
|
130
|
-
"user": true,
|
|
131
|
-
"scenario": "research"
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
"name": "retro",
|
|
135
|
-
"description": "Conduct a retrospective on a coding session.",
|
|
136
|
-
"dir": "retro",
|
|
137
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
138
|
-
"model": false,
|
|
139
|
-
"user": true,
|
|
140
|
-
"scenario": "process"
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
"name": "setup-matt-pocock-skills",
|
|
144
|
-
"description": "Configure this repo for the engineering skills: set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills.",
|
|
145
|
-
"dir": "setup-matt-pocock-skills",
|
|
146
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
147
|
-
"model": true,
|
|
148
|
-
"user": false,
|
|
149
|
-
"scenario": "setup"
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
"name": "setup-ts-deep-modules",
|
|
153
|
-
"description": "Wire dependency-cruiser into a TypeScript repo so each package is a deep module, with implementation hidden in subfolders and reachable only through its entry-point files. User-invoked.",
|
|
154
|
-
"dir": "setup-ts-deep-modules",
|
|
155
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
156
|
-
"model": true,
|
|
157
|
-
"user": false,
|
|
158
|
-
"scenario": "engineering"
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
"name": "software-factory",
|
|
162
|
-
"description": "Shared language for designing a software factory: the tasks it runs and the services it plugs into.",
|
|
163
|
-
"dir": "software-factory",
|
|
164
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
165
|
-
"model": true,
|
|
166
|
-
"user": false,
|
|
167
|
-
"scenario": "process"
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
"name": "tdd",
|
|
171
|
-
"description": "Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions \"red-green-refactor\", or wants integration tests.",
|
|
172
|
-
"dir": "tdd",
|
|
173
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
174
|
-
"model": true,
|
|
175
|
-
"user": false,
|
|
176
|
-
"scenario": "engineering"
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
"name": "teach",
|
|
180
|
-
"description": "Teach the user a new skill or concept, within this workspace.",
|
|
181
|
-
"dir": "teach",
|
|
182
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
183
|
-
"model": false,
|
|
184
|
-
"user": true,
|
|
185
|
-
"scenario": "teaching"
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
"name": "to-questionnaire",
|
|
189
|
-
"description": "Turn a decision you can't fully answer into a questionnaire for someone else to fill in.",
|
|
190
|
-
"dir": "to-questionnaire",
|
|
191
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
192
|
-
"model": true,
|
|
193
|
-
"user": false,
|
|
194
|
-
"scenario": "process"
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
"name": "to-spec",
|
|
198
|
-
"description": "Turn the current conversation into a spec and publish it to the project issue tracker: no interview, just synthesis of what you've already discussed.",
|
|
199
|
-
"dir": "to-spec",
|
|
200
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
201
|
-
"model": true,
|
|
202
|
-
"user": true,
|
|
203
|
-
"scenario": "process"
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
"name": "to-tickets",
|
|
207
|
-
"description": "Break a plan, spec, or the current conversation into a set of tracer-bullet tickets, each declaring its blocking edges, published to the configured tracker (edges as text in one file per ticket locally, or native blocking links on a real tracker).",
|
|
208
|
-
"dir": "to-tickets",
|
|
209
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
210
|
-
"model": true,
|
|
211
|
-
"user": true,
|
|
212
|
-
"scenario": "process"
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
"name": "triage",
|
|
216
|
-
"description": "Move issues and external PRs through a state machine of triage roles, categorise, verify, grill if needed, and write agent-ready briefs.",
|
|
217
|
-
"dir": "triage",
|
|
218
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
219
|
-
"model": true,
|
|
220
|
-
"user": true,
|
|
221
|
-
"scenario": "process"
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
"name": "wait-what",
|
|
225
|
-
"description": "Stop. That last message did not land: re-pitch it.",
|
|
226
|
-
"dir": "wait-what",
|
|
227
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
228
|
-
"model": false,
|
|
229
|
-
"user": true,
|
|
230
|
-
"scenario": "meta"
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
"name": "wayfinder",
|
|
234
|
-
"description": "Plan a huge chunk of work (more than one agent session can hold) as a shared map of decision tickets on your issue tracker, and resolve them one at a time until the way to the destination is clear.",
|
|
235
|
-
"dir": "wayfinder",
|
|
236
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
237
|
-
"model": true,
|
|
238
|
-
"user": true,
|
|
239
|
-
"scenario": "process"
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
"name": "wizard",
|
|
243
|
-
"description": "Generate an interactive bash wizard that walks a human through steps only they can perform. Use when provisioning infrastructure, setting up credentials or CI secrets, walking an unfamiliar third-party dashboard, or running a one-off migration or cutover. Don't invoke this for steps the agent can perform itself.",
|
|
244
|
-
"dir": "wizard",
|
|
245
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
246
|
-
"model": false,
|
|
247
|
-
"user": true,
|
|
248
|
-
"scenario": "process"
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
"name": "writing-beats",
|
|
252
|
-
"description": "Writing, exploit; assemble raw material into a journey of beats, grounding each term before a beat leans on it.",
|
|
253
|
-
"dir": "writing-beats",
|
|
254
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
255
|
-
"model": true,
|
|
256
|
-
"user": true,
|
|
257
|
-
"scenario": "writing"
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
"name": "writing-for-agents",
|
|
261
|
-
"description": "Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.",
|
|
262
|
-
"dir": "writing-for-agents",
|
|
263
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
264
|
-
"model": true,
|
|
265
|
-
"user": false,
|
|
266
|
-
"scenario": "writing"
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
"name": "writing-fragments",
|
|
270
|
-
"description": "Writing, explore: mine raw fragments, no structure yet.",
|
|
271
|
-
"dir": "writing-fragments",
|
|
272
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
273
|
-
"model": true,
|
|
274
|
-
"user": false,
|
|
275
|
-
"scenario": "writing"
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
"name": "writing-shape",
|
|
279
|
-
"description": "Writing, exploit: shape raw material into an article, paragraph by paragraph.",
|
|
280
|
-
"dir": "writing-shape",
|
|
281
|
-
"source": "mattpocock skills (vendored fallback)",
|
|
282
|
-
"model": true,
|
|
283
|
-
"user": false,
|
|
284
|
-
"scenario": "writing"
|
|
285
|
-
}
|
|
286
|
-
]
|
|
287
|
-
}
|