SPB Git

spb/metrika Public

Stata-class statistics, GPU-accelerated by Apple Silicon. Native Swift — no Electron, no Python runtime, no compromises.

Swift 92.4% HTML 3.3% R 3% Shell 1.3%
1.4 KB · 46 lines shellscript
Raw Blame History
1#!/bin/bash2#3#  check_headers.sh — Metrika4#5#  Author:  Simon-Pierre Boucher6#  Contact: contact@spboucher.ai7#  Copyright © 2026 Simon-Pierre Boucher. All rights reserved.8#9#  Rejects any source file (.swift, .metal, .sh, .py, .zyq) missing the10#  mandatory Metrika file header (CLAUDE.md §0). With --staged, checks only11#  files staged in git (pre-commit mode); otherwise checks the whole tree.12#13set -euo pipefail1415ROOT="$(cd "$(dirname "$0")/.." && pwd)"16MODE="${1:-all}"1718if [[ "$MODE" == "--staged" ]]; then19  FILES=$(git -C "$ROOT" diff --cached --name-only --diff-filter=ACMR \20    | grep -E '\.(swift|metal|sh|py|zyq)$' || true)21else22  FILES=$(cd "$ROOT" && find . \23    -not -path './.git/*' -not -path '*/.build/*' -not -path '*/build/*' \24    -not -path '*/DerivedData/*' -not -path '*/.swiftpm/*' \25    \( -name '*.swift' -o -name '*.metal' -o -name '*.sh' -o -name '*.py' -o -name '*.zyq' \) \26    | sed 's|^\./||')27fi2829FAIL=030for f in $FILES; do31  [[ -f "$ROOT/$f" ]] || continue32  HEAD_BLOCK=$(head -n 12 "$ROOT/$f")33  if ! grep -q 'Author:  Simon-Pierre Boucher' <<<"$HEAD_BLOCK" \34     || ! grep -q 'Contact: contact@spboucher.ai' <<<"$HEAD_BLOCK"; then35    echo "❌ missing Metrika header: $f"36    FAIL=137  fi38done3940if [[ $FAIL -ne 0 ]]; then41  echo ""42  echo "Every source file must begin with the Metrika header (see CLAUDE.md §0)."43  exit 144fi45echo "✅ header check passed"46