#!/bin/bash # Pre-commit hook for SeaFare Montana # Install: cp pre-commit.sh .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit set -e echo "=== Pre-commit: syntax check ===" python -m py_compile seafare_api.py python -m py_compile seafare_agent.py python -m py_compile maritime_db.py python -m py_compile moltbook_bot.py python -m py_compile ais_provider.py python -m py_compile equasis_parser.py python -m py_compile marinetraffic_parser.py python -m py_compile maritime_compliance.py echo "=== Pre-commit: running tests ===" python -m pytest tests/ -q --tb=line 2>/dev/null || { echo "WARNING: pytest not installed or tests failed — skipping" } echo "=== Pre-commit: checking for secrets ===" if git diff --cached --name-only | grep -q '\.env$'; then echo "ERROR: .env file staged for commit! Remove with: git reset HEAD .env" exit 1 fi echo "=== Pre-commit: all checks passed ==="