Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"Bash(git branch -r:*)",
"Bash(git branch -v:*)",
"Bash(git fetch:*)",
"Bash(git push:*)",
"Bash(ls:*)",
"Bash(tree:*)",
"Bash(wc:*)",
Expand Down Expand Up @@ -50,7 +51,6 @@
"mcp__ide__getDiagnostics"
],
"deny": [
"Bash(git push:*)",
"Bash(git reset:*)",
"Bash(git clean:*)",
"Bash(git branch -D:*)",
Expand Down
19 changes: 19 additions & 0 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
#
# Block direct pushes to protected branches (main / master / release/*).
# Feature branches pass through untouched. Git feeds each ref being pushed on
# stdin as "<local ref> <local sha> <remote ref> <remote sha>", so this checks
# the resolved destination and catches bare `git push` as well as explicit ones.
# GitHub branch protection is the server-side backstop; this is the local guard.
set -euo pipefail

protected='^refs/heads/(main|master|release/.*)$'

while read -r _local_ref _local_sha remote_ref _remote_sha; do
if [[ "$remote_ref" =~ $protected ]]; then
echo "pre-push: direct pushes to '${remote_ref#refs/heads/}' are blocked - open a PR instead." >&2
exit 1
fi
done

exit 0
9 changes: 7 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ default:
# Create virtual environment and install dependencies
venv:
pip install uv
uv venv
source .venv/bin/activate
uv venv
source .venv/bin/activate
@just install-hooks
@just install

# Install git hooks (points core.hooksPath at .githooks; idempotent, safe to re-run)
install-hooks:
git config core.hooksPath .githooks

# Install dependencies
install:
uv pip install -e ".[dev]"
Expand Down
Loading