import { Box, Text } from "ink" import * as theme from "../../theme.js" import { Icon } from "../Icon.js" import type { ToolRendererProps } from "./types.js" import { truncateText, sanitizeContent, getToolIconName } from "./utils.js" const MAX_OUTPUT_LINES = 10 export function CommandTool({ toolData }: ToolRendererProps) { const iconName = getToolIconName(toolData.tool) const command = toolData.command || "" const output = toolData.output ? sanitizeContent(toolData.output) : "" const content = toolData.content ? sanitizeContent(toolData.content) : "" const displayOutput = output || content const { text: previewOutput, truncated, hiddenLines } = truncateText(displayOutput, MAX_OUTPUT_LINES) return ( {command && ( $ {command} )} {previewOutput && ( {previewOutput.split("\n").map((line, i) => ( {line} ))} {truncated && ( ... ({hiddenLines} more lines) )} )} ) }