Fix mangled project paths in By Project and Top Sessions panels#295
Closed
meghraoa wants to merge 1 commit into
Closed
Fix mangled project paths in By Project and Top Sessions panels#295meghraoa wants to merge 1 commit into
meghraoa wants to merge 1 commit into
Conversation
shortProject() decoded Claude Code slugs by splitting on '-', which
broke directory names containing dashes ('foo-bar' became 'foo/bar').
Switch the dashboard to consume ProjectSummary.projectPath (the
canonical cwd already extracted by parser.ts) and rewrite shortProject
to operate on a real absolute path.
Member
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
The
By ProjectandTop Sessionspanels in the dashboard displayed corrupted project names whenever a directory contained a dash or a dot. For example,~/Projects/foo-barrendered asProjects/foo/bar, and~/Projects/site.github.iorendered asProjects/site/github/iowith theProjects/prefix dropped entirely on deeper paths.Root cause
shortProject()insrc/dashboard.tsxreceived Claude Code's encoded slug (e.g.-home-user-Projects-foo-bar) and tried to recover the original path by splitting on-and joining with/. This is intrinsically lossy: there's no way to distinguish dashes that came from path separators from dashes that were part of the original directory name.Fix
ProjectSummary.projectPathis already populated from the canonicalcwdextracted byparser.ts(extractCanonicalCwd, with fallback to the legacy decode when no JSONLcwdis found). Other consumers (export.ts,cli.ts) already use it. The dashboard was the last holdout still re-decoding the slug.This PR:
By ProjectandTop Sessionspanels to consumeprojectPath(the real cwd).shortProjectto operate on an absolute path: split on/, keep the last 3 segments, strip the home prefix and anyprivate/tmp/...macOS noise.projectNamefield toprojectPathfor semantic accuracy.shortProjectso it can be unit-tested.Test plan
npm testpasses (added 6 cases forshortProjectcovering dashes, dots, the home dir itself, deep nesting, and paths outside home).~/.claude/projects/; directories with dashes and dots now render verbatim instead of being split.