pi-copyblock

Copy the last code block from Pi's latest assistant response.

Packages

Package details

extension

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

$ pi install npm:pi-copyblock
Package
pi-copyblock
Version
0.1.0
Published
Aug 13, 2026
Downloads
151/mo · 7/wk
Author
johannesnauta
License
MIT
Types
extension
Size
4 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./extensions/copyblock.ts"
  ]
}

Security note

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

README

pi-copyblock

A tiny Pi extension that copies the last fenced code block from the latest agent message. Uses Pi’s public copyToClipboard() function—the same clipboard implementation used by Pi’s built-in /copy command. /copyblock only adds a filtering step so that it extracts the final fenced code block from the latest agent message before copying.

Install

pi install git:github.com/johannesnauta/pi-copyblock

For local development, clone and :

pi -e path/to/repository/extensions/copyblock.ts

Usage

Run /copyblock. The block's contents are copied without the surrounding triple backticks or language tag. If the latest response has no fenced code block, nothing is copied.