@yuanwentao/pi-toolbox
v0.2.0
Published
A toolbox of small quality-of-life extensions for the pi coding agent.
Downloads
208
Maintainers
Readme
pi-toolbox
A toolbox of small quality-of-life extensions for the pi coding agent.
Features
Copy all editor text to clipboard
Press the hotkey (default Alt+C) to copy the entire contents of the
input editor to the system clipboard — no mouse selection needed.
pi's built-in Ctrl+C clears the editor and Ctrl+X copies the last assistant
message, but there was no single-key way to copy what you are currently typing.
This extension fills that gap.
Installation
Published on npm as @yuanwentao/pi-toolbox. Install it with pi:
pi install npm:@yuanwentao/pi-toolboxThis adds it to ~/.pi/agent/settings.json so it loads in every session.
Try without installing — load it just for the current run:
pi -e npm:@yuanwentao/pi-toolboxFrom git (tracks a branch, no npm publish needed):
pi install git:github.com/15wtyuan/pi-toolboxFrom a local checkout (for development):
pi -e ./src/index.tsAfter editing settings.json by hand, run /reload in pi to pick up the change.
Configuration
The hotkey is remapped in pi's standard ~/.pi/agent/keybindings.json, using
the keybinding id pi-toolbox.copyEditor. A single string or an array of
strings (to bind multiple keys) is accepted:
{
"pi-toolbox.copyEditor": "ctrl+shift+c"
}or, to bind several keys at once:
{
"pi-toolbox.copyEditor": ["alt+c", "ctrl+shift+c"]
}Run /reload in pi after editing.
Why keybindings.json? Pi's own shortcuts live there, so it's the natural place. Note that pi's
registerShortcut()binds a concrete key sequence (likealt+c), not a keybinding id, and there is no extension API to register a custom id into pi's native keybinding table. So this extension reads yourkeybindings.jsonand binds the key you configured there — the id is ours, the file is pi's. Like pi's built-in keybindings, only the global~/.pi/agent/keybindings.jsonis read (not a project-local one).
Key id format
Keys use the modifier+key format, e.g. alt+c, ctrl+shift+c, ctrl+alt+k.
See pi's keybindings docs for the full grammar.
Avoid reusing keys that pi already binds (e.g. ctrl+c, ctrl+x, ctrl+d).
The default alt+c is free — pi binds other alt+ combos but not alt+c.
Development
npm install # install type dependencies
npm run typecheck # tsc --noEmitTypeScript is loaded directly by pi via jiti, so there is no build step — just
edit src/index.ts and /reload.
