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-copy-message

v2.1.0

Published

Pi extension with a searchable TUI picker for copying raw session messages

Downloads

444

Readme

pi copy-message extension

A pi extension that adds /copy-message: a keyboard-first picker for copying raw session message text without terminal wrapping, padding, or rendered TUI artifacts. It also adds /copy-user as a direct shortcut for the most recent user message.

pi-copy-message supersedes pi-copy-user-message, which only copied the most recent user message.

What it does

  • Adds /copy-message
  • Adds /copy-user for copying the most recent user message directly
  • Copies raw stored session message text, not rendered terminal lines
  • Shows messages in chat order: oldest at top, newest at bottom
  • Selects the newest visible message by default
  • Supports role filters for user, assistant, tool/bash, and custom messages
  • Hides tool/bash messages by default
  • Supports type-to-filter search across role and message text, with time:<term> for timestamp search
  • Supports Home/End jumps for oldest/newest visible messages
  • Uses Pi's configured selection bindings for navigation, copy, and cancel
  • Includes fast paths: /copy-message latest, /copy-message last, and /copy-message newest
  • Supports direct numbered copies like /copy-message 3
  • Supports metadata copies with --with-meta, --with-metadata, or --with-role

Install

Install it from npm with pi:

pi install npm:pi-copy-message

Or install it directly from GitHub with pi:

pi install https://github.com/fitchmultz/pi-copy-message

Then reload pi from inside the app:

/reload

If you prefer to load it directly from a local checkout during development:

pi -e ./extensions/copy-message.ts

Usage

Open the picker:

/copy-message

Copy the most recent user message directly:

/copy-user

Copy the latest visible default message directly:

/copy-message latest

Aliases:

/copy-message last
/copy-message newest

Copy the 3rd default-visible message directly, matching the picker's 1-based oldest-to-newest numbering:

/copy-message 3

Copy with role and timestamp metadata instead of raw text only:

/copy-message latest --with-meta
/copy-message 3 --with-role
/copy-user --with-meta

Keyboard controls

| Key | Action | |---|---| | Configured tui.select.up (default: ) | Move to older visible message | | Configured tui.select.down (default: ) | Move to newer visible message | | Configured tui.select.pageUp / tui.select.pageDown (default: PageUp / PageDown) | Move by one visible page in regular mode | | Ctrl+PageUp / Ctrl+PageDown | Move by one visible page in fullscreen mode | | Home / End | Jump to oldest/newest visible message in regular mode | | Ctrl+Home / Ctrl+End | Jump to oldest/newest visible message in fullscreen mode | | Type text | Filter visible messages | | time:<term> | Search timestamps | | Backspace | Delete one search character | | Ctrl+U | Toggle user messages | | Ctrl+A | Toggle assistant messages | | Ctrl+T | Toggle tool/bash messages | | Alt+C | Toggle custom messages | | Tab | Toggle a wrapped preview of the selected message | | Alt+M | Toggle raw vs metadata copy format | | Configured tui.select.confirm (default: Enter) | Copy selected message text | | Configured tui.select.cancel (default: Esc/Ctrl+C) | Cancel |

Behavior notes

  • Entry IDs are hidden from the picker.
  • The picker caps visible rows and scrolls instead of filling the screen.
  • Search preserves your original selected message and restores it when the search is cleared.
  • General search does not match timestamps; use time:<term> when you want to search by displayed time.
  • Filter labels honor the active pi theme.
  • Selection key hints show the active Pi bindings. Configured selection actions take precedence if they collide with the picker's filter, preview, or format shortcuts.
  • Only custom messages with display: true can appear or be copied from current custom_message entries or legacy message-wrapped entries; visible ones can be toggled with Alt+C.
  • Copy notifications include the role and a short preview so you can verify what was copied.
  • /copy-message latest and numbered selectors include user, assistant, and visible custom messages by default while hiding tool/bash messages. Alt+C only affects the picker. If only hidden messages exist, latest falls back to the newest message so the command still does something useful.
  • /copy-message with no direct selector requires interactive TUI mode because the picker is a custom TUI component.
  • Direct commands such as /copy-user, /copy-message latest, and /copy-message 3 do not require TUI mode, though non-UI modes may not display notifications.

Compatibility

  • Requires and is tested with Pi 0.84.0 or later
  • Pi includes Ctrl+X for copying the latest assistant response; this extension remains useful for searchable history, other roles, metadata, and direct selectors.
  • Supported Node.js range for local repo tooling: >=22.19.0
  • .nvmrc pins Node 22.19.0 for local development

This package keeps pi core packages as wildcard peers (*) per pi package guidance. Pi aliases these imports to its own bundled copies when loading the extension, so the package never bundles or shadows pi core. Local development uses @earendil-works/pi-coding-agent and @earendil-works/pi-tui as dev dependencies for typechecking and tests.

Development

npm install
npm run check

Key files:

  • extensions/copy-message.ts — publishable extension implementation
  • tests/copy-message.test.ts — regression tests for command wiring, filtering, search, navigation, and copy formatting