mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-03-20 09:06:38 +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.
14 lines
422 B
Bash
Executable File
14 lines
422 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Async Bats runner: run matching test file when a script is edited.
|
|
# Runs in background (async: true) — output appears on next turn.
|
|
|
|
fp=$(jq -r '.tool_input.file_path // empty')
|
|
[ -z "$fp" ] && exit 0
|
|
|
|
name=$(basename "$fp")
|
|
test_file="$CLAUDE_PROJECT_DIR/tests/${name}.bats"
|
|
[ ! -f "$test_file" ] && exit 0
|
|
|
|
echo "Running $test_file ..."
|
|
"$CLAUDE_PROJECT_DIR/node_modules/.bin/bats" "$test_file"
|