feat(web): custom display labels for worktrees#3070
Conversation
Let a worktree carry a readable display name instead of the auto-generated hash folder name (e.g. "t3code-f07cb2c5"). The label is cosmetic only — no `git worktree move`, no disk changes. Keyed by worktree PATH (not per-thread) so threads sharing a worktree always show the same name. Stored in a persisted `worktreeLabelByPath` map in useUiStateStore. A single `worktreeDisplayName(path, labelMap)` resolver is used everywhere a worktree name renders. Rename entry points (all open one shared, globally-mounted dialog): - Sidebar thread context menu → "Rename worktree" (worktree-backed threads). - Bottom-bar workspace label: double-click, or right-click → "Rename worktree". Labels surface in the bottom-bar workspace label and the orphan-worktree delete confirmation. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
ApprovabilityVerdict: Needs human review This PR introduces a new user-facing feature with new components, interaction patterns (double-click/right-click to rename), and workflows. While well-scoped and cosmetic-only, new feature additions warrant human review to verify the UX and implementation approach. You can customize Macroscope's approvability policy. Learn more. |
What
Lets a worktree carry a readable display name instead of the auto-generated hash folder name (e.g.
t3code-f07cb2c5). The label is cosmetic only — nogit worktree move, no disk changes.Design
worktreeLabelByPathmap inuseUiStateStore(local UI state).worktreeDisplayName(path, labelMap) = labelMap[path] ?? formatWorktreePathForDisplay(path)— is used everywhere a worktree name renders, so the UI stays consistent.WorktreeRenameDialog) driven by a smallworktreeRenameStore, so every entry point opens the same dialog and writes the same path-keyed label.Rename entry points
Leaving the field blank resets to the default hash-derived name. The label persists across reloads.
Where labels surface
BranchToolbarEnvModeSelector+ mobileMobileRunContextSelector).Tests
worktreeDisplayName(label / fallback / blank / trim).setWorktreeLabelreducer (set / trim / clear / sibling independence) + persistence round-trip.resolveCurrentWorkspaceLabel/resolveLockedWorkspaceLabel.pnpm typecheckandvp lintclean; full web unit suite passes (1057 tests). Verified manually in the running app: rename from all entry points, shared label across two threads on the same worktree, blank-resets-to-default, and persistence across reload.🤖 Generated with Claude Code
Note
Low Risk
UI-only persisted local labels and dialog wiring; no git worktree moves or server-side path changes.
Overview
Adds cosmetic worktree display names keyed by worktree path in persisted
worktreeLabelByPath(useUiStateStore), withworktreeDisplayName/setWorktreeLabeland hooksuseWorktreeLabel/useWorktreeDisplayNameso every thread on the same worktree shows the same label (no disk move).Rename UX: a global
WorktreeRenameDialogdriven byworktreeRenameStore, opened from the sidebar thread context menu (Rename worktree), or from the bottom-bar workspace label via double-click / right-click (useWorktreeRenameTriggeron desktopBranchToolbarEnvModeSelectorand mobileMobileRunContextSelector).Display:
resolveCurrentWorkspaceLabel/resolveLockedWorkspaceLabeltake an optional custom label; branch toolbar workspace text uses it. Orphan-worktree delete confirmation usesworktreeDisplayNameinstead of the raw path segment. Blank save clears the custom name back to the path-derived default.Reviewed by Cursor Bugbot for commit 3427ca9. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add custom display labels for worktrees in the branch toolbar and sidebar
WorktreeRenameDialogglobally mounted in the app shell, allowing users to set or clear a cosmetic display label for any worktree path without moving anything on disk.localStorageviauiStateStore, keyed by worktree path; blank labels are cleared on save.useWorktreeLabel,useWorktreeDisplayName, anduseWorktreeRenameTriggerhooks so components can subscribe to labels and wire double-click/right-click rename interactions.BranchToolbarEnvModeSelector,BranchToolbar.MobileRunContextSelector, andSidebarto show custom labels and open the rename dialog on double-click, right-click, or via the thread context menu.worktreeDisplayNameutility that resolves the effective display name, preferring custom labels and falling back to the path-derived name fromformatWorktreePathForDisplay.Macroscope summarized 3427ca9.