aiseo-audit 1.4.19 → 1.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/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-7EB6D7.svg)](https://opensource.org/licenses/MIT)
7
7
  [![Node.js](https://img.shields.io/badge/node-%3E%3D20-7EB6D7.svg)](https://nodejs.org)
8
8
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.9-7EB6D7?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
9
- [![Tests](https://img.shields.io/badge/tests-459%20passed-8FBC8F)](https://github.com/agencyenterprise/aiseo-audit)
9
+ [![Tests](https://img.shields.io/badge/tests-558%20passed-8FBC8F)](https://github.com/agencyenterprise/aiseo-audit)
10
10
  [![Coverage](https://img.shields.io/codecov/c/github/agencyenterprise/aiseo-audit?color=8FBC8F&label=coverage)](https://codecov.io/gh/agencyenterprise/aiseo-audit)
11
11
  [![GitHub Stars](https://img.shields.io/github/stars/agencyenterprise/aiseo-audit?style=flat&color=8FBC8F)](https://github.com/agencyenterprise/aiseo-audit/stargazers)
12
12
  ![npm downloads](https://img.shields.io/npm/dt/aiseo-audit?label=Total%20Downloads)
@@ -23,6 +23,9 @@ Deterministic CLI that audits web pages for **AI search readiness**. Think Light
23
23
  **Who is this for?** Content teams running pre-publish checks, developers gating deployments in CI/CD, and marketers auditing their own or competitor pages. If your content needs to be cited (not just ranked), this tool tells you where you stand.
24
24
 
25
25
  - [Quick Start](#quick-start)
26
+ - [Quick Summary Mode](#quick-summary-mode)
27
+ - [Tracking AI SEO Over Time](#tracking-ai-seo-over-time)
28
+ - [Use with AI Assistants (MCP)](#use-with-ai-assistants-mcp)
26
29
  - [CI/CD](#cicd)
27
30
  - [CLI Options](#cli-options)
28
31
  - [Site-Wide Auditing](#site-wide-auditing)
@@ -76,6 +79,12 @@ npm install -g aiseo-audit
76
79
  # Pretty terminal output (default)
77
80
  aiseo-audit https://example.com
78
81
 
82
+ # Quick summary only (top 3 wins + projected score, skip the full breakdown)
83
+ aiseo-audit https://example.com --tldr
84
+
85
+ # Track score changes over time
86
+ aiseo-audit https://example.com --diff
87
+
79
88
  # JSON output
80
89
  aiseo-audit https://example.com --json
81
90
 
@@ -106,9 +115,150 @@ aiseo-audit https://example.com --user-agent "MyBot/1.0"
106
115
  aiseo-audit https://example.com --config aiseo.config.json
107
116
  ```
108
117
 
118
+ ## Quick Summary Mode
119
+
120
+ Use `--tldr` to get just the top 3 highest-impact fixes and the projected score after applying them. No detailed category breakdown, no long recommendations list. Ideal for CI logs, Slack notifications, and quick pre-publish checks.
121
+
122
+ ```bash
123
+ aiseo-audit https://example.com --tldr
124
+ ```
125
+
126
+ ```
127
+ ============================================================
128
+ AI SEO Audit
129
+ https://example.com
130
+ ============================================================
131
+
132
+ Score: 59/100 Grade: F → Top 3 fixes: ~87/100 B+
133
+
134
+ Quickest wins:
135
+ 1. +13 pts Answer Capsules (Answerability)
136
+ 2. +10 pts Author Attribution (Authority Context)
137
+ 3. +7 pts Image Alt Text (Content Extractability)
138
+ ```
139
+
140
+ `--tldr` works with every output format (`--json`, `--md`, `--html`) so you can pipe it into any integration. Combine with `--out` to write a slim summary to a file.
141
+
142
+ ## Tracking AI SEO Over Time
143
+
144
+ `--diff` records every audit and shows you what changed since the last run for the same URL.
145
+
146
+ > [!IMPORTANT]
147
+ > `--diff` is the only flag that writes files outside of `--out`. On first use it creates `./audits/` (or your configured `historyDir`) and an `aiseo.config.json` in the current directory if one doesn't exist. Both are announced on stderr the moment they're created — nothing is written silently. Add `./audits/` to `.gitignore` if you don't want the history tracked in version control, or commit it to keep a record of AI SEO over time.
148
+
149
+ ```bash
150
+ # First run — establishes a baseline
151
+ aiseo-audit https://example.com --diff
152
+
153
+ # Subsequent runs — shows the delta
154
+ aiseo-audit https://example.com --diff
155
+ ```
156
+
157
+ Output on the second run:
158
+
159
+ ```
160
+ Changes since baseline (2026-04-10 → 2026-04-17)
161
+ Overall 59 → 68 (+9)
162
+ Answerability 18 → 28 (+10)
163
+ Grounding Signals 23 → 26 (+3)
164
+ ```
165
+
166
+ **How it works.** Each `--diff` run writes a full JSON audit to `./audits/<slug>-<timestamp>.json` and appends an entry to `aiseo.config.json` under a `diff` key. Nothing is ever overwritten — every run is preserved so you can walk the history.
167
+
168
+ ```json
169
+ {
170
+ "historyDir": "./audits",
171
+ "diff": {
172
+ "https://example.com": [
173
+ {
174
+ "path": "audits/example-2026-04-10.json",
175
+ "timestamp": "2026-04-10T…",
176
+ "score": 59
177
+ },
178
+ {
179
+ "path": "audits/example-2026-04-17.json",
180
+ "timestamp": "2026-04-17T…",
181
+ "score": 68
182
+ }
183
+ ]
184
+ }
185
+ }
186
+ ```
187
+
188
+ ### Saving a formatted report alongside the baseline
189
+
190
+ `--diff` always writes the JSON baseline to `historyDir` automatically. If you also want a human-friendly report (HTML, Markdown, pretty), pass `--out` with a file path and the rendered report will be written there:
191
+
192
+ ```bash
193
+ # Creates two files: the auto-named JSON baseline in ./audits/,
194
+ # and a rendered HTML report at ./audits/report.html.
195
+ aiseo-audit https://example.com --diff --html --out ./audits/report.html
196
+ ```
197
+
198
+ `--out` never replaces the baseline. It's purely for the rendered report. If `--out` points at an existing directory, the audit exits early with a clear error rather than silently writing an invalid file.
199
+
200
+ ### Cross-URL timeline
201
+
202
+ Drop the URL and pass `--diff --all` to see every tracked URL at a glance with a sparkline of its history:
203
+
204
+ ```bash
205
+ aiseo-audit --diff --all
206
+ ```
207
+
208
+ ```
209
+ Audit History (2 URLs tracked, 7 total runs)
210
+
211
+ https://example.com ▂▅▇▆ 59 → 68 → 72 → 70
212
+ https://another-site.com ▇▇ 72 → 72
213
+ ```
214
+
215
+ Works with `--html` for a shareable timeline page with inline SVG line charts.
216
+
217
+ ### Explicit baseline
218
+
219
+ If you want to compare against a specific prior JSON result without touching the tracked history, use `--baseline`:
220
+
221
+ ```bash
222
+ aiseo-audit https://example.com --baseline ./previous-audit.json
223
+ ```
224
+
225
+ ## Use with AI Assistants (MCP)
226
+
227
+ aiseo-audit ships an [MCP](https://modelcontextprotocol.io) server so Cursor, Claude Desktop, Windsurf, and any other MCP client can call the `audit_url` tool inline in a chat.
228
+
229
+ No install required — the server runs via `npx` from the published package.
230
+
231
+ **Cursor** (`~/.cursor/mcp.json`):
232
+
233
+ ```json
234
+ {
235
+ "mcpServers": {
236
+ "aiseo-audit": {
237
+ "command": "npx",
238
+ "args": ["-y", "aiseo-audit-mcp"]
239
+ }
240
+ }
241
+ }
242
+ ```
243
+
244
+ **Claude Desktop** (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
245
+
246
+ ```json
247
+ {
248
+ "mcpServers": {
249
+ "aiseo-audit": {
250
+ "command": "npx",
251
+ "args": ["-y", "aiseo-audit-mcp"]
252
+ }
253
+ }
254
+ }
255
+ ```
256
+
257
+ Once configured, prompt your assistant naturally — e.g. "audit https://mysite.com for AI search readiness" — and it will invoke the tool and return a full audit inline.
258
+
109
259
  ## CI/CD
110
260
 
111
- Drop this into any GitHub Actions workflow to gate PRs on AI search readiness:
261
+ aiseo-audit ships an official [GitHub Action](https://github.com/marketplace/actions/ai-seo-audit). Drop it into any workflow to gate PRs on AI search readiness and post a sticky PR comment with the summary:
112
262
 
113
263
  ```yaml
114
264
  # .github/workflows/aiseo-audit.yml
@@ -121,8 +271,23 @@ on:
121
271
  jobs:
122
272
  audit:
123
273
  runs-on: ubuntu-latest
274
+ permissions:
275
+ pull-requests: write
124
276
  steps:
125
- - run: npx aiseo-audit https://yoursite.com --fail-under 70
277
+ - uses: agencyenterprise/aiseo-audit@v1
278
+ with:
279
+ url: https://yoursite.com
280
+ fail-under: 70
281
+ comment-on-pr: true
282
+ ```
283
+
284
+ With `comment-on-pr: true`, the Action updates a single sticky comment on each PR with the TL;DR score, grade, and top fixes — so reviewers see the impact of content changes inline.
285
+
286
+ Prefer a one-liner without the Action wrapper? This still works:
287
+
288
+ ```yaml
289
+ steps:
290
+ - run: npx aiseo-audit https://yoursite.com --fail-under 70
126
291
  ```
127
292
 
128
293
  **Using a preview deployment URL?** If your CI pipeline produces a dynamic URL (e.g. a Vercel or Netlify preview), capture it from a prior step and pass it in:
@@ -158,8 +323,12 @@ The `--fail-under` threshold sets the minimum acceptable score. Exit code `1` is
158
323
  | `--timeout <ms>` | Request timeout in ms | `45000` |
159
324
  | `--user-agent <ua>` | Custom User-Agent string | `AISEOAudit/<version>` |
160
325
  | `--config <path>` | Path to config file | - |
326
+ | `--tldr` | Emit only the TL;DR summary (no detailed breakdown) | - |
327
+ | `--diff` | Track score over time: record this run, diff against the previous recorded run | - |
328
+ | `--all` | With `--diff` and no URL, render audit history across all tracked URLs | - |
329
+ | `--baseline <path>` | Diff against a specific prior JSON result (bypasses history tracking) | - |
161
330
 
162
- Either `[url]` or `--sitemap` must be provided, but not both. If no output flag is given, the default is `pretty` (color-coded terminal output). The default format can also be set in the config file.
331
+ Either `[url]` or `--sitemap` must be provided (or `--diff --all` for the cross-URL timeline). If no output flag is given, the default is `pretty` (color-coded terminal output). The default format can also be set in the config file.
163
332
 
164
333
  When `--out` is provided, the format is automatically inferred from the file extension (`.html` becomes HTML, `.md` becomes Markdown, `.json` becomes JSON) so you don't need to pass a separate format flag. An explicit `--html`, `--md`, or `--json` flag takes precedence if provided.
165
334
 
@@ -242,13 +411,22 @@ The audit evaluates 7 categories of AI search readiness (_[Detailed Breakdown he
242
411
 
243
412
  ### Interpreting Your Score
244
413
 
414
+ Grades follow a standard US academic scale with +/- sub-grades for granular tracking across iterations.
415
+
245
416
  | Score | Grade | What It Means |
246
417
  | ------ | ----- | -------------------------------------------------------------------------------------------------------- |
247
- | 90–100 | A | Highly optimized. AI engines can fetch, understand, and cite your content with minimal friction. |
248
- | 7589 | B | Good foundation. A few targeted improvements will push you into the top tier. |
249
- | 6074 | C | Moderate readiness. Structural or content gaps are likely limiting your citation potential. |
250
- | 4059 | D | Significant gaps. Core signals (structure, answerability, authority) need attention. |
251
- | 039 | F | Not AI-ready. Start with Content Extractability. If the content cannot be fetched, nothing else matters. |
418
+ | 93–100 | A | Highly optimized. AI engines can fetch, understand, and cite your content with minimal friction. |
419
+ | 9092 | A- | Near top tier. A handful of polish items stand between you and an A. |
420
+ | 8789 | B+ | Strong foundation with a few high-impact gaps worth closing. |
421
+ | 8386 | B | Good foundation. Targeted improvements will push you into the top tier. |
422
+ | 8082 | B- | Solid, but several category gaps are holding back citation potential. |
423
+ | 77–79 | C+ | Above average. Structural or content gaps are limiting citation potential. |
424
+ | 73–76 | C | Moderate readiness. Multiple categories need attention. |
425
+ | 70–72 | C- | Below the comfort zone. Prioritize high-impact recommendations. |
426
+ | 67–69 | D+ | Noticeable gaps across core signals. |
427
+ | 63–66 | D | Significant gaps. Core signals (structure, answerability, authority) need attention. |
428
+ | 60–62 | D- | On the edge of failing. Most categories need meaningful work. |
429
+ | 0–59 | F | Not AI-ready. Start with Content Extractability. If the content cannot be fetched, nothing else matters. |
252
430
 
253
431
  The per-category breakdown in each report shows exactly where to focus. Start with high-priority recommendations in your lowest-scoring categories.
254
432
 
@@ -299,12 +477,16 @@ You can also pass an explicit path with `--config path/to/config.json`.
299
477
  "groundingSignals": 1,
300
478
  "authorityContext": 1,
301
479
  "readabilityForCompression": 1
302
- }
480
+ },
481
+ "historyDir": "./audits",
482
+ "diff": {}
303
483
  }
304
484
  ```
305
485
 
306
486
  Weights are relative. Set a category to `2` to double its importance, or `0` to exclude it entirely from scoring.
307
487
 
488
+ `historyDir` controls where `--diff` writes audit JSONs (default `./audits`). `diff` is managed by the tool — each `--diff` run appends an entry keyed by URL. See [Tracking AI SEO Over Time](#tracking-ai-seo-over-time).
489
+
308
490
  **Example: tuning for a blog or editorial site.** Content that needs to be cited by AI engines should be highly answerable and readable. Double those weights and reduce the emphasis on domain-signal files (`authorityContext` covers schema markup, while `groundingSignals` covers citations and statistics):
309
491
 
310
492
  ```json
@@ -367,6 +549,9 @@ import type {
367
549
  AuditResultType,
368
550
  CategoryNameType,
369
551
  CategoryResultType,
552
+ CategoryDeltaType,
553
+ DiffEntryType,
554
+ DiffResultType,
370
555
  FactorResultType,
371
556
  RecommendationType,
372
557
  ReportFormatType,
@@ -374,7 +559,7 @@ import type {
374
559
  } from "aiseo-audit";
375
560
  ```
376
561
 
377
- `RecommendationType` includes the base fields (`category`, `factor`, `currentValue`, `priority`, `recommendation`) plus three optional fields populated for high-impact factors:
562
+ `RecommendationType` includes the base fields (`category`, `factor`, `currentValue`, `priority`, `recommendation`) plus optional fields populated for high-impact factors:
378
563
 
379
564
  ```typescript
380
565
  type RecommendationType = {
@@ -383,12 +568,17 @@ type RecommendationType = {
383
568
  currentValue: string;
384
569
  priority: "high" | "medium" | "low";
385
570
  recommendation: string;
571
+ expectedGain?: number; // points you'd recover by resolving this factor
386
572
  steps?: string[]; // ordered implementation steps
387
573
  codeExample?: string; // ready-to-use code snippet
388
574
  learnMoreUrl?: string; // link to canonical spec or docs
389
575
  };
390
576
  ```
391
577
 
578
+ ### Diffing results programmatically
579
+
580
+ `computeDiff(current, baseline)` compares two `AnalyzerResultType` values and returns a `DiffResultType` with the overall delta and per-category deltas. Pair with `renderDiffReport(result, diff, { format })` to render the diff in any format, or `renderHistoryTimeline(diffMap, { format })` to render a cross-URL timeline from a tracked history map.
581
+
392
582
  ## Philosophy
393
583
 
394
584
  This tool measures **AI search reusability**: how well a page's content can be fetched, extracted, understood, and reused by AI engines like ChatGPT, Claude, Perplexity, and Gemini.
@@ -414,7 +604,7 @@ It is:
414
604
 
415
605
  **Zod** - Uses [Zod 4](https://zod.dev). If you consume the library API and also use Zod in your project, ensure you are on Zod 4+ to avoid type incompatibilities.
416
606
 
417
- **CJS bin entry** - The `bin/aiseo-audit.js` executable uses `require()` (CommonJS). This is compatible with all Node 20+ environments regardless of your project's module system. The library exports support both ESM (`import`) and CJS (`require`).
607
+ **CJS bin entries** - Both `bin/aiseo-audit.js` (CLI) and `bin/aiseo-audit-mcp.js` (MCP server) use `require()` (CommonJS). This is compatible with all Node 20+ environments regardless of your project's module system. The library exports support both ESM (`import`) and CJS (`require`).
418
608
 
419
609
  **Config discovery** - When using the programmatic API, `loadConfig()` searches for config files starting from `process.cwd()`. If your application's working directory differs from where your config file lives, pass an explicit path:
420
610
 
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require("../dist/mcp.js");