turva-llms-txt-validator 0.1.3 → 0.1.5
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 +8 -7
- package/package.json +3 -3
- package/src/index.mjs +8 -2
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# turva-llms-txt-validator
|
|
2
2
|
|
|
3
|
-
Validate a site's llms.txt structure from the command line, from Node
|
|
3
|
+
Validate a site's llms.txt structure from the command line, from Node or in CI. Eight checks, each reported as pass, warn or fail, with a one-line detail. No score on purpose: a structure check can say what is there and what is missing, and a number on top of eight checks would look like an agent-readiness score without measuring one.
|
|
4
4
|
|
|
5
|
-
This is the open-source form of the hosted validator at [turva.dev/llms-txt-validator](https://turva.dev/llms-txt-validator), which runs the same logic inside the open [turva.dev Cloudflare Worker](https://
|
|
5
|
+
This is the open-source form of the hosted validator at [turva.dev/llms-txt-validator](https://turva.dev/llms-txt-validator), which runs the same logic inside the open [turva.dev Cloudflare Worker](https://github.com/erekola/turva-worker). The hosted validator stays canonical: if the two ever disagree, the hosted one wins and this package gets the fix.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -20,7 +20,9 @@ Or run it without installing:
|
|
|
20
20
|
|
|
21
21
|
Exit codes: 0 valid (warnings allowed), 1 not valid (with --strict, warnings also exit 1), 2 fetch or input error. Only the target site's /llms.txt is fetched over https, following a redirect only to the same host or its www/apex twin (an off-site or unsafe redirect fails the first check), the fetch times out after 8 seconds and the read is capped at 256 KB. Nothing is stored.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
The target has to be a public domain name: an IP literal, a bracketed IPv6 address, localhost and the internal-use TLDs local, internal, home, lan, corp, test and invalid are all refused before any request goes out, and every redirect hop is checked by the same rule. Names are not resolved here, so a public name that points at a private address is stopped by the network the fetch runs on rather than by this code. On the hosted validator that network is the Cloudflare edge, which does not route to private address space.
|
|
24
|
+
|
|
25
|
+
## The eight checks
|
|
24
26
|
|
|
25
27
|
| # | Check | fail | warn |
|
|
26
28
|
|---|-------|------|------|
|
|
@@ -31,8 +33,7 @@ Exit codes: 0 valid (warnings allowed), 1 not valid (with --strict, warnings als
|
|
|
31
33
|
| 5 | H2 sections group the content | | no H2 sections |
|
|
32
34
|
| 6 | Markdown links an agent can follow | | no links, or relative links |
|
|
33
35
|
| 7 | Small enough to be cheap to read | | over 50 KB, or read truncated at 256 KB |
|
|
34
|
-
|
|
35
|
-
An eighth signal, inline HTML in the file, is reported in the same list as a warning.
|
|
36
|
+
| 8 | No HTML markup in the file | | HTML tags found |
|
|
36
37
|
|
|
37
38
|
## Node API
|
|
38
39
|
|
|
@@ -57,8 +58,8 @@ Woodpecker or any other runner: the same npx line works anywhere Node 18.17 or n
|
|
|
57
58
|
|
|
58
59
|
## Why these checks
|
|
59
60
|
|
|
60
|
-
The llms.txt format is a plain text map of a site for AI agents: an H1 title, a one-line blockquote summary
|
|
61
|
+
The llms.txt format is a plain text map of a site for AI agents: an H1 title, a one-line blockquote summary and H2 sections of markdown links. The checks test exactly that structure and nothing else. What the format is and why it matters is written out at [llms.txt explained](https://turva.dev/guides/llms-txt), and the free tools this package belongs to are collected at [turva.dev/tools](https://turva.dev/tools).
|
|
61
62
|
|
|
62
63
|
## License
|
|
63
64
|
|
|
64
|
-
MIT. Source at [
|
|
65
|
+
MIT. Source at [github.com/erekola/llms-txt-validator](https://github.com/erekola/llms-txt-validator). Published to npm from GitHub Actions with provenance, a signed attestation of where and how the package was built, verifiable on the npm package page.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "turva-llms-txt-validator",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Validate a site's llms.txt structure:
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"description": "Validate a site's llms.txt structure: eight checks, pass/warn/fail, JSON output. Same checks as the hosted validator at turva.dev/llms-txt-validator.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.mjs",
|
|
7
7
|
"exports": "./src/index.mjs",
|
|
@@ -36,6 +36,6 @@
|
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://turva.dev/llms-txt-validator",
|
|
38
38
|
"bugs": {
|
|
39
|
-
"url": "https://
|
|
39
|
+
"url": "https://github.com/erekola/llms-txt-validator/issues"
|
|
40
40
|
}
|
|
41
41
|
}
|
package/src/index.mjs
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
// turva-llms-txt-validator: validate a site's llms.txt structure.
|
|
2
2
|
// The checks mirror the hosted validator at https://turva.dev/llms-txt-validator,
|
|
3
3
|
// which runs this same logic inside the turva.dev Cloudflare Worker
|
|
4
|
-
// (https://
|
|
4
|
+
// (https://github.com/erekola/turva-worker). The hosted validator stays
|
|
5
5
|
// canonical: if the two ever disagree, the hosted one wins and this package
|
|
6
6
|
// gets the fix.
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
import { readFileSync } from "node:fs";
|
|
9
|
+
|
|
10
|
+
// Version comes from package.json so the two can never drift again
|
|
11
|
+
// (0.1.1 and 0.1.3 both shipped with a stale hardcoded VERSION).
|
|
12
|
+
export const VERSION = JSON.parse(
|
|
13
|
+
readFileSync(new URL("../package.json", import.meta.url), "utf8")
|
|
14
|
+
).version;
|
|
9
15
|
const UA = "turva-llms-txt-validator/" + VERSION + " (+https://turva.dev/llms-txt-validator)";
|
|
10
16
|
|
|
11
17
|
export function normalizeHostInput(raw) {
|