fix: apply originalPath config to auto-detected projects#255
fix: apply originalPath config to auto-detected projects#255kabaken wants to merge 1 commit intositeboon:mainfrom
Conversation
The originalPath setting in project-config.json was only being used for manually added projects (those with manuallyAdded flag). Auto-detected projects in ~/.claude/projects/ were ignoring this setting entirely, causing the extractProjectDirectory() function to always use the cwd from session files. This caused issues when users worked in subdirectories - for example, working in /project/subdir would make the UI show that subdirectory path instead of the parent project path, even if originalPath was configured. This fix makes extractProjectDirectory() check for originalPath in the config before falling back to session-based detection, ensuring the setting works consistently for all projects. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
WalkthroughModified path resolution logic in the project configuration handling to check for a pre-configured Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
originalPathsetting inproject-config.jsonbeing ignored for auto-detected projectsProblem
The
originalPathsetting was only being used for manually added projects (those withmanuallyAddedflag). Auto-detected projects in~/.claude/projects/were ignoring this setting entirely.This caused issues when users worked in subdirectories. For example:
/Users/name/Projects/myproject/Users/name/Projects/myproject/subdir/Projects/myproject/subdiras the project pathoriginalPathin config, the subdirectory path is still displayedSolution
Modified
extractProjectDirectory()to check fororiginalPathin the config before falling back to session-based detection.Users can now override the auto-detected path by setting
originalPathin~/.claude/project-config.json:{ "-Users-name-Projects-myproject": { "displayName": "My Project", "originalPath": "/Users/name/Projects/myproject" } }Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.