Skip to content

Commit 3de3b91

Browse files
chore: simplify settings.json hooks
- Single PostToolUse: per-file checkstyle only (removed redundant compile hook, removed PreToolUse generated-code hook, removed macOS Stop notification) - Per-file checkstyle via -Dcheckstyle.includes=<relative-path> for speed - permissions.deny handles generated/ protection natively Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent 5f17686 commit 3de3b91

1 file changed

Lines changed: 1 addition & 31 deletions

File tree

.claude/settings.json

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,7 @@
66
"hooks": [
77
{
88
"type": "command",
9-
"command": "python3 -c \"\nimport sys, json, subprocess\nd = json.load(sys.stdin)\nf = d.get('tool_input', {}).get('file_path', d.get('file_path', ''))\nif f and f.endswith('.java') and 'generated' not in f:\n r = subprocess.run(['mvn', 'checkstyle:check', '-q'], capture_output=True, text=True)\n out = (r.stdout + r.stderr).strip()\n if out:\n lines = out.splitlines()\n print('\\n'.join(lines[-20:]))\n\""
10-
}
11-
]
12-
},
13-
{
14-
"matcher": "Edit|Write",
15-
"hooks": [
16-
{
17-
"type": "command",
18-
"command": "python3 -c \"\nimport sys, json, subprocess\nd = json.load(sys.stdin)\nf = d.get('tool_input', {}).get('file_path', d.get('file_path', ''))\nif f and f.endswith('.java') and 'generated' not in f:\n r = subprocess.run(['mvn', 'compile', '-q'], capture_output=True, text=True)\n out = (r.stdout + r.stderr).strip()\n if out:\n lines = out.splitlines()\n print('\\n'.join(lines[-20:]))\n\""
19-
}
20-
]
21-
}
22-
],
23-
"PreToolUse": [
24-
{
25-
"matcher": "Edit|Write",
26-
"hooks": [
27-
{
28-
"type": "command",
29-
"command": "python3 -c \"import sys,json; d=json.load(sys.stdin); p=d.get('tool_input',{}).get('file_path',d.get('file_path','')); banned='generated'; (sys.stderr.write('BLOCKED: Fern-generated code — do not edit manually\\n'), sys.exit(2)) if banned in p and 'src/main/java/com/skyflow/generated' in p else sys.exit(0)\""
30-
}
31-
]
32-
}
33-
],
34-
"Stop": [
35-
{
36-
"hooks": [
37-
{
38-
"type": "command",
39-
"command": "osascript -e 'display notification \"Claude finished\" with title \"Claude Code\"' 2>/dev/null || true"
9+
"command": "python3 -c \"\nimport sys, json, subprocess\nd = json.load(sys.stdin)\nf = d.get('tool_input', {}).get('file_path', d.get('file_path', ''))\nif f and f.endswith('.java'):\n marker = 'src/main/java/'\n if marker in f:\n rel = f.split(marker, 1)[1]\n args = ['mvn', 'checkstyle:check', '-q', '-Dcheckstyle.includes=' + rel]\n else:\n args = ['mvn', 'checkstyle:check', '-q']\n r = subprocess.run(args, capture_output=True, text=True)\n out = (r.stdout + r.stderr).strip()\n if out:\n lines = out.splitlines()\n print('\\n'.join(lines[-20:]))\n\""
4010
}
4111
]
4212
}

0 commit comments

Comments
 (0)