feat: Add dot mapping support for usernames and project names in pathResolver#3
Open
shukebeta wants to merge 5 commits intoesc5221:masterfrom
Open
feat: Add dot mapping support for usernames and project names in pathResolver#3shukebeta wants to merge 5 commits intoesc5221:masterfrom
shukebeta wants to merge 5 commits intoesc5221:masterfrom
Conversation
Major improvements to pathResolver functionality: ## New Features - **Dot mapping support**: `David-Wei` → `David.Wei` and `HappyNotes-Api` → `HappyNotes.Api` - **Cross-platform testing**: Use path.win32/path.posix for reliable testing on any platform - **Intelligent detection priority**: separator → underscore → dot with short-circuit optimization - **Windows smart detection**: Add file-existence-based intelligent path resolution for Windows (was missing in original) ## Key Improvements - Replace separator parameter injection with proper path.win32/path.posix dependency injection - Support dot notation for usernames (David.Wei) and project names (HappyNotes.Api) - Enhanced test coverage with precise mock controls for file existence scenarios - Maintain backward compatibility with all existing path resolution behavior ## Algorithm Enhancements - Short-circuit principle: try first option completely before backtracking - Three-level fallback: exact match → underscore → dot → default separation - Proper Windows drive letter handling with intelligent directory detection - Fixed Unix path processing that was broken in original version ## Test Infrastructure - Comprehensive Vitest test suite with 10 test cases - Cross-platform testing capability (Windows paths testable on Linux) - Precise existsSync mocking for deterministic file existence simulation - Verification against original version behavior Resolves path resolution issues for Windows usernames with dots and project folders with dot notation while maintaining full backward compatibility. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Review these changes at https://app.gitnotebooks.com/esc5221/claude-code-viewer/pull/3 |
added 4 commits
August 17, 2025 12:03
Add test coverage for scenarios where actual hyphen directories exist: - Windows: C--Users-David-Wei-bin → C:\Users\David-Wei\bin (preserves hyphen) - Unix: happy-notes directory → /path/to/happy-notes (preserves hyphen) These tests ensure the algorithm respects real filesystem structures and only performs replacements when the original hyphen directories don't exist, preventing future regressions.
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 enhances the
pathResolvermodule to support dot notation in Windows usernames and project names, while adding comprehensive cross-platform testing infrastructure.Problem Solved
The original
pathResolverhad two key limitations:Windows usernames with dots:
C--Users-David-Wei-bin→C:\Users\David\Wei\bin(incorrect)C:\Users\David.Wei\bin(user's actual folder name)Project names with dots:
C--Users-David-Wei-RiderProjects-HappyNotes-Api→C:\Users\David\Wei\RiderProjects\HappyNotes\Api(incorrect)C:\Users\David.Wei\RiderProjects\HappyNotes.Api(actual folder structure)Solution
✨ New Features
Intelligent Dot Mapping: The algorithm now checks file existence to choose between:
David-Wei→David\Wei(ifDavid\Weidirectory exists)David-Wei→David_Wei(ifDavid_Weidirectory exists)David-Wei→David.Wei(ifDavid.Weidirectory exists)Cross-Platform Testing: Uses
path.win32/path.posixdependency injection for reliable testing:📋 Examples
C--Users-David-Wei-binDavid.Weifolder existsC:\Users\David.Wei\bin✅C--Users-David-Wei-binDavid\Weifolders existC:\Users\David\Wei\bin✅C--Users-David-Wei-RiderProjects-HappyNotes-ApiDavid.WeiandHappyNotes.ApiexistC:\Users\David.Wei\RiderProjects\HappyNotes.Api✅-home-davidwei-AndroidStudioProjects-happy-noteshappy_notesfolder exists/home/davidwei/AndroidStudioProjects/happy_notes✅🔧 Technical Improvements
existsSyncmocking🧪 Test Infrastructure
Added Vitest testing framework with comprehensive coverage:
Files Changed
electron/pathResolver.ts: Enhanced algorithm with dot mapping support__tests__/pathResolver.test.ts: Comprehensive test suitevitest.config.ts: Test configurationpackage.json: Added Vitest dependencyTest Results
This enhancement resolves path resolution issues for modern development environments where usernames and project names commonly contain dots, maintaining full backward compatibility.