geo-ai-search-optimization 1.4.2 → 2.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.
Files changed (45) hide show
  1. package/action.yml +130 -0
  2. package/examples/github-action.yml +27 -0
  3. package/package.json +17 -3
  4. package/src/audit-diff.js +184 -0
  5. package/src/auto-fix.js +349 -0
  6. package/src/batch-full-page-audit.js +151 -0
  7. package/src/batch-page-audit.js +140 -0
  8. package/src/benchmark.js +126 -0
  9. package/src/ci.js +81 -0
  10. package/src/citability.js +311 -0
  11. package/src/citation-check.js +157 -0
  12. package/src/citation-monitor.js +86 -0
  13. package/src/cli-site-ops-commands.js +638 -4
  14. package/src/compare.js +175 -0
  15. package/src/config.js +105 -0
  16. package/src/content-gap.js +170 -0
  17. package/src/crawlers.js +286 -0
  18. package/src/diagnose.js +221 -0
  19. package/src/eeat.js +251 -0
  20. package/src/freshness.js +281 -0
  21. package/src/full-audit.js +269 -0
  22. package/src/full-page-audit.js +273 -0
  23. package/src/heading-structure.js +287 -0
  24. package/src/index.d.ts +492 -0
  25. package/src/index.js +35 -0
  26. package/src/internal-links.js +298 -0
  27. package/src/page-audit.js +1 -1
  28. package/src/page-snapshot.js +198 -0
  29. package/src/pdf-report.js +205 -0
  30. package/src/platform-ready.js +238 -0
  31. package/src/plugins.js +126 -0
  32. package/src/pm-brief.js +8 -0
  33. package/src/pre-commit.js +62 -0
  34. package/src/readability.js +252 -0
  35. package/src/report.js +37 -12
  36. package/src/security.js +249 -0
  37. package/src/sitemap.js +323 -0
  38. package/src/snapshot.js +51 -0
  39. package/src/social-meta.js +293 -0
  40. package/src/topics.js +275 -0
  41. package/src/trend.js +102 -0
  42. package/src/url-onboarding.js +1 -1
  43. package/src/validate-llms.js +307 -0
  44. package/src/validate-schema.js +306 -0
  45. package/src/watch.js +49 -0
@@ -0,0 +1,86 @@
1
+ import { checkCitation } from "./citation-check.js";
2
+ import { saveSnapshot, listSnapshots, loadSnapshot } from "./snapshot.js";
3
+ import { writeScanOutput } from "./scan.js";
4
+
5
+ export async function monitorCitations(siteUrl, queries, options = {}) {
6
+ const result = await checkCitation(siteUrl, queries, {
7
+ engines: options.engines
8
+ });
9
+
10
+ const monitorResult = {
11
+ kind: "geo-citation-monitor",
12
+ siteUrl: result.siteUrl,
13
+ domain: result.domain,
14
+ queries: result.queries,
15
+ engines: result.engines,
16
+ foundRate: result.foundRate,
17
+ foundCount: result.foundCount,
18
+ totalChecks: result.totalChecks,
19
+ results: result.results,
20
+ savedAt: new Date().toISOString(),
21
+ previousFoundRate: null,
22
+ foundRateDelta: null
23
+ };
24
+
25
+ // Try to load previous citation snapshot for comparison
26
+ const dataDir = options.dataDir || undefined;
27
+ const snapshots = await listSnapshots(dataDir);
28
+ const citationSnapshots = [];
29
+
30
+ for (const snap of snapshots) {
31
+ try {
32
+ const data = await loadSnapshot(snap.path);
33
+ if (data.kind === "geo-citation-monitor" || data.kind === "geo-citation-check") {
34
+ citationSnapshots.push(data);
35
+ }
36
+ } catch {
37
+ // skip invalid
38
+ }
39
+ }
40
+
41
+ if (citationSnapshots.length > 0) {
42
+ const previous = citationSnapshots[citationSnapshots.length - 1];
43
+ monitorResult.previousFoundRate = previous.foundRate;
44
+ monitorResult.foundRateDelta = monitorResult.foundRate - previous.foundRate;
45
+ }
46
+
47
+ if (options.save) {
48
+ await saveSnapshot(monitorResult, { dataDir });
49
+ }
50
+
51
+ monitorResult.summary = monitorResult.foundRateDelta !== null
52
+ ? `当前引用率 ${monitorResult.foundRate}%(变化 ${monitorResult.foundRateDelta >= 0 ? "+" : ""}${monitorResult.foundRateDelta}%)。`
53
+ : `当前引用率 ${monitorResult.foundRate}%(无历史数据可比较)。`;
54
+
55
+ return monitorResult;
56
+ }
57
+
58
+ export function renderCitationMonitorMarkdown(report) {
59
+ const lines = [
60
+ "# GEO 引用监控",
61
+ "",
62
+ `- 网站:\`${report.siteUrl}\``,
63
+ `- 引用率:\`${report.foundRate}%\`(${report.foundCount}/${report.totalChecks})`,
64
+ ""
65
+ ];
66
+
67
+ if (report.previousFoundRate !== null) {
68
+ lines.push(`- 上次引用率:\`${report.previousFoundRate}%\``);
69
+ lines.push(`- 变化:\`${report.foundRateDelta >= 0 ? "+" : ""}${report.foundRateDelta}%\``);
70
+ lines.push("");
71
+ }
72
+
73
+ lines.push(report.summary, "");
74
+
75
+ lines.push("## 详细结果", "", "| 查询 | 引擎 | 引用 |", "|------|------|------|");
76
+ for (const r of report.results) {
77
+ lines.push(`| ${r.query} | ${r.engine} | ${r.found ? "✓" : "✗"} |`);
78
+ }
79
+
80
+ lines.push("");
81
+ return lines.join("\n");
82
+ }
83
+
84
+ export async function writeCitationMonitorOutput(outputPath, content) {
85
+ return writeScanOutput(outputPath, content);
86
+ }