AI-powered CLI error explainer using Gemini
termExplain is a Python-based command-line tool that takes terminal errors and explains them using Google's Gemini AI. It provides clear, actionable explanations of what went wrong, why it happened, and how to fix it.
# Add the tap
brew tap smundhra-git/explain
# Install termExplain
brew install termexplain# Clone the repository
git clone https://github.com/smundhra-git/termExplain.git
cd termExplain
# Install in development mode
pip install -e .-
Get a Gemini API Key:
- Visit Google AI Studio
- Create a free account and get your API key
-
Set your API key:
export GEMINI_API_KEY="your-api-key-here"
-
Add to your shell profile (optional):
echo 'export GEMINI_API_KEY="your-api-key-here"' >> ~/.zshrc source ~/.zshrc
explain "ModuleNotFoundError: No module named 'requests'"explain --file my_script.py
explain --file app.jsexplain
# Then enter your error when promptedexplain --help
explain --version# Explain a Python import error
explain "ModuleNotFoundError: No module named 'pandas'"
# Explain a JavaScript error
explain "ReferenceError: x is not defined"
# Run a Python file and explain any errors
explain --file my_script.py
# Cache an explanation for future use
explain --save "Permission denied"- Python 3.8 or higher
- Gemini API key
- Internet connection for AI explanations
google-generativeai: Google Gemini AI clientclick: Command-line interface creation kitrich: Rich text and beautiful formattingcolorama: Cross-platform colored terminal textpython-dotenv: Environment variable managementrequests: HTTP library
MIT License - see LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
If you encounter any issues, please report them on the GitHub issues page.