diff --git a/src/renderer/src/components/sidebar/WorktreeList.tsx b/src/renderer/src/components/sidebar/WorktreeList.tsx index 633380873..4eb0aae92 100644 --- a/src/renderer/src/components/sidebar/WorktreeList.tsx +++ b/src/renderer/src/components/sidebar/WorktreeList.tsx @@ -132,6 +132,10 @@ import type { PendingSidebarWorktreeReveal } from '@/store/slices/ui' import { getRepositoryBadgeColorSectionId } from '@/components/settings/repository-settings-targets' import { keybindingMatchesAction } from '../../../../shared/keybindings' import { isGitRepoKind } from '../../../../shared/repo-kind' +import { + effectiveExternalWorktreeVisibility, + isLegacyRepoForExternalWorktreeVisibility +} from '../../../../shared/worktree-ownership' // How long to wait after a sortEpoch bump before actually re-sorting. // Prevents jarring position shifts when background events (AI starting work, @@ -209,6 +213,14 @@ function getWorktreeOptionId(worktreeId: string): string { return `worktree-list-option-${encodeURIComponent(worktreeId)}` } +function getWorktreeVisibilityMenuLabel(repo: Repo): string { + const visibility = effectiveExternalWorktreeVisibility( + repo, + isLegacyRepoForExternalWorktreeVisibility(repo) + ) + return visibility === 'show' ? 'Hide non-Orca worktrees' : 'Import Worktrees' +} + const LINEAGE_INDENT = 18 const SIDEBAR_POINTER_DRAG_THRESHOLD_PX = 4 @@ -1990,7 +2002,7 @@ const VirtualizedWorktreeViewport = React.memo(function VirtualizedWorktreeViewp }} > - Import Worktrees + {getWorktreeVisibilityMenuLabel(row.repo)} ) : null} diff --git a/src/renderer/src/components/sidebar/WorktreeVisibilityDialog.tsx b/src/renderer/src/components/sidebar/WorktreeVisibilityDialog.tsx index 029aaff2b..0907cdefb 100644 --- a/src/renderer/src/components/sidebar/WorktreeVisibilityDialog.tsx +++ b/src/renderer/src/components/sidebar/WorktreeVisibilityDialog.tsx @@ -1,5 +1,5 @@ import React, { useCallback } from 'react' -import { Import } from 'lucide-react' +import { Eye, EyeOff } from 'lucide-react' import { useAppStore } from '@/store' import { Dialog, @@ -41,12 +41,8 @@ export default function WorktreeVisibilityDialog(): React.JSX.Element | null { (worktree) => !worktree.selectedCheckout && worktree.ownership !== 'orca-managed' ).length : 0 - const hiddenWorktreeLabel = `${hiddenCount} non-Orca ${ - hiddenCount === 1 ? 'worktree' : 'worktrees' - }` - const importedWorktreeLabel = `${otherCount} non-Orca ${ - otherCount === 1 ? 'worktree' : 'worktrees' - }` + const hiddenWorktreeLabel = `${hiddenCount} ${hiddenCount === 1 ? 'worktree' : 'worktrees'}` + const shownWorktreeLabel = `${otherCount} ${otherCount === 1 ? 'worktree' : 'worktrees'}` const handleToggle = useCallback(async () => { if (!repoId) { @@ -65,23 +61,21 @@ export default function WorktreeVisibilityDialog(): React.JSX.Element | null { !open && closeModal()}> - Import Worktrees + Non-Orca worktrees {repo.displayName}
- + {showOther ? : }
- {showOther - ? 'Imported non-Orca worktrees into sidebar' - : 'Import non-Orca worktrees into sidebar'} + {showOther ? 'Shown in sidebar' : 'Hidden from sidebar'}
{showOther - ? `${importedWorktreeLabel} imported` + ? `${shownWorktreeLabel} currently shown` : `${hiddenWorktreeLabel} available to import`}
@@ -90,7 +84,7 @@ export default function WorktreeVisibilityDialog(): React.JSX.Element | null { variant={showOther ? 'secondary' : 'outline'} onClick={handleToggle} > - {showOther ? 'Remove' : 'Import'} + {showOther ? 'Hide' : 'Import'}
diff --git a/src/renderer/src/lib/agent-ready-wait.test.ts b/src/renderer/src/lib/agent-ready-wait.test.ts index 06d2d7028..c2acd7edb 100644 --- a/src/renderer/src/lib/agent-ready-wait.test.ts +++ b/src/renderer/src/lib/agent-ready-wait.test.ts @@ -35,7 +35,7 @@ describe('waitForAgentReady', () => { hasChildProcesses: false }) - await expect(waitForAgentReady('tab-1', 'claude', { timeoutMs: 1 })).resolves.toEqual({ + await expect(waitForAgentReady('tab-1', 'claude', { timeoutMs: 100 })).resolves.toEqual({ ready: true, reason: 'foreground-match' })