Skip to content

Commit 5ef7a51

Browse files
committed
chore(cli): code cleanup from review feedback
- Remove duplicate AskUserContentBlock from ContentBlock union type - Remove unused execSync import from clipboard-image.ts - Fix Ctrl+V to fall through for text paste when no image in clipboard - Fix buildUserMessageContent to wrap text in user_message tags for multipart content
1 parent 9210549 commit 5ef7a51

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

cli/src/chat.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -951,21 +951,22 @@ export const Chat = ({
951951
// Check if clipboard has an image
952952
if (!hasClipboardImage()) {
953953
// No image in clipboard, let normal paste happen
954-
return
954+
return false
955955
}
956956

957957
// Read image from clipboard
958958
const result = readClipboardImage()
959959
if (!result.success || !result.imagePath || !result.filename) {
960960
showClipboardMessage(result.error || 'Failed to paste image', { durationMs: 3000 })
961-
return
961+
return true // We handled it (with an error), don't let default paste happen
962962
}
963963

964964
// Add to pending images
965965
useChatStore.getState().addPendingImage({
966966
path: result.imagePath,
967967
filename: result.filename,
968968
})
969+
return true // Image was pasted successfully
969970
},
970971
}), [
971972
setInputMode,

cli/src/hooks/use-chat-keyboard.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export type ChatKeyboardHandlers = {
5959
onExitApp: () => void
6060

6161
// Clipboard handlers
62-
onPasteImage: () => void
62+
onPasteImage: () => boolean // Returns true if an image was pasted
6363
}
6464

6565
/**
@@ -158,8 +158,7 @@ function dispatchAction(
158158
handlers.onExitApp()
159159
return true
160160
case 'paste-image':
161-
handlers.onPasteImage()
162-
return true
161+
return handlers.onPasteImage()
163162
case 'none':
164163
return false
165164
}

cli/src/types/chat.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ export type ContentBlock =
120120
| TextContentBlock
121121
| ToolContentBlock
122122
| PlanContentBlock
123-
| AskUserContentBlock
124123

125124
export type AgentMessage = {
126125
agentName: string

cli/src/utils/clipboard-image.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { execSync, spawnSync } from 'child_process'
1+
import { spawnSync } from 'child_process'
22
import { existsSync, mkdirSync, writeFileSync } from 'fs'
33
import path from 'path'
44
import os from 'os'

0 commit comments

Comments
 (0)