Elffuss BraidHub

kikocis/continue public

fix: truncate bash output lines
Changesete98588f7652fde0d5fe8b5ff5dc3d429389f85b41afd9d755a891072429e83dd
AuthorNate <sestinj@gmail.com> · 2025-08-28 14:00 -07:00
CommitterNate <sestinj@gmail.com> · 2025-08-28 14:00 -07:00
Parentsb2162ee949fa

Browse the files at this changeset

1 file changed

modified extensions/cli/src/ui/ToolResultSummary.tsx +10 −6
@@ -8,6 +8,8 @@
88 import { ColoredDiff } from "./ColoredDiff.js";
99 import { ChecklistDisplay } from "./components/ChecklistDisplay.js";
1010
11+const MAX_BASH_OUTPUT_LINES = 4;
12+
1113 interface ToolResultSummaryProps {
1214 toolName?: string;
1315 content: string;
@@ -74,8 +76,8 @@
7476 const actualOutput = isStderr ? content.slice(7).trim() : content;
7577 const outputLines = actualOutput.split("\n");
7678
77- if (outputLines.length <= 16) {
78- // Show actual output for 16 lines or fewer
79+ if (outputLines.length <= MAX_BASH_OUTPUT_LINES) {
80+ // Show actual output for MAX_BASH_OUTPUT_LINES lines or fewer
7981 return (
8082 <Box flexDirection="column">
8183 <Box>
@@ -88,8 +90,8 @@
8890 </Box>
8991 );
9092 } else {
91- // Show first 16 lines with ellipsis for more than 16 lines
92- const first16Lines = outputLines.slice(0, 16).join("\n");
93+ // Show first MAX_BASH_OUTPUT_LINES lines with ellipsis for more lines
94+ const firstLines = outputLines.slice(0, MAX_BASH_OUTPUT_LINES).join("\n");
9395 return (
9496 <Box flexDirection="column">
9597 <Box>
@@ -97,10 +99,12 @@
9799 <Text color="gray"> Terminal output:</Text>
98100 </Box>
99101 <Box paddingLeft={2}>
100- <Text color={isStderr ? "red" : "white"}>{first16Lines}</Text>
102+ <Text color={isStderr ? "red" : "white"}>{firstLines}</Text>
101103 </Box>
102104 <Box paddingLeft={2}>
103- <Text color="gray">...</Text>
105+ <Text color="gray">
106+ ... +{outputLines.length - MAX_BASH_OUTPUT_LINES} lines
107+ </Text>
104108 </Box>
105109 </Box>
106110 );