@cobola/dsh-geo 0.3.1 → 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/CHANGELOG.md +27 -0
- package/README.md +5 -6
- package/client.js +107 -282
- package/docs/PROFILES.md +21 -4
- package/docs/index.json +1 -1
- package/index.js +62 -2
- package/lib/platforms/baidu.js +154 -0
- package/lib/platforms/index.js +3 -1
- package/lib/report.js +6 -0
- package/lib/robots.js +15 -0
- package/lib/scan.js +6 -1
- package/locale/en.json +2 -2
- package/locale/zh.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.0 - 2026-11-29
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- Add the Baidu Search platform profile: Baiduspider and Baiduspider-render
|
|
8
|
+
reachability, robots.txt encoding, XML sitemap presence and root placement,
|
|
9
|
+
crawl stability, server-rendered body content, TDK completeness and mobile
|
|
10
|
+
viewport. Baidu has not published how 文心一言 or 百度 AI 搜索 choose cited
|
|
11
|
+
pages, so the profile states that limitation and never claims to model it.
|
|
12
|
+
- Platform profiles now carry their `limitation` text into the report payload.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## 0.4.0 - 2026-11-29
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Audit results now appear as a card in the transcript, under the tool call that
|
|
20
|
+
produced them: score, five dimensions, platform reference scores and the top
|
|
21
|
+
fixes, plus the delta against the previous scan.
|
|
22
|
+
- `geo_scan` and `geo_fix_plan` publish a bounded `presentationMeta` payload, so
|
|
23
|
+
the card renders structured facts instead of parsing model-facing prose.
|
|
24
|
+
- The Settings panel now holds configuration only. The dashboard page it used to
|
|
25
|
+
contain was removed along with its cross-session site guessing.
|
|
26
|
+
- Plugin and Settings labels use the brand name `dsh-geo` instead of a
|
|
27
|
+
translated product name.
|
|
28
|
+
|
|
29
|
+
|
|
3
30
|
## 0.3.1 - 2026-11-29
|
|
4
31
|
|
|
5
32
|
### Fixes
|
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
|
|
|
@@ -165,7 +164,7 @@ CLI 也随 npm 包提供:`npx @cobola/dsh-geo --help`;完整参数见 `dsh-g
|
|
|
165
164
|
|---|---|---|
|
|
166
165
|
| Google | 已实现(作为 Core 的规范边界) | Googlebot、Search 技术要求、Google 明确不需要的 GEO 手段 |
|
|
167
166
|
| Bing / Copilot | 已实现 | Bingbot / BingPreview 可达性、页面级 bingbot 指令、sitemap、站长验证、`data-nosnippet` |
|
|
168
|
-
| 百度 |
|
|
167
|
+
| 百度 | 已实现 | Baiduspider 与 Baiduspider-render 可达性、robots 编码、sitemap 与根目录位置、抓取稳定性、正文直出、TDK、移动端视口;百度 AI 引用标准未公开 |
|
|
169
168
|
| OpenAI / Perplexity | 规划中 | crawler 与 robots 控制检查 |
|
|
170
169
|
|
|
171
170
|
平台分在报告、CLI 与看板中单独显示,**从不计入 Core 总分**,也不代表任何平台的排名或引用结果。规则与官方来源见 [docs/PROFILES.md](docs/PROFILES.md),Google 边界见 [docs/GOOGLE.md](docs/GOOGLE.md)。
|
|
@@ -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,8 +18,8 @@ window.__ModuleLoader__.load({
|
|
|
18
18
|
|
|
19
19
|
const DICT = {
|
|
20
20
|
zh: {
|
|
21
|
-
nav: '
|
|
22
|
-
title: '
|
|
21
|
+
nav: 'dsh-geo',
|
|
22
|
+
title: 'dsh-geo 扫描设置',
|
|
23
23
|
lede: '这里只配置扫描行为和报告位置,不对应任何具体网站;站点数据由每次 geo_scan 产生。改动立即生效,不影响评分规则。',
|
|
24
24
|
tools: '可用工具',
|
|
25
25
|
toolsHint: '在对话里让 agent 扫描站点、生成修复清单,改完代码后再扫一次对比分数。报告写入工作区里配置的报告目录(默认 .dsh-geo/)。',
|
|
@@ -54,34 +54,16 @@ window.__ModuleLoader__.load({
|
|
|
54
54
|
saveError: '保存失败',
|
|
55
55
|
unavailable: '设置服务不可用,无法在面板中修改。',
|
|
56
56
|
badge: '可复现规则评分 · 不预测排名',
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
dashDimensions: '五维',
|
|
64
|
-
dashTrend: '分数趋势',
|
|
65
|
-
dashRecent: '最近扫描',
|
|
66
|
-
dashFixed: '已修复',
|
|
67
|
-
dashRegressed: '回归',
|
|
68
|
-
dashStill: '仍未通过',
|
|
69
|
-
dashActions: '优先修复',
|
|
70
|
-
dashEmpty: '还没有体检记录',
|
|
71
|
-
dashEmptyHint: '在会话里让 agent 运行 geo_scan,或执行 dsh-geo scan --save;之后这里会显示分数趋势与五维变化。',
|
|
72
|
-
dashNoSession: '没有可用的会话工作区',
|
|
73
|
-
dashNoSessionHint: '先打开一个会话,在其中运行 geo_scan。',
|
|
74
|
-
dashError: '读取看板失败',
|
|
75
|
-
dashRefresh: '刷新',
|
|
76
|
-
dashWorkspace: '工作区',
|
|
77
|
-
dashUpdated: '更新于',
|
|
78
|
-
dashNoData: '暂无数据',
|
|
79
|
-
dashScans: '次扫描',
|
|
80
|
-
dashPlatforms: '平台适配(参考,不计入总分)',
|
|
57
|
+
cardScanning: '正在扫描站点…',
|
|
58
|
+
cardPlanning: '正在生成修复清单…',
|
|
59
|
+
cardFailed: '体检没有完成',
|
|
60
|
+
cardDelta: '较上次',
|
|
61
|
+
cardPlatforms: '平台参考分(不计入总分)',
|
|
62
|
+
cardActions: '优先修复',
|
|
81
63
|
},
|
|
82
64
|
en: {
|
|
83
|
-
nav: '
|
|
84
|
-
title: '
|
|
65
|
+
nav: 'dsh-geo',
|
|
66
|
+
title: 'dsh-geo scan settings',
|
|
85
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.',
|
|
86
68
|
tools: 'Tools',
|
|
87
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/).',
|
|
@@ -116,30 +98,12 @@ window.__ModuleLoader__.load({
|
|
|
116
98
|
saveError: 'Could not save',
|
|
117
99
|
unavailable: 'The settings service is unavailable; the panel cannot edit values.',
|
|
118
100
|
badge: 'Reproducible checks · no ranking prediction',
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
dashDimensions: 'Dimensions',
|
|
126
|
-
dashTrend: 'Score trend',
|
|
127
|
-
dashRecent: 'Recent scans',
|
|
128
|
-
dashFixed: 'Fixed',
|
|
129
|
-
dashRegressed: 'Regressed',
|
|
130
|
-
dashStill: 'Still failing',
|
|
131
|
-
dashActions: 'Top fixes',
|
|
132
|
-
dashEmpty: 'No audits yet',
|
|
133
|
-
dashEmptyHint: 'Ask the agent to run geo_scan, or run dsh-geo scan --save; the trend and dimension history will appear here.',
|
|
134
|
-
dashNoSession: 'No session workspace available',
|
|
135
|
-
dashNoSessionHint: 'Open a session and run geo_scan there first.',
|
|
136
|
-
dashError: 'Could not read the dashboard',
|
|
137
|
-
dashRefresh: 'Refresh',
|
|
138
|
-
dashWorkspace: 'Workspace',
|
|
139
|
-
dashUpdated: 'Updated',
|
|
140
|
-
dashNoData: 'No data yet',
|
|
141
|
-
dashScans: 'scans',
|
|
142
|
-
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',
|
|
143
107
|
},
|
|
144
108
|
};
|
|
145
109
|
|
|
@@ -210,24 +174,24 @@ window.__ModuleLoader__.load({
|
|
|
210
174
|
ok: { fontSize: 12, color: 'var(--dsw-alias-state-success-primary, #1a7f37)' },
|
|
211
175
|
error: { fontSize: 12, color: 'var(--dsw-alias-state-error-primary, #cf222e)' },
|
|
212
176
|
mono: { fontFamily: 'ui-monospace, SFMono-Regular, Menlo, monospace', fontSize: 12 },
|
|
213
|
-
|
|
214
|
-
|
|
177
|
+
cardGrid: { display: 'flex', flexWrap: 'wrap', gap: 12 },
|
|
178
|
+
cardBox: {
|
|
215
179
|
flex: '1 1 180px', minWidth: 160, padding: '14px 16px', borderRadius: 10,
|
|
216
180
|
border: '1px solid var(--dsw-alias-border-l2, #d0d7de)',
|
|
217
181
|
background: 'var(--dsw-alias-bg-layer-1, #ffffff)',
|
|
218
182
|
},
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
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 },
|
|
222
186
|
barTrack: {
|
|
223
187
|
height: 8, borderRadius: 999, overflow: 'hidden',
|
|
224
188
|
background: 'var(--dsw-alias-bg-layer-2, #f6f8fa)', width: '100%',
|
|
225
189
|
},
|
|
226
190
|
barFill: { height: '100%', borderRadius: 999, background: 'var(--dsw-alias-brand-primary, #0969da)' },
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
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)' },
|
|
231
195
|
};
|
|
232
196
|
|
|
233
197
|
function Field(props) {
|
|
@@ -422,192 +386,90 @@ window.__ModuleLoader__.load({
|
|
|
422
386
|
return h('div', { style: styles.page }, children);
|
|
423
387
|
}
|
|
424
388
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
return value > 0 ? `+${value}` : String(value);
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
function Sparkline(props) {
|
|
436
|
-
const { trend, label } = props;
|
|
437
|
-
const values = trend.map((entry) => entry.total);
|
|
438
|
-
if (values.length < 2) {
|
|
439
|
-
return h('div', { style: { ...styles.hint, padding: '18px 0' } }, props.emptyLabel);
|
|
440
|
-
}
|
|
441
|
-
const width = 640;
|
|
442
|
-
const height = 160;
|
|
443
|
-
const pad = 18;
|
|
444
|
-
const x = (index) => pad + (index * (width - pad * 2)) / (values.length - 1);
|
|
445
|
-
const y = (value) => height - pad - (Math.max(0, Math.min(100, value)) / 100) * (height - pad * 2);
|
|
446
|
-
const points = values.map((value, index) => `${x(index).toFixed(1)},${y(value).toFixed(1)}`).join(' ');
|
|
447
|
-
const area = `M ${pad},${height - pad} L ${points.replaceAll(' ', ' L ')} L ${width - pad},${height - pad} Z`;
|
|
448
|
-
const first = trend[0];
|
|
449
|
-
const last = trend[trend.length - 1];
|
|
450
|
-
const children = [
|
|
451
|
-
h('path', { key: 'area', d: area, fill: 'var(--dsw-alias-brand-primary, #0969da)', opacity: 0.12 }),
|
|
452
|
-
h('polyline', {
|
|
453
|
-
key: 'line', points, fill: 'none',
|
|
454
|
-
stroke: 'var(--dsw-alias-brand-primary, #0969da)', strokeWidth: 2.5,
|
|
455
|
-
strokeLinejoin: 'round', strokeLinecap: 'round',
|
|
456
|
-
}),
|
|
457
|
-
h('circle', { key: 'dot', cx: x(values.length - 1), cy: y(last.total), r: 4, fill: 'var(--dsw-alias-brand-primary, #0969da)' }),
|
|
458
|
-
h('text', { key: 'start', x: pad, y: height - 2, fontSize: 10, fill: 'var(--dsw-alias-label-tertiary, #6e7781)' }, formatTime(first.scannedAt).slice(0, 10)),
|
|
459
|
-
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)),
|
|
460
|
-
h('text', { key: 'value', x: width - pad, y: 14, textAnchor: 'end', fontSize: 11, fill: 'var(--dsw-alias-label-secondary, #59636e)' }, `${last.total} / 100`),
|
|
461
|
-
];
|
|
462
|
-
return h('svg', {
|
|
463
|
-
viewBox: `0 0 ${width} ${height}`,
|
|
464
|
-
role: 'img',
|
|
465
|
-
'aria-label': label,
|
|
466
|
-
style: { width: '100%', height: 160, display: 'block' },
|
|
467
|
-
}, children);
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
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) {
|
|
471
396
|
const t = typeof props.t === 'function' ? props.t : (key) => key;
|
|
472
|
-
const
|
|
473
|
-
const
|
|
397
|
+
const phase = props.phase;
|
|
398
|
+
const block = props.block;
|
|
474
399
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
}
|
|
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
|
+
}
|
|
486
411
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
const timer = setInterval(() => { void load(); }, 15000);
|
|
490
|
-
return () => clearInterval(timer);
|
|
491
|
-
}, []);
|
|
412
|
+
const meta = block.meta && block.meta.kind ? block.meta : null;
|
|
413
|
+
if (!meta) return null;
|
|
492
414
|
|
|
493
415
|
const children = [];
|
|
494
|
-
const
|
|
495
|
-
|
|
496
|
-
h('div', { style:
|
|
497
|
-
h('
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
h('
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
if (
|
|
520
|
-
children.push(h('div', {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
children.push(h('div', { key: 'error', role: 'alert', style: { ...styles.card, ...styles.error } },
|
|
525
|
-
`${t('dashError')}: ${state.error}`));
|
|
526
|
-
return h('div', { style: styles.page }, children);
|
|
527
|
-
}
|
|
528
|
-
if (state.status === 'no-session') {
|
|
529
|
-
children.push(h('div', { key: 'no-session', style: styles.card },
|
|
530
|
-
h('div', { style: { ...styles.label, marginBottom: 4 } }, t('dashNoSession')),
|
|
531
|
-
h('div', { style: styles.hint }, t('dashNoSessionHint'))));
|
|
532
|
-
return h('div', { style: styles.page }, children);
|
|
533
|
-
}
|
|
534
|
-
if (state.status === 'empty') {
|
|
535
|
-
children.push(h('div', { key: 'empty', style: styles.card },
|
|
536
|
-
h('div', { style: { ...styles.label, marginBottom: 4 } }, t('dashEmpty')),
|
|
537
|
-
h('div', { style: styles.hint }, t('dashEmptyHint'))));
|
|
538
|
-
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})`));
|
|
539
446
|
}
|
|
540
447
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
h('div', { style: styles.dashValue }, value),
|
|
547
|
-
extra ?? null);
|
|
548
|
-
|
|
549
|
-
children.push(h('div', { key: 'cards', style: styles.dashGrid },
|
|
550
|
-
moduleCard('score', t('dashScore'), `${current.total} / 100`, h('div', {
|
|
551
|
-
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)' },
|
|
552
|
-
}, `${current.grade} · ${delta ? `${t('dashDelta')} ${signed(delta.total)}` : t('dashNoData')}`)),
|
|
553
|
-
moduleCard('fixed', t('dashFixed'), delta ? String(delta.fixed.length) : '—'),
|
|
554
|
-
moduleCard('regressed', t('dashRegressed'), delta ? String(delta.regressed.length) : '—'),
|
|
555
|
-
moduleCard('still', t('dashStill'), delta ? String(delta.stillFailing) : '—')));
|
|
556
|
-
|
|
557
|
-
children.push(h('div', { key: 'trend', style: styles.card },
|
|
558
|
-
h('div', { style: styles.sectionLabel }, t('dashTrend')),
|
|
559
|
-
h(Sparkline, {
|
|
560
|
-
trend: dashboard.trend ?? [],
|
|
561
|
-
label: t('dashTrend'),
|
|
562
|
-
emptyLabel: t('dashNoData'),
|
|
563
|
-
}),
|
|
564
|
-
h('div', { style: { ...styles.hint, marginTop: 4 } }, `${(dashboard.trend ?? []).length} ${t('dashScans')}`)));
|
|
565
|
-
|
|
566
|
-
const dimensionMap = new Map((dashboard.previous?.dimensions ?? []).map((dimension) => [dimension.id, dimension]));
|
|
567
|
-
children.push(h('div', { key: 'dimensions', style: styles.card },
|
|
568
|
-
h('div', { style: styles.sectionLabel }, t('dashDimensions')),
|
|
569
|
-
(current.dimensions ?? []).map((dimension) => {
|
|
570
|
-
const before = dimensionMap.get(dimension.id);
|
|
571
|
-
const diff = before ? before.after - before.before : null;
|
|
572
|
-
return h('div', { key: dimension.id, style: styles.dashRow },
|
|
573
|
-
h('span', { style: styles.label }, dimension.title),
|
|
574
|
-
h('div', { style: styles.barTrack },
|
|
575
|
-
h('div', { style: { ...styles.barFill, width: `${Math.max(0, Math.min(100, dimension.score))}%` } })),
|
|
576
|
-
h('span', { style: { ...styles.hint, textAlign: 'right' } },
|
|
577
|
-
dimension.scored === false ? '—' : `${dimension.score}`,
|
|
578
|
-
diff === null || dimension.scored === false ? '' : ` (${signed(diff)})`));
|
|
579
|
-
})));
|
|
580
|
-
|
|
581
|
-
if ((current.platforms ?? []).length > 0) {
|
|
582
|
-
children.push(h('div', { key: 'platforms', style: styles.card },
|
|
583
|
-
h('div', { style: styles.sectionLabel }, t('dashPlatforms')),
|
|
584
|
-
current.platforms.map((platform) => h('div', { key: platform.id, style: styles.dashRow },
|
|
585
|
-
h('span', { style: styles.label }, platform.title),
|
|
586
|
-
h('div', { style: styles.barTrack },
|
|
587
|
-
h('div', { style: { ...styles.barFill, width: `${Math.max(0, Math.min(100, platform.total))}%` } })),
|
|
588
|
-
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));
|
|
589
453
|
}
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
h('div', { style: styles.dashList },
|
|
595
|
-
dashboard.actions.map((action) => h('div', { key: action.ruleId, style: styles.dashItem },
|
|
596
|
-
h('span', { style: styles.dashStrong }, `${action.dimensionTitle} · ${action.title}`),
|
|
597
|
-
` — ${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));
|
|
598
458
|
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
children.push(h('div', { key: 'recent', style: styles.card },
|
|
603
|
-
h('div', { style: styles.sectionLabel }, t('dashRecent')),
|
|
604
|
-
h('div', { style: styles.dashList },
|
|
605
|
-
recent.map((entry) => h('div', { key: `${entry.scannedAt}-${entry.total}`, style: { ...styles.dashItem, display: 'flex', justifyContent: 'space-between', gap: 12 } },
|
|
606
|
-
h('span', null, formatTime(entry.scannedAt)),
|
|
607
|
-
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)));
|
|
608
462
|
}
|
|
463
|
+
return h('div', { style: styles.card }, children);
|
|
464
|
+
}
|
|
609
465
|
|
|
610
|
-
|
|
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
|
+
}
|
|
611
473
|
}
|
|
612
474
|
|
|
613
475
|
function remoteSettings(ctx) {
|
|
@@ -621,42 +483,6 @@ window.__ModuleLoader__.load({
|
|
|
621
483
|
return /not.?found|ENOENT|lookup-not-found/i.test(text);
|
|
622
484
|
}
|
|
623
485
|
|
|
624
|
-
async function readDashboard(ctx) {
|
|
625
|
-
if (!ctx.remote || !ctx.remote.workspaceFiles || !ctx.sessions) {
|
|
626
|
-
throw new Error('workspace file service unavailable');
|
|
627
|
-
}
|
|
628
|
-
const snapshot = ctx.sessions.list.getSnapshot();
|
|
629
|
-
const sessions = Object.values(snapshot.byId)
|
|
630
|
-
.filter((session) => session.cwd)
|
|
631
|
-
.sort((a, b) => b.updatedAt - a.updatedAt)
|
|
632
|
-
.slice(0, 6);
|
|
633
|
-
if (sessions.length === 0) return { status: 'no-session', data: null, error: null, session: null };
|
|
634
|
-
|
|
635
|
-
let lastError = null;
|
|
636
|
-
for (const session of sessions) {
|
|
637
|
-
const result = await ctx.remote.workspaceFiles.readBytes(session.id, '.dsh-geo/dashboard.json', {});
|
|
638
|
-
if (!result || result.ok !== true) {
|
|
639
|
-
lastError = result && result.error ? result.error : { message: 'workspace read failed' };
|
|
640
|
-
if (isNotFound(lastError)) continue;
|
|
641
|
-
throw new Error(lastError.message || 'workspace read failed');
|
|
642
|
-
}
|
|
643
|
-
const bytes = result.value && result.value.data !== undefined ? result.value.data : result.value;
|
|
644
|
-
const text = new TextDecoder().decode(bytes);
|
|
645
|
-
return {
|
|
646
|
-
status: 'ready',
|
|
647
|
-
data: JSON.parse(text),
|
|
648
|
-
error: null,
|
|
649
|
-
session: { id: session.id, cwd: session.cwd },
|
|
650
|
-
};
|
|
651
|
-
}
|
|
652
|
-
return {
|
|
653
|
-
status: 'empty',
|
|
654
|
-
data: null,
|
|
655
|
-
error: lastError ? lastError.message : null,
|
|
656
|
-
session: { id: sessions[0].id, cwd: sessions[0].cwd },
|
|
657
|
-
};
|
|
658
|
-
}
|
|
659
|
-
|
|
660
486
|
async function readNamespace(ctx) {
|
|
661
487
|
const result = await remoteSettings(ctx).describe();
|
|
662
488
|
if (!result || result.ok !== true) {
|
|
@@ -692,17 +518,16 @@ window.__ModuleLoader__.load({
|
|
|
692
518
|
ctx.effect(() => ctx.locale.register(NS, DICT), 'dsh-geo: settings dictionaries');
|
|
693
519
|
const t = ctx.locale.bind(NS);
|
|
694
520
|
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
}),
|
|
704
|
-
}, 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
|
+
}
|
|
705
529
|
|
|
530
|
+
// Settings holds configuration only; the results live in the transcript.
|
|
706
531
|
ctx.slots.inject('settings.section', () => ctx.slots.register({
|
|
707
532
|
name: 'settings.section',
|
|
708
533
|
id: NS,
|
package/docs/PROFILES.md
CHANGED
|
@@ -27,7 +27,7 @@ profile 是证据和检查边界,**不改变 Core 总分**。平台分数在
|
|
|
27
27
|
| Core | implemented | — | 通用抓取、索引、结构、实体 |
|
|
28
28
|
| Google | implemented | [Google AI Search guide](https://developers.google.com/search/docs/fundamentals/ai-optimization-guide) | Googlebot、Search 技术要求、Google 不需要的 GEO hacks 边界 |
|
|
29
29
|
| Bing | implemented (v0.3.0) | [Bing Webmaster Guidelines](https://www.bing.com/webmasters/help/webmaster-guidelines-30fba23a)、[robots meta](https://www.bing.com/webmasters/help/robots-meta-tags-and-attributes-that-bing-supports-5198d240)、[Sitemaps in AI search](https://blogs.bing.com/webmaster/July-2025/Keep-Content-Discoverable-with-Sitemaps-in-AI-Powered-Search) | Bingbot / BingPreview 可达性、页面级 bingbot 指令、sitemap、站长验证标识、data-nosnippet |
|
|
30
|
-
| Baidu |
|
|
30
|
+
| Baidu | implemented (v0.5.0) | [百度搜索引擎优化指南 2.0](https://ziyuan.baidu.com/college/articleinfo?id=193)、[移动搜索建站白皮书](https://ziyuan.baidu.com/college/articleinfo?id=2315)、[资源平台提交说明](https://ziyuan.baidu.com/college/videoinfo?id=3159) | Baiduspider、robots 编码、sitemap 与根目录、抓取稳定性、正文直出、TDK、移动端视口 |
|
|
31
31
|
| OpenAI | source-mapped | [OpenAI crawlers](https://developers.openai.com/api/docs/bots) | OAI-SearchBot 与 GPTBot 分离控制 |
|
|
32
32
|
| Perplexity | source-mapped | [Perplexity crawlers](https://docs.perplexity.ai/docs/resources/perplexity-crawlers) | crawler 身份、robots 与抓取可达性 |
|
|
33
33
|
|
|
@@ -43,9 +43,26 @@ profile 是证据和检查边界,**不改变 Core 总分**。平台分数在
|
|
|
43
43
|
|
|
44
44
|
源码:[lib/platforms/bing.js](../lib/platforms/bing.js)。
|
|
45
45
|
|
|
46
|
+
## Baidu profile 规则(已实现)
|
|
47
|
+
|
|
48
|
+
百度未公开文心一言 / 百度 AI 搜索选择引用来源的标准,因此 profile 只覆盖其公开的搜索抓取要求,并在 `limitation` 字段中写明这一点,报告与卡片都会显示。
|
|
49
|
+
|
|
50
|
+
| 规则 | 权重 | 检查内容 |
|
|
51
|
+
|---|---|---|
|
|
52
|
+
| `baidu.baiduspider-access` | 4 | Baiduspider 是否被 robots.txt 允许;Baiduspider-render 是否被禁 |
|
|
53
|
+
| `baidu.robots-ascii` | 1 | robots.txt 规则值是否含中文(注释不计) |
|
|
54
|
+
| `baidu.sitemap` | 2 | 是否有可提交的 XML sitemap |
|
|
55
|
+
| `baidu.sitemap-at-root` | 1 | sitemap 是否位于站点根目录 |
|
|
56
|
+
| `baidu.server-stability` | 2 | 抓取是否稳定返回 4xx 以下状态 |
|
|
57
|
+
| `baidu.server-rendered-content` | 2 | 正文是否直接输出,不依赖脚本 |
|
|
58
|
+
| `baidu.title-description` | 1 | TDK 中的标题与描述是否完整 |
|
|
59
|
+
| `baidu.mobile-friendly` | 1 | 是否声明 meta viewport |
|
|
60
|
+
|
|
61
|
+
源码:[lib/platforms/baidu.js](../lib/platforms/baidu.js)。
|
|
62
|
+
|
|
46
63
|
## 下一步实现顺序
|
|
47
64
|
|
|
48
|
-
1.
|
|
49
|
-
2.
|
|
50
|
-
3.
|
|
65
|
+
1. OpenAI / Perplexity 只做 crawler 与 robots 控制检查(`OAI-SearchBot` 与 `GPTBot` 分开);
|
|
66
|
+
2. 把各平台 profile 的成熟度与 `limitation` 显示到结果卡与报告中;
|
|
67
|
+
3. 给 CI 加 GitHub Action,支撑“回归门禁”定位;
|
|
51
68
|
4. 后续接 Search Console / Bing Webmaster / 百度平台数据时,放入独立“效果数据”模块,不混入 HTML 结构评分。
|
package/docs/index.json
CHANGED
package/index.js
CHANGED
|
@@ -252,6 +252,66 @@ 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
|
+
...(platform.limitation ? { limitation: platform.limitation } : {}),
|
|
281
|
+
})),
|
|
282
|
+
actions: (value.topActions ?? []).slice(0, 3).map((action) => ({
|
|
283
|
+
ruleId: action.ruleId,
|
|
284
|
+
dimensionTitle: action.dimensionTitle,
|
|
285
|
+
title: action.title,
|
|
286
|
+
evidence: action.evidence,
|
|
287
|
+
fix: action.fix,
|
|
288
|
+
})),
|
|
289
|
+
comparison: value.comparison ?? null,
|
|
290
|
+
paths: value.paths ?? {},
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/** Presentation payload for the fix-plan card. */
|
|
295
|
+
export function planPresentation(value) {
|
|
296
|
+
return {
|
|
297
|
+
kind: 'geo-fix-plan',
|
|
298
|
+
url: value.url,
|
|
299
|
+
total: value.total,
|
|
300
|
+
grade: value.grade,
|
|
301
|
+
actionCount: value.actionCount,
|
|
302
|
+
actions: (value.topActions ?? []).slice(0, 3).map((action) => ({
|
|
303
|
+
ruleId: action.ruleId,
|
|
304
|
+
dimensionTitle: action.dimensionTitle,
|
|
305
|
+
title: action.title,
|
|
306
|
+
evidence: action.evidence,
|
|
307
|
+
fix: action.fix,
|
|
308
|
+
})),
|
|
309
|
+
comparison: value.comparison ?? null,
|
|
310
|
+
planPath: value.planPath,
|
|
311
|
+
jsonPath: value.jsonPath,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
|
|
255
315
|
export function apply(ctx, config) {
|
|
256
316
|
const scanDefinition = {
|
|
257
317
|
name: 'geo_scan',
|
|
@@ -262,7 +322,7 @@ export function apply(ctx, config) {
|
|
|
262
322
|
'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
323
|
].join(' '),
|
|
264
324
|
parameters: scanParameters,
|
|
265
|
-
output: { schema: scanOutputSchema, render: scanRender },
|
|
325
|
+
output: { schema: scanOutputSchema, render: scanRender, presentationMeta: (args, value) => scanPresentation(value) },
|
|
266
326
|
timeoutMs: 180_000,
|
|
267
327
|
async execute(args, exec) {
|
|
268
328
|
if (exec.signal.aborted) throw exec.signal.reason ?? new Error('scan aborted');
|
|
@@ -340,7 +400,7 @@ export function apply(ctx, config) {
|
|
|
340
400
|
'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
401
|
].join(' '),
|
|
342
402
|
parameters: planParameters,
|
|
343
|
-
output: { schema: planOutputSchema, render: planRender },
|
|
403
|
+
output: { schema: planOutputSchema, render: planRender, presentationMeta: (args, value) => planPresentation(value) },
|
|
344
404
|
async execute(args, exec) {
|
|
345
405
|
if (exec.signal.aborted) throw exec.signal.reason ?? new Error('plan aborted');
|
|
346
406
|
const input = args !== null && typeof args === 'object' ? args : {};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Baidu Search profile.
|
|
3
|
+
*
|
|
4
|
+
* Separate from the Core score: nothing here changes a site's Core total.
|
|
5
|
+
*
|
|
6
|
+
* Scope discipline: only what Baidu documents publicly for its search and
|
|
7
|
+
* webmaster platform is checked. Baidu has not published how 文心一言 / 百度 AI
|
|
8
|
+
* 搜索 choose which pages to cite, so no rule here claims to model that. The
|
|
9
|
+
* profile's `limitation` states this and the UI shows it.
|
|
10
|
+
*
|
|
11
|
+
* Sources (retrieved 2026-11-29):
|
|
12
|
+
* - 百度搜索引擎优化指南 2.0
|
|
13
|
+
* https://ziyuan.baidu.com/college/articleinfo?id=193
|
|
14
|
+
* - 百度移动搜索建站优化白皮书
|
|
15
|
+
* https://ziyuan.baidu.com/college/articleinfo?id=2315
|
|
16
|
+
* - 百度搜索资源平台:普通收录 / sitemap / 主动推送说明
|
|
17
|
+
* https://ziyuan.baidu.com/college/videoinfo?id=3159
|
|
18
|
+
*/
|
|
19
|
+
export const BAIDU_PROFILE = {
|
|
20
|
+
id: 'baidu',
|
|
21
|
+
title: '百度搜索',
|
|
22
|
+
limitation: '百度未公开文心一言 / 百度 AI 搜索选择引用来源的标准,本 profile 只检查其公开的搜索抓取与提交要求,不代表百度 AI 的引用结果。',
|
|
23
|
+
sources: [
|
|
24
|
+
'https://ziyuan.baidu.com/college/articleinfo?id=193',
|
|
25
|
+
'https://ziyuan.baidu.com/college/articleinfo?id=2315',
|
|
26
|
+
'https://ziyuan.baidu.com/college/videoinfo?id=3159',
|
|
27
|
+
],
|
|
28
|
+
rules: [
|
|
29
|
+
{
|
|
30
|
+
id: 'baidu.baiduspider-access',
|
|
31
|
+
weight: 4,
|
|
32
|
+
title: 'Baiduspider 可抓取',
|
|
33
|
+
fix: '在 robots.txt 中允许 Baiduspider 抓取公开页面;百度 PC 与移动端统一使用该 UA,封锁会让站点无法进入索引。',
|
|
34
|
+
evaluate({ scan }) {
|
|
35
|
+
if (!scan.robots.found) return { status: 'pass', evidence: '无 robots.txt,默认允许 Baiduspider' };
|
|
36
|
+
if (scan.robots.unreachable) return { status: 'warn', evidence: 'robots.txt 不可访问,Baiduspider 抓取可能受阻' };
|
|
37
|
+
const access = scan.robots.baiduspider ?? { allowed: true, renderAllowed: true };
|
|
38
|
+
if (access.allowed === false) return { status: 'fail', evidence: 'robots.txt 明确禁止 Baiduspider 抓取' };
|
|
39
|
+
if (access.renderAllowed === false) return { status: 'warn', evidence: 'Baiduspider 可抓取,但 Baiduspider-render 被禁止' };
|
|
40
|
+
return { status: 'pass', evidence: 'robots.txt 允许 Baiduspider' };
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: 'baidu.robots-ascii',
|
|
45
|
+
weight: 1,
|
|
46
|
+
title: 'robots.txt 不含中文字符',
|
|
47
|
+
fix: '百度蜘蛛不支持 robots.txt 中的中文字符;用 ASCII 路径书写规则,中文路径用 URL 编码形式。',
|
|
48
|
+
evaluate({ scan }) {
|
|
49
|
+
if (!scan.robots.found) return { status: 'skip', evidence: '没有 robots.txt,规则无需编码' };
|
|
50
|
+
// Only rule values matter: Baidu reads paths, not comments, so a Chinese
|
|
51
|
+
// comment after `#` is harmless.
|
|
52
|
+
const effective = (scan.robots.text ?? '')
|
|
53
|
+
.split(/\r?\n/)
|
|
54
|
+
.map((line) => line.replace(/#.*$/, ''))
|
|
55
|
+
.join('\n');
|
|
56
|
+
const cjk = effective.match(/[\u3400-\u4dbf\u4e00-\u9fff\u3040-\u30ff]/g);
|
|
57
|
+
if (cjk && cjk.length > 0) {
|
|
58
|
+
return { status: 'warn', evidence: `robots.txt 规则值含 ${cjk.length} 个中日文字符,百度蜘蛛可能无法解析` };
|
|
59
|
+
}
|
|
60
|
+
return { status: 'pass', evidence: 'robots.txt 规则值全部为 ASCII 字符' };
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: 'baidu.sitemap',
|
|
65
|
+
weight: 2,
|
|
66
|
+
title: 'XML sitemap 可供百度提交',
|
|
67
|
+
fix: '在网站根目录提供 XML 或 TXT sitemap,并在百度搜索资源平台提交;sitemap 用于缩短发现时间,不保证收录。',
|
|
68
|
+
evaluate({ scan }) {
|
|
69
|
+
if (scan.sitemap.valid) return { status: 'pass', evidence: `${scan.sitemap.urlCount} 个 URL(${scan.sitemap.url})` };
|
|
70
|
+
if (scan.sitemap.found) return { status: 'warn', evidence: 'sitemap 可访问但没有解析出有效 URL' };
|
|
71
|
+
return { status: 'fail', evidence: '未找到可用的 XML sitemap' };
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 'baidu.sitemap-at-root',
|
|
76
|
+
weight: 1,
|
|
77
|
+
title: 'sitemap 位于站点根目录',
|
|
78
|
+
fix: '百度要求 sitemap 放在网站根目录(/sitemap.xml 或 /sitemap.txt);放到子目录需要额外提交工具支持。',
|
|
79
|
+
evaluate({ scan }) {
|
|
80
|
+
if (!scan.sitemap.found) return { status: 'skip', evidence: '没有可用 sitemap' };
|
|
81
|
+
let path = null;
|
|
82
|
+
try {
|
|
83
|
+
path = new URL(scan.sitemap.url).pathname;
|
|
84
|
+
} catch {
|
|
85
|
+
path = null;
|
|
86
|
+
}
|
|
87
|
+
if (path === null) return { status: 'skip', evidence: 'sitemap 地址无法解析' };
|
|
88
|
+
const depth = path.split('/').filter(Boolean).length;
|
|
89
|
+
if (depth === 1) return { status: 'pass', evidence: `sitemap 位于根目录:${path}` };
|
|
90
|
+
return { status: 'warn', evidence: `sitemap 不在根目录:${path}` };
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: 'baidu.server-stability',
|
|
95
|
+
weight: 2,
|
|
96
|
+
title: '抓取返回稳定状态码',
|
|
97
|
+
fix: '保证 Baiduspider 访问公开页面时稳定返回 200;频繁 5xx 或超时会导致抓取频次下降。',
|
|
98
|
+
evaluate({ pages, scan }) {
|
|
99
|
+
if (!Array.isArray(pages) || pages.length === 0) {
|
|
100
|
+
return { status: 'fail', evidence: scan.blockedByRobots ? 'robots.txt 拒绝了扫描,无法验证抓取稳定性' : '未抓取到页面' };
|
|
101
|
+
}
|
|
102
|
+
const serverErrors = pages.filter((page) => page.status >= 500);
|
|
103
|
+
const notFound = pages.filter((page) => page.status === 404);
|
|
104
|
+
if (serverErrors.length > 0) {
|
|
105
|
+
return { status: 'fail', evidence: `${serverErrors.length} 个页面返回 5xx` };
|
|
106
|
+
}
|
|
107
|
+
if (notFound.length > 0) {
|
|
108
|
+
return { status: 'warn', evidence: `${notFound.length} 个页面返回 404` };
|
|
109
|
+
}
|
|
110
|
+
return { status: 'pass', evidence: `${pages.length} 个页面均在 4xx 以下` };
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: 'baidu.server-rendered-content',
|
|
115
|
+
weight: 2,
|
|
116
|
+
title: '正文直接输出,不依赖脚本',
|
|
117
|
+
fix: '把正文放进服务端输出的 HTML(直出);百度虽能渲染部分 JS 页面,但直出内容抓取更稳定。',
|
|
118
|
+
evaluate({ primary }) {
|
|
119
|
+
if (!primary) return { status: 'fail', evidence: '未抓取到 HTML 入口页' };
|
|
120
|
+
const length = primary.facts.contentLength ?? primary.facts.textLength;
|
|
121
|
+
if (length >= 600) return { status: 'pass', evidence: `原始 HTML 含 ${length} 字正文` };
|
|
122
|
+
if (length >= 250) return { status: 'warn', evidence: `原始 HTML 仅 ${length} 字正文` };
|
|
123
|
+
return { status: 'fail', evidence: `原始 HTML 仅 ${length} 字正文,正文依赖脚本渲染` };
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
id: 'baidu.title-description',
|
|
128
|
+
weight: 1,
|
|
129
|
+
title: '标题与描述完整',
|
|
130
|
+
fix: '每个页面输出明确的 <title> 与 meta description;百度在页面分析阶段会提取 TDK 信息。',
|
|
131
|
+
evaluate({ primary }) {
|
|
132
|
+
if (!primary) return { status: 'fail', evidence: '未抓取到 HTML 入口页' };
|
|
133
|
+
const hasTitle = Boolean(primary.facts.title) && primary.facts.titleLength >= 6;
|
|
134
|
+
const hasDescription = [...(primary.facts.description ?? '')].length >= 30;
|
|
135
|
+
if (hasTitle && hasDescription) {
|
|
136
|
+
return { status: 'pass', evidence: `标题 ${primary.facts.titleLength} 字 / 描述 ${[...primary.facts.description].length} 字` };
|
|
137
|
+
}
|
|
138
|
+
if (hasTitle) return { status: 'warn', evidence: '有标题,但描述缺失或过短' };
|
|
139
|
+
return { status: 'fail', evidence: '标题缺失或过短' };
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
id: 'baidu.mobile-friendly',
|
|
144
|
+
weight: 1,
|
|
145
|
+
title: '移动端视口声明',
|
|
146
|
+
fix: '在 <head> 中声明 <meta name="viewport">;百度移动搜索建站规范要求页面在移动端可正常浏览。',
|
|
147
|
+
evaluate({ primary }) {
|
|
148
|
+
if (!primary) return { status: 'fail', evidence: '未抓取到 HTML 入口页' };
|
|
149
|
+
if (primary.facts.metaViewport) return { status: 'pass', evidence: primary.facts.metaViewport.slice(0, 80) };
|
|
150
|
+
return { status: 'warn', evidence: '缺少 meta viewport,移动端适配可能不完整' };
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
],
|
|
154
|
+
};
|
package/lib/platforms/index.js
CHANGED
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
* site's Core total. Every profile declares its official sources, and each
|
|
6
6
|
* rule returns evidence, a repair hint and an explicit status.
|
|
7
7
|
*/
|
|
8
|
+
import { BAIDU_PROFILE } from './baidu.js';
|
|
8
9
|
import { BING_PROFILE } from './bing.js';
|
|
9
10
|
|
|
10
|
-
export const PLATFORM_PROFILES = [BING_PROFILE];
|
|
11
|
+
export const PLATFORM_PROFILES = [BING_PROFILE, BAIDU_PROFILE];
|
|
11
12
|
|
|
12
13
|
const STATUS_FACTOR = { pass: 1, warn: 0.5, fail: 0, skip: 0 };
|
|
13
14
|
|
|
@@ -48,6 +49,7 @@ function scoreProfile(profile, ctx) {
|
|
|
48
49
|
id: profile.id,
|
|
49
50
|
title: profile.title,
|
|
50
51
|
sources: [...profile.sources],
|
|
52
|
+
...(profile.limitation ? { limitation: profile.limitation } : {}),
|
|
51
53
|
total,
|
|
52
54
|
scored: applicable > 0,
|
|
53
55
|
counts: {
|
package/lib/report.js
CHANGED
|
@@ -309,6 +309,11 @@ export function renderAuditMarkdown(report, context = {}) {
|
|
|
309
309
|
}
|
|
310
310
|
lines.push('');
|
|
311
311
|
}
|
|
312
|
+
const limitations = report.platforms.filter((platform) => platform.limitation);
|
|
313
|
+
for (const platform of limitations) {
|
|
314
|
+
lines.push(`> ${platform.title}:${escapeInline(platform.limitation)}`);
|
|
315
|
+
}
|
|
316
|
+
if (limitations.length > 0) lines.push('');
|
|
312
317
|
lines.push('平台检查只反映该平台公开文档中的可验证事项,不代表该平台的排名或引用结果。');
|
|
313
318
|
lines.push('');
|
|
314
319
|
}
|
|
@@ -381,6 +386,7 @@ export function summarizeReport(report, options = {}) {
|
|
|
381
386
|
title: platform.title,
|
|
382
387
|
total: platform.total,
|
|
383
388
|
counts: platform.counts,
|
|
389
|
+
...(platform.limitation ? { limitation: platform.limitation } : {}),
|
|
384
390
|
actions: platform.actions.slice(0, 3).map((action) => ({
|
|
385
391
|
ruleId: action.id,
|
|
386
392
|
title: action.title,
|
package/lib/robots.js
CHANGED
|
@@ -200,6 +200,21 @@ export function bingbotAccess(robots) {
|
|
|
200
200
|
};
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
+
/**
|
|
204
|
+
* Baidu crawler access at the site root.
|
|
205
|
+
*
|
|
206
|
+
* Baidu documents a single `Baiduspider` user agent for PC and mobile, plus
|
|
207
|
+
* `Baiduspider-render` for its renderer. Both are checked at `/` because the
|
|
208
|
+
* audit's own entry page is what must stay reachable.
|
|
209
|
+
* @param {ReturnType<typeof parseRobots>} robots
|
|
210
|
+
*/
|
|
211
|
+
export function baiduspiderAccess(robots) {
|
|
212
|
+
return {
|
|
213
|
+
allowed: isAllowed(robots, '/', 'Baiduspider'),
|
|
214
|
+
renderAllowed: isAllowed(robots, '/', 'Baiduspider-render'),
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
|
|
203
218
|
/**
|
|
204
219
|
* True when the file forbids the whole site to everyone.
|
|
205
220
|
* @param {ReturnType<typeof parseRobots>} robots
|
package/lib/scan.js
CHANGED
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
|
|
14
14
|
import { analyzeHtml } from './html.js';
|
|
15
15
|
import { createTransport, DEFAULT_USER_AGENT, FetchError } from './fetch.js';
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
aiCrawlerPolicy, baiduspiderAccess, bingbotAccess, blocksEverything, crawlDelayMs,
|
|
18
|
+
googlebotAccess, isAllowed, parseRobots,
|
|
19
|
+
} from './robots.js';
|
|
17
20
|
|
|
18
21
|
export const SCAN_VERSION = 'scan@1';
|
|
19
22
|
|
|
@@ -239,6 +242,7 @@ export async function scanSite(input, options = {}) {
|
|
|
239
242
|
aiCrawlers: robotsFound ? aiCrawlerPolicy(robots, new URL(startUrl).pathname) : [],
|
|
240
243
|
googlebot: robotsFound ? googlebotAccess(robots) : { allowed: true, imageAllowed: true },
|
|
241
244
|
bingbot: robotsFound ? bingbotAccess(robots) : { allowed: true, previewAllowed: true },
|
|
245
|
+
baiduspider: robotsFound ? baiduspiderAccess(robots) : { allowed: true, renderAllowed: true },
|
|
242
246
|
crawlDelayMs: robotsFound ? crawlDelayMs(robots, settings.userAgent) : 0,
|
|
243
247
|
sitemapDeclarations: robots.sitemaps.slice(0, 10),
|
|
244
248
|
unreachable: robotsUnreachable,
|
|
@@ -300,6 +304,7 @@ export async function scanSite(input, options = {}) {
|
|
|
300
304
|
aiCrawlers: robotsFound ? aiCrawlerPolicy(robots, new URL(startUrl).pathname) : [],
|
|
301
305
|
googlebot: robotsFound ? googlebotAccess(robots) : { allowed: true, imageAllowed: true },
|
|
302
306
|
bingbot: robotsFound ? bingbotAccess(robots) : { allowed: true, previewAllowed: true },
|
|
307
|
+
baiduspider: robotsFound ? baiduspiderAccess(robots) : { allowed: true, renderAllowed: true },
|
|
303
308
|
crawlDelayMs: robotsFound ? crawlDelayMs(robots, settings.userAgent) : 0,
|
|
304
309
|
sitemapDeclarations: robots.sitemaps.slice(0, 10),
|
|
305
310
|
unreachable: settings.respectRobots && (robotsStatus === 0 || robotsStatus >= 500),
|
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.5.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": {
|