feat(cli): add /copy command for clipboard copy in TUI#2342
Open
Sskift wants to merge 1 commit into
Open
Conversation
Add a new /copy slash command that extracts chat content through OSC 52 clipboard (with temp-file fallback for oversized text). - /copy (no args) → copies the latest assistant response - /copy all → copies the serialized chat conversation - /copy N → copies the last N serializable items New src/cli/ui/copy-history.ts handles card-to-text serialization covering all card kinds (user, assistant, tool, reasoning, diff, plan, task, usage, memory, subagent, search, etc.). /copy is restricted to local TUI sessions only — remote QQ/ Telegram/Weixin slash commands cannot trigger host clipboard writes. Fixes esengine#2260 (copy portion)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the copy portion of #2260 — unable to copy content from the CLI TUI.
Changes
New:
src/cli/ui/copy-history.tsCard-to-text serialization covering all 18 card kinds: user, assistant, tool, reasoning, diff, plan, task, usage, memory, subagent, search, error, warn, live, ctx, tip, doctor, compaction.
/copyslash command/copy(no args) → copies the latest completed assistant response/copy all→ copies the full serialized conversation/copy N→ copies the last N serializable chat itemsUses the existing
writeClipboard()OSC 52 path with temp-file fallback for oversized content.Guard: local TUI only
getCardsis only exposed to the slash context when NOT running in a remote QQ/Telegram/Weixin channel — remote slash commands cannot trigger host-terminal clipboard writes.Files changed
src/cli/ui/copy-history.tssrc/cli/ui/slash/commands.tssrc/cli/ui/slash/handlers/basic.ts/copyhandler via OSC 52 clipboardsrc/cli/ui/slash/types.tsgetCardstoSlashContextsrc/cli/ui/App.tsxgetCardscallback, guarded from remote channelssrc/i18n/EN.ts/copyto keys referenceVerification
npm run typechecknpm run lint