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.
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.
gema-cli web
GENAI_PORT - Custom port to run the server on (defaults to 8080)
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.
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/
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.
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]
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:
- Process your query
- Show a response
- Suggest a terminal command
- Ask if you want to run the command
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:"
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'"
Contributions are welcome! Please feel free to submit a Pull Request.