#!/usr/bin/env zsh

set -eu

repo_root=$(git rev-parse --show-toplevel)
hook_path="${repo_root}/.git/hooks/pre-commit"
target="${repo_root}/scripts/git-hooks/pre-commit"

mkdir -p "${repo_root}/.git/hooks"
cat > "${hook_path}" <<EOF
#!/usr/bin/env zsh
exec "${target}" "\$@"
EOF

chmod +x "${hook_path}"
echo "Installed git hook: ${hook_path}"
