Transform natural language into shell commands instantly with the power of Google Gemini AI
- Overview
- Features
- Installation
- Quick Start
- Usage Guide
- Configuration
- Interactive Mode
- Alias System
- Advanced Features
- Architecture
- Troubleshooting
- Contributing
- FAQ
Vira CLI is an intelligent terminal assistant that bridges the gap between natural language and shell commands. Simply describe what you want to do, and Vira will generate the appropriate command for your operating system.
- 🤖 AI-Powered: Leverages Google Gemini 2.5 for accurate command generation
- 🌍 Multi-language: Supports English and Vietnamese
- 💬 Interactive Mode: Chat with AI to get commands on-the-fly
- 📚 Command History: Navigate through previous queries with arrow keys
- 🔖 Alias System: Save frequently used commands
- 🛡️ Safety First: Detects dangerous commands before execution
- 📋 Auto-copy: Commands automatically copied to clipboard
- 🎨 Beautiful UI: Rich terminal interface with colors and formatting
| Feature | Description |
|---|---|
| Natural Language Processing | Convert plain English/Vietnamese to shell commands |
| Multi-OS Support | Optimized for Linux, macOS, and Windows |
| Interactive Chat | Continuous conversation mode with command history |
| Smart Suggestions | Get common flags and options for each command |
| Command Execution | Run commands directly with confirmation |
| Error Recovery | AI-powered fix for failed commands |
| Clipboard Integration | Auto-copy commands for easy pasting |
- 🔄 History Navigation: Use ↑↓ arrows to browse previous queries
- 🔍 History Search: Press Ctrl+R to search command history
- 💾 Persistent Config: All settings saved in
~/.vira-cli/ - 🎯 Context Aware: AI understands follow-up questions
- 🌐 Bilingual: Switch between English and Vietnamese
- 📦 Model Selection: Choose from multiple Gemini models
- 🔐 Safe Execution: Blocks dangerous operations by default
- Python 3.8 or higher
- pip or pipx package manager
- Internet connection (for API calls)
# Install pipx if you haven't
python3 -m pip install --user pipx
python3 -m pipx ensurepath
# Install Vira CLI
pipx install vira-clipip install vira-cli# Clone repository
git clone https://github.com/vuvandinh123/vira-cli.git
cd vira-cli
# Install in development mode
pip install -e .# For X11 (most common)
sudo apt-get install xclip
# Or
sudo apt-get install xsel
# For Wayland
sudo apt-get install wl-clipboardRun the configuration wizard:
vira --configThis will guide you through:
- API Key setup
- Model selection
- Language preference
- Display settings
- Visit Google AI Studio
- Sign in with your Google account
- Click "Create API Key"
- Copy the key (starts with
AIza...)
vira list all filesOutput:
💭 Thinking...
✨ ls -la
✓ Copied to clipboard
▶ Run this command? [Y/n]:
vira <your query in natural language># List files
vira list all files
vira show hidden files
# Find files
vira find files larger than 100MB
vira search for pdf files in downloads
# File management
vira create a folder named backup
vira copy all images to backup folder
vira rename all txt files to md
vira delete files older than 30 days# CPU and Memory
vira show cpu usage
vira check memory usage
vira find process using most memory
# Disk
vira show disk space
vira find largest directories
vira check disk io
# Network
vira show ip address
vira check internet connection
vira find which process using port 8080vira show git status
vira create new branch from main
vira undo last commit but keep changes
vira view commit history with graph
vira merge feature branch to main# Linux (Ubuntu/Debian)
vira update all packages
vira search for package containing python
vira remove package and dependencies
# macOS
vira install node using homebrew
vira update all homebrew packages
# Python
vira install requirements from file
vira create virtual environment
vira list outdated packagesvira list all docker containers
vira stop all running containers
vira remove unused images
vira build docker image from dockerfile
vira run container with port mappingvira find lines containing error in log file
vira count occurrences of word in file
vira remove duplicate lines from file
vira sort file by column 3
vira replace text in all filesAll settings are stored in: ~/.vira-cli/config.ini
vira --set-api-keyvira --set-modelAvailable models:
gemini-2.0-flash- Fast, good for simple queriesgemini-2.0-pro- More accurate, better reasoninggemini-2.5-flash- Latest fast model (default)gemini-2.5-pro- Latest pro model, best quality
vira --set-languageOptions:
- English (en)
- Tiếng Việt (vi)
vira --set-show-suggestionsOptions:
- Yes: Show common flags and options
- No: Only show the command
vira --configInteractive setup for all options.
Alternatively, set API key via environment:
# Temporary (current session)
export GEMINI_API_KEY="your_api_key_here"
# Permanent (add to ~/.bashrc or ~/.zshrc)
echo 'export GEMINI_API_KEY="your_api_key_here"' >> ~/.bashrc
source ~/.bashrcStart a continuous chat session with AI:
vira -i
# or
vira --interactive| Command | Description |
|---|---|
<query> |
Generate command from your query |
fix |
Fix the last failed command |
explain |
Explain the last command |
clear |
Clear screen |
help |
Show help message |
exit / quit / q |
Exit interactive mode |
| Shortcut | Action |
|---|---|
↑ |
Previous query |
↓ |
Next query |
Ctrl+R |
Search history |
Ctrl+C |
Cancel current input |
Ctrl+D |
Exit |
→ or End |
Accept auto-suggestion |
$ vira -i
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💬 Interactive Terminal Helper
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Type 'exit' or 'quit' to exit.
Type 'fix' to fix last error.
Type 'run <command>' to run a command.
Type 'history' to show recent commands.
💡 Use ↑↓ arrows to browse history, Ctrl+R to search
You: list all files
✨ ls -la
▶ Run this command? [Y/n]: y
total 48
drwxr-xr-x 5 user user 4096 Jan 27 10:30 .
✅ Done!
You: find large files
✨ find . -type f -size +100M
▶ Run this command? [Y/n]: n
You: explain
Explanation:
This command searches for files larger than 100MB
starting from the current directory recursively.
You: compress folder
✨ tar -czf folder.tar.gz folder/
▶ Run this command? [Y/n]: y
tar: folder/: Cannot stat: No such file or directory
❌ Command failed
You: fix
✨ tar -czf archive.tar.gz .
▶ Run this command? [Y/n]: y
✅ Done!
You: exit
👋 Bye!All your queries are saved to: ~/.vira-cli/chat_history.txt
Search History:
- Press
Ctrl+R - Type keywords
- Press
Enterto use the command - Press
Ctrl+Ragain to see next match
View History File:
cat ~/.vira-cli/chat_history.txtClear History:
rm ~/.vira-cli/chat_history.txtSave frequently used commands as aliases.
vira --set-alias backup="tar -czf backup-$(date +%Y%m%d).tar.gz ."
vira --set-alias update="sudo apt update && sudo apt upgrade -y"
vira --set-alias ports="netstat -tulpn | grep LISTEN"vira --list-aliasOutput:
┌─ 📘 Alias List ─────────────────────────────────┐
│ Name │ Command │
├─────────┼────────────────────────────────────────┤
│ backup │ tar -czf backup-$(date +%Y%m%d)... │
│ update │ sudo apt update && sudo apt upgrade... │
│ ports │ netstat -tulpn | grep LISTEN │
└─────────┴────────────────────────────────────────┘
vira backupOutput:
✨ tar -czf backup-20250127.tar.gz .
▶ Run this alias? [Y/n]:
vira --remove-alias backupRun commands without confirmation:
vira list files --runVira automatically detects commands that need user input:
vira create react app Output:
✨ npx create-react-app my-app
⚠️ This command may require user input
▶ Run this command? [Y/n]: y
Need to install the following packages:
create-react-app@5.1.0
Ok to proceed? (y) y # <-- You can type here!
When enabled, Vira shows common flags:
vira find filesOutput:
✨ find . -type f
📘 Common options:
-name "*.txt" : Find files by name pattern
-size +10M : Find files larger than 10MB
-mtime -7 : Modified in last 7 days
-exec rm {} \; : Execute command on found files
-maxdepth 2 : Limit search depth
English:
vira --set-language
> 1. EnglishVietnamese:
vira --set-language
> 2. Tiếng Việt
vira liệt kê tất cả file
✨ ls -la
📘 Các tùy chọn phổ biến:
-h : Hiển thị kích thước dễ đọc
-t : Sắp xếp theo thời gianvira-cli/
├── cli_helper/ # Main package
│ ├── __init__.py # Package initialization
│ ├── main.py # CLI entry point
│ ├── core/ # Core functionality
│ │ ├── __init__.py
│ │ ├── ai.py # Gemini AI integration
│ │ └── command.py # Command execution
│ ├── config/ # Configuration
│ │ ├── __init__.py
│ │ ├── manager.py # Config management
│ │ └── constants.py # Constants
│ ├── features/ # Features
│ │ ├── __init__.py
│ │ ├── alias.py # Alias management
│ │ ├── chat.py # Interactive mode
│ │ └── history.py # Command history
│ └── utils/ # Utilities
│ ├── __init__.py
│ ├── console.py # Rich console helpers
│ └── system.py # OS detection, clipboard
├── tests/ # Unit tests
├── docs/ # Documentation
├── setup.py # Package setup
├── requirements.txt # Dependencies
├── README.md # Main documentation
└── LICENSE # MIT License
- Handles Gemini API communication
- Generates commands from natural language
- Manages chat sessions
- Loads/saves configuration
- Manages API keys, models, settings
- Handles aliases
- Executes shell commands
- Supports interactive commands
- Safety checks for dangerous operations
- Prompt toolkit integration
- Command history with search
- Auto-suggestion from history
- Rich terminal formatting
- Color-coded messages
- Tables and panels
Solution:
# Check if installed
pipx list | grep vira-cli
# Reinstall
pipx reinstall vira-cli
# Or add to PATH
export PATH="$PATH:$HOME/.local/bin"Error:
❌ No API key found. Run: vira --config
Solution:
# Method 1: Interactive setup
vira --config
# Method 2: Direct set
vira --set-api-key
# Method 3: Environment variable
export GEMINI_API_KEY="your_key_here"Error:
⚠️ Could not copy to clipboard
Solution:
# Linux X11
sudo apt-get install xclip
# Linux Wayland
sudo apt-get install wl-clipboard
# macOS (should work by default)
# Windows (should work by default)Problem: Commands like npm install hang without accepting input.
Solution: Already fixed in version 2.1.0. Update:
pipx upgrade vira-cliError:
ModuleNotFoundError: No module named 'prompt_toolkit'
Solution:
pip install prompt-toolkit rich pyperclip python-dotenv google-generativeaiError:
Permission denied: /home/user/.vira-cli/config.ini
Solution:
chmod 600 ~/.vira-cli/config.ini
# or delete and reconfigure
rm -rf ~/.vira-cli
vira --configEnable verbose logging:
export VIRA_DEBUG=1
vira your queryView logs:
cat ~/.vira-cli/vira.log- Check Documentation: GitHub Wiki
- Report Issues: GitHub Issues
- Community: Discussions
We welcome contributions! Here's how:
# Clone repository
git clone https://github.com/vuvandinh123/vira-cli.git
cd vira-cli
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode
pip install -e .
# Install dev dependencies
pip install -r requirements-dev.txt
# Run tests
pytest- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- Follow PEP 8
- Use type hints
- Add docstrings
- Write tests
Q: Is Vira CLI free?
A: Yes, Vira CLI is open-source (MIT License). However, you need a Google Gemini API key, which has a free tier.
Q: Does it work offline?
A: No, Vira requires internet connection to communicate with Gemini API.
Q: Which operating systems are supported?
A: Linux, macOS, and Windows. Commands are optimized for each OS.
Q: Can I use it in scripts?
A: Yes, use --run flag for non-interactive execution:
vira list files --run > output.txtQ: How do I save my favorite commands?
A: Use the alias system:
vira --set-alias mybackup="tar -czf backup.tar.gz ."Q: Can it execute commands automatically?
A: Yes, use --run flag, but be careful:
vira delete old logs --run # No confirmation!Q: How to switch languages?
A: Run vira --set-language and choose your language.
Q: Does it support multiple commands?
A: Currently one command per query. Use aliases for command chains.
Q: Which AI model should I use?
A:
gemini-2.5-flash: Fast, good for simple commands (default)gemini-2.5-pro: Best quality, slower, for complex queries
Q: How is my data stored?
A: All data stored locally in ~/.vira-cli/:
config.ini: Settings and API keychat_history.txt: Query historyvira.log: Debug logs (if enabled)
Q: Is my API key secure?
A: API key is stored with 600 permissions (owner read/write only). Never share your config file.
Q: Can I use my own AI model?
A: Currently only Gemini models are supported. Custom model support is planned.
Q: Commands are slow?
A:
- Check internet connection
- Switch to faster model (gemini-2.5-flash)
- Use alias for frequent commands
Q: Getting wrong commands?
A:
- Be more specific in your query
- Switch to pro model for better accuracy
- Report issue with examples
Q: History not working?
A: Check if ~/.vira-cli/chat_history.txt is writable:
ls -la ~/.vira-cli/
chmod 600 ~/.vira-cli/chat_history.txtMIT License - see LICENSE file for details.
- Google Gemini: For providing the AI capabilities
- Rich: For beautiful terminal formatting
- Prompt Toolkit: For interactive terminal features
- Contributors: Everyone who has contributed to this project
- Author: Vũ Văn Định
- Email: vuvandinh203@gmail.com
- GitHub: @vuvandinh123
- Issues: Report bugs
- Discussions: Community forum
- Version: 2.1.0
- Python Version: 3.8+
- Dependencies: 5 core packages
- Code Lines: ~2,500
- Test Coverage: 85%
- Downloads: 🚀 Growing!
If you find Vira CLI useful, please give it a star on GitHub! ⭐
Made with ❤️ by Vũ Văn Định
Happy Commanding! 🚀