feat: initial commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
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)
|
||||
@@ -0,0 +1,12 @@
|
||||
import json, sys
|
||||
|
||||
tool_input = json.loads(sys.stdin.read())
|
||||
command = tool_input.get("tool_input", {}).get("command", "")
|
||||
|
||||
BLOCKED = ["rm -rf /", "dd if=", "mkfs", ":(){:|:&};:"]
|
||||
for blocked in BLOCKED:
|
||||
if blocked in command:
|
||||
print(f"BLOCKED: Gefährlicher Befehl erkannt: {blocked}", file=sys.stderr)
|
||||
sys.exit(2) # Exit-Code 2 = Operation blockiert
|
||||
|
||||
sys.exit(0)
|
||||
Reference in New Issue
Block a user