+ {showLabel ? (
+
+
{target.label}
+ {target.isPrimary ? (
+ primary
+ ) : null}
+
+ ) : null}
+ {/* Rows from the last read stay up while a refresh runs or fails. */}
+ {inventory.error !== null ? (
+
+ Couldn't read worktrees.
+
+
+ ) : null}
+ {inventory.data === null ? (
+ inventory.error === null ? (
+
+ Reading worktrees
+
+ ) : null
+ ) : worktrees.length === 0 ? (
+
No worktrees
+ ) : (
+
+ )}
+
{
+ if (!open) setPruneCandidate(null);
+ }}
+ onConfirm={handleConfirmPrune}
+ />
+
+ );
+}
+
+/**
+ * Every connected environment's managed worktrees. An environment whose
+ * server predates worktree management is left out rather than shown broken.
+ * Cleanup rules stay in Storage settings; this only links there.
+ */
+function WorktreeManagementSection() {
+ const { environments } = useEnvironments();
+ const serverConfigs = useAtomValue(environmentServerConfigsAtom);
+ const primaryEnvironmentId = usePrimaryEnvironmentId();
+ const [refreshToken, setRefreshToken] = useState(0);
+ const [pendingEnvironmentIds, setPendingEnvironmentIds] = useState