manai is an AI powered interactive command line completion for Zsh. Hotkey to trigger and ask anything about your work-in-progress command line.
-
Clone this package to somewhere you are comfortable with (e.g.
$HOME/.dotfiles/manai
)$ git clone [email protected]:mecab/manai.git $HOME/.dotfiles/manai
-
Download manai binary (why?/you don't trust the binary? see Build Manai Binary by Yourself)
$ $HOME/.dotfiles/manai/download-manai.zsh
-
Source
manai.zsh
in your zshrc, set yourOPENAI_API_KEY
then bindmanai
function to any keybind$ nano ~/.zshrc
and add the following
export OPENAI_API_KEY="your-openai-api-key" source $HOME/.dotfiles/manai/manai.zsh # bind to `Alt-h`. Update this to your preference! bindkey '\eh' manai
Note: You can also specify
MANAI_OPENAI_API_KEY
instead ofOPENAI_AI_KEY
formanai
exclusive use. -
then reload your zshrc
$ exec $SHELL -l
Manai uses a binary executable to process the output from ChatGPT because it is difficult to handle the streamed output using only shell scripts. For convenience, pre-built binaries are distributed, but you can also build it yourself. It is written in TypeScript and can be compiled if you have Bun installed.
-
Install JS Dependencies
$ cd $HOME/.dotfiles/manai $ bun install
-
Build the binary
$ bun run build
It should generate
bin/manai
binary for your architecture.
- man + AI
- (悩)まない (naya)manai - "worry-free" in Japanese