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
@@ -0,0 +1,15 @@
// The same deny rules as guard-bash.sh, written as a JDK 25 compact source file (JEP 512, final in 25).
// Run by the hook as: java ${CLAUDE_PROJECT_DIR}/.claude/hooks/GuardBash.java
// It exists to measure what a JVM hook costs next to bash + jq. It does not parse JSON properly.
void main() throws Exception {
String in = new String(System.in.readAllBytes());
var m = java.util.regex.Pattern.compile("\"command\"\\s*:\\s*\"((?:[^\"\\\\]|\\\\.)*)\"").matcher(in);
String cmd = m.find() ? m.group(1) : "";
String reason = null;
if (cmd.contains("mvn deploy") || cmd.contains("mvn release:")) reason = "Publishing artifacts is a human decision.";
else if (cmd.contains("git push --force") || cmd.contains("git push -f")) reason = "Force-pushing is blocked in this project.";
else if (cmd.contains("rm -rf")) reason = "rm -rf is blocked.";
if (reason != null) {
System.out.println("{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"deny\",\"permissionDecisionReason\":\"" + reason + "\"}}");
}
}