feat: add push-reminder hook (opt-in, disabled by default)

This commit is contained in:
Mortdecai
2026-04-01 17:50:50 -04:00
parent e8980d06a8
commit e6438816ca
2 changed files with 23 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
{
"description": "Gitea connector hooks — push reminder after commits (opt-in)",
"hooks": {}
}
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# push-reminder.sh — nudges you to push after a commit
# Reads Bash tool output from stdin (JSON), checks if a git commit happened.
set -euo pipefail
INPUT=$(cat)
TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // ""')
TOOL_RESULT=$(echo "$INPUT" | jq -r '.tool_result // ""')
# Only trigger on Bash tool
[[ "$TOOL_NAME" == "Bash" ]] || exit 0
# Check if the output looks like a successful git commit
if echo "$TOOL_RESULT" | grep -qE '^\[.+\]\s+\S+'; then
echo '{"decision":"approve","systemMessage":"Commit detected! Friendly reminder: run `gitea push` to send it to git.sethpc.xyz. Unpushed commits are just really elaborate local notes."}'
else
echo '{"decision":"approve"}'
fi