{
"event": "PreToolUse",
"tool_name": "Bash",
"tool_input": {
"command": "cd \/var\/www\/tools\/ki-protokoll\/claude-hook\n\necho \"=== PYTHON TESTS ===\"\necho \"\"\n\n# Test 1: PP1.1 - Hardcoded Model (BLOCK)\necho \"Test 1: PP1.1 Hardcoded model default (should DENY)\"\necho '{\"tool_name\": \"Write\", \"tool_input\": {\"file_path\": \"\/var\/www\/scripts\/pipeline\/test.py\", \"content\": \"parser.add_argument(\\\"--model\\\", default=\\\"mistral\\\")\"}}' | python3 -u hook_dispatcher.py pre 2>&1 | grep -o '\"permissionDecision\": \"[^\"]*\"'\n\n# Test 2: PP1.1 - Config usage (ALLOW)\necho \"Test 2: PP1.1 Config usage (should ALLOW - no output)\"\necho '{\"tool_name\": \"Write\", \"tool_input\": {\"file_path\": \"\/var\/www\/scripts\/pipeline\/test.py\", \"content\": \"model = get_pipeline_model(\\\"text_semantic_analyze\\\")\"}}' | python3 -u hook_dispatcher.py pre 2>&1 | grep -o '\"permissionDecision\": \"[^\"]*\"' || echo \"(allowed - no output)\"\n\n# Test 3: PP1.1 - Constant (ALLOW)\necho \"Test 3: PP1.1 UPPER_CASE constant (should ALLOW)\"\necho '{\"tool_name\": \"Write\", \"tool_input\": {\"file_path\": \"\/var\/www\/scripts\/pipeline\/test.py\", \"content\": \"DEFAULT_MODEL = \\\"mistral\\\"\\nmodel = args.model or DEFAULT_MODEL\"}}' | python3 -u hook_dispatcher.py pre 2>&1 | grep -o '\"permissionDecision\": \"[^\"]*\"' || echo \"(allowed - no output)\"\n\n# Test 4: PP1.2 - Hardcoded pipeline_id (BLOCK)\necho \"Test 4: PP1.2 Hardcoded pipeline_id (should DENY)\"\necho '{\"tool_name\": \"Write\", \"tool_input\": {\"file_path\": \"\/var\/www\/scripts\/pipeline\/test.py\", \"content\": \"pipeline_id = 5\\nrun(pipeline_id)\"}}' | python3 -u hook_dispatcher.py pre 2>&1 | grep -o '\"permissionDecision\": \"[^\"]*\"'\n\n# Test 5: PP1.2 - Constant (ALLOW)\necho \"Test 5: PP1.2 DEFAULT_PIPELINE_ID constant (should ALLOW)\"\necho '{\"tool_name\": \"Write\", \"tool_input\": {\"file_path\": \"\/var\/www\/scripts\/pipeline\/test.py\", \"content\": \"DEFAULT_PIPELINE_ID = 5\\npipeline_id = args.pipeline_id\"}}' | python3 -u hook_dispatcher.py pre 2>&1 | grep -o '\"permissionDecision\": \"[^\"]*\"' || echo \"(allowed - no output)\"\n\n# Test 6: Skip venv (ALLOW)\necho \"Test 6: Skip venv path (should ALLOW)\"\necho '{\"tool_name\": \"Write\", \"tool_input\": {\"file_path\": \"\/var\/www\/scripts\/pipeline\/venv\/lib\/test.py\", \"content\": \"model = \\\"mistral\\\"\"}}' | python3 -u hook_dispatcher.py pre 2>&1 | grep -o '\"permissionDecision\": \"[^\"]*\"' || echo \"(allowed - no output)\"\n\necho \"\"\necho \"=== PHP TESTS (Sanity Check) ===\"\n\n# Test 7: PHP still gets checked\necho \"Test 7: PHP file (should DENY - P1.1 missing @responsibility)\"\necho '{\"tool_name\": \"Write\", \"tool_input\": {\"file_path\": \"\/var\/www\/dev.campus.systemische-tools.de\/src\/Controller\/Test.php\", \"content\": \"<?php\\nclass Test {}\"}}' | python3 -u hook_dispatcher.py pre 2>&1 | grep -o '\"permissionDecision\": \"[^\"]*\"'\n\necho \"\"\necho \"=== RESULTS ===\"\necho \"All tests passed if:\"\necho \" - Tests 1, 4, 7 = deny\"\necho \" - Tests 2, 3, 5, 6 = allowed (no output)\"",
"description": "Complete test matrix for hook"
}
}
{
"tool_response": {
"stdout": "=== PYTHON TESTS ===\n\nTest 1: PP1.1 Hardcoded model default (should DENY)\n\"permissionDecision\": \"deny\"\nTest 2: PP1.1 Config usage (should ALLOW - no output)\n(allowed - no output)\nTest 3: PP1.1 UPPER_CASE constant (should ALLOW)\n(allowed - no output)\nTest 4: PP1.2 Hardcoded pipeline_id (should DENY)\n\"permissionDecision\": \"deny\"\nTest 5: PP1.2 DEFAULT_PIPELINE_ID constant (should ALLOW)\n(allowed - no output)\nTest 6: Skip venv path (should ALLOW)\n(allowed - no output)\n\n=== PHP TESTS (Sanity Check) ===\nTest 7: PHP file (should DENY - P1.1 missing @responsibility)\n\"permissionDecision\": \"deny\"\n\n=== RESULTS ===\nAll tests passed if:\n - Tests 1, 4, 7 = deny\n - Tests 2, 3, 5, 6 = allowed (no output)",
"stderr": "",
"interrupted": false,
"isImage": false
}
}