A smart command-line assistant that converts natural language requests into shell commands using Google's Gemini AI model.
Shell AI is a Python-based tool that helps users generate shell commands from natural language descriptions. It uses Google's Gemini 2.0 Flash model to understand user requests and provide appropriate shell commands with explanations of the reasoning process.
- 🤖 AI-powered command generation using Google Gemini 2.0 Flash
- 🧠 Transparent reasoning - shows AI's thought process before providing commands
- 🔒 Safety first - asks for confirmation before executing commands
- 🌍 Multilingual support - responds in the same language as your request
- ⚡ Simple CLI interface - easy to use from any terminal
- Python 3.10 or higher
- Google AI API key (Gemini)
-
Clone the repository:
git clone https://github.com/Bayashat/Shell-ai.git cd Shell-ai
-
Install dependencies using uv (recommended):
uv sync
Or using pip:
pip install -e .
-
Set up your Google AI API key:
Create a
.env
file in the project root:echo "GEMINI_KEY=your_api_key_here" > .env
To get a Google AI API key:
- Visit Google AI Studio
- Sign in with your Google account
- Create a new API key
- Copy the key to your
.env
file
After installation, you can use the ai
command from anywhere in your terminal:
ai "list all files in the current directory"
ai "find all Python files modified in the last 7 days"
ai "create a backup of my home directory"
$ ai "show disk usage for the current directory"
(AI Thinking): The user wants to see disk usage for the current directory.
The most appropriate command would be 'du' with options to show human-readable
format and summary for the current directory.
(AI Answer): du -sh .
Execute? Y/N: y
4.2M .
shell-ai/
├── main.py # Main application logic
├── pyproject.toml # Project configuration and dependencies
├── uv.lock # Dependency lock file
├── .env # Environment variables (create this)
├── .gitignore # Git ignore rules
└── README.md # This file
The application uses the following environment variables:
GEMINI_KEY
: Your Google AI API key (required)
- pydantic-ai-slim[google]: AI framework with Google provider support
- python-dotenv: Environment variable management
Note: Always review generated commands before execution, especially for system-critical operations.