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.
18 lines
529 B
Bash
Executable File
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
|