npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pi-yank

v0.1.2

Published

Lightweight /yank extension for pi that copies the last assistant message or a selected code block.

Readme

pi-yank

Lightweight /yank extension for pi.

/yank copies the last assistant response to the clipboard, or lets you choose an individual fenced code block from that response. You can also target earlier messages with /yank N (e.g. /yank 2 operates on the 2nd-to-last assistant message).

Features

  • Copy the last assistant message to the clipboard
  • Use /yank N to target the N-th latest assistant message (/yank 2 = 2nd-to-last)
  • Detect fenced Markdown code blocks in the selected assistant message
  • Use arrow keys + Enter to choose a specific code block
  • Optionally disable the menu for the current session so /yank behaves like /copy
  • Reuse pi's official clipboard pipeline via copyToClipboard() for /copy-compatible behavior
  • Zero third-party runtime dependencies

Installation

Quick test

Load temporarily without installing:

pi --extension /path/to/pi-yank/extensions/yank.ts

Install as pi package

Globally:

pi install /path/to/pi-yank

Project-local:

pi install -l /path/to/pi-yank

Install as a project-local extension file

mkdir -p .pi/extensions
cp /path/to/pi-yank/extensions/yank.ts .pi/extensions/yank.ts

Install as a global extension file

mkdir -p ~/.pi/agent/extensions
cp /path/to/pi-yank/extensions/yank.ts ~/.pi/agent/extensions/yank.ts

Usage

/yank       # copy from the latest assistant message
/yank 1     # same as /yank
/yank 2     # copy from the 2nd-to-last assistant message
/yank N     # copy from the N-th latest assistant message

Behavior:

  • No assistant message yet → shows No agent messages to copy yet.
  • N-th latest message not found → shows No N-th latest agent message to copy yet.
  • Selected assistant message has no fenced code blocks → copies the full message
  • Selected assistant message has code blocks → opens a selection menu
  • Selecting a code block copies only that code block's content
  • Selecting the session option disables the menu for later /yank calls in the current session
  • Pressing Escape in the selector cancels without copying

Code block detection notes

/yank uses a line-by-line fenced block parser instead of a simple regex. This makes it more robust for LLM output such as:

  • a top-level ````markdownfenced block containing literal nested ```js ` examples
  • multiple top-level sibling code blocks
  • ~~~ fenced blocks
  • unterminated fences, which are ignored

Menu previews include more context when available, for example:

  • 1. Full latest message (24 lines • 812 chars)
  • 2. Code block — markdown: # Title (18 lines • 640 chars)
  • 3. Code block — js: console.log("hi") (1 line • 18 chars)
  • 4. Always copy full selected message in this session

When using /yank N with N > 1, the menu title shows the target (e.g. "Yank from 2nd latest response").

Development

Run parser tests:

npm run check

Package structure

This repository follows pi package conventions:

  • extension entry: extensions/yank.ts
  • package.json includes a pi manifest
  • pi core package is declared as a peerDependency

License

MIT