mirror of
https://github.com/tradecatlabs/vibe-coding-cn.git
synced 2026-07-27 18:57:50 +00:00
chore: governance - tighten repo hygiene
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Check required repository-owned directories have README.md and AGENTS.md."""
|
||||
"""Check repository-owned directories have README.md and AGENTS.md."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -9,6 +9,9 @@ from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
REQUIRED_DIRS = [
|
||||
Path(".github"),
|
||||
Path(".github/ISSUE_TEMPLATE"),
|
||||
Path(".github/workflows"),
|
||||
Path("assets"),
|
||||
Path("assets/ai-citation"),
|
||||
Path("assets/datasets"),
|
||||
@@ -23,24 +26,60 @@ REQUIRED_DIRS = [
|
||||
Path("metadata"),
|
||||
Path("prompts"),
|
||||
Path("scripts"),
|
||||
Path("scripts/lib"),
|
||||
Path("skills"),
|
||||
Path("skills/auto-skill"),
|
||||
Path("skills/auto-skill/assets"),
|
||||
Path("skills/auto-skill/references"),
|
||||
Path("skills/auto-skill/scripts"),
|
||||
Path("tools"),
|
||||
Path("tools/chat-vault"),
|
||||
Path("tools/config"),
|
||||
Path("tools/config/.codex"),
|
||||
Path("tools/external"),
|
||||
Path("tools/prompts-library"),
|
||||
Path("tools/prompts-library/docs"),
|
||||
Path("tools/prompts-library/scripts"),
|
||||
]
|
||||
GENERATED_OR_VENDOR_DIRS = [
|
||||
Path("node_modules"),
|
||||
]
|
||||
SKIP_PARTS = {".git", ".history", "node_modules", "__pycache__"}
|
||||
SKIP_PREFIXES = [
|
||||
Path(".github/wiki"),
|
||||
]
|
||||
VENDOR_SUBTREES = [
|
||||
Path("tools/external"),
|
||||
Path("tools/chat-vault"),
|
||||
]
|
||||
|
||||
|
||||
def should_skip(directory: Path) -> bool:
|
||||
rel = directory.relative_to(ROOT)
|
||||
if any(part in SKIP_PARTS for part in rel.parts):
|
||||
return True
|
||||
if directory.is_symlink():
|
||||
return True
|
||||
if any(rel == prefix or prefix in rel.parents for prefix in SKIP_PREFIXES):
|
||||
return True
|
||||
return any(vendor in rel.parents for vendor in VENDOR_SUBTREES)
|
||||
|
||||
|
||||
def repository_owned_dirs() -> list[Path]:
|
||||
dirs = set(REQUIRED_DIRS)
|
||||
for directory in ROOT.rglob("*"):
|
||||
if not directory.is_dir():
|
||||
continue
|
||||
if should_skip(directory):
|
||||
continue
|
||||
dirs.add(directory.relative_to(ROOT))
|
||||
return sorted(dirs)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
errors: list[str] = []
|
||||
|
||||
for rel_dir in REQUIRED_DIRS:
|
||||
for rel_dir in repository_owned_dirs():
|
||||
directory = ROOT / rel_dir
|
||||
if not directory.is_dir():
|
||||
errors.append(f"{rel_dir}: required directory is missing")
|
||||
@@ -61,7 +100,7 @@ def main() -> int:
|
||||
print(f"TOTAL={len(errors)}")
|
||||
return 1
|
||||
|
||||
print(f"OK directory README/AGENTS pairs checked: {len(REQUIRED_DIRS)} directories")
|
||||
print(f"OK directory README/AGENTS pairs checked: {len(repository_owned_dirs())} directories")
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user