@cobola/dsh-geo 0.3.0 → 0.4.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/CHANGELOG.md +30 -0
- package/README.md +4 -5
- package/client.js +109 -271
- package/docs/index.json +1 -1
- package/index.js +61 -2
- package/locale/en.json +2 -2
- package/locale/zh.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.0 - 2026-11-29
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- Audit results now appear as a card in the transcript, under the tool call that
|
|
8
|
+
produced them: score, five dimensions, platform reference scores and the top
|
|
9
|
+
fixes, plus the delta against the previous scan.
|
|
10
|
+
- `geo_scan` and `geo_fix_plan` publish a bounded `presentationMeta` payload, so
|
|
11
|
+
the card renders structured facts instead of parsing model-facing prose.
|
|
12
|
+
- The Settings panel now holds configuration only. The dashboard page it used to
|
|
13
|
+
contain was removed along with its cross-session site guessing.
|
|
14
|
+
- Plugin and Settings labels use the brand name `dsh-geo` instead of a
|
|
15
|
+
translated product name.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## 0.3.1 - 2026-11-29
|
|
19
|
+
|
|
20
|
+
### Fixes
|
|
21
|
+
|
|
22
|
+
- The visibility dashboard now names the audited site in its header, so it is
|
|
23
|
+
clear which site the score, trend and platform results belong to.
|
|
24
|
+
- The settings panel states that it configures scan behaviour only and is not
|
|
25
|
+
tied to any site.
|
|
26
|
+
|
|
27
|
+
### Tests
|
|
28
|
+
|
|
29
|
+
- Panel tests now render the dashboard component in loading, empty, error and
|
|
30
|
+
ready states, and assert the audited site URL is displayed.
|
|
31
|
+
|
|
32
|
+
|
|
3
33
|
## 0.2.0 - 2026-11-29
|
|
4
34
|
|
|
5
35
|
- Published as the scoped npm package `@cobola/dsh-geo` (the unscoped `dsh-geo` name was refused by npm for being too similar to `d3-geo`).
|
package/README.md
CHANGED
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
[](LICENSE)
|
|
9
9
|
[](https://github.com/cobola/dsh-geo/releases)
|
|
10
10
|
|
|
11
|
-
`dsh-geo` 是一个面向网站维护者、内容团队、SEO/GEO 顾问和开发者的只读、可复现网站可见性体检工具。
|
|
12
|
-
|
|
13
11
|
`dsh-geo` 是一个只读、可复现的网站 GEO/SEO 结构体检工具:它读取网站实际返回的 HTML、robots.txt、sitemap 和结构化数据,找出影响可见性的具体问题,生成可以直接执行的修复清单,并在修改后用同一套规则复查结果。
|
|
14
12
|
|
|
15
13
|
它适合维护官网、内容站、文档站和数据产品的产品负责人、内容负责人、SEO/GEO 顾问与开发者。工具不承诺排名,也不猜测任何平台的黑盒算法;它只报告能够从网站和公开平台文档中验证的事实。
|
|
@@ -18,7 +16,8 @@
|
|
|
18
16
|
|
|
19
17
|
| 入口 | 能力 |
|
|
20
18
|
|---|---|
|
|
21
|
-
| `geo_scan`(DSH 工具) | 抓取并评分一个站点,报告写入 `.dsh-geo
|
|
19
|
+
| `geo_scan`(DSH 工具) | 抓取并评分一个站点,报告写入 `.dsh-geo/`,自动与上次扫描对比;结果以卡片形式出现在该次对话里 |
|
|
20
|
+
| 会话内结果卡 | 模型调用 `geo_scan` / `geo_fix_plan` 后,对话中直接显示分数、五维、平台参考分与优先修复,不用另开页面 |
|
|
22
21
|
| `geo_fix_plan`(DSH 工具) | 把最近一次(或指定的)报告变成按影响力排序的修复清单 |
|
|
23
22
|
| **设置 → GEO 体检**(面板) | 修改抓取页数、robots 策略、限速、超时、体积上限、报告目录、私有目标开关 |
|
|
24
23
|
| CLI(`dsh-geo`) | `scan` / `fix-plan` / `history` / `diff`,支持 `--json` 与 `--fail-under`,可直接进 CI |
|
|
@@ -77,7 +76,7 @@ npm install # 安装唯一的运行时依赖 @deepseek-ai/schemastery
|
|
|
77
76
|
|
|
78
77
|
安装后:
|
|
79
78
|
|
|
80
|
-
1. 在**设置 →
|
|
79
|
+
1. 在**设置 → dsh-geo** 里确认默认值(尤其“允许本机/私网目标”,默认关闭);
|
|
81
80
|
2. 新开一个会话,让 agent 跑一次 `geo_scan`;
|
|
82
81
|
3. 首次安装显示成功但工具没出现时,重启 DSH(替换已安装的 JS 需要重启加载新模块)。
|
|
83
82
|
|
|
@@ -193,7 +192,7 @@ fixture 基线(参考时间 `2026-06-15T00:00:00Z`,由测试锁定):
|
|
|
193
192
|
- **只读原始 HTML**:不执行 JavaScript,这是与检索管线对齐的设计;它不测渲染后的 DOM、Core Web Vitals、搜索排名、流量或真实 AI 引用。
|
|
194
193
|
- **不自动改代码**:`geo_fix_plan` 只产出清单;修改由 agent 或人完成,再用 `geo_scan` 验证。
|
|
195
194
|
- **评规则不是真理**:分数用于同站点纵向对比,不适合跨站点绝对排名。规则可审计、可改,带版本号 `geo-rubric@1`。
|
|
196
|
-
-
|
|
195
|
+
- **面板只编辑默认值**:扫描结果出现在对话卡片中;趋势与历史通过 `.dsh-geo/`、CLI 或 `dsh-geo history` 查看,尚未做图标趋势图。
|
|
197
196
|
- **npm 上仅发布命令行与库**:作为 DSH 插件仍建议本地目录链接安装,确保读到当前 checkout。
|
|
198
197
|
|
|
199
198
|
## 开发与发布
|
package/client.js
CHANGED
|
@@ -18,9 +18,9 @@ window.__ModuleLoader__.load({
|
|
|
18
18
|
|
|
19
19
|
const DICT = {
|
|
20
20
|
zh: {
|
|
21
|
-
nav: '
|
|
22
|
-
title: '
|
|
23
|
-
lede: '
|
|
21
|
+
nav: 'dsh-geo',
|
|
22
|
+
title: 'dsh-geo 扫描设置',
|
|
23
|
+
lede: '这里只配置扫描行为和报告位置,不对应任何具体网站;站点数据由每次 geo_scan 产生。改动立即生效,不影响评分规则。',
|
|
24
24
|
tools: '可用工具',
|
|
25
25
|
toolsHint: '在对话里让 agent 扫描站点、生成修复清单,改完代码后再扫一次对比分数。报告写入工作区里配置的报告目录(默认 .dsh-geo/)。',
|
|
26
26
|
crawl: '抓取',
|
|
@@ -54,34 +54,17 @@ window.__ModuleLoader__.load({
|
|
|
54
54
|
saveError: '保存失败',
|
|
55
55
|
unavailable: '设置服务不可用,无法在面板中修改。',
|
|
56
56
|
badge: '可复现规则评分 · 不预测排名',
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
dashTrend: '分数趋势',
|
|
64
|
-
dashRecent: '最近扫描',
|
|
65
|
-
dashFixed: '已修复',
|
|
66
|
-
dashRegressed: '回归',
|
|
67
|
-
dashStill: '仍未通过',
|
|
68
|
-
dashActions: '优先修复',
|
|
69
|
-
dashEmpty: '还没有体检记录',
|
|
70
|
-
dashEmptyHint: '在会话里让 agent 运行 geo_scan,或执行 dsh-geo scan --save;之后这里会显示分数趋势与五维变化。',
|
|
71
|
-
dashNoSession: '没有可用的会话工作区',
|
|
72
|
-
dashNoSessionHint: '先打开一个会话,在其中运行 geo_scan。',
|
|
73
|
-
dashError: '读取看板失败',
|
|
74
|
-
dashRefresh: '刷新',
|
|
75
|
-
dashWorkspace: '工作区',
|
|
76
|
-
dashUpdated: '更新于',
|
|
77
|
-
dashNoData: '暂无数据',
|
|
78
|
-
dashScans: '次扫描',
|
|
79
|
-
dashPlatforms: '平台适配(参考,不计入总分)',
|
|
57
|
+
cardScanning: '正在扫描站点…',
|
|
58
|
+
cardPlanning: '正在生成修复清单…',
|
|
59
|
+
cardFailed: '体检没有完成',
|
|
60
|
+
cardDelta: '较上次',
|
|
61
|
+
cardPlatforms: '平台参考分(不计入总分)',
|
|
62
|
+
cardActions: '优先修复',
|
|
80
63
|
},
|
|
81
64
|
en: {
|
|
82
|
-
nav: '
|
|
83
|
-
title: '
|
|
84
|
-
lede: 'These settings
|
|
65
|
+
nav: 'dsh-geo',
|
|
66
|
+
title: 'dsh-geo scan settings',
|
|
67
|
+
lede: 'These settings configure scan behaviour and report location only — they are not tied to any site. Site data comes from each geo_scan run, and these values never change the rubric.',
|
|
85
68
|
tools: 'Tools',
|
|
86
69
|
toolsHint: 'Ask the agent to audit a site, generate a fix plan, then audit again after the code changes. Reports live in the configured report directory (default .dsh-geo/).',
|
|
87
70
|
crawl: 'Crawl',
|
|
@@ -115,29 +98,12 @@ window.__ModuleLoader__.load({
|
|
|
115
98
|
saveError: 'Could not save',
|
|
116
99
|
unavailable: 'The settings service is unavailable; the panel cannot edit values.',
|
|
117
100
|
badge: 'Reproducible checks · no ranking prediction',
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
dashTrend: 'Score trend',
|
|
125
|
-
dashRecent: 'Recent scans',
|
|
126
|
-
dashFixed: 'Fixed',
|
|
127
|
-
dashRegressed: 'Regressed',
|
|
128
|
-
dashStill: 'Still failing',
|
|
129
|
-
dashActions: 'Top fixes',
|
|
130
|
-
dashEmpty: 'No audits yet',
|
|
131
|
-
dashEmptyHint: 'Ask the agent to run geo_scan, or run dsh-geo scan --save; the trend and dimension history will appear here.',
|
|
132
|
-
dashNoSession: 'No session workspace available',
|
|
133
|
-
dashNoSessionHint: 'Open a session and run geo_scan there first.',
|
|
134
|
-
dashError: 'Could not read the dashboard',
|
|
135
|
-
dashRefresh: 'Refresh',
|
|
136
|
-
dashWorkspace: 'Workspace',
|
|
137
|
-
dashUpdated: 'Updated',
|
|
138
|
-
dashNoData: 'No data yet',
|
|
139
|
-
dashScans: 'scans',
|
|
140
|
-
dashPlatforms: 'Platform profiles (reference, not in Core score)',
|
|
101
|
+
cardScanning: 'Scanning the site…',
|
|
102
|
+
cardPlanning: 'Building the fix plan…',
|
|
103
|
+
cardFailed: 'The audit did not complete',
|
|
104
|
+
cardDelta: 'vs previous',
|
|
105
|
+
cardPlatforms: 'Platform scores (not in Core total)',
|
|
106
|
+
cardActions: 'Top fixes',
|
|
141
107
|
},
|
|
142
108
|
};
|
|
143
109
|
|
|
@@ -208,24 +174,24 @@ window.__ModuleLoader__.load({
|
|
|
208
174
|
ok: { fontSize: 12, color: 'var(--dsw-alias-state-success-primary, #1a7f37)' },
|
|
209
175
|
error: { fontSize: 12, color: 'var(--dsw-alias-state-error-primary, #cf222e)' },
|
|
210
176
|
mono: { fontFamily: 'ui-monospace, SFMono-Regular, Menlo, monospace', fontSize: 12 },
|
|
211
|
-
|
|
212
|
-
|
|
177
|
+
cardGrid: { display: 'flex', flexWrap: 'wrap', gap: 12 },
|
|
178
|
+
cardBox: {
|
|
213
179
|
flex: '1 1 180px', minWidth: 160, padding: '14px 16px', borderRadius: 10,
|
|
214
180
|
border: '1px solid var(--dsw-alias-border-l2, #d0d7de)',
|
|
215
181
|
background: 'var(--dsw-alias-bg-layer-1, #ffffff)',
|
|
216
182
|
},
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
183
|
+
cardValue: { fontSize: 30, fontWeight: 700, lineHeight: 1.1, color: 'var(--dsw-alias-label-primary, #1f2328)' },
|
|
184
|
+
cardCap: { fontSize: 12, color: 'var(--dsw-alias-label-tertiary, #6e7781)', marginBottom: 6 },
|
|
185
|
+
cardDelta: { fontSize: 12, marginTop: 4 },
|
|
220
186
|
barTrack: {
|
|
221
187
|
height: 8, borderRadius: 999, overflow: 'hidden',
|
|
222
188
|
background: 'var(--dsw-alias-bg-layer-2, #f6f8fa)', width: '100%',
|
|
223
189
|
},
|
|
224
190
|
barFill: { height: '100%', borderRadius: 999, background: 'var(--dsw-alias-brand-primary, #0969da)' },
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
191
|
+
cardRow: { display: 'grid', gridTemplateColumns: '88px 1fr 72px', gap: 10, alignItems: 'center', padding: '5px 0' },
|
|
192
|
+
cardList: { display: 'flex', flexDirection: 'column', gap: 6 },
|
|
193
|
+
cardItem: { fontSize: 12, lineHeight: 1.5, color: 'var(--dsw-alias-label-secondary, #59636e)' },
|
|
194
|
+
cardStrong: { fontWeight: 600, color: 'var(--dsw-alias-label-primary, #1f2328)' },
|
|
229
195
|
};
|
|
230
196
|
|
|
231
197
|
function Field(props) {
|
|
@@ -420,181 +386,90 @@ window.__ModuleLoader__.load({
|
|
|
420
386
|
return h('div', { style: styles.page }, children);
|
|
421
387
|
}
|
|
422
388
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
return value > 0 ? `+${value}` : String(value);
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
function Sparkline(props) {
|
|
434
|
-
const { trend, label } = props;
|
|
435
|
-
const values = trend.map((entry) => entry.total);
|
|
436
|
-
if (values.length < 2) {
|
|
437
|
-
return h('div', { style: { ...styles.hint, padding: '18px 0' } }, props.emptyLabel);
|
|
438
|
-
}
|
|
439
|
-
const width = 640;
|
|
440
|
-
const height = 160;
|
|
441
|
-
const pad = 18;
|
|
442
|
-
const x = (index) => pad + (index * (width - pad * 2)) / (values.length - 1);
|
|
443
|
-
const y = (value) => height - pad - (Math.max(0, Math.min(100, value)) / 100) * (height - pad * 2);
|
|
444
|
-
const points = values.map((value, index) => `${x(index).toFixed(1)},${y(value).toFixed(1)}`).join(' ');
|
|
445
|
-
const area = `M ${pad},${height - pad} L ${points.replaceAll(' ', ' L ')} L ${width - pad},${height - pad} Z`;
|
|
446
|
-
const first = trend[0];
|
|
447
|
-
const last = trend[trend.length - 1];
|
|
448
|
-
const children = [
|
|
449
|
-
h('path', { key: 'area', d: area, fill: 'var(--dsw-alias-brand-primary, #0969da)', opacity: 0.12 }),
|
|
450
|
-
h('polyline', {
|
|
451
|
-
key: 'line', points, fill: 'none',
|
|
452
|
-
stroke: 'var(--dsw-alias-brand-primary, #0969da)', strokeWidth: 2.5,
|
|
453
|
-
strokeLinejoin: 'round', strokeLinecap: 'round',
|
|
454
|
-
}),
|
|
455
|
-
h('circle', { key: 'dot', cx: x(values.length - 1), cy: y(last.total), r: 4, fill: 'var(--dsw-alias-brand-primary, #0969da)' }),
|
|
456
|
-
h('text', { key: 'start', x: pad, y: height - 2, fontSize: 10, fill: 'var(--dsw-alias-label-tertiary, #6e7781)' }, formatTime(first.scannedAt).slice(0, 10)),
|
|
457
|
-
h('text', { key: 'end', x: width - pad, y: height - 2, textAnchor: 'end', fontSize: 10, fill: 'var(--dsw-alias-label-tertiary, #6e7781)' }, formatTime(last.scannedAt).slice(0, 10)),
|
|
458
|
-
h('text', { key: 'value', x: width - pad, y: 14, textAnchor: 'end', fontSize: 11, fill: 'var(--dsw-alias-label-secondary, #59636e)' }, `${last.total} / 100`),
|
|
459
|
-
];
|
|
460
|
-
return h('svg', {
|
|
461
|
-
viewBox: `0 0 ${width} ${height}`,
|
|
462
|
-
role: 'img',
|
|
463
|
-
'aria-label': label,
|
|
464
|
-
style: { width: '100%', height: 160, display: 'block' },
|
|
465
|
-
}, children);
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
function GeoDashboard(props) {
|
|
389
|
+
/**
|
|
390
|
+
* The tool call's own card in the transcript: score, dimensions, platform
|
|
391
|
+
* profile and the top fixes, plus the delta when a previous scan exists.
|
|
392
|
+
* Rendering stops at the payload the Host already computed.
|
|
393
|
+
* @param props - tool view props: phase, block, and the presentation meta.
|
|
394
|
+
*/
|
|
395
|
+
function GeoToolCard(props) {
|
|
469
396
|
const t = typeof props.t === 'function' ? props.t : (key) => key;
|
|
470
|
-
const
|
|
471
|
-
const
|
|
397
|
+
const phase = props.phase;
|
|
398
|
+
const block = props.block;
|
|
472
399
|
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
}
|
|
400
|
+
if (phase === 'preparing' || phase === 'start') {
|
|
401
|
+
return h('div', { style: styles.card },
|
|
402
|
+
h('div', { style: styles.sectionLabel }, props.toolName === 'geo_scan' ? t('cardScanning') : t('cardPlanning')),
|
|
403
|
+
h('div', { style: styles.hint }, block && block.args ? summarizeArgs(block.args) : ''));
|
|
404
|
+
}
|
|
405
|
+
if (!block || block.isError) {
|
|
406
|
+
const reason = block && block.error && block.error.reason ? block.error.reason : t('cardFailed');
|
|
407
|
+
return h('div', { ...{ style: { ...styles.card, ...styles.error } }, role: 'alert' },
|
|
408
|
+
h('div', { style: styles.sectionLabel }, t('cardFailed')),
|
|
409
|
+
h('div', { style: styles.hint }, reason));
|
|
410
|
+
}
|
|
484
411
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
const timer = setInterval(() => { void load(); }, 15000);
|
|
488
|
-
return () => clearInterval(timer);
|
|
489
|
-
}, []);
|
|
412
|
+
const meta = block.meta && block.meta.kind ? block.meta : null;
|
|
413
|
+
if (!meta) return null;
|
|
490
414
|
|
|
491
415
|
const children = [];
|
|
492
|
-
|
|
493
|
-
h('
|
|
494
|
-
|
|
495
|
-
h('
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
h('
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
children.push(h('div', { key: 'empty', style: styles.card },
|
|
523
|
-
h('div', { style: { ...styles.label, marginBottom: 4 } }, t('dashEmpty')),
|
|
524
|
-
h('div', { style: styles.hint }, t('dashEmptyHint'))));
|
|
525
|
-
return h('div', { style: styles.page }, children);
|
|
416
|
+
const dimensionRows = (meta.dimensions ?? []).map((dimension) => h('div', { key: dimension.title, style: styles.cardRow },
|
|
417
|
+
h('span', { style: styles.label }, dimension.title),
|
|
418
|
+
h('div', { style: styles.barTrack },
|
|
419
|
+
h('div', { style: { ...styles.barFill, width: `${Math.max(0, Math.min(100, dimension.score))}%` } })),
|
|
420
|
+
h('span', { style: { ...styles.hint, textAlign: 'right' } }, `${dimension.score}`)));
|
|
421
|
+
|
|
422
|
+
const platformRows = (meta.platforms ?? []).map((platform) => h('div', { key: platform.title, style: styles.cardRow },
|
|
423
|
+
h('span', { style: styles.label }, platform.title),
|
|
424
|
+
h('div', { style: styles.barTrack },
|
|
425
|
+
h('div', { style: { ...styles.barFill, width: `${Math.max(0, Math.min(100, platform.total))}%` } })),
|
|
426
|
+
h('span', { style: { ...styles.hint, textAlign: 'right' } }, `${platform.total}`)));
|
|
427
|
+
|
|
428
|
+
const actionRows = (meta.actions ?? []).map((action) => h('div', { key: action.ruleId, style: styles.cardItem },
|
|
429
|
+
h('span', { style: styles.cardStrong }, `${action.dimensionTitle} · ${action.title}`),
|
|
430
|
+
` — ${action.evidence}`));
|
|
431
|
+
|
|
432
|
+
const delta = meta.comparison;
|
|
433
|
+
children.push(h('div', { key: 'head', style: { display: 'flex', alignItems: 'baseline', gap: 10, flexWrap: 'wrap' } },
|
|
434
|
+
h('span', { style: styles.cardValue }, meta.kind === 'geo-fix-plan' ? `${meta.actionCount}` : `${meta.total}`),
|
|
435
|
+
h('span', { style: styles.cardCap }, meta.kind === 'geo-fix-plan' ? t('cardActions') : `${meta.grade} · / 100`),
|
|
436
|
+
h('a', {
|
|
437
|
+
href: meta.url, target: '_blank', rel: 'noreferrer',
|
|
438
|
+
style: { ...styles.mono, fontSize: 12, color: 'var(--dsw-alias-brand-primary, #0969da)' },
|
|
439
|
+
}, meta.url)));
|
|
440
|
+
|
|
441
|
+
if (delta && typeof delta.totalDelta === 'number') {
|
|
442
|
+
children.push(h('div', {
|
|
443
|
+
key: 'delta',
|
|
444
|
+
style: { ...styles.hint, color: delta.totalDelta >= 0 ? 'var(--dsw-alias-state-success-primary, #1a7f37)' : 'var(--dsw-alias-state-error-primary, #cf222e)' },
|
|
445
|
+
}, `${t('cardDelta')} ${delta.before} → ${delta.after}(${delta.totalDelta >= 0 ? '+' : ''}${delta.totalDelta})`));
|
|
526
446
|
}
|
|
527
447
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
h('div', { style: styles.dashValue }, value),
|
|
534
|
-
extra ?? null);
|
|
535
|
-
|
|
536
|
-
children.push(h('div', { key: 'cards', style: styles.dashGrid },
|
|
537
|
-
moduleCard('score', t('dashScore'), `${current.total} / 100`, h('div', {
|
|
538
|
-
style: { ...styles.dashDelta, color: delta && delta.total !== 0 ? (delta.total > 0 ? 'var(--dsw-alias-state-success-primary, #1a7f37)' : 'var(--dsw-alias-state-error-primary, #cf222e)') : 'var(--dsw-alias-label-tertiary, #6e7781)' },
|
|
539
|
-
}, `${current.grade} · ${delta ? `${t('dashDelta')} ${signed(delta.total)}` : t('dashNoData')}`)),
|
|
540
|
-
moduleCard('fixed', t('dashFixed'), delta ? String(delta.fixed.length) : '—'),
|
|
541
|
-
moduleCard('regressed', t('dashRegressed'), delta ? String(delta.regressed.length) : '—'),
|
|
542
|
-
moduleCard('still', t('dashStill'), delta ? String(delta.stillFailing) : '—')));
|
|
543
|
-
|
|
544
|
-
children.push(h('div', { key: 'trend', style: styles.card },
|
|
545
|
-
h('div', { style: styles.sectionLabel }, t('dashTrend')),
|
|
546
|
-
h(Sparkline, {
|
|
547
|
-
trend: dashboard.trend ?? [],
|
|
548
|
-
label: t('dashTrend'),
|
|
549
|
-
emptyLabel: t('dashNoData'),
|
|
550
|
-
}),
|
|
551
|
-
h('div', { style: { ...styles.hint, marginTop: 4 } }, `${(dashboard.trend ?? []).length} ${t('dashScans')}`)));
|
|
552
|
-
|
|
553
|
-
const dimensionMap = new Map((dashboard.previous?.dimensions ?? []).map((dimension) => [dimension.id, dimension]));
|
|
554
|
-
children.push(h('div', { key: 'dimensions', style: styles.card },
|
|
555
|
-
h('div', { style: styles.sectionLabel }, t('dashDimensions')),
|
|
556
|
-
(current.dimensions ?? []).map((dimension) => {
|
|
557
|
-
const before = dimensionMap.get(dimension.id);
|
|
558
|
-
const diff = before ? before.after - before.before : null;
|
|
559
|
-
return h('div', { key: dimension.id, style: styles.dashRow },
|
|
560
|
-
h('span', { style: styles.label }, dimension.title),
|
|
561
|
-
h('div', { style: styles.barTrack },
|
|
562
|
-
h('div', { style: { ...styles.barFill, width: `${Math.max(0, Math.min(100, dimension.score))}%` } })),
|
|
563
|
-
h('span', { style: { ...styles.hint, textAlign: 'right' } },
|
|
564
|
-
dimension.scored === false ? '—' : `${dimension.score}`,
|
|
565
|
-
diff === null || dimension.scored === false ? '' : ` (${signed(diff)})`));
|
|
566
|
-
})));
|
|
567
|
-
|
|
568
|
-
if ((current.platforms ?? []).length > 0) {
|
|
569
|
-
children.push(h('div', { key: 'platforms', style: styles.card },
|
|
570
|
-
h('div', { style: styles.sectionLabel }, t('dashPlatforms')),
|
|
571
|
-
current.platforms.map((platform) => h('div', { key: platform.id, style: styles.dashRow },
|
|
572
|
-
h('span', { style: styles.label }, platform.title),
|
|
573
|
-
h('div', { style: styles.barTrack },
|
|
574
|
-
h('div', { style: { ...styles.barFill, width: `${Math.max(0, Math.min(100, platform.total))}%` } })),
|
|
575
|
-
h('span', { style: { ...styles.hint, textAlign: 'right' } }, `${platform.total}`)))));
|
|
448
|
+
if (dimensionRows.length > 0) children.push(h('div', { key: 'dimensions' }, dimensionRows));
|
|
449
|
+
if (platformRows.length > 0) {
|
|
450
|
+
children.push(h('div', { key: 'platforms', style: { marginTop: 6 } },
|
|
451
|
+
h('div', { style: styles.sectionLabel }, t('cardPlatforms')),
|
|
452
|
+
platformRows));
|
|
576
453
|
}
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
h('div', { style: styles.dashList },
|
|
582
|
-
dashboard.actions.map((action) => h('div', { key: action.ruleId, style: styles.dashItem },
|
|
583
|
-
h('span', { style: styles.dashStrong }, `${action.dimensionTitle} · ${action.title}`),
|
|
584
|
-
` — ${action.evidence}`)))));
|
|
454
|
+
if (actionRows.length > 0) {
|
|
455
|
+
children.push(h('div', { key: 'actions', style: { marginTop: 8, display: 'flex', flexDirection: 'column', gap: 4 } },
|
|
456
|
+
h('div', { style: styles.sectionLabel }, t('cardActions')),
|
|
457
|
+
actionRows));
|
|
585
458
|
}
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
children.push(h('div', { key: 'recent', style: styles.card },
|
|
590
|
-
h('div', { style: styles.sectionLabel }, t('dashRecent')),
|
|
591
|
-
h('div', { style: styles.dashList },
|
|
592
|
-
recent.map((entry) => h('div', { key: `${entry.scannedAt}-${entry.total}`, style: { ...styles.dashItem, display: 'flex', justifyContent: 'space-between', gap: 12 } },
|
|
593
|
-
h('span', null, formatTime(entry.scannedAt)),
|
|
594
|
-
h('span', null, h('span', { style: styles.dashStrong }, `${entry.total}`), ` ${entry.grade}`))))));
|
|
459
|
+
if (meta.paths && meta.paths.report) {
|
|
460
|
+
children.push(h('div', { key: 'paths', style: { ...styles.hint, marginTop: 6 } },
|
|
461
|
+
h('span', { style: styles.mono }, meta.paths.report)));
|
|
595
462
|
}
|
|
463
|
+
return h('div', { style: styles.card }, children);
|
|
464
|
+
}
|
|
596
465
|
|
|
597
|
-
|
|
466
|
+
function summarizeArgs(args) {
|
|
467
|
+
try {
|
|
468
|
+
const parsed = typeof args === 'string' ? JSON.parse(args) : args;
|
|
469
|
+
return parsed && parsed.url ? parsed.url : '';
|
|
470
|
+
} catch {
|
|
471
|
+
return '';
|
|
472
|
+
}
|
|
598
473
|
}
|
|
599
474
|
|
|
600
475
|
function remoteSettings(ctx) {
|
|
@@ -608,42 +483,6 @@ window.__ModuleLoader__.load({
|
|
|
608
483
|
return /not.?found|ENOENT|lookup-not-found/i.test(text);
|
|
609
484
|
}
|
|
610
485
|
|
|
611
|
-
async function readDashboard(ctx) {
|
|
612
|
-
if (!ctx.remote || !ctx.remote.workspaceFiles || !ctx.sessions) {
|
|
613
|
-
throw new Error('workspace file service unavailable');
|
|
614
|
-
}
|
|
615
|
-
const snapshot = ctx.sessions.list.getSnapshot();
|
|
616
|
-
const sessions = Object.values(snapshot.byId)
|
|
617
|
-
.filter((session) => session.cwd)
|
|
618
|
-
.sort((a, b) => b.updatedAt - a.updatedAt)
|
|
619
|
-
.slice(0, 6);
|
|
620
|
-
if (sessions.length === 0) return { status: 'no-session', data: null, error: null, session: null };
|
|
621
|
-
|
|
622
|
-
let lastError = null;
|
|
623
|
-
for (const session of sessions) {
|
|
624
|
-
const result = await ctx.remote.workspaceFiles.readBytes(session.id, '.dsh-geo/dashboard.json', {});
|
|
625
|
-
if (!result || result.ok !== true) {
|
|
626
|
-
lastError = result && result.error ? result.error : { message: 'workspace read failed' };
|
|
627
|
-
if (isNotFound(lastError)) continue;
|
|
628
|
-
throw new Error(lastError.message || 'workspace read failed');
|
|
629
|
-
}
|
|
630
|
-
const bytes = result.value && result.value.data !== undefined ? result.value.data : result.value;
|
|
631
|
-
const text = new TextDecoder().decode(bytes);
|
|
632
|
-
return {
|
|
633
|
-
status: 'ready',
|
|
634
|
-
data: JSON.parse(text),
|
|
635
|
-
error: null,
|
|
636
|
-
session: { id: session.id, cwd: session.cwd },
|
|
637
|
-
};
|
|
638
|
-
}
|
|
639
|
-
return {
|
|
640
|
-
status: 'empty',
|
|
641
|
-
data: null,
|
|
642
|
-
error: lastError ? lastError.message : null,
|
|
643
|
-
session: { id: sessions[0].id, cwd: sessions[0].cwd },
|
|
644
|
-
};
|
|
645
|
-
}
|
|
646
|
-
|
|
647
486
|
async function readNamespace(ctx) {
|
|
648
487
|
const result = await remoteSettings(ctx).describe();
|
|
649
488
|
if (!result || result.ok !== true) {
|
|
@@ -679,17 +518,16 @@ window.__ModuleLoader__.load({
|
|
|
679
518
|
ctx.effect(() => ctx.locale.register(NS, DICT), 'dsh-geo: settings dictionaries');
|
|
680
519
|
const t = ctx.locale.bind(NS);
|
|
681
520
|
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
}),
|
|
691
|
-
}, GeoDashboard));
|
|
521
|
+
// The card appears where the model's call appears: inside the transcript.
|
|
522
|
+
// It renders from the tool's presentation payload, so it never parses prose.
|
|
523
|
+
for (const toolName of ['geo_scan', 'geo_fix_plan']) {
|
|
524
|
+
ctx.slots.inject('tool.call.toolview', () => ctx.slots.register({
|
|
525
|
+
name: 'tool.call.toolview',
|
|
526
|
+
key: toolName,
|
|
527
|
+
}, (props) => GeoToolCard({ ...props, toolName })));
|
|
528
|
+
}
|
|
692
529
|
|
|
530
|
+
// Settings holds configuration only; the results live in the transcript.
|
|
693
531
|
ctx.slots.inject('settings.section', () => ctx.slots.register({
|
|
694
532
|
name: 'settings.section',
|
|
695
533
|
id: NS,
|
package/docs/index.json
CHANGED
package/index.js
CHANGED
|
@@ -252,6 +252,65 @@ function planRender(args, value) {
|
|
|
252
252
|
return [{ type: 'text', text: lines.join('\n') }];
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Bounded facts for the in-chat tool card. The card renders this instead of
|
|
258
|
+
* parsing model-facing prose, so the numbers a developer sees in the transcript
|
|
259
|
+
* are the same ones the tool returned.
|
|
260
|
+
* @param value - the tool's canonical output value.
|
|
261
|
+
*/
|
|
262
|
+
export function scanPresentation(value) {
|
|
263
|
+
return {
|
|
264
|
+
kind: 'geo-scan',
|
|
265
|
+
url: value.url,
|
|
266
|
+
total: value.total,
|
|
267
|
+
grade: value.grade,
|
|
268
|
+
gradeLabel: value.gradeLabel,
|
|
269
|
+
pages: value.pages,
|
|
270
|
+
counts: value.counts,
|
|
271
|
+
blockedByRobots: value.blockedByRobots,
|
|
272
|
+
dimensions: (value.dimensions ?? []).map((dimension) => ({
|
|
273
|
+
title: dimension.title,
|
|
274
|
+
score: dimension.score,
|
|
275
|
+
weight: dimension.weight,
|
|
276
|
+
})),
|
|
277
|
+
platforms: (value.platforms ?? []).map((platform) => ({
|
|
278
|
+
title: platform.title,
|
|
279
|
+
total: platform.total,
|
|
280
|
+
})),
|
|
281
|
+
actions: (value.topActions ?? []).slice(0, 3).map((action) => ({
|
|
282
|
+
ruleId: action.ruleId,
|
|
283
|
+
dimensionTitle: action.dimensionTitle,
|
|
284
|
+
title: action.title,
|
|
285
|
+
evidence: action.evidence,
|
|
286
|
+
fix: action.fix,
|
|
287
|
+
})),
|
|
288
|
+
comparison: value.comparison ?? null,
|
|
289
|
+
paths: value.paths ?? {},
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/** Presentation payload for the fix-plan card. */
|
|
294
|
+
export function planPresentation(value) {
|
|
295
|
+
return {
|
|
296
|
+
kind: 'geo-fix-plan',
|
|
297
|
+
url: value.url,
|
|
298
|
+
total: value.total,
|
|
299
|
+
grade: value.grade,
|
|
300
|
+
actionCount: value.actionCount,
|
|
301
|
+
actions: (value.topActions ?? []).slice(0, 3).map((action) => ({
|
|
302
|
+
ruleId: action.ruleId,
|
|
303
|
+
dimensionTitle: action.dimensionTitle,
|
|
304
|
+
title: action.title,
|
|
305
|
+
evidence: action.evidence,
|
|
306
|
+
fix: action.fix,
|
|
307
|
+
})),
|
|
308
|
+
comparison: value.comparison ?? null,
|
|
309
|
+
planPath: value.planPath,
|
|
310
|
+
jsonPath: value.jsonPath,
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
|
|
255
314
|
export function apply(ctx, config) {
|
|
256
315
|
const scanDefinition = {
|
|
257
316
|
name: 'geo_scan',
|
|
@@ -262,7 +321,7 @@ export function apply(ctx, config) {
|
|
|
262
321
|
'It never edits the site, measures rankings or traffic, or guarantees AI citations. Review the evidence, apply changes in your normal workflow, then re-run with the same reference time to verify repairs.',
|
|
263
322
|
].join(' '),
|
|
264
323
|
parameters: scanParameters,
|
|
265
|
-
output: { schema: scanOutputSchema, render: scanRender },
|
|
324
|
+
output: { schema: scanOutputSchema, render: scanRender, presentationMeta: (args, value) => scanPresentation(value) },
|
|
266
325
|
timeoutMs: 180_000,
|
|
267
326
|
async execute(args, exec) {
|
|
268
327
|
if (exec.signal.aborted) throw exec.signal.reason ?? new Error('scan aborted');
|
|
@@ -340,7 +399,7 @@ export function apply(ctx, config) {
|
|
|
340
399
|
'Writes .dsh-geo/fix-plan.md and .dsh-geo/fix-plan.json. It never edits the site; apply the changes with your own tools, then run geo_scan again.',
|
|
341
400
|
].join(' '),
|
|
342
401
|
parameters: planParameters,
|
|
343
|
-
output: { schema: planOutputSchema, render: planRender },
|
|
402
|
+
output: { schema: planOutputSchema, render: planRender, presentationMeta: (args, value) => planPresentation(value) },
|
|
344
403
|
async execute(args, exec) {
|
|
345
404
|
if (exec.signal.aborted) throw exec.signal.reason ?? new Error('plan aborted');
|
|
346
405
|
const input = args !== null && typeof args === 'object' ? args : {};
|
package/locale/en.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
|
-
"title": "
|
|
4
|
-
"description": "
|
|
3
|
+
"title": "dsh-geo",
|
|
4
|
+
"description": "Read-only, reproducible GEO/SEO site audits: 45 auditable checks across five dimensions, with evidence and prioritized fixes. Never edits your site; re-run with the same reference time to verify changes."
|
|
5
5
|
}
|
|
6
6
|
}
|
package/locale/zh.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cobola/dsh-geo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Read-only, reproducible GEO/SEO website audits for DeepSeek Harness: inspect crawlability and citation-ready structure, return evidence and prioritized fixes, and never edit the site or promise rankings.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|