Build Test Run
btr is a Rust CLI for running project-defined commands from a hidden project config file.
What It Does
Each project contains a .btr.toml file that defines how to build, test, run, lint, analyze, and execute other named commands. The CLI discovers that file automatically and executes the configured command for the action you choose.
Commands
Config File
Create a .btr.toml file at the root of your project:
[]
= "example"
= "."
[]
= "info"
= ".env.ci"
[]
= { = "cargo", = ["build"] }
= { = "cargo", = ["test"] }
= { = "cargo", = ["run"] }
= { = "cargo", = ["clippy", "--all-targets", "--all-features", "--", "-D", "warnings"] }
= { = "cargo", = ["doc"], = "docs" }
= { = "cargo", = ["check"], = 60 }
Behavior
- Finds
.btr.tomlin the current directory or a parent directory - Merges parent
.btr.tomlfiles with child overrides - Runs the matching command for
build,test, orrun - Runs the matching command for
build,test,run, ordev - Supports named commands via
btr exec <name> - Forwards extra arguments after
-- - Validates config with
btr validate - Supports
--strictforvalidateanddoctor - Strict validation checks PATH availability, env files, and placeholder
runcommands - Generates a starter config with
btr init --template <name> - Supports interactive prompts with
btr init --interactive - Detects common project types with
btr init --detect - Imports common project files with
btr init --import btr init --detect --interactiveuses the detected template as the default prompt- Prints starter configs with
btr init --print - Interactive init can add template-specific optional commands and safe structured-only mode
- Lists starter templates with
btr templatesorbtr init --list-templates - Prints a JSON schema for
.btr.tomlwithbtr schema - Supports custom template files or directories with
btr init --template-file <path> - Interactive init can add optional command stubs and enable safe structured-only mode
- Starter templates include rust, node, pnpm, yarn, bun, deno, nextjs, vite, turbo, nx, python, django, fastapi, flask, poetry, hatch, pixi, uv, go, cargo-workspace, java-gradle, java-maven, kotlin-gradle, dotnet, php-composer, ruby-bundler, rails, laravel, terraform, helm, docker-compose, cmake, cmake-ninja, and generic
- Starter templates now include short descriptions in the template catalog
- Lists commands and descriptions with
btr list - Shows resolved config with
btr which, including config chain and selected profile - Inspects a command with
btr show <name>and shows source provenance - Shows command inheritance and pipeline trees with
btr show --tree <name> - Explains a command with
btr explain <name>and shows source provenance - JSON output now uses a stable envelope with
statusandcommand - Supports
--workspace <path>to run from a nested project root - Runs multiple named commands concurrently with
btr parallel <name>... - Supports workspace concurrency with
btr workspace --jobs <n> - Supports workspace failure policies with
--fail-fastand--keep-going - Supports workspace ordering with
--order name - Supports workspace filtering with project tags via
--tag <tag> - Supports
btr watchfor repeated execution on file changes - Supports
[requirements]for required tools, files, and env vars - Supports
[trust].shell_commandsto explicitly allow shell-based commands - Supports
--json-eventsfor streaming orchestration progress to stderr - Supports
--log-dirfor saving command output to files - Supports pipeline commands with
steps = ["fmt", "lint", "test"] - Prefixes workspace and parallel output with the project or command name
- Prints failure summaries with exit code, target, and duration
- Prints end-of-run summaries for run, workspace, parallel, dry-run, and release
- Checks for missing commands and PATH issues with
btr doctor btr doctorsuggests fixes for missing PATH tools and env filesbtr doctor --fixcreates missing configured env files when possiblebtr show --sourceprints an explicit provenance trace for config resolution- Supports
--dry-runfor execution commands - Supports per-command
cwdandtimeout - Uses the configured project root when provided
- Passes config environment variables to the child process
- Streams command output directly to the terminal
- Supports
extendsfor derived commands that inherit arguments and environment by default - Supports
args_mode = "replace"andenv_mode = "replace"for derived commands - Supports profile overlays via
BTR_PROFILE - Supports
--profile <name>to select a profile explicitly - Supports
env_file = ".env.ci"for named env files - Supports
windowsandunixcommand overrides - Supports
--safeto reject shell-string commands - Warns when the project has no explicit name
- Loads a project-root
.envfile - Supports
retrieson commands - Supports
workspaceto discover and run commands across projects - Supports
workspace --name <project>to filter discovered projects by project name - Supports
workspace --changed-onlyto limit execution to changed projects - Supports
workspace --changed-only --since <ref>to choose the git base - Supports
packageto create local release archives - Supports
releaseto run build/test and then package - Supports
completionsandmanpagegeneration
Development
Build and test the project with:
Install the CLI locally with:
Installer options:
--root <dir>to install into a custom Cargo root--debugto install a debug build--forceto reinstall an existing binary--no-lockto skip lockfile enforcement--checkto verify prerequisites only--install-completions <dir>to write shell completions--install-manpage <dir>to write the manpage
Documentation
SPEC.mddescribes the project in detailEXAMPLES.mdcontains ready-to-use config examples
Example Projects
- Rust:
cargo build,cargo test,cargo run - Node:
npm run build,npm test,npm start - Python:
python -m build,pytest,python main.py - CMake:
cmake -S . -B build,ctest --test-dir build,./build/native-app
Common Extensions
- Lint:
btr exec lint - Analysis:
btr exec analyze - CI:
btr exec ci - Format:
btr fmt - Clean:
btr clean - CI alias:
btr ci