mirror of
https://github.com/AstronautCheetah/frame-tweaks.git
synced 2026-10-27 11:00:28 +01:00
The official tweaks move into packs/official/ and become data: everything the installer, the installer window, the docs and the tests knew about a tweak is now in the front matter of its README.md (title, category, tier, summary, what/why, author, source, dependencies, icon, Run label, processes to stop, settings, known issue, wallet apps, the docs' changes/access/undo, offline test). components.tsv, every meta and processes file, the "# label:" lines and the window's icon, known-issue and wallet tables are gone; pack.md orders categories and tweaks. - lib/manifest.py: a dependency-free reader for a strict YAML subset. It refuses what YAML readers disagree on (yes/no/on/off, dates, 010, anchors, tags, duplicate keys, plain values continuing on the next line) instead of guessing; tests compare it with PyYAML on every manifest. Also a writer. - lib/sft.py loads packs: the official one, then ~/.local/share/frame-tweaks/packs/* and FRAME_TWEAKS_PACKS. A user's pack is used only once trusted (hash of its files; a changed pack needs trusting again); a tweak with an id already taken is used only with `replaces: true`; missing dependencies, newer pack api and invalid manifests are reported, not loaded. `./install.sh mods [trust|untrust PACK | check FOLDER]`. - Scripts find their files through $TWEAK_DIR and other tweaks through tweak_dir (the installer passes FRAME_TWEAKS_DIRS); they source the helpers through $FRAME_TWEAKS_LIB. The installer runs every script with bash, so a pack's scripts needn't be executable. Arrow Pad's "release stuck modifiers after stopping it" is its own stopped.sh hook. - Tweak icons live in their tweak's folder; the window shows them from there. - dev/test-tweaks.sh: the offline set and what uninstall may keep come from manifests; a tweak's offline dependencies are installed before the baseline instead of listing their files. - Docs links, CI, pin tools and tests follow the new paths.
24 lines
1.2 KiB
Python
Executable File
24 lines
1.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Docs consistency: every tweak in the official pack 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 d in (root / "packs/official").iterdir() if (d / "README.md").is_file()]
|
|
readme = (root / "README.md").read_text()
|
|
rows = set(re.findall(r"^\|[^|]*\| \[\*\*[^]]+\*\*\]\(packs/official/([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)
|