chore: governance - tighten repo hygiene

This commit is contained in:
tukuaiai
2026-05-04 04:45:05 +08:00
parent bf73f011bc
commit 2eafa33fee
30 changed files with 423 additions and 404 deletions
+1 -26
View File
@@ -8,9 +8,9 @@ import sys
import urllib.parse
from pathlib import Path
from lib.taxonomy import taxonomy_document_paths
ROOT = Path(__file__).resolve().parents[1]
TAXONOMY = ROOT / "metadata/taxonomy.yml"
AI_ENTRY_FILES = [
Path("llms.txt"),
Path("assets/ai-citation/llms-full.txt"),
@@ -28,31 +28,6 @@ MARKDOWN_LINK_PATTERN = re.compile(r"!??\[[^\]]*\]\(([^)]+)\)")
EXTERNAL_PREFIXES = ("http://", "https://", "mailto:", "tel:", "data:")
def strip_quotes(value: str) -> str:
return value.strip().strip("\"'")
def taxonomy_document_paths() -> list[str]:
paths: list[str] = []
in_documents = False
for line in TAXONOMY.read_text(encoding="utf-8").splitlines():
if line == "documents:":
in_documents = True
continue
if in_documents and line and not line.startswith(" "):
break
if not in_documents:
continue
stripped = line.strip()
if stripped.startswith("- path:"):
_, value = stripped.split(":", 1)
paths.append(strip_quotes(value))
return paths
def github_slug(title: str) -> str:
title = re.sub(r"<[^>]+>", "", title.strip().lower())
title = re.sub(r"[`*_~]", "", title)