set dotenv-load := true

# Default recipe - list all available recipes
list:
    @just --list

# Run tests with an optional pytest marker expression. State-changing tests are opt-in.
test marker="":
    #!/usr/bin/env bash
    selected_marker="{{marker}}"
    selected_marker="${selected_marker#marker=}"
    if [ -n "$selected_marker" ]; then
        uv run pytest -v -m "$selected_marker"
    else
        uv run pytest -v -m "not orders and not mutating"
    fi

# Analyze the codebase using cloc, excluding certain directories
cloc:
    @cloc . --vcs=git --exclude-dir=products,tests

# Build the package distribution
build:
    @echo "Building package..."
    rm -rf dist
    uv build

# Publish the package to PyPI using UV, with the token provided in the environment variable
publish:
    @echo "Publishing package to PyPI..."
    uv publish --token $UV_PUBLISH_TOKEN
