.PHONY: install test build publish clean lint format help

# Default target
help:
	@echo "Comfy Client - Makefile Commands"
	@echo ""
	@echo "  make install    - Install dependencies with uv"
	@echo "  make test       - Run tests with pytest"
	@echo "  make lint       - Run ruff linter"
	@echo "  make format     - Format code with ruff"
	@echo "  make build      - Build package with hatch"
	@echo "  make publish    - Publish to PyPI with hatch"
	@echo "  make clean      - Clean build artifacts"
	@echo ""

# Install dependencies
install:
	uv sync
	uv sync --dev

# Run tests
test:
	uv run pytest tests/ -v --tb=short

# Run tests with coverage
test-cov:
	uv run pytest tests/ -v --cov=src/comfy_client --cov-report=term-missing

# Lint code
lint:
	uv run ruff check src/ tests/

# Format code
format:
	uv run ruff format src/ tests/

# Build package
build:
	hatch build

# Publish to PyPI
publish: build
	hatch publish

# Clean build artifacts
clean:
	rm -rf dist/
	rm -rf build/
	rm -rf *.egg-info/
	rm -rf .pytest_cache/
	rm -rf .ruff_cache/
	find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
	find . -type f -name "*.pyc" -delete 2>/dev/null || true

# Development setup
dev: install
	@echo "Development environment ready!"
	@echo "Run 'uv run comfy --help' to see available commands."
