Skip to content

Conversation

@kabaken
Copy link

@kabaken kabaken commented Dec 9, 2025

Summary

  • Fix originalPath setting in project-config.json being ignored for auto-detected projects

Problem

The originalPath setting was only being used for manually added projects (those with manuallyAdded flag). Auto-detected projects in ~/.claude/projects/ were ignoring this setting entirely.

This caused issues when users worked in subdirectories. For example:

  • User has a project at /Users/name/Projects/myproject
  • User runs Claude Code in /Users/name/Projects/myproject/subdir
  • The UI incorrectly shows /Projects/myproject/subdir as the project path
  • Even after setting originalPath in config, the subdirectory path is still displayed

Solution

Modified extractProjectDirectory() to check for originalPath in the config before falling back to session-based detection.

Users can now override the auto-detected path by setting originalPath in ~/.claude/project-config.json:

{
  "-Users-name-Projects-myproject": {
    "displayName": "My Project",
    "originalPath": "/Users/name/Projects/myproject"
  }
}

Summary by CodeRabbit

  • New Features
    • Project paths can now be customized in project-config.json, allowing users to override automatic path detection with a configured originalPath.

✏️ Tip: You can customize this high-level summary in your review settings.

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 <[email protected]>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 9, 2025

Walkthrough

Modified path resolution logic in the project configuration handling to check for a pre-configured originalPath value before falling back to auto-detection, providing an override mechanism for directory extraction.

Changes

Cohort / File(s) Change Summary
Project Path Override
server/projects.js
Added precedence logic to read and cache originalPath from project configuration, short-circuiting auto-detection when the value is present

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Focus area: Configuration check logic and early-return path in path resolution
  • Verify caching mechanism works correctly for repeated access
  • Confirm backward compatibility when originalPath is not configured

Poem

🐰 A config whisper, a path made plain,
No more guessing games or detection strain,
When originalPath is set just right,
The project finds home—swift, direct, and bright!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main change: applying originalPath config to auto-detected projects, which aligns with the primary modification in server/projects.js.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 09688a0 and 57823f5.

📒 Files selected for processing (1)
  • server/projects.js (1 hunks)
🔇 Additional comments (1)
server/projects.js (1)

269-278: LGTM! Good precedence override for auto-detected projects.

The implementation correctly checks for a configured originalPath before falling back to auto-detection, which solves the subdirectory display issue mentioned in the PR objectives. The caching and optional chaining are appropriate, and this approach is consistent with how manually added projects handle originalPath (line 470).


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

wiseyoda added a commit to wiseyoda/claudecodeui that referenced this pull request Dec 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant