Witty is a smart terminal emulator powered by large code language models. It currently supports OpenAI GPT-3.5 and Amazon CodeWhisperer.
As any terminal emulator, Witty will start the selected shell and pass all input to it. However, every time the terminal is idle (5 seconds by default), Witty will attempt to generate a completion suggestion. The suggestion will be rendered in a different color (configurable through the -c argument). Pressing tab will cause the suggestion to be accepted, and Witty will behave as if the user had typed it. Pressing any other key will cause the suggestion to be discarded. See the Demos section below for examples.
To use GPT-3.5, you will need an OpenAI API key.
To use CodeWhisperer, you will be asked the first time you run Witty to log in using your AWS Builder ID and authorize Witty to access CodeWhisperer on your behalf.
git clone https://github.com/jjviana/witty.git
cd witty/cmd/witty
go build .
./witty
(see -h for options)
Binaries for MacOS, Linux and Freebsd can be found in the releases page.
Mac users will need to manually open the app the first time, as it is not signed. To do that, right-click on the app and select "Open". You will be prompted to confirm that you want to open the app. It will immediately quit after that, but you will be able to open it normally from now on.
./witty -e gpt3.5|codewhisperer [options]
The first time it is run with a specific engine, it will ask you to either provide an API key (for GPt-3.5) or log in with your AWS Builder ID (for CodeWhisperer).
Witty will run your default shell (specified in the SHELL environment variable) unless you specify a different command to run with the -c option.
Arguments after --
argument will be passed to the shell.
For instance, to run witty using CodeWhisperer and configuring the shell as a login shell:
./witty -e codewhisperer -- --login
See witty -h
for the full list of options.
In the demos below the autocomplete suggestions are rendered in red.
Witty knows how to perform many mundane command-line tasks in different operating systems. Here it suggests how to handle image conversion:
witty_convert.mov
Kubernetes controlled from natural language:
witty_kubernetes.mov
Here Witty generates configuration changes for the Nginx web server based on user prompts:
nginx_config.mp4
Here Witty suggests a Git commit message based on the source code diff:
witty-git.mov
Here Witty manipulates a CSV file and performs data transformations, while seamlessly switching from bash to Python:
data_science.mp4
Generating a SQL query based on table descriptions and prompt:
witty_postgresql.mp4
This project would not have been possible without:
- OpenAI GPT-3.5
- Amazon CodeWhisperer
- vt10x, a terminal emulator backend in Go
- tcell, a terminal screen renderer in Go