Files
praxis/scripts/install-hooks.sh
T
kiskaadee d6f9103906 ci: set up quality control pipeline and automated git hooks
- Add toolchain configurations for Ruff, Pyright, and Pytest in pyproject.toml
- Implement pre-commit hook for fast linting/formatting and pre-push hook for strict typing and tests
- Document mandatory quality gates in AGENTS.md
- Include initial smoke test to ensure the test runner is functioning.
2026-09-24 16:30:52 -05:00

43 lines
1.0 KiB
Bash

#!/usr/bin/env bash
# =============================================================================
# scripts/install-hooks.sh
#
# Installs project git hooks into .git/hooks/.
# Run once after cloning:
#
# bash scripts/install-hooks.sh
#
# Or with uv (if added as a script entry point):
#
# uv run install-hooks
# =============================================================================
set -euo pipefail
REPO_ROOT=$(git rev-parse --show-toplevel)
HOOKS_SRC="$REPO_ROOT/scripts/hooks"
HOOKS_DST="$REPO_ROOT/.git/hooks"
GREEN=$(tput setaf 2 2>/dev/null || true)
RESET=$(tput sgr0 2>/dev/null || true)
install_hook() {
local name="$1"
local src="$HOOKS_SRC/$name"
local dst="$HOOKS_DST/$name"
if [[ ! -f "$src" ]]; then
echo "WARNING: $src not found — skipping."
return
fi
cp "$src" "$dst"
chmod +x "$dst"
echo "${GREEN}✔${RESET} Installed $name"
}
install_hook "pre-commit"
install_hook "pre-push"
echo ""
echo "Git hooks installed. Run 'bash scripts/install-hooks.sh' after every fresh clone."