feat(sidebar): add a filter to hide detached-HEAD workspaces (#10786)

Adds "Hide detached HEAD" alongside the existing sidebar filters, wired
through the same pipeline as Hide CLI-created: sidebar list, Cmd+J
empty-query list, workspace board, active-filter badges, Clear/Reset
Filters, and persisted UI state.

The predicate reuses getWorktreeGitIdentityDisplay so the filter targets
exactly what the card renders a Detached HEAD badge for. Requiring a real
head (not just an empty branch) keeps folder workspaces and
SSH-synthesized rows — which carry both empty — out of the filter.

Activating a hidden detached workspace clears the filter, matching the
existing reveal escape hatch for automation- and CLI-created workspaces.

Splits the filter-state describes out of visible-worktrees.test.ts into
sidebar-filter-state.test.ts to stay under the max-lines budget.

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Neil
2026-07-26 14:42:05 -07:00
committed by GitHub
co-authored by Orca
parent 5d17bd8f33
commit af708d3471
22 changed files with 376 additions and 182 deletions
+1
View File
@@ -460,6 +460,7 @@ export function getDefaultUIState(): PersistedUIState {
hideDefaultBranchWorkspace: false,
hideAutomationGeneratedWorkspaces: false,
hideCliCreatedWorkspaces: false,
hideDetachedHeadWorkspaces: false,
showDotfilesByWorktree: {},
filterRepoIds: [],
collapsedGroups: [],
+2
View File
@@ -3265,6 +3265,8 @@ export type PersistedUIState = {
hideAutomationGeneratedWorkspaces?: boolean
/** Hide workspaces created through `orca worktree create`. */
hideCliCreatedWorkspaces?: boolean
/** Hide workspaces sitting on a detached HEAD; folder workspaces (no head at all) are unaffected. */
hideDetachedHeadWorkspaces?: boolean
/** Per-worktree Explorer dotfile visibility. Missing entries inherit the default: show. */
showDotfilesByWorktree?: Record<string, boolean>
filterRepoIds: string[]