diff --git a/apps/mobile/src/features/threads/git/GitBranchesSheet.occupancy.test.tsx b/apps/mobile/src/features/threads/git/GitBranchesSheet.occupancy.test.tsx index 436fb4dd0b40..040af6f7c946 100644 --- a/apps/mobile/src/features/threads/git/GitBranchesSheet.occupancy.test.tsx +++ b/apps/mobile/src/features/threads/git/GitBranchesSheet.occupancy.test.tsx @@ -5,6 +5,7 @@ import { expect, it, vi } from "vite-plus/test"; const checkout = vi.hoisted(() => ({ projectRoot: "", worktreePath: null as string | null, + removedPath: null as string | null, branches: [] as Array<{ name: string; worktreePath: string | null }>, })); @@ -41,18 +42,34 @@ vi.mock("../../../state/use-thread-selection", () => ({ vi.mock("../../../state/use-thread-detail", () => ({ useSelectedThreadWorktreePath: () => checkout.worktreePath, })); -vi.mock("../../../state/use-selected-thread-git-state", () => ({ - useSelectedThreadGitState: () => ({ - selectedThreadBranches: checkout.branches, - selectedThreadBranchesLoading: false, - gitOperationLabel: null, +// A removed checkout is not a repository, so listing refs there finds none. +vi.mock("../../../state/queries", () => ({ + useBranches: ({ cwd }: { cwd: string | null }) => ({ + data: { refs: cwd === checkout.removedPath ? [] : checkout.branches }, + isPending: false, }), })); +vi.mock("../../../state/use-vcs-action-state", () => ({ + useVcsActionState: () => ({ currentLabel: null, hookName: null }), +})); +vi.mock("../../../state/sourceControl", () => ({ + sourceControlEnvironment: { discovery: () => null }, +})); vi.mock("../../../state/use-selected-thread-git-actions", () => ({ useSelectedThreadGitActions: () => ({ canChangeThreadBranch: true }), })); -vi.mock("../../../state/query", () => ({ useEnvironmentQuery: () => ({ data: null }) })); -vi.mock("../../../state/vcs", () => ({ vcsEnvironment: { branch: () => null } })); +vi.mock("../../../state/query", () => ({ + useEnvironmentQuery: (query: { statusCwd?: string } | null) => ({ + data: + query?.statusCwd === undefined ? null : { isRepo: query.statusCwd !== checkout.removedPath }, + }), +})); +vi.mock("../../../state/vcs", () => ({ + vcsEnvironment: { + branch: () => null, + status: ({ input }: { input: { cwd: string } }) => ({ statusCwd: input.cwd }), + }, +})); import { GitBranchesSheet } from "./GitBranchesSheet"; @@ -96,6 +113,14 @@ it("recognizes both the main checkout and a linked worktree as this thread's che { name: "feature/linked", subtitle: "Checked out in this thread", disabled: false }, { name: "main", subtitle: "Checked out in another worktree", disabled: true }, ]); + + // A removed worktree leaves the project checkout as the one the thread can move to. + checkout.removedPath = linked; + expect(rows()).toEqual([ + { name: "feature/available", subtitle: "Local branch", disabled: false }, + { name: "feature/linked", subtitle: "Checked out in another worktree", disabled: true }, + { name: "main", subtitle: "Checked out in this thread", disabled: false }, + ]); } finally { act(() => root.unmount()); } diff --git a/apps/mobile/src/features/threads/git/GitBranchesSheet.test.tsx b/apps/mobile/src/features/threads/git/GitBranchesSheet.test.tsx index fef45b5c8800..7386d98ac21d 100644 --- a/apps/mobile/src/features/threads/git/GitBranchesSheet.test.tsx +++ b/apps/mobile/src/features/threads/git/GitBranchesSheet.test.tsx @@ -42,9 +42,10 @@ vi.mock("../../../state/use-thread-selection", () => ({ }), })); vi.mock("../../../state/use-selected-thread-worktree", () => ({ - useSelectedThreadWorktree: () => ({ + useSelectedThreadGitCheckout: () => ({ selectedThreadCwd: "/repo", selectedThreadWorktreePath: null, + checkoutMissing: false, }), })); vi.mock("../../../state/use-selected-thread-git-state", () => ({ diff --git a/apps/mobile/src/features/threads/git/GitBranchesSheet.tsx b/apps/mobile/src/features/threads/git/GitBranchesSheet.tsx index 7c610a445667..5b5f86ef020d 100644 --- a/apps/mobile/src/features/threads/git/GitBranchesSheet.tsx +++ b/apps/mobile/src/features/threads/git/GitBranchesSheet.tsx @@ -12,7 +12,7 @@ import { useEnvironmentQuery } from "../../../state/query"; import { useThreadSelection } from "../../../state/use-thread-selection"; import { useSelectedThreadGitActions } from "../../../state/use-selected-thread-git-actions"; import { useSelectedThreadGitState } from "../../../state/use-selected-thread-git-state"; -import { useSelectedThreadWorktree } from "../../../state/use-selected-thread-worktree"; +import { useSelectedThreadGitCheckout } from "../../../state/use-selected-thread-worktree"; import { vcsEnvironment } from "../../../state/vcs"; import { SheetActionButton } from "./gitSheetComponents"; @@ -25,7 +25,7 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) { const gt = useGT(); const navigation = useNavigation(); const { selectedThread } = useThreadSelection(); - const { selectedThreadCwd } = useSelectedThreadWorktree(); + const { selectedThreadCwd } = useSelectedThreadGitCheckout(); const gitState = useSelectedThreadGitState(); const gitActions = useSelectedThreadGitActions(); const { canChangeThreadBranch } = gitActions; diff --git a/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx b/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx index f84ea9d0ccc2..53577bcebb61 100644 --- a/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx +++ b/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx @@ -33,7 +33,10 @@ import { useEnvironmentQuery } from "../../../state/query"; import { useThreadSelection } from "../../../state/use-thread-selection"; import { useSelectedThreadGitActions } from "../../../state/use-selected-thread-git-actions"; import { useSelectedThreadGitState } from "../../../state/use-selected-thread-git-state"; -import { useSelectedThreadWorktree } from "../../../state/use-selected-thread-worktree"; +import { + useSelectedThreadGitCheckout, + useSelectedThreadWorktree, +} from "../../../state/use-selected-thread-worktree"; import { vcsEnvironment } from "../../../state/vcs"; import { menuItemIconName, statusSummary } from "./gitSheetComponents"; import { @@ -81,6 +84,7 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) { context: selectedThread ?? undefined, }); const { selectedThreadCwd, selectedThreadWorktreePath } = useSelectedThreadWorktree(); + const { checkoutMissing } = useSelectedThreadGitCheckout(); const linkedPrLines = useLinkedPullRequestLines(selectedThread, selectedEnvironmentRuntime); const linkedPrActions = useLinkedPullRequestActions({ thread: selectedThread, @@ -331,7 +335,7 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) { ? gt("Switch branch, create branch, or move to a worktree") : gt("View branches and worktrees") } - disabled={busy || !isRepo} + disabled={busy || (!isRepo && !checkoutMissing)} onPress={() => presentRoute(() => navigation.navigate("GitBranches", { diff --git a/apps/mobile/src/state/use-selected-thread-git-actions.test.ts b/apps/mobile/src/state/use-selected-thread-git-actions.test.ts index 548ae2d3ce6b..d1f6f98ed40d 100644 --- a/apps/mobile/src/state/use-selected-thread-git-actions.test.ts +++ b/apps/mobile/src/state/use-selected-thread-git-actions.test.ts @@ -44,9 +44,10 @@ vi.mock("./use-thread-selection", () => ({ }), })); vi.mock("./use-selected-thread-worktree", () => ({ - useSelectedThreadWorktree: () => ({ + useSelectedThreadGitCheckout: () => ({ selectedThreadCwd: "/repo", selectedThreadWorktreePath: null, + checkoutMissing: false, }), })); vi.mock("./queries", () => ({ diff --git a/apps/mobile/src/state/use-selected-thread-git-actions.ts b/apps/mobile/src/state/use-selected-thread-git-actions.ts index 42336835cc44..1e8df5b3d48d 100644 --- a/apps/mobile/src/state/use-selected-thread-git-actions.ts +++ b/apps/mobile/src/state/use-selected-thread-git-actions.ts @@ -37,7 +37,7 @@ import { import { useAtomCommand } from "./use-atom-command"; import { showGitActionResult } from "./use-vcs-action-state"; import { useThreadSelection } from "./use-thread-selection"; -import { useSelectedThreadWorktree } from "./use-selected-thread-worktree"; +import { useSelectedThreadGitCheckout } from "./use-selected-thread-worktree"; function refreshFailureMessage(cause: Cause.Cause): string { const error = Cause.squash(cause); @@ -75,7 +75,7 @@ export function useSelectedThreadGitActions() { AuthOrchestrationOperateScope, ); const canChangeThreadBranch = canWriteSourceControl && canOperateThread; - const { selectedThreadCwd, selectedThreadWorktreePath } = useSelectedThreadWorktree(); + const { selectedThreadCwd, selectedThreadWorktreePath } = useSelectedThreadGitCheckout(); const runStackedAction = useAtomCommand( vcsActionManager.runStackedAction({ environmentId: selectedThread?.environmentId ?? null, diff --git a/apps/mobile/src/state/use-selected-thread-git-state.test.tsx b/apps/mobile/src/state/use-selected-thread-git-state.test.tsx index 73c3b22d02ab..3318c981ff82 100644 --- a/apps/mobile/src/state/use-selected-thread-git-state.test.tsx +++ b/apps/mobile/src/state/use-selected-thread-git-state.test.tsx @@ -18,7 +18,7 @@ vi.mock("./use-thread-selection", () => ({ }), })); vi.mock("./use-selected-thread-worktree", () => ({ - useSelectedThreadWorktree: () => ({ selectedThreadCwd: harness.cwd }), + useSelectedThreadGitCheckout: () => ({ selectedThreadCwd: harness.cwd }), })); vi.mock("./use-vcs-action-state", () => ({ useVcsActionState: () => ({ currentLabel: null }), diff --git a/apps/mobile/src/state/use-selected-thread-git-state.ts b/apps/mobile/src/state/use-selected-thread-git-state.ts index b48429e8fe28..1c5ec0a5dcc5 100644 --- a/apps/mobile/src/state/use-selected-thread-git-state.ts +++ b/apps/mobile/src/state/use-selected-thread-git-state.ts @@ -9,12 +9,12 @@ import { useEnvironmentQuery } from "./query"; import { sourceControlEnvironment } from "./sourceControl"; import { useVcsActionState } from "./use-vcs-action-state"; import { useThreadSelection } from "./use-thread-selection"; -import { useSelectedThreadWorktree } from "./use-selected-thread-worktree"; +import { useSelectedThreadGitCheckout } from "./use-selected-thread-worktree"; export function useSelectedThreadGitState() { const messages = useMessages(); const { selectedThread } = useThreadSelection(); - const { selectedThreadCwd } = useSelectedThreadWorktree(); + const { selectedThreadCwd } = useSelectedThreadGitCheckout(); const selectedThreadGitTarget = { environmentId: selectedThread?.environmentId ?? null, diff --git a/apps/mobile/src/state/use-selected-thread-worktree.ts b/apps/mobile/src/state/use-selected-thread-worktree.ts index 74d45cc83f8c..72903be24102 100644 --- a/apps/mobile/src/state/use-selected-thread-worktree.ts +++ b/apps/mobile/src/state/use-selected-thread-worktree.ts @@ -1,5 +1,9 @@ +import { isThreadCheckoutMissing } from "@t3tools/client-runtime/thread-checkout"; + +import { useEnvironmentQuery } from "./query"; import { useSelectedThreadWorktreePath } from "./use-thread-detail"; import { useThreadSelection } from "./use-thread-selection"; +import { vcsEnvironment } from "./vcs"; import { resolvePreferredThreadWorktreePath } from "../features/terminal/terminalLaunchContext"; export function useSelectedThreadWorktree() { @@ -16,3 +20,31 @@ export function useSelectedThreadWorktree() { selectedThreadCwd: selectedThreadWorktreePath ?? selectedThreadProject?.workspaceRoot ?? null, }; } + +/** The checkout git actions use: the project checkout once the thread's own was removed. */ +export function useSelectedThreadGitCheckout() { + const { selectedThread, selectedThreadProject } = useThreadSelection(); + const worktree = useSelectedThreadWorktree(); + const environmentId = selectedThread?.environmentId ?? null; + const worktreePath = worktree.selectedThreadWorktreePath; + const projectCwd = selectedThreadProject?.workspaceRoot ?? null; + const worktreeStatus = useEnvironmentQuery( + environmentId !== null && worktreePath !== null + ? vcsEnvironment.status({ environmentId, input: { cwd: worktreePath } }) + : null, + ); + const worktreeIsRepo = worktreeStatus.data?.isRepo; + const projectStatus = useEnvironmentQuery( + environmentId !== null && worktreeIsRepo === false && projectCwd !== null + ? vcsEnvironment.status({ environmentId, input: { cwd: projectCwd } }) + : null, + ); + const checkoutMissing = isThreadCheckoutMissing({ + worktreePath, + worktreeIsRepo, + projectIsRepo: projectStatus.data?.isRepo, + }); + return checkoutMissing + ? { selectedThreadWorktreePath: null, selectedThreadCwd: projectCwd, checkoutMissing } + : { ...worktree, checkoutMissing }; +} diff --git a/apps/web/src/components/BranchToolbarBranchSelector.tsx b/apps/web/src/components/BranchToolbarBranchSelector.tsx index 591f7c5ab969..1c2e761d5488 100644 --- a/apps/web/src/components/BranchToolbarBranchSelector.tsx +++ b/apps/web/src/components/BranchToolbarBranchSelector.tsx @@ -1,3 +1,4 @@ +import { isThreadCheckoutMissing } from "@t3tools/client-runtime/thread-checkout"; import { thrownErrorMessage } from "@t3tools/client-runtime/errors"; import { ThreadDetailsControl } from "./chat/ThreadDetailsControl"; import { ComposerContextLabel } from "./ComposerContextLabel"; @@ -174,7 +175,7 @@ export function BranchToolbarBranchSelector({ ? serverThread.worktreePath : (draftThread?.worktreePath ?? null); const activeProjectCwd = activeProject?.workspaceRoot ?? null; - const branchCwd = activeWorktreePath ?? activeProjectCwd; + const statusCwd = activeWorktreePath ?? activeProjectCwd; const hasServerThread = serverThread !== null; const canUpdateThreadBranch = !hasServerThread || canOperateThread; const canChangeThreadBranch = canWriteSourceControl && canUpdateThreadBranch; @@ -258,11 +259,11 @@ export function BranchToolbarBranchSelector({ const [branchQuery, setBranchQuery] = useState(""); const branchStatusQuery = useEnvironmentQuery( - branchCwd === null + statusCwd === null ? null : vcsEnvironment.status({ environmentId, - input: { cwd: branchCwd }, + input: { cwd: statusCwd }, }), ); const projectStatusQuery = useEnvironmentQuery( @@ -270,6 +271,15 @@ export function BranchToolbarBranchSelector({ ? null : vcsEnvironment.status({ environmentId, input: { cwd: activeProjectCwd } }), ); + const checkoutMissing = isThreadCheckoutMissing({ + worktreePath: activeWorktreePath, + worktreeIsRepo: branchStatusQuery.data?.isRepo, + projectIsRepo: projectStatusQuery.data?.isRepo, + }); + const branchCwd = checkoutMissing ? activeProjectCwd : statusCwd; + // Refs resolve against the checkout the thread can move to, not one that is gone. + const selectableWorktreePath = (worktreePath: string | null) => + checkoutMissing ? null : worktreePath; const activeProjectCheckoutRoot = projectStatusQuery.data?.workingTree.rootPath; const trimmedBranchQuery = branchQuery.trim(); const branchRefState = usePaginatedBranches( @@ -298,7 +308,7 @@ export function BranchToolbarBranchSelector({ : resolveBranchSelectionTarget({ activeProjectCwd, activeProjectCheckoutRoot, - activeWorktreePath, + activeWorktreePath: selectableWorktreePath(activeWorktreePath), refName, }).nextWorktreePath, }); @@ -482,7 +492,7 @@ export function BranchToolbarBranchSelector({ const selectionTarget = resolveBranchSelectionTarget({ activeProjectCwd, activeProjectCheckoutRoot, - activeWorktreePath: latest.worktreePath, + activeWorktreePath: selectableWorktreePath(latest.worktreePath), refName, }); @@ -571,6 +581,20 @@ export function BranchToolbarBranchSelector({ if (!canChangeThreadBranch) return; const name = sanitizeNewRefName(rawName); if (!branchCwd || !name || isBranchActionPending) return; + const latest = readLatestThreadState(); + // Refuse before switching the checkout, or a running thread stays bound to the missing one. + if ( + isWorktreeChangeBlocked({ + runtime: latest.runtime, + currentWorktreePath: latest.worktreePath, + nextWorktreePath: selectableWorktreePath(activeWorktreePath), + }) + ) { + toastManager.add( + stackedThreadToast({ type: "warning", title: messages(WORKTREE_CHANGE_BLOCKED_MESSAGE) }), + ); + return; + } latestSelectionIdRef.current++; setIsBranchMenuOpen(false); @@ -589,7 +613,7 @@ export function BranchToolbarBranchSelector({ }); if (createBranchResult._tag === "Success") { const nextBranchName = createBranchResult.value.refName; - const applied = setThreadBranch(nextBranchName, activeWorktreePath); + const applied = setThreadBranch(nextBranchName, selectableWorktreePath(activeWorktreePath)); if (applied) { setBranchHold({ branch: nextBranchName, @@ -794,7 +818,7 @@ export function BranchToolbarBranchSelector({ !resolveBranchSelectionTarget({ activeProjectCwd, activeProjectCheckoutRoot, - activeWorktreePath, + activeWorktreePath: selectableWorktreePath(activeWorktreePath), refName, }).reuseExistingWorktree)) || isWorktreeChangeBlockedForRef(refName) diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index a731a5798e19..d65f474e8906 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -1,3 +1,4 @@ +import { isThreadCheckoutMissing } from "@t3tools/client-runtime/thread-checkout"; import { m } from "../i18n/messages"; import { thrownErrorMessage } from "@t3tools/client-runtime/errors"; import { useGT, useMessages } from "gt-react"; @@ -1774,7 +1775,22 @@ export default function ChatView(props: ChatViewProps) { rememberCheckoutIsRepo(environmentId, gitStatusCwd, liveIsGitRepo); } }, [environmentId, gitStatusCwd, liveIsGitRepo]); - const isGitRepo = liveIsGitRepo ?? recallCheckoutIsRepo(environmentId, gitStatusCwd) ?? true; + // A removed thread checkout keeps git controls so the thread can move to another checkout. + const projectGitStatus = useAtomValue( + liveIsGitRepo === false && activeThreadWorktreePath !== null && activeProjectCwd !== null + ? chatGitStatusAtom( + vcsEnvironment.status({ environmentId, input: { cwd: activeProjectCwd } }), + ) + : NO_CHAT_GIT_STATUS_ATOM, + ); + const threadCheckoutMissing = isThreadCheckoutMissing({ + worktreePath: activeThreadWorktreePath, + worktreeIsRepo: liveIsGitRepo, + projectIsRepo: projectGitStatus?.isRepo, + }); + const isGitRepo = + threadCheckoutMissing || + (liveIsGitRepo ?? recallCheckoutIsRepo(environmentId, gitStatusCwd) ?? true); // Provider-native subagents cannot take messages; approvals and questions go to the top-level parent. const showProviderSubagentBar = isProviderSubagent; const composerMounted = !showProviderSubagentBar; @@ -3960,6 +3976,7 @@ export default function ChatView(props: ChatViewProps) { gitCwd={gitCwd} workspaceMutationId={workspaceMutationId} isGitRepo={isGitRepo} + threadCheckoutMissing={threadCheckoutMissing} envLocked={envLocked} availableEnvironments={logicalProjectEnvironments} autoEnvironmentLabel={autoEnvironmentLabel} diff --git a/apps/web/src/components/chat/ThreadDetailsPanel.browser.test.tsx b/apps/web/src/components/chat/ThreadDetailsPanel.browser.test.tsx index 52e5033d58d4..a888ab2c3faa 100644 --- a/apps/web/src/components/chat/ThreadDetailsPanel.browser.test.tsx +++ b/apps/web/src/components/chat/ThreadDetailsPanel.browser.test.tsx @@ -161,6 +161,7 @@ function Panel({ fixture }: { fixture: ReturnType }) { gitCwd={state.folder} workspaceMutationId={null} isGitRepo={false} + threadCheckoutMissing={false} envLocked availableEnvironments={[]} onEnvModeChange={noop} diff --git a/apps/web/src/components/chat/ThreadDetailsPanel.tsx b/apps/web/src/components/chat/ThreadDetailsPanel.tsx index d7c309074200..707376c1544e 100644 --- a/apps/web/src/components/chat/ThreadDetailsPanel.tsx +++ b/apps/web/src/components/chat/ThreadDetailsPanel.tsx @@ -70,6 +70,8 @@ interface ThreadDetailsPanelProps extends Pick< gitCwd: string | null; workspaceMutationId: string | null; isGitRepo: boolean; + // The thread's folder was removed: its git actions have nothing to act on until it is rebound. + threadCheckoutMissing: boolean; envLocked: boolean; availableEnvironments: readonly EnvironmentOption[]; autoEnvironmentLabel?: string | undefined; @@ -176,6 +178,7 @@ export function ThreadDetailsPanel(props: ThreadDetailsPanelProps) { pullRequests: !(offersGit && props.isGitRepo) && visible.branch, git: offersGit && + !props.threadCheckoutMissing && props.activeProjectName !== undefined && (visible.gitActions || (visible.changes && props.isGitRepo)), }; diff --git a/packages/client-runtime/package.json b/packages/client-runtime/package.json index c09deef7e4b3..825159a27172 100644 --- a/packages/client-runtime/package.json +++ b/packages/client-runtime/package.json @@ -79,6 +79,10 @@ "types": "./src/worktreeSetup.ts", "default": "./src/worktreeSetup.ts" }, + "./thread-checkout": { + "types": "./src/threadCheckout.ts", + "default": "./src/threadCheckout.ts" + }, "./load-balancing": { "types": "./src/load-balancing.ts", "default": "./src/load-balancing.ts" diff --git a/packages/client-runtime/src/threadCheckout.test.ts b/packages/client-runtime/src/threadCheckout.test.ts new file mode 100644 index 000000000000..d8f70b5b309f --- /dev/null +++ b/packages/client-runtime/src/threadCheckout.test.ts @@ -0,0 +1,27 @@ +import { describe, expect, it } from "vite-plus/test"; + +import { isThreadCheckoutMissing } from "./threadCheckout.ts"; + +describe("isThreadCheckoutMissing", () => { + it.each([ + { worktreePath: "/external-wt", worktreeIsRepo: false, projectIsRepo: true, missing: true }, + { worktreePath: "/external-wt", worktreeIsRepo: true, projectIsRepo: true, missing: false }, + // Unknown until both statuses load, and a project that is not a repo has nowhere to move to. + { + worktreePath: "/external-wt", + worktreeIsRepo: undefined, + projectIsRepo: true, + missing: false, + }, + { + worktreePath: "/external-wt", + worktreeIsRepo: false, + projectIsRepo: undefined, + missing: false, + }, + { worktreePath: "/external-wt", worktreeIsRepo: false, projectIsRepo: false, missing: false }, + { worktreePath: null, worktreeIsRepo: false, projectIsRepo: true, missing: false }, + ])("$worktreePath, worktree repo $worktreeIsRepo, project repo $projectIsRepo", (input) => { + expect(isThreadCheckoutMissing(input)).toBe(input.missing); + }); +}); diff --git a/packages/client-runtime/src/threadCheckout.ts b/packages/client-runtime/src/threadCheckout.ts new file mode 100644 index 000000000000..92e419d7559d --- /dev/null +++ b/packages/client-runtime/src/threadCheckout.ts @@ -0,0 +1,11 @@ +// A thread checkout Git no longer recognises inside a project it still does was removed, so git +// controls work from the project checkout and picking a ref there rebinds the thread. +export function isThreadCheckoutMissing(input: { + worktreePath: string | null; + worktreeIsRepo: boolean | undefined; + projectIsRepo: boolean | undefined; +}): boolean { + return ( + input.worktreePath !== null && input.worktreeIsRepo === false && input.projectIsRepo === true + ); +}