set dotenv-load

# Read version from pyproject.toml
version := `grep '^version' pyproject.toml | cut -d'"' -f2`

# Default: list available tasks
default:
    @just --list

# Lint and type-check
check:
    uvx ruff check . --fix && uvx ruff format .
    uvx ty check .

# Run tests with coverage
test:
    uv run pytest --cov --cov-report term-missing --cov-report json
    uv run cov-badge

# Merge dev into main and push
sync:
    git switch main
    git pull origin main
    git merge --ff-only dev
    git push -u origin main
    git switch dev

# Add version tag
tag:
    git switch main
    git tag -a v{{version}} -m 'v{{version}}'
    git push origin v{{version}}

# Publish to PyPI
publish:
    rm -r dist
    uv build
    uv publish --token $PYPI_TOKEN

# Tag and publish
release: tag publish
