turva-llms-txt-validator 0.5.1 → 0.6.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/README.md +6 -4
- package/dist/src/index.js +168 -27
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -82,7 +82,7 @@ The two discovery checks return `pass` or `info`. They never change the summary
|
|
|
82
82
|
npx --yes turva-llms-txt-validator example.com --json --strict
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
Completed validation returns `{ target, summary, checks }`, where `target` is `https://<host>/llms.txt`. Each check contains `{ id, status, label, detail }`. The `input-path` check, which reports a path given with the domain and then ignored, also carries `value`, that path cut to 120 characters.
|
|
85
|
+
Completed validation returns `{ target, summary, checks }`, where `target` is `https://<host>/llms.txt`. Each check contains `{ id, status, label, detail }`. Read `id` and `status` in a script, because the wording of `detail` can change between versions. The `input-path` check, which reports a path given with the domain and then ignored, also carries `value`, that path cut to 120 characters.
|
|
86
86
|
|
|
87
87
|
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`.
|
|
88
88
|
|
|
@@ -114,6 +114,8 @@ Some failures stop the file checks early. For example, an HTML response is repor
|
|
|
114
114
|
Links are read the way CommonMark reads them for the forms listed here.
|
|
115
115
|
|
|
116
116
|
- A link inside inline code, after an escaped bracket or in an image does not count.
|
|
117
|
+
- Inline code pairs only inside one block, the way CommonMark reads blocks. A blank line, a heading, a list item, a thematic break and a setext underline each end a block. An empty list item or a numbered item that does not start at 1 does not end a paragraph, unless the line closes an open list item, so a backtick pair across such a line is inline code. Block quotes and HTML blocks are not read as blocks here, so a backtick pair across the start of one, or across lines inside a block quote, stays inline code. CommonMark ends the block at a block quote and at an HTML block that can interrupt a paragraph.
|
|
118
|
+
- A fence indented past three columns inside a list item hides what it holds, closed or not, as long as it sits less than four columns past the item's content column. Further in, CommonMark reads indented code, and this validator still counts a link in it. One gap remains for a fence opened on a list marker line, at four or more columns or by a tab: its closing line at 0 to 3 columns reads as a new opening fence, so the lines after it are skipped until the next fence.
|
|
117
119
|
- A link in an ordered list, a target in angle brackets and a target with a title in double or single quotes do count.
|
|
118
120
|
- A title in parentheses is not read, so `[Guide](https://example.org/guide (Overview))` is not collected.
|
|
119
121
|
- An unbracketed target ends at its first closing parenthesis, so `https://example.org/docs_(v2)` is read only up to `https://example.org/docs_(v2`. Write a target that contains parentheses in angle brackets.
|
|
@@ -199,7 +201,7 @@ For vulnerability reporting and supported versions, see [SECURITY.md](https://gi
|
|
|
199
201
|
|
|
200
202
|
The source is TypeScript under `src/` and `bin/`, compiled with `tsc` to `dist/`. The tarball ships only `dist/src/index.js`, `dist/src/index.d.ts`, `dist/bin/cli.js`, the README, the license, the third-party notices and `package.json`, which npm always includes. `dist/` is generated, and `npm pack` builds it through the `prepack` script.
|
|
201
203
|
|
|
202
|
-
GitHub Actions tests Node.js 22 and
|
|
204
|
+
GitHub Actions tests Node.js 22, 24 and 26 on Ubuntu and Node.js 22 on Windows. A version tag starts the release workflow, `.github/workflows/publish.yml`. It runs the type check and the tests, fails when the tag and `package.json` name different versions, publishes with npm trusted publishing over OIDC and creates the GitHub release from the CHANGELOG section. npm writes a provenance attestation. No npm token is stored in the repository or in the workflow.
|
|
203
205
|
|
|
204
206
|
## From JavaScript to TypeScript
|
|
205
207
|
|
|
@@ -212,10 +214,10 @@ The strict type check found two inputs that could leave `undefined` in a check's
|
|
|
212
214
|
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.
|
|
213
215
|
|
|
214
216
|
```sh
|
|
215
|
-
mkdir verify-llms && cd verify-llms && npm init -y && npm install turva-llms-txt-validator@0.
|
|
217
|
+
mkdir verify-llms && cd verify-llms && npm init -y && npm install turva-llms-txt-validator@0.6.0 --ignore-scripts && npm audit signatures
|
|
216
218
|
```
|
|
217
219
|
|
|
218
|
-
`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. Tag `v0.
|
|
220
|
+
`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. Tag `v0.6.0` must point at that same commit, and `gh api repos/erekola/llms-txt-validator/commits/v0.6.0 --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.
|
|
219
221
|
|
|
220
222
|
## Development
|
|
221
223
|
|
package/dist/src/index.js
CHANGED
|
@@ -273,35 +273,38 @@ function isEscaped(s, i) {
|
|
|
273
273
|
// span itself crosses a real line ending. V2 (Tek-526): a fenceless "`[a](b)\ncontinued`" was
|
|
274
274
|
// masked only on its own line, so the second line escaped the mask and its bracket read as a
|
|
275
275
|
// real link. A span opens with a run of backticks and closes with the next run of the same
|
|
276
|
-
// length anywhere in the text
|
|
277
|
-
//
|
|
278
|
-
//
|
|
279
|
-
//
|
|
280
|
-
// pair consumes neither run: its closer is still free to open a span of its own in its own
|
|
276
|
+
// length anywhere in the text. A pair in two different blocks, as inlineBlockReader reads them,
|
|
277
|
+
// is not a code span in CommonMark, so it is left unmasked and its backticks stay literal (VREG2,
|
|
278
|
+
// round 3 Tek-542: backticks in two different list items used to enclose a real hyperlink
|
|
279
|
+
// between them). Such a pair consumes neither run: its closer is still free to open a span of its own in its own
|
|
281
280
|
// block. Until 2026-11-04 the scan jumped past the closer, so a stray backtick moved the mask by
|
|
282
281
|
// one run, a link inside the next real span counted as a link and text after it could count as
|
|
283
282
|
// code (Tek-745). An escaped first backtick is literal and the rest of its run still opens, while
|
|
284
283
|
// a closing run is never escaped, because a backslash inside a code span is literal. Each run
|
|
285
|
-
// carries the number of
|
|
284
|
+
// carries the number of its block, read once per line, so comparing two runs
|
|
286
285
|
// costs nothing however far apart they sit. Runs are grouped by length and every group is read
|
|
287
286
|
// with one forward pointer, so the scan stays linear on a document of unmatched runs. Mirrored
|
|
288
|
-
// from the hosted validator at turva.dev in 0.
|
|
289
|
-
function endsInlineBlock(line) {
|
|
290
|
-
return /^[ \t]*$/.test(line) || /^ {0,3}(#{1,6}(?:[ \t]|$)|[-*+][ \t]|\d{1,9}[.)][ \t])/.test(line);
|
|
291
|
-
}
|
|
287
|
+
// from the hosted validator at turva.dev in 0.6.0.
|
|
292
288
|
function codeSpanMask(text) {
|
|
293
289
|
const mask = new Uint8Array(text.length);
|
|
294
290
|
const runs = [];
|
|
291
|
+
const blockOf = inlineBlockReader();
|
|
295
292
|
let block = 0;
|
|
293
|
+
const readLine = (from) => {
|
|
294
|
+
const next = text.indexOf("\n", from);
|
|
295
|
+
const end = next < 0 ? text.length : next;
|
|
296
|
+
block = blockOf(text.slice(from, end));
|
|
297
|
+
if (block < 0)
|
|
298
|
+
mask.fill(1, from, end);
|
|
299
|
+
};
|
|
300
|
+
readLine(0);
|
|
296
301
|
for (let i = 0; i < text.length;) {
|
|
297
302
|
if (text[i] === "\n") {
|
|
298
|
-
|
|
299
|
-
if (endsInlineBlock(text.slice(i + 1, next < 0 ? text.length : next)))
|
|
300
|
-
block++;
|
|
303
|
+
readLine(i + 1);
|
|
301
304
|
i++;
|
|
302
305
|
continue;
|
|
303
306
|
}
|
|
304
|
-
if (text[i] !== "`") {
|
|
307
|
+
if (text[i] !== "`" || block < 0) {
|
|
305
308
|
i++;
|
|
306
309
|
continue;
|
|
307
310
|
}
|
|
@@ -335,6 +338,144 @@ function codeSpanMask(text) {
|
|
|
335
338
|
}
|
|
336
339
|
return mask;
|
|
337
340
|
}
|
|
341
|
+
// Which inline block each line belongs to, read once per line in document order, because two
|
|
342
|
+
// backtick runs pair only inside one block. Measured against commonmark.js 0.31.2, Tek-747. A
|
|
343
|
+
// blank line, an ATX heading, a thematic break and a setext underline end a paragraph, and the
|
|
344
|
+
// next line starts a new block, so a backtick on a heading line never pairs with the next line. A
|
|
345
|
+
// list marker starts a new block, with the exception CommonMark sets: a line that would continue
|
|
346
|
+
// an open paragraph cannot open a list with an empty item or with a number other than 1. The
|
|
347
|
+
// number is compared as a number, so "01." counts as 1. That exception holds only while the
|
|
348
|
+
// paragraph is the innermost open container. A line indented less than an open item's content
|
|
349
|
+
// column closes that item, so "2." there is the list's next item, which is why the reader keeps
|
|
350
|
+
// the content column of every open item. An empty item followed by a blank line is closed. An
|
|
351
|
+
// indented line continues an open paragraph, and a run of indented lines with no paragraph open is
|
|
352
|
+
// one block, so backticks in it still pair. A fence this reader sees is one the caller did not
|
|
353
|
+
// blank, because fenceMask reads only lines at 0 to 3 columns: a fence indented further inside a
|
|
354
|
+
// list item, or opened on a marker line. For every line of such a fence the reader returns -1 and
|
|
355
|
+
// the scan masks the line whole, so a fence hides what it holds whatever closes it and whichever
|
|
356
|
+
// character it uses. A fence ends when an open item it sits in closes. Block quotes and HTML blocks
|
|
357
|
+
// are not read here, neither the start of one nor the lines of a block quote. Every pattern runs at
|
|
358
|
+
// a fixed position, the thematic break test and the closing fence test run once per line, and the
|
|
359
|
+
// walk over the open items stops at the line's own width, so the reader stays linear however deep
|
|
360
|
+
// the items nest.
|
|
361
|
+
const INLINE_HEADING = /#{1,6}(?:[ \t]|$)/y;
|
|
362
|
+
const INLINE_UNDERLINE = /(?:=+|-+)[ \t]*$/y;
|
|
363
|
+
const INLINE_THEMATIC = /([-*_])(?:[ \t]*\1){2,}[ \t]*$/y;
|
|
364
|
+
const INLINE_MARKER = /(?:[-*+]|(\d{1,9})[.)])(?=[ \t]|$)/y;
|
|
365
|
+
const INLINE_FENCE = /(`{3,})[^`]*$|(~{3,})/y;
|
|
366
|
+
function matchAt(re, s, at) {
|
|
367
|
+
re.lastIndex = at;
|
|
368
|
+
return re.exec(s);
|
|
369
|
+
}
|
|
370
|
+
function inlineBlockReader() {
|
|
371
|
+
let block = 0, para = false, code = false, emptyItem = false;
|
|
372
|
+
let fenceChar = "", fenceLen = 0, fenceDepth = 0;
|
|
373
|
+
const items = [];
|
|
374
|
+
return (line) => {
|
|
375
|
+
let p = 0, col = 0;
|
|
376
|
+
const skipBlanks = () => {
|
|
377
|
+
for (; p < line.length; p++) {
|
|
378
|
+
if (line[p] === " ")
|
|
379
|
+
col++;
|
|
380
|
+
else if (line[p] === "\t")
|
|
381
|
+
col += 4 - (col % 4);
|
|
382
|
+
else
|
|
383
|
+
break;
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
skipBlanks();
|
|
387
|
+
if (p === line.length) {
|
|
388
|
+
if (fenceChar !== "")
|
|
389
|
+
return -1;
|
|
390
|
+
if (emptyItem)
|
|
391
|
+
items.pop();
|
|
392
|
+
emptyItem = false;
|
|
393
|
+
para = false;
|
|
394
|
+
code = false;
|
|
395
|
+
return ++block;
|
|
396
|
+
}
|
|
397
|
+
emptyItem = false;
|
|
398
|
+
let depth = 0;
|
|
399
|
+
while (depth < items.length && col >= items[depth])
|
|
400
|
+
depth++;
|
|
401
|
+
if (fenceChar !== "") {
|
|
402
|
+
if (depth >= fenceDepth) {
|
|
403
|
+
if (col - (fenceDepth > 0 ? items[fenceDepth - 1] : 0) < 4) {
|
|
404
|
+
let end = p;
|
|
405
|
+
while (line[end] === fenceChar)
|
|
406
|
+
end++;
|
|
407
|
+
if (end - p >= fenceLen && line.slice(end).trim() === "")
|
|
408
|
+
fenceChar = "";
|
|
409
|
+
}
|
|
410
|
+
return -1;
|
|
411
|
+
}
|
|
412
|
+
fenceChar = "";
|
|
413
|
+
}
|
|
414
|
+
let inParagraph = para && depth === items.length;
|
|
415
|
+
let thematicRead = false;
|
|
416
|
+
for (;;) {
|
|
417
|
+
if (col - (depth > 0 ? items[depth - 1] : 0) >= 4) {
|
|
418
|
+
if (para)
|
|
419
|
+
return block;
|
|
420
|
+
items.length = depth;
|
|
421
|
+
if (code)
|
|
422
|
+
return block;
|
|
423
|
+
code = true;
|
|
424
|
+
return ++block;
|
|
425
|
+
}
|
|
426
|
+
code = false;
|
|
427
|
+
if (matchAt(INLINE_HEADING, line, p)) {
|
|
428
|
+
items.length = depth;
|
|
429
|
+
para = false;
|
|
430
|
+
return ++block;
|
|
431
|
+
}
|
|
432
|
+
const fence = matchAt(INLINE_FENCE, line, p);
|
|
433
|
+
if (fence) {
|
|
434
|
+
items.length = depth;
|
|
435
|
+
para = false;
|
|
436
|
+
fenceChar = line[p];
|
|
437
|
+
fenceLen = (fence[1] || fence[2]).length;
|
|
438
|
+
fenceDepth = depth;
|
|
439
|
+
return -1;
|
|
440
|
+
}
|
|
441
|
+
if (inParagraph && matchAt(INLINE_UNDERLINE, line, p)) {
|
|
442
|
+
para = false;
|
|
443
|
+
return block;
|
|
444
|
+
}
|
|
445
|
+
if (!thematicRead && matchAt(INLINE_THEMATIC, line, p)) {
|
|
446
|
+
items.length = depth;
|
|
447
|
+
para = false;
|
|
448
|
+
return ++block;
|
|
449
|
+
}
|
|
450
|
+
thematicRead = true;
|
|
451
|
+
const marker = matchAt(INLINE_MARKER, line, p);
|
|
452
|
+
if (!marker)
|
|
453
|
+
break;
|
|
454
|
+
p += marker[0].length;
|
|
455
|
+
col += marker[0].length;
|
|
456
|
+
const afterMarker = col;
|
|
457
|
+
skipBlanks();
|
|
458
|
+
const empty = p === line.length;
|
|
459
|
+
if (inParagraph && (empty || (marker[1] !== undefined && Number(marker[1]) !== 1)))
|
|
460
|
+
break;
|
|
461
|
+
items.length = depth;
|
|
462
|
+
items.push(empty || col - afterMarker >= 5 ? afterMarker + 1 : col);
|
|
463
|
+
depth = items.length;
|
|
464
|
+
para = false;
|
|
465
|
+
inParagraph = false;
|
|
466
|
+
if (empty) {
|
|
467
|
+
emptyItem = true;
|
|
468
|
+
return block;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
if (!para) {
|
|
472
|
+
items.length = depth;
|
|
473
|
+
para = true;
|
|
474
|
+
block++;
|
|
475
|
+
}
|
|
476
|
+
return block;
|
|
477
|
+
};
|
|
478
|
+
}
|
|
338
479
|
// A CommonMark link reference label is matched without regard to case or the exact run of
|
|
339
480
|
// whitespace inside it, so "[Guide]" and "[ guide ]" name the same definition.
|
|
340
481
|
function normalizeLinkLabel(s) {
|
|
@@ -862,8 +1003,8 @@ function entryLineList(hits) {
|
|
|
862
1003
|
}
|
|
863
1004
|
function unparsedEntriesNote(found) {
|
|
864
1005
|
const u = found.unparsed.length, k = found.marker.length;
|
|
865
|
-
return (u > 0 ? "
|
|
866
|
-
+ (k > 0 ? "
|
|
1006
|
+
return (u > 0 ? ". " + (u === 1 ? "1 list line looks like a link entry but is not a Markdown link" : u + " list lines look like link entries but are not Markdown links") + entryLineList(found.unparsed) : "")
|
|
1007
|
+
+ (k > 0 ? ". " + (k === 1 ? "1 list line opens with a dash or bullet that is not a Markdown list marker" : k + " list lines open with a dash or bullet that is not a Markdown list marker") + entryLineList(found.marker) : "");
|
|
867
1008
|
}
|
|
868
1009
|
// The text of an ATX H1, or null when the line is not one. One to three leading spaces, a
|
|
869
1010
|
// single "#", then a space, a tab or the end of the line. A closing run of "#" preceded by a
|
|
@@ -910,11 +1051,11 @@ function isAbsoluteHttpUrl(t) {
|
|
|
910
1051
|
}
|
|
911
1052
|
function redirectFailDetail(f) {
|
|
912
1053
|
if (f.reason === "off-host")
|
|
913
|
-
return "redirects to " + f.location + ", a different host
|
|
1054
|
+
return "redirects to " + f.location + ", a different host. llms.txt is host-scoped, so validate that host directly";
|
|
914
1055
|
if (f.reason === "unsafe-target")
|
|
915
|
-
return "redirects to an unsupported target (" + f.location + ")
|
|
1056
|
+
return "redirects to an unsupported target (" + f.location + "). Only https redirects to the same site are followed";
|
|
916
1057
|
if (f.reason === "too-many")
|
|
917
|
-
return "too many redirects
|
|
1058
|
+
return "too many redirects. The llms.txt is not served at a stable URL";
|
|
918
1059
|
return "got a " + f.status + " redirect without a usable Location header";
|
|
919
1060
|
}
|
|
920
1061
|
export function validateLlmsTxt(f) {
|
|
@@ -974,7 +1115,7 @@ export function validateLlmsTxt(f) {
|
|
|
974
1115
|
add("h1-title", "pass", "Starts with an H1 title", JSON.stringify(cut(first, 80)));
|
|
975
1116
|
}
|
|
976
1117
|
else if (title === "") {
|
|
977
|
-
add("h1-title", "fail", "Starts with an H1 title", "the H1 has no text
|
|
1118
|
+
add("h1-title", "fail", "Starts with an H1 title", "the H1 has no text. The format requires the project name there");
|
|
978
1119
|
}
|
|
979
1120
|
else {
|
|
980
1121
|
add("h1-title", "fail", "Starts with an H1 title", "the first non-empty line should be a markdown H1 (# Site name, or one line of text underlined with =)");
|
|
@@ -1174,15 +1315,15 @@ export function validateLlmsTxt(f) {
|
|
|
1174
1315
|
add("sections", "pass", "H2 sections group the content", h2Count + " section" + (h2Count === 1 ? "" : "s") + ", " + sectionsWithList + " carrying a file list");
|
|
1175
1316
|
}
|
|
1176
1317
|
else if (h2Count > 0) {
|
|
1177
|
-
add("sections", "warn", "H2 sections group the content", h2Count + " section" + (h2Count === 1 ? "" : "s") + " but no file list under any of them
|
|
1318
|
+
add("sections", "warn", "H2 sections group the content", h2Count + " section" + (h2Count === 1 ? "" : "s") + " but no file list under any of them. The format puts a section's links in a markdown list");
|
|
1178
1319
|
}
|
|
1179
1320
|
else {
|
|
1180
|
-
add("sections", "warn", "H2 sections group the content", "no H2 sections found
|
|
1321
|
+
add("sections", "warn", "H2 sections group the content", "no H2 sections found. Sections are the convention for grouping links");
|
|
1181
1322
|
}
|
|
1182
1323
|
if (misplaced !== -1) {
|
|
1183
1324
|
const s = checks[checks.length - 1];
|
|
1184
1325
|
s.status = "warn";
|
|
1185
|
-
s.detail += "
|
|
1326
|
+
s.detail += ". The heading at line " + (misplaced + 1) + " is out of place, because the format has one H1 and no other heading before the first H2";
|
|
1186
1327
|
}
|
|
1187
1328
|
// Links are collected from the prose only, for the same reason the headings are: a link
|
|
1188
1329
|
// shown inside a code fence is an example of a link, not one an agent can follow. Computed
|
|
@@ -1197,7 +1338,7 @@ export function validateLlmsTxt(f) {
|
|
|
1197
1338
|
add("links", "warn", "Markdown links an agent can follow", "no markdown links found");
|
|
1198
1339
|
}
|
|
1199
1340
|
else if (unnamed > 0) {
|
|
1200
|
-
add("links", "warn", "Markdown links an agent can follow", links.length + " link" + (links.length === 1 ? "" : "s") + ", " + unnamed + " with an empty link name
|
|
1341
|
+
add("links", "warn", "Markdown links an agent can follow", links.length + " link" + (links.length === 1 ? "" : "s") + ", " + unnamed + " with an empty link name. An entry needs a name an agent can show");
|
|
1201
1342
|
}
|
|
1202
1343
|
else if (absolute === named.length) {
|
|
1203
1344
|
add("links", "pass", "Markdown links an agent can follow", named.length + " link" + (named.length === 1 ? "" : "s") + ", all absolute URLs");
|
|
@@ -1205,7 +1346,7 @@ export function validateLlmsTxt(f) {
|
|
|
1205
1346
|
else {
|
|
1206
1347
|
const relativeCount = named.filter((m) => !/^[a-z][a-z0-9+.-]*:/i.test(m.target)).length;
|
|
1207
1348
|
const hostless = named.length - absolute - relativeCount;
|
|
1208
|
-
add("links", "warn", "Markdown links an agent can follow", named.length + " links, " + relativeCount + " relative" + (hostless > 0 ? " and " + hostless + " that are not valid http or https URLs" : "") + "
|
|
1349
|
+
add("links", "warn", "Markdown links an agent can follow", named.length + " links, " + relativeCount + " relative" + (hostless > 0 ? " and " + hostless + " that are not valid http or https URLs" : "") + ". Absolute URLs travel better when the file is read out of context");
|
|
1209
1350
|
}
|
|
1210
1351
|
// A list line that looks like a link entry but is not one (Tek-730) turns the links check to a warn.
|
|
1211
1352
|
const lookalikes = unparsedLinkEntries(lines, fenced, new Set(proseLinks.map((m) => m.at)));
|
|
@@ -1221,7 +1362,7 @@ export function validateLlmsTxt(f) {
|
|
|
1221
1362
|
add("size", "pass", "Small enough to be cheap to read", f.bytes + " bytes");
|
|
1222
1363
|
}
|
|
1223
1364
|
else {
|
|
1224
|
-
add("size", "warn", "Small enough to be cheap to read", f.bytes + " bytes
|
|
1365
|
+
add("size", "warn", "Small enough to be cheap to read", f.bytes + " bytes. Consider moving detail to llms-full.txt");
|
|
1225
1366
|
}
|
|
1226
1367
|
// A tag needs its closing ">" (Tek-560): an opening tag with well formed attributes, a closing tag
|
|
1227
1368
|
// or a comment start. "a <b + c" is prose and no longer warns. An attribute name is any run of
|
|
@@ -1234,7 +1375,7 @@ export function validateLlmsTxt(f) {
|
|
|
1234
1375
|
// string inside an inline code span, a fenced block or after a backslash is not markup.
|
|
1235
1376
|
const htmlScan = blankCodeForHtml(proseText);
|
|
1236
1377
|
if (/<[a-zA-Z][a-zA-Z0-9-]*(?:\s+[^\s"'<>\/=\p{L}\p{N}_]*[\p{L}\p{N}_][^\s"'<>\/=]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|(?!["'])[^\s<>]+))?)*\s*\/?>|<\/[a-zA-Z][a-zA-Z0-9-]*\s*>|<!--/u.test(htmlScan)) {
|
|
1237
|
-
add("no-html", "warn", "No HTML markup in the file", "HTML tags found
|
|
1378
|
+
add("no-html", "warn", "No HTML markup in the file", "HTML tags found. llms.txt should be plain markdown");
|
|
1238
1379
|
}
|
|
1239
1380
|
else {
|
|
1240
1381
|
add("no-html", "pass", "No HTML markup in the file", "plain markdown");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "turva-llms-txt-validator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
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",
|