mirror of
https://github.com/AstronautCheetah/frame-tweaks.git
synced 2026-10-17 12:00:18 +02:00
The first official pack was called Original, which suggested Frame Tweaks wrote everything in it, Homebrew included. It's now Core (packs/core): Frame Tweaks' own tweaks and the helpers many of them need, other projects' tools credited to their makers; its description names them (Homebrew for whisper.cpp, tesseract and scrcpy; ydotool for typing; Piper for Narrate). A Core turned off as "original" stays off, and a packs/original an update leaves behind with only ignored files isn't taken for a pack of the user's. Mouse cursor fix is curiousjtuber's fix (from ThrillSeeker via Cas and Chary XR), so it moves to 3rd Party, whose description now covers such fixes too. The Packs page's inventories tagged the Homebrew tweaks sudo even with Homebrew installed; they use the same check as the list now.
29 lines
1.6 KiB
Python
Executable File
29 lines
1.6 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 ("core", "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/(?:core|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"):
|
|
parts = md.relative_to(root).parts
|
|
if {".git", "tmp", "references"} & set(parts):
|
|
continue
|
|
if parts[0] == "packs" and len(parts) > 2 and parts[1] not in ("core", "integrations", "third-party"):
|
|
continue # (a local pack, not published: packs/attic, say)
|
|
text = re.sub(r"```.*?```", "", md.read_text(), flags=re.S)
|
|
text = re.sub(r"`[^`\n]*`", "", text) # code isn't a link
|
|
links = re.findall(r"\]\((?!https?:|mailto:|#)([^)#\s]+)", text)
|
|
links += re.findall(r"""<(?:img|a|source)\b[^>]*?\s(?:src|href)=["'](?!https?:|mailto:|#|data:)([^"'#]+)""", text) # (HTML)
|
|
for target in links:
|
|
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)
|