From 5273f8dd7b7980685857ddfdb68b07ebf1ac16a0 Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Thu, 18 Jun 2026 12:50:47 +0200 Subject: [PATCH] fix(tui): simplify shell output headings --- packages/opencode/src/cli/cmd/run/tool.ts | 6 ++-- .../test/cli/run/scrollback.surface.test.ts | 3 +- packages/tui/src/routes/session/index.tsx | 28 +++++++++++-------- .../inline-tool-wrap-snapshot.test.tsx.snap | 2 -- .../tui/inline-tool-wrap-snapshot.test.tsx | 1 - 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/packages/opencode/src/cli/cmd/run/tool.ts b/packages/opencode/src/cli/cmd/run/tool.ts index 18a92cb1c7..9a717ba4e6 100644 --- a/packages/opencode/src/cli/cmd/run/tool.ts +++ b/packages/opencode/src/cli/cmd/run/tool.ts @@ -630,13 +630,11 @@ function scrollBashStart(p: ToolProps): string { return `$ ${cmd}` } - const title = dir ? `Shell in ${dir}` : "Shell" - if (!cmd) { - return `# ${title}` + return dir ? `# Running in ${dir}` : "" } - return `# ${title}\n$ ${cmd}` + return `# Running in ${dir}\n$ ${cmd}` } function scrollBashProgress(p: ToolProps): string { diff --git a/packages/opencode/test/cli/run/scrollback.surface.test.ts b/packages/opencode/test/cli/run/scrollback.surface.test.ts index ccab8642eb..52ff5a354d 100644 --- a/packages/opencode/test/cli/run/scrollback.surface.test.ts +++ b/packages/opencode/test/cli/run/scrollback.surface.test.ts @@ -612,7 +612,7 @@ test("omits the current directory from bash titles", async () => { const commits = claim(out.renderer) try { expect(render(commits)).toContain("$ pwd") - expect(render(commits)).not.toContain("Shell in .") + expect(render(commits)).not.toContain("Running in .") } finally { destroy(commits) } @@ -675,6 +675,7 @@ test("renders completed bash output with one blank line after the command and be take() const output = lines.join("\n") + expect(output).toContain("# Running in /tmp/demo\n$ git status") expect(output).toContain("$ git status\n\nOn branch demo") expect(output).toContain("nothing to commit, working tree clean\n\noc-run-dev ahead 1") expect(output).not.toContain("nothing to commit, working tree clean\n\n\noc-run-dev ahead 1") diff --git a/packages/tui/src/routes/session/index.tsx b/packages/tui/src/routes/session/index.tsx index 05d63574cd..8ddb756670 100644 --- a/packages/tui/src/routes/session/index.tsx +++ b/packages/tui/src/routes/session/index.tsx @@ -2001,7 +2001,7 @@ export function InlineToolRow(props: { } function BlockTool(props: { - title: string + title?: string children: JSX.Element onClick?: () => void part?: ToolPart @@ -2030,15 +2030,19 @@ function BlockTool(props: { props.onClick?.() }} > - - {props.title} - - } - > - {props.title.replace(/^# /, "")} + + {(title) => ( + + {title()} + + } + > + {title().replace(/^# /, "")} + + )} {props.children} @@ -2073,8 +2077,8 @@ function Shell(props: ToolProps) { const title = createMemo(() => { const wd = workdirDisplay() - if (!wd) return "# Shell" - return `# Shell in ${wd}` + if (!wd) return + return `# Running in ${wd}` }) return ( diff --git a/packages/tui/test/cli/tui/__snapshots__/inline-tool-wrap-snapshot.test.tsx.snap b/packages/tui/test/cli/tui/__snapshots__/inline-tool-wrap-snapshot.test.tsx.snap index 36b6b5c563..de6decb4da 100644 --- a/packages/tui/test/cli/tui/__snapshots__/inline-tool-wrap-snapshot.test.tsx.snap +++ b/packages/tui/test/cli/tui/__snapshots__/inline-tool-wrap-snapshot.test.tsx.snap @@ -24,8 +24,6 @@ exports[`TUI inline tool wrapping snapshots expanded tool errors under the tool exports[`TUI inline tool wrapping keeps separation after a shell output block 1`] = ` " - # List files - $ ls file.ts diff --git a/packages/tui/test/cli/tui/inline-tool-wrap-snapshot.test.tsx b/packages/tui/test/cli/tui/inline-tool-wrap-snapshot.test.tsx index 93ae89d61d..34072bbd9d 100644 --- a/packages/tui/test/cli/tui/inline-tool-wrap-snapshot.test.tsx +++ b/packages/tui/test/cli/tui/inline-tool-wrap-snapshot.test.tsx @@ -54,7 +54,6 @@ const tools: readonly ToolFixture[] = [ function ShellOutput() { return ( - # List files $ ls file.ts