# Default command (list all commands)
default:
    @just --list

# Clean build artifacts
clean: clean-autosummary
    rm -rf build

# Clean autosummary build artifacts.
clean-autosummary:
    rm -f source/reference/_autosummary/*.rst

# Build docs
build builder="html" *OPTIONS="-W --keep-going":  # TODO: find a way to allow building on GPU
    JAX_PLATFORMS="cpu" CUDA_VISIBLE_DEVICES="" uv run --group docs sphinx-build -M {{ builder }} source build {{ OPTIONS }}

# Build docs in "draft" mode
draft *ARGS:
    NB_OFF="1" just build {{ ARGS }}

# Check links
linkcheck *ARGS: (draft "linkcheck" ARGS)

alias check := linkcheck
