feat(ui): add /copy command to paste the last response cleanly (#127) - #277
Open
innocarpe wants to merge 1 commit into
Open
feat(ui): add /copy command to paste the last response cleanly (#127)#277innocarpe wants to merge 1 commit into
innocarpe wants to merge 1 commit into
Conversation
…eb#127) Adds a /copy slash command that copies the last assistant response to the system clipboard (pbcopy / xclip / wl-copy / Set-Clipboard), stripping ANSI codes so the pasted text is clean. (cherry picked from commit 3bf0b5a43422d7232dd13e24616d0961c6315bcc)
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
/copyslash command copies the last assistant response to the system clipboard as clean text (ANSI stripped), so pasting into an IDE/terminal does not include terminal color codes or UI margins.Why
Copying output from the CLI required either terminal selection (which carries leading UI margins and ANSI codes) or the
/rawworkaround. A dedicated command gives a clean, one-step paste path (issue #127).Changes
packages/cli/src/ui/core/clipboard.ts: addcleanOutputForClipboard()(strip ANSI, normalize line endings) andwriteClipboardText()usingpbcopy/xclip/wl-copy/ PowerShellSet-Clipboard.packages/cli/src/ui/core/slash-commands.ts: register/copy.packages/cli/src/ui/views/PromptInput.tsx: handle thecopycommand kind.packages/cli/src/ui/views/App.tsx: copy the last assistant response on/copywith success/error feedback.clipboard.test.ts(clean function),slash-commands.test.ts(registry).Validation
npm run typecheck✅npm test— clipboard + slash-command tests pass ✅Closes #127