-
Notifications
You must be signed in to change notification settings - Fork 201
Expand file tree
/
Copy pathsetup_precommit.sh
More file actions
executable file
Β·40 lines (32 loc) Β· 1.07 KB
/
setup_precommit.sh
File metadata and controls
executable file
Β·40 lines (32 loc) Β· 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
# Auto-setup script for pre-commit hooks and development environment
# Run this after cloning the repository.
#
# What it does:
# 1. Installs the pre-commit framework and hooks
set -e
REPO_ROOT="$(cd "$(dirname "$0")" && pwd)"
cd "$REPO_ROOT"
echo "π§ Setting up development environment for ToolUniverse..."
# --- 1. Pre-commit hooks ---
# Check if .pre-commit-config.yaml exists
if [ ! -f ".pre-commit-config.yaml" ]; then
echo "β .pre-commit-config.yaml not found in current directory"
exit 1
fi
# Check if pre-commit is installed
if ! command -v pre-commit &> /dev/null; then
echo "Installing pre-commit..."
pip install pre-commit
echo "β
pre-commit installed successfully"
else
echo "β
pre-commit is already installed"
fi
# Install pre-commit hooks
echo "Installing pre-commit hooks..."
pre-commit install
echo "β
pre-commit hooks installed successfully"
echo ""
echo "π Setup completed successfully!"
echo "π Pre-commit hooks will now run automatically on every commit."
echo "π‘ To run hooks manually: pre-commit run --all-files"