-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add image paste support to CLI #4244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 34c1e6d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds comprehensive image support to the CLI, enabling users to paste images directly with Ctrl+V and reference images via @path mentions. The implementation introduces a new media module with platform-specific clipboard handlers for macOS and Linux, while Windows support is deferred.
Key changes:
- Clipboard image paste with Ctrl+V creates temporary files and inserts [Image #N] references
- @path mention parsing extracts and loads images from file paths
- Message processing combines both clipboard-pasted and @path-referenced images before sending
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| cli/src/state/hooks/useMessageHandler.ts | Integrates image processing into message sending flow, handling both @path mentions and [Image #N] references with error display |
| cli/src/state/atoms/keyboard.ts | Adds Ctrl+V handler for clipboard paste, image reference tracking atoms, and status feedback for clipboard operations |
| cli/src/state/atoms/tests/shell.test.ts | Adds execFile mock to prevent clipboard code from executing during shell tests |
| cli/src/media/processMessageImages.ts | Processes messages to extract and load images from both [Image #N] references and @path mentions |
| cli/src/media/images.ts | Provides image utilities for validation, size checking, MIME type detection, and data URL conversion |
| cli/src/media/clipboard.ts | Main clipboard module that delegates to platform-specific implementations |
| cli/src/media/clipboard-shared.ts | Shared clipboard utilities including format detection, path helpers, and result types |
| cli/src/media/clipboard-macos.ts | macOS clipboard implementation using osascript to read/write images via AppleScript |
| cli/src/media/clipboard-linux.ts | Linux clipboard implementation using xclip to access clipboard images |
| cli/src/media/atMentionParser.ts | Parses @path mentions with support for quoted paths, escaped characters, and automatic image detection |
| cli/src/media/tests/processMessageImages.test.ts | Tests for image reference removal (minimal coverage) |
| cli/src/media/tests/images.test.ts | Comprehensive tests for image path validation, MIME types, data URL conversion, and size limits |
| cli/src/media/tests/clipboard.test.ts | Tests for clipboard parsing logic, format detection, and platform support |
| cli/src/media/tests/atMentionParser.test.ts | Comprehensive tests for @path mention parsing with various edge cases |
| .kilocode/rules/rules.md | Documents CLI test file naming exception (.test.ts instead of .spec.ts) |
This PR adds image support to the CLI.