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 (custom worktree labels) with new UI components, interaction patterns (double-click/right-click to rename), and persisted state. While well-structured and cosmetic-only, new features with this scope warrant human review. You can customize Macroscope's approvability policy. Learn more. |
Address self-review findings on the worktree display-label feature: - Clear a worktree's custom label when the worktree is deleted (orphan-delete in useThreadActions), so it can't linger in persisted state or be inherited by a future worktree reusing the same path. - Key labels by the verbatim worktree path everywhere. Previously writers trimmed the path key while useWorktreeLabel read it raw, so a path with surrounding whitespace would store and read under different keys. - Remove unused useWorktreeDisplayName hook (dead code). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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 labels with no VCS or filesystem changes; scope is localized to display state and rename flows.
Overview
Users can assign cosmetic display names to worktrees (keyed by worktree path, not thread) so shared threads and toolbars show the same label instead of hash folder names—no disk or git worktree moves.
Persistence & resolution:
worktreeLabelByPathis added touiStateStore(load/sanitize/persist in localStorage).setWorktreeLabeltrims labels and clears on blank input.worktreeDisplayNameanduseWorktreeLabelprefer custom labels and fall back toformatWorktreePathForDisplay.resolveCurrentWorkspaceLabel/resolveLockedWorkspaceLabelaccept an optional custom label.Rename UX: A global
WorktreeRenameDialogis driven byworktreeRenameStore. Entry points: sidebar thread context menu Rename worktree, and bottom-bar workspace label double-click / right-click viauseWorktreeRenameTrigger(wired inBranchToolbar,BranchToolbarEnvModeSelector, mobile run context).Cleanup: Orphan worktree delete confirmation uses
worktreeDisplayName; removing a worktree clears its stored label so it does not linger for a future path reuse.Reviewed by Cursor Bugbot for commit fcda8a9. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add custom display labels for worktrees with rename dialog
WorktreeRenameDialogthat lets users set a cosmetic label for any worktree path; blank input clears the label.uiStateStoreunderworktreeLabelByPath, persisted to localStorage and restored on startup.BranchToolbar,BranchToolbarEnvModeSelector, and the sidebar thread context menu, using the newuseWorktreeRenameTriggerhook.worktreeDisplayNameutility and updatesresolveCurrentWorkspaceLabel/resolveLockedWorkspaceLabelto prefer custom labels over path-derived defaults.Macroscope summarized fcda8a9.