Files
claude-hub/scripts/setup/setup-precommit.sh
Jonathan Flatt 4cdad828c4 Reorganize scripts into structured directory layout and consolidate functionality
This commit reorganizes all scripts in the repository into a more structured directory layout for better maintainability:
- Categorizes scripts by functionality (setup, build, aws, runtime, security, utils)
- Organizes test scripts into logical categories
- Consolidates redundant scripts with unified interfaces
- Adds backward compatibility wrappers
- Adds detailed SCRIPTS.md documentation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-21 00:19:07 +00:00

32 lines
977 B
Bash
Executable File

#!/bin/bash
echo "Setting up pre-commit hooks for credential scanning..."
# Check if Python is installed
if ! command -v python3 &> /dev/null && ! command -v python &> /dev/null; then
echo "Error: Python is required for pre-commit. Please install Python 3."
exit 1
fi
# Install pre-commit if not already installed
if ! command -v pre-commit &> /dev/null; then
echo "Installing pre-commit..."
pip install pre-commit || pip3 install pre-commit
fi
# Install detect-secrets if not already installed
if ! command -v detect-secrets &> /dev/null; then
echo "Installing detect-secrets..."
pip install detect-secrets || pip3 install detect-secrets
fi
# Install the git hooks
echo "Installing pre-commit hooks..."
pre-commit install
# Run initial scan to populate baseline
echo "Generating secrets baseline..."
detect-secrets scan > .secrets.baseline
echo "Pre-commit hooks installed successfully!"
echo "Run 'pre-commit run --all-files' to test the hooks"