@cobola/dsh-geo 0.11.0 → 0.12.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,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.12.0 - 2026-11-29
4
+
5
+ ### Removed
6
+
7
+ - Delete `lib/profiles.js` and its test. It was the original platform evidence
8
+ registry, superseded by `lib/platforms/*`; no production code imported it.
9
+ - Stop writing `.dsh-geo/dashboard.json`. It duplicated state already held in
10
+ `history/`, and nothing read it after the dashboard page left Settings.
11
+ - Drop the unused `sessions` and `remote.workspaceFiles` injections from the
12
+ client half: it no longer lists sessions or reads workspace files.
13
+
14
+ ### Features
15
+
16
+ - Add `dsh-geo trend`, which derives the score trend from `history/` instead of
17
+ a separately maintained file. Exits 4 when there is no history.
18
+
19
+
3
20
  ## 0.11.0 - 2026-11-29
4
21
 
5
22
  ### Features
package/README.md CHANGED
@@ -23,7 +23,7 @@
23
23
  | 会话内结果卡 | 模型调用 `geo_scan` / `geo_fix_plan` 后,对话中直接显示分数、五维、平台参考分与优先修复,不用另开页面 |
24
24
  | `geo_fix_plan`(DSH 工具) | 把最近一次(或指定的)报告变成按影响力排序的修复清单 |
25
25
  | **设置 → GEO 体检**(面板) | 修改抓取页数、robots 策略、限速、超时、体积上限、报告目录、私有目标开关 |
26
- | CLI(`dsh-geo`) | `scan` / `ci` / `mcp` / `generate-llms` / `generate-faq` / `fix-plan` / `history` / `diff` |
26
+ | CLI(`dsh-geo`) | `scan` / `ci` / `mcp` / `generate-llms` / `generate-faq` / `fix-plan` / `history` / `trend` / `diff` |
27
27
  | MCP server | `npx -y @cobola/dsh-geo mcp`,给 Cursor / Claude Code 等客户端直接调用 |
28
28
 
29
29
  报告固定在会话工作区的 `.dsh-geo/` 下;报告可能包含页面正文摘录,上传 CI artifact 前请先审阅内容:
@@ -31,7 +31,7 @@
31
31
  ```
32
32
  .dsh-geo/
33
33
  latest.json 最近一次完整产物(scan + score + diff)
34
- history/<scannedAt>.json 每次扫描一份,保留最近 50 份
34
+ history/<scannedAt>.json 每次扫描一份,保留最近 50 份(趋势也从这里读)
35
35
  report.md 给人看的体检摘要
36
36
  fix-plan.md / fix-plan.json 最新修复清单(机器可读 + Markdown)
37
37
  ```
@@ -136,6 +136,7 @@ dsh-geo fix-plan
136
136
 
137
137
  # 历史与对比
138
138
  dsh-geo history
139
+ dsh-geo trend # 最近几次扫描的分数走势
139
140
  dsh-geo diff .dsh-geo/history/<before>.json .dsh-geo/latest.json
140
141
 
141
142
  # CI:低于阈值时退出码 3
@@ -167,7 +168,7 @@ dsh-geo ci https://journal123.com \
167
168
 
168
169
  ```yaml
169
170
  - uses: actions/checkout@v4
170
- - uses: cobola/dsh-geo@v0.11.0
171
+ - uses: cobola/dsh-geo@v0.12.0
171
172
  with:
172
173
  url: https://journal123.com
173
174
  baseline: geo-baseline.json
@@ -252,7 +253,7 @@ fixture 基线(参考时间 `2026-06-15T00:00:00Z`,由测试锁定):
252
253
  - **只读原始 HTML**:不执行 JavaScript,这是与检索管线对齐的设计;它不测渲染后的 DOM、Core Web Vitals、搜索排名、流量或真实 AI 引用。
253
254
  - **不自动改代码**:`geo_fix_plan` 只产出清单;修改由 agent 或人完成,再用 `geo_scan` 验证。
254
255
  - **评规则不是真理**:分数用于同站点纵向对比,不适合跨站点绝对排名。规则可审计、可改,带版本号 `geo-rubric@1`。
255
- - **面板只编辑默认值**:扫描结果出现在对话卡片中;趋势与历史通过 `.dsh-geo/`、CLI 或 `dsh-geo history` 查看,尚未做图标趋势图。
256
+ - **面板只编辑默认值**:扫描结果出现在对话卡片中;趋势用 `dsh-geo trend` 查看(纯文本,不含图表)。
256
257
  - **npm 上仅发布命令行与库**:作为 DSH 插件仍建议本地目录链接安装,确保读到当前 checkout。
257
258
 
258
259
  ## 开发与发布
package/bin/dsh-geo.js CHANGED
@@ -16,7 +16,7 @@ import path from 'node:path';
16
16
  import { auditSite, persistAudit, planFromReport } from '../lib/audit.js';
17
17
  import { runCi } from '../lib/ci.js';
18
18
  import { diffReports } from '../lib/report.js';
19
- import { listAudits, resolveStoreDir } from '../lib/store.js';
19
+ import { listAudits, readTrend, resolveStoreDir } from '../lib/store.js';
20
20
 
21
21
  const require = createRequire(import.meta.url);
22
22
  const { version } = require('../package.json');
@@ -31,6 +31,7 @@ Usage:
31
31
  dsh-geo generate-faq <url> [--out <path>]
32
32
  dsh-geo fix-plan [options]
33
33
  dsh-geo history [options]
34
+ dsh-geo trend [options] Recent score trend from saved audits.
34
35
  dsh-geo diff <before.json> <after.json> [--json]
35
36
  dsh-geo --help | --version
36
37
 
@@ -78,6 +79,11 @@ fix-plan options:
78
79
  --report <path> Use a specific report instead of .dsh-geo/latest.json.
79
80
  --json Print the plan payload as JSON.
80
81
 
82
+ trend options:
83
+ --dir <path> Report directory (default .dsh-geo).
84
+ --limit <n> Entries to include (default 12).
85
+ --json Print trend entries as JSON.
86
+
81
87
  history options:
82
88
  --dir <path> Report directory (default .dsh-geo).
83
89
  --limit <n> Entries to show (default 10).
@@ -474,6 +480,35 @@ async function commandGenerate(positionals, options) {
474
480
  return 0;
475
481
  }
476
482
 
483
+ async function commandTrend(positionals, options) {
484
+ if (positionals.length > 0) throw new Error(`Unexpected argument: ${positionals[0]}`);
485
+ const cwd = process.cwd();
486
+ const storeDir = resolveStoreDir(cwd, options.dir);
487
+ const entries = await readTrend(storeDir, options.limit);
488
+ if (options.json) {
489
+ process.stdout.write(`${JSON.stringify(entries, null, 2)}\n`);
490
+ return entries.length === 0 ? 4 : 0;
491
+ }
492
+ if (entries.length === 0) {
493
+ process.stdout.write(`No saved audits in ${path.relative(cwd, storeDir)}/history\n`);
494
+ return 4;
495
+ }
496
+ const lines = [`最近 ${entries.length} 次扫描:`, ''];
497
+ for (const entry of entries) {
498
+ const when = (entry.scannedAt ?? '').slice(0, 10);
499
+ lines.push(`${when} ${String(entry.total).padStart(5)} ${entry.grade} ${bar(entry.total)}`);
500
+ }
501
+ const first = entries[0];
502
+ const last = entries[entries.length - 1];
503
+ if (entries.length > 1) {
504
+ const delta = Math.round((last.total - first.total) * 10) / 10;
505
+ lines.push('');
506
+ lines.push(`合计变化:${first.total} → ${last.total}(${delta > 0 ? '+' : ''}${delta})`);
507
+ }
508
+ process.stdout.write(`${lines.join('\n')}\n`);
509
+ return 0;
510
+ }
511
+
477
512
  const COMMANDS = {
478
513
  scan: commandScan,
479
514
  ci: commandCi,
@@ -482,6 +517,7 @@ const COMMANDS = {
482
517
  'generate-faq': (pos, opts) => commandGenerate(pos, { ...opts, generateKind: 'faq' }),
483
518
  'fix-plan': commandFixPlan,
484
519
  history: commandHistory,
520
+ trend: commandTrend,
485
521
  diff: commandDiff,
486
522
  };
487
523
 
package/client.js CHANGED
@@ -526,7 +526,7 @@ window.__ModuleLoader__.load({
526
526
  }
527
527
 
528
528
  return {
529
- inject: ['slots', 'locale', 'remote', 'remote.settings', 'sessions', 'remote.workspaceFiles'],
529
+ inject: ['slots', 'locale', 'remote', 'remote.settings'],
530
530
  apply(ctx) {
531
531
  ctx.effect(() => ctx.locale.register(NS, DICT), 'dsh-geo: settings dictionaries');
532
532
  const t = ctx.locale.bind(NS);
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.11.0
126
+ - uses: cobola/dsh-geo@v0.12.0
127
127
  with:
128
128
  url: https://journal123.com
129
129
  baseline: geo-baseline.json
package/docs/GOOGLE.md CHANGED
@@ -38,7 +38,7 @@ Google 指南的关键是:**Google Search 能抓取并索引公开内容**。
38
38
 
39
39
  ## 当前仍不是 Google Search Console 数据
40
40
 
41
- 截图类效果面板(总分趋势、五维变化、修复/回归)读取本地 `.dsh-geo/dashboard.json`,它展示的是**站点结构体检历史**,不是:
41
+ `dsh-geo trend` 与 `dsh-geo diff` 读取本地 `.dsh-geo/history/`,展示的是**站点结构体检历史**,不是:
42
42
 
43
43
  - GSC clicks/impressions;
44
44
  - AI Overviews / AI Mode 的真实曝光;
package/docs/index.json CHANGED
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "versions": [
29
29
  {
30
- "version": "0.11.0",
30
+ "version": "0.12.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.11.0
26
+ uses: cobola/dsh-geo@v0.12.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.11.0
18
+ uses: cobola/dsh-geo@v0.12.0
19
19
  with:
20
20
  url: https://journal123.com
21
21
  now: 2026-11-29T00:00:00Z
package/lib/store.js CHANGED
@@ -17,7 +17,6 @@ import { REPORT_FORMAT_VERSION, renderAuditMarkdown } from './report.js';
17
17
  export const STORE_DIRNAME = '.dsh-geo';
18
18
  export const FORMAT_VERSION = REPORT_FORMAT_VERSION;
19
19
  export const HISTORY_LIMIT = 50;
20
- export const DASHBOARD_TREND_LIMIT = 24;
21
20
 
22
21
  /**
23
22
  * Resolve the configured report directory, refusing anything outside `.dsh-geo/`.
@@ -110,97 +109,13 @@ export async function writeAudit(storeDir, { scan, report, diff = null, previous
110
109
  const latestPath = path.join(storeDir, 'latest.json');
111
110
  const historyPath = path.join(historyDir, historyName(scan.scannedAt));
112
111
  const reportPath = path.join(storeDir, 'report.md');
113
- const dashboardPath = path.join(storeDir, 'dashboard.json');
114
112
 
115
113
  await writeJsonAtomic(latestPath, payload);
116
114
  await writeJsonAtomic(historyPath, payload);
117
115
  await writeFileAtomic(reportPath, renderAuditMarkdown(report, { scan, diff }));
118
116
  await pruneHistory(historyDir);
119
117
 
120
- const previousDashboard = await readDashboard(storeDir);
121
- const dashboard = buildDashboard(scan, report, diff, previousDashboard);
122
- await writeJsonAtomic(dashboardPath, dashboard);
123
-
124
- return { latestPath, historyPath, reportPath, dashboardPath };
125
- }
126
-
127
- function dimensionSummary(dimensions) {
128
- return dimensions.map((dimension) => ({
129
- id: dimension.id,
130
- title: dimension.title,
131
- weight: dimension.weight,
132
- score: dimension.score,
133
- scored: dimension.scored !== false,
134
- }));
135
- }
136
-
137
- function buildDashboard(scan, report, diff, previousDashboard) {
138
- const priorTrend = Array.isArray(previousDashboard?.trend) ? previousDashboard.trend : [];
139
- const trend = [...priorTrend, {
140
- scannedAt: scan.scannedAt,
141
- total: report.total,
142
- grade: report.grade,
143
- url: scan.startUrl,
144
- }]
145
- .filter((entry) => entry && typeof entry.total === 'number' && entry.scannedAt)
146
- .slice(-DASHBOARD_TREND_LIMIT);
147
-
148
- return {
149
- formatVersion: FORMAT_VERSION,
150
- generatedAt: scan.scannedAt,
151
- url: scan.startUrl,
152
- origin: scan.origin,
153
- current: {
154
- total: report.total,
155
- grade: report.grade,
156
- gradeLabel: report.gradeLabel,
157
- counts: report.counts,
158
- dimensions: dimensionSummary(report.dimensions),
159
- platforms: (report.platforms ?? []).map((platform) => ({
160
- id: platform.id,
161
- title: platform.title,
162
- total: platform.total,
163
- counts: platform.counts,
164
- })),
165
- },
166
- previous: diff
167
- ? {
168
- scannedAt: diff.previous.scannedAt,
169
- total: diff.previous.total,
170
- grade: diff.previous.grade,
171
- dimensions: diff.dimensions.map((dimension) => ({
172
- id: dimension.id,
173
- before: dimension.before,
174
- after: dimension.after,
175
- delta: dimension.delta,
176
- })),
177
- }
178
- : null,
179
- delta: diff
180
- ? {
181
- total: diff.total.delta,
182
- fixed: diff.fixed.map((entry) => entry.ruleId),
183
- regressed: diff.regressed.map((entry) => entry.ruleId),
184
- stillFailing: diff.counts.stillFailing,
185
- dimensions: diff.dimensions,
186
- }
187
- : null,
188
- trend,
189
- actions: report.actions.slice(0, 5).map((action) => ({
190
- ruleId: action.ruleId,
191
- dimensionTitle: action.dimensionTitle,
192
- title: action.title,
193
- status: action.status,
194
- weight: action.weight,
195
- evidence: action.evidence,
196
- fix: action.fix,
197
- })),
198
- };
199
- }
200
-
201
- /** Read the latest dashboard payload, or null. */
202
- export async function readDashboard(storeDir) {
203
- return readJson(path.join(storeDir, 'dashboard.json'));
118
+ return { latestPath, historyPath, reportPath };
204
119
  }
205
120
 
206
121
  async function pruneHistory(historyDir) {
@@ -242,6 +157,29 @@ export async function listAudits(storeDir, limit = 20) {
242
157
  return entries;
243
158
  }
244
159
 
160
+ /**
161
+ * Score trend across saved audits, oldest first.
162
+ *
163
+ * History files already hold every score, so a separate trend file would be a
164
+ * second copy of the same state that can drift or go stale.
165
+ *
166
+ * @param {string} storeDir
167
+ * @param {number} [limit] - Most recent entries to include.
168
+ * @returns {Promise<Array<{scannedAt: string|null, total: number, grade: string, url: string|null}>>}
169
+ */
170
+ export async function readTrend(storeDir, limit = 24) {
171
+ const entries = await listAudits(storeDir, limit);
172
+ return entries
173
+ .slice()
174
+ .reverse()
175
+ .map((entry) => ({
176
+ scannedAt: entry.savedAt,
177
+ total: entry.total,
178
+ grade: entry.grade,
179
+ url: entry.url,
180
+ }));
181
+ }
182
+
245
183
  /**
246
184
  * Read one audit payload file.
247
185
  * @param {string} file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobola/dsh-geo",
3
- "version": "0.11.0",
3
+ "version": "0.12.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": {
package/lib/profiles.js DELETED
@@ -1,62 +0,0 @@
1
- /**
2
- * Platform evidence registry. Profiles are metadata and source boundaries, not
3
- * extra score weight. A profile may later add platform-specific checks without
4
- * contaminating the Core score.
5
- */
6
- export const PLATFORM_PROFILES = Object.freeze({
7
- core: Object.freeze({
8
- id: 'core', title: '跨平台基础', maturity: 'implemented',
9
- sources: [],
10
- scope: 'crawlability, indexability, page structure, duplicate URLs, entity clarity',
11
- }),
12
- google: Object.freeze({
13
- id: 'google', title: 'Google Search / AI features', maturity: 'implemented',
14
- sources: ['https://developers.google.com/search/docs/fundamentals/ai-optimization-guide'],
15
- scope: 'Googlebot access, Search technical requirements, people-first content, Google-specific controls',
16
- }),
17
- bing: Object.freeze({
18
- id: 'bing', title: 'Bing / Copilot', maturity: 'source-mapped',
19
- sources: [
20
- 'https://www.bing.com/webmasters/help/webmaster-guidelines-30fba23a',
21
- 'https://www.bing.com/webmasters/help/robots-meta-tags-and-attributes-that-bing-supports-5198d240',
22
- 'https://www.bing.com/indexnow',
23
- ],
24
- scope: 'Bingbot, Copilot grounding, data-nosnippet, AI controls, IndexNow',
25
- }),
26
- baidu: Object.freeze({
27
- id: 'baidu', title: '百度搜索', maturity: 'source-mapped',
28
- sources: [
29
- 'https://ziyuan.baidu.com/college/articleinfo?id=193undefinedpage%3D1&page=6',
30
- 'https://ziyuan.baidu.com/college/courseinfo?id=1399',
31
- ],
32
- scope: 'Baiduspider, 百度搜索资源平台, sitemap/submission, Chinese search crawlability',
33
- limitation: '百度 AI 引用选择标准没有完整公开;不把推测当作规则。',
34
- }),
35
- openai: Object.freeze({
36
- id: 'openai', title: 'OpenAI Search', maturity: 'source-mapped',
37
- sources: ['https://developers.openai.com/api/docs/bots'],
38
- scope: 'OAI-SearchBot vs GPTBot access controls',
39
- limitation: '不推导未公开的 ChatGPT 引用排序公式。',
40
- }),
41
- perplexity: Object.freeze({
42
- id: 'perplexity', title: 'Perplexity', maturity: 'source-mapped',
43
- sources: ['https://docs.perplexity.ai/docs/resources/perplexity-crawlers'],
44
- scope: 'Perplexity crawler identity, robots and fetchability',
45
- limitation: '不推导未公开的引用排序公式。',
46
- }),
47
- });
48
-
49
- export function listProfiles() {
50
- return Object.values(PLATFORM_PROFILES).map((profile) => ({
51
- id: profile.id,
52
- title: profile.title,
53
- maturity: profile.maturity,
54
- scope: profile.scope,
55
- sources: [...profile.sources],
56
- ...(profile.limitation ? { limitation: profile.limitation } : {}),
57
- }));
58
- }
59
-
60
- export function profileById(id) {
61
- return PLATFORM_PROFILES[id] ?? null;
62
- }