@tbanowl/pi-exit
v0.1.1
Published
Exit pi with /exit, /e, /ex, /exi, or :q
Readme
pi-exit
A small pi extension that adds familiar ways to leave an interactive session.
Commands
The canonical command is /exit. These aliases have the same effect:
| Input | Meaning |
| --- | --- |
| /exit | Exit pi |
| /e | Alias for /exit |
| /ex | Alias for /exit |
| /exi | Alias for /exit |
| :q | Alias for /exit |
Matching is case-sensitive and applies to the complete trimmed input. For example, /exit now, /E, :q!, and :q foo are ordinary prompts rather than exit commands.
Only text entered by a person in pi's TUI can trigger this extension. RPC input, print/JSON modes, messages injected by other extensions, and prompts with image attachments are not intercepted.
Behavior
An exit input uses pi's graceful extension shutdown API, following the same shutdown path as the built-in /quit command. It does not call process.exit() directly and does not add a confirmation dialog.
If the agent is running, pi-exit first aborts the current operation and discards queued steering or follow-up messages, then requests graceful shutdown. The request is idempotent.
The slash autocomplete list contains only the canonical /exit entry. Aliases do not appear in autocomplete and are recognized when submitted.
Known timing difference from /quit
Pi queues ordinary extension input while session compaction is running. If /exit or an alias is submitted during compaction, it takes effect after compaction finishes. The built-in /quit command can exit immediately during that state.
Requirements
- Node.js 22.19 or newer
@earendil-works/pi-coding-agent0.84.x or compatible@earendil-works/pi-tui0.84.x or compatible
Installation
Install the npm package globally in pi so the commands are available in every project:
pi install npm:@tbanowl/pi-exitYou can also install the package directly from GitHub:
pi install git:github.com/tbanowl/pi-exitRestart pi after installation. To remove the npm package:
pi remove npm:@tbanowl/pi-exitTo try the published package without installing it:
pi -e npm:@tbanowl/pi-exitFor local development, load the extension entry point from this checkout:
pi -e ./extensions/index.tsDevelopment
Install development dependencies and run all automated checks:
npm install
npm run checkIndividual commands:
npm run typecheck
npm testManual TUI smoke test
- Start
pi -e ./extensions/index.ts. - Confirm slash autocomplete shows
/exitbut not/e,/ex, or/exi. - Start a fresh pi process for each of
/exit,/e,/ex,/exi, and:q; verify each exits without confirmation. - Start a streaming answer, submit an exit alias, and verify generation is aborted before pi exits.
- Verify
/exit now,/E,:q!, and:q fooare sent to the model rather than intercepted. - Load a small observer extension with a
session_shutdownhandler and verify it receives{ reason: "quit" }on exit. - Start compaction, submit an exit alias, and verify pi exits after compaction finishes.
- Run
pi install npm:@tbanowl/pi-exit(or install this checkout by absolute path before the first npm release), start pi from another directory, and repeat an exit check.
License
MIT
