feat: add --exclude / -x option to hide files from message generation#9
Merged
feat: add --exclude / -x option to hide files from message generation#9
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--exclude VALUE/-x VALUECLI 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.--include/-ioption (long form,=syntax, short form, clustering).Changes
internal/git/filter.go,filter_test.goExcludeFilesfield onOptions,containsFilehelper, exact-match check before pattern matchinginternal/app/app.goexcludeFilesthroughRun()→commitDiff()→git.Optionscmd/git-ai-commit/main.go,main_test.go--exclude/-xparsing, help text, 7 parsing testsUsage
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 outputTest plan
go test ./internal/git/...— filter layer tests (exact path, multiple, no-match, combined with patterns,containsFilehelper)go test ./cmd/git-ai-commit/...— CLI parsing tests (long,=form, short, multiple, missing value errors, clustered short flags)go test ./...— full suite passesmake build— binary compilesbin/git-ai-commit -x go.sum --debug-prompt