[config]
default_to_workspace = false

# ─── Development ───

[tasks.check]
description = "Quick check (no tests)"
command = "cargo"
args = ["check", "--workspace"]

[tasks.test]
description = "Run unit + integration tests (shared test stack must already be running)"
command = "cargo"
args = ["test", "--workspace"]

[tasks.test-docker]
description = "Run tests with Docker validation (shared test stack must already be running)"
command = "cargo"
args = ["test", "--workspace", "--features", "validate-docker"]

[tasks.test-all]
description = "Run all test modes"
dependencies = ["test", "test-docker"]

# ─── Quality ───

[tasks.clippy]
description = "Run clippy linter"
command = "cargo"
args = ["clippy", "--workspace", "--", "-D", "warnings"]

[tasks.fmt]
description = "Format code"
command = "cargo"
args = ["fmt", "--all"]

[tasks.fmt-check]
description = "Check formatting"
command = "cargo"
args = ["fmt", "--all", "--check"]

[tasks.deny]
description = "License and supply chain check"
command = "cargo"
args = ["deny", "check", "advisories", "licenses", "sources"]

[tasks.lint]
description = "All quality checks: clippy + fmt + deny"
dependencies = ["clippy", "fmt-check", "deny"]

# ─── Benchmarks ───

[tasks.bench]
description = "Run Criterion benchmarks (delta + transforms)"
command = "cargo"
args = ["bench"]

[tasks.bench-baseline]
description = "Save benchmark baseline (run before optimizations)"
command = "cargo"
args = ["bench", "--", "--save-baseline", "before"]

[tasks.bench-compare]
description = "Compare against saved baseline"
command = "cargo"
args = ["bench", "--", "--baseline", "before"]

[tasks.bench-parallel]
description = "Run benchmarks with parallel hashing feature"
command = "cargo"
args = ["bench", "--features", "parallel"]

# ─── Coverage ───

[tasks.coverage]
clear = true
description = "Run tests with coverage (shared test stack must already be running)"
command = "cargo"
args = ["llvm-cov", "--workspace", "--features", "validate-docker", "--lcov", "--output-path", "lcov.info"]

[tasks.coverage-html]
description = "Generate HTML coverage report"
command = "cargo"
args = ["llvm-cov", "--workspace", "--html"]

# ─── CI (what GitHub Actions runs) ───

[tasks.ci]
description = "Full CI pipeline: fmt + clippy + coverage (tests included)"
dependencies = ["fmt-check", "clippy", "coverage"]
env = { "RUSTFLAGS" = "-D warnings" }

[tasks.stress]
description = "Run stress tests (ignored by default, used in release CI)"
command = "cargo"
args = ["test", "--workspace", "--features", "validate-docker", "--", "--ignored"]

[tasks.throughput]
description = "Run query-level throughput harness (shared test stack must already be running)"
command = "cargo"
args = ["test", "--test", "throughput_benchmark_tests", "throughput_parallel_queries_three_wave_harness", "--", "--ignored", "--exact", "--nocapture"]

[tasks.cluster-soak]
description = "Run rolling-restart cluster soak harness (shared test stack must already be running)"
command = "cargo"
args = ["test", "--test", "scheduler_tests", "scheduler_rolling_restart_soak_campaign", "--", "--ignored", "--exact", "--nocapture"]

[tasks.test-stack-up]
description = "Start the shared Docker test stack"
command = "docker"
args = ["compose", "-f", "tests/stack/docker-compose.yml", "up", "-d"]

[tasks.test-stack-wait]
description = "Wait until the shared Docker test stack is ready"
command = "bash"
args = ["tests/stack/wait.sh"]

[tasks.test-stack-down]
description = "Stop the shared Docker test stack"
command = "docker"
args = ["compose", "-f", "tests/stack/docker-compose.yml", "down", "-v", "--remove-orphans"]

# ─── CLI ───

[tasks.cli]
description = "Build CLI tool"
command = "cargo"
args = ["build", "--features", "cli"]

[tasks.cli-release]
description = "Build CLI tool (release)"
command = "cargo"
args = ["build", "--release", "--features", "cli"]

# ─── Publish ───

[tasks.publish-dry]
description = "Dry-run publish to crates.io"
command = "cargo"
args = ["publish", "--dry-run"]

[tasks.publish]
description = "Publish to crates.io"
command = "cargo"
args = ["publish"]
