@joelazar/pi-copy-block

Copy a code block or shell command out of recent pi replies to the clipboard

Packages

Package details

extension

Install @joelazar/pi-copy-block from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@joelazar/pi-copy-block
Package
@joelazar/pi-copy-block
Version
1.1.0
Published
Sep 8, 2026
Downloads
302/mo · 32/wk
Author
joelazar
License
MIT
Types
extension
Size
9.5 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ],
  "image": "https://raw.githubusercontent.com/joelazar/pi-copy-block/main/assets/demo.gif"
}

Security note

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

README

pi-copy-block

Grab a code block out of pi's recent replies and put it on your clipboard.

demo

Pi ends a lot of turns with something you're meant to run or paste: a fenced block in its prose, or a bash tool call waiting for approval. Selecting that text with the mouse inside a TUI is fiddly, and it picks up the surrounding borders. /copy-block pulls it out cleanly.

Install

pi install npm:@joelazar/pi-copy-block

Usage

Run /copy-block. The extension scans the last ten assistant replies and gathers from each, in the order they appear:

  • the body of every fenced code block in the message text, with the fences and language tag stripped
  • the command argument of every bash tool call

One match goes straight to the clipboard. Several open a picker: the list on the left shows each block's first line tagged with its reply (R1 is the latest reply), the pane on the right shows the highlighted block. / scroll a long block. Navigation follows your tui.select.* keybindings.

If none of the replies has a block, you get a warning and the clipboard is left alone.

License

MIT