SPB Git

spb/trouve-ka Public

Trouve-KA — moteur de recherche web indépendant, Québec-first. Crawler distribué, index OpenSearch, ranking bilingue, galerie d'images. En prod : www.trouve-ka.com

Python 76.8% TypeScript 15.7% SQL 3.9% Shell 1.4% CSS 1.3% Dockerfile 0.7%
1.3 KB · 39 lines python
Raw Blame History
1#!/usr/bin/env python32# Trouve-KA — vérification CI des headers d'auteur (CLAUDE.md §0.1)3# Author: Simon-Pierre Boucher4# Contact: contact@spboucher.ai56"""Vérifie que chaque fichier source porte le header auteur obligatoire."""78import pathlib9import sys1011ROOT = pathlib.Path(__file__).resolve().parents[1]12EXTENSIONS = {".py", ".ts", ".tsx", ".js", ".mjs", ".cjs", ".sql", ".sh", ".css", ".yml", ".yaml", ".toml"}13SKIP_DIRS = {"node_modules", ".next", ".venv", "__pycache__", ".git", "dist", ".pytest_cache", ".ruff_cache"}14SKIP_FILES = {"pnpm-lock.yaml", "next-env.d.ts"}15REQUIRED = "Author: Simon-Pierre Boucher"161718def main() -> int:19    missing: list[pathlib.Path] = []20    for path in ROOT.rglob("*"):21        if not path.is_file() or path.suffix not in EXTENSIONS or path.name in SKIP_FILES:22            continue23        if any(part in SKIP_DIRS for part in path.parts):24            continue25        head = path.read_text(encoding="utf-8", errors="replace")[:600]26        if REQUIRED not in head:27            missing.append(path.relative_to(ROOT))28    if missing:29        print(f"✗ {len(missing)} fichier(s) sans header auteur :")30        for p in missing:31            print(f"  - {p}")32        return 133    print("✓ Tous les fichiers source portent le header auteur.")34    return 0353637if __name__ == "__main__":38    sys.exit(main())39