CLI reference
This page is generated from trimtest --help (version 0.1.1).
See also exit codes and trimtest.toml.
trimtest
Section titled “trimtest”Run only the tests a change can reach, across languages.
Usage: trimtest [OPTIONS] <COMMAND>
Commands: check Validate trimtest.toml and report what would be detected init Create trimtest.toml and ignore .trimtest/ schema Print the JSON Schema of trimtest.toml (for editors and agents) detect List detected test projects and how many tests each tracks record Record the current tree as the baseline (optionally after a full green run) select Print the tests affected by the current changes run Select, then run the affected tests with each project's native runner explain Say why a test was (or was not) selected in the last run help Print this message or the help of the given subcommand(s)
Options: --root <ROOT> Repository root (default: current directory) --verbose Print more: the changed files and per-test timing --quiet Print less: only the summary lines -h, --help Print help -V, --version Print versiontrimtest check
Section titled “trimtest check”Validate trimtest.toml and report what would be detected
Usage: trimtest check [OPTIONS]
Options: --root <ROOT> Repository root (default: current directory) --verbose Print more: the changed files and per-test timing --quiet Print less: only the summary lines -h, --help Print helptrimtest init
Section titled “trimtest init”Create trimtest.toml and ignore .trimtest/
Usage: trimtest init [OPTIONS]
Options: --root <ROOT> Repository root (default: current directory) --verbose Print more: the changed files and per-test timing --quiet Print less: only the summary lines -h, --help Print helptrimtest schema
Section titled “trimtest schema”Print the JSON Schema of trimtest.toml (for editors and agents)
Usage: trimtest schema [OPTIONS]
Options: --root <ROOT> Repository root (default: current directory) --verbose Print more: the changed files and per-test timing --quiet Print less: only the summary lines -h, --help Print helptrimtest detect
Section titled “trimtest detect”List detected test projects and how many tests each tracks
Usage: trimtest detect [OPTIONS]
Options: --root <ROOT> Repository root (default: current directory) --verbose Print more: the changed files and per-test timing --quiet Print less: only the summary lines -h, --help Print helptrimtest record
Section titled “trimtest record”Record the current tree as the baseline (optionally after a full green run)
Usage: trimtest record [OPTIONS]
Options: --root <ROOT> Repository root (default: current directory) --run Run the full test suites first and only record when they pass --coverage Also measure what each test executes (per-test coverage) for precise selection. Implies running every test unit individually; fails if any test fails --verbose Print more: the changed files and per-test timing --lenient With --coverage: keep going when a test unit fails when run alone (order-dependent tests, for example). Those units are not measured and keep using the static graph --quiet Print less: only the summary lines --remeasure Measure every test again instead of keeping recordings that are still valid --update-if-green Run the affected tests first and re-record only if they all pass --timeout <SECONDS> Kill a runner command (and everything it started) after this many seconds. A test whose measurement times out is not recorded and keeps using the static graph. Overrides `timeout` in trimtest.toml; 0 means no limit -h, --help Print helptrimtest select
Section titled “trimtest select”Print the tests affected by the current changes
Usage: trimtest select [OPTIONS]
Options: --base <BASE> Compare against a git ref instead of the recorded map
--root <ROOT> Repository root (default: current directory)
--full Select everything
--verbose Print more: the changed files and per-test timing
--json
--quiet Print less: only the summary lines
--paths Print only test paths, one per line (for scripting)
--tier <TIER> Possible values: - auto: Use recorded coverage where a valid recording exists, else the static graph - static: Ignore recordings; import graph only
[default: auto]
--format <FORMAT> Possible values: - text - json - github: Append `any`, `count` and a `matrix` of {adapter, cwd, command} to `$GITHUB_OUTPUT` (and print the text form)
[default: text]
--exit-code Exit 1 when any test is selected; else 3 when the selection is uncertain (a selected test cannot be run, or a changed file is not known to affect any test); else 0. Like `git diff --exit-code`
--project <PROJECT> Only these projects (substring of the name shown by `detect`, e.g. `pytest@api`); repeatable
--shard <SHARD> Run only shard `i` of `n` (e.g. `2/4`): selected tests are split by a stable hash of their path
--strict Run everything when a changed file is not known to affect any test (also `on_unobserved = "full"`)
-h, --help Print help (see a summary with '-h')trimtest run
Section titled “trimtest run”Select, then run the affected tests with each project's native runner
Usage: trimtest run [OPTIONS]
Options: --base <BASE>
--root <ROOT> Repository root (default: current directory)
--full
--verbose Print more: the changed files and per-test timing
--dry-run Print the commands without running them
--quiet Print less: only the summary lines
--timeout <SECONDS> Kill a runner command after this many seconds, with everything it started; its tests count as failed. Overrides `timeout` in trimtest.toml; 0 means no limit
--total-timeout <SECONDS> Stop the whole run after this many seconds: the command in flight is killed, the rest are not started, and their tests count as failed. Overrides `total_timeout`; 0 means no limit
--tier <TIER> Possible values: - auto: Use recorded coverage where a valid recording exists, else the static graph - static: Ignore recordings; import graph only
[default: auto]
--project <PROJECT> Only these projects (substring of the name shown by `detect`, e.g. `pytest@api`); repeatable
--shard <SHARD> Run only shard `i` of `n` (e.g. `2/4`): selected tests are split by a stable hash of their path
--strict Run everything when a changed file is not known to affect any test (also `on_unobserved = "full"`)
-h, --help Print help (see a summary with '-h')trimtest explain
Section titled “trimtest explain”Say why a test was (or was not) selected in the last run
Usage: trimtest explain [OPTIONS] <TEST>
Arguments: <TEST>
Options: --root <ROOT> Repository root (default: current directory) --verbose Print more: the changed files and per-test timing --quiet Print less: only the summary lines -h, --help Print help