.PHONY: help install-dev sync test test-cov check lint format type-check clean

help:
	@echo "Targets:"
	@echo "  install-dev  Sync dev + test deps"
	@echo "  test         Run unit tests"
	@echo "  test-cov     Run tests with coverage"
	@echo "  lint         Ruff lint"
	@echo "  format       Ruff format"
	@echo "  type-check   Mypy"
	@echo "  check        Lint + type-check"
	@echo "  clean        Remove caches + build artefacts"

install-dev:
	uv sync --group dev --group test

sync:
	uv sync --group dev --group test

test:
	uv run pytest tests/ -m "not manual" -v

test-cov:
	uv run pytest tests/ -m "not manual" --cov=src/stallari_adapter_framework --cov-report=term-missing -v

lint:
	uv run ruff check src/ tests/

format:
	uv run ruff format src/ tests/

type-check:
	uv run mypy src/stallari_adapter_framework

check: lint type-check
	@echo "All quality checks passed!"

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