Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
25 changes: 25 additions & 0 deletions .claude/hooks/enforce-makefile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
set -euo pipefail

# PreToolUse hook: intercept commands that should use Makefile targets instead.
# Exit 0 with JSON deny = block the command and suggest an alternative.
# Exit 0 with no output = allow the command.

INPUT=$(cat)
COMMAND=$(printf '%s' "$INPUT" | jq -r '.tool_input.command // empty')

# Block direct invocation of the AI writing check script
# Match only actual script execution (uv run python / python), not mentions in strings
if [[ "$COMMAND" =~ (uv\ run\ python|python3?|\./).*check_ai_writing\.py ]]; then
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Outdated
jq -n '{
hookSpecificOutput: {
hookEventName: "PreToolUse",
permissionDecision: "deny",
permissionDecisionReason: "Do not run the AI writing check script directly. Instead, avoid using em dashes (U+2014) in any code or text you write. The check runs automatically via pre-commit hooks."
}
}'
exit 0
fi

# Allow everything else
exit 0
16 changes: 16 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/enforce-makefile.sh\"",
"timeout": 5
}
]
}
]
}
}
Loading