Skip to content

dotemacs/pi-update

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

pi /update command extension

It updates the currently installed pi, from an active session.

If there is a newer version of pi, it installs it and builds the command to resume the session (pi --session <session-ID>), which you can paste and continue where you left off.

Why this stop & paste to resume the session?

Because ctx.reload() only reloads extensions/resources within the current running process. It does not replace the already-loaded pi core code in memory after npm install -g updates files on disk. To guarantee the new global pi version is actually running, the command exits (ctx.shutdown()) and gives you a resume command for the same session.

/update behavior

  1. Checks currently installed global version of @mariozechner/pi-coding-agent
  2. Checks latest available version from npm (npm view ... version)
  3. If versions differ, installs the new version globally

Then:

  • If a newer version was installed successfully:
    • builds pi --session <session-ref> (prefers getSessionFile(), fallback getSessionId())
    • copies that command to clipboard (best-effort)
    • prints Resume previous pi session: pi --session <session-ref>
    • calls ctx.shutdown()
  • If already up to date:
    • no install, no restart

Clipboard backends tried (order): pbcopy, wl-copy, xclip, clip.exe.

Install

Project-local:

  • .pi/extensions/update.ts

Global:

  • ~/.pi/agent/extensions/update.ts

Quick test:

pi -e ./update.ts

About

`/update` pi agent to the latest version, from a running pi session and resume the active session

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors