Skip to content

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

Open
TheIcarusWings wants to merge 1 commit into
pingdotgg:mainfrom
TheIcarusWings:t3code/worktree-display-labels
Open

feat(web): custom display labels for worktrees#3070
TheIcarusWings wants to merge 1 commit 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 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), with worktreeDisplayName / setWorktreeLabel and hooks useWorktreeLabel / useWorktreeDisplayName so every thread on the same worktree shows the same label (no disk move).

Rename UX: a global WorktreeRenameDialog driven by worktreeRenameStore, opened from the sidebar thread context menu (Rename worktree), or from the bottom-bar workspace label via double-click / right-click (useWorktreeRenameTrigger on desktop BranchToolbarEnvModeSelector and mobile MobileRunContextSelector).

Display: resolveCurrentWorkspaceLabel / resolveLockedWorkspaceLabel take an optional custom label; branch toolbar workspace text uses it. Orphan-worktree delete confirmation uses worktreeDisplayName instead 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

  • Adds a WorktreeRenameDialog globally mounted in the app shell, allowing users to set or clear a cosmetic display label for any worktree path without moving anything on disk.
  • Persists custom labels in localStorage via uiStateStore, keyed by worktree path; blank labels are cleared on save.
  • Exposes useWorktreeLabel, useWorktreeDisplayName, and useWorktreeRenameTrigger hooks so components can subscribe to labels and wire double-click/right-click rename interactions.
  • Updates BranchToolbarEnvModeSelector, BranchToolbar.MobileRunContextSelector, and Sidebar to show custom labels and open the rename dialog on double-click, right-click, or via the thread context menu.
  • Adds worktreeDisplayName utility that resolves the effective display name, preferring custom labels and falling back to the path-derived name from formatWorktreePathForDisplay.

Macroscope summarized 3427ca9.

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: de18d8f0-0335-4b8b-9898-442eb4dc19dc

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 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.

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