# Install: brew install just  |  cargo install just  |  uv tool install rust-just
# Usage:   just <recipe>


# List available recipes
default:
    @just --list

# ── Usage ─────────────────────────────────────────────────────────────────────

# Generate the dashboard
dashboard:
    uv run vitalog dashboard -p all

# Load all data
load:
    uv run vitalog load all --apple ./data/export-20260326.zip --sleep ./data/sleepdata.csv


# ── Dependencies ──────────────────────────────────────────────────────────────

# Sync dependencies from lockfile
sync:
    uv sync --all-extras

# Update pre-commit hooks
update-hooks:
    uv run pre-commit autoupdate


# ── Code Quality ──────────────────────────────────────────────────────────────

# Run linter + formatter
lint:
    uv run ruff check .
    uv run ruff format .

# Run pre-commit hooks on all files
pre-commit:
    uv run pre-commit run --all-files

# Run tests
test:
    uv run pytest

# Run tests across all supported Python versions
test-all:
    uv run tox run-parallel

# Clean up Python build artifacts and caches
clean:
    find . -type d -name "__pycache__" -exec rm -rf {} +
    find . -type d -name ".pytest_cache" -exec rm -rf {} +
    find . -type d -name "dist" -exec rm -rf {} +
    find . -type d -name "build" -exec rm -rf {} +
    find . -type d -name "*.egg-info" -exec rm -rf {} +
    find . -type d -name ".ruff_cache" -exec rm -rf {} +
    find . -type d -name ".mypy_cache" -exec rm -rf {} +
    find . -type f -name "*.pyc" -exec rm -f {} +
    find . -type f -name "*.pyo" -exec rm -f {} +
    find . -type f -name ".coverage" -exec rm -rf {} +
    find . -type f -name "coverage.xml" -exec rm -rf {} +


# ── Versioning ────────────────────────────────────────────────────────────────

# List the current version
bump:
    uv run bump-my-version show-bump

# Bump patch version (e.g. 0.1.0 → 0.1.1)
bump-patch:
    uv run bump-my-version bump patch --no-commit --no-tag
    uv lock
    git add pyproject.toml src/vitalog/__main__.py uv.lock
    git commit -m "Bump version: $(uv run bump-my-version show current_version)"
    git tag "v$(uv run bump-my-version show current_version)"

# Bump minor version (e.g. 0.1.0 → 0.2.0)
bump-minor:
    uv run bump-my-version bump minor --no-commit --no-tag
    uv lock
    git add pyproject.toml src/vitalog/__main__.py uv.lock
    git commit -m "Bump version: $(uv run bump-my-version show current_version)"
    git tag "v$(uv run bump-my-version show current_version)"

# Bump major version (e.g. 0.1.0 → 1.0.0)
bump-major:
    uv run bump-my-version bump major --no-commit --no-tag
    uv lock
    git add pyproject.toml src/vitalog/__main__.py uv.lock
    git commit -m "Bump version: $(uv run bump-my-version show current_version)"
    git tag "v$(uv run bump-my-version show current_version)"
