Hook automatically rebuilds and installs bd CLI when Go files change. Usage in new clones: ./scripts/install-hooks.sh Files: - scripts/hooks/post-push: Hook that runs go install after successful push - scripts/install-hooks.sh: Installer to set up hooks in new clones 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
30 lines
705 B
Bash
Executable File
30 lines
705 B
Bash
Executable File
#!/bin/bash
|
|
# Install git hooks from scripts/hooks/ to .git/hooks/
|
|
|
|
set -e
|
|
|
|
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
HOOKS_DIR="$REPO_ROOT/scripts/hooks"
|
|
GIT_HOOKS_DIR="$REPO_ROOT/.git/hooks"
|
|
|
|
if [ ! -d "$GIT_HOOKS_DIR" ]; then
|
|
echo "Error: Not in a git repository"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Installing git hooks..."
|
|
|
|
for hook in "$HOOKS_DIR"/*; do
|
|
if [ -f "$hook" ]; then
|
|
hook_name=$(basename "$hook")
|
|
echo " Installing $hook_name"
|
|
cp "$hook" "$GIT_HOOKS_DIR/$hook_name"
|
|
chmod +x "$GIT_HOOKS_DIR/$hook_name"
|
|
fi
|
|
done
|
|
|
|
echo "✓ Git hooks installed successfully"
|
|
echo ""
|
|
echo "Installed hooks:"
|
|
ls -1 "$GIT_HOOKS_DIR" | grep -v ".sample" || true
|