feat(claude): random improvements

This commit is contained in:
Barrett Ruth 2026-03-06 16:39:23 -05:00
parent 44b9ac8a7e
commit 2c4ff5cb8c
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
5 changed files with 34 additions and 12 deletions

View file

@ -4,17 +4,16 @@ set -euo pipefail
INPUT=$(cat)
CMD=$(printf '%s' "$INPUT" | jq -r '.tool_input.command // empty')
if printf '%s' "$CMD" | grep -qE '\bgh\b.*\s(-R|--repo)\b'; then
echo "Blocked: do not target other repos with -R/--repo. Run gh commands against the current repo only." >&2
exit 2
fi
if printf '%s' "$CMD" | grep -qE '\bgit\s+push\b'; then
BRANCH=$(git branch --show-current 2>/dev/null || true)
if [ "$BRANCH" = "main" ] || [ "$BRANCH" = "master" ]; then
echo "Blocked: never push directly to $BRANCH. Use a feature branch." >&2
exit 2
fi
if printf '%s' "$CMD" | grep -qE '\bgit\s+push\b.*\b(main|master)\b'; then
echo "Blocked: never push to main/master by name. Use a feature branch." >&2
exit 2
fi
fi
exit 0