Skip to content

Commit 57aaae8

Browse files
authored
chore(claude): add format hook (#2359)
Signed-off-by: Miguel Martinez <[email protected]>
1 parent 7f34140 commit 57aaae8

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

.claude/hooks/format-and-lint.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
# Read hook input from stdin
4+
input=$(cat)
5+
6+
# Extract file path from the input JSON
7+
file_path=$(echo "$input" | jq -r '.tool_input.file_path // empty')
8+
9+
# Only process Go files
10+
if [[ "$file_path" =~ \.go$ ]]; then
11+
echo "Running go fmt on $file_path"
12+
go fmt "$file_path"
13+
fi

.claude/settings.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"hooks": {
3+
"PostToolUse": [
4+
{
5+
"matcher": "Edit|Write",
6+
"hooks": [
7+
{
8+
"type": "command",
9+
"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/format-and-lint.sh"
10+
}
11+
]
12+
}
13+
]
14+
}
15+
}

CLAUDE.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ make migration_lint # Lint migration files
135135

136136
## Key Technologies
137137

138-
- **Language**: Go 1.24.6. To know how to upgrade go version, see @.claude/golang-upgrade-process.md
138+
- **Language**: Go 1.24.6. To know how to upgrade go version, see docs/runbooks
139139
- **API**: gRPC with HTTP/JSON gateway, Protocol Buffers with buf
140140
- **Database**: PostgreSQL with Ent ORM, Atlas for migrations
141141
- **Authentication**: OIDC, JWT tokens
@@ -253,8 +253,5 @@ All commits must meet these criteria:
253253

254254
Code reviews are required for all submissions via GitHub pull requests.
255255
- make sure golang code is always formatted and golang-ci-lint is run
256-
257-
258256
- I do not want you to be in the co-author signoff
259-
- make sure all go code is go-fmt
260257
- when the schema is changed, run make generate, do not create a migration explicitly

0 commit comments

Comments
 (0)