Observed since 21 Oct, 10:09 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
AI-powered CLI assistant with Gemini LLM command generation and human confirmation
AI-powered command-line assistant that converts natural language into safe shell commands using Gemini LLM with human-in-the-loop confirmation.
pip install ai-cli-llm==2.0.1
Windows (PowerShell):
$env:GEMINI_API_KEY = "your_api_key_here"
Linux/macOS:
export GEMINI_API_KEY="your_api_key_here"
Get your free Gemini API key at ai.google.com
python -m ai_cli.main
You can switch to offline fallback mode at any time by typing:
/mode fallback
This disables LLM and uses pattern-based command generation locally (no API required).
That's it! Start typing natural language commands like:
create folder named projectsshow all filesdelete test.txt/mode fallback (to switch to offline mode)✨ Core Capabilities
🔧 Advanced Features
Clone the repository
git clone https://github.com/yourusername/ai-cli.git
cd ai-cli
Install the package
pip install -e .
Configure environment
Create a .env file in the project root:
GEMINI_API_KEY=your_api_key_here
# Optional: for Ollama fallback
OLLAMA_API_URL=http://localhost:11434
Get your free Gemini API key:
.env fileVerify installation
python -m ai_cli.main
ai-cli
You can switch between LLM and fallback modes at any time:
> /mode fallback # Switch to offline mode
> /mode llm # Switch back to Gemini LLM
Then describe what you want to do:
> Clean up all .pyc files in the project
Generated command: find . -name "*.pyc" -type f -delete
Safe to execute? (y/n): y
✓ Command executed successfully
File Operations
> Create a backup of my config file
> Delete all temporary files
> Find files larger than 100MB
> Rename all .txt files to .bak
System Management
> Show disk usage
> Kill process on port 8080
> Restart the Docker service
Development
> Install dependencies from requirements.txt
> Build and test the project
> Format all Python files
Commands are automatically classified by risk level:
Generated command: rm -rf /important/directory
⚠️ HIGH RISK: Destructive file operation
Estimated impact: Permanent deletion
Safe to execute? (y/n): n
❌ Command blocked by user
> undo
Recent commands:
1. mv file.txt file.bak ✓
2. rm oldfile.py ✓
Undo which? (1): 1
✓ Command reverted: file.bak → file.txt
AI CLI now tracks all commands executed in its own internal history file (ai_cli_history.txt).
To view your AI CLI command history, type:
show ai-cli history
This will display a numbered list of all commands run via the AI CLI (not PowerShell session history).
The history file is stored in the project root and is persistent across sessions.
ai-cli/
├── ai_cli/
│ ├── main.py # Entry point and CLI loop
│ ├── llm_generator.py # Gemini API integration & fallback
│ ├── executor.py # Command execution engine
│ ├── safety.py # Risk assessment module
│ ├── planner.py # Multi-step plan execution
│ ├── undo_manager.py # Undo/rollback functionality
│ ├── context_manager.py # Context and history tracking
│ ├── intent_parser.py # NLP intent recognition
│ ├── command_mapper.py # Intent → command mapping
│ └── autocomplete.py # Tab completion support
├── setup.py # Package configuration
├── .env # API keys (not in git)
├── .gitignore # Git ignore patterns
└── README.md # This file
# Required
GEMINI_API_KEY=sk_...
# Optional
OLLAMA_API_URL=http://localhost:11434
OLLAMA_MODEL=mistral
SAFETY_LEVEL=medium # low, medium, high
HISTORY_SIZE=100
DEBUG=false
User Input
↓
Intent Parser (NLP)
↓
Intent → Command Mapper
↓
LLM Generator (Gemini API)
↓
Fallback Generator (if needed)
↓
Safety Assessment
↓
User Approval
↓
Executor
.env file.env to git (already in .gitignore)# Check .env exists and has GEMINI_API_KEY
cat .env
# Install NLP dependencies
pip install spacy
python -m spacy download en_core_web_sm
ai-cli --history.ai-cli-backups/echo "Find all .log files" | ai-cli --batch
ai-cli --dry-run
> Clean up temp files
[DRY RUN] rm -rf /tmp/*.log
No commands executed
ai-cli --history
ai-cli --clear-history
Contributions welcome! Areas for improvement:
⚠️ Important Notes
google-generativeai>=0.3.0 # Gemini API
requests>=2.28.0 # Ollama API
python-dotenv>=0.19.0 # .env support
spacy>=3.0.0 # NLP (optional)
MIT License - Feel free to use, modify, and distribute.
Made with ❤️ for command-line enthusiasts
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 2.0.3 | 6 Jan 2026 | 3 |
This describes our collected data; it is not a security assessment.
Observed since 21 Oct, 10:09 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:02383726b880a3c35c72786cddfb7d896136c388f9533e5840ce134842f82e95