From 877470337dc9a2145498f448bd77944c7a096809 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Mon, 9 Nov 2026 06:18:18 +0100 Subject: [PATCH] fix: keep llms-full.txt to what a setup needs It joined every setup page whole, its parts and its reference of every file: 6.9 MB, past what an assistant reads at once. Each setup's own page now stops before that reference, which its Markdown copy keeps. --- scripts/site_markdown.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/scripts/site_markdown.py b/scripts/site_markdown.py index af77d735d..1bacce5a5 100644 --- a/scripts/site_markdown.py +++ b/scripts/site_markdown.py @@ -299,6 +299,12 @@ def convert_site(dist: Path) -> int: text = page_markdown(html_path.read_text(encoding="utf-8"), url) (html_path.parent / "index.md").write_text(text, encoding="utf-8") written += 1 + write_full(dist) + return written + + +def write_full(dist: Path) -> None: + """llms-full.txt from the pages' Markdown copies.""" parts = ["# RetroBIOS: the guides in one file", "", "> The pages a setup is done with, in reading order. Every page of the site also has " "its own Markdown copy at `/index.md`.", ""] @@ -306,11 +312,21 @@ def convert_site(dist: Path) -> int: md = dist / page / "index.md" if md.is_file(): parts += [md.read_text(encoding="utf-8").rstrip(), "", "---", ""] - platforms = sorted(p for p in (dist / "platforms").glob("*/index.md") - if not re.search(r"-(files|part)-\d+$", p.parent.name)) - parts += [p.read_text(encoding="utf-8").rstrip() + "\n\n---\n" for p in platforms] + # Each setup's own page (the setups the picker lists, not the parts a + # long page is cut into), up to its reference of every file: what to + # do and where, not the full lists, which its own copy keeps. All of + # them was 6.9 MB, past what an assistant reads at once. + import json # noqa: PLC0415 + + index = dist / "data" / "picker" / "index.json" + setups = [str(item["platform"]) for item in json.loads(index.read_text(encoding="utf-8"))] \ + if index.is_file() else [] + for setup in [*setups, "linux-handhelds"]: + md = dist / "platforms" / setup / "index.md" + if md.is_file(): + text = md.read_text(encoding="utf-8") + parts += [text.split("\n## Reference", 1)[0].rstrip(), "", "---", ""] (dist / "llms-full.txt").write_text("\n".join(parts).rstrip() + "\n", encoding="utf-8") - return written def main() -> int: