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

v0.1.2

Published

Clickable copy button on every code block in Pi, plus clean code block rendering without ``` fences

Readme

pi-code-copy

A copy button on every code block in Pi, and code blocks that look like code instead of raw Markdown.

── python  ⧉ copy  ──────────────────────────────── #1 ──
def hello():
    print("Hello, world!")
──────────────────────────────────────────────────────────

Without it, Pi prints code blocks with literal ```python fences and a two-space indent, so selecting code with the mouse picks up both.

Features

  • Click ⧉ copy on any code block — in the last answer or anywhere in the history — to copy exactly the code: no fences, no indent, no terminal wrapping.
  • Keyboard: Alt+1 … Alt+9 copy block N of the last answer; /cc [N] does the same (/cc without a number opens a picker when there are several blocks).
  • Clean rendering: a titled rule with the language and block number, unindented, syntax-highlighted code, and a closing rule.
  • A grey ✓ Copied appears next to the button for two seconds — no popups.
  • Copies through Pi's own clipboard (wl-copy, xclip, xsel, pbcopy, …) and sends the same text to the terminal as OSC 52, so apps that keep their own clipboard (for example VS Code running under XWayland) get it too.
  • No dependencies, no network access, never executes anything.

Install

pi install npm:pi-code-copy

Then restart Pi.

Requirements

  • Clickable button: Pi's fullscreen UI (/settings → TUI mode → fullscreen, or "tuiMode": "fullscreen" in ~/.pi/agent/settings.json) and a terminal with OSC 8 hyperlinks (Konsole, VS Code, kitty, WezTerm, iTerm2, GNOME Terminal and most modern terminals). In the regular UI the terminal owns the mouse, so the button is hidden and Alt+N / /cc are used instead.
  • Linux on Wayland: install wl-clipboard (wl-copy). Pi needs it for every clipboard action; without it this extension falls back to OSC 52, which not every terminal honours.

How it works

  • Pi has no public API for code block rendering, so the extension wraps Markdown.prototype.renderToken for code tokens only. If a Pi update changes that method, rendering silently falls back to Pi's default and keyboard copy keeps working.
  • On Wayland the extension runs wl-copy --type text/plain;charset=utf-8 itself. Plain wl-copy (what Pi's own clipboard helper runs) guesses the MIME type from the content and offers only that type: multi-line Python can come out as application/x-ruby, and editors, VS Code and Klipper then paste the previous clipboard instead.
  • The button is an OSC 8 link pi-copy:<hash>. In fullscreen mode Pi handles link clicks itself; the extension wraps that handler so pi-copy: links copy the block and every other link opens as usual.

Tested with Pi 0.87.1.

Development

npm test            # self-check of the code block parser
pi -e ./extensions/code-copy/index.ts

License

MIT