# Makefile for Xiaohongshu MCP Python
.PHONY: help setup install run dev test clean docker-build docker-up docker-down docker-logs format lint
help: ## Show this help message
@echo "Available commands:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
setup: ## Setup development environment
@bash setup.sh
install: ## Install dependencies
pip install -r requirements.txt
playwright install chromium
run: ## Run the server
python main.py
dev: ## Run the server in development mode (non-headless)
HEADLESS=false python main.py
test: ## Run tests
pytest tests/ -v
clean: ## Clean up generated files
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
find . -type f -name "*.pyo" -delete
find . -type d -name "*.egg-info" -exec rm -rf {} +
rm -rf .pytest_cache
rm -rf dist build
docker-build: ## Build Docker image
docker-compose build
docker-up: ## Start Docker containers
docker-compose up -d
docker-down: ## Stop Docker containers
docker-compose down
docker-logs: ## View Docker logs
docker-compose logs -f
format: ## Format code with black and isort
black .
isort .
lint: ## Lint code with flake8
flake8 . --max-line-length=100 --exclude=venv,__pycache__,.git