.PHONY: check test fix format all setup docs docs-serve smoke release

check:
	uv run ruff check phonemenal/ tests/
	uv run ruff format --check phonemenal/ tests/

fix:
	uv run ruff check --fix phonemenal/ tests/

format:
	uv run ruff format phonemenal/ tests/

test:
	uv run pytest -v

setup:
	uv run python -c "import nltk; nltk.download('cmudict', quiet=True)"

docs:
	uv run --group docs mkdocs build --strict

docs-serve:
	uv run --group docs mkdocs serve

smoke:
	uv build
	uv run --isolated --with dist/phonemenal-*.whl python tests/smoke.py

all: fix format test


release:
	@test -n "$(VERSION)" || (echo "Usage: make release VERSION=x.y.z" && exit 1)
	@grep -q 'version = "$(VERSION)"' pyproject.toml || \
		(echo "pyproject.toml version != $(VERSION) — bump it first" && exit 1)
	@grep -q '__version__ = "$(VERSION)"' phonemenal/__init__.py || \
		(echo "phonemenal/__init__.py version != $(VERSION) — bump it first" && exit 1)
	git tag v$(VERSION)
	git push origin v$(VERSION)