← Catalog

@pedro_klein/pi-term

Floating terminal panel for Pi TUI

Package

Install

Install with PiG

pig install npm:@pedro_klein/pi-term

Install with Pi

pi install npm:@pedro_klein/pi-term
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./src/index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.2.0 (README.md). PiG does not review it.

pi-term

Floating terminal panel inside pi's TUI. Launch shells, TUI tools, or any CLI program in an overlay without leaving your agent session.

I built this because switching windows while pi is working breaks my flow. With pi-term, I can run lazygit, a shell, or htop right inside the pi interface — and close it when I'm done.

Install

pi install npm:@pedro_klein/pi-term

Note: node-pty requires native compilation. If install fails, make sure you have a C++ build toolchain (xcode-select --install on macOS, build-essential on Linux).

What it provides

  • Command /term — launch, pick from a list, or run an ad-hoc command
  • Shortcuts — per-app keybindings registered at session start
  • Widget /term keys — shows active keybindings in the context bar

Commands

CommandDescription
/termOpen app picker
/term <name>Launch app by name
/term -- <cmd>Run any command in a floating terminal
/term keysToggle keybinding overlay in context bar

How it works

Each app opens as an overlay on top of pi's TUI. It's a real PTY — full color, interactive shells, curses apps, everything works. Press the configured close key (default ctrl+q) to dismiss.

Apps can be toggled (show/hide without killing the process) or one-shot (close on exit). Conditional apps (if field) are checked lazily at launch time so startup stays fast.

When a command exits, you can optionally:

  • Get a notification with exit code
  • Feed the command's output as context to the agent (feedContext)

Configuration

Create ~/.pi/agent/pi-term.json for global apps, or .pi/pi-term.json in any project for project-local apps. Both are merged — project-local wins on name collisions.

{
  "defaults": {
    "width": "80%",
    "height": "80%",
    "anchor": "center",
    "shell": "/bin/zsh",
    "closeKey": "ctrl+q",
    "holdOnExit": false,
    "toggle": false,
    "notify": false,
    "borderColor": "accent"
  },
  "apps": [
    {
      "name": "shell",
      "cmd": "$SHELL",
      "key": "ctrl+shift+t",
      "toggle": true
    },
    {
      "name": "lazygit",
      "cmd": "lazygit",
      "key": "ctrl+shift+g",
      "if": "command -v lazygit",
      "width": "95%",
      "height": "95%"
    },
    {
      "name": "htop",
      "cmd": "htop",
      "notify": true,
      "feedContext": "echo 'Process check complete'"
    }
  ]
}

App fields

FieldDefaultDescription
namerequiredDisplay name and /term <name> identifier
cmdrequiredCommand to run. Use $SHELL for an interactive shell
key—Keybinding to toggle/launch (e.g. ctrl+shift+t)
width"80%"Overlay width — percentage or absolute columns
height"80%"Overlay height — percentage or absolute rows
anchor"center"Overlay position: center, top, bottom, left, right
closeKey"ctrl+q"Key to close the overlay
shell$SHELLShell used to run cmd
togglefalseIf true, re-pressing the key hides/shows instead of reopening
holdOnExitfalseKeep overlay open after the process exits
notifyfalseShow exit code notification when process exits
feedContext—Shell command whose stdout is sent to the agent after exit
if—Condition checked before launching; skips if non-zero exit
cwdsession cwdWorking directory for the process
env—Extra environment variables
borderColor"accent"Border color (any pi theme color)

Defaults

All app fields except name and cmd fall back to the defaults block. Override defaults globally, then tweak per-app only what's different.

Development

pnpm test           # run tests
pnpm build          # build for publish
pnpm typecheck      # type-check without emitting

License

MIT