@cobola/dsh-geo 0.10.0 → 0.11.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 CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.0 - 2026-11-29
4
+
5
+ ### Features
6
+
7
+ - Add schema.org completeness checking: every typed entity is compared against
8
+ the properties its type actually needs (`Article` needs headline/author/
9
+ datePublished, `Product` needs name/offers, …), and the gap is named.
10
+ - Add page-type/schema matching. The inference uses observable signals only
11
+ (URL path, cart copy, FAQ entities) and is reported as a warning, never a hard
12
+ failure, because inference can be wrong.
13
+ - Add an optional WebMCP check (W3C Web Machine Learning CG draft): forms
14
+ declaring `toolname`/`tooldescription` are recognised. Plain search forms
15
+ report `skip`, not a defect.
16
+ - Rubric is now 56 checks: SEO 28, AEO 16, GEO 12.
17
+
18
+ ### Notes
19
+
20
+ - Google rich-result membership is encoded separately from schema.org
21
+ requirements, so the audit never implies a rich result it cannot verify.
22
+
23
+
3
24
  ## 0.10.0 - 2026-11-29
4
25
 
5
26
  ### Features
package/README.md CHANGED
@@ -167,7 +167,7 @@ dsh-geo ci https://journal123.com \
167
167
 
168
168
  ```yaml
169
169
  - uses: actions/checkout@v4
170
- - uses: cobola/dsh-geo@v0.10.0
170
+ - uses: cobola/dsh-geo@v0.11.0
171
171
  with:
172
172
  url: https://journal123.com
173
173
  baseline: geo-baseline.json
@@ -199,7 +199,7 @@ CLI 也随 npm 包提供:`npx @cobola/dsh-geo --help`;完整参数见 `dsh-g
199
199
  | 实体与信任 | 15 | 站点身份是否可核实(HTTPS、组织实体、联系方式、安全头) |
200
200
  | 机器说明书 | 15 | llms.txt、结构化数据、OpenGraph、feed、Link 提示 |
201
201
 
202
- 45 条可审计检查,维度内按权重归一化;`pass` 计 1、`warn` 计 0.5、`fail` 计 0、`skip` 移出分母。总分是五维加权平均。完整规则、阈值与修复建议见 **[docs/RULES.md](docs/RULES.md)**(由 `lib/rules.js` 生成)。
202
+ 56 条可审计检查,维度内按权重归一化;`pass` 计 1、`warn` 计 0.5、`fail` 计 0、`skip` 移出分母。总分是五维加权平均。完整规则、阈值与修复建议见 **[docs/RULES.md](docs/RULES.md)**(由 `lib/rules.js` 生成)。
203
203
 
204
204
  ### 内容生成器(可选)
205
205
 
@@ -275,6 +275,8 @@ lib/html.js 无依赖 HTML 解析与事实抽取
275
275
  lib/scan.js 抓取流程
276
276
  lib/rules.js 45 条 Core 规则(唯一事实源)
277
277
  lib/platforms/ 平台 profile(Bing、百度、OpenAI、Perplexity 已实现)
278
+ lib/schema.js schema.org 字段完整性、页面类型匹配
279
+ lib/generate.js llms.txt 与 FAQ JSON-LD 生成器
278
280
  lib/ci.js CI 审计、基线与质量门禁
279
281
  lib/mcp.js stdio MCP server(零依赖手写 JSON-RPC)
280
282
  bin/dsh-geo-mcp.js MCP 二进制入口
package/docs/CI.md CHANGED
@@ -123,7 +123,7 @@ on:
123
123
 
124
124
  ```yaml
125
125
  - uses: actions/checkout@v4
126
- - uses: cobola/dsh-geo@v0.10.0
126
+ - uses: cobola/dsh-geo@v0.11.0
127
127
  with:
128
128
  url: https://journal123.com
129
129
  baseline: geo-baseline.json
package/docs/RULES.md CHANGED
@@ -1,4 +1,4 @@
1
- # GEO 评分规则(geo-rubric@2)
1
+ # GEO 评分规则(geo-rubric@3)
2
2
 
3
3
  本文件由 `scripts/gen-docs.mjs` 从 `lib/rules.js` 生成,请勿手工编辑。改规则后运行 `npm run docs`。
4
4
 
@@ -14,7 +14,7 @@
14
14
 
15
15
  ## 2. 规则表
16
16
 
17
- 共 53 条规则,分归三个支柱:SEO 26 条、AEO 16 条、GEO 11 条。支柱是同一批规则的第二个视图,不改变 Core 总分。每条规则的通过条件、证据格式与失败阈值都在 `lib/rules.js` 的 `evaluate()` 中,运行时会把证据写进报告(`findings[].evidence`),因此报告本身就能说明为什么得分。
17
+ 共 56 条规则,分归三个支柱:SEO 28 条、AEO 16 条、GEO 12 条。支柱是同一批规则的第二个视图,不改变 Core 总分。每条规则的通过条件、证据格式与失败阈值都在 `lib/rules.js` 的 `evaluate()` 中,运行时会把证据写进报告(`findings[].evidence`),因此报告本身就能说明为什么得分。
18
18
 
19
19
  ### 可发现性(25 分)
20
20
 
@@ -52,6 +52,8 @@
52
52
  | `seo.viewport` | SEO | 2 | 移动端视口声明 | 在 <head> 输出 <meta name="viewport" content="width=device-width, initial-scale=1">;缺少它会让移动端按桌面宽度渲染。 |
53
53
  | `seo.image-dimensions` | SEO | 2 | 图片声明宽高 | 为 <img> 写上 width/height 或使用 aspect-ratio,避免加载时布局跳动(CLS)。 |
54
54
  | `seo.image-lazy` | SEO | 1 | 首屏外图片懒加载 | 给首屏以下的图片加 loading="lazy",首屏图不要加,避免延迟最大内容渲染。 |
55
+ | `seo.schema-fields` | SEO | 3 | 结构化数据字段完整 | 按 schema.org 定义补齐必备属性:Article 要 headline/author/datePublished,Product 要 name 与 offers,Organization 要 name 与 url。 |
56
+ | `seo.schema-matches-page-type` | SEO | 2 | 页面类型与结构化数据匹配 | 内容页输出 Article/BlogPosting,商品页输出 Product,问答页输出 FAQPage;类型与内容不符会被忽略。 |
55
57
 
56
58
  ### 可引用性(25 分)
57
59
 
@@ -86,6 +88,7 @@
86
88
 
87
89
  | 规则 ID | 支柱 | 权重 | 检查项 | 修复建议 |
88
90
  |---|---|---|---|---|
91
+ | `geo.agent-tools` | GEO | 2 | 可选:WebMCP agent 工具声明 | 可选能力:若希望 agent 直接调用站内功能,给 <form> 加 toolname/tooldescription(W3C WebMCP 草案);普通内容站不需要。 |
89
92
  | `manifest.llms-txt` | GEO | 2 | llms.txt(可选,非 Google 必需) | 可选:若需要服务非 Google 的 agent/工具,可发布 llms.txt(# 标题 + ## 分节 + Markdown 链接)。Google Search 明确不使用 llms.txt,不要把它当作 Google 排名手段。 |
90
93
  | `manifest.llms-structure` | GEO | 1 | llms.txt 结构完整(可选) | 若提供 llms.txt,至少包含 2 个 ## 分节和 3 个指向正文的 Markdown 链接。注意:Google Search 不使用该文件。 |
91
94
  | `manifest.structured-breadth` | GEO | 2 | schema.org 类型覆盖面(富结果) | 按页面类型输出 schema(Organization/WebSite、Article、FAQPage、BreadcrumbList),用于富结果与实体消歧。Google 明确表示生成式 AI 不需要特殊 schema。 |
package/docs/index.json CHANGED
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "versions": [
29
29
  {
30
- "version": "0.10.0",
30
+ "version": "0.11.0",
31
31
  "source": {
32
32
  "type": "npm"
33
33
  },
@@ -23,7 +23,7 @@ jobs:
23
23
  - uses: actions/checkout@v4
24
24
 
25
25
  - name: Audit and compare against the committed baseline
26
- uses: cobola/dsh-geo@v0.10.0
26
+ uses: cobola/dsh-geo@v0.11.0
27
27
  with:
28
28
  url: https://journal123.com
29
29
  baseline: geo-baseline.json
@@ -15,7 +15,7 @@ jobs:
15
15
  - uses: actions/checkout@v4
16
16
 
17
17
  - name: Audit and write a baseline
18
- uses: cobola/dsh-geo@v0.10.0
18
+ uses: cobola/dsh-geo@v0.11.0
19
19
  with:
20
20
  url: https://journal123.com
21
21
  now: 2026-11-29T00:00:00Z
package/lib/html.js CHANGED
@@ -540,6 +540,13 @@ export function analyzeHtml(html, pageUrl) {
540
540
  .filter((link) => link.rel.includes('alternate') && Boolean(link.hreflang))
541
541
  .map((link) => link.hreflang);
542
542
 
543
+ const webmcpForms = nodes
544
+ .filter((node) => node.tag === 'form')
545
+ .map((node) => ({
546
+ toolname: attribute(node, 'toolname'),
547
+ tooldescription: attribute(node, 'tooldescription'),
548
+ }));
549
+
543
550
  const times = [];
544
551
  for (const node of nodes) {
545
552
  if (node.tag !== 'time') continue;
@@ -661,6 +668,8 @@ export function analyzeHtml(html, pageUrl) {
661
668
  jsonLdTypes: [...new Set(jsonLd.flatMap((block) => block.types))].sort(),
662
669
  jsonLdValid: jsonLd.length > 0 && jsonLd.every((block) => block.ok),
663
670
  orgEntities,
671
+ jsonLdEntities,
672
+ webmcpForms,
664
673
  articleEntities,
665
674
  faqEntities,
666
675
  sameAs: [...new Set(sameAs)],
package/lib/rules.js CHANGED
@@ -12,7 +12,9 @@
12
12
  * - skip: excluded from the denominator (not applicable)
13
13
  */
14
14
 
15
- export const RUBRIC_VERSION = 'geo-rubric@2';
15
+ import { checkPageTypeSchema, checkSchemaCompleteness } from './schema.js';
16
+
17
+ export const RUBRIC_VERSION = 'geo-rubric@3';
16
18
 
17
19
  /**
18
20
  * The three optimisation pillars industry tools report separately.
@@ -1053,6 +1055,61 @@ export const RULES = [
1053
1055
  },
1054
1056
  },
1055
1057
 
1058
+ {
1059
+ id: 'seo.schema-fields',
1060
+ pillar: 'seo',
1061
+ dimension: 'parsability',
1062
+ weight: 3,
1063
+ title: '结构化数据字段完整',
1064
+ fix: '按 schema.org 定义补齐必备属性:Article 要 headline/author/datePublished,Product 要 name 与 offers,Organization 要 name 与 url。',
1065
+ evaluate({ factsPages }) {
1066
+ const result = checkSchemaCompleteness(factsPages);
1067
+ if (result.summary.total === 0) return skip('页面没有带 @type 的结构化数据');
1068
+ const broken = result.entities.filter((entity) => entity.missingRequired.length > 0);
1069
+ if (broken.length === 0) {
1070
+ return pass(`${result.summary.total} 个实体必备字段齐全`);
1071
+ }
1072
+ const examples = broken.slice(0, 3).map((entity) => `${entity.type} 缺 ${entity.missingRequired.join('/')}`);
1073
+ const evidence = `${broken.length}/${result.summary.total} 个实体缺必备字段:${examples.join(';')}`;
1074
+ return broken.length === result.summary.total ? fail(evidence) : warn(evidence);
1075
+ },
1076
+ },
1077
+ {
1078
+ id: 'seo.schema-matches-page-type',
1079
+ pillar: 'seo',
1080
+ dimension: 'parsability',
1081
+ weight: 2,
1082
+ title: '页面类型与结构化数据匹配',
1083
+ fix: '内容页输出 Article/BlogPosting,商品页输出 Product,问答页输出 FAQPage;类型与内容不符会被忽略。',
1084
+ evaluate({ scan, factsPages }) {
1085
+ const signals = checkPageTypeSchema(scan, factsPages);
1086
+ if (signals.length === 0) return skip('未能从 URL 或内容推断页面类型');
1087
+ const missing = signals.filter((signal) => !signal.present);
1088
+ if (missing.length === 0) {
1089
+ return pass(signals.map((signal) => `${signal.pageType}✓`).join(' '));
1090
+ }
1091
+ // Inference, not proof: report as partial rather than a hard failure.
1092
+ return warn(`疑似 ${missing.map((signal) => signal.pageType).join('/')} 页缺少对应类型(${missing.map((signal) => signal.expected.join(' 或 ')).join(';')})`);
1093
+ },
1094
+ },
1095
+ {
1096
+ id: 'geo.agent-tools',
1097
+ pillar: 'geo',
1098
+ dimension: 'manifest',
1099
+ weight: 2,
1100
+ title: '可选:WebMCP agent 工具声明',
1101
+ fix: '可选能力:若希望 agent 直接调用站内功能,给 <form> 加 toolname/tooldescription(W3C WebMCP 草案);普通内容站不需要。',
1102
+ evaluate({ factsPages }) {
1103
+ const forms = factsPages.flatMap((page) => page.facts.webmcpForms ?? []);
1104
+ if (forms.length === 0) return skip('页面没有表单,也没有 WebMCP 声明;这是可选能力');
1105
+ const named = forms.filter((form) => form.toolname && form.tooldescription);
1106
+ if (named.length > 0 && named.length === forms.length) return pass(`${named.length} 个表单已声明 WebMCP 工具`);
1107
+ if (named.length > 0) return warn(`${forms.length} 个表单中 ${forms.length - named.length} 个缺少 toolname 或 tooldescription`);
1108
+ // Plain search/filter forms are not agent tools; absence is not a defect.
1109
+ return skip(`${forms.length} 个普通表单未声明 WebMCP;这是可选能力,内容站不需要`);
1110
+ },
1111
+ },
1112
+
1056
1113
  // ---------------------------------------------------------------- 机器说明书
1057
1114
  {
1058
1115
  id: 'manifest.llms-txt',
package/lib/schema.js ADDED
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Schema.org completeness: does a declared type carry the properties a
3
+ * consumer actually needs?
4
+ *
5
+ * Two different standards apply, and conflating them is a common mistake:
6
+ *
7
+ * - **Required for Google rich results.** Google's structured-data
8
+ * documentation lists required and recommended properties per feature, and
9
+ * only those produce rich results. A type Google does not consume at all
10
+ * (or no longer consumes) earns nothing regardless of completeness.
11
+ * - **Required for the type to be meaningful.** schema.org itself defines few
12
+ * hard requirements, but a `Product` without an offer, or an `Article`
13
+ * without a headline, does not describe what it claims to describe.
14
+ *
15
+ * This module only encodes the second kind plus the fields Google publishes as
16
+ * required, and it labels which is which. It never claims a rich-result outcome.
17
+ *
18
+ * Source: https://schema.org/docs/full.html and the per-feature pages under
19
+ * https://developers.google.com/search/docs/appearance/structured-data
20
+ */
21
+ export const SCHEMA_REQUIREMENTS = {
22
+ Article: { required: ['headline', 'author', 'datePublished'], recommended: ['dateModified', 'image', 'publisher'] },
23
+ NewsArticle: { required: ['headline', 'author', 'datePublished'], recommended: ['dateModified', 'image', 'publisher'] },
24
+ BlogPosting: { required: ['headline', 'author', 'datePublished'], recommended: ['dateModified', 'image'] },
25
+ TechArticle: { required: ['headline', 'author', 'datePublished'], recommended: ['dateModified', 'image'] },
26
+ Product: { required: ['name'], recommended: ['offers', 'image', 'brand', 'sku', 'aggregateRating'] },
27
+ Offer: { required: ['price', 'priceCurrency'], recommended: ['availability', 'url', 'priceValidUntil'] },
28
+ Organization: { required: ['name'], recommended: ['url', 'logo', 'sameAs', 'contactPoint'] },
29
+ Person: { required: ['name'], recommended: ['url', 'sameAs', 'jobTitle'] },
30
+ WebSite: { required: ['name', 'url'], recommended: ['potentialAction', 'description'] },
31
+ WebPage: { required: ['name'], recommended: ['url', 'description', 'dateModified'] },
32
+ BreadcrumbList: { required: ['itemListElement'], recommended: [] },
33
+ FAQPage: { required: ['mainEntity'], recommended: [] },
34
+ Question: { required: ['name', 'acceptedAnswer'], recommended: [] },
35
+ HowTo: { required: ['name', 'step'], recommended: ['image', 'totalTime'] },
36
+ Event: { required: ['name', 'startDate', 'location'], recommended: ['endDate', 'image', 'offers'] },
37
+ Recipe: { required: ['name', 'recipeIngredient', 'recipeInstructions'], recommended: ['image', 'author'] },
38
+ VideoObject: { required: ['name', 'thumbnailUrl', 'uploadDate'], recommended: ['description', 'duration', 'contentUrl'] },
39
+ LocalBusiness: { required: ['name', 'address'], recommended: ['telephone', 'openingHours', 'priceRange'] },
40
+ ItemList: { required: ['itemListElement'], recommended: ['name'] },
41
+ Course: { required: ['name', 'description'], recommended: ['provider'] },
42
+ JobPosting: { required: ['title', 'description', 'datePosted', 'hiringOrganization'], recommended: ['jobLocation', 'baseSalary'] },
43
+ };
44
+
45
+ /** Types Google states it consumes for rich results, with the caveat that most
46
+ * require per-feature checks this audit does not perform. */
47
+ export const GOOGLE_RICH_RESULT_TYPES = new Set([
48
+ 'Article', 'NewsArticle', 'BlogPosting', 'Product', 'Offer', 'BreadcrumbList',
49
+ 'Event', 'Recipe', 'VideoObject', 'LocalBusiness', 'JobPosting', 'Course',
50
+ 'FAQPage', 'HowTo', 'Question', 'ItemList', 'Person', 'Organization', 'WebSite',
51
+ ]);
52
+
53
+ function hasProperty(entity, property) {
54
+ const value = entity[property];
55
+ if (value === undefined || value === null) return false;
56
+ if (typeof value === 'string') return value.trim().length > 0;
57
+ if (Array.isArray(value)) return value.length > 0;
58
+ if (typeof value === 'object') return Object.keys(value).length > 0;
59
+ return true;
60
+ }
61
+
62
+ function typesOf(entity) {
63
+ const type = entity?.['@type'];
64
+ if (typeof type === 'string') return [type];
65
+ if (Array.isArray(type)) return type.filter((entry) => typeof entry === 'string');
66
+ return [];
67
+ }
68
+
69
+ /**
70
+ * Check every typed entity on the crawled pages against its requirements.
71
+ *
72
+ * @param {object[]} factsPages - Pages carrying facts.
73
+ * @returns {{entities: Array<object>, summary: object, unknownTypes: string[]}}
74
+ */
75
+ export function checkSchemaCompleteness(factsPages) {
76
+ const entities = [];
77
+ const unknownTypes = new Set();
78
+
79
+ for (const page of factsPages) {
80
+ for (const entity of page.facts.jsonLdEntities ?? []) {
81
+ for (const type of typesOf(entity)) {
82
+ const rule = SCHEMA_REQUIREMENTS[type];
83
+ if (!rule) {
84
+ unknownTypes.add(type);
85
+ continue;
86
+ }
87
+ const missingRequired = rule.required.filter((property) => !hasProperty(entity, property));
88
+ const missingRecommended = rule.recommended.filter((property) => !hasProperty(entity, property));
89
+ entities.push({
90
+ page: page.path,
91
+ type,
92
+ missingRequired,
93
+ missingRecommended,
94
+ googleRichResultType: GOOGLE_RICH_RESULT_TYPES.has(type),
95
+ });
96
+ }
97
+ }
98
+ }
99
+
100
+ const complete = entities.filter((entity) => entity.missingRequired.length === 0);
101
+ return {
102
+ entities,
103
+ summary: {
104
+ total: entities.length,
105
+ complete: complete.length,
106
+ incomplete: entities.length - complete.length,
107
+ },
108
+ unknownTypes: [...unknownTypes].sort(),
109
+ };
110
+ }
111
+
112
+ /**
113
+ * Whether the site is a page type that expects a matching schema type.
114
+ *
115
+ * This is inference from observable signals, and the caller must present it as
116
+ * such: a site can be a product page without looking like one.
117
+ *
118
+ * @param {object} scan
119
+ * @param {object[]} factsPages
120
+ */
121
+ export function checkPageTypeSchema(scan, factsPages) {
122
+ const present = new Set(factsPages.flatMap((page) => page.facts.jsonLdTypes ?? []));
123
+ const path = scan.startUrl ? new URL(scan.startUrl).pathname : '/';
124
+ const primary = factsPages.find((page) => page.depth === 0) ?? factsPages[0];
125
+ const text = primary?.facts?.text ?? '';
126
+ const signals = [];
127
+
128
+ if (/(?:^|\/)(?:product|products|item|shop|p)\//i.test(path) || /\b(?:add to cart|buy now|price)\b/i.test(text)) {
129
+ signals.push({ pageType: 'product', expected: ['Product'], present: present.has('Product') });
130
+ }
131
+ if (/(?:^|\/)(?:blog|article|news|post|posts)\//i.test(path) || (primary?.facts?.articleEntities?.length ?? 0) > 0) {
132
+ signals.push({ pageType: 'article', expected: ['Article', 'NewsArticle', 'BlogPosting'], present: ['Article', 'NewsArticle', 'BlogPosting'].some((type) => present.has(type)) });
133
+ }
134
+ if ((primary?.facts?.faqEntities?.length ?? 0) > 0 || (primary?.facts?.questionHeadings?.length ?? 0) >= 3) {
135
+ signals.push({ pageType: 'faq', expected: ['FAQPage'], present: present.has('FAQPage') });
136
+ }
137
+ if (/\b(?:opening hours|visit us|our address|directions)\b/i.test(text)) {
138
+ signals.push({ pageType: 'local-business', expected: ['LocalBusiness'], present: present.has('LocalBusiness') });
139
+ }
140
+ return signals;
141
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobola/dsh-geo",
3
- "version": "0.10.0",
3
+ "version": "0.11.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": {