librarian move specifications

This commit is contained in:
nvaldez
2026-10-02 12:24:44 +02:00
committed by nvaldez
parent 3c21217970
commit 09362f3951
2 changed files with 12 additions and 10 deletions
+2 -2
View File
@@ -162,7 +162,7 @@ def build_toc(
) -> str:
"""Build a table of contents that nests folders, files and their headers.
Generated by CURSOR: 2026-10-02 - frontmatter name and version for fmlint.
Generated by AI/LLM: 2026-10-02 - frontmatter name and version for fmlint.
Args:
folder: The folder the table of contents covers.
@@ -170,7 +170,7 @@ def build_toc(
max_header_depth: Maximum header level to list per file
(3 = h1 through h3). None or 0 mean unlimited.
"""
# CURSOR: name and version are required by fmlint on every markdown file.
# AI/LLM: name and version are required by fmlint on every markdown file.
today = datetime.datetime.now(datetime.UTC).date().isoformat()
frontmatter = f"""---
name: Table of Contents
+10 -8
View File
@@ -516,14 +516,16 @@ class TestTocFrontmatter:
toc_file = temp_dir_with_md_files / TOC_NAME
content = toc_file.read_text()
# TOC should start with frontmatter delimiters
# AI/LLM: frontmatter grew past 100 characters once name and version were added.
preamble = content.split("# Table of Contents", 1)[0]
assert content.startswith("---"), "TOC should start with frontmatter delimiter"
assert "---" in content[1:100], "TOC should have closing frontmatter delimiter"
assert preamble.count("---") >= 2, "TOC should have closing frontmatter delimiter"
# TOC should have frontmatter fields
assert "title:" in content[:200], "TOC should have title in frontmatter"
assert "created:" in content[:300] or "date:" in content[:300], "TOC should have date field in frontmatter"
assert "type:" in content[:300], "TOC should have type field in frontmatter"
assert "name: Table of Contents" in preamble, "TOC should have name in frontmatter"
assert "version: 1.0.0" in preamble, "TOC should have version in frontmatter"
assert "title:" in preamble, "TOC should have title in frontmatter"
assert "created:" in preamble or "date:" in preamble, "TOC should have date field in frontmatter"
assert "type:" in preamble, "TOC should have type field in frontmatter"
finally:
sys.argv = original_argv
@@ -540,7 +542,7 @@ version: 1.0.0
# File 1
## Section 1
""")
file_without_version = temp_dir_with_md_files / "file2.md"
file_without_version.write_text("# File 2\n")
@@ -554,7 +556,7 @@ version: 1.0.0
# Check that entries include version
# file1.md has version 1.0.0
assert "v1.0.0" in content, "TOC should include version 1.0.0 for file1.md"
# file2.md has no version, should show v0.0.0
assert "v0.0.0" in content, "TOC should show v0.0.0 for files without version"
finally: