anomalyco / anomalyco/opencode
macOS: image paste fails for Figma "Copy as PNG" clipboard contents
@kommander is already working on this.
Since Aug 24, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
I tried to copy a design from Figma as PNG so I could paste in opencode and have the agent read the design.
Copying and pasting from other sites works fine, from Figma (specifically Desktop) is where pressint CMD+V or CTRL+V did nothing.
The agent generated the following notes to explain the issue, as it was able to fix it via some commands:
read() in packages/tui/src/clipboard.ts uses osascript -e 'set imageData to the clipboard as "PNGf"'. That coercion fails with -1700 ("Can't make some data into the expected type") when the clipboard comes from Figma's ⇧⌘C copy — even though a valid public.png is present.
Figma writes a type cocktail (org.w3.web-custom-format.*, public.png, Apple PNG pasteboard type, org.chromium.source-url, public.tiff) that breaks the AppleScript coercion. Rewriting the clipboard as plain PNG via NSPasteboard fixes pasting.
Suggested fix: on macOS read public.png directly (Swift helper or JXA ObjC bridge) instead of AppleScript coercion.
Plugins
No response
OpenCode version
1.18.8
Steps to reproduce
- Figma (web or desktop): select frame → ⇧⌘C (Copy as PNG)
- Paste into opencode TUI → nothing attaches
- osascript -e 'the clipboard as "PNGf"' → error -1700, while NSPasteboard.data(forType: .png) returns the PNG fine (verified via Swift)
Screenshot and/or share link
No response
Operating System
26.5.2 (25F84)
Terminal
Visual Studio Terminal
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.