-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-hooks.sh
More file actions
executable file
·32 lines (23 loc) · 1.1 KB
/
setup-hooks.sh
File metadata and controls
executable file
·32 lines (23 loc) · 1.1 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
#!/usr/bin/env bash
set -euo pipefail
# Downloads and installs OpenCode Skills pre-commit hooks in the current project
# Usage: curl -sSL https://raw.githubusercontent.com/joaomj/opencode/main/setup-hooks.sh | bash
RAW_URL="https://raw.githubusercontent.com/joaomj/opencode/main"
echo "Downloading pre-commit config..."
curl -sSL "$RAW_URL/.pre-commit-config.yaml" -o .pre-commit-config.yaml
echo "Downloading check_file_length.py..."
mkdir -p .hooks
curl -sSL "$RAW_URL/hooks/check_file_length.py" -o .hooks/check_file_length.py
chmod +x .hooks/check_file_length.py
echo "Downloading check_test_mock_abuse.py..."
curl -sSL "$RAW_URL/hooks/check_test_mock_abuse.py" -o .hooks/check_test_mock_abuse.py
chmod +x .hooks/check_test_mock_abuse.py
echo "Downloading mock allowlist template..."
curl -sSL "$RAW_URL/.test-mock-external-allowlist.example" -o .test-mock-external-allowlist.example
echo "Installing pre-commit..."
pip install -q pre-commit
echo "Installing hooks..."
pre-commit install
echo ""
echo "Done! Pre-commit hooks are now active."
echo "Quality checks will run automatically on every 'git commit'."