-
Notifications
You must be signed in to change notification settings - Fork 0
Filtering
CommitBrief applies three filter layers, in order, to decide which files reach the LLM:
- Built-in ignore patterns — hardcoded into the binary.
-
.commitbriefignore— repo-local gitignore-syntax overlay. -
--file/--dirpath filters from the command line.
Later layers can override earlier ones (negate patterns in
.commitbriefignore, narrow the path scope on the CLI).
Always applied, applied first. The pattern set is hardcoded in the
binary at internal/ignore/builtin.go. As of v1.0.0 the list is:
# Lock files
*.lock
package-lock.json
yarn.lock
pnpm-lock.yaml
Cargo.lock
Gemfile.lock
composer.lock
poetry.lock
Pipfile.lock
go.sum
# Vendored / third-party
vendor/**
node_modules/**
Pods/**
third_party/**
# Generated code
*.pb.go
*_pb2.py
*_pb2_grpc.py
*_generated.go
*.gen.go
*.gen.ts
*.gen.js
# Mocks
**/mocks/**
*_mock.go
*.mock.ts
# Build artifacts
dist/**
build/**
target/**
bin/**
out/**
coverage/**
coverage.out
*.test
# CommitBrief cache (avoid recursive review of cached entries)
.commitbrief/cache/**
# Editor / IDE detritus
.idea/**
.vscode/**
*.swp
*~
.DS_Store
Thumbs.db
# Minified / map files
*.min.js
*.min.css
*.map
# Binaries
*.png
*.jpg
*.jpeg
*.gif
*.ico
*.pdf
*.zip
*.tar.gz
*.tgz
These patterns exist for the obvious reasons: lock files churn but have no review value, vendored code is not yours to review, generated artefacts are noise, etc.
Drop a .commitbriefignore file at the repo root for project-specific
rules. Gitignore syntax — * glob, ** recursive, leading ! to
re-include a previously-excluded path.
# Skip our migration files — they are reviewed in the PR description.
db/migrations/**
# But DO review the schema definition (re-include after the bulk exclude).
!db/migrations/schema.sql
# Exclude generated docs.
docs/api/generated/**A ! re-inclusion can also override a built-in pattern. If your
project genuinely needs review on, say, vendor/-style code that
is not actually vendored:
!vendor/**That works because the built-in vendor/** runs first, but the
.commitbriefignore layer applies on top and can negate it.
Repeatable CLI flags. Applied after both ignore layers, so they narrow whatever made it past steps 1 and 2.
# Review only these specific files (must already pass the ignore layers).
commitbrief --staged --file src/main.go --file src/util.go
# Review only files under these directories.
commitbrief --unstaged --dir database/seeder --dir app/ModelsBehavior:
-
--filematches a file path exactly (the diff'sb/path relative to repo root). -
--dirmatches any file whose path begins with the given directory plus a slash. - Both can be repeated. Multiple instances are union'd — a file matching any one of them is kept.
- They combine:
--file foo.go --dir handlers/keepsfoo.goAND everything underhandlers/.
Use commitbrief dry-run to see exactly how many files each layer
removes:
Files (input): 12
built-in ignore filtered: 3
.commitbriefignore net filtered: 1
--file/--dir path filter: 2
Files (review): 6
See Dry-run command for the full report.
Two other layers run before the LLM call but are not filters in the sense above:
- The
.commitbrief/guard (ADR-0007) prompts/aborts on a diff that touches files under.commitbrief/. It does not silently remove them. - The secret scanner looks for credential patterns and prompts/aborts but does not remove flagged lines.
See Secret scanner and Review command §"Pre-send guards" for details.