-include .env
export

.PHONY: install test lint format typecheck ci clean tag

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

# Run tests
test:
	uv run pytest $(ARGS)

# Lint with ruff
lint:
	uv run ruff check src/ tests/
	uv run ruff format --check src/ tests/

# Format code
format:
	uv run ruff check --fix src/ tests/
	uv run ruff format src/ tests/

# Type check
typecheck:
	uv run basedpyright

# All CI checks
ci: lint typecheck test

# Tag a release from pyproject.toml version
tag:
	@VERSION=$$(python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])") && \
	git tag "v$$VERSION" && \
	echo "Tagged v$$VERSION"

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