turva-llms-txt-validator 0.1.3 → 0.1.4
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 +5 -6
- 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, or in CI.
|
|
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,7 @@ 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
|
-
## The
|
|
23
|
+
## The eight checks
|
|
24
24
|
|
|
25
25
|
| # | Check | fail | warn |
|
|
26
26
|
|---|-------|------|------|
|
|
@@ -31,8 +31,7 @@ Exit codes: 0 valid (warnings allowed), 1 not valid (with --strict, warnings als
|
|
|
31
31
|
| 5 | H2 sections group the content | | no H2 sections |
|
|
32
32
|
| 6 | Markdown links an agent can follow | | no links, or relative links |
|
|
33
33
|
| 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.
|
|
34
|
+
| 8 | No HTML markup in the file | | HTML tags found |
|
|
36
35
|
|
|
37
36
|
## Node API
|
|
38
37
|
|
|
@@ -61,4 +60,4 @@ The llms.txt format is a plain text map of a site for AI agents: an H1 title, a
|
|
|
61
60
|
|
|
62
61
|
## License
|
|
63
62
|
|
|
64
|
-
MIT. Source at [
|
|
63
|
+
MIT. Source at [github.com/erekola/llms-txt-validator](https://github.com/erekola/llms-txt-validator), mirrored at [codeberg.org/erekola/llms-txt-validator](https://codeberg.org/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.4",
|
|
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) {
|