mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-03-20 19:06:50 +00:00
Replace inline command strings in settings.json with external scripts in .claude/hooks/ for readability and maintainability. Consolidate three PostToolUse formatters into one script and add markdown/yaml formatting. Add new hooks: SessionStart context banner, Stop lint gate, async Bats test runner, idle desktop notification, and PostToolUseFailure logger.
24 lines
636 B
Bash
Executable File
24 lines
636 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Pre-edit guard: block vendor/lock files and secrets.d real fish files.
|
|
# Receives tool input JSON on stdin.
|
|
|
|
fp=$(jq -r '.tool_input.file_path // empty')
|
|
[ -z "$fp" ] && exit 0
|
|
|
|
case "$fp" in
|
|
*/fzf-tmux | */yarn.lock | */.yarn/*)
|
|
echo "BLOCKED: $fp is a vendor/lock file — do not edit directly" >&2
|
|
exit 2
|
|
;;
|
|
*/secrets.d/*.fish)
|
|
case "$(basename "$fp")" in
|
|
*.example.fish | *.fish.example) exit 0 ;;
|
|
esac
|
|
echo "BLOCKED: do not edit $fp directly — it is gitignored." >&2
|
|
echo "Copy the matching .fish.example file and edit that locally." >&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
|
|
exit 0
|