From 57823f573e7e4f7a6f38bbd3d3096fb8fc98082e Mon Sep 17 00:00:00 2001 From: Kenji Kabashima Date: Tue, 9 Dec 2025 12:22:01 +0900 Subject: [PATCH] fix: apply originalPath config to auto-detected projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- server/projects.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/server/projects.js b/server/projects.js index ff5aa25bb..97488b538 100755 --- a/server/projects.js +++ b/server/projects.js @@ -266,8 +266,16 @@ async function extractProjectDirectory(projectName) { if (projectDirectoryCache.has(projectName)) { return projectDirectoryCache.get(projectName); } - - + + // Check if originalPath is configured in project-config.json + // This allows users to override the auto-detected path + const config = await loadProjectConfig(); + if (config[projectName]?.originalPath) { + const customPath = config[projectName].originalPath; + projectDirectoryCache.set(projectName, customPath); + return customPath; + } + const projectDir = path.join(process.env.HOME, '.claude', 'projects', projectName); const cwdCounts = new Map(); let latestTimestamp = 0;