@cobola/dsh-geo 0.0.0-stage → 0.2.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.
@@ -0,0 +1,4 @@
1
+ - insert:
2
+ - id: dsh-geo
3
+ name: '@cobola/dsh-geo'
4
+ config: {}
package/docs/CI.md ADDED
@@ -0,0 +1,118 @@
1
+ # 在 CI 里跑 GEO 体检
2
+
3
+ 在相同工具版本、扫描配置、目标内容和参考时间下,CI 与本地/agent 得到可复现结果。它适合做两件事:
4
+
5
+ 1. **不倒退**:PR 里跑一次,低于阈值直接失败;
6
+ 2. **验证修复**:用固定的 `--now` 对比改动前后的分数,把变化归因到代码。
7
+
8
+ 该包已发布到 npm,可直接作为开发依赖安装。
9
+
10
+ ## 方式 A:从 npm 安装(推荐)
11
+
12
+ ```sh
13
+ npm install --save-dev @cobola/dsh-geo
14
+ npx dsh-geo --version
15
+ ```
16
+
17
+ ## 方式 B:在 CI 里 checkout 工具仓库
18
+
19
+ ```yaml
20
+ name: GEO audit
21
+
22
+ on:
23
+ pull_request:
24
+ workflow_dispatch:
25
+
26
+ jobs:
27
+ geo:
28
+ runs-on: ubuntu-latest
29
+ env:
30
+ SITE: https://journal123.com
31
+ steps:
32
+ - uses: actions/checkout@v4
33
+
34
+ - uses: actions/setup-node@v4
35
+ with:
36
+ node-version: 22
37
+
38
+ - name: Checkout dsh-geo
39
+ uses: actions/checkout@v4
40
+ with:
41
+ repository: <your-org>/dsh-geo
42
+ path: .dsh-geo-tool
43
+
44
+ - name: Install tool
45
+ run: npm --prefix .dsh-geo-tool ci
46
+
47
+ - name: Audit site
48
+ run: |
49
+ node .dsh-geo-tool/bin/dsh-geo.js scan "$SITE" \
50
+ --save \
51
+ --now <REFERENCE_TIME> # 固定一个基线时间,复扫时沿用同一值 \
52
+ --fail-under 80
53
+
54
+ - name: Upload report
55
+ if: always()
56
+ uses: actions/upload-artifact@v4
57
+ with:
58
+ name: geo-report
59
+ path: .dsh-geo/
60
+
61
+ - name: Job summary
62
+ if: always()
63
+ run: cat .dsh-geo/report.md >> "$GITHUB_STEP_SUMMARY"
64
+ ```
65
+
66
+ ### 保留基线,才能看 diff
67
+
68
+ `--save` 每次都会把结果写进 `.dsh-geo/latest.json` 并和**上一次**对比。CI 的 runner 是无状态的,所以要让 diff 有意义,选一种基线策略:
69
+
70
+ - **提交基线**:把 `.dsh-geo/latest.json` 提交进站点仓库(只提交这一个文件,`history/` 不提交),每次体检的 diff 就对照仓库里的基线;需要更新基线时单独开 PR。
71
+ - **缓存**:用 `actions/cache` 缓存 `.dsh-geo/`,key 用分支名。缓存可能被淘汰,适合“看趋势”而不是“卡阈值”。
72
+ - **构建产物**:上一次 workflow 的报告作为 artifact 下载回来,再 `dsh-geo diff`。
73
+
74
+ 只提交 `latest.json` 的写法:
75
+
76
+ ```yaml
77
+ - name: Use committed baseline
78
+ run: |
79
+ mkdir -p .dsh-geo
80
+ if [ -f geo-baseline.json ]; then cp geo-baseline.json .dsh-geo/latest.json; fi
81
+ ```
82
+
83
+ ## 阈值与退出码
84
+
85
+ | 退出码 | 含义 |
86
+ |---|---|
87
+ | 0 | 扫描完成且分数达标(或未设 `--fail-under`) |
88
+ | 1 | 扫描/运行错误 |
89
+ | 2 | 用法错误 |
90
+ | 3 | 分数低于 `--fail-under` |
91
+
92
+ 建议先观察一段时间再设阈值:`--fail-under 80` 对 `good-static` 这种满分站点有意义,对刚起步的站点会一直红。更稳妥的做法是**只卡回归**:把基线存下来,用 `diff` 的输出判断 `regressed` 是否为空。
93
+
94
+ ## 可复现的 `--now`
95
+
96
+ `--now` 只影响“内容时效”检查。CI 里固定它有两个好处:
97
+
98
+ - 同一提交重复跑,产物逐字节一致,适合缓存和 diff;
99
+ - 比较两次提交时,分数变化不会混入“时间过去了几个月”。
100
+
101
+ 固定值不需要是今天;它代表“这次体检把哪一天当作参考时间”。
102
+
103
+ ## 安全与数据
104
+
105
+ - 扫描只写 `.dsh-geo/`,不会碰站点仓库的其它文件;`--dir` 也只能指向 `.dsh-geo/` 内部。
106
+ - 默认遵守 robots.txt、拒绝私网/元数据地址、限速限体积;CI 里不要用 `--no-robots` 或 `--allow-private` 去扫不属于你的站点。
107
+ - 报告包含页面正文摘录(`latest.json` 的 `scan.pages[].facts.text`)。如果站点有未公开内容,上传 artifact 前先确认权限。
108
+
109
+ ## 定时体检
110
+
111
+ 不需要额外服务:用 GitHub Actions 的 `schedule` 每天跑一次,结果作为 artifact 或写入一个单独的报告仓库即可。
112
+
113
+ ```yaml
114
+ on:
115
+ schedule:
116
+ - cron: '17 2 * * 1'
117
+ workflow_dispatch:
118
+ ```
package/docs/GOOGLE.md ADDED
@@ -0,0 +1,57 @@
1
+ # Google 生成式 AI 搜索指南对照
2
+
3
+ 本项目把 Google Search Central 的《[Optimizing for generative AI features on Google Search](https://developers.google.com/search/docs/fundamentals/ai-optimization-guide)》当作**规范性上游指南**,但不把每条建议误写成“排名硬门槛”。该页面最后更新于 2026-07-10;复核日期:2026-11-29。
4
+
5
+ ## Google 明确要求/强调的基础
6
+
7
+ | Google 指南重点 | dsh-geo 对应检查/行为 |
8
+ |---|---|
9
+ | 生成式 AI 功能建立在 Google Search 的索引、排名与质量系统之上 | `disc.indexable`、`disc.robots-not-blocking-site`、`disc.googlebot-accessible`、sitemap、canonical、HTTP 状态 |
10
+ | 页面必须满足 Search 技术要求,并能被索引、展示 snippet | 原始 HTML 状态、noindex、robots、canonical、标题/description、内链 |
11
+ | 内容必须可抓取;大型/高频站点关注 crawl budget | robots、crawl-delay、限速、sitemap 覆盖、页面抓取结果 |
12
+ | 创建独特、非同质、可靠、以人为本的内容 | `cite.authority-sources`、作者/日期、数字证据、段落结构;规则只做可观察代理,不声称能判断“内容质量真相” |
13
+ | 内容按段落、章节组织,帮助读者阅读 | 标题层级、语义容器、段落/列表/表格结构 |
14
+ | 图片/视频在合适时提供高质量、相关内容 | 图片 alt 与 OpenGraph 检查;当前不做视觉质量判断 |
15
+ | JavaScript 可以被 Google 处理,但 JavaScript SEO 更复杂 | `parse.raw-content` 明确标注“非 JS 引用管线”风险;它不是 Googlebot 必然失败判断 |
16
+ | 页面体验、设备适配、延迟和主内容辨识度重要 | 当前扫描只做原始 HTML;Core Web Vitals/真实渲染列为明确边界,不伪装成已检查 |
17
+ | 减少重复内容、避免浪费抓取资源 | `parse.duplicate-metadata`、canonical、sitemap 覆盖 |
18
+ | 本地业务/电商场景使用 Business Profile、Merchant Center 和 feed | 当前通用引擎不连接这些账户;实体 schema/feed 只作为可选辅助信号 |
19
+
20
+ ## Google 明确说“不需要”的东西
21
+
22
+ 这些内容不能继续被当作 Google AI 的强制规则:
23
+
24
+ - **`llms.txt`/特殊 AI 文件**:Google 明确说 Search 不使用它们。dsh-geo 仍可检查它,因为它对其他 agent/工具可能有用,但现在是 `skip`/可选项,不会惩罚没有它的站点。
25
+ - **为 AI 切分内容 / chunking**:Google 说不需要把内容切成小块。`cite.snippet-ready` 只作为可摘录性参考,缺失不再硬扣分。
26
+ - **专门为 AI 重写措辞、覆盖所有长尾 query**:Google 说系统理解同义词和一般含义。dsh-geo 不检查关键词密度,也不建议制造 query 变体页。
27
+ - **不真实的外部提及**:Google 反对操纵性 mentions。dsh-geo 不做外链/提及数量库,也不把外链数量当成增长目标。
28
+ - **特殊 schema**:Google 说生成式 AI 不需要特殊 schema。结构化数据只检查语法、实体和富结果辅助价值,不把缺 schema 视为 Google AI 必然不可见。
29
+
30
+ ## robots 与 AI 爬虫的解释
31
+
32
+ Google 指南的关键是:**Google Search 能抓取并索引公开内容**。因此:
33
+
34
+ - `Googlebot` / `Googlebot-Image` 的公开入口被禁止,属于高影响问题;
35
+ - GPTBot、ClaudeBot、PerplexityBot 等第三方 agent 是否允许,是站点所有者的策略选择,不是 Google 规则。dsh-geo 把它们作为 `warn`/策略提示,而不是“一律失败”;
36
+ - `robots.txt` 不可访问时工具遵循 RFC 9309 的保守策略,停止抓取并给出证据;
37
+ - `--no-robots`/私网开关只用于站点所有者明确授权的本地或预发环境。
38
+
39
+ ## 当前仍不是 Google Search Console 数据
40
+
41
+ 截图类效果面板(总分趋势、五维变化、修复/回归)读取本地 `.dsh-geo/dashboard.json`,它展示的是**站点结构体检历史**,不是:
42
+
43
+ - GSC clicks/impressions;
44
+ - AI Overviews / AI Mode 的真实曝光;
45
+ - Perplexity/ChatGPT/Claude 的真实引用或排名;
46
+ - Google Search 的最终质量/排名判断。
47
+
48
+ Google 建议使用 Search Console 的 Generative AI performance report 衡量生成式 AI 功能中的可见性。未来若接入该数据,必须单独设计凭证、隐私和数据来源,不把外部平台指标混进确定性 HTML 评分。
49
+
50
+ ## 结论
51
+
52
+ dsh-geo 的评分现在遵循“Google 基础 SEO 是地基,GEO hacks 不是规则”的原则:
53
+
54
+ 1. 对 Google 必需/高影响的抓取、索引、Googlebot、重复 URL 和可读结构给出明确 finding;
55
+ 2. 对可选的 llms.txt、feed、OpenGraph、schema、FAQ、摘要等给出辅助建议或 `skip`;
56
+ 3. 不承诺分数等于 Google 排名,也不把 Google 不使用的文件包装成 Google 规则;
57
+ 4. 看板展示本地修复效果,不伪造 GSC 或第三方 AI 流量数据。
@@ -0,0 +1,69 @@
1
+ # Publish dsh-geo to npm with GitHub OIDC
2
+
3
+ The repository uses npm Trusted Publishing so GitHub Actions receives a short-
4
+ lived OIDC credential instead of storing a long-lived npm publish token.
5
+
6
+ ## Repository details
7
+
8
+ - GitHub repository: `cobola/dsh-geo` (public)
9
+ - Workflow filename: `publish.yml`
10
+ - Workflow path: `.github/workflows/publish.yml`
11
+ - Package: `@cobola/dsh-geo`
12
+ - Registry: `https://registry.npmjs.org`
13
+
14
+ ## One-time npm setup
15
+
16
+ A package maintainer must configure the trust relationship on npmjs.com:
17
+
18
+ 1. Open **Packages → @cobola/dsh-geo → Settings → Trusted Publisher**.
19
+ 2. Select **GitHub Actions**.
20
+ 3. Enter organization/user `cobola`.
21
+ 4. Enter repository `dsh-geo`.
22
+ 5. Enter workflow filename `publish.yml` (filename only, not the path).
23
+ 6. Leave environment blank; this workflow does not use a GitHub environment.
24
+ 7. Enable the allowed action **npm publish**. New trusted publishers may only allow
25
+ staged publishing by default; this workflow uses direct publishing.
26
+ 8. Save the trusted publisher configuration.
27
+
28
+ npm requires a package settings page to configure this relationship. Since
29
+ `@cobola/dsh-geo@0.2.0` has not yet been published, the package may not have a settings
30
+ page yet. If npm does not allow adding a trusted publisher before the first
31
+ version exists, make one initial manual publication from a maintainer machine
32
+ with npm 2FA enabled, then immediately add the trusted publisher and use OIDC
33
+ for all subsequent versions. Do not add a long-lived publish token to GitHub.
34
+
35
+ A new trusted-publisher configuration must complete its first successful
36
+ workflow publish within npm's validation window (currently two days); otherwise
37
+ delete and recreate the configuration.
38
+
39
+ ## Release procedure
40
+
41
+ 1. Update `package.json` version and `CHANGELOG.md`.
42
+ 2. Run `npm ci`, `npm test`, `npm run docs`, and `npm pack --dry-run`.
43
+ 3. Commit and push the release changes to `main`.
44
+ 4. Create and push a matching version tag, for example:
45
+
46
+ ```sh
47
+ git tag -a v0.2.1 -m "Release @cobola/dsh-geo v0.2.1"
48
+ git push origin v0.2.1
49
+ ```
50
+
51
+ 5. GitHub Actions verifies the package and publishes it to npm using OIDC.
52
+ 6. Verify at `https://www.npmjs.com/package/@cobola/dsh-geo` and with:
53
+
54
+ ```sh
55
+ npm view @cobola/dsh-geo version --registry=https://registry.npmjs.org
56
+ ```
57
+
58
+ The workflow can also be started manually, but it still checks that the
59
+ workflow run is in the canonical `cobola/dsh-geo` repository and that the tag
60
+ matches `package.json`.
61
+
62
+ ## Security notes
63
+
64
+ - The workflow grants `id-token: write` only to the publishing job.
65
+ - No `NPM_TOKEN` secret is used.
66
+ - The workflow runs tests and checks generated documentation before publishing.
67
+ - npm provenance is generated automatically for public GitHub-hosted OIDC
68
+ publishes when supported by npm.
69
+ - Do not publish from forks; the workflow has a repository identity guard.
@@ -0,0 +1,40 @@
1
+ # 平台 profile 规划
2
+
3
+ ## 设计原则
4
+
5
+ `dsh-geo` 不把所有平台混成一个“AI 标准分”。报告分为:
6
+
7
+ 1. **Core**:跨平台基础抓取、索引、页面结构、重复 URL、正文和实体;
8
+ 2. **Google**:Google Search / AI features 的官方可验证事项;
9
+ 3. **Bing**:Bing / Copilot / grounding 的官方事项;
10
+ 4. **Baidu**:百度搜索资源平台和 Baiduspider 的官方事项;
11
+ 5. **Crawler controls**:OpenAI、Perplexity 等公开 crawler/robots 控制。
12
+
13
+ profile 是证据和检查边界,不自动改变 Core 总分。只有用户显式启用某个平台 profile,平台专属 finding 才显示。
14
+
15
+ ## 证据等级
16
+
17
+ - `official`:平台官方文档明确说明,可用于强规则;
18
+ - `advisory`:官方建议,但不是硬门槛;适合 warn;
19
+ - `experimental`:没有平台公开标准,只能作为实验观察,不进入核心分数。
20
+
21
+ 禁止从“社区 GEO 经验”推导未公开的引用排序公式。
22
+
23
+ ## 当前状态
24
+
25
+ | Profile | 状态 | 已有官方来源 | 当前范围 |
26
+ |---|---|---|---|
27
+ | Core | implemented | — | 通用抓取、索引、结构、实体 |
28
+ | Google | implemented | [Google AI Search guide](https://developers.google.com/search/docs/fundamentals/ai-optimization-guide) | Googlebot、Search 技术要求、Google 不需要的 GEO hacks 边界 |
29
+ | Bing | source-mapped | [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)、[IndexNow](https://www.bing.com/indexnow) | Bingbot、Copilot grounding、data-nosnippet、IndexNow |
30
+ | Baidu | source-mapped | [百度 SEO 指南](https://ziyuan.baidu.com/college/articleinfo?id=193undefinedpage%3D1&page=6)、[抓取友好](https://ziyuan.baidu.com/college/courseinfo?id=1399) | Baiduspider、资源平台、sitemap/提交;百度 AI 引用未公开 |
31
+ | OpenAI | source-mapped | [OpenAI crawlers](https://developers.openai.com/api/docs/bots) | OAI-SearchBot 与 GPTBot 分离控制 |
32
+ | Perplexity | source-mapped | [Perplexity crawlers](https://docs.perplexity.ai/docs/resources/perplexity-crawlers) | crawler 身份、robots 与抓取可达性 |
33
+
34
+ ## 下一步实现顺序
35
+
36
+ 1. 把当前 `lib/profiles.js` 作为证据注册表暴露给报告和面板;
37
+ 2. 加 `--profile google|bing|baidu|openai|perplexity`,默认只启用 Core + Google;
38
+ 3. 先实现 Bing 的官方事项(Bingbot、data-nosnippet、IndexNow 可发现性),但单独显示 profile 分数;
39
+ 4. 实现 Baidu Search profile,不声称百度 AI 引用规则已知;
40
+ 5. 后续接 Search Console / Bing Webmaster / 百度平台数据时,放入独立“效果数据”模块,不混入 HTML 结构评分。
package/docs/RULES.md ADDED
@@ -0,0 +1,108 @@
1
+ # GEO 评分规则(geo-rubric@1)
2
+
3
+ 本文件由 `scripts/gen-docs.mjs` 从 `lib/rules.js` 生成,请勿手工编辑。改规则后运行 `npm run docs`。
4
+
5
+ ## 1. 总分怎么算
6
+
7
+ 1. 每条规则返回一个状态:`pass`(通过)、`warn`(部分通过)、`fail`(失败)、`skip`(不适用)。
8
+ 2. 规则得分系数:通过 = 1,部分通过 = 0.5,失败 = 0,不适用 = 0。
9
+ 3. 维度分 = `已获得权重 ÷ 适用权重 × 100`,保留 1 位小数。`skip` 从分母中移除,避免“站点没有图片”这类无关项扣分。
10
+ 4. 总分 = `Σ(维度分 × 维度权重) ÷ 100`。维度权重固定为 **可发现性 25 / 可解析性 20 / 可引用性 25 / 实体与信任 15 / 机器说明书 15**。
11
+ 5. 等级:A+ ≥ 90,A ≥ 80,B ≥ 70,C ≥ 55,D ≥ 40,F < 40。
12
+
13
+ 评分是 `(扫描产物, 规则表, now)` 的纯函数:不调用模型、不读系统时钟、不做随机抽样。`now` 只影响时效性检查,调用方必须显式传入(CLI 的 `--now`)才能保证跨天复现。
14
+
15
+ ## 2. 规则表
16
+
17
+ 共 45 条规则。每条规则的通过条件、证据格式与失败阈值都在 `lib/rules.js` 的 `evaluate()` 中,运行时会把证据写进报告(`findings[].evidence`),因此报告本身就能说明为什么得分。
18
+
19
+ ### 可发现性(25 分)
20
+
21
+ | 规则 ID | 权重 | 检查项 | 修复建议 |
22
+ |---|---|---|---|
23
+ | `disc.robots-present` | 3 | robots.txt 可访问 | 在站点根目录发布 robots.txt,声明 Sitemap 与 AI 爬虫策略;返回 200 且为纯文本。 |
24
+ | `disc.robots-not-blocking-site` | 4 | robots.txt 未封禁站点 | 删掉对 Disallow: / 的全局封禁;只对确实需要保密的路径单独设置规则。 |
25
+ | `disc.ai-crawler-policy` | 3 | AI 爬虫策略明确 | 若希望被 AI 检索,在 robots.txt 显式 Allow GPTBot、ClaudeBot、PerplexityBot、Google-Extended 等;若刻意封闭,保留 Disallow 但需接受 AI 搜索不可见。 |
26
+ | `disc.googlebot-accessible` | 3 | Googlebot 可抓取 | 在 robots.txt 中允许 Googlebot 与 Googlebot-Image 抓取公开页面;这是 Google Search(包括生成式 AI 功能)的前提。 |
27
+ | `disc.sitemap-present` | 3 | XML sitemap 可用 | 发布 /sitemap.xml(或 sitemap index),每个 <url> 使用最终的可索引 URL,并在 robots.txt 里声明。 |
28
+ | `disc.sitemap-declared` | 2 | sitemap 已声明 | 在 robots.txt 增加 Sitemap: <绝对 URL>,或在首页 <link rel="sitemap"> / Link 响应头中声明。 |
29
+ | `disc.sitemap-covers-pages` | 2 | sitemap 覆盖已抓取页面 | 把被内链或导航暴露的可索引页面全部写进 sitemap,移除已 404/重定向的旧 URL。 |
30
+ | `disc.indexable` | 3 | 入口页可索引 | 入口页返回 200;移除 meta robots 与 X-Robots-Tag 中的 noindex/nofollow。 |
31
+ | `disc.canonical` | 2 | canonical 自指且为绝对地址 | 每个页面输出 <link rel="canonical" href="https://正式域名/该页路径">,与当前 URL 完全一致(含尾斜杠策略)。 |
32
+ | `disc.internal-links` | 3 | 入口页内链充分 | 在入口页用真实 <a href> 链接导航到核心页面(≥5 个),避免只在 JavaScript 里跳转。 |
33
+
34
+ ### 可解析性(20 分)
35
+
36
+ | 规则 ID | 权重 | 检查项 | 修复建议 |
37
+ |---|---|---|---|
38
+ | `parse.title` | 3 | <title> 长度合适 | 为每个页面写唯一的 <title>,10–65 个字符,包含主题词与品牌名。 |
39
+ | `parse.meta-description` | 2 | meta description 存在且合适 | 为每个页面输出 50–170 字的 <meta name="description">,概括该页回答的问题。 |
40
+ | `parse.lang` | 1 | <html lang> 已声明 | 在 <html> 上声明 lang(如 lang="zh-CN"),便于检索与语言匹配。 |
41
+ | `parse.h1` | 2 | 唯一且非空的主标题 | 每页保留一个 <h1> 作为主标题,用 <h2>/<h3> 组织小节。 |
42
+ | `parse.heading-order` | 2 | 标题层级连续 | 按 h1 → h2 → h3 顺序组织标题,不要从 h1 直接跳到 h4;每个小节都要有 h2。 |
43
+ | `parse.semantics` | 2 | 语义化正文容器 | 用 <main> 包裹正文、<article> 包裹独立内容,替代无语义的 <div> 堆叠。 |
44
+ | `parse.raw-content` | 3 | 无 JS 也能读到正文 | 服务端渲染或预渲染正文,保证不执行 JavaScript 的检索/引用管线也能读到 ≥600 字;Googlebot 能渲染 JS,但许多 AI 抓取器不能。 |
45
+ | `parse.pages-with-content` | 2 | 被抓取页面普遍含正文 | 确保列表页、详情页都在原始 HTML 中输出正文,而不是只输出加载骨架。 |
46
+ | `parse.duplicate-metadata` | 2 | 页面标题/描述不重复 | 为每个页面写唯一的 <title> 与 meta description;重复元数据会让检索系统难以区分页面,也浪费抓取预算。 |
47
+ | `parse.image-alt` | 2 | 图片 alt 覆盖 | 为所有内容图片补写描述性 alt;纯装饰图片使用 alt="" 并标记 role="presentation"。 |
48
+ | `parse.jsonld-syntax` | 2 | JSON-LD 语法有效 | 用 schema.org 词汇输出 application/ld+json,并在发布前用校验器检查括号与逗号。 |
49
+ | `parse.link-text` | 1 | 内链锚文本有描述性 | 把“点击这里/了解更多”改成能说明目标内容的锚文本,例如“GEO 评分方法”。 |
50
+
51
+ ### 可引用性(25 分)
52
+
53
+ | 规则 ID | 权重 | 检查项 | 修复建议 |
54
+ |---|---|---|---|
55
+ | `cite.qa-structure` | 3 | 问答结构 | 把用户真实提问写成 h2/h3,并用 FAQPage/HowTo 结构化数据标注问答对。 |
56
+ | `cite.summary` | 2 | 摘要 / TL;DR 区块 | 在正文开头加一段 2–4 句的摘要(class="summary" 或 TL;DR),让引用者能直接取用。 |
57
+ | `cite.numeric-evidence` | 3 | 可验证的数字证据 | 补充带单位的具体数字(百分比、耗时、样本量、版本号、日期),避免只有形容词。 |
58
+ | `cite.authority-sources` | 2 | 引用权威来源 | 在关键论断处链接一手来源(标准文档、官方文档、论文、政府/教育站点),并保持链接可访问。 |
59
+ | `cite.freshness` | 3 | 内容时效可判定 | 输出 datePublished/dateModified(JSON-LD 或 <time datetime>),并在正文中显示“最后更新日期”。 |
60
+ | `cite.author` | 2 | 作者署名可识别 | 在页面与 Article schema 中给出作者姓名、简介与主页;匿名内容很难被引用。 |
61
+ | `cite.anchors` | 2 | 章节可锚点引用 | 给每个 h2/h3 加语义化 id(如 id="geo-score"),方便引用到具体小节。 |
62
+ | `cite.structure` | 3 | 结构化排版与短段落 | 用表格、有序列表承载对比与步骤,段落控制在 120 词以内,便于模型截取。 |
63
+ | `cite.snippet-ready` | 3 | 小节答案可直接摘录 | 每个 h2 下紧跟 30–140 词的直接回答,再展开细节;避免先铺垫后给结论。 |
64
+
65
+ ### 实体与信任(15 分)
66
+
67
+ | 规则 ID | 权重 | 检查项 | 修复建议 |
68
+ |---|---|---|---|
69
+ | `trust.https` | 3 | 全站 HTTPS | 启用 HTTPS,把 HTTP 301 到 HTTPS,并提交 HSTS。 |
70
+ | `trust.org-schema` | 3 | 组织实体 schema | 用 Organization/LocalBusiness JSON-LD 声明 name、url、logo、sameAs,帮助实体消歧与富结果;Google 表示生成式 AI 不要求特殊 schema。 |
71
+ | `trust.contact` | 2 | 联系方式可找到 | 提供 /contact 页面、mailto: 或 schema contactPoint,并保持信息与实体注册一致。 |
72
+ | `trust.about` | 2 | About 页面可核实身份 | 提供 /about 页面,写明团队、公司主体、所在地与联系方式。 |
73
+ | `trust.security-headers` | 2 | 基础安全响应头 | 至少配置 HSTS(HTTPS)、Content-Security-Policy、X-Content-Type-Options: nosniff、Referrer-Policy。 |
74
+ | `trust.privacy` | 1 | 隐私政策可达 | 添加隐私政策页面并从页脚链接,说明数据用途与联系方式。 |
75
+ | `trust.sameas` | 2 | 外部身份背书 | 在 Organization sameAs 或 <link rel="me"> 中列出官方 GitHub、LinkedIn、X、维基数据等主页。 |
76
+
77
+ ### 机器说明书(15 分)
78
+
79
+ | 规则 ID | 权重 | 检查项 | 修复建议 |
80
+ |---|---|---|---|
81
+ | `manifest.llms-txt` | 2 | llms.txt(可选,非 Google 必需) | 可选:若需要服务非 Google 的 agent/工具,可发布 llms.txt(# 标题 + ## 分节 + Markdown 链接)。Google Search 明确不使用 llms.txt,不要把它当作 Google 排名手段。 |
82
+ | `manifest.llms-structure` | 1 | llms.txt 结构完整(可选) | 若提供 llms.txt,至少包含 2 个 ## 分节和 3 个指向正文的 Markdown 链接。注意:Google Search 不使用该文件。 |
83
+ | `manifest.structured-breadth` | 2 | schema.org 类型覆盖面(富结果) | 按页面类型输出 schema(Organization/WebSite、Article、FAQPage、BreadcrumbList),用于富结果与实体消歧。Google 明确表示生成式 AI 不需要特殊 schema。 |
84
+ | `manifest.og-cards` | 1 | OpenGraph / 分享卡片 | 为每个页面输出 og:title、og:description、og:image(1200×630)与 og:url。 |
85
+ | `manifest.feed` | 1 | 内容 feed(可选) | 发布 RSS/Atom feed,并用 <link rel="alternate" type="application/rss+xml"> 暴露;它服务于订阅与分发,不是 Google AI 的要求。 |
86
+ | `manifest.link-hints` | 1 | HTTP Link / Markdown 入口提示(可选) | 可选:在响应头加 Link: </llms.txt>; rel="llms",或提供 text/markdown alternate。Google Search 不使用这些提示。 |
87
+ | `manifest.entity-id` | 1 | 实体 @id 稳定 | 给 Organization/WebSite 分配稳定的 @id(如 https://example.com/#organization),所有页面复用同一 @id。 |
88
+
89
+ ## 3. fixture 与基线分数
90
+
91
+ 三个 fixture 在固定参考时间 `2026-06-15T00:00:00Z` 下的基线分数由 `test/fixtures.test.js` 锁定:
92
+
93
+ | fixture | 总分 | 等级 | 页数 | 说明 |
94
+ |---|---|---|---|---|
95
+ | `good-static` | 100.0 | A+ | 5 | 五维全部通过,用来证明满分可达 |
96
+ | `bad-spa` | 30.5 | F | 1 | 正文只在 JavaScript 里,抓取器看到空壳 |
97
+ | `bad-robots` | 77.4 | B | 5 | 内容可读;第三方 AI 爬虫封禁提示 warn,但 Googlebot 可抓取 |
98
+
99
+ 任何规则或 fixture 的改动都会让这些数字变化,测试会立即失败。要更新基线,必须先确认改动是**有意的**,再同时修改 fixture 与测试中的期望值。
100
+
101
+ ## 4. 扫描产物的边界
102
+
103
+ - 只读取原始 HTML,不渲染、不执行 JavaScript,因此规则看到的是检索管线看到的同一份内容。
104
+ - 抓取上限:默认 6 个页面、单响应 1.5 MB、单请求 10 秒(含整体截止时间)、同主机 250 ms 间隔;HTML 解析深度上限 256 层。
105
+ - robots.txt 默认对每一个请求生效,包括 `/llms.txt`、sitemap 和**每一次重定向跳转**。被拒绝的跳转不会被请求;入口被拒绝时扫描停止并标记 `blockedByRobots`。robots.txt 返回 5xx 或无法访问时按 RFC 9309 视为禁止抓取(可用 `--no-robots` 显式绕过);空 200 视为全站允许。
106
+ - 跨站重定向被拒绝(`FETCH_CROSS_SITE_REDIRECT`),只允许同站点升级:`http → https`、裸域 → `www`。接受同站点跳转时会先重新加载目标源的 robots.txt,再继续抓取。
107
+ - 目标地址必须是公网 http(s):拒绝回环、私网、链路本地、CGNAT、NAT64、6to4、Teredo、元数据地址;域名解析后钉在校验过的 IP 上,每个重定向跳转重新校验。请求走直连,不使用环境代理,避免代理代替我们解析/连接而绕过校验。
108
+ - 扫描引擎只返回 JSON 产物,本身不写文件。工具层(`geo_scan` / `geo_fix_plan`)与 CLI 的 `--save` 会把产物写入会话工作区的 `<cwd>/.dsh-geo/`:`latest.json`、`history/`、`report.md`、`fix-plan.md/.json`。路径被限制在 `.dsh-geo/` 内,越界会直接拒绝。
package/icon.svg ADDED
@@ -0,0 +1,8 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64" role="img" aria-label="GEO audit">
2
+ <rect x="2" y="2" width="60" height="60" rx="14" fill="#0d2f4f"/>
3
+ <circle cx="32" cy="32" r="19" fill="none" stroke="#5eead4" stroke-opacity="0.35" stroke-width="2"/>
4
+ <circle cx="32" cy="32" r="12" fill="none" stroke="#5eead4" stroke-opacity="0.6" stroke-width="2"/>
5
+ <path d="M32 32 L47 20" stroke="#5eead4" stroke-width="2.5" stroke-linecap="round"/>
6
+ <circle cx="32" cy="32" r="3" fill="#e6fffb"/>
7
+ <path d="M24 40 L29 45 L40 33" fill="none" stroke="#7ee787" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
8
+ </svg>