Defining tasks
A task is a [tasks.<name>] table. It runs shell commands, a Rhai script, or a
WASM plugin — exactly one of run / script / wasm.
[tasks.fmt]
desc = "Format and lint"
run = ["cargo fmt", "cargo clippy --fix --allow-dirty"]
Dependencies
[tasks.check]
desc = "Full check pipeline"
depends = ["fmt", "lint", "test"] # run these first
Dependencies form a DAG; yatr runs each task as soon as its dependencies finish
(a ready-queue scheduler), bounded by --parallel.
Parallel commands
[tasks.lint]
parallel = true
run = ["cargo fmt --check", "cargo clippy -- -D warnings", "cargo doc --no-deps"]
Environment, working dir, shell
[env] # global
RUST_LOG = "debug"
[tasks.migrate]
cwd = "./backend"
env = { DATABASE_URL = "postgres://localhost/dev" }
shell = true
run = ["diesel migration run"]
Long-running processes
[tasks.dev]
foreground = true # inherit stdio; not cached
run = ["cargo watch -x run"]
Full task reference
| Field | Meaning |
|---|---|
desc | Human description |
run / script / wasm | What to execute (mutually exclusive) |
depends | Tasks to run first |
parallel | Run run commands concurrently |
env, cwd, shell | Environment, working dir, shell mode |
foreground | Inherit stdio (dev servers); not cached |
sources, outputs | Caching inputs/outputs |
watch | File patterns for yatr watch |
no_cache, allow_failure, timeout | Per-task behaviour |