docs(readme): Overhaul for clarity and user experience (#5732)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Srinath Padmanabhan <17151014+srithreepo@users.noreply.github.com>
This commit is contained in:
parent
0157eae3d7
commit
0e44bbc85d
411
README.md
411
README.md
|
@ -1,135 +1,182 @@
|
|||
# Gemini CLI
|
||||
|
||||
[](https://github.com/google-gemini/gemini-cli/actions/workflows/ci.yml)
|
||||
[](https://www.npmjs.com/package/@google/gemini-cli)
|
||||
[](https://github.com/google-gemini/gemini-cli/blob/main/LICENSE)
|
||||
|
||||

|
||||
|
||||
This repository contains the Gemini CLI, a command-line AI workflow tool that connects to your
|
||||
tools, understands your code and accelerates your workflows.
|
||||
Gemini CLI is an open-source AI agent that brings the power of Gemini directly into your terminal. It provides lightweight access to Gemini, giving you the most direct path from your prompt to our model.
|
||||
|
||||
With the Gemini CLI you can:
|
||||
## 🚀 Why Gemini CLI?
|
||||
|
||||
- Query and edit large codebases in and beyond Gemini's 1M token context window.
|
||||
- Generate new apps from PDFs or sketches, using Gemini's multimodal capabilities.
|
||||
- Automate operational tasks, like querying pull requests or handling complex rebases.
|
||||
- Integrate with GitHub: Use the [Gemini CLI GitHub Action](https://github.com/google-github-actions/run-gemini-cli) for automated PR reviews, issue triage, and on-demand AI assistance directly in your repositories.
|
||||
- Use tools and MCP servers to connect new capabilities, including [media generation with Imagen,
|
||||
Veo or Lyria](https://github.com/GoogleCloudPlatform/vertex-ai-creative-studio/tree/main/experiments/mcp-genmedia)
|
||||
- Ground your queries with the [Google Search](https://ai.google.dev/gemini-api/docs/grounding)
|
||||
tool, built into Gemini.
|
||||
- **🎯 Free tier**: 60 requests/min and 1,000 requests/day with personal Google account
|
||||
- **🧠 Powerful Gemini 2.5 Pro**: Access to 1M token context window
|
||||
- **🔧 Built-in tools**: Google Search grounding, file operations, shell commands, web fetching
|
||||
- **🔌 Extensible**: MCP (Model Context Protocol) support for custom integrations
|
||||
- **💻 Terminal-first**: Designed for developers who live in the command line
|
||||
- **🛡️ Open source**: Apache 2.0 licensed
|
||||
|
||||
## Quickstart
|
||||
## 📦 Installation
|
||||
|
||||
You have two options to install Gemini CLI.
|
||||
### Quick Install
|
||||
|
||||
### With Node
|
||||
#### Run instantly with npx
|
||||
|
||||
1. **Prerequisites:** Ensure you have [Node.js version 20](https://nodejs.org/en/download) or higher installed.
|
||||
2. **Run the CLI:** Execute the following command in your terminal:
|
||||
|
||||
```bash
|
||||
npx https://github.com/google-gemini/gemini-cli
|
||||
```
|
||||
|
||||
Or install it with:
|
||||
|
||||
```bash
|
||||
npm install -g @google/gemini-cli
|
||||
```
|
||||
|
||||
Then, run the CLI from anywhere:
|
||||
|
||||
```bash
|
||||
gemini
|
||||
```
|
||||
|
||||
### With Homebrew
|
||||
|
||||
1. **Prerequisites:** Ensure you have [Homebrew](https://brew.sh/) installed.
|
||||
2. **Install the CLI:** Execute the following command in your terminal:
|
||||
|
||||
```bash
|
||||
brew install gemini-cli
|
||||
```
|
||||
|
||||
Then, run the CLI from anywhere:
|
||||
|
||||
```bash
|
||||
gemini
|
||||
```
|
||||
|
||||
### Common Configuration steps
|
||||
|
||||
3. **Pick a color theme**
|
||||
4. **Authenticate:** When prompted, sign in with your personal Google account. This will grant you up to 60 model requests per minute and 1,000 model requests per day using Gemini.
|
||||
|
||||
You are now ready to use the Gemini CLI!
|
||||
|
||||
### Use a Gemini API key:
|
||||
|
||||
The Gemini API provides a free tier with [100 requests per day](https://ai.google.dev/gemini-api/docs/rate-limits#free-tier) using Gemini 2.5 Pro, control over which model you use, and access to higher rate limits (with a paid plan):
|
||||
|
||||
1. Generate a key from [Google AI Studio](https://aistudio.google.com/apikey).
|
||||
2. Set it as an environment variable in your terminal. Replace `YOUR_API_KEY` with your generated key.
|
||||
|
||||
```bash
|
||||
export GEMINI_API_KEY="YOUR_API_KEY"
|
||||
```
|
||||
|
||||
3. (Optionally) Upgrade your Gemini API project to a paid plan on the API key page (will automatically unlock [Tier 1 rate limits](https://ai.google.dev/gemini-api/docs/rate-limits#tier-1))
|
||||
|
||||
### Use a Vertex AI API key:
|
||||
|
||||
The Vertex AI API provides a [free tier](https://cloud.google.com/vertex-ai/generative-ai/docs/start/express-mode/overview) using express mode for Gemini 2.5 Pro, control over which model you use, and access to higher rate limits with a billing account:
|
||||
|
||||
1. Generate a key from [Google Cloud](https://cloud.google.com/vertex-ai/generative-ai/docs/start/api-keys).
|
||||
2. Set it as an environment variable in your terminal. Replace `YOUR_API_KEY` with your generated key and set GOOGLE_GENAI_USE_VERTEXAI to true
|
||||
|
||||
```bash
|
||||
export GOOGLE_API_KEY="YOUR_API_KEY"
|
||||
export GOOGLE_GENAI_USE_VERTEXAI=true
|
||||
```
|
||||
|
||||
3. (Optionally) Add a billing account on your project to get access to [higher usage limits](https://cloud.google.com/vertex-ai/generative-ai/docs/quotas)
|
||||
|
||||
For other authentication methods, including Google Workspace accounts, see the [authentication](./docs/cli/authentication.md) guide.
|
||||
|
||||
## Examples
|
||||
|
||||
Once the CLI is running, you can start interacting with Gemini from your shell.
|
||||
|
||||
You can start a project from a new directory:
|
||||
|
||||
```sh
|
||||
cd new-project/
|
||||
gemini
|
||||
> Write me a Gemini Discord bot that answers questions using a FAQ.md file I will provide
|
||||
```bash
|
||||
# Using npx (no installation required)
|
||||
npx https://github.com/google-gemini/gemini-cli
|
||||
```
|
||||
|
||||
Or work with an existing project:
|
||||
#### Install globally with npm
|
||||
|
||||
```sh
|
||||
```bash
|
||||
npm install -g @google/gemini-cli
|
||||
```
|
||||
|
||||
#### Install globally with Homebrew (macOS/Linux)
|
||||
|
||||
```bash
|
||||
brew install gemini-cli
|
||||
```
|
||||
|
||||
#### System Requirements
|
||||
|
||||
- Node.js version 20 or higher
|
||||
- macOS, Linux, or Windows
|
||||
|
||||
## 📋 Key Features
|
||||
|
||||
With Gemini CLI you can:
|
||||
|
||||
- **Code Understanding & Generation**
|
||||
- Query and edit large codebases
|
||||
- Generate new apps from PDFs, images, or sketches using multimodal capabilities
|
||||
- Debug issues and troubleshoot with natural language
|
||||
- **Automation & Integration**
|
||||
- Automate operational tasks like querying pull requests or handling complex rebases
|
||||
- Use MCP servers to connect new capabilities, including [media generation with Imagen, Veo or Lyria](https://github.com/GoogleCloudPlatform/vertex-ai-creative-studio/tree/main/experiments/mcp-genmedia)
|
||||
- Run non-interactively in scripts for workflow automation
|
||||
- **Advanced Capabilities**
|
||||
- Ground your queries with built-in [Google Search](https://ai.google.dev/gemini-api/docs/grounding) for real-time information
|
||||
- Conversation checkpointing to save and resume complex sessions
|
||||
- Custom context files (GEMINI.md) to tailor behavior for your projects
|
||||
|
||||
- **🔗 GitHub Integration**
|
||||
- Use the Gemini CLI GitHub Action for automated PR reviews
|
||||
- Automated issue triage and on-demand AI assistance directly in your repositories
|
||||
- Seamless integration with your GitHub workflows
|
||||
|
||||
## 🔐 Authentication Options
|
||||
|
||||
Choose the authentication method that best fits your needs:
|
||||
|
||||
### Option 1: OAuth login (Using your Google Account)
|
||||
|
||||
**✨ Best for:** Individual developers as well as anyone who has a Gemini Code Assist License. (see [quota limits and terms of service](https://cloud.google.com/gemini/docs/quotas) for details)
|
||||
|
||||
**Benefits:**
|
||||
|
||||
- **Free tier**: 60 requests/min and 1,000 requests/day
|
||||
- **Gemini 2.5 Pro** with 1M token context window
|
||||
- **No API key management** - just sign in with your Google account
|
||||
- **Automatic updates** to latest models
|
||||
|
||||
#### Start Gemini CLI, then choose OAuth and follow the browser authentication flow when prompted
|
||||
|
||||
```bash
|
||||
gemini
|
||||
```
|
||||
|
||||
#### If you are using a paid Code Assist License from your organization, remember to set the Google Cloud Project
|
||||
|
||||
```bash
|
||||
# Set your Google Cloud Project
|
||||
export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_NAME"
|
||||
gemini
|
||||
```
|
||||
|
||||
### Option 2: Gemini API Key
|
||||
|
||||
**✨ Best for:** Developers who need specific model control or paid tier access
|
||||
|
||||
**Benefits:**
|
||||
|
||||
- **Free tier**: 100 requests/day with Gemini 2.5 Pro
|
||||
- **Model selection**: Choose specific Gemini models
|
||||
- **Usage-based billing**: Upgrade for higher limits when needed
|
||||
|
||||
```bash
|
||||
# Get your key from https://aistudio.google.com/apikey
|
||||
export GEMINI_API_KEY="YOUR_API_KEY"
|
||||
gemini
|
||||
```
|
||||
|
||||
### Option 3: Vertex AI
|
||||
|
||||
**✨ Best for:** Enterprise teams and production workloads
|
||||
|
||||
**Benefits:**
|
||||
|
||||
- **Enterprise features**: Advanced security and compliance
|
||||
- **Scalable**: Higher rate limits with billing account
|
||||
- **Integration**: Works with existing Google Cloud infrastructure
|
||||
|
||||
```bash
|
||||
# Get your key from Google Cloud Console
|
||||
export GOOGLE_API_KEY="YOUR_API_KEY"
|
||||
export GOOGLE_GENAI_USE_VERTEXAI=true
|
||||
gemini
|
||||
```
|
||||
|
||||
For Google Workspace accounts and other authentication methods, see the [authentication guide](./docs/cli/authentication.md).
|
||||
|
||||
## 🚀 Getting Started
|
||||
|
||||
### Basic Usage
|
||||
|
||||
#### Start in current directory
|
||||
|
||||
```bash
|
||||
gemini
|
||||
```
|
||||
|
||||
#### Include multiple directories
|
||||
|
||||
```bash
|
||||
gemini --include-directories ../lib,../docs
|
||||
```
|
||||
|
||||
#### Use specific model
|
||||
|
||||
```bash
|
||||
gemini -m gemini-2.5-flash
|
||||
```
|
||||
|
||||
#### Non-interactive mode for scripts
|
||||
|
||||
```bash
|
||||
gemini -p "Explain the architecture of this codebase"
|
||||
```
|
||||
|
||||
### Quick Examples
|
||||
|
||||
#### Start a new project
|
||||
|
||||
````bash
|
||||
cd new-project/
|
||||
gemini
|
||||
> Write me a Discord bot that answers questions using a FAQ.md file I will provide
|
||||
|
||||
#### Analyze existing code
|
||||
```bash
|
||||
git clone https://github.com/google-gemini/gemini-cli
|
||||
cd gemini-cli
|
||||
gemini
|
||||
> Give me a summary of all of the changes that went in yesterday
|
||||
```
|
||||
````
|
||||
|
||||
### Next steps
|
||||
|
||||
- Learn how to [contribute to or build from the source](./CONTRIBUTING.md).
|
||||
- Explore the available **[CLI Commands](./docs/cli/commands.md)**.
|
||||
- If you encounter any issues, review the **[troubleshooting guide](./docs/troubleshooting.md)**.
|
||||
- For more comprehensive documentation, see the [full documentation](./docs/index.md).
|
||||
- Take a look at some [popular tasks](#popular-tasks) for more inspiration.
|
||||
- Check out our **[Official Roadmap](./ROADMAP.md)**
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
Head over to the [troubleshooting guide](docs/troubleshooting.md) if you're
|
||||
having issues.
|
||||
|
||||
## GitHub Integration
|
||||
## 🔗 GitHub Integration
|
||||
|
||||
Integrate Gemini CLI directly into your GitHub workflows with the [**Gemini CLI GitHub Action**](https://github.com/google-github-actions/run-gemini-cli). Key features include:
|
||||
|
||||
|
@ -138,88 +185,98 @@ Integrate Gemini CLI directly into your GitHub workflows with the [**Gemini CLI
|
|||
- **On-demand Collaboration**: Mention `@gemini-cli` in issues and pull requests for assistance and task delegation.
|
||||
- **Custom Workflows**: Set up your own scheduled tasks and event-driven automations.
|
||||
|
||||
## Popular tasks
|
||||
## 📚 Documentation
|
||||
|
||||
### Explore a new codebase
|
||||
### Getting Started
|
||||
|
||||
Start by `cd`ing into an existing or newly-cloned repository and running `gemini`.
|
||||
- [**Quickstart Guide**](./docs/cli/index.md) - Get up and running quickly
|
||||
- [**Authentication Setup**](./docs/cli/authentication.md) - Detailed auth configuration
|
||||
- [**Configuration Guide**](./docs/cli/configuration.md) - Settings and customization
|
||||
- [**Keyboard Shortcuts**](./docs/keyboard-shortcuts.md) - Productivity tips
|
||||
|
||||
### Core Features
|
||||
|
||||
- [**Commands Reference**](./docs/cli/commands.md) - All slash commands (`/help`, `/chat`, `/mcp`, etc.)
|
||||
- [**Checkpointing**](./docs/checkpointing.md) - Save and resume conversations
|
||||
- [**Memory Management**](./docs/tools/memory.md) - Using GEMINI.md context files
|
||||
- [**Token Caching**](./docs/cli/token-caching.md) - Optimize token usage
|
||||
|
||||
### Tools & Extensions
|
||||
|
||||
- [**Built-in Tools Overview**](./docs/tools/index.md)
|
||||
- [File System Operations](./docs/tools/file-system.md)
|
||||
- [Shell Commands](./docs/tools/shell.md)
|
||||
- [Web Fetch & Search](./docs/tools/web-fetch.md)
|
||||
- [Multi-file Operations](./docs/tools/multi-file.md)
|
||||
- [**MCP Server Integration**](./docs/tools/mcp-server.md) - Extend with custom tools
|
||||
- [**Custom Extensions**](./docs/extension.md) - Build your own commands
|
||||
|
||||
### Advanced Topics
|
||||
|
||||
- [**Architecture Overview**](./docs/architecture.md) - How Gemini CLI works
|
||||
- [**IDE Integration**](./docs/extension.md) - VS Code companion
|
||||
- [**Sandboxing & Security**](./docs/sandbox.md) - Safe execution environments
|
||||
- [**Enterprise Deployment**](./docs/deployment.md) - Docker, system-wide config
|
||||
- [**Telemetry & Monitoring**](./docs/telemetry.md) - Usage tracking
|
||||
- [**Tools API Development**](./docs/core/tools-api.md) - Create custom tools
|
||||
|
||||
### Configuration & Customization
|
||||
|
||||
- [**Settings Reference**](./docs/cli/configuration.md) - All configuration options
|
||||
- [**Theme Customization**](./docs/cli/themes.md) - Visual customization
|
||||
- [**.gemini Directory**](./docs/gemini-ignore.md) - Project-specific settings
|
||||
- [**Environment Variables**](./docs/cli/configuration.md#environment-variables)
|
||||
|
||||
### Troubleshooting & Support
|
||||
|
||||
- [**Troubleshooting Guide**](./docs/troubleshooting.md) - Common issues and solutions
|
||||
- [**FAQ**](./docs/troubleshooting.md#frequently-asked-questions) - Quick answers
|
||||
- Use `/bug` command to report issues directly from the CLI
|
||||
|
||||
### Using MCP Servers
|
||||
|
||||
Configure MCP servers in `~/.gemini/settings.json` to extend Gemini CLI with custom tools:
|
||||
|
||||
```text
|
||||
> Describe the main pieces of this system's architecture.
|
||||
> @github List my open pull requests
|
||||
> @slack Send a summary of today's commits to #dev channel
|
||||
> @database Run a query to find inactive users
|
||||
```
|
||||
|
||||
```text
|
||||
> What security mechanisms are in place?
|
||||
```
|
||||
See the [MCP Server Integration guide](./docs/tools/mcp-server.md) for setup instructions.
|
||||
|
||||
```text
|
||||
> Provide a step-by-step dev onboarding doc for developers new to the codebase.
|
||||
```
|
||||
## 🤝 Contributing
|
||||
|
||||
```text
|
||||
> Summarize this codebase and highlight the most interesting patterns or techniques I could learn from.
|
||||
```
|
||||
We welcome contributions! Gemini CLI is fully open source (Apache 2.0), and we encourage the community to:
|
||||
|
||||
```text
|
||||
> Identify potential areas for improvement or refactoring in this codebase, highlighting parts that appear fragile, complex, or hard to maintain.
|
||||
```
|
||||
- Report bugs and suggest features
|
||||
- Improve documentation
|
||||
- Submit code improvements
|
||||
- Share your MCP servers and extensions
|
||||
|
||||
```text
|
||||
> Which parts of this codebase might be challenging to scale or debug?
|
||||
```
|
||||
See our [Contributing Guide](./CONTRIBUTING.md) for development setup, coding standards, and how to submit pull requests.
|
||||
|
||||
```text
|
||||
> Generate a README section for the [module name] module explaining what it does and how to use it.
|
||||
```
|
||||
Check our [Official Roadmap](https://github.com/orgs/google-gemini/projects/11/) for planned features and priorities.
|
||||
|
||||
```text
|
||||
> What kind of error handling and logging strategies does the project use?
|
||||
```
|
||||
## 📖 Resources
|
||||
|
||||
```text
|
||||
> Which tools, libraries, and dependencies are used in this project?
|
||||
```
|
||||
|
||||
### Work with your existing code
|
||||
|
||||
```text
|
||||
> Implement a first draft for GitHub issue #123.
|
||||
```
|
||||
|
||||
```text
|
||||
> Help me migrate this codebase to the latest version of Java. Start with a plan.
|
||||
```
|
||||
|
||||
### Automate your workflows
|
||||
|
||||
Use MCP servers to integrate your local system tools with your enterprise collaboration suite.
|
||||
|
||||
```text
|
||||
> Make me a slide deck showing the git history from the last 7 days, grouped by feature and team member.
|
||||
```
|
||||
|
||||
```text
|
||||
> Make a full-screen web app for a wall display to show our most interacted-with GitHub issues.
|
||||
```
|
||||
|
||||
### Interact with your system
|
||||
|
||||
```text
|
||||
> Convert all the images in this directory to png, and rename them to use dates from the exif data.
|
||||
```
|
||||
|
||||
```text
|
||||
> Organize my PDF invoices by month of expenditure.
|
||||
```
|
||||
- **[Official Roadmap](./ROADMAP.md)** - See what's coming next
|
||||
- **[NPM Package](https://www.npmjs.com/package/@google/gemini-cli)** - Package registry
|
||||
- **[GitHub Issues](https://github.com/google-gemini/gemini-cli/issues)** - Report bugs or request features
|
||||
- **[Security Advisories](https://github.com/google-gemini/gemini-cli/security/advisories)** - Security updates
|
||||
|
||||
### Uninstall
|
||||
|
||||
Head over to the [Uninstall](docs/Uninstall.md) guide for uninstallation instructions.
|
||||
See the [Uninstall Guide](docs/Uninstall.md) for removal instructions.
|
||||
|
||||
## Terms of Service and Privacy Notice
|
||||
## 📄 Legal
|
||||
|
||||
For details on the terms of service and privacy notice applicable to your use of Gemini CLI, see the [Terms of Service and Privacy Notice](./docs/tos-privacy.md).
|
||||
- **License**: [Apache License 2.0](LICENSE)
|
||||
- **Terms of Service**: [Terms & Privacy](./docs/tos-privacy.md)
|
||||
- **Security**: [Security Policy](SECURITY.md)
|
||||
|
||||
## Security Disclosures
|
||||
---
|
||||
|
||||
Please see our [security disclosure process](SECURITY.md). All [security advisories](https://github.com/google-gemini/gemini-cli/security/advisories) are managed on Github.
|
||||
<p align="center">
|
||||
Built with ❤️ by Google and the open source community
|
||||
</p>
|
||||
|
|
Loading…
Reference in New Issue