- New hooks/format-code.sh: reads file path from stdin JSON, dispatches by extension (*.py → uvx black, *.js/ts → prettier) - Updated settings.json: PostToolUse hook on Edit/Write/MultiEdit Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
13 lines
291 B
Bash
Executable File
13 lines
291 B
Bash
Executable File
#!/bin/bash
|
|
# Read tool input from stdin (JSON with tool_input.file_path)
|
|
FILE=$(jq -r '.tool_input.file_path // empty' 2>/dev/null)
|
|
|
|
[ -z "$FILE" ] && exit 0
|
|
|
|
case "$FILE" in
|
|
*.py)
|
|
uvx black --quiet "$FILE" ;;
|
|
*.js|*.ts|*.jsx|*.tsx)
|
|
prettier --write "$FILE" 2>/dev/null ;;
|
|
esac
|