TermWhiz is an AI-powered terminal assistant that explains shell commands in simple language before executing them. It leverages Google Gemini's generative language API to provide concise, human-friendly explanations, helping users understand what a command does before running it—making the terminal safer and more approachable for everyone.
- AI-Powered Explanations: Get clear, two-sentence explanations for any terminal command using Google Gemini.
- Interactive Confirmation: Review the explanation and confirm before executing any command.
- Cross-Platform: Works on Windows, macOS, and Linux.
- Simple CLI & TUI: Clean command-line interface with potential for terminal UI enhancements.
- Input a Command:
Runtermwhiz <your-command>or launch without arguments to enter a command interactively. - AI Explanation:
TermWhiz queries the Gemini API and displays a concise explanation of what the command does. - User Confirmation:
You decide whether to proceed with execution based on the explanation. - Safe Execution:
If confirmed, the command runs in your shell; otherwise, execution is cancelled.
- Rust (edition 2021): Install Rust
- Google Gemini API Key:
- Get an API key from Google AI Studio.
git clone https://github.com/Kishan1835/termwiz.git
cd termwiz
cargo build --releaseCreate a .env file in the project root:
API_KEY=your-gemini-api-key-here
./target/release/termwhiz "echo Hello from TermWhiz"Or launch interactively:
./target/release/termwhizYou’ll see:
🔤 Enter a command to explain: ls -la
🧠 Command: `ls -la`
📘 Explanation:
Lists all files and directories in the current directory, including hidden ones, in long format.
❓ Do you want to execute this? [y/N]:
From your project root, run:
cargo build --releaseThis will create the binary at target/release/termwhiz.exe (on Windows) or target/release/termwhiz (on Linux/macOS).
- Copy the binary to a directory already in your
PATH(e.g.,C:\Windows\System32or another directory you prefer), or add thetarget\releasedirectory to yourPATH:
To add target\release to your PATH temporarily:
$env:PATH += ";C:\path\to\your\project\target\release"To add it permanently:
- Open the Start Menu and search for "Environment Variables".
- Click "Edit the system environment variables".
- In the System Properties window, click "Environment Variables".
- Under "System variables", find and select the
Pathvariable, then click "Edit". - Click "New" and add the full path to your
target\releasedirectory (e.g.,C:\Users\YourName\termwhiz\target\release). - Click OK to save.
- Copy the binary to
/usr/local/bin(requires sudo):
sudo cp target/release/termwhiz /usr/local/bin/Or add the target/release directory to your PATH in your shell profile (.bashrc, .zshrc, etc.):
export PATH="$PATH:/path/to/your/project/target/release"Now you can run termwhiz from any terminal window:
termwhiz "ls -la"or
termwhizTip:
If you update the binary, repeat the copy step to overwrite the old version in your global path.
- API Key:
Set theAPI_KEYin your.envfile or as an environment variable. - Debug Mode:
Run withcargo runin development to see debug logs.
- tokio - Async runtime
- reqwest - HTTP client
- serde, serde_json - JSON parsing
- dotenv - Environment variable management
- crossterm, ratatui - Terminal UI (future enhancements)
Pull requests and issues are welcome! Please open an issue to discuss your ideas or report bugs.
This project is licensed under the MIT License.
Warning: While TermWhiz helps explain commands, always review explanations and use caution before executing unfamiliar commands.