holy-agents-kits 0.3.3 → 0.5.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/README.md +50 -2
- package/bin/cli.js +4 -1
- package/package.json +6 -2
- package/skills/human-docs/SKILL.md +123 -0
- package/skills/human-docs/references/agent-notes.md +37 -0
- package/skills/knowledge-surface/SKILL.md +68 -0
- package/skills/knowledge-surface/assets/viewer.html +401 -0
- package/skills/knowledge-surface/references/INDEX.md +9 -0
- package/skills/knowledge-surface/references/disclosure-and-style.md +78 -0
- package/skills/knowledge-surface/references/parsing.md +100 -0
- package/skills/knowledge-surface/references/qa.md +71 -0
- package/skills/knowledge-surface/references/relations.md +82 -0
- package/skills/knowledge-surface/references/rendering.md +101 -0
- package/skills/knowledge-surface/scripts/README.md +23 -0
- package/skills/knowledge-surface/scripts/build_surface.mjs +619 -0
- package/skills/rules-layer-governance/SKILL.md +58 -0
- package/skills/rules-layer-governance/references/gate-authoring.md +156 -0
- package/skills/rules-layer-governance/references/legislation-protocol.md +120 -0
- package/skills/rules-layer-governance/references/verification.md +116 -0
- package/skills/rules-layer-governance/templates/check-dead-refs.sh +131 -0
- package/skills/rules-layer-governance/templates/gate-script.sh +94 -0
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>知识表面</title>
|
|
7
|
+
<style>
|
|
8
|
+
:root {
|
|
9
|
+
--bg:#0F172A; --panel:#1B2336; --muted-bg:#272F42; --line:#475569;
|
|
10
|
+
--fg:#F8FAFC; --dim:#94A3B8; --accent:#22C55E; --gold:#F59E0B; --bad:#EF4444; --link:#5B9DFF;
|
|
11
|
+
}
|
|
12
|
+
* { box-sizing:border-box; margin:0; }
|
|
13
|
+
html,body { height:100%; }
|
|
14
|
+
body { background:var(--bg); color:var(--fg); font:14px/1.6 "IBM Plex Sans","Segoe UI",system-ui,"Microsoft YaHei",sans-serif; overflow:hidden; }
|
|
15
|
+
#topbar { display:flex; align-items:center; gap:12px; padding:10px 16px; border-bottom:1px solid var(--line); background:var(--panel); }
|
|
16
|
+
#topbar h1 { font-size:16px; font-weight:600; white-space:nowrap; }
|
|
17
|
+
#search { flex:0 1 320px; background:#111A2E; border:1px solid var(--line); border-radius:8px; color:var(--fg); padding:7px 12px; font:inherit; }
|
|
18
|
+
#search:focus { outline:1px solid var(--accent); }
|
|
19
|
+
#hitcount, #scale { color:var(--dim); font-size:12px; white-space:nowrap; }
|
|
20
|
+
button.tb { background:transparent; color:var(--dim); border:1px solid var(--line); border-radius:8px; padding:6px 12px; cursor:pointer; font-size:12px; white-space:nowrap; }
|
|
21
|
+
button.tb:hover { color:var(--fg); border-color:var(--accent); }
|
|
22
|
+
.hint { color:var(--dim); font-size:11px; white-space:nowrap; }
|
|
23
|
+
#stage { position:absolute; top:53px; bottom:0; left:0; right:0; }
|
|
24
|
+
#loading { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; color:var(--dim); }
|
|
25
|
+
#legend { position:fixed; right:14px; top:66px; display:flex; flex-direction:column; gap:7px; z-index:10; background:rgba(15,23,42,.82); padding:10px 12px; border-radius:10px; border:1px solid var(--line); }
|
|
26
|
+
.lg { display:flex; align-items:center; gap:5px; font-size:12px; color:var(--dim); cursor:pointer; }
|
|
27
|
+
.lg:hover { color:var(--fg); }
|
|
28
|
+
.lg i { width:10px; height:10px; border-radius:3px; display:inline-block; }
|
|
29
|
+
#warn { position:fixed; left:50%; transform:translateX(-50%); top:62px; z-index:20; background:#2A1F12; border:1px solid var(--gold); color:#FCD9A4; border-radius:10px; padding:8px 14px; font-size:12px; max-width:82vw; display:none; }
|
|
30
|
+
#pop { position:fixed; display:none; width:min(600px, 92vw); max-height:min(78vh, 760px); background:var(--panel); border:1px solid var(--line); border-radius:14px; box-shadow:0 18px 50px rgba(0,0,0,.55); z-index:30; flex-direction:column; overflow:hidden; }
|
|
31
|
+
#pop.open { display:flex; }
|
|
32
|
+
#pophead { display:flex; align-items:flex-start; gap:10px; padding:14px 16px 10px; border-bottom:1px solid var(--line); background:var(--muted-bg); }
|
|
33
|
+
#ptitle { flex:1; font-size:15px; font-weight:600; line-height:1.5; }
|
|
34
|
+
#popclose { background:transparent; border:1px solid var(--line); color:var(--dim); border-radius:8px; width:30px; height:30px; cursor:pointer; font-size:14px; flex:none; }
|
|
35
|
+
#popclose:hover { color:var(--fg); border-color:var(--bad); }
|
|
36
|
+
#popmeta { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:6px; }
|
|
37
|
+
.badge { font-size:11px; padding:2px 10px; border-radius:999px; border:1px solid var(--line); color:var(--dim); }
|
|
38
|
+
#popbody { flex:1; overflow:auto; padding:12px 16px 16px; }
|
|
39
|
+
#popbody h4 { color:var(--link); margin:14px 0 6px; font-size:13.5px; }
|
|
40
|
+
#popbody h4:first-child { margin-top:2px; }
|
|
41
|
+
#popbody blockquote { border-left:3px solid var(--accent); background:#12291E; color:#CFEEDB; padding:9px 13px; margin:8px 0; border-radius:6px; font-size:13px; }
|
|
42
|
+
#popbody li { margin:4px 0 4px 18px; color:#D6DCE8; }
|
|
43
|
+
#popbody p { margin:6px 0; }
|
|
44
|
+
#popbody code { background:#111A2E; padding:1px 6px; border-radius:4px; font-size:12px; color:#A5D6FF; }
|
|
45
|
+
#popbody hr { border:0; border-top:1px solid var(--line); margin:12px 0; }
|
|
46
|
+
#popbody .essence { color:#E2E8F0; background:#1F2A3E; border-left:3px solid var(--gold); padding:8px 12px; border-radius:6px; margin-bottom:6px; }
|
|
47
|
+
.chips { display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
|
|
48
|
+
.chip { background:#111A2E; border:1px solid var(--line); color:var(--fg); border-radius:999px; padding:4px 12px; font-size:12px; cursor:pointer; }
|
|
49
|
+
.chip:hover { border-color:var(--accent); }
|
|
50
|
+
.chip b { color:var(--link); font-weight:500; }
|
|
51
|
+
.chip i { color:var(--dim); font-style:normal; }
|
|
52
|
+
</style>
|
|
53
|
+
</head>
|
|
54
|
+
<body>
|
|
55
|
+
<div id="topbar">
|
|
56
|
+
<h1 id="ttl">知识表面</h1>
|
|
57
|
+
<input id="search" placeholder="搜标题 / 摘要 / 关键词" autocomplete="off">
|
|
58
|
+
<span id="hitcount"></span>
|
|
59
|
+
<span id="scale"></span>
|
|
60
|
+
<button class="tb" id="expandall">展开全部</button>
|
|
61
|
+
<button class="tb" id="collapseall">收起</button>
|
|
62
|
+
<span class="hint">滚轮缩放 · 拖拽平移 · 点节点展开/收起 · 悬浮看摘要 · 点卡片出明细</span>
|
|
63
|
+
</div>
|
|
64
|
+
<div id="stage"><div id="loading">载入图谱…</div></div>
|
|
65
|
+
<div id="legend"></div>
|
|
66
|
+
<div id="warn"></div>
|
|
67
|
+
|
|
68
|
+
<div id="pop">
|
|
69
|
+
<div id="pophead">
|
|
70
|
+
<div style="flex:1">
|
|
71
|
+
<div id="popmeta"></div>
|
|
72
|
+
<div id="ptitle"></div>
|
|
73
|
+
</div>
|
|
74
|
+
<button id="popclose" title="关闭 (Esc)">✕</button>
|
|
75
|
+
</div>
|
|
76
|
+
<div id="popbody"></div>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
__ECHARTS_TAG__
|
|
80
|
+
<script>const SURFACE = __SURFACE_JSON__;</script>
|
|
81
|
+
<script>
|
|
82
|
+
const $ = s => document.querySelector(s);
|
|
83
|
+
const S = SURFACE;
|
|
84
|
+
const byId = new Map(S.nodes.map(n => [n.id, n]));
|
|
85
|
+
/* 同名节点计数:标题撞车时,明细卡的关联条目必须带上下文,否则用户分不清跳到哪个 */
|
|
86
|
+
const titleCount = new Map();
|
|
87
|
+
for (const n of S.nodes) titleCount.set(n.title, (titleCount.get(n.title) || 0) + 1);
|
|
88
|
+
const parentTitle = id => { const p = byId.get(id); const q = p && p.parentId ? byId.get(p.parentId) : null; return q ? q.title : ''; };
|
|
89
|
+
const kidsOf = new Map();
|
|
90
|
+
for (const n of S.nodes) {
|
|
91
|
+
if (!n.parentId) continue;
|
|
92
|
+
if (!kidsOf.has(n.parentId)) kidsOf.set(n.parentId, []);
|
|
93
|
+
kidsOf.get(n.parentId).push(n);
|
|
94
|
+
}
|
|
95
|
+
const GCOLOR = new Map(S.groups.map(g => [g.id, g.color]));
|
|
96
|
+
const collapsed = new Map(); // 用户展开态(id -> collapsed):唯一真相源,重建时从这里读回
|
|
97
|
+
const LABEL_LIMIT = 40; // 可见叶节点超过这个数 → 只画点不画标签
|
|
98
|
+
let query = '', chart = null, treeCache = null, hitSet = new Set();
|
|
99
|
+
|
|
100
|
+
const esc = s => String(s == null ? '' : s)
|
|
101
|
+
.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
102
|
+
|
|
103
|
+
/* ---------- markdown(明细正文) ---------- */
|
|
104
|
+
function md2html(src) {
|
|
105
|
+
const lines = String(src || '').split(/\r?\n/);
|
|
106
|
+
const inline = s => esc(s)
|
|
107
|
+
.replace(/\*\*([^*]+)\*\*/g, '<b>$1</b>').replace(/`([^`]+)`/g, '<code>$1</code>');
|
|
108
|
+
let out = '', list = false;
|
|
109
|
+
const closeList = () => { if (list) { out += '</ul>'; list = false; } };
|
|
110
|
+
for (const raw of lines) {
|
|
111
|
+
if (/^###\s/.test(raw)) { closeList(); out += '<h4>' + inline(raw.replace(/^###\s*/, '')) + '</h4>'; }
|
|
112
|
+
else if (/^####\s/.test(raw)) { closeList(); out += '<h4>' + inline(raw.replace(/^####\s*/, '')) + '</h4>'; }
|
|
113
|
+
else if (/^>\s?/.test(raw)) { closeList(); out += '<blockquote>' + inline(raw.replace(/^>\s?/, '')) + '</blockquote>'; }
|
|
114
|
+
else if (/^[-*]\s+/.test(raw)) { if (!list) { out += '<ul>'; list = true; } out += '<li>' + inline(raw.replace(/^[-*]\s+/, '')) + '</li>'; }
|
|
115
|
+
else if (/^---+$/.test(raw.trim())) { closeList(); out += '<hr>'; }
|
|
116
|
+
else if (!raw.trim()) { closeList(); }
|
|
117
|
+
else { closeList(); out += '<p>' + inline(raw) + '</p>'; }
|
|
118
|
+
}
|
|
119
|
+
closeList();
|
|
120
|
+
return out;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* ---------- 命中判定 ---------- */
|
|
124
|
+
function hitText(n) {
|
|
125
|
+
return (n.title + ' ' + (n.summary || '') + ' ' + (n.keywords || []).join(' ') + ' '
|
|
126
|
+
+ (n.body || '') + ' ' + (n.file || '')).toLowerCase();
|
|
127
|
+
}
|
|
128
|
+
function computeHits() {
|
|
129
|
+
hitSet = new Set();
|
|
130
|
+
const q = query.toLowerCase();
|
|
131
|
+
if (!q) return;
|
|
132
|
+
for (const n of S.nodes) if (n.type !== 'root' && hitText(n).includes(q)) hitSet.add(n.id);
|
|
133
|
+
}
|
|
134
|
+
/* ---------- 树构建 ---------- */
|
|
135
|
+
/**
|
|
136
|
+
* 默认展开到第几层:在「可见节点数 ≤ 预算」的前提下的最深一层。
|
|
137
|
+
* 文档库动辄几百个叶子,全展开就是一团毛线;骨架全图才是一眼能看懂的地图。
|
|
138
|
+
*/
|
|
139
|
+
const NODE_BUDGET = 120;
|
|
140
|
+
function autoLevel() {
|
|
141
|
+
const byDepth = new Map();
|
|
142
|
+
let maxDepth = 0;
|
|
143
|
+
for (const n of S.nodes) {
|
|
144
|
+
const d = n.depth || 0;
|
|
145
|
+
if (d > maxDepth) maxDepth = d;
|
|
146
|
+
byDepth.set(d, (byDepth.get(d) || 0) + 1);
|
|
147
|
+
}
|
|
148
|
+
let level = 0, sum = 0;
|
|
149
|
+
for (let d = 0; d <= maxDepth; d++) {
|
|
150
|
+
sum += byDepth.get(d) || 0;
|
|
151
|
+
if (sum <= NODE_BUDGET) level = d; else break;
|
|
152
|
+
}
|
|
153
|
+
return level;
|
|
154
|
+
}
|
|
155
|
+
const AUTO_LEVEL = autoLevel();
|
|
156
|
+
function defaultCollapsed(n) {
|
|
157
|
+
const kids = kidsOf.get(n.id) || [];
|
|
158
|
+
if (!kids.length) return false;
|
|
159
|
+
return (n.depth || 0) >= AUTO_LEVEL; // 这一层往下默认收起
|
|
160
|
+
}
|
|
161
|
+
function visibleLeafCount() {
|
|
162
|
+
let c = 0;
|
|
163
|
+
const walk = n => {
|
|
164
|
+
const isCollapsed = collapsed.has(n.id) ? collapsed.get(n.id) : defaultCollapsed(n);
|
|
165
|
+
if (isCollapsed) return;
|
|
166
|
+
if (n.type === 'leaf') { c++; return; }
|
|
167
|
+
(kidsOf.get(n.id) || []).forEach(walk);
|
|
168
|
+
};
|
|
169
|
+
(kidsOf.get('root') || []).forEach(walk);
|
|
170
|
+
return c;
|
|
171
|
+
}
|
|
172
|
+
function buildTree() {
|
|
173
|
+
computeHits();
|
|
174
|
+
const vis = visibleLeafCount();
|
|
175
|
+
const searching = !!query;
|
|
176
|
+
const showLeafLabels = searching ? true : vis <= LABEL_LIMIT;
|
|
177
|
+
const colorOf = n => GCOLOR.get(n.group) || '#64748B';
|
|
178
|
+
const mk = n => {
|
|
179
|
+
const t = { id: n.id, name: n.title, raw: n, children: (kidsOf.get(n.id) || []).map(mk) };
|
|
180
|
+
const isHit = searching && hitSet.has(n.id);
|
|
181
|
+
const dim = searching && !isHit && n.type !== 'root' && n.type !== 'group';
|
|
182
|
+
if (n.type === 'root') {
|
|
183
|
+
t.symbolSize = 14;
|
|
184
|
+
t.itemStyle = { color: '#F8FAFC' };
|
|
185
|
+
t.label = { position: 'right', distance: 10, fontSize: 15, fontWeight: 700, color: '#F8FAFC' };
|
|
186
|
+
} else if (n.type === 'group') {
|
|
187
|
+
t.symbolSize = 12;
|
|
188
|
+
t.itemStyle = { color: colorOf(n) };
|
|
189
|
+
t.label = { position: 'right', distance: 9, fontSize: 14, fontWeight: 700, color: colorOf(n) };
|
|
190
|
+
} else if (n.type === 'file') {
|
|
191
|
+
t.symbolSize = 9;
|
|
192
|
+
t.itemStyle = { color: colorOf(n) };
|
|
193
|
+
t.label = {
|
|
194
|
+
position: 'right', distance: 8, fontSize: 12.5, fontWeight: 600,
|
|
195
|
+
color: isHit ? '#F59E0B' : '#F8FAFC',
|
|
196
|
+
backgroundColor: 'rgba(15,23,42,.72)', padding: [1, 3], borderRadius: 3, // 长标题互相压字时仍可读
|
|
197
|
+
};
|
|
198
|
+
} else {
|
|
199
|
+
t.symbolSize = n.type === 'section' ? 6.5 : 5.5;
|
|
200
|
+
t.itemStyle = { color: n.type === 'empty' ? '#64748B' : colorOf(n) + 'CC' };
|
|
201
|
+
t.label = {
|
|
202
|
+
show: showLeafLabels, position: 'right', distance: 6, fontSize: 11.5,
|
|
203
|
+
color: isHit ? '#F59E0B' : '#C7CFDC', fontWeight: isHit ? 700 : 400,
|
|
204
|
+
opacity: dim ? .35 : 1,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
// 搜索态:命中项及其祖先链强制展开,其余收起(根节点永远展开,否则整图消失)
|
|
208
|
+
if (searching) {
|
|
209
|
+
t.collapsed = !(isHit || hasHitDescendant(n.id));
|
|
210
|
+
} else {
|
|
211
|
+
t.collapsed = collapsed.has(n.id) ? collapsed.get(n.id) : defaultCollapsed(n);
|
|
212
|
+
}
|
|
213
|
+
return t;
|
|
214
|
+
};
|
|
215
|
+
const rootNode = byId.get('root');
|
|
216
|
+
return [mk(rootNode)];
|
|
217
|
+
}
|
|
218
|
+
function hasHitDescendant(id) {
|
|
219
|
+
for (const k of (kidsOf.get(id) || [])) {
|
|
220
|
+
if (hitSet.has(k.id)) return true;
|
|
221
|
+
if (hasHitDescendant(k.id)) return true;
|
|
222
|
+
}
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/* ---------- 渲染 ---------- */
|
|
227
|
+
function fullOption() {
|
|
228
|
+
return {
|
|
229
|
+
backgroundColor: 'transparent',
|
|
230
|
+
tooltip: {
|
|
231
|
+
trigger: 'item', triggerOn: 'mousemove', enterable: false,
|
|
232
|
+
backgroundColor: '#1B2336', borderColor: '#475569', borderWidth: 1,
|
|
233
|
+
padding: [10, 14], textStyle: { color: '#F8FAFC', fontSize: 12 },
|
|
234
|
+
extraCssText: 'border-radius:10px;box-shadow:0 10px 30px rgba(0,0,0,.5);',
|
|
235
|
+
formatter: tooltipHtml,
|
|
236
|
+
},
|
|
237
|
+
series: [{
|
|
238
|
+
type: 'tree', data: JSON.parse(JSON.stringify(treeCache)), orient: 'LR', edgeShape: 'curve',
|
|
239
|
+
expandAndCollapse: true, roam: true,
|
|
240
|
+
top: '2%', left: '5%', bottom: '2%', right: '28%',
|
|
241
|
+
lineStyle: { width: 1.1, color: '#33415C' },
|
|
242
|
+
emphasis: { focus: 'none', itemStyle: { shadowBlur: 12, shadowColor: 'rgba(34,197,94,.35)' } },
|
|
243
|
+
}],
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
function renderTree() {
|
|
247
|
+
treeCache = buildTree();
|
|
248
|
+
chart.setOption(fullOption(), true); // notMerge:tree 系列的 merge 会残留旧内部状态
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/* ---------- tooltip:摘要(一句话) ---------- */
|
|
252
|
+
function tooltipHtml(params) {
|
|
253
|
+
const d = params.data && params.data.raw;
|
|
254
|
+
if (!d) return '';
|
|
255
|
+
const color = GCOLOR.get(d.group) || '#94A3B8';
|
|
256
|
+
if (d.type === 'root') {
|
|
257
|
+
return `<div><b>${esc(d.title)}</b><br><span style="color:#94A3B8">${S.counts.files} 文件 · ${S.counts.groups} 组 · ${S.counts.leaves} 叶节点</span></div>`;
|
|
258
|
+
}
|
|
259
|
+
if (d.type === 'group') {
|
|
260
|
+
const kids = (kidsOf.get(d.id) || []).length;
|
|
261
|
+
return `<div><b style="color:${color}">${esc(d.title)}</b><br><span style="color:#94A3B8">${kids} 个文件 · 点开看内容</span></div>`;
|
|
262
|
+
}
|
|
263
|
+
const sum = d.summary ? `<div style="color:#C7CFDC">${esc(d.summary)}</div>` : '<div style="color:#EF4444">(无摘要)</div>';
|
|
264
|
+
return `<div style="max-width:340px;white-space:normal;line-height:1.6">
|
|
265
|
+
<div style="color:${color};font-size:11px;margin-bottom:4px">${esc(d.file || d.title)}</div>
|
|
266
|
+
<div style="font-weight:600;margin-bottom:6px">${esc(d.title)}</div>
|
|
267
|
+
${sum}
|
|
268
|
+
<div style="color:#94A3B8;font-size:11px;margin-top:6px">点击查看完整内容</div></div>`;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/* ---------- 明细卡(披露第二层) ---------- */
|
|
272
|
+
function showPop(n, px, py) {
|
|
273
|
+
const color = GCOLOR.get(n.group) || '#94A3B8';
|
|
274
|
+
$('#popmeta').innerHTML =
|
|
275
|
+
`<span class="badge" style="border-color:${color};color:${color}">${esc((S.groups.find(g => g.id === n.group) || {}).name || '—')}</span>` +
|
|
276
|
+
(n.file ? `<span class="badge">${esc(n.file)}</span>` : '') +
|
|
277
|
+
`<span class="badge">${esc(n.type)}</span>`;
|
|
278
|
+
$('#ptitle').textContent = n.title;
|
|
279
|
+
const rel = (n.links || []).map(l => {
|
|
280
|
+
const r = byId.get(l.id); if (!r) return '';
|
|
281
|
+
const why = l.basis === 'kw' ? (l.shared && l.shared[0] ? l.shared[0] : '关键词') : '同文件相邻';
|
|
282
|
+
const t = r.title.length > 24 ? r.title.slice(0, 24) + '…' : r.title;
|
|
283
|
+
// 标题在语料里不唯一 → 补一段上下文(父级小节名),否则关联条目指代不清
|
|
284
|
+
const ctx = (titleCount.get(r.title) || 0) > 1 ? ` <i>· ${esc(parentTitle(l.id) || r.file || '')}</i>` : '';
|
|
285
|
+
return `<span class="chip" data-rel="${esc(l.id)}">${esc(t)}${ctx} <i>· ${esc(why)}</i></span>`;
|
|
286
|
+
}).join('');
|
|
287
|
+
const body = n.body ? md2html(n.body) : '<p style="color:#94A3B8">(该节点无正文)</p>';
|
|
288
|
+
$('#popbody').innerHTML =
|
|
289
|
+
(n.summary ? `<h4>一句话</h4><div class="essence">${esc(n.summary)}</div>` : '') +
|
|
290
|
+
`<h4>全文</h4>${body}` +
|
|
291
|
+
(rel ? `<h4>关联</h4><div class="chips">${rel}</div>` : '');
|
|
292
|
+
document.querySelectorAll('.chip').forEach(c => c.onclick = () => jumpTo(c.dataset.rel));
|
|
293
|
+
const pop = $('#pop');
|
|
294
|
+
pop.classList.add('open');
|
|
295
|
+
const w = Math.min(600, innerWidth * .92), h = Math.min(760, innerHeight * .78);
|
|
296
|
+
pop.style.left = Math.max(10, Math.min(px + 20, innerWidth - w - 12)) + 'px';
|
|
297
|
+
pop.style.top = Math.max(60, Math.min(py - 20, innerHeight - h - 12)) + 'px';
|
|
298
|
+
$('#popbody').scrollTop = 0;
|
|
299
|
+
}
|
|
300
|
+
const hidePop = () => $('#pop').classList.remove('open');
|
|
301
|
+
|
|
302
|
+
/* ---------- 跳转:展开祖先 + 高亮 ---------- */
|
|
303
|
+
function jumpTo(id) {
|
|
304
|
+
const n = byId.get(id); if (!n) return;
|
|
305
|
+
const targets = new Set([id]);
|
|
306
|
+
let p = n.parentId;
|
|
307
|
+
while (p) { targets.add(p); const x = byId.get(p); p = x ? x.parentId : null; }
|
|
308
|
+
const walk = node => {
|
|
309
|
+
node.children && node.children.forEach(walk);
|
|
310
|
+
if (targets.has(node.id)) { node.collapsed = false; collapsed.set(node.id, false); }
|
|
311
|
+
};
|
|
312
|
+
walk(treeCache[0]);
|
|
313
|
+
renderTree();
|
|
314
|
+
flash(id);
|
|
315
|
+
hidePop();
|
|
316
|
+
}
|
|
317
|
+
function flash(id) {
|
|
318
|
+
const paint = arr => arr.forEach(n => {
|
|
319
|
+
if (n.id === id) { n.__saved = n.label; n.label = Object.assign({}, n.label || {}, { color: '#F59E0B', fontWeight: 800, fontSize: 13 }); }
|
|
320
|
+
if (n.children) paint(n.children);
|
|
321
|
+
});
|
|
322
|
+
paint(treeCache);
|
|
323
|
+
renderTree();
|
|
324
|
+
setTimeout(() => {
|
|
325
|
+
const restore = arr => arr.forEach(n => {
|
|
326
|
+
if (n.id === id && n.__saved) { n.label = n.__saved; delete n.__saved; }
|
|
327
|
+
if (n.children) restore(n.children);
|
|
328
|
+
});
|
|
329
|
+
restore(treeCache);
|
|
330
|
+
renderTree();
|
|
331
|
+
}, 1600);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/* ---------- 顶栏 / 图例 ---------- */
|
|
335
|
+
function paintCounts() {
|
|
336
|
+
const c = S.counts;
|
|
337
|
+
$('#scale').textContent = `${c.files} 文件 · ${c.groups} 组 · ${c.leaves} 叶节点 · ${c.linked} 有关联 · 默认展开 ${AUTO_LEVEL + 1} 层`;
|
|
338
|
+
$('#hitcount').textContent = query ? `${hitSet.size} 个命中` : '';
|
|
339
|
+
}
|
|
340
|
+
function renderLegend() {
|
|
341
|
+
$('#legend').innerHTML = S.groups.map(g => `<span class="lg" data-g="${esc(g.id)}"><i style="background:${g.color}"></i>${esc(g.name)}</span>`).join('');
|
|
342
|
+
document.querySelectorAll('.lg').forEach(el => el.onclick = () => {
|
|
343
|
+
const g = byId.get('g:' + el.dataset.g);
|
|
344
|
+
if (g) jumpTo(g.id);
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/* ---------- 启动 ---------- */
|
|
349
|
+
function start() {
|
|
350
|
+
if (!window.echarts) {
|
|
351
|
+
$('#loading').innerHTML = '<span style="color:#EF4444">ECharts 未加载(离线环境请用 --echarts 指定本地 echarts.min.js)</span>';
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
document.title = S.title || '知识表面';
|
|
355
|
+
$('#ttl').textContent = S.title || '知识表面';
|
|
356
|
+
renderLegend();
|
|
357
|
+
paintCounts();
|
|
358
|
+
if (S.warnings && S.warnings.length) {
|
|
359
|
+
const w = $('#warn');
|
|
360
|
+
w.textContent = '⚠ ' + S.warnings.join(' · ');
|
|
361
|
+
w.style.display = 'block';
|
|
362
|
+
w.onclick = () => { w.style.display = 'none'; };
|
|
363
|
+
}
|
|
364
|
+
const load = $('#loading');
|
|
365
|
+
load && load.remove(); // echarts.init 会清空容器 → 先移除,再 init
|
|
366
|
+
chart = echarts.init($('#stage'));
|
|
367
|
+
renderTree();
|
|
368
|
+
chart.on('click', params => {
|
|
369
|
+
const d = params.data && params.data.raw; if (!d) return;
|
|
370
|
+
if (d.type === 'leaf' || d.type === 'empty') {
|
|
371
|
+
showPop(d, params.event.offsetX, params.event.offsetY);
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
// 非叶节点 = 展开/收起。params.collapsed 是「切换后」的状态,必须回写,否则重建时丢
|
|
375
|
+
collapsed.set(d.id, !!params.collapsed);
|
|
376
|
+
renderTree();
|
|
377
|
+
});
|
|
378
|
+
chart.getZr().on('click', e => { if (!e.target) hidePop(); });
|
|
379
|
+
window.addEventListener('resize', () => chart.resize());
|
|
380
|
+
$('#search').oninput = e => { query = e.target.value.trim(); renderTree(); paintCounts(); };
|
|
381
|
+
$('#expandall').onclick = () => {
|
|
382
|
+
const walk = n => { collapsed.set(n.id, false); (kidsOf.get(n.id) || []).forEach(walk); };
|
|
383
|
+
walk(byId.get('root'));
|
|
384
|
+
renderTree();
|
|
385
|
+
};
|
|
386
|
+
$('#collapseall').onclick = () => {
|
|
387
|
+
const walk = n => {
|
|
388
|
+
const kids = kidsOf.get(n.id) || [];
|
|
389
|
+
collapsed.set(n.id, n.type !== 'root' && kids.length > 0);
|
|
390
|
+
kids.forEach(walk);
|
|
391
|
+
};
|
|
392
|
+
walk(byId.get('root'));
|
|
393
|
+
renderTree();
|
|
394
|
+
};
|
|
395
|
+
$('#popclose').onclick = hidePop;
|
|
396
|
+
document.addEventListener('keydown', e => { if (e.key === 'Escape') hidePop(); });
|
|
397
|
+
}
|
|
398
|
+
start();
|
|
399
|
+
</script>
|
|
400
|
+
</body>
|
|
401
|
+
</html>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# references 索引
|
|
2
|
+
|
|
3
|
+
本目录下每个文件都是 SKILL.md 正文的溢出内容,按需读取。
|
|
4
|
+
|
|
5
|
+
- `parsing.md` —— 盘语料结构、写 `surface.config.json`、调摘要与叶节点规则时读
|
|
6
|
+
- `relations.md` —— 调关联质量、解释边的来源、判断一条边该不该存在时读
|
|
7
|
+
- `rendering.md` —— 画布不听话(节点不显示、状态丢失、标签压字)时读,含 16 条坑清单
|
|
8
|
+
- `disclosure-and-style.md` —— 做明细排版、调配色/字号/密度时读
|
|
9
|
+
- `qa.md` —— 交付前逐条过:全图、披露、搜索、性能、自检、交付口径
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# 披露与审美
|
|
2
|
+
|
|
3
|
+
「一眼全图」和「披露式明细」是同一个动作的两端:图负责让人知道**有什么、在哪、叫什么**;明细负责让人**读下去**。审美不是装饰——配色、字号梯度、对比度、密度策略直接决定「一眼全图」能不能成立。
|
|
4
|
+
|
|
5
|
+
## 1. 三级披露
|
|
6
|
+
|
|
7
|
+
| 级 | 载体 | 内容 | 触发 |
|
|
8
|
+
|---|---|---|---|
|
|
9
|
+
| 概览 | 画布节点 + 顶栏计数 | 分组色、标题、规模数字 | 打开页面 |
|
|
10
|
+
| 摘要 | tooltip | 一句话(≤140 字)+ 文件名 | 悬浮 |
|
|
11
|
+
| 全文 | 明细面板 | 标题 / 一句话 / 正文(渲染后的 md) | 点叶节点 |
|
|
12
|
+
|
|
13
|
+
明细面板的段序固定:**标签 chips(分组 / 文件名 / 节点类型) → 标题 → 一句话 → 正文**。先给定位,再给内容。
|
|
14
|
+
|
|
15
|
+
- 正文渲染要保留 md 结构:标题、列表、引用块、行内代码、代码块。
|
|
16
|
+
- 长文必须可滚动,面板本身不撑破视口。
|
|
17
|
+
- `Esc` 关闭,点空白关闭;关掉后不残留遮罩。
|
|
18
|
+
|
|
19
|
+
## 2. 色板(深色 OLED)
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
--bg #0F172A 页面底
|
|
23
|
+
--panel #1B2336 面板 / tooltip
|
|
24
|
+
--muted #272F42 次级底
|
|
25
|
+
--line #475569 分隔线
|
|
26
|
+
--fg #F8FAFC 主文字
|
|
27
|
+
--dim #94A3B8 次要文字
|
|
28
|
+
--accent #22C55E 强调 / 命中态边框
|
|
29
|
+
--gold #F59E0B 搜索命中
|
|
30
|
+
--bad #EF4444 缺内容(无摘要)
|
|
31
|
+
--link #5B9DFF 关联链接
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
规则:
|
|
35
|
+
|
|
36
|
+
- 正文对底色对比度 ≥ 4.5:1;次要文字 ≥ 3:1。深色底上纯白刺眼,用 `#F8FAFC` 而非 `#FFFFFF`。
|
|
37
|
+
- **分组色是身份**,不是装饰:同一分组在全图、明细 chips、图例里必须是同一个颜色。
|
|
38
|
+
- 分组色要互相可辨(10 色板已按色相拉开),并且在深色底上都有足够亮度。
|
|
39
|
+
- 命中金色只给「被搜到」的东西,不要大面积用。
|
|
40
|
+
- 缺失信息用 `--bad` 明说「(无摘要)」,不要留空——留空会被当成「加载中」。
|
|
41
|
+
|
|
42
|
+
## 3. 字号梯度
|
|
43
|
+
|
|
44
|
+
| 对象 | 字号 | 字重 |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| 根节点 | 15 | 700 |
|
|
47
|
+
| 分组 | 14 | 700 |
|
|
48
|
+
| 文件 | 12.5 | 600 |
|
|
49
|
+
| 叶/段 | 11.5 | 400(命中 700) |
|
|
50
|
+
| tooltip | 12 | 400 |
|
|
51
|
+
|
|
52
|
+
层级靠**字号 + 字重 + 颜色**三重区分,不能只靠颜色(色盲、投影、截图都吃亏)。
|
|
53
|
+
|
|
54
|
+
## 4. 密度策略
|
|
55
|
+
|
|
56
|
+
- 可见叶节点 ≤ 40:全标签。
|
|
57
|
+
- 超过 40:叶/段只画点不画标签,文件标签保留并加半透明底衬。
|
|
58
|
+
- 搜索态:**强制显示标签**(否则「搜到了却看不见」)。
|
|
59
|
+
- 点开一个分支只多展开那一支,其余保持收起——不要因为点开一个就把整棵树摊平。
|
|
60
|
+
- 图例放**右上竖排**,不要放左下浮层:左下是树的叶子密集区。
|
|
61
|
+
|
|
62
|
+
## 5. 排版细节
|
|
63
|
+
|
|
64
|
+
- 标题不换行超过两行;过长时截断并在 tooltip/明细里给全名。
|
|
65
|
+
- tooltip 宽度封顶(`max-width:340px`),`white-space:normal`,多行可读。
|
|
66
|
+
- 正文里的表格、代码块要横向可滚,不要撑破面板。
|
|
67
|
+
- 明细里的**关联 chips**:显示目标标题,点了能跳到那个节点(跳过去后目标要展开并高亮)。
|
|
68
|
+
- 顶栏放规模数字(文件 / 组 / 叶节点 / 有关联 / 搜索命中数)——读者第一眼要知道这图有多大。
|
|
69
|
+
|
|
70
|
+
## 6. 自检(审美向)
|
|
71
|
+
|
|
72
|
+
改完配色/密度后,逐条对:
|
|
73
|
+
|
|
74
|
+
1. 缩小窗口看分组色还认得出来吗?
|
|
75
|
+
2. 截图给一个「不熟这个领域」的人看,他能说出「有哪些大块」吗?
|
|
76
|
+
3. 悬浮时 tooltip 里的第一句话,单独看能懂吗?
|
|
77
|
+
4. 点开明细后,正文里有没有跟图上一模一样的重复段落(有 = ownBody 规则没生效,见 parsing.md §2)?
|
|
78
|
+
5. 全展开一次,标签有没有互相压字?压了就调 `LABEL_LIMIT`,别调字号到 9px 以下。
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# 盘结构与解析规则
|
|
2
|
+
|
|
3
|
+
## 1. 先盘,再写配置
|
|
4
|
+
|
|
5
|
+
盘结构这一步的产出是三件事,写进 `surface.config.json`(或记在心里):
|
|
6
|
+
|
|
7
|
+
| 要盘的东西 | 怎么盘 | 写进哪 |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| 有几个文件、什么语料 | `find . -name '*.md' \| wc -l` | 决定是否拆多张 surface |
|
|
10
|
+
| 标题有几级、什么算叶 | 抽查 3 份:`grep -n '^#' file.md` | `summarySections` / `--leaf-pattern` |
|
|
11
|
+
| 怎么分组 | 看目录名;目录拍平就看文件名里的编号/日期 | `groups[].match`(正则,匹配**不含扩展名**的文件名) |
|
|
12
|
+
| 一句话从哪取 | 找语料里「答案/摘要/结论」这类段名 | `summarySections` |
|
|
13
|
+
| 有没有既定配色 | 语料若已有领域色板(别的界面在用),照抄 | `groups[].color` / `palette` |
|
|
14
|
+
|
|
15
|
+
**分组不靠猜**:语料若已有人工校准过的领域划分,照抄不重造。自动聚类的分组看起来聪明但不可信——读者要的是「跟人想的一样」的分区。
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"title": "AI 全栈面试 · 25 天学习图谱",
|
|
20
|
+
"groups": [
|
|
21
|
+
{ "id": "gateway", "name": "AI 网关", "color": "#5b9dff", "match": "day-0[234]" },
|
|
22
|
+
{ "id": "method", "name": "Agent 方法论", "color": "#3ecf8e", "match": "day-0[56]" }
|
|
23
|
+
],
|
|
24
|
+
"summarySections": ["答案", "摘要", "一句话", "结论"],
|
|
25
|
+
"palette": ["#5b9dff", "#3ecf8e", "#f0b429"]
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
未命中任何 `match` 的文件落进「其它」组(灰色)。`groups.match` 是对**文件名**(不含扩展名)的正则;完全不配 `groups` 时按第一层目录归组,根目录文件归「其它」。
|
|
30
|
+
|
|
31
|
+
## 2. 解析链(build_surface.mjs 的实际顺序)
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
walkMd(dir) 递归收 *.md,路径用 / 分隔
|
|
35
|
+
↓ findHeadings(lines) 取标题行;代码围栏里的 # 不算标题
|
|
36
|
+
↓ markRanges(heads) 每个标题的正文范围 = 到下一个同级或更高级标题前
|
|
37
|
+
↓ linkParents(heads) 用同级栈建父子(跳级会自动挂到最近的祖先)
|
|
38
|
+
↓ ownBody(lines, h) 只保留本节点自己的行(排除子标题覆盖的行)
|
|
39
|
+
↓ splitSections(body) 按 **标签** / --- 把正文切成段
|
|
40
|
+
↓ pickSummary(...) 每段→摘要候选
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
- **标题层级即结构**:md 的 H1→H4 天然是树。「卡片」写法(`### 卡 1 · 标题`)本来就是 H3,不需要另写解析器。只有当「卡片」标记出现在正文而非标题时,才用 `--leaf-pattern` 正则。
|
|
44
|
+
- **跳级标题**(H2 下面直接 H4)自动挂到最近的祖先,不报错——真实语料里很常见。
|
|
45
|
+
- **ownBody 的意义**:H3 的正文不能包含 H4 的正文,否则子节点的内容会在父节点摘要里重复出现,展开后会看到同一段文字两次。
|
|
46
|
+
|
|
47
|
+
## 3. 摘要规则(叶节点必须有摘要)
|
|
48
|
+
|
|
49
|
+
摘要缺失 = 界面退化成目录。取值顺序(`pickSummary`):
|
|
50
|
+
|
|
51
|
+
1. **designated 段**:`summarySections` 里命中的段(默认 `答案 / essence / 摘要 / 一句话 / 结论 / 核心结论`)。
|
|
52
|
+
2. designated 段**标签独占一行、内容在下一段**时 → 取其后第一个有内容的段。
|
|
53
|
+
3. 首个命名段(`splitSections` 切出来的带标签段)。
|
|
54
|
+
4. 首个实质行(跳过纯标记行、纯标签行、表格行)。
|
|
55
|
+
5. 围栏里的纯文本(跳过图形化围栏)。
|
|
56
|
+
6. 表格首行数据(跳过表头)。
|
|
57
|
+
|
|
58
|
+
最后在**句边界**截断(`firstSentence`,默认 140 字)。别在词中间砍。
|
|
59
|
+
|
|
60
|
+
**必须跳过的内容**(否则摘要有毒):
|
|
61
|
+
|
|
62
|
+
| 内容 | 判定 | 为什么 |
|
|
63
|
+
|---|---|---|
|
|
64
|
+
| 图形化代码块 | `DIAGRAM_LANG = /^(mermaid\|graph\|flowchart\|sequencediagram\|plantuml\|dot)$/i` | 图不是摘要,是图 |
|
|
65
|
+
| ASCII 框线图 | `DIAGRAM_CHAR = /[\u2500-\u257F]\|▶\|►\|▼\|▲\|◄\|◀\|➡\|➤/` | 框线字符拼出来的图,摘要是乱码 |
|
|
66
|
+
| 分隔线 `---` | stripMd 后为空串 | 不是内容 |
|
|
67
|
+
| 表格行 | `^\s*\|` | 表格有专门结构,摘要是碎片 |
|
|
68
|
+
| 复选框 | `^\s*\[[ xX✓✔]\]\s*` | 任务符号不是内容 |
|
|
69
|
+
|
|
70
|
+
**「纯标签行」判定要严**:整段加粗的正文会被误判成小节标签。用 `LABEL_RE = /^[^*\n]{1,16}$/` + 不含 `。!?,、;` 来卡;只看长度会翻车。
|
|
71
|
+
|
|
72
|
+
## 4. 段切分(splitSections)
|
|
73
|
+
|
|
74
|
+
正文切成段有三种触发:
|
|
75
|
+
|
|
76
|
+
1. `**标签**` 独占一行 → 该行是段标签,内容是后面的行;
|
|
77
|
+
2. `**标签**:内容` 同行 → 标签 + 内联内容;
|
|
78
|
+
3. `---` 分隔线 → 强制断段。
|
|
79
|
+
|
|
80
|
+
段标签判定用 `labelOk()`(≤16 字、不含句末标点)。**整段加粗的正文必须被排除**,否则「`**一、结论**`」这种写法会把整篇当标签。
|
|
81
|
+
|
|
82
|
+
## 5. 常见坑
|
|
83
|
+
|
|
84
|
+
- **围栏里的 `#` 不是标题**:先做围栏状态机再取标题,否则示例代码块会凭空长出一棵子树。
|
|
85
|
+
- **文件名里的日期编号不是结构**:`day-02-学习任务.md` 是文件名,不是节点;文件是叶子容器还是分组容器由 `groups.match` 决定。
|
|
86
|
+
- **文件内多张卡片**:每张卡是独立叶节点(`### 卡 N · 标题` → 一个 H3)。一张卡就是一个叶,天然对应「一眼全图 → 点开看明细」。
|
|
87
|
+
- **表格型小节**(「三句口诀」「自测六问」)没有标题层级,只能作为所属卡片的内容,不会独立成节点——这是对的,它本来就不是可导航单元。
|
|
88
|
+
- **空文件 / 只有标题**:会产生没有摘要的节点 → 自检会报 warning,先补内容或把它并进父节点。
|
|
89
|
+
|
|
90
|
+
## 6. 自检(脚本已内置)
|
|
91
|
+
|
|
92
|
+
跑完构建看 stderr:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
[ok] 25 文件 / 10 组 / 573 叶节点(641 节点,437 个有关联)
|
|
96
|
+
[warn] N 个叶节点没有摘要:…
|
|
97
|
+
[warn] 孤儿节点 N 个
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**这两个 warning 必须是 0**。有 warning 就回去修解析规则,不要改数据源迁就脚本。
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# 交付前逐条过
|
|
2
|
+
|
|
3
|
+
每条都有**判据**,不靠「看着还行」。勾不上就回去改,别在交付说明里写「可能有点问题」。
|
|
4
|
+
|
|
5
|
+
## A. 构建层(脚本跑完就有结论)
|
|
6
|
+
|
|
7
|
+
| # | 检查 | 判据 |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| A1 | 构建成功 | stderr 第一行 `[ok] N 文件 / N 组 / N 叶节点` |
|
|
10
|
+
| A2 | **没有摘要的叶节点 = 0** | 没有 `[warn] N 个叶节点没有摘要` |
|
|
11
|
+
| A3 | **孤儿节点 = 0** | 没有 `[warn] 孤儿节点 N 个` |
|
|
12
|
+
| A4 | 关联数量合理 | 「N 个有关联」不是 0,也不是 90%(90% 说明边没有信息量) |
|
|
13
|
+
| A5 | 单文件自包含 | `--echarts` 给了本地文件 → 断网双击也能开 |
|
|
14
|
+
| A6 | 产物无路径泄漏 | HTML 里搜不到构建机的绝对路径(除 data 字段) |
|
|
15
|
+
|
|
16
|
+
## B. 全图(打开产物第一件事)
|
|
17
|
+
|
|
18
|
+
1. **默认视图 = 骨架**:根 → 组 → 文件,一屏能看完;不是几百个叶子糊成一片。
|
|
19
|
+
2. **全展开也不炸**:点「展开全部」,节点不重叠、不出 NaN 坐标、不白屏。
|
|
20
|
+
3. **标签自动降级**:节点多时叶标签消失,文件标签仍在且可读。
|
|
21
|
+
4. **规模数字可读**:顶栏的文件/组/叶节点/关联数对得上 JSON。
|
|
22
|
+
5. **分组色可辨**:相邻两组颜色不撞;「其它」组是灰色。
|
|
23
|
+
6. **图例不挡内容**:右上竖排,不压节点。
|
|
24
|
+
|
|
25
|
+
## C. 披露
|
|
26
|
+
|
|
27
|
+
1. **hover 出摘要**:一句话 + 文件名;没有摘要的节点明说「(无摘要)」。
|
|
28
|
+
2. **点叶节点出明细**:标题 + 一句话 + 正文(md 渲染结构完整:标题/列表/引用/代码)。
|
|
29
|
+
3. **长文能滚**:面板不撑破视口。
|
|
30
|
+
4. **Esc 关闭 / 点空白关闭**,关掉无残影。
|
|
31
|
+
5. **点非叶节点 = 展开/收起**,不是出明细(两种语义不能混)。
|
|
32
|
+
6. **展开态跨重建保留**:点开 → 触发一次重渲染 → 展开态还在。
|
|
33
|
+
|
|
34
|
+
## D. 搜索
|
|
35
|
+
|
|
36
|
+
1. 搜索命中**看得见**(不是命中了却被密度规则藏掉)。
|
|
37
|
+
2. **命中路径自动展开**(祖先链展开到命中项)。
|
|
38
|
+
3. 命中高亮(金色 + 700 字重),非命中降到 opacity .35。
|
|
39
|
+
4. 顶栏显示命中数。
|
|
40
|
+
5. **根节点永远展开** —— 搜索态把根收起 = 整图消失(坑 13)。
|
|
41
|
+
|
|
42
|
+
## E. 性能(语料规模 × 交互)
|
|
43
|
+
|
|
44
|
+
| 规模 | 期望 |
|
|
45
|
+
|---|---|
|
|
46
|
+
| < 300 节点 | 首屏 < 1s,交互 60fps |
|
|
47
|
+
| 300–800 节点 | 首屏 < 2s;展开动画不卡死 |
|
|
48
|
+
| > 800 节点 | **拆多张 surface**(按组),不要硬塞一张画布 |
|
|
49
|
+
|
|
50
|
+
自检:展开全部后持续漫游/缩放,浏览器不崩、不掉帧到不可用。
|
|
51
|
+
|
|
52
|
+
## F. 交付(按消费方写,不写过程)
|
|
53
|
+
|
|
54
|
+
1. **交付物 → 消费方对照表**:产物是什么、谁打开、怎么用(双击 / 命令行)。
|
|
55
|
+
2. **启动指令**:可直接复制的一行命令 + 打开地址。
|
|
56
|
+
3. **已知限制**:如实写(哪些没接线、哪些边界没覆盖),不要藏。
|
|
57
|
+
4. **不写**:内部路径、决策编号、日期时点、过程文档引用、未决清单。
|
|
58
|
+
5. **不写没用的按钮**:外部数据接口没接线的,别留一个点了没反应的入口。
|
|
59
|
+
|
|
60
|
+
## G. 一键复检(能自动的就自动)
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# 构建 + 自检(warning 必须为 0)
|
|
64
|
+
node scripts/build_surface.mjs --in ./docs --out ./surface.html \
|
|
65
|
+
--config ./docs/surface.config.json --echarts ./vendor/echarts.min.js
|
|
66
|
+
|
|
67
|
+
# 浏览器里点一遍(合成事件法,见 rendering.md §5)
|
|
68
|
+
# 读 window.__probe 确认 name/type/collapsed 三项
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**退出条件**:A 全绿 + B/C/D 逐条过 + E 达标 + F 写完。
|