T-020: Enhance scan — depth, ignore, and patterns #123
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
--depth N: Controls scan depth (0=root only, unlimited by default)pathlib.Path.rglobfor efficient file discoveryPattern-Based Filtering
--ignore PATTERN: Excludes files/directories matching glob patterns (repeatable)--ignoreflagsGitignore Integration
--respect-gitignore: Honors .gitignore rules when scanning!pattern)File Sampling
files_sample: Always present in JSON output with stable ordering--show N: Configurable number of sample files per language (default: 5)🔧 API Changes
Enhanced
collect_evidence()FunctionJSON Schema Updates
files_sample: Array of sample file paths (always present)🧪 Testing
Comprehensive Test Coverage
test_scan_enhanced_golden.py(5 tests for golden file validation)test_scan_gitignore.py(6 tests for gitignore functionality)Test Scenarios Covered
📚 Documentation
Updated Documentation
Usage Examples
✅ Acceptance Criteria
All acceptance criteria from issue #110 are met:
🔄 Manual Test Results
All manual tests from the issue pass:
depth=0→ python onlydepth=2→ python,nodeignore pattern excludes subdir→ python onlyfiles_sample length reflects --show→ correct length.gitignore scenario→ python only (respects gitignore)files_sample always present in JSON→ true🚦 Breaking Changes
None - This is a fully backward-compatible enhancement:
files_samplefield but preserves all existing fields🔗 Related
Closes #110
Ready for review - All tests passing, documentation updated, and acceptance criteria met.