T-020: Enhance scan — depth, ignore, and patterns#124
Merged
Conversation
Implements T-020: Enhance scan — depth, ignore, and patterns (#110) ## New Features - **Hierarchical scanning**: --depth N controls scan depth (0=root only, unlimited by default) - **Pattern filtering**: --ignore PATTERN excludes files/directories (repeatable) - **Gitignore integration**: --respect-gitignore honors .gitignore rules including negation patterns - **File sampling**: JSON output includes files_sample array (default 5, configurable with --show N) ## API Changes - Enhanced collect_evidence() with depth, ignore_patterns, respect_gitignore, show_files_sample parameters - files_sample field now always present in JSON output with stable ordering - Improved gitignore parsing with support for negation patterns (!pattern) ## Testing - Added comprehensive test suites for enhanced functionality - Created golden test files for different scan scenarios - All existing tests pass, maintaining backward compatibility - 62 scan-related tests covering all new features ## Documentation - Updated README.md with new options and usage examples - Enhanced CLI help text for all new flags - Added examples for depth control, filtering, and gitignore integration Fixes #110
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
This PR implements the enhanced scan functionality as described in issue #110, adding hierarchical scanning capabilities with depth control, pattern-based filtering, and gitignore integration.
🚀 New Features
Hierarchical Scanning
Pattern-Based Filtering
Gitignore Integration
File Sampling
🔧 API Changes
Enhanced `collect_evidence()` Function
```python
collect_evidence(
root: Path,
depth: Optional[int] = None, # 0=root only, None=unlimited
ignore_patterns: Optional[list[str]] = None, # Glob patterns to ignore
respect_gitignore: bool = False, # Honor .gitignore rules
show_files_sample: Optional[int] = None # Number of sample files
)
```
JSON Schema Updates
🧪 Testing
Comprehensive Test Coverage
Test Scenarios Covered
📚 Documentation
Updated Documentation
Usage Examples
```bash
Depth control
autorepro scan --depth 0 # Root only
autorepro scan --depth 2 # Up to 2 levels deep
Pattern filtering
autorepro scan --ignore 'node_modules/' --ignore 'dist/'
Gitignore integration
autorepro scan --respect-gitignore
File sampling
autorepro scan --json --show 3 # Up to 3 sample files per language
```
✅ Acceptance Criteria
All acceptance criteria from issue #110 are met:
🔄 Manual Test Results
All manual tests from the issue pass:
🚦 Breaking Changes
None - This is a fully backward-compatible enhancement:
🔗 Related
Closes #110
Ready for review - All tests passing, documentation updated, and acceptance criteria met.