feat(cli): enhance tool confirmation UI and selection layout (#24376)

This commit is contained in:
Gal Zahavi
2026-04-03 18:32:35 -07:00
committed by GitHub
parent 21a3925f99
commit 7311e242ec
24 changed files with 2435 additions and 1953 deletions
@@ -32,6 +32,7 @@ export function parseDiffWithLineNumbers(diffContent: string): DiffLine[] {
for (const line of lines) {
const hunkMatch = line.match(hunkHeaderRegex);
if (hunkMatch) {
currentOldLine = parseInt(hunkMatch[1], 10);
currentOldLine = parseInt(hunkMatch[1], 10);
currentNewLine = parseInt(hunkMatch[2], 10);
inHunk = true;
@@ -89,6 +90,7 @@ interface DiffRendererProps {
terminalWidth: number;
theme?: Theme;
disableColor?: boolean;
paddingX?: number;
}
const DEFAULT_TAB_WIDTH = 4; // Spaces per tab for normalization
@@ -101,6 +103,7 @@ export const DiffRenderer: React.FC<DiffRendererProps> = ({
terminalWidth,
theme,
disableColor = false,
paddingX = 0,
}) => {
const settings = useSettings();
@@ -122,11 +125,7 @@ export const DiffRenderer: React.FC<DiffRendererProps> = ({
if (parsedLines.length === 0) {
return (
<Box
borderStyle="round"
borderColor={semanticTheme.border.default}
padding={1}
>
<Box padding={1}>
<Text dimColor>No changes detected.</Text>
</Box>
);
@@ -162,12 +161,14 @@ export const DiffRenderer: React.FC<DiffRendererProps> = ({
theme,
settings,
disableColor,
paddingX,
});
} else {
const key = filename ? `diff-box-${filename}` : undefined;
return (
<MaxSizedBox
paddingX={paddingX}
maxHeight={availableTerminalHeight}
maxWidth={terminalWidth}
key={key}
@@ -194,6 +195,7 @@ export const DiffRenderer: React.FC<DiffRendererProps> = ({
settings,
tabWidth,
disableColor,
paddingX,
]);
return renderedOutput;
@@ -239,12 +241,7 @@ export const renderDiffLines = ({
if (displayableLines.length === 0) {
return [
<Box
key="no-changes"
borderStyle="round"
borderColor={semanticTheme.border.default}
padding={1}
>
<Box key="no-changes" padding={1}>
<Text dimColor>No changes detected.</Text>
</Box>,
];