pi-open-last-response

内容来源:README.md(说明文档) · 原始地址 · 查看安装指南

原始内容

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:

  1. editor command passed as command args, e.g. /open-last cursor
  2. PI_OPEN_LAST_EDITOR
  3. non-terminal VISUAL / EDITOR
  4. 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

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