Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 58 additions & 1 deletion gemini-cli/README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Gemini CLI Best Practices

> ⚠️ **Important change (since 2026-06-18)**: According to the [Google Developers Blog](https://developers.googleblog.com/an-important-update-transitioning-gemini-cli-to-antigravity-cli/), Gemini CLI **no longer serves individual users** (free Gemini Code Assist for individuals and Google AI Pro / Ultra sign-ins no longer work). Enterprise users (Gemini Code Assist Standard / Enterprise) and **paid Gemini API keys** still work, and Google continues to ship updates and support for enterprise users. Individual developers should switch to **Antigravity CLI**, which keeps Skills, Hooks, and Subagents, with Extensions becoming Antigravity plugins.
> ⚠️ **Important change (since 2026-06-18)**: According to the [Google Developers Blog](https://developers.googleblog.com/an-important-update-transitioning-gemini-cli-to-antigravity-cli/), Gemini CLI **no longer serves individual users** (free Gemini Code Assist for individuals and Google AI Pro / Ultra sign-ins no longer work). Enterprise users (Gemini Code Assist Standard / Enterprise) and **paid Gemini API keys** still work, and Google continues to ship updates and support for enterprise users. Individual developers should switch to **Antigravity CLI** ([migration steps below](#migrating-to-antigravity-cli-individual-users)), which keeps Skills, Hooks, and Subagents, with Extensions becoming Antigravity plugins.

> Gemini CLI is Google's command-line AI coding tool. Its biggest advantage: **a massive context window (1M tokens on Gemini 3 models)**. Great for large codebase analysis and long-running tasks.

Expand Down Expand Up @@ -156,6 +156,63 @@ Sort by migration priority.

---

## Migrating to Antigravity CLI (Individual Users)

> Everything below comes from official Google docs, last checked 2026-09-29. Official guide: [Migration from Gemini CLI](https://antigravity.google/docs/cli/gcli-migration).

### Install and Sign In

The command is **`agy`** ([install docs](https://antigravity.google/docs/cli/install/)):

```bash
# macOS / Linux (installs to ~/.local/bin/agy)
curl -fsSL https://antigravity.google/cli/install.sh | bash

# Windows PowerShell
irm https://antigravity.google/cli/install.ps1 | iex
```

- **Google account**: on first run, `agy` opens a browser to sign in and stores credentials in the OS keyring. Over SSH, you authorize by opening a URL yourself. Sign out with `/logout`
- **Gemini API key**: put `{"modelProvider": "gemini"}` in `~/.gemini/antigravity-cli/settings.json`, then `export GEMINI_API_KEY=...`. This works for headless / CI runs with no browser

### Config Migration Map

| Item | Gemini CLI | Antigravity CLI |
|------|-----------|-----------------|
| Context files | `GEMINI.md` / `AGENTS.md`, `~/.gemini/GEMINI.md` | **No change**, same rules |
| Global skills | `~/.gemini/skills/` | `~/.gemini/antigravity-cli/skills/` |
| Workspace skills | `.gemini/skills/` | `.agents/skills/` (**move manually**) |
| Extensions | Gemini extensions | Plugins: `agy plugin import gemini` converts them |
| MCP | `mcpServers` in `~/.gemini/settings.json` | Global `~/.gemini/config/mcp_config.json`, workspace `.agents/mcp_config.json`. For remote servers, rename `url` / `httpUrl` to `serverUrl` |
| Hooks | (not listed in the guide) | Workspace `.agents/hooks.json`, global `~/.gemini/config/hooks.json` or `~/.gemini/antigravity-cli/settings.json` ([Hooks](https://antigravity.google/docs/hooks/)) |
| Subagents | (not listed in the guide) | Workspace `.agents/agents/<name>.md`, global `~/.gemini/config/agents/<name>.md` ([Subagents](https://antigravity.google/docs/subagents/)) |

- If `agy` finds legacy config on first launch, it shows a migration checklist. The checklist converts extensions and global settings and moves session tokens to the OS keyring. Some custom terminal themes aren't supported
- `agy plugin import gemini` parses legacy extensions and migrates their skills and MCP servers. It also converts legacy custom commands into skills
- The official migration guide does **not** cover automatic conversion of Hooks or Subagents. Check them by hand against the new paths above

### Pricing and Quota

Per the [Plans docs](https://antigravity.google/docs/plans/) and [pricing page](https://antigravity.google/pricing): individuals can use it for free ($0 with a weekly rate limit), and the CLI is included in every plan. Google AI Pro / Ultra get higher quota that refreshes every five hours, up to a weekly cap. Pro / Ultra subscribers can also buy AI Credits. In the CLI, `/usage` shows your quota and `/credits` shows AI Credits.

### Key Differences from Gemini CLI

- Rewritten in Go and more responsive, with async multi-agent workflows ([Google Developers Blog](https://developers.googleblog.com/an-important-update-transitioning-gemini-cli-to-antigravity-cli/))
- Uses the same agent harness as the Antigravity 2.0 desktop app. Settings sync automatically, and you can export conversations between the CLI and the desktop app ([CLI Overview](https://antigravity.google/docs/cli/overview/))
- New slash commands include `/plan`, `/agents`, `/codesearch`, `/diff`, `/permissions`, `/resume` and `/usage`

### Migration Checklist

1. Install `agy`, run it and sign in with Google (or set `GEMINI_API_KEY`)
2. Accept the conversions in the first-launch migration checklist
3. Run `agy plugin import gemini` and check the output to confirm each extension migrated
4. Move each project's `.gemini/skills/` to `.agents/skills/`
5. Confirm MCP config is now in `mcp_config.json` and remote servers use `serverUrl` instead of `url` / `httpUrl`
6. Put Hooks and Subagents in the new paths listed above
7. Leave `GEMINI.md` / `AGENTS.md` as they are. Run `agy` once in the project to confirm your rules load

---

## Configuration Templates

| Template | Purpose |
Expand Down
59 changes: 58 additions & 1 deletion gemini-cli/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Gemini CLI 最佳实践

> ⚠️ **重要变化(2026-06-18 起)**:据 [Google Developers Blog](https://developers.googleblog.com/an-important-update-transitioning-gemini-cli-to-antigravity-cli/),Gemini CLI **已停止服务个人用户**(免费的 Gemini Code Assist 个人版、Google AI Pro / Ultra 账号登录都不能用了)。企业用户(Gemini Code Assist Standard / Enterprise)和**付费 Gemini API key** 仍可继续使用,Google 也继续为企业用户提供更新和支持。个人开发者请改用 **Antigravity CLI**——它保留了 Skills、Hooks、Subagents,Extensions 变成了 Antigravity plugins。
> ⚠️ **重要变化(2026-06-18 起)**:据 [Google Developers Blog](https://developers.googleblog.com/an-important-update-transitioning-gemini-cli-to-antigravity-cli/),Gemini CLI **已停止服务个人用户**(免费的 Gemini Code Assist 个人版、Google AI Pro / Ultra 账号登录都不能用了)。企业用户(Gemini Code Assist Standard / Enterprise)和**付费 Gemini API key** 仍可继续使用,Google 也继续为企业用户提供更新和支持。个人开发者请改用 **Antigravity CLI**(迁移步骤见[下文](#迁移到-antigravity-cli个人用户))——它保留了 Skills、Hooks、Subagents,Extensions 变成了 Antigravity plugins。

> Gemini CLI 是 Google 的命令行 AI 编程工具。最大优势:**超大上下文窗口(Gemini 3 模型 1M tokens)**。适合大代码库分析、长任务执行。

Expand Down Expand Up @@ -154,6 +154,63 @@ Gemini CLI 的 1M tokens 上下文窗口是它的核心优势。但大不等于

---

## 迁移到 Antigravity CLI(个人用户)

> 以下内容均来自 Google 官方文档,最后核对:2026-09-29。官方迁移指南:[Migration from Gemini CLI](https://antigravity.google/docs/cli/gcli-migration)。

### 安装与登录

命令名是 **`agy`**([安装文档](https://antigravity.google/docs/cli/install/)):

```bash
# macOS / Linux(安装到 ~/.local/bin/agy)
curl -fsSL https://antigravity.google/cli/install.sh | bash

# Windows PowerShell
irm https://antigravity.google/cli/install.ps1 | iex
```

- **Google 账号登录**:首次运行 `agy` 会打开浏览器登录,凭据存进系统 keyring;SSH 环境下改为手动打开 URL 授权。退出用 `/logout`
- **Gemini API key**:在 `~/.gemini/antigravity-cli/settings.json` 里写 `{"modelProvider": "gemini"}`,再 `export GEMINI_API_KEY=...`,适合无浏览器的 headless / CI 场景

### 配置迁移对照

| 项目 | Gemini CLI | Antigravity CLI |
|------|-----------|-----------------|
| 上下文文件 | `GEMINI.md` / `AGENTS.md`、`~/.gemini/GEMINI.md` | **不用改**,规则相同 |
| 全局 Skills | `~/.gemini/skills/` | `~/.gemini/antigravity-cli/skills/` |
| 项目 Skills | `.gemini/skills/` | `.agents/skills/`(**需手动移动**) |
| Extensions | Gemini 扩展 | 插件:`agy plugin import gemini` 自动转换 |
| MCP | `~/.gemini/settings.json` 里的 `mcpServers` | 全局 `~/.gemini/config/mcp_config.json`,项目 `.agents/mcp_config.json`;远程服务器的 `url` / `httpUrl` 改为 `serverUrl` |
| Hooks | (迁移指南未列出) | 项目 `.agents/hooks.json`,全局 `~/.gemini/config/hooks.json` 或 `~/.gemini/antigravity-cli/settings.json`([Hooks](https://antigravity.google/docs/hooks/)) |
| Subagents | (迁移指南未列出) | 项目 `.agents/agents/<name>.md`,全局 `~/.gemini/config/agents/<name>.md`([Subagents](https://antigravity.google/docs/subagents/)) |

- 首次运行 `agy` 时如果检测到旧配置,会弹出迁移清单:转换扩展和全局设置、把会话 token 迁到系统 keyring。部分自定义终端主题不支持
- `agy plugin import gemini` 会解析旧扩展,把其中的 skills、MCP 服务器迁过来,旧的自定义 commands 会转成 skills
- 官方迁移指南**没有**提到 Hooks 和 Subagents 的自动转换,建议按上表的新路径手动检查

### 价格与额度

据 [Plans 文档](https://antigravity.google/docs/plans/) 和 [定价页](https://antigravity.google/pricing):个人可以免费用($0,每周限额),CLI 属于所有计划都有的功能;Google AI Pro / Ultra 额度更高,每 5 小时刷新,另有每周上限;Pro / Ultra 用户还可以加购 AI Credits。CLI 里用 `/usage` 看额度,`/credits` 看 AI Credits。

### 和 Gemini CLI 的主要区别

- 用 Go 重写,响应更快;支持异步多 Agent 工作流([Google Developers Blog](https://developers.googleblog.com/an-important-update-transitioning-gemini-cli-to-antigravity-cli/))
- 和 Antigravity 2.0 桌面端共用同一套 agent harness,设置自动同步,会话可以在 CLI 和桌面端之间互导([CLI Overview](https://antigravity.google/docs/cli/overview/))
- 新增 `/plan`、`/agents`、`/codesearch`、`/diff`、`/permissions`、`/resume`、`/usage` 等斜杠命令

### 迁移清单

1. 安装 `agy`,运行后登录 Google 账号(或配置 `GEMINI_API_KEY`)
2. 在首次启动弹出的迁移清单里确认转换
3. 运行 `agy plugin import gemini`,看输出确认每个扩展是否迁移成功
4. 把项目里的 `.gemini/skills/` 移到 `.agents/skills/`
5. 检查 MCP 配置是否已迁到 `mcp_config.json`,远程服务器的 `url` / `httpUrl` 是否已改成 `serverUrl`
6. 把 Hooks、Subagents 放到上表列出的新路径
7. `GEMINI.md` / `AGENTS.md` 不用动,在项目里跑一次 `agy` 确认规则已生效

---

## 配置模板

| 模板 | 用途 |
Expand Down
Loading