Files
HartOMat/.claude/hooks/post_tool_use.py
T
2026-03-05 22:12:38 +01:00

21 lines
691 B
Python

import json, sys, subprocess
data = json.loads(sys.stdin.read())
# Nur nach Datei-Änderungen prüfen
if data.get("tool_name") in ["Write", "Edit"]:
results = []
# Tests
r = subprocess.run(["npm", "test", "--", "--passWithNoTests"], capture_output=True)
results.append(("Tests", r.returncode == 0))
# Linting
r = subprocess.run(["npm", "run", "lint"], capture_output=True)
results.append(("Lint", r.returncode == 0))
failed = [name for name, ok in results if not ok]
if failed:
print(f"⚠️ Quality Gate FAILED: {', '.join(failed)}", file=sys.stderr)
print("Bitte Fehler beheben bevor du fortfährst.", file=sys.stderr)