Skip to content

Commit 138ce94

Browse files
SandyTao520jacob314
authored andcommitted
Upgrade to Ink 6 and React 19 (google-gemini#2096)
Co-authored-by: jacob314 <[email protected]>
1 parent d0e3da9 commit 138ce94

18 files changed

+1177
-1619
lines changed

GEMINI.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ Rather than relying on Java-esque private or public class members, which can be
9191
TypeScript's power lies in its ability to provide static type checking, catching potential errors before your code runs. To fully leverage this, it's crucial to avoid the `any` type and be judicious with type assertions.
9292

9393
- **The Dangers of `any`**: Using any effectively opts out of TypeScript's type checking for that particular variable or expression. While it might seem convenient in the short term, it introduces significant risks:
94-
9594
- **Loss of Type Safety**: You lose all the benefits of type checking, making it easy to introduce runtime errors that TypeScript would otherwise have caught.
9695
- **Reduced Readability and Maintainability**: Code with `any` types is harder to understand and maintain, as the expected type of data is no longer explicitly defined.
9796
- **Masking Underlying Issues**: Often, the need for any indicates a deeper problem in the design of your code or the way you're interacting with external libraries. It's a sign that you might need to refine your types or refactor your code.
@@ -163,7 +162,6 @@ Design for a good user experience - Provide clear, minimal, and non-blocking UI
163162
### Process
164163

165164
1. Analyze the user's code for optimization opportunities:
166-
167165
- Check for React anti-patterns that prevent compiler optimization
168166
- Look for component structure issues that limit compiler effectiveness
169167
- Think about each suggestion you are making and consult React docs for best practices

docs/architecture.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ This document provides a high-level overview of the Gemini CLI's architecture.
77
The Gemini CLI is primarily composed of two main packages, along with a suite of tools that can be used by the system in the course of handling command-line input:
88

99
1. **CLI package (`packages/cli`):**
10-
1110
- **Purpose:** This contains the user-facing portion of the Gemini CLI, such as handling the initial user input, presenting the final output, and managing the overall user experience.
1211
- **Key functions contained in the package:**
1312
- [Input processing](./cli/commands.md)
@@ -17,7 +16,6 @@ The Gemini CLI is primarily composed of two main packages, along with a suite of
1716
- [CLI configuration settings](./cli/configuration.md)
1817

1918
2. **Core package (`packages/core`):**
20-
2119
- **Purpose:** This acts as the backend for the Gemini CLI. It receives requests sent from `packages/cli`, orchestrates interactions with the Gemini API, and manages the execution of available tools.
2220
- **Key functions contained in the package:**
2321
- API client for communicating with the Google Gemini API

docs/cli/authentication.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,22 @@
33
The Gemini CLI requires you to authenticate with Google's AI services. On initial startup you'll need to configure **one** of the following authentication methods:
44

55
1. **Login with Google (Gemini Code Assist):**
6-
76
- Use this option to log in with your google account.
87
- During initial startup, Gemini CLI will direct you to a webpage for authentication. Once authenticated, your credentials will be cached locally so the web login can be skipped on subsequent runs.
98
- Note that the web login must be done in a browser that can communicate with the machine Gemini CLI is being run from. (Specifically, the browser will be redirected to a localhost url that Gemini CLI will be listening on).
109
- <a id="workspace-gca">Users may have to specify a GOOGLE_CLOUD_PROJECT if:</a>
11-
1210
1. You have a Google Workspace account. Google Workspace is a paid service for businesses and organizations that provides a suite of productivity tools, including a custom email domain (e.g. [email protected]), enhanced security features, and administrative controls. These accounts are often managed by an employer or school.
1311
1. You have recieved a free Code Assist license through the [Google Developer Program](https://developers.google.com/program/plans-and-pricing) (including qualified Google Developer Experts)
1412
1. You have been assigned a license to a current Gemini Code Assist standard or enterprise subscription.
1513
1. You are using the product outside the the [supported regions](https://developers.google.com/gemini-code-assist/resources/available-locations) for free individual usage.>
1614
1. You are a Google account holder under the age of 18
17-
1815
- If you fall into one of these categories, you must first configure a Google Cloud Project Id to use, [enable the Gemini for Cloud API](https://cloud.google.com/gemini/docs/discover/set-up-gemini#enable-api) and [configure access permissions](https://cloud.google.com/gemini/docs/discover/set-up-gemini#grant-iam).
1916

2017
You can temporarily set the environment variable in your current shell session using the following command:
2118

2219
```bash
2320
export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"
2421
```
25-
2622
- For repeated use, you can add the environment variable to your `.env` file (located in the project directory or user home directory) or your shell's configuration file (like `~/.bashrc`, `~/.zshrc`, or `~/.profile`). For example, the following command adds the environment variable to a `~/.bashrc` file:
2723
2824
```bash
@@ -31,7 +27,6 @@ The Gemini CLI requires you to authenticate with Google's AI services. On initia
3127
```
3228
3329
2. **<a id="gemini-api-key"></a>Gemini API key:**
34-
3530
- Obtain your API key from Google AI Studio: [https://aistudio.google.com/app/apikey](https://aistudio.google.com/app/apikey)
3631
- Set the `GEMINI_API_KEY` environment variable. In the following methods, replace `YOUR_GEMINI_API_KEY` with the API key you obtained from Google AI Studio:
3732
- You can temporarily set the environment variable in your current shell session using the following command:

docs/cli/commands.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ Gemini CLI supports several built-in commands to help you manage your session, c
77
Slash commands provide meta-level control over the CLI itself.
88

99
- **`/bug`**
10-
1110
- **Description:** File an issue about Gemini CLI. By default, the issue is filed within the GitHub repository for Gemini CLI. The string you enter after `/bug` will become the headline for the bug being filed. The default `/bug` behavior can be modified using the `bugCommand` setting in your `.gemini/settings.json` files.
1211

1312
- **`/chat`**
14-
1513
- **Description:** Save and resume conversation history for branching conversation state interactively, or resuming a previous state from a later session.
1614
- **Sub-commands:**
1715
- **`save`**
@@ -24,24 +22,19 @@ Slash commands provide meta-level control over the CLI itself.
2422
- **Description:** Lists available tags for chat state resumption.
2523

2624
- **`/clear`**
27-
2825
- **Description:** Clear the terminal screen, including the visible session history and scrollback within the CLI. The underlying session data (for history recall) might be preserved depending on the exact implementation, but the visual display is cleared.
2926
- **Keyboard shortcut:** Press **Ctrl+L** at any time to perform a clear action.
3027

3128
- **`/compress`**
32-
3329
- **Description:** Replace the entire chat context with a summary. This saves on tokens used for future tasks while retaining a high level summary of what has happened.
3430

3531
- **`/editor`**
36-
3732
- **Description:** Open a dialog for selecting supported editors.
3833

3934
- **`/help`** (or **`/?`**)
40-
4135
- **Description:** Display help information about the Gemini CLI, including available commands and their usage.
4236

4337
- **`/mcp`**
44-
4538
- **Description:** List configured Model Context Protocol (MCP) servers, their connection status, server details, and available tools.
4639
- **Sub-commands:**
4740
- **`desc`** or **`descriptions`**:
@@ -53,7 +46,6 @@ Slash commands provide meta-level control over the CLI itself.
5346
- **Keyboard Shortcut:** Press **Ctrl+T** at any time to toggle between showing and hiding tool descriptions.
5447

5548
- **`/memory`**
56-
5749
- **Description:** Manage the AI's instructional context (hierarchical memory loaded from `GEMINI.md` files).
5850
- **Sub-commands:**
5951
- **`add`**:
@@ -65,29 +57,23 @@ Slash commands provide meta-level control over the CLI itself.
6557
- **Note:** For more details on how `GEMINI.md` files contribute to hierarchical memory, see the [CLI Configuration documentation](./configuration.md#4-geminimd-files-hierarchical-instructional-context).
6658

6759
- **`/restore`**
68-
6960
- **Description:** Restores the project files to the state they were in just before a tool was executed. This is particularly useful for undoing file edits made by a tool. If run without a tool call ID, it will list available checkpoints to restore from.
7061
- **Usage:** `/restore [tool_call_id]`
7162
- **Note:** Only available if the CLI is invoked with the `--checkpointing` option or configured via [settings](./configuration.md). See [Checkpointing documentation](../checkpointing.md) for more details.
7263

7364
- **`/stats`**
74-
7565
- **Description:** Display detailed statistics for the current Gemini CLI session, including token usage, cached token savings (when available), and session duration. Note: Cached token information is only displayed when cached tokens are being used, which occurs with API key authentication but not with OAuth authentication at this time.
7666

7767
- [**`/theme`**](./themes.md)
78-
7968
- **Description:** Open a dialog that lets you change the visual theme of Gemini CLI.
8069

8170
- **`/auth`**
82-
8371
- **Description:** Open a dialog that lets you change the authentication method.
8472

8573
- **`/about`**
86-
8774
- **Description:** Show version info. Please share this information when filing issues.
8875

8976
- [**`/tools`**](../tools/index.md)
90-
9177
- **Description:** Display a list of tools that are currently available within Gemini CLI.
9278
- **Sub-commands:**
9379
- **`desc`** or **`descriptions`**:
@@ -96,15 +82,13 @@ Slash commands provide meta-level control over the CLI itself.
9682
- **Description:** Hide tool descriptions, showing only the tool names.
9783

9884
- **`/quit`** (or **`/exit`**)
99-
10085
- **Description:** Exit Gemini CLI.
10186

10287
## At commands (`@`)
10388

10489
At commands are used to include the content of files or directories as part of your prompt to Gemini. These commands include git-aware filtering.
10590

10691
- **`@<path_to_file_or_directory>`**
107-
10892
- **Description:** Inject the content of the specified file or files into your current prompt. This is useful for asking questions about specific code, text, or collections of files.
10993
- **Examples:**
11094
- `@path/to/your/file.txt Explain this text.`
@@ -132,14 +116,12 @@ At commands are used to include the content of files or directories as part of y
132116
The `!` prefix lets you interact with your system's shell directly from within Gemini CLI.
133117

134118
- **`!<shell_command>`**
135-
136119
- **Description:** Execute the given `<shell_command>` in your system's default shell. Any output or errors from the command are displayed in the terminal.
137120
- **Examples:**
138121
- `!ls -la` (executes `ls -la` and returns to Gemini CLI)
139122
- `!git status` (executes `git status` and returns to Gemini CLI)
140123

141124
- **`!` (Toggle shell mode)**
142-
143125
- **Description:** Typing `!` on its own toggles shell mode.
144126
- **Entering shell mode:**
145127
- When active, shell mode uses a different coloring and a "Shell Mode Indicator".

docs/cli/configuration.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,11 @@ In addition to a project settings file, a project's `.gemini` directory can cont
3434
### Available settings in `settings.json`:
3535

3636
- **`contextFileName`** (string or array of strings):
37-
3837
- **Description:** Specifies the filename for context files (e.g., `GEMINI.md`, `AGENTS.md`). Can be a single filename or a list of accepted filenames.
3938
- **Default:** `GEMINI.md`
4039
- **Example:** `"contextFileName": "AGENTS.md"`
4140

4241
- **`bugCommand`** (object):
43-
4442
- **Description:** Overrides the default URL for the `/bug` command.
4543
- **Default:** `"urlTemplate": "https://github.com/google-gemini/gemini-cli/issues/new?template=bug_report.yml&title={title}&info={info}"`
4644
- **Properties:**
@@ -53,7 +51,6 @@ In addition to a project settings file, a project's `.gemini` directory can cont
5351
```
5452

5553
- **`fileFiltering`** (object):
56-
5754
- **Description:** Controls git-aware file filtering behavior for @ commands and file discovery tools.
5855
- **Default:** `"respectGitIgnore": true, "enableRecursiveFileSearch": true`
5956
- **Properties:**
@@ -68,43 +65,36 @@ In addition to a project settings file, a project's `.gemini` directory can cont
6865
```
6966

7067
- **`coreTools`** (array of strings):
71-
7268
- **Description:** Allows you to specify a list of core tool names that should be made available to the model. This can be used to restrict the set of built-in tools. See [Built-in Tools](../core/tools-api.md#built-in-tools) for a list of core tools.
7369
- **Default:** All tools available for use by the Gemini model.
7470
- **Example:** `"coreTools": ["ReadFileTool", "GlobTool", "SearchText"]`.
7571

7672
- **`excludeTools`** (array of strings):
77-
7873
- **Description:** Allows you to specify a list of core tool names that should be excluded from the model. A tool listed in both `excludeTools` and `coreTools` is excluded.
7974
- **Default**: No tools excluded.
8075
- **Example:** `"excludeTools": ["run_shell_command", "findFiles"]`.
8176

8277
- **`autoAccept`** (boolean):
83-
8478
- **Description:** Controls whether the CLI automatically accepts and executes tool calls that are considered safe (e.g., read-only operations) without explicit user confirmation. If set to `true`, the CLI will bypass the confirmation prompt for tools deemed safe.
8579
- **Default:** `false`
8680
- **Example:** `"autoAccept": true`
8781

8882
- **`theme`** (string):
89-
9083
- **Description:** Sets the visual [theme](./themes.md) for Gemini CLI.
9184
- **Default:** `"Default"`
9285
- **Example:** `"theme": "GitHub"`
9386

9487
- **`sandbox`** (boolean or string):
95-
9688
- **Description:** Controls whether and how to use sandboxing for tool execution. If set to `true`, Gemini CLI uses a pre-built `gemini-cli-sandbox` Docker image. For more information, see [Sandboxing](#sandboxing).
9789
- **Default:** `false`
9890
- **Example:** `"sandbox": "docker"`
9991

10092
- **`toolDiscoveryCommand`** (string):
101-
10293
- **Description:** Defines a custom shell command for discovering tools from your project. The shell command must return on `stdout` a JSON array of [function declarations](https://ai.google.dev/gemini-api/docs/function-calling#function-declarations). Tool wrappers are optional.
10394
- **Default:** Empty
10495
- **Example:** `"toolDiscoveryCommand": "bin/get_tools"`
10596

10697
- **`toolCallCommand`** (string):
107-
10898
- **Description:** Defines a custom shell command for calling a specific tool that was discovered using `toolDiscoveryCommand`. The shell command must meet the following criteria:
10999
- It must take function `name` (exactly as in [function declaration](https://ai.google.dev/gemini-api/docs/function-calling#function-declarations)) as first command line argument.
110100
- It must read function arguments as JSON on `stdin`, analogous to [`functionCall.args`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#functioncall).
@@ -113,7 +103,6 @@ In addition to a project settings file, a project's `.gemini` directory can cont
113103
- **Example:** `"toolCallCommand": "bin/call_tool"`
114104

115105
- **`mcpServers`** (object):
116-
117106
- **Description:** Configures connections to one or more Model-Context Protocol (MCP) servers for discovering and using custom tools. Gemini CLI attempts to connect to each configured MCP server to discover available tools. If multiple MCP servers expose a tool with the same name, the tool names will be prefixed with the server alias you defined in the configuration (e.g., `serverAlias__actualToolName`) to avoid conflicts. Note that the system might strip certain schema properties from MCP tool definitions for compatibility.
118107
- **Default:** Empty
119108
- **Properties:**
@@ -149,14 +138,12 @@ In addition to a project settings file, a project's `.gemini` directory can cont
149138
```
150139

151140
- **`checkpointing`** (object):
152-
153141
- **Description:** Configures the checkpointing feature, which allows you to save and restore conversation and file states. See the [Checkpointing documentation](../checkpointing.md) for more details.
154142
- **Default:** `{"enabled": false}`
155143
- **Properties:**
156144
- **`enabled`** (boolean): When `true`, the `/restore` command is available.
157145

158146
- **`preferredEditor`** (string):
159-
160147
- **Description:** Specifies the preferred editor to use for viewing diffs.
161148
- **Default:** `vscode`
162149
- **Example:** `"preferredEditor": "vscode"`

docs/core/tools-api.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ The Gemini CLI core (`packages/core`) features a robust system for defining, reg
55
## Core Concepts
66

77
- **Tool (`tools.ts`):** An interface and base class (`BaseTool`) that defines the contract for all tools. Each tool must have:
8-
98
- `name`: A unique internal name (used in API calls to Gemini).
109
- `displayName`: A user-friendly name.
1110
- `description`: A clear explanation of what the tool does, which is provided to the Gemini model.
@@ -16,7 +15,6 @@ The Gemini CLI core (`packages/core`) features a robust system for defining, reg
1615
- `execute()`: The core method that performs the tool's action and returns a `ToolResult`.
1716

1817
- **`ToolResult` (`tools.ts`):** An interface defining the structure of a tool's execution outcome:
19-
2018
- `llmContent`: The factual string content to be included in the history sent back to the LLM for context.
2119
- `returnDisplay`: A user-friendly string (often Markdown) or a special object (like `FileDiff`) for display in the CLI.
2220

0 commit comments

Comments
 (0)