原始内容
pi-open-last-response
A local Pi extension that writes the latest completed assistant response to a temporary Markdown file and opens it in your external editor.
Why
Long assistant replies are inconvenient to scroll through inside the Pi TUI. /open-last lets you read the newest reply in Cursor, VS Code, Zed, Sublime, or your configured editor without manually copying and pasting.
Install
From npm:
pi install npm:pi-open-last-response
From GitHub:
pi install git:github.com/wujunchuan/pi-open-last-response
For local development:
pi install /Users/john/Project/Github/pi-open-last-response
Then reload Pi:
/reload
Commands
/open-last
/open-last-response
/olast
Examples:
/open-last
/open-last cursor
/open-last code --reuse-window
/open-last --path-only
--path-only writes the Markdown file and prints the path without opening an editor.
Editor selection
Priority:
- editor command passed as command args, e.g.
/open-last cursor PI_OPEN_LAST_EDITOR- non-terminal
VISUAL/EDITOR - auto-detected GUI/open command:
- macOS:
cursor,code,zed,subl,open - Linux:
cursor,code,zed,subl,xdg-open - Windows:
cursor.cmd,code.cmd,notepad.exe
- macOS:
Recommended config:
export PI_OPEN_LAST_EDITOR="cursor"
# or
export PI_OPEN_LAST_EDITOR="code --reuse-window"
By default files are written under your OS temp directory, in pi-open-last-response/. Override with:
export PI_OPEN_LAST_DIR="$HOME/.pi/open-last"
Development
npm install
npm run check
Pi package
This repository is a Pi package because package.json contains:
{
"pi": {
"extensions": ["./src/index.ts"]
}
}
License
MIT