#!/usr/bin/env bash
# Strip Inkscape editor metadata from staged SVG files before committing.
# Install: git config core.hooksPath .githooks

set -e

mapfile -t staged < <(git diff --cached --name-only --diff-filter=ACM | grep -E '\.svg$' || true)
[ ${#staged[@]} -eq 0 ] && exit 0

echo "[inkflow] cleaning staged SVGs..."
uv run inkflow clean "${staged[@]}"

git add "${staged[@]}"
