Lightweight, powerful and intelligent command-line assistant that translates natural language into precise shell commands. Featuring an advanced interactive interface, gesture controls, real-time syntax highlighting, and cross-platform compatibility.
- π― Interactive Command Interface: Gesture-based controls with real-time preview
- π¨ Advanced Terminal UI: Syntax highlighting, Unicode support
- β‘ Smart Command Suggestions: AI-powered alternatives and explanations
- π Enhanced Security: Risk assessment and safety warnings
- π Cross-Platform Excellence: Optimized for Windows, Linux and macOS
- π Smart Clipboard Integration: One-click command copying and pasting
- β¨οΈ Advanced Keyboard Shortcuts: Vim-inspired editing with history navigation
Windows:
powershell -Command "Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/fmdz387/cli-ai/refs/heads/master/setup.ps1' -OutFile 'setup.ps1'; .\setup.ps1"Linux/macOS:
curl -sSL https://raw.githubusercontent.com/fmdz387/cli-ai/refs/heads/master/setup.sh -o setup.sh && bash setup.shAfter installation, use s followed by your natural language command:
s find all Python files modified in the last week
s show docker containers with high memory usage
s compress this directory into a tar.gz fileThe v2 interface provides an intuitive command interaction experience with two modes:
Interactive interface with gesture controls:
β΅ Enter- Execute command immediatelyβ₯ Tab- Accept command and paste to active terminalπ Ctrl+C- Copy command to clipboard
β‘ Ctrl+A- Show alternative commandsβ ?- Show help and keyboard shortcutsβ Esc- Cancel and exit
A streamlined, performance-optimized experience designed for speed and efficiency:
- No Interactive UI: Bypasses all UI boxes and gesture controls
- Faster Response: Skips generating alternatives, explanations, and context processing
- Direct Output: Command is immediately copied to clipboard and displayed
- Optimized API Usage: Makes fewer API calls for faster execution
- Windows: Command copied to clipboard and pasted to new line if terminal supports it
- Unix/Linux/macOS: Command copied to clipboard and displayed for manual pasting
- Git Bash: Enabled by default for optimal Git Bash compatibility
- Performance Priority: When you need the fastest possible response
- Terminal Compatibility: In terminals with limited Unicode or UI support
- Automation/Scripting: When integrating with scripts or automated workflows
- Minimal Overhead: When you just want the command without explanations
# Enable Simple Mode for faster, streamlined experience
s config-set AI_ASSISTANT_SIMPLE_MODE=true
# Disable Simple Mode (return to full interactive interface)
s config-set AI_ASSISTANT_SIMPLE_MODE=false
# Note: Git Bash users have Simple Mode enabled by default for optimal compatibility- Reduced API Calls: No alternatives or explanations generated
- Faster Processing: Skips directory tree context and command history processing
- Lower Latency: Direct command generation without UI rendering overhead
- Resource Efficient: Minimal memory and CPU usage
s list all files larger than 100MB sorted by size
# β find . -type f -size +100M -exec ls -lh {} + | sort -k5 -hr
s find duplicate files in this directory
# β fdupes -r .
s backup my home directory to external drive
# β rsync -av --progress ~/ /media/backup/s show top 10 processes using most CPU
# β ps aux --sort=-%cpu | head -n 11
s monitor network connections in real time
# β netstat -tulnp | watch -n 1
s check disk usage for each mounted filesystem
# β df -hs find all TODO comments in Python files
# β grep -rn "TODO" --include="*.py" .
s start a local HTTP server on port 8080
# β python -m http.server 8080
s show git commits from last month with stats
# β git log --since="1 month ago" --statThe assistant uses a configuration file located at ~/.cli_ai_assistant/config:
# Execution behavior
AI_ASSISTANT_SKIP_CONFIRM=true
# Context and privacy
AI_DIRECTORY_TREE_CONTEXT=true
# Enhanced UI features
AI_ASSISTANT_SAFETY_LEVEL=medium
AI_ASSISTANT_MODEL=claude-sonnet-4-5-20250929
AI_ASSISTANT_SHOW_EXPLANATIONS=true
AI_ASSISTANT_MAX_ALTERNATIVES=3
AI_ASSISTANT_ENABLE_SYNTAX_HIGHLIGHTING=true
AI_ASSISTANT_ENABLE_COMMAND_HISTORY=trueView Configuration:
# Display all configuration settings
s config-show
# Display specific setting with details
s config-show AI_ASSISTANT_SAFETY_LEVEL
s config-show AI_ASSISTANT_MAX_ALTERNATIVESUpdate Configuration:
s config-set AI_ASSISTANT_SAFETY_LEVEL=high
s config-set AI_ASSISTANT_MAX_ALTERNATIVES=5
s config-set AI_ASSISTANT_SHOW_EXPLANATIONS=false| Command | Description |
|---|---|
s config-show |
Display all configuration settings with descriptions |
s config-show <key> |
Display detailed information about a specific setting |
s config-set <key>=<value> |
Update a configuration setting |
| Setting | Values | Description |
|---|---|---|
AI_ASSISTANT_SKIP_CONFIRM |
true/false |
Skip confirmation prompts (default: true) |
AI_ASSISTANT_MODEL |
See model list below | The model to use for the AI assistant (default: claude-sonnet-4-5-20250929) |
AI_DIRECTORY_TREE_CONTEXT |
true/false |
Include directory structure in AI context (default: true) |
AI_ASSISTANT_SAFETY_LEVEL |
low/medium/high |
Command risk assessment level (default: medium) |
AI_ASSISTANT_SHOW_EXPLANATIONS |
true/false |
Display command explanations (default: true) |
AI_ASSISTANT_MAX_ALTERNATIVES |
0-5 |
Number of alternative commands to generate (default: 3) |
AI_ASSISTANT_ENABLE_SYNTAX_HIGHLIGHTING |
true/false |
Colorize command syntax (default: true) |
AI_ASSISTANT_ENABLE_COMMAND_HISTORY |
true/false |
Enable command history navigation (default: true) |
AI_ASSISTANT_SIMPLE_MODE |
true/false |
Enable simple mode (no UI boxes, just clipboard/display) (default: false, true for Git Bash) |
All current Anthropic Claude models are supported:
Claude Sonnet 4.5 (Latest, Recommended):
claude-sonnet-4-5-20250929(default, best for coding and complex agents)claude-sonnet-4-5(alias)
Claude Sonnet 4:
claude-sonnet-4-20250514claude-sonnet-4-0(alias)
Claude Sonnet 3.7:
claude-3-7-sonnet-20250219claude-3-7-sonnet-latest(alias)
Claude Opus 4.1:
claude-opus-4-1-20250805(most capable, higher cost)claude-opus-4-1(alias)
Claude Opus 4:
claude-opus-4-20250514claude-opus-4-0(alias)
Claude Haiku 3.5 (Fast, Cost-effective):
claude-3-5-haiku-20241022claude-3-5-haiku-latest(alias)
Claude Haiku 3:
claude-3-haiku-20240307
Changing Models:
# Use latest Claude Sonnet 4.5 (default)
s config-set AI_ASSISTANT_MODEL=claude-sonnet-4-5-20250929
# Use Claude Opus 4.1 for more complex tasks
s config-set AI_ASSISTANT_MODEL=claude-opus-4-1-20250805
# Use Claude Haiku 3.5 for faster, cost-effective responses
s config-set AI_ASSISTANT_MODEL=claude-3-5-haiku-20241022For complete model details and pricing, see the Anthropic Models Documentation.
- Secure Storage: API keys are stored in your system's secure keyring
- Local Processing: Keys never leave your machine
- No Logging: Sensitive information is never logged or cached
- Risk Assessment: Commands are automatically analyzed for potential dangers
- Safety Warnings: High-risk operations display clear warnings
- User Control: All commands require explicit user confirmation or execution
- Optional Context: Directory tree sharing can be disabled
- Local Operation: All processing happens on your machine
- No Telemetry: No usage data is collected or transmitted
The assistant automatically detects and optimizes for:
Windows:
- Command Prompt, PowerShell, Windows Terminal
- WSL (Windows Subsystem for Linux)
- MSYS2/Git Bash environments
Linux:
- Bash, Zsh, Fish shells
- X11 and Wayland display servers
- Various distributions (Ubuntu, Debian, Fedora, Arch, etc.)
macOS:
- Terminal.app, iTerm2, and third-party terminals
- Homebrew package management integration
- System theme detection
- Unicode Support: Beautiful icons and symbols where supported
- Color Themes: Automatic light/dark theme detection
- Responsive Layout: Adapts to terminal size and capabilities
- Accessibility: Fallback modes for limited terminals
- Context Awareness: Uses directory structure and command history
- Multi-Platform: Generates appropriate commands for your OS/shell
- Error Recovery: Provides alternatives when commands fail
- Loading Animations: Visual feedback during AI processing
- Progress Indicators: Clear status for long-running operations
- Error Handling: Graceful degradation and helpful error messages
- Command History: Navigate through previously generated commands
- Syntax Validation: Real-time command validation and highlighting
- Alternative Suggestions: Multiple approaches to accomplish tasks
s monitor system resources and alert if CPU usage exceeds 80%
s create a cron job to backup database daily at 2 AM
s find all files owned by user john and change ownership to admins run tests and generate coverage report
s deploy application to staging environment
s revert last 3 git commitss merge all CSV files in data directory and remove duplicatess build Docker image and push to registry with latest tag
s show kubernetes pods that are not in running state
s update all npm packages and commit changesCommand not recognized:
# Refresh shell configuration
s help # Test basic functionality
source ~/.bashrc # Linux/macOS
# or restart terminalAPI key issues:
# Reconfigure API key
s config-set ANTHROPIC_API_KEY=your_key_here
# or run setup againPermission errors:
# Check installation
python --version # Ensure Python 3.8+
pip list | grep anthropic # Verify dependenciesView current configuration:
# See all settings with their current values
s config-show
# Check specific settings
s config-show AI_ASSISTANT_SAFETY_LEVELDisable context features for faster responses:
s config-set AI_DIRECTORY_TREE_CONTEXT=false
s config-set AI_ASSISTANT_MAX_ALTERNATIVES=0Reduce UI features for slower terminals:
s config-set AI_ASSISTANT_ENABLE_SYNTAX_HIGHLIGHTING=false
s config-set AI_ASSISTANT_SHOW_EXPLANATIONS=falseUse Simple Mode for minimal UI:
s config-set AI_ASSISTANT_SIMPLE_MODE=truePerformance Comparison:
- Standard Mode: Full interactive experience with alternatives, explanations, and context
- Simple Mode: 2-3x faster response time, single API call, no UI overhead
- AI Engine: Claude integration with support for all current models (Sonnet 4.5, Opus 4.1, Haiku 3.5, etc.)
- Command Parser: Natural language to shell command translation
- UI Framework: Cross-platform terminal interface with gesture support
- Security Layer: Command risk assessment and user protection
- anthropic: Claude API client
- keyring: Secure credential storage
- Cross-platform utilities: Terminal optimization and clipboard integration
We welcome contributions!
git clone https://github.com/fmdz387/cli-ai.git
cd cli-ai
pip install -r requirements.txt
python assistant.py "test command"This project is licensed under the Apache License 2.0. See the LICENSE file for details.
Transform your command line experience with the power of AI
