# Default serial port/device for the badge (used when live-testing before a release).
device := "/dev/ttyACM0"

# List available recipes
default:
    @just --list

# Lint and check formatting (uses the ruff/black on PATH, not uvx-fetched latest)
lint:
    ruff check .
    black --check .

# Auto-fix formatting
fmt:
    black .

# Build the sdist + wheel into dist/
build:
    rm -rf dist
    uv build

# Install the built wheel into a throwaway venv and smoke-test the entry point
test-install: build
    rm -rf /tmp/tildagon-cli-test-install
    uv venv /tmp/tildagon-cli-test-install --quiet
    uv pip install --python /tmp/tildagon-cli-test-install/bin/python dist/*.whl
    /tmp/tildagon-cli-test-install/bin/tildagon --help
    /tmp/tildagon-cli-test-install/bin/mpremote --version

# Dry-run release checks: version bump validity against Codeberg + PyPI, no changes made
release-check:
    uv run tools/release.py --dry-run

# Tag, push, create a Codeberg release, and publish to PyPI (needs CODEBERG_TOKEN + UV_PUBLISH_TOKEN)
release: lint test-install
    uv run tools/release.py
