{
"event": "PreToolUse",
"tool_name": "Write",
"tool_input": {
"file_path": "\/var\/www\/mcp-servers\/mcp-db\/run_tests.sh",
"content": "#!\/bin\/bash\n# Test Runner für MCP-DB Tests\n\nset -e\n\nMCP_DB_DIR=\"\/var\/www\/mcp-servers\/mcp-db\"\nVENV=\"$MCP_DB_DIR\/venv\"\n\ncd \"$MCP_DB_DIR\"\n\n# Colors\nGREEN='\\033[0;32m'\nYELLOW='\\033[1;33m'\nRED='\\033[0;31m'\nNC='\\033[0m'\n\necho \"=== MCP-DB Test Suite ===\"\necho \"\"\n\n# 1. Install test dependencies if needed\nif [ ! -f \"$VENV\/bin\/pytest\" ]; then\n echo -e \"${YELLOW}Installing test dependencies...${NC}\"\n \"$VENV\/bin\/pip\" install -r requirements-test.txt -q\n echo -e \"${GREEN}✓ Dependencies installed${NC}\"\n echo \"\"\nfi\n\n# 2. Run Ruff Linting\necho -e \"${YELLOW}[1\/4] Ruff - Linting${NC}\"\nif \"$VENV\/bin\/ruff\" check tests\/ --config ruff.toml 2>&1; then\n echo -e \"${GREEN}✓ Ruff: No linting errors${NC}\"\nelse\n echo -e \"${RED}✗ Ruff: Linting errors found${NC}\"\nfi\necho \"\"\n\n# 3. Run Ruff Formatting Check\necho -e \"${YELLOW}[2\/4] Ruff - Format Check${NC}\"\nif \"$VENV\/bin\/ruff\" format tests\/ --check --config ruff.toml 2>&1; then\n echo -e \"${GREEN}✓ Ruff: Formatting OK${NC}\"\nelse\n echo -e \"${RED}✗ Ruff: Formatting issues (run: ruff format tests\/)${NC}\"\nfi\necho \"\"\n\n# 4. Run mypy Type Checking\necho -e \"${YELLOW}[3\/4] mypy - Type Checking${NC}\"\nif \"$VENV\/bin\/mypy\" tests\/ --ignore-missing-imports --no-error-summary 2>&1 | head -20; then\n echo -e \"${GREEN}✓ mypy: Type check complete${NC}\"\nelse\n echo -e \"${YELLOW}⚠ mypy: Type hints missing (non-blocking)${NC}\"\nfi\necho \"\"\n\n# 5. Run pytest\necho -e \"${YELLOW}[4\/4] pytest - Running Tests${NC}\"\n\"$VENV\/bin\/pytest\" tests\/ -v\n\necho \"\"\necho -e \"${GREEN}=== All checks completed ===${NC}\"\n"
}
}
{
"tool_response": {
"type": "create",
"filePath": "\/var\/www\/mcp-servers\/mcp-db\/run_tests.sh",
"content": "#!\/bin\/bash\n# Test Runner für MCP-DB Tests\n\nset -e\n\nMCP_DB_DIR=\"\/var\/www\/mcp-servers\/mcp-db\"\nVENV=\"$MCP_DB_DIR\/venv\"\n\ncd \"$MCP_DB_DIR\"\n\n# Colors\nGREEN='\\033[0;32m'\nYELLOW='\\033[1;33m'\nRED='\\033[0;31m'\nNC='\\033[0m'\n\necho \"=== MCP-DB Test Suite ===\"\necho \"\"\n\n# 1. Install test dependencies if needed\nif [ ! -f \"$VENV\/bin\/pytest\" ]; then\n echo -e \"${YELLOW}Installing test dependencies...${NC}\"\n \"$VENV\/bin\/pip\" install -r requirements-test.txt -q\n echo -e \"${GREEN}✓ Dependencies installed${NC}\"\n echo \"\"\nfi\n\n# 2. Run Ruff Linting\necho -e \"${YELLOW}[1\/4] Ruff - Linting${NC}\"\nif \"$VENV\/bin\/ruff\" check tests\/ --config ruff.toml 2>&1; then\n echo -e \"${GREEN}✓ Ruff: No linting errors${NC}\"\nelse\n echo -e \"${RED}✗ Ruff: Linting errors found${NC}\"\nfi\necho \"\"\n\n# 3. Run Ruff Formatting Check\necho -e \"${YELLOW}[2\/4] Ruff - Format Check${NC}\"\nif \"$VENV\/bin\/ruff\" format tests\/ --check --config ruff.toml 2>&1; then\n echo -e \"${GREEN}✓ Ruff: Formatting OK${NC}\"\nelse\n echo -e \"${RED}✗ Ruff: Formatting issues (run: ruff format tests\/)${NC}\"\nfi\necho \"\"\n\n# 4. Run mypy Type Checking\necho -e \"${YELLOW}[3\/4] mypy - Type Checking${NC}\"\nif \"$VENV\/bin\/mypy\" tests\/ --ignore-missing-imports --no-error-summary 2>&1 | head -20; then\n echo -e \"${GREEN}✓ mypy: Type check complete${NC}\"\nelse\n echo -e \"${YELLOW}⚠ mypy: Type hints missing (non-blocking)${NC}\"\nfi\necho \"\"\n\n# 5. Run pytest\necho -e \"${YELLOW}[4\/4] pytest - Running Tests${NC}\"\n\"$VENV\/bin\/pytest\" tests\/ -v\n\necho \"\"\necho -e \"${GREEN}=== All checks completed ===${NC}\"\n",
"structuredPatch": [],
"originalFile": null
}
}