SHAI is a command-line tool that uses AI to suggest and execute shell commands based on natural language descriptions. Instead of remembering complex command syntax, simply describe what you want to do, and SHAI will suggest appropriate commands.
- Natural language to shell command conversion
- Multiple command suggestions for each query
- Interactive command selection and modification
- Support for custom OpenAI API endpoints
- Cross-platform support (Linux, macOS, and Windows)
Pre-built binaries for Linux, MacOS, and Windows can be found on the releases page.
You can use the following command on Linux, MacOS, or Windows to download the latest release, shai replace DEST with the directory where you'd like to put shai:
curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/y1j2x34/shai/refs/heads/master/install.sh | bash -s -- --to DEST
# create ~/bin
mkdir -p ~/bin
# download and extract shai to ~/bin/shai
curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/y1j2x34/shai/refs/heads/master/install.sh | bash -s -- --tag v0.1.0 --to ~/bin
# add `~/bin` to the paths that your shell searches for executables
# this line should be added to your shells initialization file,
# e.g. `~/.bashrc` or `~/.zshrc`
export PATH="$PATH:$HOME/bin"
# shai should now be executable
shai --help
-
Clone the repository:
git clone https://github.com/y1j2x34/shai.git cd shai
-
Build and install:
# For Unix-like systems cargo build --release sudo mv target/release/shai /usr/local/bin/ # For Windows (PowerShell) cargo build --release Move-Item -Path .\target\release\shai.exe -Destination "$env:USERPROFILE\AppData\Local\Microsoft\WindowsApps\shai.exe"
SHAI requires environment variables for configuration. Create a .env
file in your home directory or set the following environment variables:
# Required: Your AI API key
SHAI_API_KEY=your-api-key-here
# Optional: Custom AI API endpoint (default: https://openrouter.ai/api/v1)
SHAI_API_ENDPOINT=https://openrouter.ai/api/v1
# Optional: AI model to use (default: meta-llama/llama-3.1-70b-instruct:free)
SHAI_MODEL=meta-llama/llama-3.1-70b-instruct:free
# Optional: Number of command suggestions to generate (default: 2)
SHAI_SUGGESTION_COUNT=2
shai "your command description here"
-
Find large files:
shai "find files larger than 1GB in the current directory"
-
Process text files:
shai "search for the word 'error' in all log files"
-
System maintenance:
shai "clean up old docker images and containers"
The tool will:
- Generate multiple command suggestions based on your description
- Display them in an interactive selection menu
- Allow you to modify the selected command before execution
- Execute the chosen command
This project is licensed under the MIT License - see the LICENSE file for details.