Skip to content

feat: add --exclude / -x option to hide files from message generation#9

Merged
takai merged 3 commits intomainfrom
feat/exclude-option
Feb 3, 2026
Merged

feat: add --exclude / -x option to hide files from message generation#9
takai merged 3 commits intomainfrom
feat/exclude-option

Conversation

@takai
Copy link
Owner

@takai takai commented Feb 3, 2026

Summary

  • Add --exclude VALUE / -x VALUE CLI option that removes specific files (by exact path) from the diff sent to the LLM engine. This only affects commit message generation — staged files are still committed normally.
  • Follows the same parsing conventions as the existing --include / -i option (long form, = syntax, short form, clustering).

Changes

Layer Files What
Filter internal/git/filter.go, filter_test.go ExcludeFiles field on Options, containsFile helper, exact-match check before pattern matching
App internal/app/app.go Thread excludeFiles through Run()commitDiff()git.Options
CLI cmd/git-ai-commit/main.go, main_test.go --exclude/-x parsing, help text, 7 parsing tests

Usage

git ai-commit --exclude go.sum
git ai-commit -x go.sum -x vendor/deps.go
git ai-commit --exclude=go.sum --debug-prompt   # verify with debug output

Test plan

  • go test ./internal/git/... — filter layer tests (exact path, multiple, no-match, combined with patterns, containsFile helper)
  • go test ./cmd/git-ai-commit/... — CLI parsing tests (long, = form, short, multiple, missing value errors, clustered short flags)
  • go test ./... — full suite passes
  • make build — binary compiles
  • Manual smoke test: bin/git-ai-commit -x go.sum --debug-prompt

takai added 3 commits February 3, 2026 19:43
Add ExcludeFiles field to Options for excluding files by exact path match, complementing the existing glob pattern-based exclusion. Implement containsFile helper for efficient exact-path matching and add comprehensive test coverage for single file, multiple files, no-match, and combined pattern scenarios.
@takai takai merged commit 38a584d into main Feb 3, 2026
1 check passed
@takai takai deleted the feat/exclude-option branch February 3, 2026 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant