Skip to content

Conversation

@marius-kilocode
Copy link
Contributor

@marius-kilocode marius-kilocode commented Dec 5, 2025

This PR adds image support to the CLI.

  • Allow Ctrl+V in the CLI to paste clipboard images, attach them as [Image #N], and send them with messages (macOS + Linux, with status feedback and cleanup).
  • Add image mention parsing (@path and [Image #N]) so pasted or referenced images are included when sending messages.
  • Split media code into a dedicated module with platform-specific clipboard handlers and image utilities; keep behavior consistent and logged.
  • Document the CLI test naming exception (.test.ts[x]) and add covering tests for media parsing/clipboard/image loading.
  • Windows is currently not supported
image image

@changeset-bot
Copy link

changeset-bot bot commented Dec 5, 2025

🦋 Changeset detected

Latest commit: 34c1e6d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@kilocode/cli Patch

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

Copy link
Contributor

Copilot AI left a 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants