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

@rwese/pi-inject

v1.0.0

Published

pi extension for injecting messages into a running pi TUI via Unix Domain Socket

Readme

pi-inject

CLI tool and pi extension for injecting messages into a running pi TUI via Unix Domain Socket.

Overview

This tool enables external scripts, hotkeys, or applications to communicate with a running pi TUI session. Useful for:

  • Triggering pi actions from external scripts
  • Hotkey integration (e.g., send selected text to pi)
  • CI/CD pipeline integration
  • Custom automation workflows

Installation

Option 1: Development (Local)

# Clone or copy to your extensions directory
cp -r pi-inject ~/.pi/agent/extensions/

# Make the CLI executable
chmod +x ~/.pi/agent/extensions/pi-inject/src/pi-inject.ts

Option 2: npm Package

npm install -g pi-inject

Configuration

Socket Path

By default, the socket is created at ~/.pi/injector.sock. Override with the PI_INJECTOR_SOCKET environment variable:

# Custom socket path
PI_INJECTOR_SOCKET=/tmp/pi-inject.sock pi

# Then use the same path in CLI
PI_INJECTOR_SOCKET=/tmp/pi-inject.sock pi-inject "message"

Important: Both pi (with the extension) and the CLI must use the same socket path.

Usage

Starting pi with the Extension

The extension auto-starts when pi loads it. Ensure it's in your extensions directory:

pi

Or load explicitly:

pi -e ./pi-inject

CLI Commands

# Send a message (steer by default)
pi-inject "Fix the tests"

# Send a steer message (interrupts current processing)
pi-inject --steer "Stop that and focus on X"

# Queue a follow-up (waits for current task)
pi-inject --followup "After this, also do Y"

# Execute a slash command
pi-inject /reload
pi-inject /compact
pi-inject /model

# Check if injector is running
pi-inject --ping

# With verbose output
pi-inject -v "Your message"

In-pi Commands

When pi is running with the extension:

/inject-status   # Check socket status
/inject-restart # Restart the socket server

Protocol

The socket server listens on ~/.pi/injector.sock and accepts JSON messages:

{ "type": "steer", "message": "Focus on X" }
{ "type": "followup", "message": "After this, do Y" }
{ "type": "command", "command": "/reload" }
{ "type": "ping" }

Responses:

{ "type": "ok" }
{ "type": "error", "message": "Command not found" }
{ "type": "pong" }

Architecture

┌─────────────────┐         ┌─────────────────┐
│   pi-inject     │ ──JSON──│  pi-injector    │
│   CLI client    │  socket │  (extension)    │
└─────────────────┘         └────────┬────────┘
                                     │
                              ┌──────▼──────┐
                              │  pi TUI      │
                              │  (running)   │
                              └──────────────┘

Requirements

  • pi coding agent
  • Node.js 18+

License

MIT