@felixoid/py-yank
Pi agent copy command: enhanced /y (yank/copy) for indexed and rendered assistant message clipboard copy
Package details
Install @felixoid/py-yank from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@felixoid/py-yank- Package
@felixoid/py-yank- Version
0.3.1- Published
- Jun 6, 2026
- Downloads
- 558/mo · 310/wk
- Author
- felixoid
- License
- MIT
- Types
- extension
- Size
- 14.1 KB
- Dependencies
- 1 dependency · 2 peers
Pi manifest JSON
{
"extensions": [
"./extensions/yank.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@felixoid/py-yank
Enhanced /y yank (copy) command for pi coding agent.
Why /y
/copy is a built-in interactive command in pi, and command-name overlap with extensions is currently awkward. See the current state and discussion in earendil-works/pi#3601.
This package uses a vim-style /y to avoid that collision while still adding copy-oriented features: indexed message copy, optional markdown rendering (--plain), code-block picker for multi-block responses, and per-session picker reset.
Features
/y— same as/y 1(raw markdown by default)/y 2— copy 2nd-to-last assistant message as raw markdown/y --plain— copy last assistant message as rendered plain text/y 2 --plain— indexed rendered plain-text copy/y --reset— reset the session option that always copies full response
For default/indexed forms, raw markdown is copied unless --plain is passed. If the selected response contains multiple fenced code blocks, /y and /y N show an interactive picker so you can copy either the full response or one code block.
--plain uses pi TUI Markdown renderer (@earendil-works/pi-tui) and strips ANSI, so copied text keeps structure (tables, lists, code blocks) in plain text. The interactive picker is skipped in --plain mode.
Install
pi install npm:@felixoid/py-yank
Or test without installing:
pi -e npm:@felixoid/py-yank
Usage
Inside pi:
/y
/y 2
/y --plain
/y 2 --plain
Notes
- This extension registers its own
/ycommand. - Clipboard backend uses pi's built-in
copyToClipboardutility.
Development
npm install
npm run typecheck
npm test
Load locally (project mode):
pi install .
# or add this path to .pi/settings.json packages