CLI Tools2026年4月8日·1 分钟阅读

Gemini CLI — Google AI Coding Agent in Terminal

Google's official CLI coding agent powered by Gemini 2.5 Pro. Free 60 requests/min for Gemini users with 1M token context, MCP support, and Google ecosystem integration.

Agent 就绪

这个资产会安全暂存

这个资产会先安全暂存。复制的指令会要求 Agent 读取暂存文件,并在激活脚本、MCP 配置或全局配置前先确认。

Stage only · 17/100策略:需暂存
Agent 入口
任意 MCP/CLI Agent
类型
Mcp Config
安装
Stage only
信任
信任等级:Established
入口
Gemini CLI — Google AI Coding Agent in Terminal
安全暂存命令
npx -y tokrepo@latest install 926633bc-d041-486a-bda3-5a3cecabc0a8 --target codex

先暂存文件;激活前需要读取暂存 README 和安装计划。

TL;DR
Gemini CLI brings Google's Gemini models to the terminal for AI-assisted coding, file editing, and command execution.
§01

What it is

Gemini CLI is Google's command-line AI coding agent. It lets you chat with Gemini models directly in the terminal, ask questions about your codebase, edit files, run shell commands, and generate code. It competes with Claude Code and GitHub Copilot CLI.

Gemini CLI targets developers who prefer terminal-based workflows and want AI assistance without leaving the command line. It supports multiple Gemini model variants.

§02

How it saves time or tokens

Instead of switching between a web browser (for AI chat) and terminal (for coding), Gemini CLI keeps everything in one place. Ask the AI to explain code, generate tests, refactor functions, or debug errors -- all from the same terminal session where you write code.

The CLI has direct access to your filesystem, so it can read project files and provide context-aware suggestions without manual copy-pasting.

§03

How to use

  1. Install Gemini CLI:
npm install -g @google/gemini-cli
  1. Authenticate with your Google account:
gemini auth login
  1. Start chatting in your project directory:
gemini
# Opens an interactive session with access to your project files
§04

Example

# Ask about your codebase
$ gemini 'Explain the authentication flow in this project'

# Generate a test file
$ gemini 'Write unit tests for src/utils/validators.ts'

# Fix a bug
$ gemini 'The login endpoint returns 500 when email is missing. Fix it.'

# Run commands through the AI
$ gemini 'Find all TODO comments in the project and list them'

Interactive mode example:

> What does the handlePayment function do?

Gemini: The handlePayment function in src/api/payments.ts:
1. Validates the payment amount and currency
2. Creates a Stripe PaymentIntent
3. Returns the client secret for frontend confirmation
...
§05

Related on TokRepo

§06

Common pitfalls

  • Gemini CLI requires a Google account and may have usage limits on the free tier. Check Google's pricing for current quotas.
  • File editing operations modify your code directly. Always use version control (git) so you can revert AI-generated changes.
  • Context window limits apply. For very large projects, the CLI may not be able to read all files simultaneously. Point it to specific directories or files.

常见问题

Is Gemini CLI free?+

Gemini CLI offers free usage with Google account authentication. Higher usage tiers and enterprise features may require a paid Google Cloud subscription. Check Google's current pricing for limits.

How does Gemini CLI compare to Claude Code?+

Both are terminal-based AI coding agents. Gemini CLI uses Google's Gemini models, Claude Code uses Anthropic's Claude models. Feature sets are similar: file editing, command execution, and codebase search. Model quality differences depend on the task.

Does Gemini CLI work offline?+

No. Gemini CLI requires an internet connection to communicate with Google's Gemini API. All inference happens in the cloud.

Can I use Gemini CLI with any programming language?+

Yes. Gemini CLI is language-agnostic. It reads files and generates code for any language that the Gemini model supports, which includes all major programming languages.

Does Gemini CLI support MCP?+

Check Google's latest documentation for MCP support status. The tool ecosystem is evolving and MCP integration may be available in newer versions.

引用来源 (3)
🙏

来源与感谢

google-gemini/gemini-cli — 50k+ stars, Apache 2.0

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产