Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
28 changes: 28 additions & 0 deletions .claude/hooks/biome-format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
# PostToolUse hook: auto-format the edited file with Biome.
#
# Runs `biome check --write` on the single file Claude just edited so
# formatting and safe lint fixes apply deterministically after every edit,
# instead of relying on the advisory "run check:fix when done" workflow.
# Non-blocking by design: it never fails the turn (Biome's own ignore rules
# in biome.json keep generated files out), it just keeps the tree formatted.
set -euo pipefail

input=$(cat)

# Extract tool_input.file_path from the hook's stdin JSON (node is always
# available in this repo).
file=$(printf '%s' "$input" | node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>{try{const j=JSON.parse(s);process.stdout.write((j.tool_input&&j.tool_input.file_path)||"")}catch{process.stdout.write("")}})')

[ -z "$file" ] && exit 0
[ ! -f "$file" ] && exit 0

# Only touch files Biome handles.
case "$file" in
*.ts|*.tsx|*.js|*.jsx|*.mjs|*.cjs|*.json|*.jsonc|*.css) ;;
*) exit 0 ;;
esac

cd "$CLAUDE_PROJECT_DIR" || exit 0
pnpm exec biome check --write "$file" >/dev/null 2>&1 || true
exit 0
34 changes: 34 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
{
"permissions": {
"allow": [
"Bash(pnpm build:*)",
"Bash(pnpm test:*)",
"Bash(pnpm test)",
"Bash(pnpm check)",
"Bash(pnpm check:fix)",
"Bash(pnpm lint:*)",
"Bash(pnpm format:*)",
"Bash(pnpm typecheck)",
"Bash(pnpm -r typecheck)",
"Bash(pnpm docs:build)",
"Bash(pnpm exec biome:*)",
"Bash(pnpm exec tsc:*)",
"Bash(npx appkit:*)",
"Bash(git status:*)",
"Bash(git diff:*)",
"Bash(git log:*)",
"Bash(git show:*)",
"Bash(git add:*)"
]
},
"hooks": {
"SessionStart": [
{
Expand All @@ -11,6 +33,18 @@
}
]
}
],
"PostToolUse": [
{
"matcher": "Edit|Write|MultiEdit",
"hooks": [
{
"type": "command",
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/biome-format.sh\"",
"timeout": 60
}
]
}
]
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ coverage
.databricks

.claude/scheduled_tasks.lock
.claude/worktrees/
Loading