Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .changeset/seven-ghosts-tan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"roo-cline": patch
---

Fix command display in the approval required case
59 changes: 55 additions & 4 deletions webview-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 14 additions & 11 deletions webview-ui/src/components/chat/CommandExecution.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ interface CommandExecutionProps {
export const CommandExecution = ({ executionId, text, icon, title }: CommandExecutionProps) => {
const { terminalShellIntegrationDisabled = false } = useExtensionState()

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)

const { command: initialCommand, output: initialOutput } = useMemo(
() => (text ? parseCommandAndOutput(text) : { command: "", output: "" }),
[text],
)

const [output, setOutput] = useState(initialOutput)
const [command, setCommand] = useState(initialCommand)
const [streamingOutput, setStreamingOutput] = useState("")
const [status, setStatus] = useState<CommandExecutionStatus | null>(null)

// The command's output can either come from the text associated with the
// task message (this is the case for completed commands) or from the
// streaming output (this is the case for running commands).
const output = streamingOutput || parsedOutput

const onMessage = useCallback(
(event: MessageEvent) => {
const message: ExtensionMessage = event.data
Expand All @@ -52,11 +52,10 @@ export const CommandExecution = ({ executionId, text, icon, title }: CommandExec

switch (data.status) {
case "started":
setCommand(data.command)
setStatus(data)
break
case "output":
setOutput(data.output)
setStreamingOutput(data.output)
break
case "fallback":
setIsExpanded(true)
Expand Down Expand Up @@ -143,7 +142,11 @@ const OutputContainerInternal = ({ isExpanded, output }: { isExpanded: boolean;

const OutputContainer = memo(OutputContainerInternal)

const parseCommandAndOutput = (text: string) => {
const parseCommandAndOutput = (text: string | undefined) => {
if (!text) {
return { command: "", output: "" }
}

const index = text.indexOf(COMMAND_OUTPUT_STRING)

if (index === -1) {
Expand Down