.PHONY: help build test test-cov publish publish-test clean install-dev nox lint format check pre-commit-install pre-commit-run

help:
	@echo "Available targets:"
	@echo "  build        - Build the package"
	@echo "  test         - Run tests"
	@echo "  test-cov     - Run tests with coverage"
	@echo "  nox          - Run nox for multi-version testing"
	@echo "  lint         - Run linting (ruff)"
	@echo "  format       - Format code (ruff)"
	@echo "  check        - Run all checks (lint + test)"
	@echo "  clean        - Clean build artifacts"
	@echo "  install-dev  - Install development dependencies"
	@echo "  pre-commit-install - Install pre-commit hooks"
	@echo "  pre-commit-run     - Run pre-commit on all files"
	@echo "  publish-test - Publish to TestPyPI"
	@echo "  publish      - Publish to PyPI (production)"

install-dev:
	uv sync --group dev

build: clean
	uv build

test:
	uv run pytest tests/ -v

test-cov:
	uv run pytest tests/ -v --cov=src/extract_soft_clipped --cov-report=html --cov-report=term

nox:
	uv run nox

lint:
	uv run ruff check src/ tests/

format:
	uv run ruff format src/ tests/

check: lint test

clean:
	rm -rf dist/
	rm -rf build/
	rm -rf *.egg-info/
	rm -rf .pytest_cache/
	rm -rf htmlcov/
	rm -rf .coverage
	find . -type d -name __pycache__ -delete
	find . -type f -name "*.pyc" -delete
	find . -type f -name "*~" -delete

publish-test: build
	uv publish --publish-url https://test.pypi.org/legacy/

publish: build
	uv publish

# Pre-commit hooks
pre-commit-install: install-dev
	uv run pre-commit install

pre-commit-run:
	uv run pre-commit run --all-files

# Complete development setup
dev: install-dev pre-commit-install format lint test
	@echo "Development setup complete!"
