diff --git a/.claude/hooks/SessionStart.sh b/.claude/hooks/SessionStart.sh new file mode 100755 index 00000000..5beb4d50 --- /dev/null +++ b/.claude/hooks/SessionStart.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Session start hook to ensure pre-commit is installed +echo "Setting up pre-commit..." + +# Check if pre-commit is available, install if not +if ! command -v pre-commit &> /dev/null; then + echo "pre-commit is not installed. Installing pre-commit..." + + # Try to install pre-commit using pip + if command -v pip3 &> /dev/null; then + pip3 install pre-commit + elif command -v pip &> /dev/null; then + pip install pre-commit + else + echo "Error: pip is not installed. Cannot install pre-commit." + exit 1 + fi + + # Verify installation + if ! command -v pre-commit &> /dev/null; then + echo "Error: Failed to install pre-commit." + exit 1 + fi + + echo "pre-commit installed successfully!" +fi + +# Install pre-commit hooks +pre-commit install +pre-commit install --hook-type commit-msg + +echo "Pre-commit hooks installed successfully!" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e715b82f..fabfe90a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,3 +13,17 @@ repos: hooks: - id: conventional-pre-commit stages: [commit-msg] + - repo: local + hooks: + - id: php-cs-fixer + name: PHP CS Fixer + entry: vendor/bin/php-cs-fixer fix + language: system + types: [php] + pass_filenames: false + - id: phpunit + name: PHPUnit + entry: vendor/bin/phpunit + language: system + types: [php] + pass_filenames: false