Files
AstronautCheetah--frame-tweaks/dev/check-docs.py
T
AstronautCheetah 3da788d880 feat(i18n): the language follows the keyboard; scripts and tweak programs marked; an Integrations pack
- lib/i18n.py: the active keyboard's language (Steam's VR keyboard in VR, KDE's layout in desktop
  mode), looked at no more than every 5 s; the window switches when it changes. A language
  without its own file uses one for the same language (es, es_MX: es_419.po).
- Shell scripts translate with t (lib/i18n.sh); installed programs get a copy of the
  translations (install_i18n). dev/i18n.py collects t, N_ and the tweak programs' text, and
  exports/imports batches for translating (locale/BATCH.md, MARKING.md, glossary/es_419.md).
- Integrations: Signal, NordVPN, VSCodium, Claude Code and Claude Desktop move from Original to a
  third official pack, packs/integrations.
2026-10-14 14:50:29 -04:00

24 lines
1.3 KiB
Python
Executable File

#!/usr/bin/env python3
"""Docs consistency: every tweak in the official packs has a row in README.md, README links only
to tweaks that exist, and relative links in all Markdown files point at real files."""
import re
import sys
from pathlib import Path
root = Path(__file__).resolve().parent.parent
ids = [d.name for pack in ("original", "integrations", "third-party") for d in (root / "packs" / pack).iterdir() if (d / "README.md").is_file()]
readme = (root / "README.md").read_text()
rows = set(re.findall(r"^\|[^|]*\| \[\*\*[^]]+\*\*\]\(packs/(?:original|integrations|third-party)/([a-z0-9-]+)/\)", readme, re.M))
problems = [f"README.md: no row for '{i}'" for i in ids if i not in rows]
problems += [f"README.md: row for unknown tweak '{r}'" for r in rows - set(ids)]
for md in root.rglob("*.md"):
if {".git", "tmp", "references"} & set(md.relative_to(root).parts):
continue
text = re.sub(r"```.*?```", "", md.read_text(), flags=re.S)
text = re.sub(r"`[^`\n]*`", "", text) # code isn't a link
for target in re.findall(r"\]\((?!https?:|mailto:|#)([^)#\s]+)", text):
if not (md.parent / target).exists():
problems.append(f"{md.relative_to(root)}: broken link {target}")
print("\n".join(problems) or "docs ok")
sys.exit(1 if problems else 0)