Review and strengthen the Package.swift parsing and folder pattern matching logic for edge cases.
Current Strengths
- Good fallback mechanism: Package.swift → folder patterns → project name
- Intelligent longest-path matching for nested structures
- Handles test filtering well
Improvements Needed
Following patterns from SwiftPackageScripts:
-
Explicit Validation
- Validate simulator/path availability before processing (like their get_latest_simulator)
- Check that extracted target names are valid (not empty, not test-like)
- Return clear error codes on validation failure
-
Edge Cases to Handle
- Deeply nested directory structures (>3 levels)
- Symlinks in source paths
- Non-standard Package.swift formats
- Unicode characters in target names
- Targets with similar path prefixes (ensure longest match wins consistently)
-
Fallback Robustness
- Better logging of which detection method succeeded (currently done, but could be clearer)
- Explicit error when no valid targets detected
- Handle malformed jq output gracefully
-
Test Coverage
- Document expected patterns for file paths
- Add examples of edge cases handled
Review and strengthen the Package.swift parsing and folder pattern matching logic for edge cases.
Current Strengths
Improvements Needed
Following patterns from SwiftPackageScripts:
Explicit Validation
Edge Cases to Handle
Fallback Robustness
Test Coverage