Skip to content

Commit 15fd1a7

Browse files
authored
Cover llms txt generation check (#3555)
* Cover llms txt generation check * Normalize llms txt doc paths
1 parent 04aed3f commit 15fd1a7

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

scripts/build_llms_txt.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,12 @@ def extract_page_info(md_path: Path, url: str, depth: int = 0) -> PageInfo | Non
129129
if len(desc) > MAX_DESC_LEN:
130130
desc = desc[: MAX_DESC_LEN - 3] + "..."
131131
return PageInfo(
132-
title=title, path=str(md_path.relative_to(DOCS_DIR)), url=url, description=desc, content=content, depth=depth
132+
title=title,
133+
path=md_path.relative_to(DOCS_DIR).as_posix(),
134+
url=url,
135+
description=desc,
136+
content=content,
137+
depth=depth,
133138
)
134139

135140

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""Tests for llms.txt documentation generation."""
2+
3+
from __future__ import annotations
4+
5+
import subprocess
6+
import sys
7+
from pathlib import Path
8+
9+
SCRIPT = Path(__file__).resolve().parents[1] / "scripts" / "build_llms_txt.py"
10+
11+
12+
def test_build_llms_txt_check_is_up_to_date() -> None:
13+
"""Generated llms.txt files are committed."""
14+
subprocess.run([sys.executable, str(SCRIPT), "--check"], check=True)

0 commit comments

Comments
 (0)