tauri_path := "src-tauri"

# Launch the desktop app with hot reload
[group('dev')]
dev:
    pnpm tauri dev

# Produce a release bundle
[group('dev')]
build:
    pnpm tauri build

# Run the Rust unit tests
[group('test')]
test:
    cd {{tauri_path}} && cargo test --lib -- --test-threads=1

# Run the end-to-end solver tests
[group('test')]
test-integration:
    cd {{tauri_path}} && cargo test --test integration -- --test-threads=1 --nocapture

# Run the full suite in release mode
[group('test')]
test-all:
    cd {{tauri_path}} && cargo test --release

# Benchmark the parallel search (criterion)
[group('test')]
bench:
    cd {{tauri_path}} && cargo bench

# Measure coverage via cargo-llvm-cov
[group('test')]
cov:
    cd {{tauri_path}} && cargo llvm-cov run

# Run mutation testing via cargo-mutants
[group('test')]
mutants:
    cd {{tauri_path}} && cargo mutants

# Format frontend (prettier) + backend (cargo fmt)
[group('quality')]
fmt:
    pnpm prettier --write "**/*.svelte" "**/*.ts"
    cd {{tauri_path}} && cargo fmt

# Lint the backend (cargo clippy)
[group('quality')]
lint:
    cd {{tauri_path}} && cargo clippy

# Remove node_modules and cargo build artifacts
[group('misc')]
clean:
    rm -rf node_modules
    cd {{tauri_path}} && cargo clean
