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

@elafo/pi-better-snippets

v0.3.0

Published

Previews syntax-highlighted fenced snippets and copies them individually from Pi assistant responses.

Readme

pi-better-snippets

Pi package

Pi extension that renders fenced code blocks in assistant responses as syntax-highlighted panels and lets you copy each snippet independently.

Pi TUI showing the snippet picker

Watch the real Pi TUI demo (MP4).

Requirements

  • Node.js >=22.19.0.
  • Pi coding agent and Pi TUI host peers. Official Pi package documentation requires the core host peer ranges to be *; this is a host-resolution contract, not a claim that every host version is compatible. Pi coding agent/TUI 0.85.1 is the enforced supported floor, and CI separately tests current registry latest. Other host versions require recorded CI evidence and are not guaranteed by this README.
  • An interactive Pi TUI session for the picker and clipboard actions. Copying is not available in print, JSON, or RPC-only use.

The public Git repository and npm publication are external release gates. This repository does not claim that the public Git URL or npm package is currently available; verify availability before relying on either installation source.

Install

Review the source before installing. Pi packages execute with the permissions of the Pi process, and assistant responses can contain untrusted content.

Install the npm package globally:

pi install npm:@elafo/pi-better-snippets

Install the npm package for the current project only:

pi install -l npm:@elafo/pi-better-snippets

Install from the public Git source globally:

pi install git:github.com/eLafo/pi-better-snippets

Install the Git source for the current project only:

pi install -l git:github.com/eLafo/pi-better-snippets

Use one source, rather than installing both copies. Public Git and npm availability must be verified as part of a release; a local checkout or package archive is not evidence that either public source is published.

Update

Update one installed package, preserving its global or project scope:

pi update npm:@elafo/pi-better-snippets
# or
pi update git:github.com/eLafo/pi-better-snippets

To update all installed packages, use pi update --extensions. A Git installation pinned to a tag or commit does not move to a newer ref automatically; install the new ref explicitly, for example pi install git:github.com/eLafo/pi-better-snippets@<tag>.

Use

  • Ctrl+Shift+C or /copy-snippet: opens the same picker showing the snippets and a preview. The picker supports navigation, paging, selection, and cancellation. Press / to enter opt-in search, type a query, then press Esc to leave search and restore the normal list. Search filters only snippet number, language, and the bounded one-line preview.
  • /copy-snippet <n>: copies snippet n, including snippets after the ninth.

/copy-snippet is the shortcut fallback when the key binding is unavailable or conflicts with another Pi binding.

The extension preserves the original Markdown in the session. It only changes its terminal rendering and copies the content inside complete backtick or tilde fences.

The picker labels, one-line previews, and rendered panels are sanitized and bounded display text. They can omit or truncate content, including a suffix that is not visible in the preview. An explicit copy action instead sends the complete raw body of the selected fence to the OS clipboard, including any control characters or other unseen content in that body. Never treat the preview as a complete safety review: paste into a safe text editor and inspect the full content before execution or sharing.

Safety and clipboard privacy

Snippets originate in potentially untrusted assistant responses. Review the selected code and its language metadata before executing, sharing, or storing it. The extension does not vouch for the safety of assistant-generated content.

Copying happens only after an explicit user action through the shortcut or /copy-snippet. Only the selected fence body is sent to the clipboard: fence markers, language labels, picker text, and explanations are excluded. The selected body may contain anything present in the assistant response, including secrets or terminal-control text, so review it before copying.

The operating system clipboard and clipboard managers may expose, retain, synchronize, or store copied text in clipboard history. The extension does not control that persistence or clear history; use the privacy controls provided by your OS or clipboard manager.

Localization

Interface text selects Spanish when the system locale language is es (including variants such as es-MX) and English for other locales or invalid locale values. The current bundled catalog supports only English and Spanish; it does not automatically add arbitrary new locales. Some technical key labels remain as provided by the current UI catalog.

The bundled copyable-snippets skill helps Pi format user-requested content as separate, clean fenced blocks. It activates for explicit copyable/clipboard-ready requests, not merely because an ordinary answer contains code.

Uninstall

Remove a global installation:

pi remove npm:@elafo/pi-better-snippets
# or, for a Git installation:
pi remove git:github.com/eLafo/pi-better-snippets

Remove a project-local installation with -l:

pi remove -l npm:@elafo/pi-better-snippets
# or
pi remove -l git:github.com/eLafo/pi-better-snippets

Restart Pi after changing package settings. If both sources were installed, remove each source separately.

Troubleshooting

  • Wrong runtime or tested host baseline: run node --version and pi --version. Upgrade Node to 22.19.0 or newer; Pi coding agent/TUI 0.85.1 is the currently tested baseline. Later host versions need CI evidence and are not guaranteed.
  • The extension is not loaded: run pi list, confirm the package is installed in the intended global or project scope, then run pi update <source> and restart an interactive pi session. Project-local installs may require --approve when Pi asks for trust.
  • The picker does not appear: use an interactive pi TUI, not pi -p, JSON, or RPC-only mode. Try /copy-snippet, which is the documented shortcut fallback, and confirm that the latest assistant response contains complete fenced blocks.
  • Copying fails: check that the OS clipboard provider is available and that Pi can access it. Retry the explicit copy action and inspect the reported error; the extension does not silently retry or clear clipboard history.
  • Unexpected language: set the desired locale before starting Pi (for example, LANG=es_MX.UTF-8 pi) and restart Pi. Only es* locales select Spanish; all other locales select English.
  • Install or update errors: verify the requested npm/Git source is publicly available and that the network can reach it. Public availability is a release gate and is not implied by this checkout.

Develop

Source-repository maintenance instructions, including validation, dependency lifecycle review, releases, and the quality checklist, are in DEVELOPMENT.md.

License

MIT