#!/usr/bin/env python3 # Trouve-KA — vérification CI des headers d'auteur (CLAUDE.md §0.1) # Author: Simon-Pierre Boucher # Contact: contact@spboucher.ai """Vérifie que chaque fichier source porte le header auteur obligatoire.""" import pathlib import sys ROOT = pathlib.Path(__file__).resolve().parents[1] EXTENSIONS = {".py", ".ts", ".tsx", ".js", ".mjs", ".cjs", ".sql", ".sh", ".css", ".yml", ".yaml", ".toml"} SKIP_DIRS = {"node_modules", ".next", ".venv", "__pycache__", ".git", "dist", ".pytest_cache", ".ruff_cache"} SKIP_FILES = {"pnpm-lock.yaml", "next-env.d.ts"} REQUIRED = "Author: Simon-Pierre Boucher" def main() -> int: missing: list[pathlib.Path] = [] for path in ROOT.rglob("*"): if not path.is_file() or path.suffix not in EXTENSIONS or path.name in SKIP_FILES: continue if any(part in SKIP_DIRS for part in path.parts): continue head = path.read_text(encoding="utf-8", errors="replace")[:600] if REQUIRED not in head: missing.append(path.relative_to(ROOT)) if missing: print(f"✗ {len(missing)} fichier(s) sans header auteur :") for p in missing: print(f" - {p}") return 1 print("✓ Tous les fichiers source portent le header auteur.") return 0 if __name__ == "__main__": sys.exit(main())