#!/usr/bin/env bash
set -euo pipefail

ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
cd "$ROOT"

git rev-parse --is-inside-work-tree >/dev/null 2>&1 || {
  echo '[FAIL] Not inside a git repository' >&2
  exit 1
}

chmod +x scripts/git-hooks/commit-msg scripts/validate_conventional_commit.py scripts/version.py
git config core.hooksPath scripts/git-hooks

echo '[OK] Git hooks installed: core.hooksPath=scripts/git-hooks'
echo '[OK] commit-msg now enforces Conventional Commits'
