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-print-stream

v0.1.0

Published

Pi extension adding a --stream flag: run non-interactively and stream the turn (thinking, text, and tool activity) to stdout as it happens — no TUI, no JSON.

Readme

pi-print-stream

A Pi extension that adds a --stream CLI flag.

pi -p "your prompt here" --stream

Runs the turn non-interactively and streams it as it plays out — thinking deltas, text deltas, and tool activity — as plain text, with no TUI and no JSON envelope.

How it works — a wrapper over pi --mode json -p

--stream does not drive the turn itself. It intercepts the prompt and spawns a child pi --mode json -p "<prompt>" (inheriting your model/flags), pretty-prints the child's JSON event stream, and returns handled so Pi's own turn doesn't also run. The child uses Pi's real print-mode path, so prompt handling, the retry loop (429/5xx/empty/transient), and compaction are exactly what a normal pi -p run gets — no reimplemented (and subtly broken) turn lifecycle inside the extension.

Usage

pi -p "explain this repo" --stream      # recommended
pi --stream "explain this repo"         # also works (prompt recovered from argv)
echo "explain this repo" | pi --stream  # piped stdin
pi -p "..." --stream | less -R           # keep ANSI colors in a pager

Install

pi install npm:pi-print-stream

or, for local development:

pi -e ./src/extension.ts -p "your prompt" --stream

What you get

$ pi -p "What is 2+2? Think first." --stream

── thinking ──
The user wants 2+2. That's basic arithmetic: 4.

The answer is 4.

Tool calls are shown inline as they run:

→ read({"path":"/etc/hostname"})
← read done

Behavior notes

  • Non-interactive only. The flag is active when there's no TUI — i.e. print mode (-p, or any run where stdout is not a TTY, such as a pipe or script). In interactive mode the TUI already renders the turn, so --stream is a no-op and the terminal is left untouched.
  • No duplicated output. In plain print mode Pi normally echoes the final assistant text after the turn. Since --stream already streamed that text live, the extension strips the text blocks from the finalized message so it isn't printed twice. Tool calls and thinking in the transcript are left intact. Pass --no-session if you don't want the (text-trimmed) transcript persisted at all.
  • JSON mode is untouched. Under --mode json Pi emits its own machine event stream and does no text echo, so --stream stays out of the way.

Colors

Thinking is dimmed, tool activity is cyan, answer text is default. Colors are ANSI escapes; pipe through a pager with -R (e.g. less -R) to preserve them, or they'll degrade gracefully to plain text in most capture contexts.

License

MIT