Compare commits

...

1 Commits

Author SHA1 Message Date
opencode-agent[bot] dd098e597d fix(tui): copy active git worktree path 2026-06-05 10:26:23 +00:00
+12 -9
View File
@@ -551,12 +551,15 @@ function App(props: { onSnapshot?: () => Promise<string[]> }) {
) )
const connected = useConnected() const connected = useConnected()
const currentWorktreeWorkspace = createMemo(() => { const currentWorktreePath = createMemo(() => {
const workspaceID = project.workspace.current() const workspaceID = project.workspace.current()
if (!workspaceID) return if (workspaceID) {
const workspace = project.workspace.get(workspaceID) const workspace = project.workspace.get(workspaceID)
if (workspace?.type !== "worktree" || !workspace.directory) return if (workspace?.type === "worktree" && workspace.directory) return workspace.directory
return workspace }
const paths = project.instance.path()
return (paths.worktree === "/" ? undefined : paths.worktree) || paths.directory || undefined
}) })
const appCommands = createMemo(() => const appCommands = createMemo(() =>
[ [
@@ -598,11 +601,11 @@ function App(props: { onSnapshot?: () => Promise<string[]> }) {
name: "workspace.copy_path", name: "workspace.copy_path",
title: "Copy worktree path", title: "Copy worktree path",
category: "Workspace", category: "Workspace",
enabled: () => currentWorktreeWorkspace() !== undefined, enabled: () => currentWorktreePath() !== undefined,
run: async () => { run: async () => {
const workspace = currentWorktreeWorkspace() const worktreePath = currentWorktreePath()
if (!workspace?.directory) return if (!worktreePath) return
await Clipboard.copy(workspace.directory) await Clipboard.copy(worktreePath)
.then(() => toast.show({ message: "Copied worktree path", variant: "info" })) .then(() => toast.show({ message: "Copied worktree path", variant: "info" }))
.catch(toast.error) .catch(toast.error)
dialog.clear() dialog.clear()