Skip to content

Dry run command

Muhammet Şafak edited this page Jul 26, 2026 · 4 revisions

Home / Commands / dry-run

commitbrief dry-run

Walk the review pipeline without making a provider call. Reports exactly what would be sent and how much it would cost. Use this to:

  • Verify your ignore/path filters before spending tokens.
  • Get a cost estimate for a large diff.
  • Inspect which provider/model/lang/cache-key the runtime resolved.
  • Debug "review found 0 changes" — see which layer removed them.

Synopsis

commitbrief dry-run [--staged|--unstaged] [global-flags...]

dry-run re-binds the same scope flags as the root command, so --staged (default) and --unstaged work the same way. Every filter applies: the --file / --dir allowlist, the --exclude-file / --exclude-dir denylist, and the commit filters (--author, --committer, --start-date, --end-date, --text). This makes dry-run the cheapest way to answer "did my filter select what I think it did?" — no provider call, no cost.

Output

Dry run — no provider call.
Origin:        staged
Files (input): 12
  built-in ignore filtered:        3
  .commitbriefignore net filtered: 1
  --file/--dir path filter:        2
  --exclude-file/--exclude-dir:    0
Files (review): 6
Added lines:   142
Deleted lines: 38
Provider:      anthropic
Model:         claude-opus-4-7
Lang:          en (source: default)
Rules source:  file (/repo/COMMITBRIEF.md)
Output source: default
Input tokens (est):  2105
Output tokens (est): 526
Context window:      200000
Cost estimate:       $0.0319
Cache key:           ab12cd34ef56...<64 hex>

Field semantics

Field Meaning
Origin staged / unstaged / diff / filtered — which diff source produced the input. filtered means a commit filter assembled it from per-commit patches.
Commits (walked) Commit-filtered runs only: how many commits the history walk inspected. A (walk limit reached…) note means older history was never looked at.
Commits (matched) Commit-filtered runs only: how many of them matched. A (truncated at --max-commits N) note means the review covers only the most recent matches.
Files (input) Files in the raw diff before any filter. On a commit-filtered run one path can be counted several times — once per commit that touched it.
built-in ignore filtered Files dropped by the built-in pattern set (lock files, vendor, etc.).
.commitbriefignore net filtered Files dropped by repo-local .commitbriefignore, net of any ! re-includes.
--file/--dir path filter Files dropped by the global --file / --dir allowlist.
--exclude-file/--exclude-dir Files dropped by the denylist, which runs after the allowlist.
Files (review) What actually goes into the prompt.
Added lines / Deleted lines Per-line counts on the surviving files.
Provider / Model / Lang Resolved active provider, model, and AI output language. Lang includes the resolution source (default / global config / repo config / cli flag).
Rules source Where COMMITBRIEF.md came from: file (with path) or default (embedded).
Output source Where OUTPUT.md template came from: file (with path) or default (embedded).
Input tokens (est) Estimated input tokens using the chars/4 heuristic.
Output tokens (est) Estimated output tokens (heuristic clamped to 200-1500).
Context window The model's reported context window. 0 when the provider could not be instantiated (e.g. missing credentials — does not fail dry-run; the rest of the report still prints).
Cost estimate Pricing.Cost({input, output}) for the resolved model. $0.0000 when the provider returns zero pricing (Ollama, CLI-tool-backed providers).
Cache key The full SHA-256 hex digest that would identify this review in the cache.

What dry-run does NOT do

  • It does not call the provider.
  • It does not run the secret scanner or cost preflight.
  • It does not write to the cache.
  • It does not produce findings.

It performs steps 1–7 of the pipeline (resolve → load rules → fetch diff → filter → build prompt → compute cache key), reports them, and exits.

Exit codes

Code Condition
0 Successful walk.
1 Hard error: cannot resolve context, cannot fetch diff, cannot read rules, malformed OUTPUT.md, etc. The same errors that would abort a real review.

Examples

# Standard dry-run on staged changes.
commitbrief dry-run

# Dry-run with all output destinations resolved.
commitbrief dry-run --unstaged --provider=gemini --model=gemini-2.5-pro

# Verify a path filter drops the noise you expect.
commitbrief dry-run --staged --dir cmd/

# Which commits would "Alice, last month" actually select?
commitbrief dry-run --author alice --start-date 2026-06-01 --end-date 2026-06-30

# Same, minus the test files — check the counts before paying for a review.
commitbrief dry-run --text payment --exclude-file '*_test.go'

# Use --json on dry-run? Not applicable — dry-run output is a fixed
# table for human review; for machine pipelines use `commitbrief
# config show` + `commitbrief --json` on a real run.

See also

  • Cost preflight — the real-run cost gate dry-run estimates.
  • Filtering — the ignore/path layers dry-run reports per file.
  • Cache — what the reported cache key identifies.
  • Review command — the full pipeline dry-run simulates.

Clone this wiki locally