#!/usr/bin/env bash # Formats each file Claude writes, so diffs stay clean without asking Claude to run Prettier. set -euo pipefail file=$(jq -r '.tool_input.file_path // empty') if [ -z "$file" ] || [ ! -f "$file" ]; then exit 0; fi case "$file" in *.ts | *.tsx | *.js | *.jsx | *.json | *.css | *.md | *.mdx | *.yml | *.yaml) cd "$CLAUDE_PROJECT_DIR" npx --no-install prettier --write --log-level warn "$file" || true ;; esac exit 0