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

v1.0.25

Published

Deprecated pi extension for copying the most recent user message; use pi-copy-message instead

Readme

pi copy-user extension

Deprecated: use pi-copy-message instead. It provides a searchable picker for copying raw user, assistant, and tool messages.

A tiny pi extension that adds a slash command for copying the most recent user message to your clipboard.

What it does

  • Adds /copy-user
  • Copies the text from the most recent user message in the current session
  • Preserves line breaks between text blocks
  • Uses the system clipboard when available and a terminal OSC 52 clipboard escape in interactive TTY sessions
  • Avoids synchronous clipboard subprocesses in the /copy-user command path
  • Does not fall back to an older message if the latest user message has no text

Install

Install it from npm with pi:

pi install npm:pi-copy-user-message

Or install it directly from GitHub with pi:

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

Then reload pi from inside the app with:

/reload

If you prefer to load it directly from a local checkout during development, you can point pi at the package entrypoint:

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

Compatibility

  • Tested with pi 0.78.1
  • Supported Node.js range for local repo tooling: >=22.19.0
  • .nvmrc pins Node 22.19.0 for local development; CI verifies Node 22.x and 24.x

This package keeps @earendil-works/pi-coding-agent as a development dependency for local typechecking and tests and declares pi core packages as optional wildcard peers per current pi package guidance. That keeps installs forward-open for future pi releases: npm peer ranges should not block users from trying a newer pi, though runtime behavior is only verified against the tested baseline until a follow-up package release confirms it.

Usage

Once loaded, run:

/copy-user

The command will:

  • copy the newest user message text to the clipboard
  • show a warning if there are no user messages
  • show a warning if the newest user message contains no text

Behavior notes

  • Text-only by design: image-only user messages are not copied.
  • If a user message contains multiple text blocks, they are joined with newlines.
  • OSC 52 is only emitted in interactive TTY sessions, so print/RPC output stays clean.
  • Clipboard command fallbacks run asynchronously so the slash-command path does not block the TUI event loop while utilities resolve or time out.
  • On Linux-family environments, the extension tries termux-clipboard-set, then wl-copy, then X11 tools (xclip, then xsel).
  • If no supported clipboard transport is available, the command reports an error instead of claiming success.
  • The command is intentionally strict about “most recent” so it never copies an older user message by mistake.

Development

This repo includes a small regression test in:

  • tests/copy-user-message.test.ts

The test covers:

  • latest text message
  • latest image-only message
  • latest whitespace-only message
  • no user message at all
  • actual /copy-user command success, warning, and error paths
  • OSC 52 emission
  • Linux clipboard fallback ordering
  • X11 xsel fallback after xclip
  • macOS pbcopy and Windows clip transport selection
  • failed or unsupported clipboard transport cases

Files

  • extensions/copy-user-message.ts — publishable extension implementation
  • .pi/extensions/copy-user-message.ts — thin project-local wrapper for auto-discovery in this repo
  • tests/copy-user-message.test.ts — regression test for message selection, /copy-user command behavior, and clipboard transport fallbacks