Smart-Shell

July 7, 2025 ยท View on GitHub

Status License Python Gemini

Smart-Shell is in active development.

Smart-Shell Demo

Smart-Shell is an intelligent terminal assistant that converts natural language into executable Bash or Zsh commands using Google's Gemini AI models via the new google-genai SDK.

โœจ Features

  • ๐Ÿง  Natural Language to Command
    Convert plain English into valid Bash/Zsh commands instantly.

  • ๐Ÿš Shell Auto-Detection
    Automatically detects and supports both Bash and Zsh environments.

  • ๐Ÿ’ฌ Interactive Mode with Command History
    Rich REPL interface with protected prompt and support for special commands like:
    !help, !docs, !models, !history, !clear, !redo, !last, !creator, !forget-sudo, !update, !errors, !web, and more.

  • ๐Ÿ›ก๏ธ Built-in Safety System
    Analyzes each command and classifies it into four risk levels with detailed reasoning:

    • โœ… Safe โ€“ Executed automatically.
    • ๐Ÿ”ต Info Leak โ€“ May expose sensitive data (requires confirmation).
    • ๐ŸŸก Medium โ€“ Sudo operations and system changes (requires y/n confirmation).
    • ๐Ÿ”ด High โ€“ Dangerous operations like file deletion (requires y/n confirmation).
      This ensures potentially destructive commands are never run without user awareness.
  • ๐Ÿค– AI-Powered Command Planning
    Generates and refines shell commands using Google Gemini models.

  • ๐Ÿ”€ Multi-Model Support with Smart Warnings
    Easily switch between Gemini Pro, Flash, and Legacy models with detailed cost information and confirmation prompts for premium models.

  • ๐Ÿ’ณ Smart Cost Awareness
    Real-time model pricing information with detailed cost breakdowns and confirmation prompts when switching to premium models.

  • ๐Ÿงช Dry-Run Mode
    Preview the exact command before execution for extra safety and transparency.

  • ๐Ÿ“Ÿ Standard CLI Commands
    Includes --help, --version, and other CLI flags for quick access.

  • ๐Ÿ–ฅ๏ธ Desktop Integration
    Comes with a .desktop entry โ€” launch directly from your system's Application Menu.

  • โŒจ๏ธ Tab Completion
    Supports intelligent tab completion for both Bash and Zsh shells.

  • ๐Ÿ” Simple Setup
    Easy configuration of your API key and sudo password during first run.

  • ๐ŸŒ Web Search Integration
    When enabled, Smart-Shell performs relevant web searches in real-time to enhance command accuracy.
    AI combines local knowledge with live web results to refine its suggestions โ€” giving you smarter, context-aware commands.
    You can toggle web search anytime using the !web command.

  • โšก Modern CLI Experience
    A clean and user-friendly terminal UI with colorful output and rich formatting.

  • ๐Ÿ› ๏ธ Open Source & Extensible
    Easily extend functionality or contribute โ€” fully open and developer-friendly.

Install Smart-Shell with a single command:

curl -sSL https://raw.githubusercontent.com/Lusan-sapkota/smart-shell/main/install.sh | bash

Our intelligent installation script:

  • โœ… Automatically checks and installs all dependencies (including pipx if needed)
  • โœ… Handles package installation with proper isolation
  • โœ… Creates desktop entries and command completion
  • โœ… Fixes common Python module path issues
  • โœ… Runs the setup wizard to configure your API key

After installation, use Smart-Shell from any terminal:

smart-shell

The first time you run Smart-Shell, it will guide you through setting up your Google Gemini API key. You can also run the setup wizard anytime:

smart-shell setup

For manual installation and development instructions, see docs/DEVELOPMENT.md.

๏ฟฝ๏ธ Uninstall

To completely remove Smart-Shell from your system, run this single command:

curl -sSL https://raw.githubusercontent.com/Lusan-sapkota/smart-shell/main/install.sh | bash -s -- --uninstall

Manual Uninstall

If you prefer to uninstall manually, follow these steps:

1. Remove the Smart-Shell package:

# If installed with pipx (recommended)
pipx uninstall smart-shell

# If installed system-wide
sudo pip3 uninstall smart-shell

# If installed in a virtual environment
rm -rf ./venv  # (from the project directory)

2. Remove configuration files:

rm -rf ~/.config/smart-shell

3. Remove desktop entry:

rm -f ~/.local/share/applications/smart-shell.desktop

4. Remove shell completion:

rm -f ~/.local/share/bash-completion/completions/smart-shell-completion.bash

5. Clean up shell configuration:

# Remove from .bashrc
sed -i '/# Smart-Shell completion/,+1d' ~/.bashrc

# Remove from .zshrc (if exists)
sed -i '/# Smart-Shell completion/,+1d' ~/.zshrc

6. Remove any remaining executables:

rm -f ~/.local/bin/smart-shell
rm -f ~/.local/bin/smart-shell.bak

After completing these steps, restart your terminal or run source ~/.bashrc (or source ~/.zshrc) to reload your shell configuration.

๏ฟฝ๐Ÿ“– Documentation

๐Ÿ“š Full documentation is available at the Smart-Shell MkDocs site.

๐Ÿ“œ License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

๐Ÿ‘ค Author

Created by Lusan Sapkota

โš ๏ธ Disclaimer

Smart-Shell is an AI assistant and may occasionally generate incorrect or unsafe commands. Always review commands before execution, especially those involving system modifications or sensitive data.