-
Notifications
You must be signed in to change notification settings - Fork 73
Description
Feature Request: Add ignore patterns support for stats command
Problem
Currently, git-ai stats includes all files when calculating AI vs human code statistics, including:
- Lock files (package-lock.json, Cargo.lock, go.sum, etc.)
- Minified/bundled files (*.min.js, *.bundle.js)
- Generated code (protobuf files, GraphQL generated files, etc.)
- Build artifacts that are committed to repos
This makes statistics inaccurate because these files are auto-generated and shouldn't count towards "real coding work".
Proposed Solution
Add support for ignoring file patterns in stats calculations, with three configuration levels:
1. CLI flag (highest priority)
git-ai stats --ignore "*.lock" "*.min.js" "dist/**"
git-ai stats HEAD --ignore "*.generated.*"2. Project-level config (team shared)
Create .git-ai-ignore in repository root (gitignore syntax):
# Lock files
*.lock
go.sum
# Build artifacts
*.min.js
*.bundle.js
# Generated code
*.generated.*
*_pb.go
3. Global config (user defaults)
In ~/.git-ai/config.json:
{
"stats_ignore_patterns": [
"*.lock",
"*.min.js",
"*.generated.*"
]
}All three levels merge together (additive).
Use Cases
Monorepo with multiple languages: Each team can define their own .git-ai-ignore committed to the repo.
Personal preferences: Users can set global defaults without modifying each project.
Ad-hoc filtering: Quick one-off stats with --ignore flag.
Implementation Notes
The ignore logic should:
- Only affect
git-ai statscommand (not checkpoint, blame, diff) - Use glob pattern matching (like .gitignore)
- Skip entire files from statistics (both AI and human lines)
- Work with both
stats <commit>andstats <range>modes
Benefits
✅ More accurate AI/human code ratio
✅ Exclude noise from lock files and generated code
✅ Team consistency via committed .git-ai-ignore
✅ Flexible: global defaults + per-project overrides
Example
Before:
$ git-ai stats HEAD
you ████████░░░░░░░░░░░░ ai
65% 35%
# Includes 5000 lines from package-lock.jsonAfter:
$ git-ai stats HEAD
you ████████████████░░░░ ai
80% 20%
# package-lock.json excluded via .git-ai-ignoreWould this be a useful addition to git-ai?