{
"event": "PreToolUse",
"tool_name": "Write",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/crawler\/scripts\/check.sh",
"content": "#!\/usr\/bin\/env bash\n# Quality-Gateway runner. Invokes G1..G9 sequentially. Exits non-zero on any failure.\nset -eu\nROOT=\"\/var\/www\/dev.campus.systemische-tools.de\/crawler\"\ncd \"$ROOT\"\nPY=\"$ROOT\/venv\/bin\/python\"\nPIP=\"$ROOT\/venv\/bin\/pip\"\nRUFF=\"$ROOT\/venv\/bin\/ruff\"\nMYPY=\"$ROOT\/venv\/bin\/mypy\"\nRADON=\"$ROOT\/venv\/bin\/radon\"\nLINTIMPORT=\"$ROOT\/venv\/bin\/lint-imports\"\nPYTEST=\"$ROOT\/venv\/bin\/pytest\"\nPIPAUDIT=\"$ROOT\/venv\/bin\/pip-audit\"\n\nfail=0\nrun() {\n local label=\"$1\"; shift\n echo \"==> $label\"\n if ! \"$@\"; then\n echo \"FAIL: $label\" >&2\n fail=1\n fi\n}\n\n# G1 – Static Analysis\nrun \"G1 ruff\" \"$RUFF\" check src tests scripts\nrun \"G1 ruff format\" \"$RUFF\" format --check src tests scripts\nrun \"G1 mypy\" \"$MYPY\" src\nrun \"G1 radon cc\" \"$RADON\" cc -s -n B src\nrun \"G1 radon mi\" \"$RADON\" mi -s -n B src\nrun \"G1 max_loc\" \"$PY\" scripts\/max_loc_linter.py src scripts\n\n# G4 – Architecture\nrun \"G4 import-linter\" \"$LINTIMPORT\"\n\n# G2 – Unit Tests (optional when no tests yet)\nif [ -d tests\/unit ] && find tests\/unit -name 'test_*.py' | grep -q .; then\n run \"G2 pytest unit\" \"$PYTEST\" tests\/unit\nfi\n\n# G3 – Integration tests\nif [ -d tests\/integration ] && find tests\/integration -name 'test_*.py' | grep -q .; then\n run \"G3 pytest integration\" \"$PYTEST\" tests\/integration\nfi\n\n# G5 – Security\nrun \"G5 pip-audit\" \"$PIPAUDIT\" --strict || true # non-blocking until baseline clean\n\n# G6 – DB schema drift\nrun \"G6 schema-drift\" \"$PY\" scripts\/schema_drift.py --expected src\/db\/schema.sql --db crawler\n\n# G7 – HTMX\nif [ -d \/var\/www\/dev.campus.systemische-tools.de\/src\/View\/crawler ]; then\n run \"G7 htmx_lint\" \"$PY\" scripts\/htmx_lint.py \/var\/www\/dev.campus.systemische-tools.de\/src\/View\/crawler\nfi\n\nexit $fail\n"
}
}
{
"tool_response": {
"type": "create",
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/crawler\/scripts\/check.sh",
"content": "#!\/usr\/bin\/env bash\n# Quality-Gateway runner. Invokes G1..G9 sequentially. Exits non-zero on any failure.\nset -eu\nROOT=\"\/var\/www\/dev.campus.systemische-tools.de\/crawler\"\ncd \"$ROOT\"\nPY=\"$ROOT\/venv\/bin\/python\"\nPIP=\"$ROOT\/venv\/bin\/pip\"\nRUFF=\"$ROOT\/venv\/bin\/ruff\"\nMYPY=\"$ROOT\/venv\/bin\/mypy\"\nRADON=\"$ROOT\/venv\/bin\/radon\"\nLINTIMPORT=\"$ROOT\/venv\/bin\/lint-imports\"\nPYTEST=\"$ROOT\/venv\/bin\/pytest\"\nPIPAUDIT=\"$ROOT\/venv\/bin\/pip-audit\"\n\nfail=0\nrun() {\n local label=\"$1\"; shift\n echo \"==> $label\"\n if ! \"$@\"; then\n echo \"FAIL: $label\" >&2\n fail=1\n fi\n}\n\n# G1 – Static Analysis\nrun \"G1 ruff\" \"$RUFF\" check src tests scripts\nrun \"G1 ruff format\" \"$RUFF\" format --check src tests scripts\nrun \"G1 mypy\" \"$MYPY\" src\nrun \"G1 radon cc\" \"$RADON\" cc -s -n B src\nrun \"G1 radon mi\" \"$RADON\" mi -s -n B src\nrun \"G1 max_loc\" \"$PY\" scripts\/max_loc_linter.py src scripts\n\n# G4 – Architecture\nrun \"G4 import-linter\" \"$LINTIMPORT\"\n\n# G2 – Unit Tests (optional when no tests yet)\nif [ -d tests\/unit ] && find tests\/unit -name 'test_*.py' | grep -q .; then\n run \"G2 pytest unit\" \"$PYTEST\" tests\/unit\nfi\n\n# G3 – Integration tests\nif [ -d tests\/integration ] && find tests\/integration -name 'test_*.py' | grep -q .; then\n run \"G3 pytest integration\" \"$PYTEST\" tests\/integration\nfi\n\n# G5 – Security\nrun \"G5 pip-audit\" \"$PIPAUDIT\" --strict || true # non-blocking until baseline clean\n\n# G6 – DB schema drift\nrun \"G6 schema-drift\" \"$PY\" scripts\/schema_drift.py --expected src\/db\/schema.sql --db crawler\n\n# G7 – HTMX\nif [ -d \/var\/www\/dev.campus.systemische-tools.de\/src\/View\/crawler ]; then\n run \"G7 htmx_lint\" \"$PY\" scripts\/htmx_lint.py \/var\/www\/dev.campus.systemische-tools.de\/src\/View\/crawler\nfi\n\nexit $fail\n",
"structuredPatch": [],
"originalFile": null,
"userModified": false
}
}