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-fzf

v0.9.0

Published

A [Pi](https://github.com/badlogic/pi) extension for fuzzy finding. Define commands that list candidates from any shell command, then perform actions on the selected item—fill the editor, send to the agent, or run shell commands.

Downloads

282

Readme

pi-fzf

A Pi extension for fuzzy finding. Define commands that list candidates from any shell command, then perform actions on the selected item—fill the editor, send to the agent, or run shell commands.

demo

Installation

From npm

pi install npm:pi-fzf

From git

pi install git:github.com/kaofelix/pi-fzf

Dependencies

The examples in this README use fd for fast file finding. It's not installed by default on most systems:

| OS | Install command | Notes | |----|-----------------|-------| | macOS | brew install fd | | | Ubuntu/Debian | apt install fd-find | Binary is fdfind, not fd (see below) | | Fedora | dnf install fd-find | | | Arch | pacman -S fd | |

Ubuntu/Debian note

On Ubuntu and Debian, the binary is installed as fdfind to avoid conflicts. Either:

  • Use fdfind in your commands instead of fd
  • Create a symlink: ln -s $(which fdfind) ~/.local/bin/fd

You can also use standard find instead of fd if you prefer not to install additional tools.

Configuration

Create a config file to define your commands:

  • ~/.pi/agent/fzf.json — global commands
  • <project>/.pi/fzf.json — project-specific (overrides global)

Each command has a list (shell command that outputs candidates) and an action (what to do with the selection):

{
  "commands": {
    "file": {
      "list": "fd --type f --max-depth 4",
      "action": "Read and explain {{selected}}"
    }
  }
}

This registers /fzf:file in Pi. The {{selected}} placeholder is replaced with the chosen candidate.

Keyboard Shortcuts

Add a shortcut field to trigger a command via a keyboard shortcut instead of typing /fzf:<name>:

{
  "commands": {
    "file": {
      "list": "fd --type f --max-depth 4",
      "action": "Read and explain {{selected}}",
      "shortcut": "ctrl+shift+f"
    }
  }
}

The shortcut format follows Pi's keybinding syntax: modifier+key where modifiers are ctrl, shift, alt (combinable).

Selector Placement

You can control selector widget placement in two ways:

  • Per-command via placement
  • Globally via top-level defaultPlacement

Allowed values:

  • "overlay" (default; classic floating panel)
  • "aboveEditor"
  • "belowEditor"
{
  "defaultPlacement": "belowEditor",
  "commands": {
    "file": {
      "list": "fd --type f --max-depth 4",
      "action": "Read and explain {{selected}}"
    },
    "branch": {
      "list": "git branch --format='%(refname:short)'",
      "action": { "type": "bash", "template": "git checkout {{selected}}" },
      "placement": "aboveEditor"
    }
  }
}

Precedence: command.placementdefaultPlacement"overlay".

Hide Header

Set hideHeader: true on a command to hide the selector title line (fzf:<name>).

{
  "commands": {
    "file": {
      "list": "fd --type f --max-depth 4",
      "action": "Read and explain {{selected}}",
      "hideHeader": true
    }
  }
}

Multi-select

Set multiSelect: true on a command to enable the fzf-style Tab workflow:

  • Tab — toggle the current item and move down
  • Shift+Tab — toggle the current item and move up
  • Enter — accept all marked items (or just the current item if nothing is marked)

When multiple items are accepted, {{selected}} becomes a newline-separated list. For bash actions, you can pipe that through tools like xargs.

{
  "commands": {
    "git-diff": {
      "list": "git diff --name-only",
      "multiSelect": true,
      "action": {
        "type": "bash",
        "template": "printf '%s\\n' '{{selected}}' | xargs -I{} git diff -- \"{}\"",
        "output": "editor"
      }
    }
  }
}

Preview Pane

Commands can optionally display a preview pane showing content for the selected candidate. Add a preview field with a command template:

{
  "commands": {
    "file": {
      "list": "fd --type f --max-depth 4",
      "action": "Read and explain {{selected}}",
      "preview": "bat --style=numbers --color=always {{selected}} 2>/dev/null || cat {{selected}}"
    }
  }
}

When preview is configured, the selector splits into two panes:

  • Left pane: Candidate list (35% width)
  • Right pane: Preview output (65% width)

The preview command receives the same {{selected}} placeholder as actions. Its output is displayed in the preview pane as you navigate through candidates.

Keyboard shortcuts for preview:

  • Shift+↑ / Shift+↓ — Scroll preview content (default, configurable)
  • Standard navigation keys work in the list pane

Preview Settings

You can customize preview scrolling behavior in the settings section:

{
  "settings": {
    "previewScrollUp": "shift+up",
    "previewScrollDown": "shift+down",
    "previewScrollLines": 5
  },
  "commands": { ... }
}

| Setting | Default | Description | |---------|---------|-------------| | previewScrollUp | shift+up | Keybinding to scroll preview up | | previewScrollDown | shift+down | Keybinding to scroll preview down | | previewScrollLines | 5 | Number of lines to scroll at a time |

Keybindings use Pi's keybinding syntax: modifier+key (e.g., alt+k, ctrl+u).

Actions

Editor (default)

Pastes text into the Pi editor at the current cursor position (without replacing existing text). You can review and edit before sending.

"action": "Explain {{selected}}"

Or explicitly:

"action": { "type": "editor", "template": "Explain {{selected}}" }

Send

Sends directly to the agent, triggering a turn immediately.

"action": { "type": "send", "template": "Explain {{selected}}" }

Bash

Runs a shell command. By default shows the result as a notification.

"action": { "type": "bash", "template": "git checkout {{selected}}" }

Add output to route the command's stdout elsewhere:

| Output | Behavior | |--------|----------| | "notify" | Show as notification (default) | | "editor" | Paste stdout into the editor at cursor | | "send" | Send stdout to the agent |

"action": {
  "type": "bash",
  "template": "cat {{selected}}",
  "output": "editor"
}

Examples

Override the @ trigger for file selection

By default, typing @ in Pi opens the autocomplete menu. You can override this to use pi-fzf for file selection instead:

"file": {
  "list": "fd --type f",
  "action": "@{{selected}}",
  "shortcut": "@"
}

Now pressing @ opens the fuzzy finder. Selecting a file inserts @<filename> into the editor, preserving Pi's file reference syntax.

This works for any key: use !, $, or any character as a custom trigger for your commands.

Find files and ask the agent to explain them

"file": {
  "list": "fd --type f --max-depth 4",
  "action": "Read and explain {{selected}}",
  "preview": "bat --style=numbers --color=always {{selected}} 2>/dev/null || cat {{selected}}"
}

Load a skill by name

"skill": {
  "list": "fd -L 'SKILL.md' ~/.pi/agent/skills ~/.pi/agent/git 2>/dev/null | sed -E 's|.*/skills/([^/]+)/SKILL\\.md|\\1|' | grep -v '/' | sort -u",
  "action": { "type": "editor", "template": "/skill:{{selected}}" }
}

Switch git branches

"branch": {
  "list": "git branch --format='%(refname:short)'",
  "action": { "type": "bash", "template": "git checkout {{selected}}" },
  "preview": "git log --oneline -10 {{selected}}"
}

View git diff in editor

"git-diff": {
  "list": "git diff --name-only",
  "action": {
    "type": "bash",
    "template": "git diff {{selected}}",
    "output": "editor"
  }
}

Find files with TODOs

"todo": {
  "list": "rg -l 'TODO|FIXME' || true",
  "action": { "type": "editor", "template": "Find and fix all TODOs in {{selected}}" }
}

A complete example config is available in examples/fzf.json.

Usage

  1. Type /fzf:<name> (e.g., /fzf:file) or press the configured shortcut
  2. Type to filter candidates
  3. Use ↑/↓ to navigate, Enter to select, Escape to cancel