Files
crewli/.claude/hooks/post-edit-pint.sh
bert.hausmans f7ef26d450 chore(claude): add pint and eslint PostToolUse hooks
post-edit-pint.sh runs vendor/bin/pint --dirty from api/ after any
.php edit. post-edit-eslint.sh runs pnpm eslint --fix inside the
matching SPA dir for .vue/.ts/.tsx/.js files under apps/app/ or
apps/portal/. Both exit 0 unconditionally — formatting failures must
not block the agent.
2026-05-05 23:24:41 +02:00

18 lines
529 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
input="$(cat)"
path="$(echo "$input" | jq -r '.tool_input.file_path // .tool_input.path // empty')"
# No path or non-PHP — nothing to do.
[ -z "$path" ] && exit 0
[[ "$path" != *.php ]] && exit 0
# Laravel app lives in api/. Pint binary is at api/vendor/bin/pint.
cd "$CLAUDE_PROJECT_DIR/api" 2>/dev/null || exit 0
[ -x vendor/bin/pint ] || exit 0
# --dirty only formats files with git changes — fast even when called per-edit.
vendor/bin/pint --dirty >/dev/null 2>&1 || true
exit 0