pi-cp

Slack-ready rich clipboard commands for pi assistant responses

Packages

Package details

extension

Install pi-cp from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-cp
Package
pi-cp
Version
0.1.1
Published
Jun 2, 2026
Downloads
not available
Author
tianrendong
License
MIT
Types
extension
Size
17.4 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./extensions"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-cp

Slack-ready rich clipboard commands for pi assistant responses.

Copies assistant messages as rich HTML + plain text so they paste with formatting into Slack, docs, email, and other rich-text targets — while still degrading to plain text everywhere else.

Install

pi install git:github.com/tianrendong/pi-cp

Or add it to your settings.json packages/extensions.

Commands

Command Behavior
/cp Copy the last assistant response.
/cp 2 Copy assistant message #2 (1-indexed over assistant messages).
/cp range 2:4 Copy assistant messages 2–4 inclusive, joined with \n\n---\n\n.
/cp-interactive Open an editor pre-filled with the selection so you can trim it, then copy.

Shortcuts

Shortcut Behavior
ctrl+shift+c Copy the last assistant response.

How copy works

The markdown of the selected message(s) is converted to HTML with Slack-ish styling and placed on the clipboard as both rich HTML and plain text.

Platform clipboard backends, in order:

  • macOS — rich copy via osascript (HTML + plain), falling back to pbcopy.
  • Termuxtermux-clipboard-set.
  • Linux (Wayland)wl-copy.
  • Linux (X11)xclip, falling back to xsel.
  • Final fallback — OSC 52 terminal escape (when the base64 payload is ≤ 100k).

If nothing succeeds, the command reports a copy failure.

Markdown support

A tiny dependency-free renderer handles:

  • Fenced code blocks (lang), headings (#/##/###), blockquotes (>)
  • Unordered (-/*) and ordered (1./1)) lists, paragraphs
  • Inline: `code`, [links](https://…), **bold**, *italic*

HTML is escaped before inline formatting is applied.