Skip to content

Commit 47c35f3

Browse files
fix(patch): cherry-pick 14b2f35 to release/v0.38.1-pr-24974 to patch version v0.38.1 and create version 0.38.2 (#25585)
Co-authored-by: Jarrod Whelan <150866123+jwhelangoog@users.noreply.github.com>
1 parent 7f55800 commit 47c35f3

7 files changed

Lines changed: 70 additions & 8 deletions

packages/cli/src/ui/__snapshots__/ToolConfirmationFullFrame-Full-Terminal-Tool-Confirmation-Snapshot-renders-tool-confirmation-box-in-the-frame-of-the-entire-terminal.snap.svg

Lines changed: 2 additions & 1 deletion
Loading

packages/cli/src/ui/__snapshots__/ToolConfirmationFullFrame.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ exports[`Full Terminal Tool Confirmation Snapshot > renders tool confirmation bo
55
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
66
77
╭─────────────────────────────────────────────────────────────────────────────────────────────────╮
8-
│ ? Edit
8+
│ ? Edit packages/.../InputPrompt.tsx: return kittyProtocolSupporte... => return kittyProto…
99
│ ╭─────────────────────────────────────────────────────────────────────────────────────────────╮ │
1010
│ │ ... first 42 lines hidden (Ctrl+O to show) ... │ │
1111
│ │ 43 const line43 = true; │ │

packages/cli/src/ui/components/ToolConfirmationQueue.test.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,44 @@ describe('ToolConfirmationQueue', () => {
6666
vi.clearAllMocks();
6767
});
6868

69+
it('explicitly renders the tool description (containing filename) for edit confirmations', async () => {
70+
const confirmingTool = {
71+
tool: {
72+
callId: 'call-1',
73+
name: 'Edit',
74+
description: 'Editing src/main.ts',
75+
status: CoreToolCallStatus.AwaitingApproval,
76+
confirmationDetails: {
77+
type: 'edit' as const,
78+
title: 'Confirm edit',
79+
fileName: 'main.ts',
80+
filePath: '/src/main.ts',
81+
fileDiff: '--- a/main.ts\n+++ b/main.ts\n@@ -1 +1 @@\n-old\n+new',
82+
originalContent: 'old',
83+
newContent: 'new',
84+
},
85+
},
86+
index: 1,
87+
total: 1,
88+
};
89+
90+
const { lastFrame, unmount } = await renderWithProviders(
91+
<ToolConfirmationQueue
92+
confirmingTool={confirmingTool as unknown as ConfirmingToolState}
93+
/>,
94+
{
95+
config: mockConfig,
96+
uiState: {
97+
terminalWidth: 80,
98+
},
99+
},
100+
);
101+
102+
const output = lastFrame();
103+
expect(output).toContain('Editing src/main.ts');
104+
unmount();
105+
});
106+
69107
it('renders the confirming tool with progress indicator', async () => {
70108
const confirmingTool = {
71109
tool: {

packages/cli/src/ui/components/ToolConfirmationQueue.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ export const ToolConfirmationQueue: React.FC<ToolConfirmationQueueProps> = ({
9898
<Box flexDirection="row" flexShrink={1} overflow="hidden">
9999
<Text color={theme.status.warning} bold>
100100
? {toolLabel}
101-
{!isEdit && !!tool.description && ' '}
101+
{!!tool.description && ' '}
102102
</Text>
103-
{!isEdit && !!tool.description && (
103+
{!!tool.description && (
104104
<Box flexShrink={1} overflow="hidden">
105105
<Text color={theme.text.primary} wrap="truncate-end">
106106
{tool.description}

packages/cli/src/ui/components/__snapshots__/ToolConfirmationQueue-ToolConfirmationQueue-height-allocation-and-layout-should-render-the-full-queue-wrapper-with-borders-and-content-for-large-edit-diffs.snap.svg

Lines changed: 2 additions & 1 deletion
Loading

packages/cli/src/ui/components/__snapshots__/ToolConfirmationQueue.test.tsx.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`ToolConfirmationQueue > calculates availableContentHeight based on availableTerminalHeight from UI state 1`] = `
44
"╭──────────────────────────────────────────────────────────────────────────────╮
5-
│ ? replace
5+
│ ? replace edit file
66
│ ╭──────────────────────────────────────────────────────────────────────────╮ │
77
│ ╰─... 48 hidden (Ctrl+O) ...───────────────────────────────────────────────╯ │
88
│ Apply this change? │
@@ -17,7 +17,7 @@ exports[`ToolConfirmationQueue > calculates availableContentHeight based on avai
1717

1818
exports[`ToolConfirmationQueue > does not render expansion hint when constrainHeight is false 1`] = `
1919
"╭──────────────────────────────────────────────────────────────────────────────╮
20-
│ ? replace
20+
│ ? replace edit file
2121
│ ╭──────────────────────────────────────────────────────────────────────────╮ │
2222
│ │ │ │
2323
│ │ No changes detected. │ │
@@ -63,7 +63,7 @@ exports[`ToolConfirmationQueue > height allocation and layout > should handle se
6363

6464
exports[`ToolConfirmationQueue > height allocation and layout > should render the full queue wrapper with borders and content for large edit diffs 1`] = `
6565
"╭──────────────────────────────────────────────────────────────────────────────╮
66-
│ ? replace
66+
│ ? replace Replaces content in a file
6767
│ ╭──────────────────────────────────────────────────────────────────────────╮ │
6868
│ │ ... 13 hidden (Ctrl+O) ... │ │
6969
│ │ 7 + const newLine7 = true; │ │

packages/cli/src/ui/components/messages/DenseToolMessage.test.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,28 @@ describe('DenseToolMessage', () => {
3434
terminalWidth: 80,
3535
};
3636

37+
it('explicitly renders the filename in the header for FileDiff results', async () => {
38+
const fileDiff: FileDiff = {
39+
fileName: 'test-file.ts',
40+
filePath: '/test-file.ts',
41+
fileDiff:
42+
'--- a/test-file.ts\n+++ b/test-file.ts\n@@ -1 +1 @@\n-old\n+new',
43+
originalContent: 'old',
44+
newContent: 'new',
45+
};
46+
47+
const { lastFrame, waitUntilReady } = await renderWithProviders(
48+
<DenseToolMessage
49+
{...defaultProps}
50+
name="Edit"
51+
resultDisplay={fileDiff as unknown as ToolResultDisplay}
52+
/>,
53+
);
54+
await waitUntilReady();
55+
const output = lastFrame();
56+
expect(output).toContain('test-file.ts');
57+
});
58+
3759
it('renders correctly for a successful string result', async () => {
3860
const { lastFrame, waitUntilReady } = await renderWithProviders(
3961
<DenseToolMessage {...defaultProps} />,

0 commit comments

Comments
 (0)