Repository navigation
v1.1.29
[1.1.29] - 2025-11-01
Fixed
- Test Count Consistency: Corrected mismatched test counts in test.sh output
- Fixed "Suite 2/3: Scripts Tests" banner: 25 tests → 23 tests (correct)
- Fixed "Suite 3/3: Integration Tests" banner: 17 tests → 15 tests (correct)
- Updated line number references in maintainability comments (83, 146, 150)
- All test counts now consistent across header comment, suite banners, and summary output
- Eliminates confusion for contributors checking test suite status
Added
-
Enhanced Documentation Accuracy: Fixed outdated metrics and improved maintainability
- Updated PLAN.md with correct test counts (43 Swift tests, 81 total)
- Enhanced test.sh with comprehensive test suite breakdown comments
- Documents all 3 test suites: Swift (43), Scripts (23), Integration (15)
- Added maintenance notes for updating hardcoded counts
- Verified function length compliance: all <20 lines except validateFilePath (40 lines)
- Documented validateFilePath exception: 33/40 lines are user-facing error messages
- Improves documentation accuracy and maintainability for future contributors
-
Comprehensive Unit Tests for Helper Functions: Direct test coverage for critical utilities
- Created Tests/fontliftTests/HelperFunctionTests.swift with 16 new unit tests
- shellEscape(): 4 tests (simple paths, spaces, single quotes, empty strings)
- isSystemFontPath(): 5 tests (system fonts, library, user library, home, relative paths)
- isValidFontExtension(): 7 tests (ttf, otf, ttc, otc, dfont, invalid extensions, no extension)
- Previously these functions were only tested indirectly through integration tests
- Test count increased: 65 → 81 tests (+16, +24.6% increase)
- Swift tests increased: 27 → 43 tests (+59% increase)
- Better test isolation, clearer failure messages, and comprehensive edge case coverage
- All 81 tests passing (43 Swift + 23 Scripts + 15 Integration)
-
System Font Protection: Critical safety feature to prevent modifying system fonts
- Added
isSystemFontPath()helper function to detect protected directories - Blocks uninstall/remove operations on
/System/Library/Fonts/and/Library/Fonts/ - Clear error messages explain why system fonts cannot be modified
- Protects macOS stability by preventing accidental system font deletion
- Added 2 new Swift unit tests:
testUninstallSystemFontProtection,testRemoveSystemFontProtection
- Added
-
Ambiguous Name Resolution: Ensures deterministic behavior when using
-nflag- Detects when multiple font files match a provided font name
- Fails with descriptive error listing all matching font file paths
- Advises users to specify font by file path instead of ambiguous name
- Prevents accidental removal of wrong font variant (e.g., Bold vs Regular)
- Implemented in both
uninstall -nandremove -ncommands
-
Font Format Validation: Early detection of invalid font files
- Added
isValidFontExtension()helper function - Validates file extensions: .ttf, .otf, .ttc, .otc, .dfont
- Integrated into
validateFilePath()for pre-operation validation - Clear error messages with supported formats list
- Prevents cryptic Core Text errors from attempting to install non-font files
- Added 2 new Swift unit tests:
testInstallInvalidFileFormat,testInstallTextFile
- Added
-
Enhanced Error Messages:
- List command now provides troubleshooting steps on font database failure
- Suggests
atsutil databases -removeand Console.app checks - All error messages now include actionable guidance
-
Shell-Safe Path Escaping: Protection against copy-paste errors
- Added
shellEscape()helper function for path sanitization - Properly escapes special characters (spaces, quotes) in file paths
- Used in error messages that suggest shell commands
- Prevents errors when users copy-paste suggested commands with paths containing spaces
- Added
-
Enhanced Duplicate Detection: Better feedback for already-installed fonts
- Install command now detects "already installed" errors specifically
- Displays font name when duplicate detected: "ℹ️ Font already installed: FontName"
- Provides clear next steps: "Use 'fontlift uninstall' to remove before reinstalling"
- More helpful than generic "Font already installed" message
-
Consistency Improvements: Unified error messaging and command suggestions
- Standardized font list retrieval errors across uninstall and remove commands
- All commands now show identical comprehensive troubleshooting steps
- Enhanced ambiguous name error messages with ready-to-run shell-escaped commands
- Users can copy-paste suggested commands directly, even with special characters in paths
Fixed
-
Incorrect Command Suggestions: Fixed atsutil command guidance
- Corrected
sudo atsutil databases -removetoatsutil databases -remove - atsutil doesn't require sudo for user-level font database operations
- Fixed in 3 error message locations across list, uninstall, and remove commands
- Prevents users from unnecessarily escalating privileges
- Corrected
-
Critical Bug: Font name extraction in remove command
- Was attempting to read font metadata AFTER file deletion (impossible!)
- Now extracts font name before deletion for accurate success messages
- Added fallback to filename if font metadata unavailable
- Ensures users see which font was actually removed
-
Race Condition: File deletion timing issue
- Added verification that file still exists immediately before deletion
- Graceful handling if file removed by another process
- Prevents confusing errors in concurrent scenarios
- Returns early with success message if file already gone
-
Error Handling: Improved specificity in remove command
- Parse NSError codes to provide targeted guidance
- NSFileNoSuchFileError treated as success (file already deleted)
- NSFileWriteNoPermissionError shows sudo suggestion
- NSFileReadNoSuchFileError explains parent directory missing
Changed
- Modified name resolution logic to collect all matches instead of using first match
- Synchronized version constant from 1.1.28 to 1.1.29 to match documentation
- Test count: 61 → 81 tests (added 20 new tests: 4 validation/protection + 16 helper function tests)
- Swift test count: 23 → 43 tests
- Source file size: 564 → 741 lines (+177 lines total: +105 safety/validation, +29 bug fixes, +35 UX, +8 consistency)
- Test file size: +119 lines (HelperFunctionTests.swift)
Improved
- Safety: Major improvement - tool can no longer accidentally break macOS
- Reliability: Fixed actual bugs, added race condition protection
- Predictability: Ambiguous operations now fail explicitly with guidance
- User Experience: Clear error messages with actionable solutions
- Code Quality: All 65 tests passing, zero compiler warnings