feat(cli): add native drag-and-drop and Cmd+V clipboard image pasting#27859
feat(cli): add native drag-and-drop and Cmd+V clipboard image pasting#27859pedrogoiania wants to merge 1 commit into
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Gemini CLI by introducing native drag-and-drop and clipboard image pasting capabilities. By implementing a background clipboard watcher and improving path resolution logic, the PR streamlines the workflow for adding local files and images to the prompt, providing a more polished and intuitive terminal experience. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
📊 PR Size: size/L
|
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
6c65ad5 to
233ee46
Compare
There was a problem hiding this comment.
Code Review
This pull request introduces a background clipboard image watcher that automatically converts copied raw images into temporary files and writes their relative paths back to the clipboard. It also updates path pasting to resolve paths relatively within the target directory and adds toast notifications when files are added to the prompt context. Feedback on these changes highlights a critical command injection vulnerability in the Windows clipboard writing function, potential path traversal issues due to simple string prefix checks, and a bug where file paths containing spaces are incorrectly split when generating toast notifications.
233ee46 to
5a06e33
Compare
5a06e33 to
c0b4dd3
Compare
- Implement background clipboard image synchronizer to extract raw images from system clipboard and reframe their relative text paths back to the clipboard on macOS, Windows, and Linux. - Update parsePastedPaths to support targetDir and convert absolute file paths to clean relative paths inside the workspace. - Update text-buffer to pass targetDir and emit a transient status toast confirming dropped/pasted files. - Add comprehensive unit tests for relative path resolution with targetDir. Closes google-gemini#27855
ccca6e3 to
dc42ffc
Compare
What does this PR do?
This PR brings visual multimodal parity to Gemini CLI by adding first-class terminal drag-and-drop and native
Cmd+V/Ctrl+Vclipboard image pasting inside standard terminal emulators.This addresses the long-standing limitation discussed in closed/stale issues #15532 and #5316, making the workflow incredibly fast and polished.
Detailed Changes:
InputPrompt.tsxthat polls the clipboard for raw image buffers (e.g. screenshots).~/.gemini/tmp/gemini-cli/images/clipboard-xxx.png) and writes the workspace-relative path text (@.gemini-clipboard/clipboard-xxx.png) back to the system clipboard.Cmd+Vpaste the file reference natively!parsePastedPathsinclipboardUtils.tsto accept an optionaltargetDirparameter.@src/image.png) instead of a long absolute path.text-buffer.tsinput handler to pass the active workspace directory and emit a clean, non-intrusive status toast (e.g.Added logo.png to prompt context) when files are dropped or pasted.clipboardUtils.test.tsverifying path resolution both inside and outside of the workspace directory.Closes #27855