diff --git a/src/main/persistence.test.ts b/src/main/persistence.test.ts index f3a1c2fd7..9388428b8 100644 --- a/src/main/persistence.test.ts +++ b/src/main/persistence.test.ts @@ -2111,6 +2111,7 @@ describe('Store', () => { expect(store.getUI().worktreeCardProperties).toContain('inline-agents') expect(store.getUI().worktreeCardProperties).toContain('linear-issue') expect(store.getUI().worktreeCardProperties).toContain('ports') + expect(store.getUI().worktreeCardProperties).not.toContain('branch') expect(store.getUI()._inlineAgentsDefaultedForExperiment).toBe(true) expect(store.getUI()._inlineAgentsDefaultedForAllUsers).toBe(true) expect(store.getUI()._expandedWorktreeCardPropertiesDefaulted).toBe(true) diff --git a/src/main/runtime/rpc/methods/client-ui.test.ts b/src/main/runtime/rpc/methods/client-ui.test.ts index 7c591597c..6cd4892a5 100644 --- a/src/main/runtime/rpc/methods/client-ui.test.ts +++ b/src/main/runtime/rpc/methods/client-ui.test.ts @@ -136,7 +136,7 @@ describe('client UI RPC methods', () => { it('accepts persisted literal UI arrays and nested UI state', async () => { const updated: PersistedUIState = { ...getDefaultUIState(), - worktreeCardProperties: ['status', 'inline-agents'], + worktreeCardProperties: ['status', 'branch', 'inline-agents'], statusBarItems: ['codex'], taskResumeState: { githubMode: 'items', @@ -163,7 +163,7 @@ describe('client UI RPC methods', () => { const dispatcher = new RpcDispatcher({ runtime, methods: CLIENT_UI_METHODS }) const payload = { - worktreeCardProperties: ['status', 'inline-agents'], + worktreeCardProperties: ['status', 'branch', 'inline-agents'], statusBarItems: ['codex'], taskResumeState: { githubMode: 'items', diff --git a/src/main/runtime/rpc/methods/client-ui.ts b/src/main/runtime/rpc/methods/client-ui.ts index 0098722c1..6e9d57050 100644 --- a/src/main/runtime/rpc/methods/client-ui.ts +++ b/src/main/runtime/rpc/methods/client-ui.ts @@ -10,6 +10,7 @@ const UnknownRecordArray = z.array(UnknownRecord) const WorktreeCardProperty = z.enum([ 'status', 'unread', + 'branch', 'ci', 'issue', 'linear-issue', diff --git a/src/renderer/src/components/sidebar/SidebarWorkspaceOptionsMenu.tsx b/src/renderer/src/components/sidebar/SidebarWorkspaceOptionsMenu.tsx index bf27e5dcd..32f32ae86 100644 --- a/src/renderer/src/components/sidebar/SidebarWorkspaceOptionsMenu.tsx +++ b/src/renderer/src/components/sidebar/SidebarWorkspaceOptionsMenu.tsx @@ -35,6 +35,7 @@ const GROUP_BY_OPTIONS = [ ] as const const PROPERTY_OPTIONS: { id: WorktreeCardProperty; label: string }[] = [ + { id: 'branch', label: 'Branch name' }, { id: 'issue', label: 'GitHub ticket' }, { id: 'linear-issue', label: 'Linear issue' }, { id: 'pr', label: 'PR/MR link' }, diff --git a/src/renderer/src/components/sidebar/WorktreeCard.quick-actions.test.tsx b/src/renderer/src/components/sidebar/WorktreeCard.quick-actions.test.tsx index 63b37973a..cfe4aa382 100644 --- a/src/renderer/src/components/sidebar/WorktreeCard.quick-actions.test.tsx +++ b/src/renderer/src/components/sidebar/WorktreeCard.quick-actions.test.tsx @@ -125,6 +125,41 @@ describe('WorktreeCard quick actions', () => { expect(markup).toContain('data-workspace-board-preserve-open=""') }) + it('hides the branch name from workspace card metadata by default', () => { + const markup = renderToStaticMarkup( + + ) + + expect(markup).toContain('Visible workspace') + expect(markup).not.toContain('feature/secret-ref') + expect(markup).not.toContain('secret-ref') + }) + + it('renders the branch name when the Branch name property is enabled', () => { + worktreeCardProperties = ['status', 'unread', 'branch'] + + const markup = renderToStaticMarkup( + + ) + + expect(markup).toContain('Visible workspace') + expect(markup).toContain('feature/show-ref') + }) + it('shows delete as the top-right quick action for an inactive workspace', () => { const markup = renderToStaticMarkup( diff --git a/src/renderer/src/components/sidebar/WorktreeCard.tsx b/src/renderer/src/components/sidebar/WorktreeCard.tsx index 45dc3d546..ec70021a7 100644 --- a/src/renderer/src/components/sidebar/WorktreeCard.tsx +++ b/src/renderer/src/components/sidebar/WorktreeCard.tsx @@ -254,6 +254,7 @@ const WorktreeCard = React.memo(function WorktreeCard({ const showLinearIssue = cardProps.includes('linear-issue') const showComment = cardProps.includes('comment') const showPorts = cardProps.includes('ports') + const showBranch = cardProps.includes('branch') // Skip hosted-review fetches when the corresponding card sections are hidden. // This preference is purely presentational, so background refreshes would @@ -415,8 +416,7 @@ const WorktreeCard = React.memo(function WorktreeCard({ ) // Why: deleting the active/current workspace or one with live activity is a // disruptive hover action; keep the quick action delete-only and passive. - const showDeleteQuickAction = - !isCurrentWorktree && !hasActiveActivity && !worktree.isMainWorktree + const showDeleteQuickAction = !isCurrentWorktree && !hasActiveActivity && !worktree.isMainWorktree const handleWorkspaceQuickAction = useCallback( (event: React.MouseEvent) => { event.preventDefault() @@ -624,10 +624,9 @@ const WorktreeCard = React.memo(function WorktreeCard({ )} {/* Why: weight alone carries the unread signal; color stays - at text-foreground in both states so the title keeps - hierarchy against the muted branch row below (muting the - title as well flattened the card — same reasoning as the - repo chip comment below). */} + at text-foreground in both states so the title remains + the card's primary scan target even when optional branch + metadata is hidden. */}