Skip to content

Gemini CLI is an AI assistant for your terminal that can run commands based on your queries. It leverages the power of AI to understand your requests and suggest appropriate commands to execute.

Notifications You must be signed in to change notification settings

4nkitd/gemini-cli

Repository files navigation

Gema CLI

Gema CLI is an AI assistant for your terminal that leverages Gemini AI to help with text refinement, command suggestions, and Git commit messages. It's designed to make your terminal experience more productive through AI-powered assistance.

DEMO

Gema CLI Demo

Web UI

alt text

WebCmd represents the web command which starts a web server for AI interactions. It provides both a web UI and a REST API endpoint for asking questions to the AI.

The server automatically attempts to open the web interface in the default browser.

Usage:

gema-cli web

Environment Variables:

GENAI_PORT - Custom port to run the server on (defaults to 8080)

Web Interface:

http://localhost:8080/

API Endpoint:

POST http://localhost:8080/answer Request Body: {"message": "your question", "history": {"previous question": "previous answer", ...}} Response: {"message": "AI response"}

The web interface provides a user-friendly chat experience, while the API allows for programmatic interaction with the AI assistant.

Installation

git clone https://github.com/4nkitd/gema-cli.git
cd gema-cli
go build -o gema

For easier access, move the binary to your PATH:

mv gema /usr/local/bin/

Setup

Before using Gema CLI, set your Gemini API key and default model as environment variables:

export GENAI_API_KEY=your_api_key
export GENAI_DEFAULT_MODEL="gemini-2.0-flash-exp"

You can obtain your API key from Google AI Studio.

Add these to your .bashrc, .zshrc, or equivalent for persistence.

Commands

Text Refinement

Revise text to make it more professional:

gema writer "Hey, can we meet to discuss the project?"
gema revise "Hey, can we meet to discuss the project?" # alias

Special formatting options:

  • Use [length=X] to specify approximate word count
  • Use [type=email] to format as a professional email

Example:

gema writer "Need to reschedule our meeting tomorrow. Sorry for late notice." [type=email]

AI Assistant

Ask questions and get command suggestions:

gema cli "how do I find large files in this directory?"
gema ask "how do I find large files in this directory?" # alias

The command will:

  1. Process your query
  2. Show a response
  3. Suggest a terminal command
  4. Ask if you want to run the command

Git Commit Helper

Generate AI-powered commit messages:

gema commit
gema c # alias

You can also specify a repository path:

gema commit /path/to/repo

Or customize the prompt:

gema commit --prompt "Write a detailed commit message explaining the following changes:"

Co Pilot

Get assistance with anything on your screen:

gema assist "explain this error message"
gema a "explain this error message" # alias
gema copilot "suggest improvements for this code" # alias
gema assistant "what does this output mean?" # alias

The Co Pilot feature analyzes text from your terminal and provides helpful explanations, suggestions, or guidance based on the content.

Example:

gema assist "What's wrong with this command: grep -l 'function' | xargs sed 's/old/new/g'"

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

Gemini CLI is an AI assistant for your terminal that can run commands based on your queries. It leverages the power of AI to understand your requests and suggest appropriate commands to execute.

Resources

Stars

Watchers

Forks

Packages

No packages published