pi-upgrade

Pi extension that adds a /upgrade command to self-upgrade pi

Package details

extension

Install pi-upgrade from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-upgrade
Package
pi-upgrade
Version
0.2.1
Published
Mar 23, 2026
Downloads
130/mo · 19/wk
Author
maxpetretta
License
MIT
Types
extension
Size
17.9 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./src/upgrade.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-upgrade

A pi extension that adds an /upgrade command for upgrading the core pi-coding-agent CLI to the latest npm release.

Install

pi install npm:pi-upgrade

Or from GitHub:

pi install git:github.com/maxpetretta/pi-upgrade

Usage

/upgrade

Flags:

  • /upgrade --force — reinstall even if already on latest
  • /upgrade --dry-run — show what would run without doing it

After a successful upgrade, the extension shows a 5-second restart countdown and automatically relaunches pi on the current session in interactive TUI mode. In non-interactive modes, it falls back to the normal manual restart message.

What it does

  1. Finds the running pi binary and walks up to its package.json
  2. Detects the package manager from the install path (npm, pnpm, yarn, bun)
  3. Prefers the package manager sibling to the current Node runtime
  4. Checks the npm registry for the latest published version
  5. Runs the appropriate global install command
  6. Automatically relaunches pi on the current session after a successful upgrade when interactive TUI mode is available
  7. Otherwise tells you to restart pi afterward

Why restart?

/reload only reloads extensions, skills, prompts, and themes. The core pi runtime is already loaded in memory, so a process restart is needed to pick up the new version.

Development

This package uses Bun for local development.

bun install
bun run lint
bun run typecheck
bun test

License

MIT