Skip to content

Commit b2e293c

Browse files
authored
🤖 fix: add padding to bash tool SCRIPT section (#989)
Added `px-2 py-1.5` padding to the `DetailContent` component which renders the Script section in the expanded bash tool view. This matches the padding used by the Output section and `OutputPaths` component. Also added: - `createBashTool` mockFactory helper - `WithBashTool` story that auto-expands a bash tool to visually validate the fix _Generated with `mux`_
1 parent 7139114 commit b2e293c

File tree

3 files changed

+90
-1
lines changed

3 files changed

+90
-1
lines changed

src/browser/components/tools/BashToolCall.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export const BashToolCall: React.FC<BashToolCallProps> = ({
104104
<ToolDetails>
105105
<DetailSection>
106106
<DetailLabel>Script</DetailLabel>
107-
<DetailContent>{args.script}</DetailContent>
107+
<DetailContent className="px-2 py-1.5">{args.script}</DetailContent>
108108
</DetailSection>
109109

110110
{result && (

src/browser/stories/App.chat.stories.tsx

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
createCompactionRequestMessage,
1111
createFileReadTool,
1212
createFileEditTool,
13+
createBashTool,
1314
createTerminalTool,
1415
createStatusTool,
1516
createGenericTool,
@@ -180,6 +181,76 @@ export const WithTerminal: AppStory = {
180181
),
181182
};
182183

184+
/** Bash tool with expanded script and output sections */
185+
export const WithBashTool: AppStory = {
186+
render: () => (
187+
<AppWithMocks
188+
setup={() =>
189+
setupSimpleChatStory({
190+
workspaceId: "ws-bash",
191+
messages: [
192+
createUserMessage("msg-1", "Check project status", {
193+
historySequence: 1,
194+
timestamp: STABLE_TIMESTAMP - 100000,
195+
}),
196+
createAssistantMessage("msg-2", "Let me check the git status and run tests:", {
197+
historySequence: 2,
198+
timestamp: STABLE_TIMESTAMP - 90000,
199+
toolCalls: [
200+
createBashTool(
201+
"call-1",
202+
`#!/bin/bash
203+
set -e
204+
205+
# Check git status
206+
echo "=== Git Status ==="
207+
git status --short
208+
209+
# Run tests
210+
echo "=== Running Tests ==="
211+
npm test 2>&1 | head -20`,
212+
[
213+
"=== Git Status ===",
214+
" M src/api/users.ts",
215+
" M src/auth/jwt.ts",
216+
"?? src/api/users.test.ts",
217+
"",
218+
"=== Running Tests ===",
219+
"PASS src/api/users.test.ts",
220+
" ✓ should authenticate (24ms)",
221+
" ✓ should reject invalid tokens (18ms)",
222+
"",
223+
"Tests: 2 passed, 2 total",
224+
].join("\n"),
225+
0,
226+
10,
227+
1250
228+
),
229+
],
230+
}),
231+
],
232+
})
233+
}
234+
/>
235+
),
236+
parameters: {
237+
docs: {
238+
description: {
239+
story: "Bash tool showing multi-line script in expanded view with proper padding.",
240+
},
241+
},
242+
},
243+
play: async ({ canvasElement }: { canvasElement: HTMLElement }) => {
244+
const canvas = within(canvasElement);
245+
246+
// Expand the bash tool to show Script section with padding
247+
await waitFor(async () => {
248+
const toolHeader = canvas.getByText(/set -e/);
249+
await userEvent.click(toolHeader);
250+
});
251+
},
252+
};
253+
183254
/** Chat with agent status indicator */
184255
export const WithAgentStatus: AppStory = {
185256
render: () => (

src/browser/stories/mockFactory.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,24 @@ export function createFileEditTool(toolCallId: string, filePath: string, diff: s
255255
};
256256
}
257257

258+
export function createBashTool(
259+
toolCallId: string,
260+
script: string,
261+
output: string,
262+
exitCode = 0,
263+
timeoutSecs = 3,
264+
durationMs = 50
265+
): MuxPart {
266+
return {
267+
type: "dynamic-tool",
268+
toolCallId,
269+
toolName: "bash",
270+
state: "output-available",
271+
input: { script, run_in_background: false, timeout_secs: timeoutSecs },
272+
output: { success: exitCode === 0, output, exitCode, wall_duration_ms: durationMs },
273+
};
274+
}
275+
258276
export function createTerminalTool(
259277
toolCallId: string,
260278
command: string,

0 commit comments

Comments
 (0)