refactor(claude): migrate hooks to external scripts and add new hooks

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.
This commit is contained in:
2026-03-20 04:38:18 +02:00
parent 2b867c3348
commit cff83e4738
8 changed files with 173 additions and 5 deletions

14
.claude/hooks/log-failures.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
# PostToolUseFailure logger: append tool failures to a local log file.
log_file="$CLAUDE_PROJECT_DIR/.claude/hook-failures.log"
entry=$(jq -c '{
time: (now | strftime("%Y-%m-%dT%H:%M:%SZ")),
tool: .tool_name,
error: .error
}')
echo "$entry" >> "$log_file"
exit 0