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

View File

@@ -62,6 +62,7 @@ describe('ToolConfirmationMessage', () => {
getPreferredEditor={vi.fn()}
availableTerminalHeight={30}
terminalWidth={80}
toolName="shell"
/>,
);
@@ -88,6 +89,7 @@ describe('ToolConfirmationMessage', () => {
getPreferredEditor={vi.fn()}
availableTerminalHeight={30}
terminalWidth={80}
toolName="shell"
/>,
);
@@ -111,6 +113,7 @@ describe('ToolConfirmationMessage', () => {
getPreferredEditor={vi.fn()}
availableTerminalHeight={30}
terminalWidth={80}
toolName="shell"
/>,
);
@@ -140,6 +143,7 @@ describe('ToolConfirmationMessage', () => {
getPreferredEditor={vi.fn()}
availableTerminalHeight={30}
terminalWidth={80}
toolName="shell"
/>,
);
@@ -169,6 +173,7 @@ describe('ToolConfirmationMessage', () => {
getPreferredEditor={vi.fn()}
availableTerminalHeight={30}
terminalWidth={80}
toolName="shell"
/>,
);
@@ -197,6 +202,7 @@ describe('ToolConfirmationMessage', () => {
getPreferredEditor={vi.fn()}
availableTerminalHeight={30}
terminalWidth={80}
toolName="shell"
/>,
);
@@ -225,6 +231,7 @@ describe('ToolConfirmationMessage', () => {
getPreferredEditor={vi.fn()}
availableTerminalHeight={30}
terminalWidth={80}
toolName="shell"
/>,
);
@@ -253,6 +260,7 @@ describe('ToolConfirmationMessage', () => {
getPreferredEditor={vi.fn()}
availableTerminalHeight={30}
terminalWidth={80}
toolName="shell"
/>,
);
await result.waitUntilReady();
@@ -338,6 +346,7 @@ describe('ToolConfirmationMessage', () => {
getPreferredEditor={vi.fn()}
availableTerminalHeight={30}
terminalWidth={80}
toolName="shell"
/>,
);
@@ -361,6 +370,7 @@ describe('ToolConfirmationMessage', () => {
getPreferredEditor={vi.fn()}
availableTerminalHeight={30}
terminalWidth={80}
toolName="shell"
/>,
);
@@ -396,6 +406,7 @@ describe('ToolConfirmationMessage', () => {
getPreferredEditor={vi.fn()}
availableTerminalHeight={30}
terminalWidth={80}
toolName="shell"
/>,
{
settings: createMockSettings({
@@ -423,6 +434,7 @@ describe('ToolConfirmationMessage', () => {
getPreferredEditor={vi.fn()}
availableTerminalHeight={30}
terminalWidth={80}
toolName="shell"
/>,
{
settings: createMockSettings({
@@ -474,6 +486,7 @@ describe('ToolConfirmationMessage', () => {
getPreferredEditor={vi.fn()}
availableTerminalHeight={30}
terminalWidth={80}
toolName="shell"
/>,
);
@@ -505,6 +518,7 @@ describe('ToolConfirmationMessage', () => {
getPreferredEditor={vi.fn()}
availableTerminalHeight={30}
terminalWidth={80}
toolName="shell"
/>,
);
@@ -536,6 +550,7 @@ describe('ToolConfirmationMessage', () => {
getPreferredEditor={vi.fn()}
availableTerminalHeight={30}
terminalWidth={80}
toolName="shell"
/>,
);
@@ -562,6 +577,7 @@ describe('ToolConfirmationMessage', () => {
getPreferredEditor={vi.fn()}
availableTerminalHeight={30}
terminalWidth={80}
toolName="shell"
/>,
);
@@ -607,6 +623,7 @@ describe('ToolConfirmationMessage', () => {
getPreferredEditor={vi.fn()}
availableTerminalHeight={30}
terminalWidth={80}
toolName="shell"
/>,
);
@@ -638,6 +655,7 @@ describe('ToolConfirmationMessage', () => {
getPreferredEditor={vi.fn()}
availableTerminalHeight={30}
terminalWidth={80}
toolName="shell"
/>,
);
@@ -672,13 +690,14 @@ describe('ToolConfirmationMessage', () => {
getPreferredEditor={vi.fn()}
availableTerminalHeight={40}
terminalWidth={80}
toolName="shell"
/>,
);
await waitUntilReady();
const outputLines = lastFrame().split('\n');
// Should use the entire terminal height minus 1 line for the "Press Ctrl+O to show more lines" hint
expect(outputLines.length).toBe(39);
// Should use the entire terminal height
expect(outputLines.length).toBe(40);
await expect({ lastFrame, generateSvg }).toMatchSvgSnapshot();
unmount();
@@ -712,13 +731,14 @@ describe('ToolConfirmationMessage', () => {
getPreferredEditor={vi.fn()}
availableTerminalHeight={40}
terminalWidth={80}
toolName="shell"
/>,
);
await waitUntilReady();
const outputLines = lastFrame().split('\n');
// Should use the entire terminal height minus 1 line for the "Press Ctrl+O to show more lines" hint
expect(outputLines.length).toBe(39);
// Should use the entire terminal height
expect(outputLines.length).toBe(40);
await expect({ lastFrame, generateSvg }).toMatchSvgSnapshot();
unmount();
@@ -761,6 +781,7 @@ describe('ToolConfirmationMessage', () => {
getPreferredEditor={vi.fn()}
availableTerminalHeight={30}
terminalWidth={80}
toolName="shell"
/>,
);