.PHONY: test lint build release clean sync

# Ensure .venv has dev tools (pytest, ruff, …), not global mise shims.
sync:
	uv sync --quiet

test: sync
	uv run pytest --tb=short -q

lint: sync
	uv run ruff check src/

build: clean
	uv build

# Usage: make release V=0.4.0
release:
	@test -n "$(V)" || (echo "Usage: make release V=x.y.z" && exit 1)
	@echo "Releasing v$(V)..."
	sed -i '' 's/^version = .*/version = "$(V)"/' pyproject.toml
	git add pyproject.toml CHANGELOG.md
	git diff --cached --quiet || git commit -m "release: v$(V)"
	git tag -f "v$(V)"
	git push origin main --tags

clean:
	rm -rf dist/
