Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/types/src/global-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ export const globalSettingsSchema = z.object({
terminalZshOhMy: z.boolean().optional(),
terminalZshP10k: z.boolean().optional(),
terminalZdotdir: z.boolean().optional(),
terminalAutoShow: z.boolean().optional(),
execaShellPath: z.string().optional(),

diagnosticsEnabled: z.boolean().optional(),
Expand Down Expand Up @@ -356,6 +357,7 @@ export const EVALS_SETTINGS: RooCodeSettings = {
terminalZshP10k: false,
terminalZdotdir: true,
terminalShellIntegrationDisabled: true,
terminalAutoShow: false,

diagnosticsEnabled: true,

Expand Down
1 change: 1 addition & 0 deletions packages/types/src/vscode-extension-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ export type ExtensionState = Pick<
| "terminalZshOhMy"
| "terminalZshP10k"
| "terminalZdotdir"
| "terminalAutoShow"
| "execaShellPath"
| "diagnosticsEnabled"
| "language"
Expand Down
8 changes: 6 additions & 2 deletions src/core/tools/ExecuteCommandTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class ExecuteCommandTool extends BaseTool<"execute_command"> {
const provider = await task.providerRef.deref()
const providerState = await provider?.getState()

const { terminalShellIntegrationDisabled = true } = providerState ?? {}
const { terminalShellIntegrationDisabled = true, terminalAutoShow = false } = providerState ?? {}

// Get command execution timeout from VSCode configuration (in seconds)
const commandExecutionTimeoutSeconds = vscode.workspace
Expand Down Expand Up @@ -157,6 +157,7 @@ export type ExecuteCommandOptions = {
command: string
customCwd?: string
terminalShellIntegrationDisabled?: boolean
terminalAutoShow?: boolean
commandExecutionTimeout?: number
agentTimeout?: number
}
Expand All @@ -168,6 +169,7 @@ export async function executeCommandInTerminal(
command,
customCwd,
terminalShellIntegrationDisabled = true,
terminalAutoShow = false,
commandExecutionTimeout = 0,
agentTimeout = 0,
}: ExecuteCommandOptions,
Expand Down Expand Up @@ -369,7 +371,9 @@ export async function executeCommandInTerminal(
const terminal = await TerminalRegistry.getOrCreateTerminal(workingDir, task.taskId, terminalProvider)

if (terminal instanceof Terminal) {
terminal.terminal.show(true)
if (terminalAutoShow) {
terminal.terminal.show(true)
}

// Update the working directory in case the terminal we asked for has
// a different working directory so that the model will know where the
Expand Down
3 changes: 3 additions & 0 deletions src/core/webview/ClineProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2162,6 +2162,7 @@ export class ClineProvider
terminalZshOhMy,
terminalZshP10k,
terminalZdotdir,
terminalAutoShow,
mcpEnabled,
currentApiConfigName,
listApiConfigMeta,
Expand Down Expand Up @@ -2282,6 +2283,7 @@ export class ClineProvider
terminalZshOhMy: terminalZshOhMy ?? false,
terminalZshP10k: terminalZshP10k ?? false,
terminalZdotdir: terminalZdotdir ?? false,
terminalAutoShow: terminalAutoShow ?? false,
mcpEnabled: mcpEnabled ?? true,
currentApiConfigName: currentApiConfigName ?? "default",
listApiConfigMeta: listApiConfigMeta ?? [],
Expand Down Expand Up @@ -2509,6 +2511,7 @@ export class ClineProvider
terminalZshOhMy: stateValues.terminalZshOhMy ?? false,
terminalZshP10k: stateValues.terminalZshP10k ?? false,
terminalZdotdir: stateValues.terminalZdotdir ?? false,
terminalAutoShow: stateValues.terminalAutoShow ?? false,
mode: stateValues.mode ?? defaultModeSlug,
language: stateValues.language ?? formatLanguage(vscode.env.language),
mcpEnabled: stateValues.mcpEnabled ?? true,
Expand Down
7 changes: 5 additions & 2 deletions webview-ui/src/components/chat/CommandExecution.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ interface CommandExecutionProps {
export const CommandExecution = ({ executionId, text, icon, title }: CommandExecutionProps) => {
const {
terminalShellIntegrationDisabled = false,
terminalAutoShow = false,
allowedCommands = [],
deniedCommands = [],
setAllowedCommands,
Expand All @@ -44,8 +45,10 @@ export const CommandExecution = ({ executionId, text, icon, title }: CommandExec
const { command, output: parsedOutput } = useMemo(() => parseCommandAndOutput(text), [text])

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

Expand Down
3 changes: 3 additions & 0 deletions webview-ui/src/components/settings/SettingsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
terminalZshOhMy,
terminalZshP10k,
terminalZdotdir,
terminalAutoShow,
writeDelayMs,
showRooIgnoredFiles,
enableSubfolderRules,
Expand Down Expand Up @@ -396,6 +397,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
terminalZshOhMy,
terminalZshP10k,
terminalZdotdir,
terminalAutoShow,
terminalOutputPreviewSize: terminalOutputPreviewSize ?? "medium",
mcpEnabled,
maxOpenTabsContext: Math.min(Math.max(0, maxOpenTabsContext ?? 20), 500),
Expand Down Expand Up @@ -862,6 +864,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
terminalZshOhMy={terminalZshOhMy}
terminalZshP10k={terminalZshP10k}
terminalZdotdir={terminalZdotdir}
terminalAutoShow={terminalAutoShow}
setCachedStateField={setCachedStateField}
/>
)}
Expand Down
18 changes: 18 additions & 0 deletions webview-ui/src/components/settings/TerminalSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type TerminalSettingsProps = HTMLAttributes<HTMLDivElement> & {
terminalZshOhMy?: boolean
terminalZshP10k?: boolean
terminalZdotdir?: boolean
terminalAutoShow?: boolean
setCachedStateField: SetCachedStateField<
| "terminalOutputPreviewSize"
| "terminalShellIntegrationTimeout"
Expand All @@ -36,6 +37,7 @@ type TerminalSettingsProps = HTMLAttributes<HTMLDivElement> & {
| "terminalZshOhMy"
| "terminalZshP10k"
| "terminalZdotdir"
| "terminalAutoShow"
>
}

Expand All @@ -49,6 +51,7 @@ export const TerminalSettings = ({
terminalZshOhMy,
terminalZshP10k,
terminalZdotdir,
terminalAutoShow,
setCachedStateField,
className,
...props
Expand Down Expand Up @@ -124,6 +127,21 @@ export const TerminalSettings = ({
{t("settings:terminal.outputPreviewSize.description")}
</div>
</SearchableSetting>

<SearchableSetting
settingId="terminal-auto-show"
section="terminal"
label={t("settings:terminal.autoShow.label")}>
<VSCodeCheckbox
checked={terminalAutoShow ?? false}
onChange={(e: any) => setCachedStateField("terminalAutoShow", e.target.checked)}
data-testid="terminal-auto-show-checkbox">
<span className="font-medium">{t("settings:terminal.autoShow.label")}</span>
</VSCodeCheckbox>
<div className="text-vscode-descriptionForeground text-sm mt-1">
{t("settings:terminal.autoShow.description")}
</div>
</SearchableSetting>
</div>
</div>

Expand Down
3 changes: 3 additions & 0 deletions webview-ui/src/context/ExtensionStateContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ export interface ExtensionStateContextType extends ExtensionState {
setTerminalShellIntegrationTimeout: (value: number) => void
terminalShellIntegrationDisabled?: boolean
setTerminalShellIntegrationDisabled: (value: boolean) => void
terminalAutoShow?: boolean
setTerminalAutoShow: (value: boolean) => void
terminalZdotdir?: boolean
setTerminalZdotdir: (value: boolean) => void
setTtsEnabled: (value: boolean) => void
Expand Down Expand Up @@ -544,6 +546,7 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode
setState((prevState) => ({ ...prevState, terminalShellIntegrationTimeout: value })),
setTerminalShellIntegrationDisabled: (value) =>
setState((prevState) => ({ ...prevState, terminalShellIntegrationDisabled: value })),
setTerminalAutoShow: (value) => setState((prevState) => ({ ...prevState, terminalAutoShow: value })),
setTerminalZdotdir: (value) => setState((prevState) => ({ ...prevState, terminalZdotdir: value })),
setMcpEnabled: (value) => setState((prevState) => ({ ...prevState, mcpEnabled: value })),
setTaskSyncEnabled: (value) => setState((prevState) => ({ ...prevState, taskSyncEnabled: value }) as any),
Expand Down
4 changes: 4 additions & 0 deletions webview-ui/src/i18n/locales/en/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,10 @@
"label": "Terminal character limit",
"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>"
},
"autoShow": {
"label": "Auto-show terminal on command execution",
"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."
},
"outputPreviewSize": {
"label": "Command output preview size",
"description": "Controls how much command output Roo sees directly. Full output is always saved and accessible when needed.",
Expand Down
Loading