@rivi-software/agentic-seo-check 0.1.0 → 0.1.1
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 +1 -1
- package/README.md +65 -15
- package/dist/brand.d.ts +11 -0
- package/dist/brand.js +22 -0
- package/dist/brand.js.map +1 -0
- package/dist/cli.js +125 -80
- package/dist/cli.js.map +1 -1
- package/dist/core/audit.d.ts +16 -16
- package/dist/core/audit.js +363 -248
- package/dist/core/audit.js.map +1 -1
- package/dist/core/concurrency.d.ts +4 -4
- package/dist/core/concurrency.js +33 -23
- package/dist/core/concurrency.js.map +1 -1
- package/dist/core/crawl.d.ts +5 -5
- package/dist/core/crawl.js +250 -121
- package/dist/core/crawl.js.map +1 -1
- package/dist/core/fetch.d.ts +5 -5
- package/dist/core/fetch.js +151 -100
- package/dist/core/fetch.js.map +1 -1
- package/dist/core/html/dom.d.ts +13 -0
- package/dist/core/html/dom.js +17 -0
- package/dist/core/html/dom.js.map +1 -0
- package/dist/core/html/extract.d.ts +2 -2
- package/dist/core/html/extract.js +168 -111
- package/dist/core/html/extract.js.map +1 -1
- package/dist/core/html/structured-data.d.ts +16 -6
- package/dist/core/html/structured-data.js +180 -145
- package/dist/core/html/structured-data.js.map +1 -1
- package/dist/core/html/text.d.ts +14 -14
- package/dist/core/html/text.js +110 -107
- package/dist/core/html/text.js.map +1 -1
- package/dist/core/lighthouse.d.ts +26 -25
- package/dist/core/lighthouse.js +181 -105
- package/dist/core/lighthouse.js.map +1 -1
- package/dist/core/performance-rules.d.ts +2 -2
- package/dist/core/performance-rules.js +105 -33
- package/dist/core/performance-rules.js.map +1 -1
- package/dist/core/render-rules.d.ts +5 -4
- package/dist/core/render-rules.js +129 -62
- package/dist/core/render-rules.js.map +1 -1
- package/dist/core/render.d.ts +2 -2
- package/dist/core/render.js +29 -23
- package/dist/core/render.js.map +1 -1
- package/dist/core/report/markdown.d.ts +2 -2
- package/dist/core/report/markdown.js +110 -131
- package/dist/core/report/markdown.js.map +1 -1
- package/dist/core/robots.d.ts +5 -5
- package/dist/core/robots.js +31 -16
- package/dist/core/robots.js.map +1 -1
- package/dist/core/rules/canonical.d.ts +1 -1
- package/dist/core/rules/canonical.js +93 -57
- package/dist/core/rules/canonical.js.map +1 -1
- package/dist/core/rules/content.js +40 -26
- package/dist/core/rules/content.js.map +1 -1
- package/dist/core/rules/document.js +64 -41
- package/dist/core/rules/document.js.map +1 -1
- package/dist/core/rules/headings.js +58 -38
- package/dist/core/rules/headings.js.map +1 -1
- package/dist/core/rules/hreflang.js +70 -38
- package/dist/core/rules/hreflang.js.map +1 -1
- package/dist/core/rules/images.js +44 -26
- package/dist/core/rules/images.js.map +1 -1
- package/dist/core/rules/index.d.ts +6 -6
- package/dist/core/rules/index.js +36 -35
- package/dist/core/rules/index.js.map +1 -1
- package/dist/core/rules/indexing.d.ts +2 -2
- package/dist/core/rules/indexing.js +48 -26
- package/dist/core/rules/indexing.js.map +1 -1
- package/dist/core/rules/keyword.js +84 -47
- package/dist/core/rules/keyword.js.map +1 -1
- package/dist/core/rules/links.js +72 -37
- package/dist/core/rules/links.js.map +1 -1
- package/dist/core/rules/meta.js +55 -34
- package/dist/core/rules/meta.js.map +1 -1
- package/dist/core/rules/response.js +75 -41
- package/dist/core/rules/response.js.map +1 -1
- package/dist/core/rules/rule.d.ts +6 -6
- package/dist/core/rules/rule.js +36 -36
- package/dist/core/rules/rule.js.map +1 -1
- package/dist/core/rules/social.js +86 -45
- package/dist/core/rules/social.js.map +1 -1
- package/dist/core/rules/structured-data.d.ts +6 -4
- package/dist/core/rules/structured-data.js +314 -102
- package/dist/core/rules/structured-data.js.map +1 -1
- package/dist/core/rules/title.js +48 -33
- package/dist/core/rules/title.js.map +1 -1
- package/dist/core/score.d.ts +3 -3
- package/dist/core/score.js +11 -9
- package/dist/core/score.js.map +1 -1
- package/dist/core/site-rules.d.ts +3 -3
- package/dist/core/site-rules.js +409 -198
- package/dist/core/site-rules.js.map +1 -1
- package/dist/core/sitemap.d.ts +5 -5
- package/dist/core/sitemap.js +109 -64
- package/dist/core/sitemap.js.map +1 -1
- package/dist/core/static.d.ts +2 -2
- package/dist/core/static.js +209 -112
- package/dist/core/static.js.map +1 -1
- package/dist/core/summary.d.ts +2 -2
- package/dist/core/summary.js +11 -6
- package/dist/core/summary.js.map +1 -1
- package/dist/core/types.d.ts +14 -14
- package/dist/core/types.js +15 -8
- package/dist/core/types.js.map +1 -1
- package/dist/core/url.d.ts +11 -11
- package/dist/core/url.js +122 -70
- package/dist/core/url.js.map +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/mcp-bin.js +7 -4
- package/dist/mcp-bin.js.map +1 -1
- package/dist/mcp.d.ts +3 -3
- package/dist/mcp.js +312 -122
- package/dist/mcp.js.map +1 -1
- package/dist/version.d.ts +0 -1
- package/dist/version.js +4 -2
- package/dist/version.js.map +1 -1
- package/package.json +27 -9
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,8 +1,42 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://rivi.software">
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/rivi-software/agentic-seo-check/main/assets/rivi-agentic-seo-check-on-dark.svg">
|
|
5
|
+
<img src="https://raw.githubusercontent.com/rivi-software/agentic-seo-check/main/assets/rivi-agentic-seo-check.svg" alt="RIVI agentic-seo-check" width="545">
|
|
6
|
+
</picture>
|
|
7
|
+
</a>
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
<p align="center">
|
|
11
|
+
SEO analysis built for coding agents: a CLI and an MCP server that audit URLs,<br>
|
|
12
|
+
static build output or raw HTML, and return findings an agent can act on.<br>
|
|
13
|
+
Open source, from <a href="https://rivi.software">RIVI Software</a>.
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="https://github.com/rivi-software/agentic-seo-check/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/rivi-software/agentic-seo-check/ci.yml?branch=main&label=CI" alt="CI status"></a>
|
|
18
|
+
<a href="https://www.npmjs.com/package/@rivi-software/agentic-seo-check"><img src="https://img.shields.io/npm/v/@rivi-software/agentic-seo-check?color=0b6b3a" alt="npm version"></a>
|
|
19
|
+
<a href="https://www.npmjs.com/package/@rivi-software/agentic-seo-check"><img src="https://img.shields.io/npm/dm/@rivi-software/agentic-seo-check?color=0b6b3a" alt="Monthly npm downloads"></a>
|
|
20
|
+
<a href="https://github.com/rivi-software/agentic-seo-check/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-0b6b3a" alt="MIT License"></a>
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
<p align="center">
|
|
24
|
+
<a href="#install">Install</a>
|
|
25
|
+
·
|
|
26
|
+
<a href="#cli">CLI</a>
|
|
27
|
+
·
|
|
28
|
+
<a href="#mcp-server">MCP server</a>
|
|
29
|
+
·
|
|
30
|
+
<a href="#agent-skill">Agent skill</a>
|
|
31
|
+
·
|
|
32
|
+
<a href="https://github.com/rivi-software/agentic-seo-check/blob/main/CONTRIBUTING.md">Contributing</a>
|
|
33
|
+
·
|
|
34
|
+
<a href="https://rivi.software">rivi.software</a>
|
|
35
|
+
</p>
|
|
36
|
+
|
|
37
|
+
<br>
|
|
38
|
+
|
|
39
|
+
agentic-seo-check is one core with two interfaces:
|
|
6
40
|
|
|
7
41
|
- **CLI** `agentic-seo-check` with JSON (default when piped) or Markdown output and CI-friendly exit codes.
|
|
8
42
|
- **MCP server** exposing five tools for Claude Code, Cursor, Codex and any other MCP client.
|
|
@@ -140,22 +174,38 @@ const site = await auditSite('https://www.example.com/', { maxPages: 100 });
|
|
|
140
174
|
console.log(renderMarkdown(site));
|
|
141
175
|
```
|
|
142
176
|
|
|
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
177
|
## Scope of this first version
|
|
152
178
|
|
|
153
179
|
- 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
180
|
- 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
181
|
- Not included yet: gzip sitemaps, rendering every page in a crawl, field (CrUX) data, rank tracking, backlink data, AI-generated copy suggestions.
|
|
156
182
|
|
|
183
|
+
## Contributing
|
|
184
|
+
|
|
185
|
+
Bug reports, wrong findings, new rules and fixes are welcome from anyone. With Node 24 and pnpm 12:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
pnpm install
|
|
189
|
+
pnpm run verify
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
`verify` runs what CI runs: format, lint, typecheck, tests, build and a check of the packed package. `pnpm run dev audit https://example.com` runs the CLI from source. [CONTRIBUTING.md](https://github.com/rivi-software/agentic-seo-check/blob/main/CONTRIBUTING.md) covers proposing a change, what a pull request needs and how releases reach npm, and [AGENTS.md](https://github.com/rivi-software/agentic-seo-check/blob/main/AGENTS.md) is the brief for coding agents working on the tool itself. Everyone who takes part follows the [code of conduct](https://github.com/rivi-software/agentic-seo-check/blob/main/CODE_OF_CONDUCT.md). [SECURITY.md](https://github.com/rivi-software/agentic-seo-check/blob/main/SECURITY.md) says how to report a vulnerability privately.
|
|
193
|
+
|
|
157
194
|
## License
|
|
158
195
|
|
|
159
|
-
|
|
196
|
+
Licensed under the [MIT License](https://github.com/rivi-software/agentic-seo-check/blob/main/LICENSE). Copyright © 2026 RIVI Software.
|
|
197
|
+
|
|
198
|
+
<br>
|
|
199
|
+
|
|
200
|
+
<p align="center">
|
|
201
|
+
<a href="https://rivi.software">
|
|
202
|
+
<picture>
|
|
203
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/rivi-software/agentic-seo-check/main/assets/rivi-mark-on-dark.svg">
|
|
204
|
+
<img src="https://raw.githubusercontent.com/rivi-software/agentic-seo-check/main/assets/rivi-mark.svg" alt="RIVI Software" width="36" height="36">
|
|
205
|
+
</picture>
|
|
206
|
+
</a>
|
|
207
|
+
</p>
|
|
160
208
|
|
|
161
|
-
|
|
209
|
+
<p align="center">
|
|
210
|
+
<sub>RIVI agentic-seo-check is made by <a href="https://rivi.software">RIVI Software</a>, which builds software for radio stations. Created in <a href="https://t3.codes">T3 Code</a>.</sub>
|
|
211
|
+
</p>
|
package/dist/brand.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RIVI Software's name, site and mark as the CLI, the MCP server and the Markdown report show
|
|
3
|
+
* them. The marks are copies of assets/rivi-mark.svg and assets/rivi-mark-on-dark.svg, inlined
|
|
4
|
+
* because npm ships dist/ without assets/.
|
|
5
|
+
*/
|
|
6
|
+
import type { Icon } from "@modelcontextprotocol/sdk/types.js";
|
|
7
|
+
export declare const MAKER = "RIVI Software";
|
|
8
|
+
export declare const MAKER_URL = "https://rivi.software";
|
|
9
|
+
export declare const REPOSITORY_URL = "https://github.com/rivi-software/agentic-seo-check";
|
|
10
|
+
/** The mark as MCP icons: the ink tile for light themes, the light tile for dark ones. */
|
|
11
|
+
export declare const MCP_ICONS: Icon[];
|
package/dist/brand.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const MAKER = "RIVI Software";
|
|
2
|
+
export const MAKER_URL = "https://rivi.software";
|
|
3
|
+
export const REPOSITORY_URL = "https://github.com/rivi-software/agentic-seo-check";
|
|
4
|
+
const MARK_SVG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" role="img" aria-label="RIVI Software"><rect width="40" height="40" rx="9" fill="#15171a"/><g fill="#f5f6f7"><rect x="8" y="16" width="3" height="8" rx="1.5"/><rect x="13.25" y="11" width="3" height="18" rx="1.5"/><rect x="18.5" y="7" width="3" height="26" rx="1.5" fill="#3be08a"/><rect x="23.75" y="12" width="3" height="16" rx="1.5"/><rect x="29" y="16" width="3" height="8" rx="1.5"/></g></svg>';
|
|
5
|
+
const MARK_ON_DARK_SVG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" role="img" aria-label="RIVI Software"><rect width="40" height="40" rx="9" fill="#f5f6f7"/><g fill="#15171a"><rect x="8" y="16" width="3" height="8" rx="1.5"/><rect x="13.25" y="11" width="3" height="18" rx="1.5"/><rect x="18.5" y="7" width="3" height="26" rx="1.5" fill="#0e9f55"/><rect x="23.75" y="12" width="3" height="16" rx="1.5"/><rect x="29" y="16" width="3" height="8" rx="1.5"/></g></svg>';
|
|
6
|
+
const dataUri = (svg) => `data:image/svg+xml;base64,${Buffer.from(svg, "utf-8").toString("base64")}`;
|
|
7
|
+
/** The mark as MCP icons: the ink tile for light themes, the light tile for dark ones. */
|
|
8
|
+
export const MCP_ICONS = [
|
|
9
|
+
{
|
|
10
|
+
mimeType: "image/svg+xml",
|
|
11
|
+
sizes: ["any"],
|
|
12
|
+
src: dataUri(MARK_SVG),
|
|
13
|
+
theme: "light",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
mimeType: "image/svg+xml",
|
|
17
|
+
sizes: ["any"],
|
|
18
|
+
src: dataUri(MARK_ON_DARK_SVG),
|
|
19
|
+
theme: "dark",
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
//# sourceMappingURL=brand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brand.js","sourceRoot":"","sources":["../src/brand.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,KAAK,GAAG,eAAe,CAAC;AACrC,MAAM,CAAC,MAAM,SAAS,GAAG,uBAAuB,CAAC;AAEjD,MAAM,CAAC,MAAM,cAAc,GACzB,oDAAoD,CAAC;AAEvD,MAAM,QAAQ,GACZ,2cAA2c,CAAC;AAE9c,MAAM,gBAAgB,GACpB,2cAA2c,CAAC;AAE9c,MAAM,OAAO,GAAG,CAAC,GAAW,EAAE,EAAE,CAC9B,6BAA6B,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;AAE9E,0FAA0F;AAC1F,MAAM,CAAC,MAAM,SAAS,GAAW;IAC/B;QACE,QAAQ,EAAE,eAAe;QACzB,KAAK,EAAE,CAAC,KAAK,CAAC;QACd,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAC;QACtB,KAAK,EAAE,OAAO;KACf;IACD;QACE,QAAQ,EAAE,eAAe;QACzB,KAAK,EAAE,CAAC,KAAK,CAAC;QACd,GAAG,EAAE,OAAO,CAAC,gBAAgB,CAAC;QAC9B,KAAK,EAAE,MAAM;KACd;CACF,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -1,68 +1,91 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { promises as fs } from
|
|
3
|
-
import { Command, InvalidArgumentError, Option } from
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
2
|
+
import { promises as fs } from "node:fs";
|
|
3
|
+
import { Command, InvalidArgumentError, Option } from "commander";
|
|
4
|
+
import { MAKER, MAKER_URL, REPOSITORY_URL } from "./brand.js";
|
|
5
|
+
import { auditTarget, compactAudit } from "./core/audit.js";
|
|
6
|
+
import { renderMarkdown } from "./core/report/markdown.js";
|
|
7
|
+
import { ALL_RULES } from "./core/rules/index.js";
|
|
8
|
+
import { SEVERITY_RANK } from "./core/types.js";
|
|
9
|
+
import { startMcpServer } from "./mcp.js";
|
|
10
|
+
import { VERSION } from "./version.js";
|
|
10
11
|
const program = new Command();
|
|
11
12
|
program
|
|
12
|
-
.name(
|
|
13
|
-
.description(
|
|
13
|
+
.name("agentic-seo-check")
|
|
14
|
+
.description("SEO analysis for coding agents. Audits URLs, static build output or raw HTML and prints machine-readable findings.")
|
|
14
15
|
.version(VERSION)
|
|
16
|
+
.addHelpText("afterAll", `\nMade by ${MAKER} (${MAKER_URL}). Docs and issues: ${REPOSITORY_URL}`)
|
|
15
17
|
.showHelpAfterError();
|
|
16
18
|
const intArg = (value) => {
|
|
19
|
+
// oxlint-disable-next-line unicorn/prefer-number-coercion -- parseInt reads the leading digits ("10.5" is 10), where Number would refuse what users have always passed
|
|
17
20
|
const n = Number.parseInt(value, 10);
|
|
18
|
-
if (!Number.isFinite(n) || n < 0)
|
|
19
|
-
throw new InvalidArgumentError(
|
|
21
|
+
if (!Number.isFinite(n) || n < 0) {
|
|
22
|
+
throw new InvalidArgumentError("Expected a non-negative integer.");
|
|
23
|
+
}
|
|
20
24
|
return n;
|
|
21
25
|
};
|
|
22
|
-
|
|
23
|
-
if (!crawlDefault)
|
|
24
|
-
cmd.option(
|
|
26
|
+
const addAuditOptions = (cmd, crawlDefault) => {
|
|
27
|
+
if (!crawlDefault) {
|
|
28
|
+
cmd.option("--crawl", "Crawl the whole site starting at the URL instead of auditing one page");
|
|
29
|
+
}
|
|
25
30
|
return cmd
|
|
26
|
-
.option(
|
|
27
|
-
.option(
|
|
28
|
-
.option(
|
|
29
|
-
.option(
|
|
30
|
-
.option(
|
|
31
|
-
.option(
|
|
32
|
-
.option(
|
|
33
|
-
.addOption(new Option(
|
|
34
|
-
.
|
|
35
|
-
.
|
|
36
|
-
.option(
|
|
37
|
-
.option(
|
|
38
|
-
.option(
|
|
39
|
-
.option(
|
|
40
|
-
.
|
|
41
|
-
.option(
|
|
42
|
-
.addOption(new Option(
|
|
43
|
-
.option(
|
|
44
|
-
.
|
|
45
|
-
.
|
|
46
|
-
.
|
|
47
|
-
.option(
|
|
48
|
-
.option(
|
|
49
|
-
.
|
|
50
|
-
.
|
|
51
|
-
|
|
52
|
-
|
|
31
|
+
.option("--max-pages <n>", "Maximum pages to crawl", intArg, 50)
|
|
32
|
+
.option("--max-depth <n>", "Maximum link depth from the start URL", intArg, 3)
|
|
33
|
+
.option("--concurrency <n>", "Parallel requests while crawling", intArg, 5)
|
|
34
|
+
.option("--delay <ms>", "Delay between requests per worker", intArg, 0)
|
|
35
|
+
.option("-k, --keyword <keyword>", "Target keyword for keyword.* checks")
|
|
36
|
+
.option("--render", "Render with headless Chromium (Playwright) and compare with the server HTML")
|
|
37
|
+
.option("--lighthouse", "Run Lighthouse for Core Web Vitals and Lighthouse SEO audits (slow)")
|
|
38
|
+
.addOption(new Option("--form-factor <type>", "Lighthouse device emulation")
|
|
39
|
+
.choices(["mobile", "desktop"])
|
|
40
|
+
.default("mobile"))
|
|
41
|
+
.option("--base-url <url>", "Origin used for directories, files and stdin HTML (default http://localhost/)")
|
|
42
|
+
.option("--ignore-robots", "Do not obey robots.txt while crawling")
|
|
43
|
+
.option("--include-subdomains", "Treat subdomains as internal when crawling")
|
|
44
|
+
.option("--check-external", "Probe external links for 4xx/5xx while crawling")
|
|
45
|
+
.option("--include <regex...>", "Only crawl URLs matching these patterns")
|
|
46
|
+
.option("--exclude <regex...>", "Skip URLs matching these patterns")
|
|
47
|
+
.addOption(new Option("-f, --format <format>", "Output format (default: json when piped, md on a terminal)").choices(["json", "md"]))
|
|
48
|
+
.option("-o, --out <file>", "Write the report to a file instead of stdout")
|
|
49
|
+
.addOption(new Option("--fail-on <severity>", "Exit with code 1 when findings at or above this severity exist")
|
|
50
|
+
.choices(["error", "warning", "info", "none"])
|
|
51
|
+
.default("none"))
|
|
52
|
+
.option("--no-info", "Omit info-level findings")
|
|
53
|
+
.option("--compact", "Trim evidence lists and bulky fields (smaller output for LLM consumption)")
|
|
54
|
+
.addOption(new Option("--page-detail <level>", "Per-page detail in site reports")
|
|
55
|
+
.choices(["full", "summary"])
|
|
56
|
+
.default("full"))
|
|
57
|
+
.option("--disable <rule...>", "Rule ids to skip")
|
|
58
|
+
.option("--timeout <ms>", "Per-request timeout", intArg, 15_000)
|
|
59
|
+
.option("--user-agent <ua>", "Custom User-Agent header")
|
|
60
|
+
.option("-H, --header <header...>", 'Extra request header "Name: value" (repeatable)')
|
|
61
|
+
.option("-q, --quiet", "Suppress progress output on stderr");
|
|
62
|
+
};
|
|
63
|
+
/** The report format: as asked, else by the output file's extension, else Markdown on a terminal. */
|
|
64
|
+
const formatOf = (opts) => {
|
|
65
|
+
if (opts.format !== undefined) {
|
|
66
|
+
return opts.format;
|
|
67
|
+
}
|
|
68
|
+
if (opts.out) {
|
|
69
|
+
return opts.out.endsWith(".md") ? "md" : "json";
|
|
70
|
+
}
|
|
71
|
+
return process.stdout.isTTY ? "md" : "json";
|
|
72
|
+
};
|
|
73
|
+
const runAudit = async (target, opts, forceCrawl) => {
|
|
53
74
|
const headers = {};
|
|
54
75
|
for (const h of opts.header ?? []) {
|
|
55
|
-
const idx = h.indexOf(
|
|
56
|
-
if (idx === -1)
|
|
76
|
+
const idx = h.indexOf(":");
|
|
77
|
+
if (idx === -1) {
|
|
57
78
|
throw new InvalidArgumentError(`Header "${h}" must be "Name: value".`);
|
|
79
|
+
}
|
|
58
80
|
headers[h.slice(0, idx).trim()] = h.slice(idx + 1).trim();
|
|
59
81
|
}
|
|
60
82
|
const showProgress = !opts.quiet && process.stderr.isTTY;
|
|
61
83
|
const onProgress = (e) => {
|
|
62
|
-
if (!showProgress)
|
|
84
|
+
if (!showProgress) {
|
|
63
85
|
return;
|
|
64
|
-
|
|
65
|
-
|
|
86
|
+
}
|
|
87
|
+
const counter = e.crawled === undefined ? "" : ` [${e.crawled}/${e.discovered}]`;
|
|
88
|
+
process.stderr.write(`\u001B[2m${e.phase}${counter}: ${e.message}\u001B[0m\n`);
|
|
66
89
|
};
|
|
67
90
|
const options = {
|
|
68
91
|
crawl: forceCrawl || Boolean(opts.crawl),
|
|
@@ -83,67 +106,89 @@ async function runAudit(target, opts, forceCrawl) {
|
|
|
83
106
|
includeInfo: opts.info,
|
|
84
107
|
disableRules: opts.disable,
|
|
85
108
|
pageDetail: opts.pageDetail,
|
|
86
|
-
fetch: {
|
|
109
|
+
fetch: {
|
|
110
|
+
timeoutMs: opts.timeout,
|
|
111
|
+
userAgent: opts.userAgent,
|
|
112
|
+
headers: Object.keys(headers).length ? headers : undefined,
|
|
113
|
+
},
|
|
87
114
|
onProgress,
|
|
88
115
|
};
|
|
89
116
|
let audit = await auditTarget(target, options);
|
|
90
|
-
if (opts.compact)
|
|
117
|
+
if (opts.compact) {
|
|
91
118
|
audit = compactAudit(audit);
|
|
92
|
-
|
|
93
|
-
const
|
|
119
|
+
}
|
|
120
|
+
const format = formatOf(opts);
|
|
121
|
+
const output = format === "md" ? renderMarkdown(audit) : JSON.stringify(audit, null, 2);
|
|
94
122
|
if (opts.out) {
|
|
95
|
-
await fs.writeFile(opts.out, output
|
|
96
|
-
if (!opts.quiet)
|
|
123
|
+
await fs.writeFile(opts.out, `${output}\n`, "utf-8");
|
|
124
|
+
if (!opts.quiet) {
|
|
97
125
|
process.stderr.write(`Report written to ${opts.out}\n`);
|
|
126
|
+
}
|
|
98
127
|
}
|
|
99
128
|
else {
|
|
100
|
-
process.stdout.write(output
|
|
129
|
+
process.stdout.write(`${output}\n`);
|
|
101
130
|
}
|
|
102
|
-
if (opts.failOn !==
|
|
131
|
+
if (opts.failOn !== "none") {
|
|
103
132
|
const threshold = SEVERITY_RANK[opts.failOn];
|
|
104
|
-
const counts = audit
|
|
105
|
-
const hits = [
|
|
133
|
+
const { counts } = audit;
|
|
134
|
+
const hits = ["error", "warning", "info"]
|
|
135
|
+
.filter((s) => SEVERITY_RANK[s] >= threshold)
|
|
136
|
+
.reduce((n, s) => n + counts[s], 0);
|
|
106
137
|
if (hits > 0) {
|
|
107
|
-
if (!opts.quiet)
|
|
138
|
+
if (!opts.quiet) {
|
|
108
139
|
process.stderr.write(`${hits} finding(s) at or above "${opts.failOn}" severity.\n`);
|
|
140
|
+
}
|
|
109
141
|
process.exitCode = 1;
|
|
110
142
|
}
|
|
111
143
|
}
|
|
112
|
-
}
|
|
144
|
+
};
|
|
113
145
|
addAuditOptions(program
|
|
114
|
-
.command(
|
|
115
|
-
.argument(
|
|
116
|
-
.description(
|
|
146
|
+
.command("audit")
|
|
147
|
+
.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"), false).action(async (target, opts) => {
|
|
117
149
|
await runAudit(target, opts, false);
|
|
118
150
|
});
|
|
119
|
-
addAuditOptions(program
|
|
151
|
+
addAuditOptions(program
|
|
152
|
+
.command("crawl")
|
|
153
|
+
.argument("<url>", "Start URL")
|
|
154
|
+
.description('Crawl a site and audit every page (same as "audit --crawl")'), true).action(async (url, opts) => {
|
|
120
155
|
await runAudit(url, opts, true);
|
|
121
156
|
});
|
|
122
157
|
program
|
|
123
|
-
.command(
|
|
124
|
-
.description(
|
|
125
|
-
.option(
|
|
126
|
-
.option(
|
|
127
|
-
.addOption(new Option(
|
|
158
|
+
.command("rules")
|
|
159
|
+
.description("List the rules this tool can report")
|
|
160
|
+
.option("--category <category>", "Filter by category")
|
|
161
|
+
.option("--rule <id>", "Show one rule")
|
|
162
|
+
.addOption(new Option("-f, --format <format>", "Output format")
|
|
163
|
+
.choices(["json", "md"])
|
|
164
|
+
.default(process.stdout.isTTY ? "md" : "json"))
|
|
128
165
|
.action((opts) => {
|
|
129
|
-
const rules = ALL_RULES.filter((r) => (!opts.category || r.category === opts.category) &&
|
|
130
|
-
|
|
131
|
-
|
|
166
|
+
const rules = ALL_RULES.filter((r) => (!opts.category || r.category === opts.category) &&
|
|
167
|
+
(!opts.rule || r.id === opts.rule));
|
|
168
|
+
if (opts.format === "json") {
|
|
169
|
+
process.stdout.write(`${JSON.stringify({ count: rules.length, rules }, null, 2)}\n`);
|
|
132
170
|
return;
|
|
133
171
|
}
|
|
134
|
-
const lines = [
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
172
|
+
const lines = [
|
|
173
|
+
"| Rule | Severity | Category | Checks |",
|
|
174
|
+
"| --- | --- | --- | --- |",
|
|
175
|
+
];
|
|
176
|
+
for (const r of rules) {
|
|
177
|
+
lines.push(`| \`${r.id}\` | ${r.severity} | ${r.category} | ${r.description.replaceAll("|", "\\|")}${r.requires ? ` _(requires ${r.requires})_` : ""} |`);
|
|
178
|
+
}
|
|
179
|
+
process.stdout.write(`${lines.join("\n")}\n`);
|
|
138
180
|
});
|
|
139
181
|
program
|
|
140
|
-
.command(
|
|
141
|
-
.description(
|
|
182
|
+
.command("mcp")
|
|
183
|
+
.description("Start the MCP server on stdio (for Claude Code, Cursor, Codex, etc.)")
|
|
142
184
|
.action(async () => {
|
|
143
185
|
await startMcpServer();
|
|
144
186
|
});
|
|
145
|
-
|
|
146
|
-
|
|
187
|
+
try {
|
|
188
|
+
await program.parseAsync(process.argv);
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
process.stderr.write(`agentic-seo-check: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
147
192
|
process.exit(2);
|
|
148
|
-
}
|
|
193
|
+
}
|
|
149
194
|
//# sourceMappingURL=cli.js.map
|
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;
|
|
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,S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AAM,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAC9I,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAChD,CAAC,CACF,CAAC;AAEJ,OAAO;KACJ,OAAO,CAAC,KAAK,CAAC;KACd,WAAW,CACV,sEAAsE,CACvE;KACA,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,cAAc,EAAE,CAAC;AACzB,CAAC,CAAC,CAAC;AAEL,IAAI,CAAC;IACH,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC;AAAC,OAAO,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"}
|
package/dist/core/audit.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export type { ProgressEvent } from
|
|
1
|
+
import type { ProgressEvent } from "./crawl.js";
|
|
2
|
+
import type { FetchOptions } from "./fetch.js";
|
|
3
|
+
import type { Audit, IssueRollup, PageAudit, PageSource, ResponseInfo, SiteAudit, Thresholds } from "./types.js";
|
|
4
|
+
export type { ProgressEvent } from "./crawl.js";
|
|
5
5
|
export interface AuditOptions {
|
|
6
6
|
/** Target keyword/phrase for the keyword.* rules. */
|
|
7
7
|
keyword?: string;
|
|
@@ -9,7 +9,7 @@ export interface AuditOptions {
|
|
|
9
9
|
render?: boolean;
|
|
10
10
|
/** Run Lighthouse (performance + SEO + agentic-browsing categories). */
|
|
11
11
|
lighthouse?: boolean;
|
|
12
|
-
formFactor?:
|
|
12
|
+
formFactor?: "mobile" | "desktop";
|
|
13
13
|
/** Include info-level findings (default true). */
|
|
14
14
|
includeInfo?: boolean;
|
|
15
15
|
/** Rule ids to skip. */
|
|
@@ -32,7 +32,7 @@ export interface CrawlOptions extends AuditOptions {
|
|
|
32
32
|
includePatterns?: string[];
|
|
33
33
|
excludePatterns?: string[];
|
|
34
34
|
/** How much per-page detail to keep in the site result. */
|
|
35
|
-
pageDetail?:
|
|
35
|
+
pageDetail?: "full" | "summary";
|
|
36
36
|
}
|
|
37
37
|
export interface HtmlAuditInput {
|
|
38
38
|
url?: string;
|
|
@@ -48,25 +48,25 @@ export declare const DEFAULT_CRAWL: {
|
|
|
48
48
|
readonly delayMs: 0;
|
|
49
49
|
readonly maxLinkChecks: 200;
|
|
50
50
|
};
|
|
51
|
+
export declare const rollupIssues: (pages: PageAudit[]) => IssueRollup[];
|
|
52
|
+
export declare const recomputeSite: (site: SiteAudit) => void;
|
|
51
53
|
/** Audit an HTML string. `url` is used to resolve links and for display. */
|
|
52
|
-
export declare
|
|
54
|
+
export declare const auditHtml: (html: string, input?: HtmlAuditInput, options?: AuditOptions) => Promise<PageAudit>;
|
|
53
55
|
/** Fetch and audit one URL. Optionally render and/or run Lighthouse. */
|
|
54
|
-
export declare
|
|
56
|
+
export declare const auditUrl: (url: string, options?: AuditOptions) => Promise<PageAudit>;
|
|
55
57
|
/** Audit a single .html file from disk. */
|
|
56
|
-
export declare
|
|
58
|
+
export declare const auditFile: (filePath: string, options?: AuditOptions) => Promise<PageAudit>;
|
|
57
59
|
/** Crawl a site and audit every page plus site-level checks. */
|
|
58
|
-
export declare
|
|
60
|
+
export declare const auditSite: (startUrl: string, options?: CrawlOptions) => Promise<SiteAudit>;
|
|
59
61
|
/** Audit a directory of built HTML files (dist/, out/, build/). */
|
|
60
|
-
export declare
|
|
62
|
+
export declare const auditDirectory: (dir: string, options?: CrawlOptions) => Promise<SiteAudit>;
|
|
61
63
|
/**
|
|
62
64
|
* Auto-detect the target type: http(s) URL, directory, .html file, or "-" for stdin.
|
|
63
65
|
* `crawl` forces a site crawl for URLs.
|
|
64
66
|
*/
|
|
65
|
-
export declare
|
|
67
|
+
export declare const auditTarget: (target: string, options?: CrawlOptions & {
|
|
66
68
|
crawl?: boolean;
|
|
67
69
|
stdinHtml?: string;
|
|
68
|
-
})
|
|
69
|
-
export declare function recomputeSite(site: SiteAudit): void;
|
|
70
|
-
export declare function rollupIssues(pages: PageAudit[]): IssueRollup[];
|
|
70
|
+
}) => Promise<Audit>;
|
|
71
71
|
/** Drop bulky, low-value fields to save tokens when the result is consumed by an LLM. */
|
|
72
|
-
export declare
|
|
72
|
+
export declare const compactAudit: <T extends Audit>(audit: T) => T;
|