default:
    @just --list

check:
    cargo check --workspace --all-targets --all-features

build:
    cargo build --workspace

build-release:
    cargo build --workspace --release

run:
    cargo run -p bone-app

test:
    cargo test --workspace --all-features

clippy:
    cargo clippy --workspace --all-targets --all-features -- -D warnings

snap:
    cargo insta test --workspace --all-features

snap-review:
    cargo insta review

snap-accept:
    cargo insta accept

fmt:
    cargo fmt --all

fmt-check:
    cargo fmt --all -- --check

lint: fmt-check clippy forbidden-deps

license:
    cargo deny check licenses bans

forbidden-deps:
    @if cargo tree -i lzma-sys >/dev/null 2>&1; then echo "forbidden FFI dependency in tree: lzma-sys" >&2; exit 1; fi
    @if cargo tree -i xz2 >/dev/null 2>&1; then echo "forbidden FFI dependency in tree: xz2" >&2; exit 1; fi
    @if cargo tree -i vtkio >/dev/null 2>&1; then echo "forbidden FFI dependency in tree: vtkio" >&2; exit 1; fi
    @echo "no forbidden FFI dependencies in the tree"

prove-determinism:
    @find crates -name '*.snap.new' -delete
    @echo "run 1 / 2 (debug)"
    CARGO_INCREMENTAL=0 INSTA_UPDATE=no cargo test --workspace --all-features --locked --quiet
    @if find crates -name '*.snap.new' -print -quit | grep -q .; then echo "snapshot drift in run 1" >&2; exit 1; fi
    @echo "run 2 / 2 (debug)"
    CARGO_INCREMENTAL=0 INSTA_UPDATE=no cargo test --workspace --all-features --locked --quiet
    @if find crates -name '*.snap.new' -print -quit | grep -q .; then echo "snapshot drift in run 2" >&2; exit 1; fi
    @echo "run 1 / 2 (release)"
    CARGO_INCREMENTAL=0 INSTA_UPDATE=no cargo test --workspace --all-features --locked --release --quiet
    @if find crates -name '*.snap.new' -print -quit | grep -q .; then echo "snapshot drift in release run 1" >&2; exit 1; fi
    @echo "run 2 / 2 (release)"
    CARGO_INCREMENTAL=0 INSTA_UPDATE=no cargo test --workspace --all-features --locked --release --quiet
    @if find crates -name '*.snap.new' -print -quit | grep -q .; then echo "snapshot drift in release run 2" >&2; exit 1; fi
    @echo "determinism: clean across two debug + two release runs"
