/witty

WiTTY is a smart unix terminal emulator powered by large code language models.

Primary LanguageGoOtherNOASSERTION

WiTTY

Witty is a smart terminal emulator powered by large code language models. It currently supports OpenAI Codex 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.

Getting Started

To use Codex, you will need an OpenAI API key with access to the Codex models. You can request one here. As of this writing, Codex is in private beta and requires an invitation to access.

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. As of this writing, CodeWhisperer is in public beta and can be accessed by anyone with a free AWS Builder account.

Installation

From source

git clone https://github.com/jjviana/witty.git
cd witty/cmd/witty
go build .
./witty 
(see -h for options)

From binary releases

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.

Running

./witty -e codex|codewhisperer [options]

The first time it is run with a specific engine, it will ask you to either provide an API key (for Codex) 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.

Demos

In the demos below the autocomplete suggestions are rendered in red.

Command-line

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

Kubernetes controlled from natural language:

witty_kubernetes.mov

System Administration

Here Witty generates configuration changes for the Nginx web server based on user prompts:

nginx_config.mp4

Git workflow

Here Witty suggests a Git commit message based on the source code diff:

witty-git.mov

Data Science

Here Witty manipulates a CSV file and performs data transformations, while seamlessly switching from bash to Python:

data_science.mp4

Databases

Generating a SQL query based on table descriptions and prompt:

witty_postgresql.mp4

Credits

This project would not have been possible without: