Hook is a lightning-fast CLI tool that uses AI to generate shell commands based on a user query. Simply write what you want to do in the terminal, and let AI do the work!
Written 100% in Go. Should work in Linux, macOS and Windows!
- Go
- Gemini API Key (get a free one from Google AI Studio)
Set up your API key:
- Option 1: Set
GEMINI_API_KEY
environment variable - Option 2 (deprecated): Create a
.api-key
file with your API key
-
Clone the repository
-
Build the project:
go build .
- Move the executable file somewhere in your PATH, for instance
/usr/local/bin
:
sudo mv ./hook /usr/local/bin
./hook "describe what you want to do"
The program outputs the command that should be typed in the console.
Add to your .zshrc
:
function __hook() {print -z $(hook ${@:2})}
alias '?'=__hook
Now just type ? description
and the shell prompt will be auto-filled with the suggested command. No more copy-pasting!
- Pre-built binaries
- Easier setup and configuration (setup script)
- Proper config file support, better (OS-agnostic) API key handling
- Windows command shell and Powershell testing
- Easier ZSH configuration on install and other shell support
- Local (offline) LLM support
- OpenAI, Claude support, more?
Inspired by Warp terminal's AI prompt.
GPL v3