Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit ed32ba1

Browse files
committed
feat: add terminalAutoShow setting for auto-showing terminal on command execution
Adds a new opt-in setting "terminalAutoShow" that: - When using VS Code terminal (shell integration enabled): automatically shows the terminal panel when Roo runs a command - When using Inline Terminal (execa mode): auto-expands command output in the chat so users can always see what is happening Addresses options (a) and (c) from Issue #12277. Changes: - packages/types: add terminalAutoShow to schema + ExtensionState - src/core/tools/ExecuteCommandTool: conditionally call terminal.show() - src/core/webview/ClineProvider: thread setting through state - webview-ui: add checkbox in TerminalSettings, auto-expand in CommandExecution - i18n: add English strings for the new setting
1 parent ad25634 commit ed32ba1

9 files changed

Lines changed: 45 additions & 4 deletions

File tree

packages/types/src/global-settings.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ export const globalSettingsSchema = z.object({
176176
terminalZshOhMy: z.boolean().optional(),
177177
terminalZshP10k: z.boolean().optional(),
178178
terminalZdotdir: z.boolean().optional(),
179+
terminalAutoShow: z.boolean().optional(),
179180
execaShellPath: z.string().optional(),
180181

181182
diagnosticsEnabled: z.boolean().optional(),
@@ -356,6 +357,7 @@ export const EVALS_SETTINGS: RooCodeSettings = {
356357
terminalZshP10k: false,
357358
terminalZdotdir: true,
358359
terminalShellIntegrationDisabled: true,
360+
terminalAutoShow: false,
359361

360362
diagnosticsEnabled: true,
361363

packages/types/src/vscode-extension-host.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ export type ExtensionState = Pick<
282282
| "terminalZshOhMy"
283283
| "terminalZshP10k"
284284
| "terminalZdotdir"
285+
| "terminalAutoShow"
285286
| "execaShellPath"
286287
| "diagnosticsEnabled"
287288
| "language"

src/core/tools/ExecuteCommandTool.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export class ExecuteCommandTool extends BaseTool<"execute_command"> {
7575
const provider = await task.providerRef.deref()
7676
const providerState = await provider?.getState()
7777

78-
const { terminalShellIntegrationDisabled = true } = providerState ?? {}
78+
const { terminalShellIntegrationDisabled = true, terminalAutoShow = false } = providerState ?? {}
7979

8080
// Get command execution timeout from VSCode configuration (in seconds)
8181
const commandExecutionTimeoutSeconds = vscode.workspace
@@ -157,6 +157,7 @@ export type ExecuteCommandOptions = {
157157
command: string
158158
customCwd?: string
159159
terminalShellIntegrationDisabled?: boolean
160+
terminalAutoShow?: boolean
160161
commandExecutionTimeout?: number
161162
agentTimeout?: number
162163
}
@@ -168,6 +169,7 @@ export async function executeCommandInTerminal(
168169
command,
169170
customCwd,
170171
terminalShellIntegrationDisabled = true,
172+
terminalAutoShow = false,
171173
commandExecutionTimeout = 0,
172174
agentTimeout = 0,
173175
}: ExecuteCommandOptions,
@@ -369,7 +371,9 @@ export async function executeCommandInTerminal(
369371
const terminal = await TerminalRegistry.getOrCreateTerminal(workingDir, task.taskId, terminalProvider)
370372

371373
if (terminal instanceof Terminal) {
372-
terminal.terminal.show(true)
374+
if (terminalAutoShow) {
375+
terminal.terminal.show(true)
376+
}
373377

374378
// Update the working directory in case the terminal we asked for has
375379
// a different working directory so that the model will know where the

src/core/webview/ClineProvider.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2162,6 +2162,7 @@ export class ClineProvider
21622162
terminalZshOhMy,
21632163
terminalZshP10k,
21642164
terminalZdotdir,
2165+
terminalAutoShow,
21652166
mcpEnabled,
21662167
currentApiConfigName,
21672168
listApiConfigMeta,
@@ -2282,6 +2283,7 @@ export class ClineProvider
22822283
terminalZshOhMy: terminalZshOhMy ?? false,
22832284
terminalZshP10k: terminalZshP10k ?? false,
22842285
terminalZdotdir: terminalZdotdir ?? false,
2286+
terminalAutoShow: terminalAutoShow ?? false,
22852287
mcpEnabled: mcpEnabled ?? true,
22862288
currentApiConfigName: currentApiConfigName ?? "default",
22872289
listApiConfigMeta: listApiConfigMeta ?? [],
@@ -2509,6 +2511,7 @@ export class ClineProvider
25092511
terminalZshOhMy: stateValues.terminalZshOhMy ?? false,
25102512
terminalZshP10k: stateValues.terminalZshP10k ?? false,
25112513
terminalZdotdir: stateValues.terminalZdotdir ?? false,
2514+
terminalAutoShow: stateValues.terminalAutoShow ?? false,
25122515
mode: stateValues.mode ?? defaultModeSlug,
25132516
language: stateValues.language ?? formatLanguage(vscode.env.language),
25142517
mcpEnabled: stateValues.mcpEnabled ?? true,

webview-ui/src/components/chat/CommandExecution.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ interface CommandExecutionProps {
3535
export const CommandExecution = ({ executionId, text, icon, title }: CommandExecutionProps) => {
3636
const {
3737
terminalShellIntegrationDisabled = false,
38+
terminalAutoShow = false,
3839
allowedCommands = [],
3940
deniedCommands = [],
4041
setAllowedCommands,
@@ -44,8 +45,10 @@ export const CommandExecution = ({ executionId, text, icon, title }: CommandExec
4445
const { command, output: parsedOutput } = useMemo(() => parseCommandAndOutput(text), [text])
4546

4647
// If we aren't opening the VSCode terminal for this command then we default
47-
// to expanding the command execution output.
48-
const [isExpanded, setIsExpanded] = useState(terminalShellIntegrationDisabled)
48+
// to expanding the command execution output. When terminalAutoShow is
49+
// enabled, also auto-expand output regardless of terminal mode so users
50+
// can always see what is happening.
51+
const [isExpanded, setIsExpanded] = useState(terminalShellIntegrationDisabled || terminalAutoShow)
4952
const [streamingOutput, setStreamingOutput] = useState("")
5053
const [status, setStatus] = useState<CommandExecutionStatus | null>(null)
5154

webview-ui/src/components/settings/SettingsView.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
183183
terminalZshOhMy,
184184
terminalZshP10k,
185185
terminalZdotdir,
186+
terminalAutoShow,
186187
writeDelayMs,
187188
showRooIgnoredFiles,
188189
enableSubfolderRules,
@@ -396,6 +397,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
396397
terminalZshOhMy,
397398
terminalZshP10k,
398399
terminalZdotdir,
400+
terminalAutoShow,
399401
terminalOutputPreviewSize: terminalOutputPreviewSize ?? "medium",
400402
mcpEnabled,
401403
maxOpenTabsContext: Math.min(Math.max(0, maxOpenTabsContext ?? 20), 500),
@@ -862,6 +864,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
862864
terminalZshOhMy={terminalZshOhMy}
863865
terminalZshP10k={terminalZshP10k}
864866
terminalZdotdir={terminalZdotdir}
867+
terminalAutoShow={terminalAutoShow}
865868
setCachedStateField={setCachedStateField}
866869
/>
867870
)}

webview-ui/src/components/settings/TerminalSettings.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ type TerminalSettingsProps = HTMLAttributes<HTMLDivElement> & {
2626
terminalZshOhMy?: boolean
2727
terminalZshP10k?: boolean
2828
terminalZdotdir?: boolean
29+
terminalAutoShow?: boolean
2930
setCachedStateField: SetCachedStateField<
3031
| "terminalOutputPreviewSize"
3132
| "terminalShellIntegrationTimeout"
@@ -36,6 +37,7 @@ type TerminalSettingsProps = HTMLAttributes<HTMLDivElement> & {
3637
| "terminalZshOhMy"
3738
| "terminalZshP10k"
3839
| "terminalZdotdir"
40+
| "terminalAutoShow"
3941
>
4042
}
4143

@@ -49,6 +51,7 @@ export const TerminalSettings = ({
4951
terminalZshOhMy,
5052
terminalZshP10k,
5153
terminalZdotdir,
54+
terminalAutoShow,
5255
setCachedStateField,
5356
className,
5457
...props
@@ -124,6 +127,21 @@ export const TerminalSettings = ({
124127
{t("settings:terminal.outputPreviewSize.description")}
125128
</div>
126129
</SearchableSetting>
130+
131+
<SearchableSetting
132+
settingId="terminal-auto-show"
133+
section="terminal"
134+
label={t("settings:terminal.autoShow.label")}>
135+
<VSCodeCheckbox
136+
checked={terminalAutoShow ?? false}
137+
onChange={(e: any) => setCachedStateField("terminalAutoShow", e.target.checked)}
138+
data-testid="terminal-auto-show-checkbox">
139+
<span className="font-medium">{t("settings:terminal.autoShow.label")}</span>
140+
</VSCodeCheckbox>
141+
<div className="text-vscode-descriptionForeground text-sm mt-1">
142+
{t("settings:terminal.autoShow.description")}
143+
</div>
144+
</SearchableSetting>
127145
</div>
128146
</div>
129147

webview-ui/src/context/ExtensionStateContext.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ export interface ExtensionStateContextType extends ExtensionState {
8282
setTerminalShellIntegrationTimeout: (value: number) => void
8383
terminalShellIntegrationDisabled?: boolean
8484
setTerminalShellIntegrationDisabled: (value: boolean) => void
85+
terminalAutoShow?: boolean
86+
setTerminalAutoShow: (value: boolean) => void
8587
terminalZdotdir?: boolean
8688
setTerminalZdotdir: (value: boolean) => void
8789
setTtsEnabled: (value: boolean) => void
@@ -544,6 +546,7 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode
544546
setState((prevState) => ({ ...prevState, terminalShellIntegrationTimeout: value })),
545547
setTerminalShellIntegrationDisabled: (value) =>
546548
setState((prevState) => ({ ...prevState, terminalShellIntegrationDisabled: value })),
549+
setTerminalAutoShow: (value) => setState((prevState) => ({ ...prevState, terminalAutoShow: value })),
547550
setTerminalZdotdir: (value) => setState((prevState) => ({ ...prevState, terminalZdotdir: value })),
548551
setMcpEnabled: (value) => setState((prevState) => ({ ...prevState, mcpEnabled: value })),
549552
setTaskSyncEnabled: (value) => setState((prevState) => ({ ...prevState, taskSyncEnabled: value }) as any),

webview-ui/src/i18n/locales/en/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,10 @@
754754
"label": "Terminal character limit",
755755
"description": "Overrides the line limit to prevent memory issues by enforcing a hard cap on output size. If exceeded, keeps the beginning and end and shows a placeholder to Roo where content is skipped. <0>Learn more</0>"
756756
},
757+
"autoShow": {
758+
"label": "Auto-show terminal on command execution",
759+
"description": "Automatically reveal the terminal panel when Roo runs a command. When using the VS Code terminal (shell integration enabled), the terminal panel is shown. When using the Inline Terminal, command output in chat is auto-expanded instead."
760+
},
757761
"outputPreviewSize": {
758762
"label": "Command output preview size",
759763
"description": "Controls how much command output Roo sees directly. Full output is always saved and accessible when needed.",

0 commit comments

Comments
 (0)