From dd098e597dac02f2b130baac48b9631dd72073f1 Mon Sep 17 00:00:00 2001 From: "opencode-agent[bot]" Date: Fri, 5 Jun 2026 10:26:23 +0000 Subject: [PATCH] fix(tui): copy active git worktree path --- packages/opencode/src/cli/cmd/tui/app.tsx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/opencode/src/cli/cmd/tui/app.tsx b/packages/opencode/src/cli/cmd/tui/app.tsx index 3fbffde1833..ce6793a2412 100644 --- a/packages/opencode/src/cli/cmd/tui/app.tsx +++ b/packages/opencode/src/cli/cmd/tui/app.tsx @@ -551,12 +551,15 @@ function App(props: { onSnapshot?: () => Promise }) { ) const connected = useConnected() - const currentWorktreeWorkspace = createMemo(() => { + const currentWorktreePath = createMemo(() => { const workspaceID = project.workspace.current() - if (!workspaceID) return - const workspace = project.workspace.get(workspaceID) - if (workspace?.type !== "worktree" || !workspace.directory) return - return workspace + if (workspaceID) { + const workspace = project.workspace.get(workspaceID) + if (workspace?.type === "worktree" && workspace.directory) return workspace.directory + } + + const paths = project.instance.path() + return (paths.worktree === "/" ? undefined : paths.worktree) || paths.directory || undefined }) const appCommands = createMemo(() => [ @@ -598,11 +601,11 @@ function App(props: { onSnapshot?: () => Promise }) { name: "workspace.copy_path", title: "Copy worktree path", category: "Workspace", - enabled: () => currentWorktreeWorkspace() !== undefined, + enabled: () => currentWorktreePath() !== undefined, run: async () => { - const workspace = currentWorktreeWorkspace() - if (!workspace?.directory) return - await Clipboard.copy(workspace.directory) + const worktreePath = currentWorktreePath() + if (!worktreePath) return + await Clipboard.copy(worktreePath) .then(() => toast.show({ message: "Copied worktree path", variant: "info" })) .catch(toast.error) dialog.clear()