foundary-test-1770784989/scripts/setup-hooks.sh
jordan b9cd1b3aa1
Some checks failed
ci/woodpecker/manual/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline failed
Initialize project from skeleton template
2026-02-11 04:44:08 +00:00

45 lines
1.3 KiB
Bash

#!/bin/bash
# Set up git hooks for foundary-test-1770784989
# Run this after cloning the repository
set -e
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
echo "Setting up git hooks for foundary-test-1770784989..."
# Ensure we're in a git repo
if [ ! -d "$PROJECT_ROOT/.git" ]; then
echo "Error: Not a git repository"
exit 1
fi
# Ensure .githooks directory exists
if [ ! -d "$PROJECT_ROOT/.githooks" ]; then
echo "Error: .githooks directory not found"
exit 1
fi
# Configure git to use .githooks
git config core.hooksPath .githooks
# Make hooks executable
chmod +x "$PROJECT_ROOT/.githooks/"*
echo -e "${GREEN}Git hooks installed successfully!${NC}"
echo ""
echo "Installed hooks:"
echo " - pre-commit: Code quality checks (formatting, linting)"
echo " - commit-msg: Conventional commit validation"
echo ""
echo -e "${YELLOW}Note:${NC} You may need to install these tools for full functionality:"
echo " - goimports: go install golang.org/x/tools/cmd/goimports@latest"
echo " - golangci-lint: brew install golangci-lint"
echo " - prettier: npm install -g prettier (or use per-project)"
echo " - eslint: npm install -g eslint (or use per-project)"