A powerful AI assistant for your terminal, designed to help with both system administration tasks on Linux/FreeBSD and software development. Powered by Google's Gemini models, it can execute commands (with sudo if needed), manage files, assist with coding, and more.
- Execute shell commands with natural language.
- Perform privileged operations using
sudo(requires user pre-configuration). - Manage files, directories, and configurations.
- Assistance with common system administration tasks.
- Interactive chat sessions for coding queries.
- Code generation, explanation, and debugging.
- Automatic use of tools for file operations (view, edit, list, grep, glob).
- Directory navigation and structure viewing (ls, tree).
- Code quality checks (linting, formatting).
- Test execution integration (e.g., pytest).
- Multiple model support (Gemini 2.5 Pro, Gemini 1.5 Pro, etc.).
- Basic conversation history management.
- Markdown rendering for clear output.
- Automatic tool usage by the assistant for a wide range of tasks.
# Install directly from PyPI
pip install gemini-code# Clone the repository
git clone https://github.com/raizamartin/gemini-code.git
cd gemini-code
# Install the package
pip install -e .Before using Gemini CLI, you need to set up your API keys:
# Set up Google API key for Gemini models
gemini setup YOUR_GOOGLE_API_KEY# Start an interactive session with the default model
gemini
# Start a session with a specific model
gemini --model models/gemini-2.5-pro-exp-03-25
# Set default model
gemini set-default-model models/gemini-2.5-pro-exp-03-25
# List all available models
gemini list-modelsDuring an interactive session, you can use these commands:
/exit- Exit the chat session/help- Display help information
Unlike direct command-line tools, the Gemini CLI's tools are used automatically by the assistant to help answer your questions. For example:
- You ask: "What files are in the current directory?"
- The assistant uses the
lstool behind the scenes. - The assistant provides you with a formatted response.
This approach makes the interaction more natural.
Similarly, for a sysadmin task:
- You ask: 'Install the htop package.'
- The assistant plans to use
bashwithsudo apt-get install htop(or similar for other OS). - After you approve the plan, the assistant executes the command.
- You are informed of the outcome.
This project is under active development, continually enhancing its capabilities as both an AI System Administrator and a Coding Assistant. Future goals include advanced system monitoring, automated maintenance routines, and deeper integration with development workflows.
- Added test_runner tool to execute automated tests (e.g., pytest)
- Fixed syntax issues in the tool definitions
- Improved error handling in tool execution
- Updated status displays during tool execution with more informative messages
- Added additional utility tools (directory_tools, quality_tools, task_complete_tool, summarizer_tool)
- Implemented native Gemini function calling for much more reliable tool usage
- Rewritten the tool execution system to use Gemini's built-in function calling capability
- Enhanced the edit tool to better handle file creation and content updating
- Updated system prompt to encourage function calls instead of text-based tool usage
- Fixed issues with Gemini not actively creating or modifying files
- Simplified the BaseTool interface to support both legacy and function call modes
- Fixed error with Flask version check in example code
- Improved error handling in system prompt example code
- Improved system prompt to encourage more active tool usage
- Added thinking/planning phase to help Gemini reason about solutions
- Enhanced response format to prioritize creating and modifying files over printing code
- Filtered out thinking stages from final output to keep responses clean
- Made Gemini more proactive as a coding partner, not just an advisor
- Updated default model to Gemini 2.5 Pro Experimental (models/gemini-2.5-pro-exp-03-25)
- Updated system prompts to reference Gemini 2.5 Pro
- Improved model usage and documentation
- Added
list-modelscommand to show all available Gemini models - Improved error handling for models that don't exist or require permission
- Added model initialization test to verify model availability
- Updated help documentation with new commands
- Fixed file creation issues: The CLI now properly handles creating files with content
- Enhanced tool pattern matching: Added support for more formats that Gemini might use
- Improved edit tool handling: Better handling of missing arguments when creating files
- Added special case for natural language edit commands (e.g., "edit filename with content: ...")
- Fixed tool execution issues: The CLI now properly processes tool calls and executes Bash commands correctly
- Fixed argument parsing for Bash tool: Commands are now passed as a single argument to avoid parsing issues
- Improved error handling in tools: Better handling of failures and timeouts
- Updated model name throughout the codebase to use
gemini-1.5-proconsistently
- If you created a config file with earlier versions, you may need to delete it to get the correct defaults:
rm -rf ~/.config/gemini-code
MIT