turva-llms-txt-validator 0.8.4 → 0.8.6

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 CHANGED
@@ -37,7 +37,7 @@ llms-txt-validate --help
37
37
  llms-txt-validate --version
38
38
  ```
39
39
 
40
- A domain, an HTTP URL or an HTTPS URL is accepted. Validation always uses the host's `/llms.txt` and home page over HTTPS, regardless of the supplied path. If the address has a path other than `/` or `/llms.txt`, the result names that path first in an `info` line.
40
+ A domain, an HTTP URL or an HTTPS URL is accepted. A host given with port 80 or 443 is read at HTTPS on port 443, and any other port is refused. Validation always uses the host's `/llms.txt` and home page over HTTPS, regardless of the supplied path. If the address has a path other than `/` or `/llms.txt`, the result names that path first in an `info` line.
41
41
 
42
42
  | Option | Effect |
43
43
  | --- | --- |
@@ -86,7 +86,7 @@ Completed validation returns `{ target, summary, checks }`, where `target` is `h
86
86
 
87
87
  The validator removes C0 and C1 control characters, bidirectional controls and invisible characters from the `detail` text, which can quote the checked site. The invisible characters are chosen by Unicode class, not from a list: every format character, which is General_Category Cf, every Default_Ignorable_Code_Point and the line and paragraph separators U+2028 and U+2029. That covers the zero-width characters, the left-to-right and right-to-left marks, the Arabic letter mark, the word joiner and the invisible math operators, the soft hyphen, the byte-order mark, the variation selectors, the combining grapheme joiner, the Hangul fillers and the tag characters U+E0000 to U+E007F. Spaces stay: the no-break space and U+2000 to U+200A. The zero-width non-joiner and joiner go too, so a quoted Persian, Malayalam or Devanagari word loses its joining marks and reads without them. The Arabic number signs U+0600 to U+0605 go as well. Until 0.8.0 only the bidi controls and the C0 and C1 controls were removed, and the invisible characters stayed in the text and in the JSON. An emoji sequence in quoted text loses its zero-width joiners and its variation selector: a family emoji reads as its members side by side, a heart written with U+FE0F shows in text style, a keycap sequence loses the selector, and a tag flag shows as its black flag. The emoji themselves, skin tone modifiers, regional indicators and combining marks stay.
88
88
 
89
- With `--json`, an invalid domain or a failed fetch returns `{ "error": "...", "target": "..." }` and exits with code `2`. A network error adds `code`, such as `EAI_AGAIN`. An unknown option, a second domain and a missing domain return `{ "error": "..." }` only, with no target, and also exit with code `2`. `--help` and `--version` win over argument errors, also with `--json`, and exit with code `0`. An unknown option is named by its dashes and the letters, digits and dashes after them, and the rest of the argument is not shown, so a target typed with a leading dash, as in `-u:secret@example.com`, gives `unknown option "-u" (the rest of the argument is not shown)`.
89
+ With `--json`, an invalid domain or a failed fetch returns `{ "error": "...", "target": "..." }` and exits with code `2`. A network error adds `code` when the error carries one, such as `EAI_AGAIN`. An unknown option, a second domain and a missing domain return `{ "error": "..." }` only, with no target, and also exit with code `2`. `--help` and `--version` win over argument errors, also with `--json`, and exit with code `0`. An unknown option is named by its dashes and the letters, digits and dashes after them, and the rest of the argument is not shown, so a target typed with a leading dash, as in `-u:secret@example.com`, gives `unknown option "-u" (the rest of the argument is not shown)`.
90
90
 
91
91
  In an error report the `target` is the address given on the command line. When it parses as a URL with a host, the user name and password are removed and each query value becomes `***`. Other values follow these cases:
92
92
 
@@ -108,7 +108,7 @@ In an error report the `target` is the address given on the command line. When i
108
108
  | 3 | First non-empty line is a Markdown H1, written `# Title` or as one line of text underlined with `=` | Missing H1, a title indented as a code block, or an H1 with no text, whether written with `#` or underlined with `=` | none |
109
109
  | 4 | Blockquote summary follows the title | none | Missing summary, a blockquote block in which no line has text after the `>`, or a blockquote after other text but before the first H2, named by its line |
110
110
  | 5 | H2 sections group the content | none | No H2 sections, no section with a Markdown link list, a heading between the title and the first H2, or a second H1 |
111
- | 6 | Markdown links have names and absolute HTTP or HTTPS targets | none | Missing links, empty names, relative targets or targets that do not parse as HTTP or HTTPS URLs, or a list line under an H2 of one of two kinds. The first kind looks like a link entry but is not a Markdown link, such as an unclosed destination in `- [Name](https://example.com/a.md: notes)`. The second kind opens with an en dash, an em dash or a bullet instead of a list marker, followed by a space or a tab and an opening bracket, whether or not its link parses. A line with such a character and no opening bracket is not counted, and a no-break space does not count as the space. The detail has one sentence per kind, each with its count and the first five line numbers |
111
+ | 6 | Markdown links have names and absolute HTTP or HTTPS targets | none | Missing links, empty names, relative targets or targets that do not parse as HTTP or HTTPS URLs, or a list line under an H2 of one of two kinds. The first kind looks like a link entry but is not a Markdown link, such as an unclosed destination in `- [Name](https://example.com/a.md: notes)`. The second kind opens with an en dash, an em dash or a bullet instead of a list marker, followed by a space or a tab and an opening bracket, whether or not its link parses. A line with such a character and no opening bracket is not counted, and a no-break space does not count as the space. When the read was truncated, the last line read is not counted, because the read limit may have cut it. The detail has one sentence per kind, each with its count and the first five line numbers |
112
112
  | 7 | File is small enough to read cheaply | none | Over 50 KiB, which is 51,200 bytes, or truncated at the 256 KiB read limit |
113
113
  | 8 | File contains no HTML markup | none | An opening tag with its closing `>`, a closing tag or an HTML comment is found in the prose. Inline code spans, fenced code and backslash-escaped angle brackets such as `\<node-name\>` are not read, so `<endpoint-id>` in a code span does not warn. An attribute name is any run of characters other than white space, quotes, `<`, `>`, `/` and `=` that holds a Unicode letter, a Unicode digit or the character `_`, so `<div @click="x">` warns. Autolinks such as `<https://example.com>` and prose such as `a <b + c` are not tags. A tag still open at the end of the file, such as `<div class="x"`, has no closing `>` and does not warn |
114
114
 
@@ -234,7 +234,7 @@ The default validation requests two documents: `https://<host>/llms.txt` and `ht
234
234
 
235
235
  **DNS resolution is not checked for private addresses.** A syntactically public domain can resolve to a private IP, so if you expose this package through a service that accepts untrusted domains, enforce private-address restrictions at the network layer. Local and CI runs use their own network policy. The hosted validator runs on the Cloudflare edge.
236
236
 
237
- For vulnerability reporting and supported versions, see [SECURITY.md](https://github.com/erekola/llms-txt-validator/blob/main/SECURITY.md).
237
+ For vulnerability reporting and supported versions, see [SECURITY.md](https://github.com/turva-dev/llms-txt-validator/blob/main/SECURITY.md).
238
238
 
239
239
  ## Release process
240
240
 
@@ -246,24 +246,24 @@ GitHub Actions tests Node.js 22, 24 and 26 on Ubuntu and Node.js 22 on Windows.
246
246
 
247
247
  Up to 0.3.21 the package was plain JavaScript modules, starting with `src/index.mjs`. Version 0.4.0, released on 21 October 2026, ports it to TypeScript compiled to `dist/`, and the entry point moved to `dist/src/index.js` behind the same `exports` name. The compiled library has the same 12 493 JavaScript tokens as 0.3.21, apart from the relative path to `package.json`. A differential run fed both versions 4 160 000 generated `llms.txt` inputs and 832 000 HTML heads and found no difference. The CLI kept its flags, its output and its exit codes.
248
248
 
249
- The strict type check found two inputs that could leave `undefined` in a check's detail. Neither `fetchLlmsTxt` nor `validateHost` produces them, and 0.4.1 fixed both. Each release is described in [CHANGELOG.md](https://github.com/erekola/llms-txt-validator/blob/main/CHANGELOG.md).
249
+ The strict type check found two inputs that could leave `undefined` in a check's detail. Neither `fetchLlmsTxt` nor `validateHost` produces them, and 0.4.1 fixed both. Each release is described in [CHANGELOG.md](https://github.com/turva-dev/llms-txt-validator/blob/main/CHANGELOG.md).
250
250
 
251
251
  ## Verify a release
252
252
 
253
253
  GitHub Actions publishes every version from 0.1.3 on with npm trusted publishing, and each one carries a provenance attestation. To check one, install it in an empty directory and ask npm to verify the signatures. Replace the version with the one you want to check.
254
254
 
255
255
  ```sh
256
- mkdir verify-llms && cd verify-llms && npm init -y && npm install turva-llms-txt-validator@0.8.4 --ignore-scripts && npm audit signatures
256
+ mkdir verify-llms && cd verify-llms && npm init -y && npm install turva-llms-txt-validator@0.8.6 --ignore-scripts && npm audit signatures
257
257
  ```
258
258
 
259
- `npm audit signatures` checks the registry signature and the provenance attestation of each installed package that has one. The attestation of this package names three things to compare with what you expect: the repository `github.com/erekola/llms-txt-validator`, the workflow file `.github/workflows/publish.yml` and the commit that produced the tarball. The npm version page shows them under Provenance.
259
+ `npm audit signatures` checks the registry signature and the provenance attestation of each installed package that has one. The attestation of this package names three things to compare with what you expect: the repository, the workflow file `.github/workflows/publish.yml` and the commit that produced the tarball. Versions up to and including 0.8.4 were built in `github.com/erekola/llms-txt-validator`, before the repository moved to the turva-dev organization on 2026-11-25. Every later release is built in `github.com/turva-dev/llms-txt-validator`. The npm version page shows them under Provenance.
260
260
 
261
- Tag `v0.8.4` must point at that same commit, and `gh api repos/erekola/llms-txt-validator/commits/v0.8.4 --jq .sha` prints it. A mismatch is a reason not to use that version. Provenance proves which workflow built a release and from which commit. It does not prove that the code is safe, so reading the source and the dependencies stays your job.
261
+ Tag `v0.8.6` must point at that same commit, and `gh api repos/turva-dev/llms-txt-validator/commits/v0.8.6 --jq .sha` prints it. A mismatch is a reason not to use that version. Provenance proves which workflow built a release and from which commit. It does not prove that the code is safe, so reading the source and the dependencies stays your job.
262
262
 
263
263
  ## Development
264
264
 
265
265
  ```sh
266
- git clone https://github.com/erekola/llms-txt-validator.git
266
+ git clone https://github.com/turva-dev/llms-txt-validator.git
267
267
  cd llms-txt-validator
268
268
  npm ci --ignore-scripts
269
269
  npm run typecheck
@@ -274,7 +274,7 @@ npm test
274
274
 
275
275
  ## Hosted version and source
276
276
 
277
- The [hosted validator](https://turva.dev/llms-txt-validator) accepts any public domain in the browser. For any host other than turva.dev itself it requests the same two documents, `/llms.txt` and the home page. For turva.dev it validates the site's own files directly, without a request. The hosted validator reads www.turva.dev the same way and reports https://turva.dev/llms.txt as the target. This package requests www.turva.dev as typed, follows its redirect and reports https://www.turva.dev/llms.txt. It runs the same checks. Its source is in the [turva.dev Cloudflare Worker](https://github.com/erekola/turva-worker). The hosted validator is the canonical implementation: if results diverge, this package is updated to match it.
277
+ The [hosted validator](https://turva.dev/llms-txt-validator) accepts any public domain in the browser. For any host other than turva.dev itself it requests the same two documents, `/llms.txt` and the home page. For turva.dev it validates the site's own files directly, without a request. The hosted validator reads www.turva.dev the same way and reports https://turva.dev/llms.txt as the target. This package requests www.turva.dev as typed, follows its redirect and reports https://www.turva.dev/llms.txt. It runs the same checks. Its source is in the [turva.dev Cloudflare Worker](https://github.com/turva-dev/turva-worker). The hosted validator is the canonical implementation: if results diverge, this package is updated to match it.
278
278
 
279
279
  The hosted version also returns JSON with the same result shape for a completed validation. Its errors are shaped differently: an `error` field, plus a `docs` link when the `url` parameter is missing, with HTTP status 400 and no `target`. The site-wide rate limiter can also answer HTTP 429 as plain text, with a `Retry-After` header, before the validator runs, and that answer is not JSON.
280
280
 
@@ -288,13 +288,13 @@ In Windows PowerShell, use `curl.exe` if `curl` resolves to `Invoke-WebRequest`.
288
288
 
289
289
  ## Check HTML and Markdown content
290
290
 
291
- [markdown-parity-check](https://github.com/erekola/markdown-parity-check) is a separate tool for a different question. This validator reads the structure of `llms.txt` and the home page's discovery links. The parity check compares the main content of one page's HTML and Markdown versions and reports changed text, numbers, links or blocks. It requires Node.js 22 or newer:
291
+ [markdown-parity-check](https://github.com/turva-dev/markdown-parity-check) is a separate tool for a different question. This validator reads the structure of `llms.txt` and the home page's discovery links. The parity check compares the main content of one page's HTML and Markdown versions and reports changed text, numbers, links or blocks. It requires Node.js 22 or newer:
292
292
 
293
293
  ```sh
294
294
  npx --yes markdown-parity-check --url https://example.com/page --format json
295
295
  ```
296
296
 
297
- Replace the URL with your page. If Markdown is served at another address, add `--markdown-url https://example.com/page.md`. Its [browser version](https://turva.dev/markdown-parity-check) on turva.dev checks turva.dev's own pages only. See the [comparison README](https://github.com/erekola/markdown-parity-check) for local-file mode, exit codes and limits.
297
+ Replace the URL with your page. If Markdown is served at another address, add `--markdown-url https://example.com/page.md`. Its [browser version](https://turva.dev/markdown-parity-check) on turva.dev checks turva.dev's own pages only. See the [comparison README](https://github.com/turva-dev/markdown-parity-check) for local-file mode, exit codes and limits.
298
298
 
299
299
  ## License
300
300
 
package/dist/src/index.js CHANGED
@@ -1,7 +1,7 @@
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://github.com/erekola/turva-worker). The hosted validator stays
4
+ // (https://github.com/turva-dev/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. No tool compares the two sources: the mirror is kept by hand, and the
7
7
  // test files of the two repos carry the same inputs and expectations by hand too.
@@ -2062,8 +2062,10 @@ export function validateLlmsTxt(f) {
2062
2062
  itemOpen = false;
2063
2063
  continue;
2064
2064
  }
2065
- const h1 = /^ {0,3}#(?:[ \t]|$)/.test(l) || sx.text[i];
2066
- if (misplaced === -1 && i > firstIdx && (h1 || (!seenH2 && /^ {0,3}#{3,6}(?:[ \t]|$)/.test(l))))
2065
+ // A line inside a raw HTML block is no heading for these checks either (h2Mask also holds the fenced lines,
2066
+ // which were skipped above, so here it only adds the HTML block lines).
2067
+ const h1 = !h2Mask[i] && (/^ {0,3}#(?:[ \t]|$)/.test(l) || sx.text[i]);
2068
+ if (misplaced === -1 && i > firstIdx && (h1 || (!seenH2 && !h2Mask[i] && /^ {0,3}#{3,6}(?:[ \t]|$)/.test(l))))
2067
2069
  misplaced = i;
2068
2070
  if (h1) {
2069
2071
  inSection = false;
@@ -2192,6 +2194,13 @@ export function validateLlmsTxt(f) {
2192
2194
  }
2193
2195
  // A list line that looks like a link entry but is not one (Tek-730) turns the links check to a warn.
2194
2196
  const lookalikes = unparsedLinkEntries(lines, fenced, new Set(proseLinks.map((m) => m.at)), codeSpanMask(linkText, linkBlocks), defAt, htmlLine);
2197
+ // A truncated read can end inside a list line, so that last line is left out of this check:
2198
+ // calling a line malformed when the read cut it is unsupported (0.8.5, mirrors the hosted validator).
2199
+ if (f.truncated) {
2200
+ const cut = lines.length;
2201
+ lookalikes.unparsed = lookalikes.unparsed.filter((n) => n !== cut);
2202
+ lookalikes.marker = lookalikes.marker.filter((n) => n !== cut);
2203
+ }
2195
2204
  if (lookalikes.unparsed.length + lookalikes.marker.length > 0) {
2196
2205
  const lk = checks[checks.length - 1];
2197
2206
  lk.status = "warn";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turva-llms-txt-validator",
3
- "version": "0.8.4",
3
+ "version": "0.8.6",
4
4
  "description": "Validate a site's llms.txt structure: eight checks as pass/warn/fail plus two llms.txt v2 discovery checks that read pass or info and never move the summary, JSON output. Same checks as the hosted validator at turva.dev/llms-txt-validator.",
5
5
  "type": "module",
6
6
  "main": "./dist/src/index.js",
@@ -43,11 +43,11 @@
43
43
  "license": "MIT",
44
44
  "repository": {
45
45
  "type": "git",
46
- "url": "git+https://github.com/erekola/llms-txt-validator.git"
46
+ "url": "git+https://github.com/turva-dev/llms-txt-validator.git"
47
47
  },
48
48
  "homepage": "https://turva.dev/llms-txt-validator",
49
49
  "bugs": {
50
- "url": "https://github.com/erekola/llms-txt-validator/issues"
50
+ "url": "https://github.com/turva-dev/llms-txt-validator/issues"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/node": "^22.20.5",