Skip to content

feat(ui): add /copy command to paste the last response cleanly (#127) - #277

Open
innocarpe wants to merge 1 commit into
lessweb:mainfrom
innocarpe:fix/127-copy-command
Open

feat(ui): add /copy command to paste the last response cleanly (#127)#277
innocarpe wants to merge 1 commit into
lessweb:mainfrom
innocarpe:fix/127-copy-command

Conversation

@innocarpe

Copy link
Copy Markdown

Summary

  • New /copy slash 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 /raw workaround. A dedicated command gives a clean, one-step paste path (issue #127).

Changes

  • packages/cli/src/ui/core/clipboard.ts: add cleanOutputForClipboard() (strip ANSI, normalize line endings) and writeClipboardText() using pbcopy / xclip / wl-copy / PowerShell Set-Clipboard.
  • packages/cli/src/ui/core/slash-commands.ts: register /copy.
  • packages/cli/src/ui/views/PromptInput.tsx: handle the copy command kind.
  • packages/cli/src/ui/views/App.tsx: copy the last assistant response on /copy with success/error feedback.
  • Tests: clipboard.test.ts (clean function), slash-commands.test.ts (registry).

Validation

  • npm run typecheck
  • npm test — clipboard + slash-command tests pass ✅

Closes #127

…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)
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.

Remove leading indentation/whitespace when copying CLI output

1 participant