feat: Introduce remove UnnecessaryTestable subcommand #5
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.
Remove Unnecessary @testable Imports & CLI Restructure
🎯 Overview
This PR introduces a major new feature to automatically detect and remove unnecessary
@testable importstatements from Swift test files, while also restructuring the CLI to use subcommands for better extensibility.🚨 Breaking Changes
CLI Structure Migration
--verboseis now a flag (no value required) instead of an option.swiftfindrefs --verbose trueswiftfindrefs search -vorswiftfindrefs search --verbose✨ New Features
Remove Unnecessary Testable Imports Subcommand
removeUnnecessaryTestableImports(alias:rmUTI)@testable importstatements that are no longer needed@testable)--excludeCompilationConditionalsflagExample usage:
swiftfindrefs removeUnnecessaryTestableImports --projectName MyApp --verbose --excludeCompilationConditionals # or using the alias: swiftfindrefs rmUTI -p MyApp -v --excludeCompilationConditionalsConditional Compilation Support
--excludeCompilationConditionalsflag to exclude@testable importstatements inside#if/#elseif/#else/#endifblocks⚡ Performance Improvements
Async/Await Migration
TaskGroupfor parallel processing of files and unitsURL.resourceBytes.linesfor efficient async file readingOptimizations
isPublicchecks), not upfrontTaskGroupPerformance impact: ~35% faster real-time execution and ~94% reduction in CPU time for large codebases.
📚 Documentation Updates
README
removeUnnecessaryTestableImportssubcommandAgent Skill Documentation
SKILL.mdwith new command structurecli.mdwith subcommand detailsworkflows.mdwith corrected examplestroubleshooting.mdwith new command format🔧 Technical Details
File System Operations
readLines(atPath:)method toFileSystemProviderURL.resourceBytes.linesfor efficient async readingreadFileandwriteFilemethods with comprehensive testsIndexStore Integration
IndexStoreProvidingprotocol with additional methodsUnitSnapshot,OccurrenceSnapshot) for thread-safe concurrent processing🎯 Migration Guide
For users upgrading from previous versions:
Update verbose flag:
Try the new feature: