feat(cli): run setup commands in right-side split pane (#409)

* feat: run setup script in split pane so main terminal stays interactive (#381)

Instead of running the worktree setup script in the main terminal pane
(blocking user interaction), queue a setup-split signal that TerminalPane
consumes on mount — creating the initial pane clean, then splitting right
and injecting the command into the new pane's PTY.

* fix: address review findings

* fix(terminal): run context menu Close Pane through request-close lifecycle
This commit is contained in:
Jinjing
2026-04-08 21:45:27 -07:00
committed by GitHub
parent 92a8726046
commit cd86a49ea4
2 changed files with 6 additions and 10 deletions
@@ -503,8 +503,8 @@ export default function TerminalPane({
const contextMenu = useTerminalPaneContextMenu({
managerRef,
toggleExpandPane,
onSetTitle: handleStartRename,
tabId
onRequestClosePane: handleRequestClosePane,
onSetTitle: handleStartRename
})
const effectiveAppearance = settings
@@ -1,14 +1,13 @@
import { useEffect, useRef, useState } from 'react'
import type { ManagedPane, PaneManager } from '@/lib/pane-manager/pane-manager'
import { useAppStore } from '@/store'
const CLOSE_ALL_CONTEXT_MENUS_EVENT = 'orca-close-all-context-menus'
type UseTerminalPaneContextMenuDeps = {
managerRef: React.RefObject<PaneManager | null>
toggleExpandPane: (paneId: number) => void
onRequestClosePane: (paneId: number) => void
onSetTitle: (paneId: number) => void
tabId: string
}
type TerminalMenuState = {
@@ -32,8 +31,8 @@ type TerminalMenuState = {
export function useTerminalPaneContextMenu({
managerRef,
toggleExpandPane,
onSetTitle,
tabId
onRequestClosePane,
onSetTitle
}: UseTerminalPaneContextMenuDeps): TerminalMenuState {
const contextPaneIdRef = useRef<number | null>(null)
const menuOpenedAtRef = useRef(0)
@@ -105,10 +104,7 @@ export function useTerminalPaneContextMenu({
const onClosePane = (): void => {
const pane = resolveMenuPane()
if (pane && (managerRef.current?.getPanes().length ?? 0) > 1) {
// Why: clear the cache timer for this pane before closing, so the sidebar
// doesn't show a stale countdown for a pane that no longer exists.
useAppStore.getState().setCacheTimerStartedAt(`${tabId}:${pane.id}`, null)
managerRef.current?.closePane(pane.id)
onRequestClosePane(pane.id)
}
}