Repository navigation
Conversation
On Windows, Claude Code can record a project path as `f:/repo` while `git rev-parse` reports the root as `F:/repo`. The exact string compare in groupProjects() then found no root project, producing empty "0 projects" groups on the Projects page and hiding their sessions. Normalize the drive letter to uppercase alongside the existing backslash normalization, and add a regression test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I checked and with this fix I can see all my sessions for each projects as expected. Thanks for the cool project! (this message is written by an organic brain) |
|
Thanks for tracking this down, the Two things before merging:
Longer term the API should probably emit CI hasn't run on this branch yet (first-contributor approval), I'll kick it off. |
JayantDevkar
left a comment
There was a problem hiding this comment.
Inline context for reviewers, one note per change area.
| // git outputs forward slashes — normalize both to forward slashes before comparing). | ||
| // Also uppercase the Windows drive letter: Claude Code may record `f:/repo` while | ||
| // git reports `F:/repo`, which would otherwise leave the group with 0 projects. | ||
| const normalizePath = (p: string) => |
There was a problem hiding this comment.
Could this live in $lib/utils.ts as an exported normalizePath and be used by getRelativePath below as well? That function still does a plain startsWith on the un-normalized root, so a nested f:/code/journal/pkg under the new F:/code/journal key renders as an absolute path instead of ./pkg. There are five other .replace(/\\/g, '/') sites across this file and utils.ts, and decodeProjectPath already uppercases the drive on its own.
| const projects = [ | ||
| makeProject({ | ||
| encoded_name: 'f--code-journal', | ||
| path: 'f:/code/journal', |
There was a problem hiding this comment.
Worth adding a nested project to this fixture (path: 'f:/code/journal/pkg', is_nested_project: true) and asserting getRelativePath(...) returns ./pkg. That's the case the current code still misses.
Problem
On Windows, the Projects page shows git-repository groups with "0 projects", and the sessions of those projects can't be reached from there.
Claude Code can record a project's path with a lowercase drive letter (
f:/code/journal), whilegit rev-parsereports the git root with an uppercase one (F:/code/journal). For example, from/projects:groupProjects()infrontend/src/lib/utils/grouped-projects.tscompares the two with an exact string match after normalizing backslashes, so the root project is never found. With no root and no nested projects, the group ends up withtotalProjects === 0. It still goes intogitRoots, which renders as an empty "0 projects" card.Fix
normalizePath()now uppercases a leading Windows drive letter, alongside the existing backslash → slash normalization. Drive letters are case-insensitive on Windows, so this is safe. The rest of the path is left as is.f:/code/journalwith a git root atF:/code/journalnow lands insingleGitProjects.Testing
npx vitest run src/tests/grouped-projects.test.ts: 18 tests pass./projectsAPI response above shows the mismatch for every repo where the session path has a lowercase drive letter.🤖 Generated with Claude Code