set shell := ["sh", "-eu", "-c"]

# Show the common development commands.
default:
    @just --list

# Build a debug executable at target/debug/cor.
dev:
    env RUSTC_WRAPPER= cargo build --locked

# Build the optimized executable at target/release/cor.
release:
    env RUSTC_WRAPPER= cargo build --release --locked

# Run storage, sync, and CLI setup tests (includes localhost servers).
test:
    env RUSTC_WRAPPER= cargo test --locked

# Check formatting and Rust diagnostics.
check:
    cargo fmt --all --check
    env RUSTC_WRAPPER= cargo clippy --locked --all-targets -- -D warnings

# Build and run the installer interactively.
install: release
    ./target/release/cor install

# Test real interactive setup using the release build; needs a free port 8787.
e2e: release
    python3 tests/e2e_setup.py target/release/cor

# Exercise Docker checks, incremental compiler caches and automatic two-client repair.
checks-e2e: release
    python3 tests/e2e_checks.py target/release/cor

# Exercise sessions and native lifecycle hooks with two continuously running workers.
sessions-e2e: release
    python3 tests/e2e_sessions.py target/release/cor

# Verify OpenSSH interoperability and an encrypted key in an isolated ssh-agent.
ssh-e2e: release
    python3 tests/e2e_ssh.py target/release/cor

# Verify people, activity accounting, key revocation, and private browser dashboards.
team-e2e: release
    python3 tests/e2e_team.py target/release/cor

# Verify isolated repositories, discovery, workers, restart, and baselines on one SSH port.
repositories-e2e: release
    python3 tests/e2e_repositories.py target/release/cor

# Build the landing page and documentation into site/dist (Python 3.11+).
site-build:
    python3 site/build.py

# Preview the static website locally; rebuild after editing.
site: site-build
    python3 -m http.server 4173 --bind ::1 --directory site/dist

# Verify website links, search destinations, and source download.
site-check: site-build
    python3 site/check.py

# Verify jobs over SSH with two runners, fixed snapshots, caching, and artifacts.
jobs-e2e: release
    python3 tests/e2e_jobs.py target/release/cor

# Verify saved device identities without an agent after first login.
devices-e2e: release
    python3 tests/e2e_devices.py target/release/cor
