Add claude-code-spring module: CLAUDE.md, a path-scoped rule, two skills, four hooks run against real hook JSON, project .mcp.json from the claude mcp CLI, and tests that lint the setup on Spring Boot 4.2.0

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b86yyhhudsSLnwNUFY
This commit is contained in:
Ankur Mhatre
2026-11-22 02:05:35 +05:30
co-authored by Claude Sonnet 5.5
parent a620d91d0a
commit 3aa20a1dce
40 changed files with 1175 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
#!/bin/bash
# Times the same PreToolUse deny rule written as bash + jq and as a JDK 25 compact source file.
# Indicative only: the numbers change with the machine and with what else is running.
MODULE="$(cd "$(dirname "$0")/.." && pwd)"
OUT="$MODULE/output/07-hook-latency.txt"
JSON='{"hook_event_name":"PreToolUse","tool_name":"Bash","tool_input":{"command":"mvn deploy"}}'
N=20
time_ms() { # time_ms <label> <command...> -> average wall milliseconds over N runs
local label="$1"; shift
local start end
start=$(date +%s%N)
for _ in $(seq $N); do echo "$JSON" | "$@" >/dev/null 2>&1; done
end=$(date +%s%N)
printf '%-34s %6d ms per call (average of %d)\n' "$label" $(( (end - start) / N / 1000000 )) $N
}
{
echo "java: $(java -version 2>&1 | grep -m1 'openjdk version')"
echo "jq : $(jq --version)"
time_ms "guard-bash.sh (bash + jq)" "$MODULE/.claude/hooks/guard-bash.sh"
time_ms "java GuardBash.java (source launcher)" java "$MODULE/.claude/hooks/GuardBash.java"
echo
echo "both produce the same decision:"
echo "$JSON" | "$MODULE/.claude/hooks/guard-bash.sh" | jq -r '.hookSpecificOutput.permissionDecision'
echo "$JSON" | java "$MODULE/.claude/hooks/GuardBash.java" 2>/dev/null | jq -r '.hookSpecificOutput.permissionDecision'
} > "$OUT"
cat "$OUT"