Skip to content

feat(web): custom display labels for worktrees#3070

Open
TheIcarusWings wants to merge 2 commits into
pingdotgg:mainfrom
TheIcarusWings:t3code/worktree-display-labels
Open

feat(web): custom display labels for worktrees#3070
TheIcarusWings wants to merge 2 commits into
pingdotgg:mainfrom
TheIcarusWings:t3code/worktree-display-labels

Conversation

@TheIcarusWings

@TheIcarusWings TheIcarusWings commented Jun 13, 2026

Copy link
Copy Markdown

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 — no git worktree move, no disk changes.

Design

  • 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 (local UI state).
  • A single resolver — worktreeDisplayName(path, labelMap) = labelMap[path] ?? formatWorktreePathForDisplay(path) — is used everywhere a worktree name renders, so the UI stays consistent.
  • The rename UI is a single, globally-mounted dialog (WorktreeRenameDialog) driven by a small worktreeRenameStore, so every entry point opens the same dialog and writes the same path-keyed label.

Rename entry points

  • Sidebar thread context menu → "Rename worktree" (only for worktree-backed threads).
  • Bottom-bar workspace label: double-click, or right-click → "Rename worktree" (desktop + mobile).

Leaving the field blank resets to the default hash-derived name. The label persists across reloads.

Where labels surface

  • Bottom-bar workspace label (desktop BranchToolbarEnvModeSelector + mobile MobileRunContextSelector).
  • Orphan-worktree delete confirmation dialog.

Tests

  • worktreeDisplayName (label / fallback / blank / trim).
  • setWorktreeLabel reducer (set / trim / clear / sibling independence) + persistence round-trip.
  • Custom-label cases for resolveCurrentWorkspaceLabel / resolveLockedWorkspaceLabel.

pnpm typecheck and vp lint clean; 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: worktreeLabelByPath is added to uiStateStore (load/sanitize/persist in localStorage). setWorktreeLabel trims labels and clears on blank input. worktreeDisplayName and useWorktreeLabel prefer custom labels and fall back to formatWorktreePathForDisplay. resolveCurrentWorkspaceLabel / resolveLockedWorkspaceLabel accept an optional custom label.

Rename UX: A global WorktreeRenameDialog is driven by worktreeRenameStore. Entry points: sidebar thread context menu Rename worktree, and bottom-bar workspace label double-click / right-click via useWorktreeRenameTrigger (wired in BranchToolbar, 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

  • Adds a global WorktreeRenameDialog that lets users set a cosmetic label for any worktree path; blank input clears the label.
  • Stores custom labels in uiStateStore under worktreeLabelByPath, persisted to localStorage and restored on startup.
  • Surfaces rename via double-click or right-click on worktree labels in BranchToolbar, BranchToolbarEnvModeSelector, and the sidebar thread context menu, using the new useWorktreeRenameTrigger hook.
  • Adds worktreeDisplayName utility and updates resolveCurrentWorkspaceLabel/resolveLockedWorkspaceLabel to prefer custom labels over path-derived defaults.
  • Deleting a thread's orphaned worktree now also clears its stored custom label.

Macroscope summarized fcda8a9.

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>
@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3d17a8c1-ce62-45b8-ad8d-08c463057e52

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Jun 13, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant