-
-
Notifications
You must be signed in to change notification settings - Fork 269
feat: add .cgrignore file support for custom exclude patterns #219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add support for a `.cgrignore` file that allows users to specify additional directories to exclude from parsing. Patterns from this file are merged with `--exclude` CLI flags and auto-detected directories. - Add `load_cgrignore_patterns()` function in config.py - Integrate with `prompt_exclude_directories()` in main.py - Add EXCLUDE_STATUS_CGRIGNORE constant for UI display - Add tests for .cgrignore loading - Update README with documentation
Summary of ChangesHello @jxstanford, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant enhancement to the directory exclusion mechanism by implementing support for a Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces support for a .cgrignore file, allowing users to specify custom directories to exclude from parsing. The implementation is clean and follows the project's patterns. The changes are well-documented in the README and thoroughly tested with new unit tests. I have one minor suggestion regarding the placement of an import statement in codebase_rag/config.py to improve consistency. Overall, this is a great addition to the project.
Greptile SummaryThis PR adds support for a Key Changes
Issues Found
Strengths
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant CLI
participant main.py
participant config.py
participant FileSystem
participant UI
User->>CLI: Run with --exclude flags
CLI->>main.py: prompt_exclude_directories(repo_path, cli_excludes)
main.py->>main.py: detect_root_excludable_directories(repo_path)
Note over main.py: Auto-detect common dirs<br/>(node_modules, .git, etc)
main.py->>config.py: load_cgrignore_patterns(repo_path)
config.py->>FileSystem: Check .cgrignore exists
alt .cgrignore exists
FileSystem-->>config.py: File found
config.py->>FileSystem: Read file contents
FileSystem-->>config.py: File contents
config.py->>config.py: Parse lines (strip, filter comments/blanks)
config.py->>config.py: Add to set, convert to frozenset
config.py-->>main.py: frozenset of patterns
else .cgrignore missing
FileSystem-->>config.py: File not found
config.py-->>main.py: empty frozenset
end
main.py->>main.py: Merge: cli_patterns | cgrignore_patterns
main.py->>main.py: Merge with detected: all_candidates = detected | pre_excluded
alt skip_prompt = True
main.py-->>CLI: Return all_candidates
else Interactive mode
main.py->>UI: Display table with sources<br/>(CLI, .cgrignore, auto-detected)
UI->>User: Prompt for selection
User-->>UI: Response (all/none/numbers)
UI-->>main.py: Selected patterns
main.py-->>CLI: frozenset of excluded dirs
end
CLI->>CLI: Use excluded dirs in parsing
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (3)
-
codebase_rag/config.py, line 251 (link)style: hardcoded log message violates coding standards - should be in
logs.pyasCGRIGNORE_LOADEDAgentic Framework
- PydanticAI Only: This project uses PydanticAI... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Context Used: Rule from
dashboard- ## Technical Requirements -
codebase_rag/config.py, line 254 (link)style: hardcoded log message violates coding standards - should be in
logs.pyasCGRIGNORE_READ_FAILEDAgentic Framework
- PydanticAI Only: This project uses PydanticAI... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Context Used: Rule from
dashboard- ## Technical Requirements -
codebase_rag/config.py, line 236 (link)style: import at function scope is acceptable but against project standards - loguru should be imported at module level
Consider moving to top of file with other imports
Agentic Framework
- PydanticAI Only: This project uses PydanticAI... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Context Used: Rule from
dashboard- ## Technical Requirements
5 files reviewed, 3 comments
Addresses PR review feedback: - Move loguru import to module level in config.py - Use log constants from logs.py instead of f-strings
|
I thought you might find this useful. Here's what ended up in my |
Summary
Add support for a
.cgrignorefile that allows users to specify additional directories to exclude from parsing, similar to.gitignorebut simpler..cgrignoreare merged with--excludeCLI flags and auto-detected directories#comments, blank lines ignoredChanges
codebase_rag/config.py: Addload_cgrignore_patterns()function andCGRIGNORE_FILENAMEconstantcodebase_rag/main.py: Integrate.cgrignoreloading intoprompt_exclude_directories()codebase_rag/constants.py: AddEXCLUDE_STATUS_CGRIGNOREfor UI displaycodebase_rag/tests/test_cgrignore.py: Add 6 unit testsREADME.md: Document the featureExample
.cgrignoreTest plan
pytest codebase_rag/tests/test_cgrignore.py).cgrignorefile in a repository