cargo-dirty
A cargo subcommand that runs a user-provided Cargo command and prints a minimal summary of what was recompiled.
By default it does not forward Cargo's own output (no Fresh ... spam, no build script warnings). Instead, it:
- Streams only crates that actually did work (compile/check/build)
- Prints a final summary line (time + counts)
Install
With Cargo:
With Homebrew:
Prebuilt archives are also available from GitHub Releases.
From a local checkout:
Usage
Run your normal cargo command via cargo dirty:
Stream in a more deterministic order (adds --jobs=1 to Cargo unless you already set jobs):
Show fresh crates too:
Explain why the rebuild happened — the root change that started the cascade, plus every crate downstream of it and the reason each was invalidated:
Enable deep fingerprint tracing (best-effort; mainly useful for debugging). On its own it only
collects Cargo's fingerprint trace; combined with --explain it adds per-crate detail: lines
explaining which fingerprint comparison failed:
Run a different Cargo binary (defaults to cargo from PATH):
Print the version:
Flags
| Flag | Effect |
|---|---|
--show-fresh |
Also list crates Cargo considered fresh |
--explain |
Print the culprit crate and the rebuild cascade it caused |
--deep |
Collect Cargo's fingerprint trace; enriches --explain with detail: lines |
--linear |
Add --jobs=1 so work is streamed in a deterministic order |
--cargo-path <PATH> |
Cargo binary to run |
--version |
Print the cargo-dirty version |
Everything that is not one of these flags is forwarded to Cargo verbatim, including arguments
after a -- separator, which reach the built binary untouched.
Notes
- On success, output is intentionally terse.
- On failure, compiler errors are printed (from Cargo JSON messages); if Cargo failed without producing any, Cargo's own stderr is shown instead.
- Invalidation reasons are best-effort from Cargo
-vvstatus lines (e.g.Dirty ...: ...).
Limitations
- Reasons and counts come entirely from Cargo's
-vvoutput. They are best-effort: Cargo may declare a crate dirty that then does no separately reported work, sodirtyandworkcounts need not agree. --quiet/-qcannot be used. cargo-dirty injects-vv, and Cargo refuses to run with both; cargo-dirty warns before Cargo rejects the invocation.- Output of
cargo dirty runandcargo dirty testis forwarded as-is, interleaved line-wise with cargo-dirty's own status lines. --explainnames a likely root cause inferred from reason text. With two versions of the same crate in one build it declines to guess rather than risk misattribution.--deepdetail:lines are Cargo's internal fingerprint diagnostics reproduced verbatim. Their wording is not a stable interface and changes between Cargo releases; when a release changes it again, details go missing rather than becoming wrong.