We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/beverage/levelang-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
pre-commit•2.03 KiB
#!/bin/bash
# Git pre-commit hook for Levelang MCP Server
# Automatically fixes linting issues and formats code before commit
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
print_status() {
echo -e "${BLUE}[PRE-COMMIT]${NC} $1"
}
print_success() {
echo -e "${GREEN}✅ $1${NC}"
}
print_warning() {
echo -e "${YELLOW}⚠️ $1${NC}"
}
print_error() {
echo -e "${RED}❌ $1${NC}"
}
# Check if uv is available
if ! command -v uv &> /dev/null; then
print_error "uv not found. Please install uv: https://docs.astral.sh/uv/"
exit 1
fi
# Run auto-fixing linting (safe fixes only)
print_status "Running automatic linting fixes..."
if ! uv run ruff check --fix src/ tests/; then
print_error "Linting fixes failed. Please review the output above."
exit 1
fi
print_success "Linting fixes completed"
# Run code formatting
print_status "Running code formatting..."
if ! uv run ruff format src/ tests/; then
print_error "Code formatting failed. Please review the output above."
exit 1
fi
print_success "Code formatting completed"
# Check if any files were modified by the fixes
if git diff --cached --quiet; then
print_success "No changes needed - code is already clean"
else
print_warning "Code was automatically fixed and formatted"
print_status "Staging the automatically fixed files..."
cached_files=$(git diff --cached --name-only)
for file in $cached_files; do
if [ -f "$file" ]; then
git add "$file"
print_status "Re-staged: $file"
fi
done
print_success "Automatically fixed files have been re-staged"
echo ""
print_warning "Your code was automatically modified and re-staged for commit"
print_status "The following changes were made:"
echo " • Linting issues fixed (safe fixes)"
echo " • Code formatted according to project standards"
echo ""
print_status "You can review the changes with: git diff --cached"
fi
print_success "Pre-commit checks completed!"
exit 0