#!/usr/bin/env bash
# Auto-fix Python files and re-stage changes.

staged_files=$(git diff --cached --name-only --diff-filter=ACM | grep '\.py$')
[ -z "$staged_files" ] && exit 0

uv run ruff check --fix $staged_files
uv run ruff format $staged_files

echo "$staged_files" | xargs git add

exit 0
