#!/usr/bin/env python3 """Fast, deterministic documentation and repository hygiene checks. Checks only tracked files: 1. no merge-conflict markers in tracked text files; 2. every relative Markdown link points at a tracked file or directory; 3. every workflow file under .github/workflows parses as YAML. External URLs and in-page anchors are not fetched or validated, so the result does not depend on the network. Exit status is 1 when a problem is found. Pass --require-yaml to fail, not skip, when PyYAML is missing. """ import re import subprocess import sys from pathlib import Path, PurePosixPath from urllib.parse import unquote ROOT = Path(__file__).resolve().parents[2] MARKER = re.compile(r"^(<{7}( |$)|={7}$|>{7}( |$))") LINK = re.compile(r"(?