@rivi-software/agentic-seo-check 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +160 -2
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +149 -0
- package/dist/cli.js.map +1 -0
- package/dist/core/audit.d.ts +72 -0
- package/dist/core/audit.js +337 -0
- package/dist/core/audit.js.map +1 -0
- package/dist/core/concurrency.d.ts +4 -0
- package/dist/core/concurrency.js +29 -0
- package/dist/core/concurrency.js.map +1 -0
- package/dist/core/crawl.d.ts +40 -0
- package/dist/core/crawl.js +195 -0
- package/dist/core/crawl.js.map +1 -0
- package/dist/core/fetch.d.ts +27 -0
- package/dist/core/fetch.js +135 -0
- package/dist/core/fetch.js.map +1 -0
- package/dist/core/html/extract.d.ts +10 -0
- package/dist/core/html/extract.js +150 -0
- package/dist/core/html/extract.js.map +1 -0
- package/dist/core/html/structured-data.d.ts +11 -0
- package/dist/core/html/structured-data.js +185 -0
- package/dist/core/html/structured-data.js.map +1 -0
- package/dist/core/html/text.d.ts +23 -0
- package/dist/core/html/text.js +149 -0
- package/dist/core/html/text.js.map +1 -0
- package/dist/core/lighthouse.d.ts +49 -0
- package/dist/core/lighthouse.js +140 -0
- package/dist/core/lighthouse.js.map +1 -0
- package/dist/core/performance-rules.d.ts +3 -0
- package/dist/core/performance-rules.js +53 -0
- package/dist/core/performance-rules.js.map +1 -0
- package/dist/core/render-rules.d.ts +7 -0
- package/dist/core/render-rules.js +77 -0
- package/dist/core/render-rules.js.map +1 -0
- package/dist/core/render.d.ts +22 -0
- package/dist/core/render.js +73 -0
- package/dist/core/render.js.map +1 -0
- package/dist/core/report/markdown.d.ts +2 -0
- package/dist/core/report/markdown.js +152 -0
- package/dist/core/report/markdown.js.map +1 -0
- package/dist/core/robots.d.ts +11 -0
- package/dist/core/robots.js +33 -0
- package/dist/core/robots.js.map +1 -0
- package/dist/core/rules/canonical.d.ts +2 -0
- package/dist/core/rules/canonical.js +105 -0
- package/dist/core/rules/canonical.js.map +1 -0
- package/dist/core/rules/content.d.ts +1 -0
- package/dist/core/rules/content.js +41 -0
- package/dist/core/rules/content.js.map +1 -0
- package/dist/core/rules/document.d.ts +1 -0
- package/dist/core/rules/document.js +60 -0
- package/dist/core/rules/document.js.map +1 -0
- package/dist/core/rules/headings.d.ts +1 -0
- package/dist/core/rules/headings.js +61 -0
- package/dist/core/rules/headings.js.map +1 -0
- package/dist/core/rules/hreflang.d.ts +1 -0
- package/dist/core/rules/hreflang.js +68 -0
- package/dist/core/rules/hreflang.js.map +1 -0
- package/dist/core/rules/images.d.ts +1 -0
- package/dist/core/rules/images.js +59 -0
- package/dist/core/rules/images.js.map +1 -0
- package/dist/core/rules/index.d.ts +14 -0
- package/dist/core/rules/index.js +76 -0
- package/dist/core/rules/index.js.map +1 -0
- package/dist/core/rules/indexing.d.ts +10 -0
- package/dist/core/rules/indexing.js +53 -0
- package/dist/core/rules/indexing.js.map +1 -0
- package/dist/core/rules/keyword.d.ts +1 -0
- package/dist/core/rules/keyword.js +74 -0
- package/dist/core/rules/keyword.js.map +1 -0
- package/dist/core/rules/links.d.ts +1 -0
- package/dist/core/rules/links.js +72 -0
- package/dist/core/rules/links.js.map +1 -0
- package/dist/core/rules/meta.d.ts +1 -0
- package/dist/core/rules/meta.js +60 -0
- package/dist/core/rules/meta.js.map +1 -0
- package/dist/core/rules/response.d.ts +1 -0
- package/dist/core/rules/response.js +59 -0
- package/dist/core/rules/response.js.map +1 -0
- package/dist/core/rules/rule.d.ts +42 -0
- package/dist/core/rules/rule.js +51 -0
- package/dist/core/rules/rule.js.map +1 -0
- package/dist/core/rules/social.d.ts +1 -0
- package/dist/core/rules/social.js +74 -0
- package/dist/core/rules/social.js.map +1 -0
- package/dist/core/rules/structured-data.d.ts +23 -0
- package/dist/core/rules/structured-data.js +169 -0
- package/dist/core/rules/structured-data.js.map +1 -0
- package/dist/core/rules/title.d.ts +1 -0
- package/dist/core/rules/title.js +59 -0
- package/dist/core/rules/title.js.map +1 -0
- package/dist/core/score.d.ts +3 -0
- package/dist/core/score.js +15 -0
- package/dist/core/score.js.map +1 -0
- package/dist/core/site-rules.d.ts +64 -0
- package/dist/core/site-rules.js +251 -0
- package/dist/core/site-rules.js.map +1 -0
- package/dist/core/sitemap.d.ts +13 -0
- package/dist/core/sitemap.js +95 -0
- package/dist/core/sitemap.js.map +1 -0
- package/dist/core/static.d.ts +9 -0
- package/dist/core/static.js +184 -0
- package/dist/core/static.js.map +1 -0
- package/dist/core/summary.d.ts +2 -0
- package/dist/core/summary.js +28 -0
- package/dist/core/summary.js.map +1 -0
- package/dist/core/types.d.ts +296 -0
- package/dist/core/types.js +26 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/url.d.ts +20 -0
- package/dist/core/url.js +139 -0
- package/dist/core/url.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-bin.d.ts +2 -0
- package/dist/mcp-bin.js +7 -0
- package/dist/mcp-bin.js.map +1 -0
- package/dist/mcp.d.ts +5 -0
- package/dist/mcp.js +190 -0
- package/dist/mcp.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +4 -0
- package/dist/version.js.map +1 -0
- package/package.json +89 -3
- package/skills/seo-audit/SKILL.md +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Rik Visser, Rivi Software
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,161 @@
|
|
|
1
|
-
|
|
1
|
+
<img src="assets/icon.svg" width="64" height="64" alt="">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# agentic-seo-check
|
|
4
|
+
|
|
5
|
+
SEO analysis built for coding agents. One core, two interfaces:
|
|
6
|
+
|
|
7
|
+
- **CLI** `agentic-seo-check` with JSON (default when piped) or Markdown output and CI-friendly exit codes.
|
|
8
|
+
- **MCP server** exposing five tools for Claude Code, Cursor, Codex and any other MCP client.
|
|
9
|
+
|
|
10
|
+
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.
|
|
11
|
+
|
|
12
|
+
## What it checks
|
|
13
|
+
|
|
14
|
+
| Area | Examples (123 rules in total, `agentic-seo-check rules` lists them) |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| 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 |
|
|
17
|
+
| Social | Open Graph completeness, absolute `og:image`, `og:url` vs canonical, Twitter card |
|
|
18
|
+
| 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 |
|
|
19
|
+
| International | hreflang syntax, absolute URLs, self reference, x-default, return links (crawl) |
|
|
20
|
+
| Structured data | JSON-LD parse errors, `@context`/`@type`, required and recommended properties for Article, Product, Offer, Organization, WebSite, BreadcrumbList, FAQPage, LocalBusiness, Event, Recipe, VideoObject, JobPosting, HowTo, Review, SoftwareApplication and more, ISO 8601 dates; microdata too |
|
|
21
|
+
| Content | empty or thin content, "lorem ipsum", readability, keyword presence in title/H1/body/description/URL and density |
|
|
22
|
+
| Response | 4xx/5xx, redirects and chains, slow HTML response, non-HTML content type, http instead of https |
|
|
23
|
+
| Site-level (crawl or directory) | robots.txt (missing, blocking, disallowed pages), sitemap (missing, invalid, noindex/non-canonical/broken/redirecting URLs, pages not in sitemap, orphan pages), broken internal links with their sources, redirected links and chains, duplicate titles/descriptions/H1s/content, deep pages, soft 404, http→https and www redirects, hreflang return links |
|
|
24
|
+
| 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 |
|
|
25
|
+
| 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 |
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
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`.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx @rivi-software/agentic-seo-check audit https://example.com # no install
|
|
33
|
+
npm install -g @rivi-software/agentic-seo-check # or pnpm add -D / npm i -D in a project
|
|
34
|
+
agentic-seo-check --help
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Optional, only for `--render` and `--lighthouse`: `playwright` and `lighthouse` (+ `chrome-launcher`) are optional peer dependencies, so install them next to the tool, plus Google Chrome or `npx playwright install chromium`. The renderer uses a Playwright-managed Chromium when present and falls back to the installed Google Chrome or Edge.
|
|
38
|
+
|
|
39
|
+
From source: `pnpm install && pnpm build && node dist/cli.js --help`.
|
|
40
|
+
|
|
41
|
+
## CLI
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# one page (Markdown on a terminal, JSON when piped or with --format json)
|
|
45
|
+
agentic-seo-check audit https://www.example.com/pricing
|
|
46
|
+
|
|
47
|
+
# whole site
|
|
48
|
+
agentic-seo-check crawl https://www.example.com --max-pages 100 --max-depth 4
|
|
49
|
+
|
|
50
|
+
# local dev server, ignore the dev robots.txt, include JS rendering comparison
|
|
51
|
+
agentic-seo-check audit http://localhost:3000 --crawl --ignore-robots --render
|
|
52
|
+
|
|
53
|
+
# static export, with the production origin for canonical/sitemap comparison
|
|
54
|
+
agentic-seo-check audit ./out --base-url https://www.example.com
|
|
55
|
+
|
|
56
|
+
# raw HTML from stdin
|
|
57
|
+
cat page.html | agentic-seo-check audit - --base-url https://www.example.com/page
|
|
58
|
+
|
|
59
|
+
# keyword focus, Lighthouse, Markdown report to a file
|
|
60
|
+
agentic-seo-check audit https://www.example.com/widgets --keyword "blue widgets" --lighthouse -o report.md
|
|
61
|
+
|
|
62
|
+
# CI: exit 1 when errors exist, smaller output
|
|
63
|
+
agentic-seo-check audit https://staging.example.com --crawl --fail-on error --compact --no-info
|
|
64
|
+
|
|
65
|
+
# rule reference
|
|
66
|
+
agentic-seo-check rules --category structured-data
|
|
67
|
+
agentic-seo-check rules --rule canonical.multiple
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Exit codes: `0` success, `1` findings at or above `--fail-on`, `2` usage or runtime error. Progress goes to stderr, the report to stdout.
|
|
71
|
+
|
|
72
|
+
## MCP server
|
|
73
|
+
|
|
74
|
+
Add to a project `.mcp.json` (Claude Code reads it automatically):
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"mcpServers": {
|
|
79
|
+
"agentic-seo-check": {
|
|
80
|
+
"command": "npx",
|
|
81
|
+
"args": ["-y", "@rivi-software/agentic-seo-check", "mcp"]
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Or `claude mcp add agentic-seo-check -- npx -y @rivi-software/agentic-seo-check mcp`. From a source checkout, use `node /absolute/path/to/agentic-seo-check/dist/mcp-bin.js` instead (this repo's own `.mcp.json` does that).
|
|
88
|
+
|
|
89
|
+
| Tool | Purpose |
|
|
90
|
+
| --- | --- |
|
|
91
|
+
| `seo_audit_page` | Audit one URL or an HTML string. Options: `keyword`, `render`, `lighthouse`, `formFactor`, `includeInfo`, `disableRules`, `headers`, `format` (json/markdown), `detail` (compact/full). |
|
|
92
|
+
| `seo_crawl_site` | Crawl and audit a site. Options: `maxPages`, `maxDepth`, `concurrency`, `delayMs`, `respectRobots`, `includeSubdomains`, `checkExternalLinks`, `includePatterns`, `excludePatterns`, `pageDetail`. |
|
|
93
|
+
| `seo_audit_directory` | Audit built HTML files in a directory. Options: `dir`, `baseUrl`, `maxPages`, `pageDetail`. |
|
|
94
|
+
| `seo_lighthouse` | Lighthouse performance + SEO + agentic-browsing for one URL. |
|
|
95
|
+
| `seo_list_rules` | Rule reference, filter by `category` or `rule`. |
|
|
96
|
+
|
|
97
|
+
All tools are read-only. Results are returned both as text (JSON or Markdown) and as `structuredContent`.
|
|
98
|
+
|
|
99
|
+
## Agent skill
|
|
100
|
+
|
|
101
|
+
`skills/seo-audit/SKILL.md` teaches an agent the audit → fix → re-audit loop, how to map rule ids to framework code (Next.js, Astro, Nuxt, SvelteKit, Remix, TanStack Start), and the caveats (preview-host noindex, localhost limits). Copy it to `.claude/skills/seo-audit/` in a project or `~/.claude/skills/` to make it available; this repo links it under `.claude/skills/`.
|
|
102
|
+
|
|
103
|
+
## Output shape
|
|
104
|
+
|
|
105
|
+
```jsonc
|
|
106
|
+
{
|
|
107
|
+
"schemaVersion": 1,
|
|
108
|
+
"kind": "page", // or "site"
|
|
109
|
+
"url": "https://www.example.com/",
|
|
110
|
+
"score": 67, // 100 - 15/error - 5/warning - 1/info, floored at 0
|
|
111
|
+
"counts": { "error": 0, "warning": 6, "info": 3 },
|
|
112
|
+
"summary": { "title": "…", "metaDescription": null, "canonical": null, "indexable": true, "h1": [], "wordCount": 25, "...": "…" },
|
|
113
|
+
"findings": [
|
|
114
|
+
{
|
|
115
|
+
"rule": "meta-description.missing",
|
|
116
|
+
"severity": "warning",
|
|
117
|
+
"category": "meta",
|
|
118
|
+
"message": "Page has no meta description.",
|
|
119
|
+
"recommendation": "Add a unique meta description (about 70-160 characters) …",
|
|
120
|
+
"selector": "head > meta[name=\"description\"]",
|
|
121
|
+
"url": "https://www.example.com/",
|
|
122
|
+
"docs": "https://developers.google.com/search/docs/appearance/snippet"
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
"response": { "status": 200, "finalUrl": "…", "redirectChain": [], "timeMs": 142, "headers": { "content-type": "text/html" } },
|
|
126
|
+
"performance": { "metrics": { "performanceScore": 99, "lcpMs": 848, "cls": 0, "...": "…" }, "opportunities": [] }, // with --lighthouse
|
|
127
|
+
"rendering": { "raw": { "wordCount": 25 }, "rendered": { "wordCount": 137 }, "...": "…" } // with --render
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Site audits add `crawl` stats, `robotsTxt`, `sitemaps`, `siteFindings`, `issues` (page findings rolled up per rule with example URLs) and `pages`.
|
|
132
|
+
|
|
133
|
+
## Library
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
import { auditUrl, auditSite, auditDirectory, auditHtml, renderMarkdown } from '@rivi-software/agentic-seo-check';
|
|
137
|
+
|
|
138
|
+
const page = await auditUrl('https://www.example.com/', { keyword: 'example', render: true });
|
|
139
|
+
const site = await auditSite('https://www.example.com/', { maxPages: 100 });
|
|
140
|
+
console.log(renderMarkdown(site));
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Development
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
pnpm test # vitest: extractor, rules, crawler against a local fixture server, directory scan, MCP client
|
|
147
|
+
pnpm typecheck
|
|
148
|
+
pnpm dev audit https://example.com # run from source with tsx
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Scope of this first version
|
|
152
|
+
|
|
153
|
+
- 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.
|
|
154
|
+
- 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.
|
|
155
|
+
- Not included yet: gzip sitemaps, rendering every page in a crawl, field (CrUX) data, rank tracking, backlink data, AI-generated copy suggestions.
|
|
156
|
+
|
|
157
|
+
## License
|
|
158
|
+
|
|
159
|
+
MIT. See [LICENSE](LICENSE).
|
|
160
|
+
|
|
161
|
+
Created in [T3 Code](https://t3.codes).
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { promises as fs } from 'node:fs';
|
|
3
|
+
import { Command, InvalidArgumentError, Option } from 'commander';
|
|
4
|
+
import { auditTarget, compactAudit } from './core/audit.js';
|
|
5
|
+
import { renderMarkdown } from './core/report/markdown.js';
|
|
6
|
+
import { ALL_RULES } from './core/rules/index.js';
|
|
7
|
+
import { SEVERITY_RANK } from './core/types.js';
|
|
8
|
+
import { startMcpServer } from './mcp.js';
|
|
9
|
+
import { VERSION } from './version.js';
|
|
10
|
+
const program = new Command();
|
|
11
|
+
program
|
|
12
|
+
.name('agentic-seo-check')
|
|
13
|
+
.description('SEO analysis for coding agents. Audits URLs, static build output or raw HTML and prints machine-readable findings.')
|
|
14
|
+
.version(VERSION)
|
|
15
|
+
.showHelpAfterError();
|
|
16
|
+
const intArg = (value) => {
|
|
17
|
+
const n = Number.parseInt(value, 10);
|
|
18
|
+
if (!Number.isFinite(n) || n < 0)
|
|
19
|
+
throw new InvalidArgumentError('Expected a non-negative integer.');
|
|
20
|
+
return n;
|
|
21
|
+
};
|
|
22
|
+
function addAuditOptions(cmd, crawlDefault) {
|
|
23
|
+
if (!crawlDefault)
|
|
24
|
+
cmd.option('--crawl', 'Crawl the whole site starting at the URL instead of auditing one page');
|
|
25
|
+
return cmd
|
|
26
|
+
.option('--max-pages <n>', 'Maximum pages to crawl', intArg, 50)
|
|
27
|
+
.option('--max-depth <n>', 'Maximum link depth from the start URL', intArg, 3)
|
|
28
|
+
.option('--concurrency <n>', 'Parallel requests while crawling', intArg, 5)
|
|
29
|
+
.option('--delay <ms>', 'Delay between requests per worker', intArg, 0)
|
|
30
|
+
.option('-k, --keyword <keyword>', 'Target keyword for keyword.* checks')
|
|
31
|
+
.option('--render', 'Render with headless Chromium (Playwright) and compare with the server HTML')
|
|
32
|
+
.option('--lighthouse', 'Run Lighthouse for Core Web Vitals and Lighthouse SEO audits (slow)')
|
|
33
|
+
.addOption(new Option('--form-factor <type>', 'Lighthouse device emulation').choices(['mobile', 'desktop']).default('mobile'))
|
|
34
|
+
.option('--base-url <url>', 'Origin used for directories, files and stdin HTML (default http://localhost/)')
|
|
35
|
+
.option('--ignore-robots', 'Do not obey robots.txt while crawling')
|
|
36
|
+
.option('--include-subdomains', 'Treat subdomains as internal when crawling')
|
|
37
|
+
.option('--check-external', 'Probe external links for 4xx/5xx while crawling')
|
|
38
|
+
.option('--include <regex...>', 'Only crawl URLs matching these patterns')
|
|
39
|
+
.option('--exclude <regex...>', 'Skip URLs matching these patterns')
|
|
40
|
+
.addOption(new Option('-f, --format <format>', 'Output format (default: json when piped, md on a terminal)').choices(['json', 'md']))
|
|
41
|
+
.option('-o, --out <file>', 'Write the report to a file instead of stdout')
|
|
42
|
+
.addOption(new Option('--fail-on <severity>', 'Exit with code 1 when findings at or above this severity exist').choices(['error', 'warning', 'info', 'none']).default('none'))
|
|
43
|
+
.option('--no-info', 'Omit info-level findings')
|
|
44
|
+
.option('--compact', 'Trim evidence lists and bulky fields (smaller output for LLM consumption)')
|
|
45
|
+
.addOption(new Option('--page-detail <level>', 'Per-page detail in site reports').choices(['full', 'summary']).default('full'))
|
|
46
|
+
.option('--disable <rule...>', 'Rule ids to skip')
|
|
47
|
+
.option('--timeout <ms>', 'Per-request timeout', intArg, 15_000)
|
|
48
|
+
.option('--user-agent <ua>', 'Custom User-Agent header')
|
|
49
|
+
.option('-H, --header <header...>', 'Extra request header "Name: value" (repeatable)')
|
|
50
|
+
.option('-q, --quiet', 'Suppress progress output on stderr');
|
|
51
|
+
}
|
|
52
|
+
async function runAudit(target, opts, forceCrawl) {
|
|
53
|
+
const headers = {};
|
|
54
|
+
for (const h of opts.header ?? []) {
|
|
55
|
+
const idx = h.indexOf(':');
|
|
56
|
+
if (idx === -1)
|
|
57
|
+
throw new InvalidArgumentError(`Header "${h}" must be "Name: value".`);
|
|
58
|
+
headers[h.slice(0, idx).trim()] = h.slice(idx + 1).trim();
|
|
59
|
+
}
|
|
60
|
+
const showProgress = !opts.quiet && process.stderr.isTTY;
|
|
61
|
+
const onProgress = (e) => {
|
|
62
|
+
if (!showProgress)
|
|
63
|
+
return;
|
|
64
|
+
const counter = e.crawled !== undefined ? ` [${e.crawled}/${e.discovered}]` : '';
|
|
65
|
+
process.stderr.write(`\x1b[2m${e.phase}${counter}: ${e.message}\x1b[0m\n`);
|
|
66
|
+
};
|
|
67
|
+
const options = {
|
|
68
|
+
crawl: forceCrawl || Boolean(opts.crawl),
|
|
69
|
+
maxPages: opts.maxPages,
|
|
70
|
+
maxDepth: opts.maxDepth,
|
|
71
|
+
concurrency: opts.concurrency,
|
|
72
|
+
delayMs: opts.delay,
|
|
73
|
+
keyword: opts.keyword,
|
|
74
|
+
render: opts.render,
|
|
75
|
+
lighthouse: opts.lighthouse,
|
|
76
|
+
formFactor: opts.formFactor,
|
|
77
|
+
baseUrl: opts.baseUrl,
|
|
78
|
+
respectRobots: !opts.ignoreRobots,
|
|
79
|
+
includeSubdomains: opts.includeSubdomains,
|
|
80
|
+
checkExternalLinks: opts.checkExternal,
|
|
81
|
+
includePatterns: opts.include,
|
|
82
|
+
excludePatterns: opts.exclude,
|
|
83
|
+
includeInfo: opts.info,
|
|
84
|
+
disableRules: opts.disable,
|
|
85
|
+
pageDetail: opts.pageDetail,
|
|
86
|
+
fetch: { timeoutMs: opts.timeout, userAgent: opts.userAgent, headers: Object.keys(headers).length ? headers : undefined },
|
|
87
|
+
onProgress,
|
|
88
|
+
};
|
|
89
|
+
let audit = await auditTarget(target, options);
|
|
90
|
+
if (opts.compact)
|
|
91
|
+
audit = compactAudit(audit);
|
|
92
|
+
const format = opts.format ?? (opts.out ? (opts.out.endsWith('.md') ? 'md' : 'json') : process.stdout.isTTY ? 'md' : 'json');
|
|
93
|
+
const output = format === 'md' ? renderMarkdown(audit) : JSON.stringify(audit, null, 2);
|
|
94
|
+
if (opts.out) {
|
|
95
|
+
await fs.writeFile(opts.out, output + '\n', 'utf8');
|
|
96
|
+
if (!opts.quiet)
|
|
97
|
+
process.stderr.write(`Report written to ${opts.out}\n`);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
process.stdout.write(output + '\n');
|
|
101
|
+
}
|
|
102
|
+
if (opts.failOn !== 'none') {
|
|
103
|
+
const threshold = SEVERITY_RANK[opts.failOn];
|
|
104
|
+
const counts = audit.counts;
|
|
105
|
+
const hits = ['error', 'warning', 'info'].filter((s) => SEVERITY_RANK[s] >= threshold).reduce((n, s) => n + counts[s], 0);
|
|
106
|
+
if (hits > 0) {
|
|
107
|
+
if (!opts.quiet)
|
|
108
|
+
process.stderr.write(`${hits} finding(s) at or above "${opts.failOn}" severity.\n`);
|
|
109
|
+
process.exitCode = 1;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
addAuditOptions(program
|
|
114
|
+
.command('audit')
|
|
115
|
+
.argument('<target>', 'URL, directory of HTML files, .html file, or "-" for HTML on stdin')
|
|
116
|
+
.description('Audit a page, a site (--crawl), a build directory or raw HTML'), false).action(async (target, opts) => {
|
|
117
|
+
await runAudit(target, opts, false);
|
|
118
|
+
});
|
|
119
|
+
addAuditOptions(program.command('crawl').argument('<url>', 'Start URL').description('Crawl a site and audit every page (same as "audit --crawl")'), true).action(async (url, opts) => {
|
|
120
|
+
await runAudit(url, opts, true);
|
|
121
|
+
});
|
|
122
|
+
program
|
|
123
|
+
.command('rules')
|
|
124
|
+
.description('List the rules this tool can report')
|
|
125
|
+
.option('--category <category>', 'Filter by category')
|
|
126
|
+
.option('--rule <id>', 'Show one rule')
|
|
127
|
+
.addOption(new Option('-f, --format <format>', 'Output format').choices(['json', 'md']).default(process.stdout.isTTY ? 'md' : 'json'))
|
|
128
|
+
.action((opts) => {
|
|
129
|
+
const rules = ALL_RULES.filter((r) => (!opts.category || r.category === opts.category) && (!opts.rule || r.id === opts.rule));
|
|
130
|
+
if (opts.format === 'json') {
|
|
131
|
+
process.stdout.write(JSON.stringify({ count: rules.length, rules }, null, 2) + '\n');
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const lines = ['| Rule | Severity | Category | Checks |', '| --- | --- | --- | --- |'];
|
|
135
|
+
for (const r of rules)
|
|
136
|
+
lines.push(`| \`${r.id}\` | ${r.severity} | ${r.category} | ${r.description.replace(/\|/g, '\\|')}${r.requires ? ` _(requires ${r.requires})_` : ''} |`);
|
|
137
|
+
process.stdout.write(lines.join('\n') + '\n');
|
|
138
|
+
});
|
|
139
|
+
program
|
|
140
|
+
.command('mcp')
|
|
141
|
+
.description('Start the MCP server on stdio (for Claude Code, Cursor, Codex, etc.)')
|
|
142
|
+
.action(async () => {
|
|
143
|
+
await startMcpServer();
|
|
144
|
+
});
|
|
145
|
+
program.parseAsync(process.argv).catch((err) => {
|
|
146
|
+
process.stderr.write(`agentic-seo-check: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
147
|
+
process.exit(2);
|
|
148
|
+
});
|
|
149
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAyC,MAAM,iBAAiB,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,aAAa,EAA6B,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAC9B,OAAO;KACJ,IAAI,CAAC,mBAAmB,CAAC;KACzB,WAAW,CAAC,oHAAoH,CAAC;KACjI,OAAO,CAAC,OAAO,CAAC;KAChB,kBAAkB,EAAE,CAAC;AAExB,MAAM,MAAM,GAAG,CAAC,KAAa,EAAU,EAAE;IACvC,MAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACrC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,MAAM,IAAI,oBAAoB,CAAC,kCAAkC,CAAC,CAAC;IACr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AAO,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IAChL,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AAChD,CAAC,CAAC,CAAC;AAEL,OAAO;KACJ,OAAO,CAAC,KAAK,CAAC;KACd,WAAW,CAAC,sEAAsE,CAAC;KACnF,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,cAAc,EAAE,CAAC;AACzB,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IACtD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACjG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type ProgressEvent } from './crawl.js';
|
|
2
|
+
import { type FetchOptions } from './fetch.js';
|
|
3
|
+
import { type Audit, type IssueRollup, type PageAudit, type PageSource, type ResponseInfo, type SiteAudit, type Thresholds } from './types.js';
|
|
4
|
+
export type { ProgressEvent } from './crawl.js';
|
|
5
|
+
export interface AuditOptions {
|
|
6
|
+
/** Target keyword/phrase for the keyword.* rules. */
|
|
7
|
+
keyword?: string;
|
|
8
|
+
/** Render with headless Chromium (Playwright) and compare against the server HTML. */
|
|
9
|
+
render?: boolean;
|
|
10
|
+
/** Run Lighthouse (performance + SEO + agentic-browsing categories). */
|
|
11
|
+
lighthouse?: boolean;
|
|
12
|
+
formFactor?: 'mobile' | 'desktop';
|
|
13
|
+
/** Include info-level findings (default true). */
|
|
14
|
+
includeInfo?: boolean;
|
|
15
|
+
/** Rule ids to skip. */
|
|
16
|
+
disableRules?: string[];
|
|
17
|
+
thresholds?: Partial<Thresholds>;
|
|
18
|
+
fetch?: FetchOptions;
|
|
19
|
+
/** Base URL for inline HTML, files and directories (default http://localhost/). */
|
|
20
|
+
baseUrl?: string;
|
|
21
|
+
includeSubdomains?: boolean;
|
|
22
|
+
onProgress?: (event: ProgressEvent) => void;
|
|
23
|
+
}
|
|
24
|
+
export interface CrawlOptions extends AuditOptions {
|
|
25
|
+
maxPages?: number;
|
|
26
|
+
maxDepth?: number;
|
|
27
|
+
concurrency?: number;
|
|
28
|
+
delayMs?: number;
|
|
29
|
+
respectRobots?: boolean;
|
|
30
|
+
checkExternalLinks?: boolean;
|
|
31
|
+
maxLinkChecks?: number;
|
|
32
|
+
includePatterns?: string[];
|
|
33
|
+
excludePatterns?: string[];
|
|
34
|
+
/** How much per-page detail to keep in the site result. */
|
|
35
|
+
pageDetail?: 'full' | 'summary';
|
|
36
|
+
}
|
|
37
|
+
export interface HtmlAuditInput {
|
|
38
|
+
url?: string;
|
|
39
|
+
response?: ResponseInfo;
|
|
40
|
+
source?: PageSource;
|
|
41
|
+
target?: string;
|
|
42
|
+
depth?: number;
|
|
43
|
+
}
|
|
44
|
+
export declare const DEFAULT_CRAWL: {
|
|
45
|
+
readonly maxPages: 50;
|
|
46
|
+
readonly maxDepth: 3;
|
|
47
|
+
readonly concurrency: 5;
|
|
48
|
+
readonly delayMs: 0;
|
|
49
|
+
readonly maxLinkChecks: 200;
|
|
50
|
+
};
|
|
51
|
+
/** Audit an HTML string. `url` is used to resolve links and for display. */
|
|
52
|
+
export declare function auditHtml(html: string, input?: HtmlAuditInput, options?: AuditOptions): Promise<PageAudit>;
|
|
53
|
+
/** Fetch and audit one URL. Optionally render and/or run Lighthouse. */
|
|
54
|
+
export declare function auditUrl(url: string, options?: AuditOptions): Promise<PageAudit>;
|
|
55
|
+
/** Audit a single .html file from disk. */
|
|
56
|
+
export declare function auditFile(filePath: string, options?: AuditOptions): Promise<PageAudit>;
|
|
57
|
+
/** Crawl a site and audit every page plus site-level checks. */
|
|
58
|
+
export declare function auditSite(startUrl: string, options?: CrawlOptions): Promise<SiteAudit>;
|
|
59
|
+
/** Audit a directory of built HTML files (dist/, out/, build/). */
|
|
60
|
+
export declare function auditDirectory(dir: string, options?: CrawlOptions): Promise<SiteAudit>;
|
|
61
|
+
/**
|
|
62
|
+
* Auto-detect the target type: http(s) URL, directory, .html file, or "-" for stdin.
|
|
63
|
+
* `crawl` forces a site crawl for URLs.
|
|
64
|
+
*/
|
|
65
|
+
export declare function auditTarget(target: string, options?: CrawlOptions & {
|
|
66
|
+
crawl?: boolean;
|
|
67
|
+
stdinHtml?: string;
|
|
68
|
+
}): Promise<Audit>;
|
|
69
|
+
export declare function recomputeSite(site: SiteAudit): void;
|
|
70
|
+
export declare function rollupIssues(pages: PageAudit[]): IssueRollup[];
|
|
71
|
+
/** Drop bulky, low-value fields to save tokens when the result is consumed by an LLM. */
|
|
72
|
+
export declare function compactAudit<T extends Audit>(audit: T): T;
|