diff --git a/.claude/hooks/format-and-lint.sh b/.claude/hooks/format-and-lint.sh new file mode 100755 index 000000000..ecca9fdcf --- /dev/null +++ b/.claude/hooks/format-and-lint.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Read hook input from stdin +input=$(cat) + +# Extract file path from the input JSON +file_path=$(echo "$input" | jq -r '.tool_input.file_path // empty') + +# Only process Go files +if [[ "$file_path" =~ \.go$ ]]; then + echo "Running go fmt on $file_path" + go fmt "$file_path" +fi \ No newline at end of file diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 000000000..fd1015a68 --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,15 @@ +{ + "hooks": { + "PostToolUse": [ + { + "matcher": "Edit|Write", + "hooks": [ + { + "type": "command", + "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/format-and-lint.sh" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/CLAUDE.md b/CLAUDE.md index 1f3099174..417f07e67 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -135,7 +135,7 @@ make migration_lint # Lint migration files ## Key Technologies -- **Language**: Go 1.24.6. To know how to upgrade go version, see @.claude/golang-upgrade-process.md +- **Language**: Go 1.24.6. To know how to upgrade go version, see docs/runbooks - **API**: gRPC with HTTP/JSON gateway, Protocol Buffers with buf - **Database**: PostgreSQL with Ent ORM, Atlas for migrations - **Authentication**: OIDC, JWT tokens @@ -253,8 +253,5 @@ All commits must meet these criteria: Code reviews are required for all submissions via GitHub pull requests. - make sure golang code is always formatted and golang-ci-lint is run - - - I do not want you to be in the co-author signoff -- make sure all go code is go-fmt - when the schema is changed, run make generate, do not create a migration explicitly \ No newline at end of file diff --git a/.claude/golang-upgrade-process.md b/docs/runbooks/golang-upgrade-process.md similarity index 100% rename from .claude/golang-upgrade-process.md rename to docs/runbooks/golang-upgrade-process.md