set dotenv-load

# Run the server (reads .env)
run:
    cargo run -p server

# Build the web SPA + run the server in release mode with the SPA embedded (served at /)
run-release:
    # build.rs embeds web/dist, so the frontend must be built first
    cd web && pnpm build
    cargo run -p server --release --features embed-web

# Seed the baseline Spectrum cataloguing vocabularies + field definitions (idempotent)
seed:
    cargo run -p server -- seed

# Run the full test suite via cargo-nextest (per-test isolation, live output,
# hang timeouts). nextest does not run doctests, so they run separately.
test:
    cargo nextest run --workspace
    cargo test --workspace --doc

# Format with the nightly toolchain
fmt:
    cargo +nightly fmt

# Lint, treating warnings as errors
lint:
    cargo clippy --workspace --all-targets -- -D warnings

# Run Storybook (web component explorer) on http://localhost:6006
storybook:
    cd web && pnpm storybook

# Format, lint, and test
check: fmt lint test
