.PHONY: fmt check lint install build run clean help

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}'

install:  ## Install all dependencies including dev dependencies
	uv sync --all-extras

fmt:  ## Format code with ruff
	uv run ruff format proxy/ apps/ scripts/
	uv run ruff check --fix proxy/ apps/ scripts/

check:  ## Check code formatting without making changes
	uv run ruff format --check proxy/ apps/ scripts/
	uv run ruff check proxy/ apps/ scripts/

lint:  ## Run linting checks (alias for check)
	$(MAKE) check

build:  ## Build Docker image
	docker build -t streamline-gateway .

run:  ## Run Docker container
	docker run -p 8080:8080 streamline-gateway

dev:  ## Run locally for development
	uv run python scripts/start.py

clean:  ## Clean up cache and temporary files
	find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
	find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true
	find . -type d -name ".ruff_cache" -exec rm -rf {} + 2>/dev/null || true
	find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
