diff --git a/.claude/hooks/format.sh b/.claude/hooks/format.sh new file mode 100755 index 0000000..af20ae7 --- /dev/null +++ b/.claude/hooks/format.sh @@ -0,0 +1,9 @@ +#!/bin/bash +file_path=$(jq -r '.tool_input.file_path') +[[ -z "$file_path" ]] && exit 0 + +if [[ "$file_path" == *.go ]]; then + gofmt -w "$file_path" 2>/dev/null || true +fi + +exit 0 diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 0000000..3e4cbf2 --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,16 @@ +{ + "hooks": { + "PostToolUse": [ + { + "matcher": "Edit|Write", + "hooks": [ + { + "type": "command", + "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/format.sh", + "timeout": 30 + } + ] + } + ] + } +}