pi-quit-aliases
v0.1.1
Published
pi extension: /exit slash command + bare exit/quit/:q aliases for /quit
Downloads
262
Readme
quit-aliases
A tiny pi extension that adds more ways to exit.
Triggers
| Input | When it exits |
| --- | --- |
| /exit | Slash command (appears in / autocomplete + command list) |
| exit | Bare word, exact match (trimmed, case-insensitive) |
| quit | Bare word, exact match |
| :q | Bare word, exact match |
/quit (pi's built-in) is untouched and still works.
All four triggers call ctx.shutdown() — pi's documented graceful shutdown, available in all contexts (event handlers, tools, commands, shortcuts).
Matching rules (bare words)
- The whole input must equal the trigger word, after trimming and lowercasing. So
Exit,QUIT,:Qall exit;exit now,please quit,just :q itdo not exit (they go to the agent as normal messages). - Option B — any time: works even while the agent is generating. The shutdown aborts the in-flight stream gracefully.
event.source === "extension"is skipped, so another extension callingsendUserMessage("exit")cannot accidentally trigger an exit.
How it works
Two hooks:
pi.registerCommand("exit", …)— registers/exit. No built-in/exitexists, so it registers cleanly (no/exit:1//exit:2suffix). Its handler callsctx.shutdown().pi.on("input", …)— catches the bare words. Theinputevent fires after the slash-command check (so bare words with no/reach it) and before skill/template expansion. On a match it callsctx.shutdown()and returns{ action: "handled" }so the word is never sent to the agent.
Install
Install from npm (global, auto-discovered):
pi install npm:pi-quit-aliasesProject-local (writes to .pi/settings.json, shared with your team):
pi install -l npm:pi-quit-aliasesOr install from git:
pi install git:github.com/ymy88/pi-quit-aliasesThen in pi: run /reload (or restart pi) to load it.
Verify
After /reload:
/exit→ exitsexit,quit,:q,Exit,QUIT→ each exitsexit now→ does not exit (goes to the agent)/quit→ still exits (built-in, untouched)
