cpwrap [arg ...]
wraps the execution of whatever command you pass it. It sends the session transcript to GitHub Copilot (you must be subscribed) and shows suggestions you can accept by pressing tab, at which point it's just like you had typed that yourself into the command. There is no need for the wrapped program to know anything about copilot; cpwrap
creates a new pseudo-terminal, so the wrapped program can't (and more importantly doesn't need to) tell the difference between what you typed and what you autocompleted.
Tab=accept, ESC=reject, F1=toggle on/off
demo_new.mp4
node
- copilot
dist
folder somewhere on your system (like what comes with copilot.vim)
cpwrap
will look for the dist folder in:
CPWRAPPATHDIST
environment variable~/.config/cpwrap/pathdist
filepathcopilotdist
global variable incpwrap.c
- extension locations for vim and neovim
Otherwise, it will prompt for the location and then save that.
I'm not sure; there are some other unofficial plugins. cpwrap
tries to be a good citizen (identifying itself, giving notifications for show/accept/reject).
Copilot thinks we are editing a file called /tmp/shell_session.txt
whose contents are $ arg ...\n
followed by the transcript of the session.
My first pass at this used the Codex API, but it ended up being way too expensive. One interesting thing was that when you started a shell session, like cpwrap sh
, the first suggestion every time was cat /etc/passwd
. I notice that when you use copilot in that situation, it doesn't say anything.