@rivi-software/agentic-seo-check 0.1.1 → 0.3.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 +67 -7
- package/dist/cli.js +69 -26
- package/dist/cli.js.map +1 -1
- package/dist/core/aeo/audit.d.ts +44 -0
- package/dist/core/aeo/audit.js +310 -0
- package/dist/core/aeo/audit.js.map +1 -0
- package/dist/core/aeo/bots.d.ts +30 -0
- package/dist/core/aeo/bots.js +299 -0
- package/dist/core/aeo/bots.js.map +1 -0
- package/dist/core/aeo/llms-txt.d.ts +8 -0
- package/dist/core/aeo/llms-txt.js +88 -0
- package/dist/core/aeo/llms-txt.js.map +1 -0
- package/dist/core/aeo/page.d.ts +43 -0
- package/dist/core/aeo/page.js +284 -0
- package/dist/core/aeo/page.js.map +1 -0
- package/dist/core/aeo/probe.d.ts +10 -0
- package/dist/core/aeo/probe.js +53 -0
- package/dist/core/aeo/probe.js.map +1 -0
- package/dist/core/aeo/site-rules.d.ts +13 -0
- package/dist/core/aeo/site-rules.js +178 -0
- package/dist/core/aeo/site-rules.js.map +1 -0
- package/dist/core/audit.d.ts +23 -2
- package/dist/core/audit.js +50 -22
- package/dist/core/audit.js.map +1 -1
- package/dist/core/crawl.d.ts +7 -1
- package/dist/core/crawl.js +85 -9
- package/dist/core/crawl.js.map +1 -1
- package/dist/core/fetch.d.ts +9 -0
- package/dist/core/fetch.js +28 -12
- package/dist/core/fetch.js.map +1 -1
- package/dist/core/html/answer.d.ts +4 -0
- package/dist/core/html/answer.js +198 -0
- package/dist/core/html/answer.js.map +1 -0
- package/dist/core/html/dom.d.ts +6 -0
- package/dist/core/html/dom.js +92 -1
- package/dist/core/html/dom.js.map +1 -1
- package/dist/core/html/extract.js +21 -72
- package/dist/core/html/extract.js.map +1 -1
- package/dist/core/html/head.d.ts +10 -0
- package/dist/core/html/head.js +206 -0
- package/dist/core/html/head.js.map +1 -0
- package/dist/core/html/resources.d.ts +17 -0
- package/dist/core/html/resources.js +172 -0
- package/dist/core/html/resources.js.map +1 -0
- package/dist/core/html/structured-data.d.ts +2 -0
- package/dist/core/html/structured-data.js +2 -0
- package/dist/core/html/structured-data.js.map +1 -1
- package/dist/core/report/markdown.d.ts +3 -1
- package/dist/core/report/markdown.js +102 -0
- package/dist/core/report/markdown.js.map +1 -1
- package/dist/core/robots.d.ts +7 -0
- package/dist/core/robots.js +13 -1
- package/dist/core/robots.js.map +1 -1
- package/dist/core/rules/aeo.d.ts +11 -0
- package/dist/core/rules/aeo.js +423 -0
- package/dist/core/rules/aeo.js.map +1 -0
- package/dist/core/rules/canonical.d.ts +3 -0
- package/dist/core/rules/canonical.js +54 -2
- package/dist/core/rules/canonical.js.map +1 -1
- package/dist/core/rules/document.js +4 -2
- package/dist/core/rules/document.js.map +1 -1
- package/dist/core/rules/head.d.ts +1 -0
- package/dist/core/rules/head.js +116 -0
- package/dist/core/rules/head.js.map +1 -0
- package/dist/core/rules/index.d.ts +4 -0
- package/dist/core/rules/index.js +15 -1
- package/dist/core/rules/index.js.map +1 -1
- package/dist/core/rules/indexing.d.ts +10 -0
- package/dist/core/rules/indexing.js +171 -9
- package/dist/core/rules/indexing.js.map +1 -1
- package/dist/core/rules/loading.d.ts +1 -0
- package/dist/core/rules/loading.js +138 -0
- package/dist/core/rules/loading.js.map +1 -0
- package/dist/core/rules/rule.d.ts +2 -0
- package/dist/core/rules/rule.js +2 -0
- package/dist/core/rules/rule.js.map +1 -1
- package/dist/core/rules/structured-data-values.d.ts +3 -0
- package/dist/core/rules/structured-data-values.js +316 -0
- package/dist/core/rules/structured-data-values.js.map +1 -0
- package/dist/core/rules/structured-data.js +50 -20
- package/dist/core/rules/structured-data.js.map +1 -1
- package/dist/core/rules/urls.d.ts +1 -0
- package/dist/core/rules/urls.js +293 -0
- package/dist/core/rules/urls.js.map +1 -0
- package/dist/core/score.d.ts +4 -2
- package/dist/core/score.js.map +1 -1
- package/dist/core/site-probes.d.ts +33 -0
- package/dist/core/site-probes.js +144 -0
- package/dist/core/site-probes.js.map +1 -0
- package/dist/core/site-rules.d.ts +18 -0
- package/dist/core/site-rules.js +479 -5
- package/dist/core/site-rules.js.map +1 -1
- package/dist/core/sitemap.d.ts +38 -1
- package/dist/core/sitemap.js +177 -43
- package/dist/core/sitemap.js.map +1 -1
- package/dist/core/static.d.ts +6 -0
- package/dist/core/static.js +122 -12
- package/dist/core/static.js.map +1 -1
- package/dist/core/types.d.ts +268 -2
- package/dist/core/types.js.map +1 -1
- package/dist/core/url.d.ts +2 -0
- package/dist/core/url.js +8 -0
- package/dist/core/url.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +129 -3
- package/dist/mcp.js.map +1 -1
- package/package.json +6 -2
- package/skills/seo-audit/SKILL.md +9 -2
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
</p>
|
|
9
9
|
|
|
10
10
|
<p align="center">
|
|
11
|
-
SEO analysis built for coding agents: a CLI and an MCP server that audit URLs,<br>
|
|
11
|
+
SEO and AEO analysis built for coding agents: a CLI and an MCP server that audit URLs,<br>
|
|
12
12
|
static build output or raw HTML, and return findings an agent can act on.<br>
|
|
13
13
|
Open source, from <a href="https://rivi.software">RIVI Software</a>.
|
|
14
14
|
</p>
|
|
@@ -39,25 +39,42 @@
|
|
|
39
39
|
agentic-seo-check is one core with two interfaces:
|
|
40
40
|
|
|
41
41
|
- **CLI** `agentic-seo-check` with JSON (default when piped) or Markdown output and CI-friendly exit codes.
|
|
42
|
-
- **MCP server** exposing
|
|
42
|
+
- **MCP server** exposing six tools for Claude Code, Cursor, Codex and any other MCP client.
|
|
43
43
|
|
|
44
44
|
It audits **URLs** (production, staging, `localhost` dev servers), **static build output** (`dist/`, `out/`, `build/`) and **raw HTML**, and returns findings an agent can act on: a stable rule id, severity, what is wrong, the fix, a CSS selector for where it lives, and evidence with the current values.
|
|
45
45
|
|
|
46
|
+
Two audits share that core: the **SEO audit** (`audit`, `crawl`) for search engines, and the **AEO audit** (`aeo`, answer engine optimization) for AI answer engines such as ChatGPT search, Claude, Perplexity, Google AI Overviews and AI Mode, Copilot and Gemini. Each has its own rules and its own score, so adding one never changes the other.
|
|
47
|
+
|
|
46
48
|
## What it checks
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
### SEO audit
|
|
51
|
+
|
|
52
|
+
| Area | Examples (163 rules, `agentic-seo-check rules` lists them) |
|
|
49
53
|
| --- | --- |
|
|
50
54
|
| On-page basics | title missing/long/short/placeholder ("React App"), meta description, H1 and heading outline, canonical (missing, conflicting, relative, pointing elsewhere), robots meta and `X-Robots-Tag`, `lang`, viewport, charset, doctype |
|
|
55
|
+
| Head and indexing | an element that ends `<head>` early (a pixel `<img>`, an `<iframe>`, stray text) so Google ignores the metadata after it, canonical, description or hreflang in `<body>`, meta refresh redirects, a charset declared past the first 1024 bytes, contradicting (`index` and `noindex`) or misspelled (`no-index`) robots directives, an HTTP `Link` canonical that disagrees with the HTML one |
|
|
51
56
|
| Social | Open Graph completeness, absolute `og:image`, `og:url` vs canonical, Twitter card |
|
|
52
57
|
| Images and links | alt text, filename-style alt, missing dimensions (CLS), empty or generic anchor text, `href="#"`/`javascript:` anchors, http links on https pages, internal nofollow |
|
|
58
|
+
| URLs | uppercase letters or underscores in the page's path (locale segments such as `en-US` aside), session ids in the URL or internal links, campaign parameters (`utm_*`, `gclid`) on internal links, canonical, `og:image`, images or scripts on `localhost` or a private address, same-page `#links` to ids the page lacks, mixed content (blocked scripts, stylesheets and frames apart from images browsers upgrade) |
|
|
53
59
|
| International | hreflang syntax, absolute URLs, self reference, x-default, return links (crawl) |
|
|
54
|
-
| Structured data | JSON-LD parse errors, `@context`/`@type`, required and recommended properties for Article, Product, Offer, Organization, WebSite, BreadcrumbList,
|
|
60
|
+
| Structured data | JSON-LD parse errors, `@context`/`@type`, required and recommended properties for Article, Product, Offer, Organization, WebSite, BreadcrumbList, LocalBusiness, Event, Recipe, VideoObject, JobPosting, QAPage, Review, SoftwareApplication and more, ISO 8601 dates; values Google cannot use (a price with a currency symbol or decimal comma, a currency that is not ISO 4217, a rating outside its scale, breadcrumb positions and crumbs without a URL); relative URLs; `@id` references the page does not define; markup for rich results Google retired (FAQPage, HowTo, SpecialAnnouncement, ClaimReview, the sitelinks search box); microdata too |
|
|
55
61
|
| Content | empty or thin content, "lorem ipsum", readability, keyword presence in title/H1/body/description/URL and density |
|
|
56
62
|
| Response | 4xx/5xx, redirects and chains, slow HTML response, non-HTML content type, http instead of https |
|
|
57
|
-
|
|
|
63
|
+
| Loading (no browser needed) | HTML sent without gzip or Brotli, scripts in `<head>` without `async`/`defer`, `loading="lazy"` on the first large image (or with `fetchpriority="high"`), wide images without `srcset`, a home page without an icon link for Google's search results |
|
|
64
|
+
| Site-level (crawl or directory) | robots.txt (missing, blocking, disallowed pages, over 500 KiB, `noindex:` and `crawl-delay` lines Google ignores, CSS and JavaScript kept from Googlebot), sitemap (missing, invalid, noindex/non-canonical/broken/redirecting URLs, pages not in sitemap, orphan pages, over 50,000 URLs or 50 MB, an index inside an index, `lastmod` that is not W3C Datetime or lies in the future, URLs on another host; gzip sitemaps are read), broken internal links and images with their sources, redirected links and chains, duplicate titles/descriptions/H1s/content among canonical pages, URLs that answer under a second spelling (`/page` and `/page/`, or another case) or a query string that changes nothing, deep pages, soft 404, http→https and www redirects, hreflang return links; canonicals that point to a broken, redirecting or noindex URL or to a page that names another canonical, hreflang alternates that are broken, redirect, noindex or not canonical, noindex pages the site links to |
|
|
58
65
|
| Rendering (`--render`, Playwright) | title/description/canonical/H1/content/links/structured data that only exist after JavaScript runs; noindex injected or removed by JavaScript; console errors |
|
|
59
66
|
| Performance (`--lighthouse`, Chrome) | LCP, CLS, TBT, FCP, Speed Index, TTFB with Core Web Vitals thresholds, Lighthouse opportunities with estimated savings, failed Lighthouse SEO and agentic-browsing audits |
|
|
60
67
|
|
|
68
|
+
### AEO audit
|
|
69
|
+
|
|
70
|
+
| Area | Examples (30 rules, `agentic-seo-check rules --category aeo` lists them) |
|
|
71
|
+
| --- | --- |
|
|
72
|
+
| AI crawler access | robots.txt checked per bot: search crawlers whose index AI answers draw on (Googlebot, Bingbot, Applebot; blocked is an error), answer bots (OAI-SearchBot, ChatGPT-User, Claude-SearchBot, Claude-User, PerplexityBot, Perplexity-User, Google-Extended, DuckAssistBot, MistralAI-User; a warning) and training bots (GPTBot, ClaudeBot, Applebot-Extended, CCBot, meta-externalagent; info, since opting out of training is a legitimate choice). Also an unreachable robots.txt, `Content-Signal` lines (`ai-input=no`, invalid values), the shared training opt-out `User-Agent: __usage_ai-training`, and `/llms.txt` (missing, no H1 title, no links) |
|
|
73
|
+
| Server blocks (`--ai-bots`) | requests the page with each AI bot's User-Agent and reports 403s, 429s and challenge pages that a CDN or firewall serves while robots.txt allows the bot |
|
|
74
|
+
| Snippet and AI opt-outs | noindex, `nosnippet` and `max-snippet` (Google AI Overviews and AI Mode), `noarchive` and `nocache` (Bing's controls for Copilot), `noai`/`noimageai`, `data-nosnippet` over a large share of the text; meta tags per crawler and scoped `X-Robots-Tag` values |
|
|
75
|
+
| Answer-ready content | an empty JavaScript app shell (most AI crawlers do not run JavaScript), question headings without a short direct answer, long text without subheadings, lists or tables, FAQPage/QAPage/HowTo markup whose questions, answers or steps the page does not show |
|
|
76
|
+
| Entity and freshness | article author missing or a bare name without url/sameAs, missing datePublished/dateModified, a structured-data date the page does not show, a home page without Organization or Person markup, entities without sameAs links |
|
|
77
|
+
|
|
61
78
|
## Install
|
|
62
79
|
|
|
63
80
|
Requires Node 22.19 or newer. Published on npm as [`@rivi-software/agentic-seo-check`](https://www.npmjs.com/package/@rivi-software/agentic-seo-check); the commands it installs are `agentic-seo-check` and `agentic-seo-check-mcp`.
|
|
@@ -96,11 +113,20 @@ agentic-seo-check audit https://www.example.com/widgets --keyword "blue widgets"
|
|
|
96
113
|
# CI: exit 1 when errors exist, smaller output
|
|
97
114
|
agentic-seo-check audit https://staging.example.com --crawl --fail-on error --compact --no-info
|
|
98
115
|
|
|
116
|
+
# AEO: AI crawler access, opt-outs and answer-ready content, with its own score
|
|
117
|
+
agentic-seo-check aeo https://www.example.com/guide
|
|
118
|
+
agentic-seo-check aeo https://www.example.com --crawl --max-pages 50
|
|
119
|
+
agentic-seo-check aeo https://www.example.com --ai-bots # also catch CDN/firewall blocks
|
|
120
|
+
agentic-seo-check aeo ./dist --base-url https://www.example.com # reads dist/robots.txt and dist/llms.txt
|
|
121
|
+
|
|
99
122
|
# rule reference
|
|
100
123
|
agentic-seo-check rules --category structured-data
|
|
124
|
+
agentic-seo-check rules --category aeo
|
|
101
125
|
agentic-seo-check rules --rule canonical.multiple
|
|
102
126
|
```
|
|
103
127
|
|
|
128
|
+
`aeo` takes the same targets and output, crawl and request options as `audit`, plus `--ai-bots`; it has no `--keyword`, `--render`, `--lighthouse` or `--check-external`. With `--ai-bots`, the requests come from your machine with each bot's User-Agent, not from the bots' own IP ranges: a CDN that verifies bots may treat the real crawler differently, and the findings say so. Search crawlers and robots.txt-only tokens (Google-Extended, Applebot-Extended) are never impersonated.
|
|
129
|
+
|
|
104
130
|
Exit codes: `0` success, `1` findings at or above `--fail-on`, `2` usage or runtime error. Progress goes to stderr, the report to stdout.
|
|
105
131
|
|
|
106
132
|
## MCP server
|
|
@@ -126,6 +152,7 @@ Or `claude mcp add agentic-seo-check -- npx -y @rivi-software/agentic-seo-check
|
|
|
126
152
|
| `seo_crawl_site` | Crawl and audit a site. Options: `maxPages`, `maxDepth`, `concurrency`, `delayMs`, `respectRobots`, `includeSubdomains`, `checkExternalLinks`, `includePatterns`, `excludePatterns`, `pageDetail`. |
|
|
127
153
|
| `seo_audit_directory` | Audit built HTML files in a directory. Options: `dir`, `baseUrl`, `maxPages`, `pageDetail`. |
|
|
128
154
|
| `seo_lighthouse` | Lighthouse performance + SEO + agentic-browsing for one URL. |
|
|
155
|
+
| `seo_aeo_audit` | AEO audit of one of `url` (with `crawl` for a site), `html` or `dir`. Options: `aiBots`, `baseUrl`, `maxPages`, `maxDepth`, `concurrency`, `respectRobots`, `includeSubdomains`, `pageDetail`, `includeInfo`, `disableRules`, `headers`, `format`, `detail`. |
|
|
129
156
|
| `seo_list_rules` | Rule reference, filter by `category` or `rule`. |
|
|
130
157
|
|
|
131
158
|
All tools are read-only. Results are returned both as text (JSON or Markdown) and as `structuredContent`.
|
|
@@ -164,21 +191,54 @@ All tools are read-only. Results are returned both as text (JSON or Markdown) an
|
|
|
164
191
|
|
|
165
192
|
Site audits add `crawl` stats, `robotsTxt`, `sitemaps`, `siteFindings`, `issues` (page findings rolled up per rule with example URLs) and `pages`.
|
|
166
193
|
|
|
194
|
+
An AEO audit has `kind: "aeo"` and its own score:
|
|
195
|
+
|
|
196
|
+
```jsonc
|
|
197
|
+
{
|
|
198
|
+
"schemaVersion": 1,
|
|
199
|
+
"kind": "aeo",
|
|
200
|
+
"target": "https://www.example.com/guide",
|
|
201
|
+
"url": "https://www.example.com/guide",
|
|
202
|
+
"source": "url", // or "crawl", "directory", "file", "html"
|
|
203
|
+
"score": 89, // average page score minus weighted site-wide findings
|
|
204
|
+
"counts": { "error": 0, "warning": 2, "info": 1 },
|
|
205
|
+
"summary": {
|
|
206
|
+
"pages": 1, "robotsTxt": "found", "llmsTxt": "missing",
|
|
207
|
+
"searchCrawlersBlocked": [], "answerBotsBlocked": ["Google-Extended"], "trainingBotsBlocked": ["GPTBot"],
|
|
208
|
+
"trainingPreference": "none", // the __usage_ai-training group: "allowed", "disallowed" or "none"
|
|
209
|
+
"blockedByServer": null, // with --ai-bots: the bots the server refused
|
|
210
|
+
"page": { "indexable": true, "googleSnippets": "allowed", "copilotAnswers": "allowed", "questions": 4, "...": "…" }
|
|
211
|
+
},
|
|
212
|
+
"findings": [ { "rule": "aeo.robots-blocks-answer-bot", "severity": "warning", "...": "…" } ],
|
|
213
|
+
"crawlers": { "robotsTxt": "https://www.example.com/robots.txt", "status": "found", "contentSignals": [], "bots": [
|
|
214
|
+
{ "name": "OAI-SearchBot", "operator": "OpenAI", "purpose": "answer", "usedFor": "ChatGPT search results", "robotsGroup": "wildcard", "allowed": true, "blockedPages": 0 }
|
|
215
|
+
] },
|
|
216
|
+
"llmsTxt": { "url": "https://www.example.com/llms.txt", "status": "missing", "...": "…" }
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
A crawl or directory adds `pages` (each page's score and summary) and `issues`. `findings` holds the site-wide findings plus every page finding, except for a site audited with `pageDetail: "summary"` (the MCP default), where page findings are only rolled up in `issues`.
|
|
221
|
+
|
|
167
222
|
## Library
|
|
168
223
|
|
|
169
224
|
```ts
|
|
170
|
-
import { auditUrl, auditSite,
|
|
225
|
+
import { auditUrl, auditSite, auditAeoUrl, renderMarkdown, renderAeoMarkdown } from '@rivi-software/agentic-seo-check';
|
|
171
226
|
|
|
172
227
|
const page = await auditUrl('https://www.example.com/', { keyword: 'example', render: true });
|
|
173
228
|
const site = await auditSite('https://www.example.com/', { maxPages: 100 });
|
|
174
229
|
console.log(renderMarkdown(site));
|
|
230
|
+
|
|
231
|
+
const aeo = await auditAeoUrl('https://www.example.com/guide', { aiBots: true });
|
|
232
|
+
console.log(renderAeoMarkdown(aeo));
|
|
175
233
|
```
|
|
176
234
|
|
|
177
235
|
## Scope of this first version
|
|
178
236
|
|
|
179
237
|
- Crawls are breadth-first, same-site, HTML only, and obey robots.txt by default. `--render`/`--lighthouse` apply to the start page only during a crawl.
|
|
180
238
|
- Scores are indicative. Thresholds (title 30-60 chars, description 70-160, thin content 300 words, slow response 2 s, deep page depth 3) are configurable through the library `thresholds` option.
|
|
181
|
-
-
|
|
239
|
+
- The AEO audit reads what answer engines document: robots.txt tokens, Content-Signal, snippet controls, structured data. Whether an engine cites a page also depends on things no audit can see from outside (its index, its ranking, the question asked), so the AEO score says how ready a site is, not how often it is cited. llms.txt is reported at info level: no major answer engine has said it reads one.
|
|
240
|
+
- Sitemaps are read up to 15 MB each (uncompressed), and at most 25 of them; a larger one is reported, not checked.
|
|
241
|
+
- Not included yet: rendering every page in a crawl, field (CrUX) data, rank tracking, backlink data, AI-generated copy suggestions, tracking of citations in AI answers.
|
|
182
242
|
|
|
183
243
|
## Contributing
|
|
184
244
|
|
package/dist/cli.js
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
import { promises as fs } from "node:fs";
|
|
3
3
|
import { Command, InvalidArgumentError, Option } from "commander";
|
|
4
4
|
import { MAKER, MAKER_URL, REPOSITORY_URL } from "./brand.js";
|
|
5
|
+
import { auditAeoTarget, compactAeoAudit } from "./core/aeo/audit.js";
|
|
5
6
|
import { auditTarget, compactAudit } from "./core/audit.js";
|
|
6
|
-
import { renderMarkdown } from "./core/report/markdown.js";
|
|
7
|
+
import { renderAeoMarkdown, renderMarkdown } from "./core/report/markdown.js";
|
|
7
8
|
import { ALL_RULES } from "./core/rules/index.js";
|
|
8
9
|
import { SEVERITY_RANK } from "./core/types.js";
|
|
9
10
|
import { startMcpServer } from "./mcp.js";
|
|
@@ -11,7 +12,7 @@ import { VERSION } from "./version.js";
|
|
|
11
12
|
const program = new Command();
|
|
12
13
|
program
|
|
13
14
|
.name("agentic-seo-check")
|
|
14
|
-
.description("SEO analysis for coding agents. Audits URLs, static build output or raw HTML and prints machine-readable findings.")
|
|
15
|
+
.description("SEO and AEO analysis for coding agents. Audits URLs, static build output or raw HTML for search engines (audit, crawl) and AI answer engines (aeo), and prints machine-readable findings.")
|
|
15
16
|
.version(VERSION)
|
|
16
17
|
.addHelpText("afterAll", `\nMade by ${MAKER} (${MAKER_URL}). Docs and issues: ${REPOSITORY_URL}`)
|
|
17
18
|
.showHelpAfterError();
|
|
@@ -23,25 +24,35 @@ const intArg = (value) => {
|
|
|
23
24
|
}
|
|
24
25
|
return n;
|
|
25
26
|
};
|
|
26
|
-
const addAuditOptions = (cmd,
|
|
27
|
-
if (
|
|
27
|
+
const addAuditOptions = (cmd, mode) => {
|
|
28
|
+
if (mode !== "crawl") {
|
|
28
29
|
cmd.option("--crawl", "Crawl the whole site starting at the URL instead of auditing one page");
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
+
cmd
|
|
31
32
|
.option("--max-pages <n>", "Maximum pages to crawl", intArg, 50)
|
|
32
33
|
.option("--max-depth <n>", "Maximum link depth from the start URL", intArg, 3)
|
|
33
34
|
.option("--concurrency <n>", "Parallel requests while crawling", intArg, 5)
|
|
34
|
-
.option("--delay <ms>", "Delay between requests per worker", intArg, 0)
|
|
35
|
-
|
|
36
|
-
.option("--
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
.option("--delay <ms>", "Delay between requests per worker", intArg, 0);
|
|
36
|
+
if (mode === "aeo") {
|
|
37
|
+
cmd.option("--ai-bots", "Also request the page with each AI bot's User-Agent to catch CDN or firewall blocks");
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
cmd
|
|
41
|
+
.option("-k, --keyword <keyword>", "Target keyword for keyword.* checks")
|
|
42
|
+
.option("--render", "Render with headless Chromium (Playwright) and compare with the server HTML")
|
|
43
|
+
.option("--lighthouse", "Run Lighthouse for Core Web Vitals and Lighthouse SEO audits (slow)")
|
|
44
|
+
.addOption(new Option("--form-factor <type>", "Lighthouse device emulation")
|
|
45
|
+
.choices(["mobile", "desktop"])
|
|
46
|
+
.default("mobile"));
|
|
47
|
+
}
|
|
48
|
+
cmd
|
|
41
49
|
.option("--base-url <url>", "Origin used for directories, files and stdin HTML (default http://localhost/)")
|
|
42
50
|
.option("--ignore-robots", "Do not obey robots.txt while crawling")
|
|
43
|
-
.option("--include-subdomains", "Treat subdomains as internal when crawling")
|
|
44
|
-
|
|
51
|
+
.option("--include-subdomains", "Treat subdomains as internal when crawling");
|
|
52
|
+
if (mode !== "aeo") {
|
|
53
|
+
cmd.option("--check-external", "Probe external links for 4xx/5xx while crawling");
|
|
54
|
+
}
|
|
55
|
+
return cmd
|
|
45
56
|
.option("--include <regex...>", "Only crawl URLs matching these patterns")
|
|
46
57
|
.option("--exclude <regex...>", "Skip URLs matching these patterns")
|
|
47
58
|
.addOption(new Option("-f, --format <format>", "Output format (default: json when piped, md on a terminal)").choices(["json", "md"]))
|
|
@@ -70,25 +81,33 @@ const formatOf = (opts) => {
|
|
|
70
81
|
}
|
|
71
82
|
return process.stdout.isTTY ? "md" : "json";
|
|
72
83
|
};
|
|
73
|
-
|
|
84
|
+
/** `-H "Name: value"` flags as request headers. */
|
|
85
|
+
const parseHeaders = (values = []) => {
|
|
74
86
|
const headers = {};
|
|
75
|
-
for (const h of
|
|
87
|
+
for (const h of values) {
|
|
76
88
|
const idx = h.indexOf(":");
|
|
77
89
|
if (idx === -1) {
|
|
78
90
|
throw new InvalidArgumentError(`Header "${h}" must be "Name: value".`);
|
|
79
91
|
}
|
|
80
92
|
headers[h.slice(0, idx).trim()] = h.slice(idx + 1).trim();
|
|
81
93
|
}
|
|
94
|
+
return headers;
|
|
95
|
+
};
|
|
96
|
+
const progressPrinter = (opts) => {
|
|
82
97
|
const showProgress = !opts.quiet && process.stderr.isTTY;
|
|
83
|
-
|
|
98
|
+
return (e) => {
|
|
84
99
|
if (!showProgress) {
|
|
85
100
|
return;
|
|
86
101
|
}
|
|
87
102
|
const counter = e.crawled === undefined ? "" : ` [${e.crawled}/${e.discovered}]`;
|
|
88
103
|
process.stderr.write(`\u001B[2m${e.phase}${counter}: ${e.message}\u001B[0m\n`);
|
|
89
104
|
};
|
|
105
|
+
};
|
|
106
|
+
/** Runs the audit the command asks for, and renders it in the format asked for. */
|
|
107
|
+
const auditFor = async (target, opts, mode) => {
|
|
108
|
+
const headers = parseHeaders(opts.header);
|
|
90
109
|
const options = {
|
|
91
|
-
crawl:
|
|
110
|
+
crawl: mode === "crawl" || Boolean(opts.crawl),
|
|
92
111
|
maxPages: opts.maxPages,
|
|
93
112
|
maxDepth: opts.maxDepth,
|
|
94
113
|
concurrency: opts.concurrency,
|
|
@@ -111,14 +130,33 @@ const runAudit = async (target, opts, forceCrawl) => {
|
|
|
111
130
|
userAgent: opts.userAgent,
|
|
112
131
|
headers: Object.keys(headers).length ? headers : undefined,
|
|
113
132
|
},
|
|
114
|
-
onProgress,
|
|
133
|
+
onProgress: progressPrinter(opts),
|
|
115
134
|
};
|
|
135
|
+
const format = formatOf(opts);
|
|
136
|
+
if (mode === "aeo") {
|
|
137
|
+
let aeo = await auditAeoTarget(target, {
|
|
138
|
+
...options,
|
|
139
|
+
aiBots: opts.aiBots,
|
|
140
|
+
});
|
|
141
|
+
if (opts.compact) {
|
|
142
|
+
aeo = compactAeoAudit(aeo);
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
counts: aeo.counts,
|
|
146
|
+
output: format === "md" ? renderAeoMarkdown(aeo) : JSON.stringify(aeo, null, 2),
|
|
147
|
+
};
|
|
148
|
+
}
|
|
116
149
|
let audit = await auditTarget(target, options);
|
|
117
150
|
if (opts.compact) {
|
|
118
151
|
audit = compactAudit(audit);
|
|
119
152
|
}
|
|
120
|
-
|
|
121
|
-
|
|
153
|
+
return {
|
|
154
|
+
counts: audit.counts,
|
|
155
|
+
output: format === "md" ? renderMarkdown(audit) : JSON.stringify(audit, null, 2),
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
const runAudit = async (target, opts, mode) => {
|
|
159
|
+
const { counts, output } = await auditFor(target, opts, mode);
|
|
122
160
|
if (opts.out) {
|
|
123
161
|
await fs.writeFile(opts.out, `${output}\n`, "utf-8");
|
|
124
162
|
if (!opts.quiet) {
|
|
@@ -130,7 +168,6 @@ const runAudit = async (target, opts, forceCrawl) => {
|
|
|
130
168
|
}
|
|
131
169
|
if (opts.failOn !== "none") {
|
|
132
170
|
const threshold = SEVERITY_RANK[opts.failOn];
|
|
133
|
-
const { counts } = audit;
|
|
134
171
|
const hits = ["error", "warning", "info"]
|
|
135
172
|
.filter((s) => SEVERITY_RANK[s] >= threshold)
|
|
136
173
|
.reduce((n, s) => n + counts[s], 0);
|
|
@@ -145,14 +182,20 @@ const runAudit = async (target, opts, forceCrawl) => {
|
|
|
145
182
|
addAuditOptions(program
|
|
146
183
|
.command("audit")
|
|
147
184
|
.argument("<target>", 'URL, directory of HTML files, .html file, or "-" for HTML on stdin')
|
|
148
|
-
.description("Audit a page, a site (--crawl), a build directory or raw HTML"),
|
|
149
|
-
await runAudit(target, opts,
|
|
185
|
+
.description("Audit a page, a site (--crawl), a build directory or raw HTML"), "audit").action(async (target, opts) => {
|
|
186
|
+
await runAudit(target, opts, "audit");
|
|
150
187
|
});
|
|
151
188
|
addAuditOptions(program
|
|
152
189
|
.command("crawl")
|
|
153
190
|
.argument("<url>", "Start URL")
|
|
154
|
-
.description('Crawl a site and audit every page (same as "audit --crawl")'),
|
|
155
|
-
await runAudit(url, opts,
|
|
191
|
+
.description('Crawl a site and audit every page (same as "audit --crawl")'), "crawl").action(async (url, opts) => {
|
|
192
|
+
await runAudit(url, opts, "crawl");
|
|
193
|
+
});
|
|
194
|
+
addAuditOptions(program
|
|
195
|
+
.command("aeo")
|
|
196
|
+
.argument("<target>", 'URL, directory of HTML files, .html file, or "-" for HTML on stdin')
|
|
197
|
+
.description("Answer engine optimization audit: AI crawler access (robots.txt, llms.txt), snippet and AI opt-outs, answer-ready content, entities and freshness, with its own score"), "aeo").action(async (target, opts) => {
|
|
198
|
+
await runAudit(target, opts, "aeo");
|
|
156
199
|
});
|
|
157
200
|
program
|
|
158
201
|
.command("rules")
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAElE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAA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O,KAAK,EAAE,CAAC;IACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,sBAAsB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CACjF,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ProgressEvent } from "../audit.js";
|
|
2
|
+
import type { FetchOptions } from "../fetch.js";
|
|
3
|
+
import type { AeoAudit } from "../types.js";
|
|
4
|
+
export interface AeoOptions {
|
|
5
|
+
/** Crawl the site from a URL target instead of auditing one page. */
|
|
6
|
+
crawl?: boolean;
|
|
7
|
+
maxPages?: number;
|
|
8
|
+
maxDepth?: number;
|
|
9
|
+
concurrency?: number;
|
|
10
|
+
delayMs?: number;
|
|
11
|
+
respectRobots?: boolean;
|
|
12
|
+
includeSubdomains?: boolean;
|
|
13
|
+
includePatterns?: string[];
|
|
14
|
+
excludePatterns?: string[];
|
|
15
|
+
/** Base URL for inline HTML, files and directories (default http://localhost/). */
|
|
16
|
+
baseUrl?: string;
|
|
17
|
+
/** Also request the page with each AI bot's User-Agent, to catch CDN or firewall blocks. */
|
|
18
|
+
aiBots?: boolean;
|
|
19
|
+
/** Include info-level findings (default true). */
|
|
20
|
+
includeInfo?: boolean;
|
|
21
|
+
/** Rule ids to skip. */
|
|
22
|
+
disableRules?: string[];
|
|
23
|
+
/** Site audits: "summary" keeps page findings out of `findings`; they stay rolled up in `issues`. */
|
|
24
|
+
pageDetail?: "full" | "summary";
|
|
25
|
+
fetch?: FetchOptions;
|
|
26
|
+
onProgress?: (event: ProgressEvent) => void;
|
|
27
|
+
}
|
|
28
|
+
/** AEO audit of an HTML string. `url` is where the HTML would be served, for links and display. */
|
|
29
|
+
export declare const auditAeoHtml: (html: string, input?: {
|
|
30
|
+
url?: string;
|
|
31
|
+
target?: string;
|
|
32
|
+
}, options?: AeoOptions) => Promise<AeoAudit>;
|
|
33
|
+
/** AEO audit of one live page, with its site's robots.txt and llms.txt. */
|
|
34
|
+
export declare const auditAeoUrl: (url: string, options?: AeoOptions) => Promise<AeoAudit>;
|
|
35
|
+
/** AEO audit of a site, crawled from `startUrl`. */
|
|
36
|
+
export declare const auditAeoSite: (startUrl: string, options?: AeoOptions) => Promise<AeoAudit>;
|
|
37
|
+
/** AEO audit of a directory of built HTML, with the robots.txt and llms.txt in it. */
|
|
38
|
+
export declare const auditAeoDirectory: (dir: string, options?: AeoOptions) => Promise<AeoAudit>;
|
|
39
|
+
/** AEO audit of a URL (a crawl with `crawl`), a directory, an .html file, or "-" for stdin. */
|
|
40
|
+
export declare const auditAeoTarget: (target: string, options?: AeoOptions & {
|
|
41
|
+
stdinHtml?: string;
|
|
42
|
+
}) => Promise<AeoAudit>;
|
|
43
|
+
/** Drops bulky detail to save tokens when an LLM reads the result. */
|
|
44
|
+
export declare const compactAeoAudit: (audit: AeoAudit) => AeoAudit;
|