Gemini CLI是什么
Gemini CLI是一款命令行AI工作流工具。它连接到用户的工具、理解用户的代码,并加速其工作流程。

Gemini CLI的主要功能
该工具具备以下功能:
- 查询和编辑大型代码库,支持超过Gemini 1M token的上下文窗口。
- 利用Gemini的多模态能力,从PDF或草图生成新的应用程序。
- 自动化运营任务,如查询拉取请求(pull requests)或处理复杂的变基(rebases)。
- 使用工具和MCP服务器连接新功能,包括使用Imagen、Veo或Lyria进行媒体生成。
- 使用内置于Gemini中的Google搜索工具为查询提供事实基础。
如何使用Gemini CLI
安装
用户有两种安装选项:
通过 Node
- 先决条件: 确保已安装Node.js 20或更高版本。
- 运行CLI: 在终端执行命令
npx https://github.com/google-gemini/gemini-cli
。
或通过npm install -g @google/gemini-cli
进行全局安装,然后运行gemini
。
通过 Homebrew
- 先决条件: 确保已安装Homebrew。
- 安装CLI: 在终端执行命令
brew install gemini-cli
,然后运行gemini
。
通用配置步骤
- 选择一个颜色主题。
- 认证: 根据提示,使用个人Google账户登录。这将授予每分钟最多60次、每天最多1000次模型请求的额度。
使用API密钥
使用Gemini API密钥:
- 从Google AI Studio生成密钥。
- 在终端中将其设置为环境变量:
export GEMINI_API_KEY="YOUR_API_KEY"
。 - (可选)在API密钥页面将项目升级到付费计划,以解锁更高的速率限制。
使用Vertex AI API密钥:
- 从Google Cloud生成密钥。
- 在终端中设置环境变量:
export GOOGLE_API_KEY="YOUR_API_KEY"
export GOOGLE_GENAI_USE_VERTEXAI=true
- (可选)为项目添加计费账户以获得更高的使用限制。
Gemini CLI的应用场景
探索新代码库
> Describe the main pieces of this system's architecture.
> What security mechanisms are in place?
> Provide a step-by-step dev onboarding doc for developers new to the codebase.
> Summarize this codebase and highlight the most interesting patterns or techniques I could learn from.
> Which parts of this codebase might be challenging to scale or debug?
> What kind of error handling and logging strategies does the project use?
处理现有代码
> Implement a first draft for GitHub issue #123.
> Help me migrate this codebase to the latest version of Java. Start with a plan.
自动化工作流
> Make me a slide deck showing the git history from the last 7 days, grouped by feature and team member.
> Make a full-screen web app for a wall display to show our most interacted-with GitHub issues.
与系统交互
> Convert all the images in this directory to png, and rename them to use dates from the exif data.
> Organize my PDF invoices by month of expenditure.
Gemini CLI的官网地址(或其他联系信息)
相关导航
暂无评论...