refactor: tidy the repository root

README.md and CONTRIBUTING.md open with a comment naming their
generator, generate_readme.py --check fails on a hand edit in
validate.yml and pr_checks.py, and .gitattributes marks the pipeline
outputs as generated, held equal to core/generated.py by a test.

_mame_clones.json becomes mame_clones.json, still written beside the
scanned bios/ tree, and now triggers both workflows (coverage reads it).
docs_assets/ moves to website/assets/, which Astro does not read as
content. ACCESSIBILITY.md becomes wiki/accessibility.md, linked from the
README and the installer page. The screenshot list moves to
wiki/images-wanted.md: nothing read docs_assets/screens/.

The architecture map names every root entry (test_repository_map),
platforms/README.md keeps only what this folder holds, the reference
index lists archive-recipes and measurements, and reference-terms no
longer defines Profile twice nor repeats the glossary's Pack.
This commit is contained in:
Abdessamad Derraz committed 2026-11-24 10:40:25 +01:00
1 parent 5e306ec19f
commit ab7e300c19
283 files changed
+410 -193

No files matched your search

+31 -12
View File
@@ -14,7 +14,7 @@ from core.text import series
from romrecipes import ledger
from devtools import prchecks
from model import releaserecord, siteinputs
from core.artifacts import write_if_changed
from core.artifacts import content_differs, write_if_changed
from core.paths import DB_FILE, REPO_ROOT
from core.sizes import size_text
from core import upstream
@@ -94,7 +94,7 @@ def collection_line(total_files: int, comp: dict) -> str:
# The installer demo (scripts/make_demo.py): the recording and what it shows.
DEMO_GIF = "docs_assets/demo/install.gif"
DEMO_GIF = "website/assets/demo/install.gif"
REPO = REPO_SLUG
README_PATH = REPO_ROOT / "README.md"
CONTRIBUTING_PATH = REPO_ROOT / "CONTRIBUTING.md"
@@ -372,6 +372,7 @@ def render_readme(inputs: ReadmeInputs) -> str:
f"- Have a file? [Check it by its hash]({SITE_URL}files/)",
f"- Every console and the files it needs: [systems]({SITE_URL}systems/)",
f"- Asking an AI assistant: it reads the site best from [llms.txt]({SITE_URL}llms.txt)",
f"- Screen reader, keyboard only or no colour: [accessibility]({SITE_URL}wiki/accessibility/)",
"",
"## How it is built",
"",
@@ -612,14 +613,32 @@ def generate_contributing() -> str:
)
def write_readme(readme: str) -> None:
status = "Generated" if write_if_changed(str(README_PATH), readme) else "Unchanged"
print(f"{status} ./README.md")
# The first line of both repository files: GitHub renders the comment as
# nothing, and whoever opens the file to edit it learns where the text comes from.
GENERATED_MARKER = (
"<!-- Generated by scripts/generate_readme.py from scripts/sitegen/readme.py."
" Edit the generator, then run it: a hand edit fails the Validation workflow. -->\n"
)
contributing = generate_contributing()
status = (
"Generated"
if write_if_changed(str(CONTRIBUTING_PATH), contributing)
else "Unchanged"
)
print(f"{status} ./CONTRIBUTING.md")
def readme_files(readme: str) -> dict[Path, str]:
"""README.md and CONTRIBUTING.md as the repository holds them."""
return {
Path(README_PATH): GENERATED_MARKER + readme,
Path(CONTRIBUTING_PATH): GENERATED_MARKER + generate_contributing(),
}
def check_readme(readme: str) -> int:
"""1, naming each file, when the committed text differs from the generated one."""
stale = [path.name for path, text in readme_files(readme).items()
if content_differs(str(path), text)]
for name in stale:
print(f"{name} differs from what generate_readme.py writes: run it and commit")
return 1 if stale else 0
def write_readme(readme: str) -> None:
for path, text in readme_files(readme).items():
status = "Generated" if write_if_changed(str(path), text) else "Unchanged"
print(f"{status} ./{path.name}")