Feat: Introduce .indexerignore
for flexible project specific file exclusion
#21
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.
Introduces support for a
.indexerignore
file, allowing users to have fine-grained control over which files and directories are excluded from the indexing process. This feature uses the samegitwildmatch
patterns as.gitignore
, providing a familiar and powerful way to customize file discovery.Problem Solved:
Different projects have unique needs for what should be included in a code index. While the default exclusion list is a good starting point, it cannot cover all use cases. Projects may contain large build artifacts, generated code, or other files that are not relevant for code analysis and can slow down indexing. The
.indexerignore
file provides a simple and standard way for developers to exclude these project-specific files.Implementation Details:
.indexerignore
Support:ProjectScanner
insrc/code_index_mcp/indexing/scanner.py
now checks for a.indexerignore
file in the project's root directory.pathspec
to parse the file and exclude any matching files and directories from the scan.Debugging with Optional Logging:
.indexerignore
rules, theset_project_path
tool has been updated with a new optional boolean parameter:generate_log_file
.generate_log_file
is set totrue
, a.indexer.log
file is created in the project root. This log details which files and directories were included or excluded during the scan, making it easy to verify that the ignore patterns are working as expected.How to Use:
Create a
.indexerignore
file in the root of your project.Add glob patterns for files and directories you wish to exclude, just like a
.gitignore
file. For example:To debug your ignore patterns, call the
set_project_path
tool withgenerate_log_file
set totrue
: