mirror of
https://github.com/google-gemini/gemini-cli
synced 2026-04-21 13:37:17 +00:00
Automated documentation audit results (#22755)
This commit is contained in:
parent
69bf2d75ef
commit
e09410b6e5
55 changed files with 404 additions and 382 deletions
|
|
@ -72,7 +72,7 @@ organization.
|
|||
**Supported Fields:**
|
||||
|
||||
- `url`: (Required) The full URL of the MCP server endpoint.
|
||||
- `type`: (Required) The connection type (e.g., `sse` or `http`).
|
||||
- `type`: (Required) The connection type (for example, `sse` or `http`).
|
||||
- `trust`: (Optional) If set to `true`, the server is trusted and tool execution
|
||||
will not require user approval.
|
||||
- `includeTools`: (Optional) An explicit list of tool names to allow. If
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ and Gemini CLI (the server).
|
|||
|
||||
- **Communication:** The entire communication happens over standard input/output
|
||||
(stdio) using the JSON-RPC 2.0 protocol.
|
||||
- **Client's role:** The client is responsible for sending requests (e.g.,
|
||||
prompts) and handling responses and notifications from Gemini CLI.
|
||||
- **Client's role:** The client is responsible for sending requests (for
|
||||
example, prompts) and handling responses and notifications from Gemini CLI.
|
||||
- **Gemini CLI's role:** In ACP mode, Gemini CLI listens for incoming JSON-RPC
|
||||
requests, processes them, and sends back responses.
|
||||
|
||||
|
|
@ -72,8 +72,8 @@ leverage the IDE's capabilities to perform tasks. The MCP client logic is in
|
|||
|
||||
## Capabilities and supported methods
|
||||
|
||||
The ACP protocol exposes a number of methods for ACP clients (e.g. IDEs) to
|
||||
control Gemini CLI.
|
||||
The ACP protocol exposes a number of methods for ACP clients (for example IDEs)
|
||||
to control Gemini CLI.
|
||||
|
||||
### Core methods
|
||||
|
||||
|
|
@ -87,8 +87,8 @@ control Gemini CLI.
|
|||
|
||||
### Session control
|
||||
|
||||
- `setSessionMode`: Allows changing the approval level for tool calls (e.g., to
|
||||
`auto-approve`).
|
||||
- `setSessionMode`: Allows changing the approval level for tool calls (for
|
||||
example, to `auto-approve`).
|
||||
- `unstable_setSessionModel`: Changes the model for the current session.
|
||||
|
||||
### File system proxy
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
# Checkpointing
|
||||
|
||||
The Gemini CLI includes a Checkpointing feature that automatically saves a
|
||||
snapshot of your project's state before any file modifications are made by
|
||||
AI-powered tools. This lets you safely experiment with and apply code changes,
|
||||
knowing you can instantly revert back to the state before the tool was run.
|
||||
Gemini CLI includes a Checkpointing feature that automatically saves a snapshot
|
||||
of your project's state before any file modifications are made by AI-powered
|
||||
tools. This lets you safely experiment with and apply code changes, knowing you
|
||||
can instantly revert back to the state before the tool was run.
|
||||
|
||||
## How it works
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ To see a list of all saved checkpoints for the current project, simply run:
|
|||
|
||||
The CLI will display a list of available checkpoint files. These file names are
|
||||
typically composed of a timestamp, the name of the file being modified, and the
|
||||
name of the tool that was about to be run (e.g.,
|
||||
name of the tool that was about to be run (for example,
|
||||
`2025-06-22T10-00-00_000Z-my-file.txt-write_file`).
|
||||
|
||||
### Restore a specific checkpoint
|
||||
|
|
|
|||
|
|
@ -29,16 +29,16 @@ and parameters.
|
|||
|
||||
These commands are available within the interactive REPL.
|
||||
|
||||
| Command | Description |
|
||||
| -------------------- | ---------------------------------------- |
|
||||
| `/skills reload` | Reload discovered skills from disk |
|
||||
| `/agents reload` | Reload the agent registry |
|
||||
| `/commands reload` | Reload custom slash commands |
|
||||
| `/memory reload` | Reload context files (e.g., `GEMINI.md`) |
|
||||
| `/mcp reload` | Restart and reload MCP servers |
|
||||
| `/extensions reload` | Reload all active extensions |
|
||||
| `/help` | Show help for all commands |
|
||||
| `/quit` | Exit the interactive session |
|
||||
| Command | Description |
|
||||
| -------------------- | ----------------------------------------------- |
|
||||
| `/skills reload` | Reload discovered skills from disk |
|
||||
| `/agents reload` | Reload the agent registry |
|
||||
| `/commands reload` | Reload custom slash commands |
|
||||
| `/memory reload` | Reload context files (for example, `GEMINI.md`) |
|
||||
| `/mcp reload` | Restart and reload MCP servers |
|
||||
| `/extensions reload` | Reload all active extensions |
|
||||
| `/help` | Show help for all commands |
|
||||
| `/quit` | Exit the interactive session |
|
||||
|
||||
## CLI Options
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ These commands are available within the interactive REPL.
|
|||
| `--allowed-tools` | - | array | - | **Deprecated.** Use the [Policy Engine](../reference/policy-engine.md) instead. Tools that are allowed to run without confirmation (comma-separated or multiple flags) |
|
||||
| `--extensions` | `-e` | array | - | List of extensions to use. If not provided, all extensions are enabled (comma-separated or multiple flags) |
|
||||
| `--list-extensions` | `-l` | boolean | - | List all available extensions and exit |
|
||||
| `--resume` | `-r` | string | - | Resume a previous session. Use `"latest"` for most recent or index number (e.g. `--resume 5`) |
|
||||
| `--resume` | `-r` | string | - | Resume a previous session. Use `"latest"` for most recent or index number (for example `--resume 5`) |
|
||||
| `--list-sessions` | - | boolean | - | List available sessions for the current project and exit |
|
||||
| `--delete-session` | - | string | - | Delete a session by index number (use `--list-sessions` to see available sessions) |
|
||||
| `--include-directories` | - | array | - | Additional directories to include in the workspace (comma-separated or multiple flags) |
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ skill. To use it, ask Gemini CLI to create a new skill for you.
|
|||
|
||||
Gemini CLI will then use the `skill-creator` to generate the skill:
|
||||
|
||||
1. Generate a new directory for your skill (e.g., `my-new-skill/`).
|
||||
1. Generate a new directory for your skill (for example, `my-new-skill/`).
|
||||
2. Create a `SKILL.md` file with the necessary YAML frontmatter (`name` and
|
||||
`description`).
|
||||
3. Create the standard resource directories: `scripts/`, `references/`, and
|
||||
|
|
@ -24,7 +24,7 @@ Gemini CLI will then use the `skill-creator` to generate the skill:
|
|||
|
||||
If you prefer to create skills manually:
|
||||
|
||||
1. **Create a directory** for your skill (e.g., `my-new-skill/`).
|
||||
1. **Create a directory** for your skill (for example, `my-new-skill/`).
|
||||
2. **Create a `SKILL.md` file** inside the new directory.
|
||||
|
||||
To add additional resources that support the skill, refer to the skill
|
||||
|
|
|
|||
|
|
@ -85,8 +85,8 @@ The model receives:
|
|||
**B. Using arguments in shell commands (inside `!{...}` blocks)**
|
||||
|
||||
When you use `{{args}}` inside a shell injection block (`!{...}`), the arguments
|
||||
are automatically **shell-escaped** before replacement. This allows you to
|
||||
safely pass arguments to shell commands, ensuring the resulting command is
|
||||
are automatically **shell-escaped** before replacement. This lets you safely
|
||||
pass arguments to shell commands, ensuring the resulting command is
|
||||
syntactically correct and secure while preventing command injection
|
||||
vulnerabilities.
|
||||
|
||||
|
|
@ -105,8 +105,8 @@ When you run `/grep-code It's complicated`:
|
|||
|
||||
1. The CLI sees `{{args}}` used both outside and inside `!{...}`.
|
||||
2. Outside: The first `{{args}}` is replaced raw with `It's complicated`.
|
||||
3. Inside: The second `{{args}}` is replaced with the escaped version (e.g., on
|
||||
Linux: `"It\'s complicated"`).
|
||||
3. Inside: The second `{{args}}` is replaced with the escaped version (for
|
||||
example, on Linux: `"It\'s complicated"`).
|
||||
4. The command executed is `grep -r "It's complicated" .`.
|
||||
5. The CLI prompts you to confirm this exact, secure command before execution.
|
||||
6. The final prompt is sent.
|
||||
|
|
@ -116,13 +116,13 @@ When you run `/grep-code It's complicated`:
|
|||
If your `prompt` does **not** contain the special placeholder `{{args}}`, the
|
||||
CLI uses a default behavior for handling arguments.
|
||||
|
||||
If you provide arguments to the command (e.g., `/mycommand arg1`), the CLI will
|
||||
append the full command you typed to the end of the prompt, separated by two
|
||||
newlines. This allows the model to see both the original instructions and the
|
||||
specific arguments you just provided.
|
||||
If you provide arguments to the command (for example, `/mycommand arg1`), the
|
||||
CLI will append the full command you typed to the end of the prompt, separated
|
||||
by two newlines. This allows the model to see both the original instructions and
|
||||
the specific arguments you just provided.
|
||||
|
||||
If you do **not** provide any arguments (e.g., `/mycommand`), the prompt is sent
|
||||
to the model exactly as it is, with nothing appended.
|
||||
If you do **not** provide any arguments (for example, `/mycommand`), the prompt
|
||||
is sent to the model exactly as it is, with nothing appended.
|
||||
|
||||
**Example (`changelog.toml`):**
|
||||
|
||||
|
|
@ -188,7 +188,7 @@ ensure that only intended commands can be run.
|
|||
dialog will appear showing the exact command(s) to be executed.
|
||||
5. **Execution and error reporting:** The command is executed. If the command
|
||||
fails, the output injected into the prompt will include the error messages
|
||||
(stderr) followed by a status line, e.g.,
|
||||
(stderr) followed by a status line, for example,
|
||||
`[Shell command exited with code 1]`. This helps the model understand the
|
||||
context of the failure.
|
||||
|
||||
|
|
@ -229,9 +229,10 @@ operate on specific files.
|
|||
|
||||
- **File injection**: `@{path/to/file.txt}` is replaced by the content of
|
||||
`file.txt`.
|
||||
- **Multimodal support**: If the path points to a supported image (e.g., PNG,
|
||||
JPEG), PDF, audio, or video file, it will be correctly encoded and injected as
|
||||
multimodal input. Other binary files are handled gracefully and skipped.
|
||||
- **Multimodal support**: If the path points to a supported image (for example,
|
||||
PNG, JPEG), PDF, audio, or video file, it will be correctly encoded and
|
||||
injected as multimodal input. Other binary files are handled gracefully and
|
||||
skipped.
|
||||
- **Directory listing**: `@{path/to/dir}` is traversed and each file present
|
||||
within the directory and all subdirectories is inserted into the prompt. This
|
||||
respects `.gitignore` and `.geminiignore` if enabled.
|
||||
|
|
|
|||
|
|
@ -175,8 +175,8 @@ the enterprise settings are always loaded with the highest precedence.
|
|||
**Example wrapper script:**
|
||||
|
||||
Administrators can create a script named `gemini` and place it in a directory
|
||||
that appears earlier in the user's `PATH` than the actual Gemini CLI binary
|
||||
(e.g., `/usr/local/bin/gemini`).
|
||||
that appears earlier in the user's `PATH` than the actual Gemini CLI binary (for
|
||||
example, `/usr/local/bin/gemini`).
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
|
@ -325,9 +325,9 @@ User. When it comes to the `mcpServers` object, these configurations are
|
|||
1. **Merging:** The lists of servers from all three levels are combined into a
|
||||
single list.
|
||||
2. **Precedence:** If a server with the **same name** is defined at multiple
|
||||
levels (e.g., a server named `corp-api` exists in both system and user
|
||||
settings), the definition from the highest-precedence level is used. The
|
||||
order of precedence is: **System > Workspace > User**.
|
||||
levels (for example, a server named `corp-api` exists in both system and
|
||||
user settings), the definition from the highest-precedence level is used.
|
||||
The order of precedence is: **System > Workspace > User**.
|
||||
|
||||
This means a user **cannot** override the definition of a server that is already
|
||||
defined in the system-level settings. However, they **can** add new servers with
|
||||
|
|
@ -343,8 +343,8 @@ canonical servers and adding their names to an allowlist.
|
|||
For even greater security, especially when dealing with third-party MCP servers,
|
||||
you can restrict which specific tools from a server are exposed to the model.
|
||||
This is done using the `includeTools` and `excludeTools` properties within a
|
||||
server's definition. This allows you to use a subset of tools from a server
|
||||
without allowing potentially dangerous ones.
|
||||
server's definition. This lets you use a subset of tools from a server without
|
||||
allowing potentially dangerous ones.
|
||||
|
||||
Following the principle of least privilege, it is highly recommended to use
|
||||
`includeTools` to create an allowlist of only the necessary tools.
|
||||
|
|
@ -481,9 +481,8 @@ an environment variable, but it can also be enforced for custom tools via the
|
|||
## Telemetry and auditing
|
||||
|
||||
For auditing and monitoring purposes, you can configure Gemini CLI to send
|
||||
telemetry data to a central location. This allows you to track tool usage and
|
||||
other events. For more information, see the
|
||||
[telemetry documentation](./telemetry.md).
|
||||
telemetry data to a central location. This lets you track tool usage and other
|
||||
events. For more information, see the [telemetry documentation](./telemetry.md).
|
||||
|
||||
**Example:** Enable telemetry and send it to a local OTLP collector. If
|
||||
`otlpEndpoint` is not specified, it defaults to `http://localhost:4317`.
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
# Ignoring files
|
||||
|
||||
This document provides an overview of the Gemini Ignore (`.geminiignore`)
|
||||
feature of the Gemini CLI.
|
||||
feature of Gemini CLI.
|
||||
|
||||
The Gemini CLI includes the ability to automatically ignore files, similar to
|
||||
Gemini CLI includes the ability to automatically ignore files, similar to
|
||||
`.gitignore` (used by Git) and `.aiexclude` (used by Gemini Code Assist). Adding
|
||||
paths to your `.geminiignore` file will exclude them from tools that support
|
||||
this feature, although they will still be visible to other services (such as
|
||||
|
|
|
|||
|
|
@ -1,26 +1,28 @@
|
|||
# Advanced Model Configuration
|
||||
|
||||
This guide details the Model Configuration system within the Gemini CLI.
|
||||
Designed for researchers, AI quality engineers, and advanced users, this system
|
||||
provides a rigorous framework for managing generative model hyperparameters and
|
||||
This guide details the Model Configuration system within Gemini CLI. Designed
|
||||
for researchers, AI quality engineers, and advanced users, this system provides
|
||||
a rigorous framework for managing generative model hyperparameters and
|
||||
behaviors.
|
||||
|
||||
> **Warning**: This is a power-user feature. Configuration values are passed
|
||||
<!-- prettier-ignore -->
|
||||
> [!WARNING]
|
||||
> This is a power-user feature. Configuration values are passed
|
||||
> directly to the model provider with minimal validation. Incorrect settings
|
||||
> (e.g., incompatible parameter combinations) may result in runtime errors from
|
||||
> the API.
|
||||
> (for example, incompatible parameter combinations) may result in runtime
|
||||
> errors from the API.
|
||||
|
||||
## 1. System Overview
|
||||
|
||||
The Model Configuration system (`ModelConfigService`) enables deterministic
|
||||
control over model generation. It decouples the requested model identifier
|
||||
(e.g., a CLI flag or agent request) from the underlying API configuration. This
|
||||
allows for:
|
||||
control over model generation. It decouples the requested model identifier (for
|
||||
example, a CLI flag or agent request) from the underlying API configuration.
|
||||
This allows for:
|
||||
|
||||
- **Precise Hyperparameter Tuning**: Direct control over `temperature`, `topP`,
|
||||
`thinkingBudget`, and other SDK-level parameters.
|
||||
- **Environment-Specific Behavior**: Distinct configurations for different
|
||||
operating contexts (e.g., testing vs. production).
|
||||
operating contexts (for example, testing vs. production).
|
||||
- **Agent-Scoped Customization**: Applying specific settings only when a
|
||||
particular agent is active.
|
||||
|
||||
|
|
@ -71,7 +73,7 @@ context. They are evaluated dynamically for each model request.
|
|||
specified `match` properties.
|
||||
- `model`: Matches the requested model name or alias.
|
||||
- `overrideScope`: Matches the distinct scope of the request (typically the
|
||||
agent name, e.g., `codebaseInvestigator`).
|
||||
agent name, for example, `codebaseInvestigator`).
|
||||
|
||||
**Example Override**:
|
||||
|
||||
|
|
@ -113,8 +115,8 @@ and `overrideScope`).
|
|||
1. **Filtering**: All matching overrides are identified.
|
||||
2. **Sorting**: Matches are prioritized by **specificity** (the number of
|
||||
matched keys in the `match` object).
|
||||
- Specific matches (e.g., `model` + `overrideScope`) override broad matches
|
||||
(e.g., `model` only).
|
||||
- Specific matches (for example, `model` + `overrideScope`) override broad
|
||||
matches (for example, `model` only).
|
||||
- Tie-breaking: If specificity is equal, the order of definition in the
|
||||
`overrides` array is preserved (last one wins).
|
||||
3. **Merging**: The configurations from the sorted overrides are merged
|
||||
|
|
@ -128,10 +130,10 @@ The configuration follows the `ModelConfigServiceConfig` interface.
|
|||
|
||||
Defines the actual parameters for the model.
|
||||
|
||||
| Property | Type | Description |
|
||||
| :---------------------- | :------- | :----------------------------------------------------------------- |
|
||||
| `model` | `string` | The identifier of the model to be called (e.g., `gemini-2.5-pro`). |
|
||||
| `generateContentConfig` | `object` | The configuration object passed to the `@google/genai` SDK. |
|
||||
| Property | Type | Description |
|
||||
| :---------------------- | :------- | :------------------------------------------------------------------------ |
|
||||
| `model` | `string` | The identifier of the model to be called (for example, `gemini-2.5-pro`). |
|
||||
| `generateContentConfig` | `object` | The configuration object passed to the `@google/genai` SDK. |
|
||||
|
||||
### `GenerateContentConfig` (Common Parameters)
|
||||
|
||||
|
|
@ -142,7 +144,7 @@ Directly maps to the SDK's `GenerateContentConfig`. Common parameters include:
|
|||
- **`topP`**: (`number`) Nucleus sampling probability.
|
||||
- **`maxOutputTokens`**: (`number`) Limit on generated response length.
|
||||
- **`thinkingConfig`**: (`object`) Configuration for models with reasoning
|
||||
capabilities (e.g., `thinkingBudget`, `includeThoughts`).
|
||||
capabilities (for example, `thinkingBudget`, `includeThoughts`).
|
||||
|
||||
## 5. Practical Examples
|
||||
|
||||
|
|
@ -170,7 +172,7 @@ configuration but enforcing zero temperature.
|
|||
### Agent-Specific Parameter Injection
|
||||
|
||||
Enforce extended thinking budgets for a specific agent without altering the
|
||||
global default, e.g. for the `codebaseInvestigator`.
|
||||
global default, for example for the `codebaseInvestigator`.
|
||||
|
||||
```json
|
||||
"modelConfigs": {
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ Model routing is managed by the `ModelAvailabilityService`, which monitors model
|
|||
health and automatically routes requests to available models based on defined
|
||||
policies.
|
||||
|
||||
1. **Model failure:** If the currently selected model fails (e.g., due to quota
|
||||
or server errors), the CLI will initiate the fallback process.
|
||||
1. **Model failure:** If the currently selected model fails (for example, due
|
||||
to quota or server errors), the CLI will initiate the fallback process.
|
||||
|
||||
2. **User consent:** Depending on the failure and the model's policy, the CLI
|
||||
may prompt you to switch to a fallback model (by default always prompts
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ Model steering is an experimental feature and is disabled by default. You can
|
|||
enable it using the `/settings` command or by updating your `settings.json`
|
||||
file.
|
||||
|
||||
1. Type `/settings` in the Gemini CLI.
|
||||
1. Type `/settings` in Gemini CLI.
|
||||
2. Search for **Model Steering**.
|
||||
3. Set the value to **true**.
|
||||
|
||||
|
|
|
|||
|
|
@ -314,8 +314,8 @@ Hooks such as `BeforeTool` or `AfterTool` can be configured to intercept the
|
|||
> [!WARNING] When hooks are triggered by **tool executions**, they do **not**
|
||||
> run when you manually toggle Plan Mode using the `/plan` command or the
|
||||
> `Shift+Tab` keyboard shortcut. If you need hooks to execute on mode changes,
|
||||
> ensure the transition is initiated by the agent (e.g., by asking "start a plan
|
||||
> for...").
|
||||
> ensure the transition is initiated by the agent (for example, by asking "start
|
||||
> a plan for...").
|
||||
|
||||
#### Example: Archive approved plans to GCS (`AfterTool`)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
# Sandboxing in the Gemini CLI
|
||||
# Sandboxing in Gemini CLI
|
||||
|
||||
This document provides a guide to sandboxing in the Gemini CLI, including
|
||||
This document provides a guide to sandboxing in Gemini CLI, including
|
||||
prerequisites, quickstart, and configuration.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before using sandboxing, you need to install and set up the Gemini CLI:
|
||||
Before using sandboxing, you need to install and set up Gemini CLI:
|
||||
|
||||
```bash
|
||||
npm install -g @google/gemini-cli
|
||||
|
|
@ -229,7 +229,7 @@ gemini -p "run the test suite"
|
|||
2. **Environment variable**:
|
||||
`GEMINI_SANDBOX=true|docker|podman|sandbox-exec|runsc|lxc`
|
||||
3. **Settings file**: `"sandbox": true` in the `tools` object of your
|
||||
`settings.json` file (e.g., `{"tools": {"sandbox": true}}`).
|
||||
`settings.json` file (for example, `{"tools": {"sandbox": true}}`).
|
||||
|
||||
### macOS Seatbelt profiles
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ via a `.gemini/.env` file. See
|
|||
- `GEMINI_SYSTEM_MD=/absolute/path/to/my-system.md`
|
||||
- Relative paths are supported and resolved from the current working
|
||||
directory.
|
||||
- Tilde expansion is supported (e.g., `~/my-system.md`).
|
||||
- Tilde expansion is supported (for example, `~/my-system.md`).
|
||||
|
||||
- Disable the override (use built‑in prompt):
|
||||
- `GEMINI_SYSTEM_MD=false` or `GEMINI_SYSTEM_MD=0` or unset the variable.
|
||||
|
|
@ -70,7 +70,7 @@ dynamically include built-in content:
|
|||
- `${AvailableTools}`: Injects a bulleted list of all currently enabled tool
|
||||
names.
|
||||
- Tool Name Variables: Injects the actual name of a tool using the pattern:
|
||||
`${toolName}_ToolName` (e.g., `${write_file_ToolName}`,
|
||||
`${toolName}_ToolName` (for example, `${write_file_ToolName}`,
|
||||
`${run_shell_command_ToolName}`).
|
||||
|
||||
This pattern is generated dynamically for all available tools.
|
||||
|
|
|
|||
|
|
@ -117,8 +117,8 @@ least `background.primary`, `text.primary`, `text.secondary`, and the various
|
|||
accent colors via `text.link`, `text.accent`, and `status` to ensure a cohesive
|
||||
UI.
|
||||
|
||||
You can use either hex codes (e.g., `#FF0000`) **or** standard CSS color names
|
||||
(e.g., `coral`, `teal`, `blue`) for any color value. See
|
||||
You can use either hex codes (for example, `#FF0000`) **or** standard CSS color
|
||||
names (for example, `coral`, `teal`, `blue`) for any color value. See
|
||||
[CSS color names](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#color_keywords)
|
||||
for a full list of supported names.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Trusted Folders
|
||||
|
||||
The Trusted Folders feature is a security setting that gives you control over
|
||||
which projects can use the full capabilities of the Gemini CLI. It prevents
|
||||
which projects can use the full capabilities of Gemini CLI. It prevents
|
||||
potentially malicious code from running by asking you to approve a folder before
|
||||
the CLI loads any project-specific configurations from it.
|
||||
|
||||
|
|
@ -24,12 +24,12 @@ Add the following to your user `settings.json` file:
|
|||
|
||||
## How it works: The trust dialog
|
||||
|
||||
Once the feature is enabled, the first time you run the Gemini CLI from a
|
||||
folder, a dialog will automatically appear, prompting you to make a choice:
|
||||
Once the feature is enabled, the first time you run Gemini CLI from a folder, a
|
||||
dialog will automatically appear, prompting you to make a choice:
|
||||
|
||||
- **Trust folder**: Grants full trust to the current folder (e.g.,
|
||||
- **Trust folder**: Grants full trust to the current folder (for example,
|
||||
`my-project`).
|
||||
- **Trust parent folder**: Grants trust to the parent directory (e.g.,
|
||||
- **Trust parent folder**: Grants trust to the parent directory (for example,
|
||||
`safe-projects`), which automatically trusts all of its subdirectories as
|
||||
well. This is useful if you keep all your safe projects in one place.
|
||||
- **Don't trust**: Marks the folder as untrusted. The CLI will operate in a
|
||||
|
|
@ -40,9 +40,9 @@ will only be asked once per folder.
|
|||
|
||||
## Understanding folder contents: The discovery phase
|
||||
|
||||
Before you make a choice, the Gemini CLI performs a **discovery phase** to scan
|
||||
the folder for potential configurations. This information is displayed in the
|
||||
trust dialog to help you make an informed decision.
|
||||
Before you make a choice, Gemini CLI performs a **discovery phase** to scan the
|
||||
folder for potential configurations. This information is displayed in the trust
|
||||
dialog to help you make an informed decision.
|
||||
|
||||
The discovery UI lists the following categories of items found in the project:
|
||||
|
||||
|
|
@ -63,16 +63,16 @@ attention:
|
|||
settings, such as auto-approving certain tools or disabling the security
|
||||
sandbox.
|
||||
- **Discovery Errors**: If the CLI encounters issues while scanning the folder
|
||||
(e.g., a malformed `settings.json` file), these errors will be displayed
|
||||
prominently.
|
||||
(for example, a malformed `settings.json` file), these errors will be
|
||||
displayed prominently.
|
||||
|
||||
By reviewing these details, you can ensure that you only grant trust to projects
|
||||
that you know are safe.
|
||||
|
||||
## Why trust matters: The impact of an untrusted workspace
|
||||
|
||||
When a folder is **untrusted**, the Gemini CLI runs in a restricted "safe mode"
|
||||
to protect you. In this mode, the following features are disabled:
|
||||
When a folder is **untrusted**, Gemini CLI runs in a restricted "safe mode" to
|
||||
protect you. In this mode, the following features are disabled:
|
||||
|
||||
1. **Workspace settings are ignored**: The CLI will **not** load the
|
||||
`.gemini/settings.json` file from the project. This prevents the loading of
|
||||
|
|
@ -97,8 +97,8 @@ to protect you. In this mode, the following features are disabled:
|
|||
commands from .toml files, including both project-specific and global user
|
||||
commands.
|
||||
|
||||
Granting trust to a folder unlocks the full functionality of the Gemini CLI for
|
||||
that workspace.
|
||||
Granting trust to a folder unlocks the full functionality of Gemini CLI for that
|
||||
workspace.
|
||||
|
||||
## Managing your trust settings
|
||||
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ The agent will:
|
|||
## Troubleshooting
|
||||
|
||||
- **Server won't start?** Try running the docker command manually in your
|
||||
terminal to see if it prints an error (e.g., "image not found").
|
||||
terminal to see if it prints an error (for example, "image not found").
|
||||
- **Tools not found?** Run `/mcp reload` to force the CLI to re-query the server
|
||||
for its capabilities.
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ loaded into every conversation.
|
|||
|
||||
### Scenario: Using the hierarchy
|
||||
|
||||
Context is loaded hierarchically. This allows you to have general rules for
|
||||
Context is loaded hierarchically. This lets you have general rules for
|
||||
everything and specific rules for sub-projects.
|
||||
|
||||
1. **Global:** `~/.gemini/GEMINI.md` (Rules for _every_ project you work on).
|
||||
|
|
|
|||
|
|
@ -79,8 +79,8 @@ each step with higher confidence and fewer errors.
|
|||
- **Steer early:** Providing feedback during the research phase is more
|
||||
efficient than waiting for the final plan to be drafted.
|
||||
- **Use for context:** Steering is a great way to provide knowledge that might
|
||||
not be obvious from reading the code (e.g., "We are planning to deprecate this
|
||||
module next month").
|
||||
not be obvious from reading the code (for example, "We are planning to
|
||||
deprecate this module next month").
|
||||
|
||||
## Next steps
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ browser.
|
|||
|
||||
This opens a searchable list of all your past sessions. You'll see:
|
||||
|
||||
- A timestamp (e.g., "2 hours ago").
|
||||
- A timestamp (for example, "2 hours ago").
|
||||
- The first user message (helping you identify the topic).
|
||||
- The number of turns in the conversation.
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ watchers.
|
|||
|
||||
**Prompt:** `Start the React dev server in the background.`
|
||||
|
||||
Gemini will run the command (e.g., `npm run dev`) and detach it.
|
||||
Gemini will run the command (for example, `npm run dev`) and detach it.
|
||||
|
||||
### Scenario: Viewing active shells
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ progress with the todo list.
|
|||
## Prerequisites
|
||||
|
||||
- Gemini CLI installed and authenticated.
|
||||
- A complex task in mind (e.g., a multi-file refactor or new feature).
|
||||
- A complex task in mind (for example, a multi-file refactor or new feature).
|
||||
|
||||
## Why use task planning?
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ Tell the agent to proceed.
|
|||
As the agent works, you'll see the todo list update in real-time above the input
|
||||
box.
|
||||
|
||||
- **Current focus:** The active task is highlighted (e.g.,
|
||||
- **Current focus:** The active task is highlighted (for example,
|
||||
`[IN_PROGRESS] Create tsconfig.json`).
|
||||
- **Progress:** Completed tasks are marked as done.
|
||||
|
||||
|
|
@ -90,4 +90,4 @@ living document, not a static text block.
|
|||
- See the [Todo tool reference](../../tools/todos.md) for technical schema
|
||||
details.
|
||||
- Learn about [Memory management](memory-management.md) to persist planning
|
||||
preferences (e.g., "Always create a test plan first").
|
||||
preferences (for example, "Always create a test plan first").
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ While the `packages/cli` portion of Gemini CLI provides the user interface,
|
|||
potentially incorporating conversation history, tool definitions, and
|
||||
instructional context from `GEMINI.md` files.
|
||||
- **Tool management & orchestration:**
|
||||
- Registering available tools (e.g., file system tools, shell command
|
||||
- Registering available tools (for example, file system tools, shell command
|
||||
execution).
|
||||
- Interpreting tool use requests from the Gemini model.
|
||||
- Executing the requested tools with the provided arguments.
|
||||
|
|
@ -45,7 +45,7 @@ The core plays a vital role in security:
|
|||
|
||||
- **API key management:** It handles the `GEMINI_API_KEY` and ensures it's used
|
||||
securely when communicating with the Gemini API.
|
||||
- **Tool execution:** When tools interact with the local system (e.g.,
|
||||
- **Tool execution:** When tools interact with the local system (for example,
|
||||
`run_shell_command`), the core (and its underlying tool implementations) must
|
||||
do so with appropriate caution, often involving sandboxing mechanisms to
|
||||
prevent unintended modifications.
|
||||
|
|
@ -70,7 +70,7 @@ to use the CLI even if the default "pro" model is rate-limited.
|
|||
|
||||
If you are using the default "pro" model and the CLI detects that you are being
|
||||
rate-limited, it automatically switches to the "flash" model for the current
|
||||
session. This allows you to continue working without interruption.
|
||||
session. This lets you continue working without interruption.
|
||||
|
||||
Internal utility calls that use `gemini-2.5-flash-lite` (for example, prompt
|
||||
completion and classification) silently fall back to `gemini-2.5-flash` and
|
||||
|
|
@ -90,9 +90,8 @@ in a hierarchical manner, starting from the current working directory and moving
|
|||
up to the project root and the user's home directory. It also searches in
|
||||
subdirectories.
|
||||
|
||||
This allows you to have global, project-level, and component-level context
|
||||
files, which are all combined to provide the model with the most relevant
|
||||
information.
|
||||
This lets you have global, project-level, and component-level context files,
|
||||
which are all combined to provide the model with the most relevant information.
|
||||
|
||||
You can use the [`/memory` command](../reference/commands.md) to `show`, `add`,
|
||||
and `refresh` the content of loaded `GEMINI.md` files.
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ Download complete.
|
|||
$ ./lit.lit.macos_arm64 pull gemma3-1b-gpu-custom
|
||||
|
||||
[Legal] The model you are about to download is governed by
|
||||
the Gemma Terms of Use and Prohibited Use Policy. Please review these terms and ensure you agree before continuing.
|
||||
the Gemma Terms of Use and Prohibited Use Policy. Review these terms and ensure you agree before continuing.
|
||||
|
||||
Full Terms: https://ai.google.dev/gemma/terms
|
||||
Prohibited Use Policy: https://ai.google.dev/gemma/prohibited_use_policy
|
||||
|
|
|
|||
|
|
@ -430,7 +430,7 @@ both behind auth.
|
|||
|
||||
## Managing Subagents
|
||||
|
||||
Users can manage subagents using the following commands within the Gemini CLI:
|
||||
Users can manage subagents using the following commands within Gemini CLI:
|
||||
|
||||
- `/agents list`: Displays all available local and remote subagents.
|
||||
- `/agents reload`: Reloads the agent registry. Use this after adding or
|
||||
|
|
|
|||
|
|
@ -358,7 +358,7 @@ it yourself; just report it.
|
|||
| `kind` | string | No | `local` (default) or `remote`. |
|
||||
| `tools` | array | No | List of tool names this agent can use. Supports wildcards: `*` (all tools), `mcp_*` (all MCP tools), `mcp_server_*` (all tools from a server). **If omitted, it inherits all tools from the parent session.** |
|
||||
| `mcpServers` | object | No | Configuration for inline Model Context Protocol (MCP) servers isolated to this specific agent. |
|
||||
| `model` | string | No | Specific model to use (e.g., `gemini-3-preview`). Defaults to `inherit` (uses the main session model). |
|
||||
| `model` | string | No | Specific model to use (for example, `gemini-3-preview`). Defaults to `inherit` (uses the main session model). |
|
||||
| `temperature` | number | No | Model temperature (0.0 - 2.0). Defaults to `1`. |
|
||||
| `max_turns` | number | No | Maximum number of conversation turns allowed for this agent before it must return. Defaults to `30`. |
|
||||
| `timeout_mins` | number | No | Maximum execution time in minutes. Defaults to `10`. |
|
||||
|
|
@ -410,8 +410,8 @@ With this feature, you can:
|
|||
### Configuring isolated tools and servers
|
||||
|
||||
You can configure tool isolation for a subagent by updating its markdown
|
||||
frontmatter. This allows you to explicitly state which tools the subagent can
|
||||
use, rather than relying on the global registry.
|
||||
frontmatter. This lets you explicitly state which tools the subagent can use,
|
||||
rather than relying on the global registry.
|
||||
|
||||
Add an `mcpServers` object to define inline MCP servers that are unique to the
|
||||
agent.
|
||||
|
|
|
|||
|
|
@ -117,8 +117,9 @@ for your users.
|
|||
Follow [Semantic Versioning (SemVer)](https://semver.org/) to communicate
|
||||
changes clearly.
|
||||
|
||||
- **Major:** Breaking changes (e.g., renaming tools or changing arguments).
|
||||
- **Minor:** New features (e.g., adding new tools or commands).
|
||||
- **Major:** Breaking changes (for example, renaming tools or changing
|
||||
arguments).
|
||||
- **Minor:** New features (for example, adding new tools or commands).
|
||||
- **Patch:** Bug fixes and performance improvements.
|
||||
|
||||
### Release channels
|
||||
|
|
@ -182,7 +183,7 @@ If your tools aren't working as expected:
|
|||
If a custom command isn't responding:
|
||||
|
||||
- **Check precedence:** Remember that user and project commands take precedence
|
||||
over extension commands. Use the prefixed name (e.g., `/extension.command`) to
|
||||
verify the extension's version.
|
||||
over extension commands. Use the prefixed name (for example,
|
||||
`/extension.command`) to verify the extension's version.
|
||||
- **Help command:** Run `/help` to see a list of all available commands and
|
||||
their sources.
|
||||
|
|
|
|||
|
|
@ -88,12 +88,12 @@ gemini extensions new <path> [template]
|
|||
```
|
||||
|
||||
- `<path>`: The directory to create.
|
||||
- `[template]`: The template to use (e.g., `mcp-server`, `context`,
|
||||
- `[template]`: The template to use (for example, `mcp-server`, `context`,
|
||||
`custom-commands`).
|
||||
|
||||
### Link a local extension
|
||||
|
||||
Create a symbolic link between your development directory and the Gemini CLI
|
||||
Create a symbolic link between your development directory and Gemini CLI
|
||||
extensions directory. This lets you test changes immediately without
|
||||
reinstalling.
|
||||
|
||||
|
|
@ -244,7 +244,7 @@ agent definition files (`.md`) to an `agents/` directory in your extension root.
|
|||
|
||||
### <a id="policy-engine"></a>Policy Engine
|
||||
|
||||
Extensions can contribute policy rules and safety checkers to the Gemini CLI
|
||||
Extensions can contribute policy rules and safety checkers to Gemini CLI
|
||||
[Policy Engine](../reference/policy-engine.md). These rules are defined in
|
||||
`.toml` files and take effect when the extension is activated.
|
||||
|
||||
|
|
@ -324,13 +324,14 @@ defined in the `themes` array in `gemini-extension.json`.
|
|||
Custom themes provided by extensions can be selected using the `/theme` command
|
||||
or by setting the `ui.theme` property in your `settings.json` file. Note that
|
||||
when referring to a theme from an extension, the extension name is appended to
|
||||
the theme name in parentheses, e.g., `shades-of-green (my-green-extension)`.
|
||||
the theme name in parentheses, for example,
|
||||
`shades-of-green (my-green-extension)`.
|
||||
|
||||
### Conflict resolution
|
||||
|
||||
Extension commands have the lowest precedence. If an extension command name
|
||||
conflicts with a user or project command, the extension command is prefixed with
|
||||
the extension name (e.g., `/gcp.deploy`) using a dot separator.
|
||||
the extension name (for example, `/gcp.deploy`) using a dot separator.
|
||||
|
||||
## Variables
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ Use these values for the placeholders:
|
|||
**Examples:**
|
||||
|
||||
- `darwin.arm64.my-tool.tar.gz` (specific to Apple Silicon Macs)
|
||||
- `darwin.my-tool.tar.gz` (fallback for all Macs, e.g. Intel)
|
||||
- `darwin.my-tool.tar.gz` (fallback for all Macs, for example Intel)
|
||||
- `linux.x64.my-tool.tar.gz`
|
||||
- `win32.my-tool.zip`
|
||||
|
||||
|
|
@ -155,9 +155,10 @@ jobs:
|
|||
|
||||
## Migrating an Extension Repository
|
||||
|
||||
If you need to move your extension to a new repository (e.g., from a personal
|
||||
account to an organization) or rename it, you can use the `migratedTo` property
|
||||
in your `gemini-extension.json` file to seamlessly transition your users.
|
||||
If you need to move your extension to a new repository (for example, from a
|
||||
personal account to an organization) or rename it, you can use the `migratedTo`
|
||||
property in your `gemini-extension.json` file to seamlessly transition your
|
||||
users.
|
||||
|
||||
1. **Create the new repository**: Setup your extension in its new location.
|
||||
2. **Update the old repository**: In your original repository, update the
|
||||
|
|
@ -173,7 +174,7 @@ in your `gemini-extension.json` file to seamlessly transition your users.
|
|||
```
|
||||
3. **Release the update**: Publish this new version in your old repository.
|
||||
|
||||
When users check for updates, the Gemini CLI will detect the `migratedTo` field,
|
||||
When users check for updates, Gemini CLI will detect the `migratedTo` field,
|
||||
verify that the new repository contains a valid extension update, and
|
||||
automatically update their local installation to track the new source and name
|
||||
moving forward. All extension settings will automatically migrate to the new
|
||||
|
|
|
|||
|
|
@ -7,22 +7,22 @@ linking it for local development.
|
|||
|
||||
## Prerequisites
|
||||
|
||||
Before you start, ensure you have the Gemini CLI installed and a basic
|
||||
understanding of Node.js.
|
||||
Before you start, ensure you have Gemini CLI installed and a basic understanding
|
||||
of Node.js.
|
||||
|
||||
## Extension features
|
||||
|
||||
Extensions offer several ways to customize Gemini CLI. Use this table to decide
|
||||
which features your extension needs.
|
||||
|
||||
| Feature | What it is | When to use it | Invoked by |
|
||||
| :------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------- |
|
||||
| **[MCP server](reference.md#mcp-servers)** | A standard way to expose new tools and data sources to the model. | Use this when you want the model to be able to _do_ new things, like fetching data from an internal API, querying a database, or controlling a local application. We also support MCP resources (which can replace custom commands) and system instructions (which can replace custom context) | Model |
|
||||
| **[Custom commands](../cli/custom-commands.md)** | A shortcut (like `/my-cmd`) that executes a pre-defined prompt or shell command. | Use this for repetitive tasks or to save long, complex prompts that you use frequently. Great for automation. | User |
|
||||
| **[Context file (`GEMINI.md`)](reference.md#contextfilename)** | A markdown file containing instructions that are loaded into the model's context at the start of every session. | Use this to define the "personality" of your extension, set coding standards, or provide essential knowledge that the model should always have. | CLI provides to model |
|
||||
| **[Agent skills](../cli/skills.md)** | A specialized set of instructions and workflows that the model activates only when needed. | Use this for complex, occasional tasks (like "create a PR" or "audit security") to avoid cluttering the main context window when the skill isn't being used. | Model |
|
||||
| **[Hooks](../hooks/index.md)** | A way to intercept and customize the CLI's behavior at specific lifecycle events (e.g., before/after a tool call). | Use this when you want to automate actions based on what the model is doing, like validating tool arguments, logging activity, or modifying the model's input/output. | CLI |
|
||||
| **[Custom themes](reference.md#themes)** | A set of color definitions to personalize the CLI UI. | Use this to provide a unique visual identity for your extension or to offer specialized high-contrast or thematic color schemes. | User (via /theme) |
|
||||
| Feature | What it is | When to use it | Invoked by |
|
||||
| :------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------- |
|
||||
| **[MCP server](reference.md#mcp-servers)** | A standard way to expose new tools and data sources to the model. | Use this when you want the model to be able to _do_ new things, like fetching data from an internal API, querying a database, or controlling a local application. We also support MCP resources (which can replace custom commands) and system instructions (which can replace custom context) | Model |
|
||||
| **[Custom commands](../cli/custom-commands.md)** | A shortcut (like `/my-cmd`) that executes a pre-defined prompt or shell command. | Use this for repetitive tasks or to save long, complex prompts that you use frequently. Great for automation. | User |
|
||||
| **[Context file (`GEMINI.md`)](reference.md#contextfilename)** | A markdown file containing instructions that are loaded into the model's context at the start of every session. | Use this to define the "personality" of your extension, set coding standards, or provide essential knowledge that the model should always have. | CLI provides to model |
|
||||
| **[Agent skills](../cli/skills.md)** | A specialized set of instructions and workflows that the model activates only when needed. | Use this for complex, occasional tasks (like "create a PR" or "audit security") to avoid cluttering the main context window when the skill isn't being used. | Model |
|
||||
| **[Hooks](../hooks/index.md)** | A way to intercept and customize the CLI's behavior at specific lifecycle events (for example, before/after a tool call). | Use this when you want to automate actions based on what the model is doing, like validating tool arguments, logging activity, or modifying the model's input/output. | CLI |
|
||||
| **[Custom themes](reference.md#themes)** | A set of color definitions to personalize the CLI UI. | Use this to provide a unique visual identity for your extension or to offer specialized high-contrast or thematic color schemes. | User (via /theme) |
|
||||
|
||||
## Step 1: Create a new extension
|
||||
|
||||
|
|
@ -172,7 +172,7 @@ Link your extension to your Gemini CLI installation for local development.
|
|||
|
||||
2. **Link the extension:**
|
||||
|
||||
The `link` command creates a symbolic link from the Gemini CLI extensions
|
||||
The `link` command creates a symbolic link from Gemini CLI extensions
|
||||
directory to your development directory. Changes you make are reflected
|
||||
immediately.
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ or fallback to Gemini 2.5 Pro.
|
|||
> [!NOTE]
|
||||
> The **Keep trying** option uses exponential backoff, in which Gemini
|
||||
> CLI waits longer between each retry, when the system is busy. If the retry
|
||||
> doesn't happen immediately, please wait a few minutes for the request to
|
||||
> doesn't happen immediately, wait a few minutes for the request to
|
||||
> process.
|
||||
|
||||
### Model selection and routing types
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Get started with Gemini CLI
|
||||
|
||||
Welcome to Gemini CLI! This guide will help you install, configure, and start
|
||||
using the Gemini CLI to enhance your workflow right from your terminal.
|
||||
using Gemini CLI to enhance your workflow right from your terminal.
|
||||
|
||||
## Quickstart: Install, authenticate, configure, and use Gemini CLI
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ colors. After analyzing the source code, here's how it works:
|
|||
getters. The `red` getter adds the red color code, and the `bold` getter adds
|
||||
the bold code.
|
||||
|
||||
- **Output generation:** When the chain is treated as a string (e.g., in
|
||||
- **Output generation:** When the chain is treated as a string (for example, in
|
||||
`console.log`), a final `toString()` method is called. This method joins all
|
||||
the stored ANSI codes, wraps them around the input string ('Hello'), and adds
|
||||
a reset code at the end. This produces the final, styled string that the
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ chmod +x .gemini/hooks/*.js
|
|||
```
|
||||
|
||||
**Windows Note**: On Windows, PowerShell scripts (`.ps1`) don't use `chmod`, but
|
||||
you may need to ensure your execution policy allows them to run (e.g.,
|
||||
you may need to ensure your execution policy allows them to run (for example,
|
||||
`Set-ExecutionPolicy RemoteSigned -Scope CurrentUser`).
|
||||
|
||||
### Version control
|
||||
|
|
@ -401,12 +401,12 @@ git add .gemini/settings.json
|
|||
Understanding where hooks come from and what they can do is critical for secure
|
||||
usage.
|
||||
|
||||
| Hook Source | Description |
|
||||
| :---------------------------- | :------------------------------------------------------------------------------------------------------------------------- |
|
||||
| **System** | Configured by system administrators (e.g., `/etc/gemini-cli/settings.json`, `/Library/...`). Assumed to be the **safest**. |
|
||||
| **User** (`~/.gemini/...`) | Configured by you. You are responsible for ensuring they are safe. |
|
||||
| **Extensions** | You explicitly approve and install these. Security depends on the extension source (integrity). |
|
||||
| **Project** (`./.gemini/...`) | **Untrusted by default.** Safest in trusted internal repos; higher risk in third-party/public repos. |
|
||||
| Hook Source | Description |
|
||||
| :---------------------------- | :-------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| **System** | Configured by system administrators (for example, `/etc/gemini-cli/settings.json`, `/Library/...`). Assumed to be the **safest**. |
|
||||
| **User** (`~/.gemini/...`) | Configured by you. You are responsible for ensuring they are safe. |
|
||||
| **Extensions** | You explicitly approve and install these. Security depends on the extension source (integrity). |
|
||||
| **Project** (`./.gemini/...`) | **Untrusted by default.** Safest in trusted internal repos; higher risk in third-party/public repos. |
|
||||
|
||||
#### Project Hook Security
|
||||
|
||||
|
|
@ -422,9 +422,10 @@ When you open a project with hooks defined in `.gemini/settings.json`:
|
|||
5. **Trust**: The hook is marked as "trusted" for this project.
|
||||
|
||||
> **Modification detection**: If the `command` string of a project hook is
|
||||
> changed (e.g., by a `git pull`), its identity changes. Gemini CLI will treat
|
||||
> it as a **new, untrusted hook** and warn you again. This prevents malicious
|
||||
> actors from silently swapping a verified command for a malicious one.
|
||||
> changed (for example, by a `git pull`), its identity changes. Gemini CLI will
|
||||
> treat it as a **new, untrusted hook** and warn you again. This prevents
|
||||
> malicious actors from silently swapping a verified command for a malicious
|
||||
> one.
|
||||
|
||||
### Risks
|
||||
|
||||
|
|
@ -441,17 +442,17 @@ When you open a project with hooks defined in `.gemini/settings.json`:
|
|||
**Verify the source** of any project hooks or extensions before enabling them.
|
||||
|
||||
- For open-source projects, a quick review of the hook scripts is recommended.
|
||||
- For extensions, ensure you trust the author or publisher (e.g., verified
|
||||
publishers, well-known community members).
|
||||
- For extensions, ensure you trust the author or publisher (for example,
|
||||
verified publishers, well-known community members).
|
||||
- Be cautious with obfuscated scripts or compiled binaries from unknown sources.
|
||||
|
||||
#### Sanitize environment
|
||||
|
||||
Hooks inherit the environment of the Gemini CLI process, which may include
|
||||
sensitive API keys. Gemini CLI provides a
|
||||
Hooks inherit the environment of Gemini CLI process, which may include sensitive
|
||||
API keys. Gemini CLI provides a
|
||||
[redaction system](../reference/configuration.md#environment-variable-redaction)
|
||||
that automatically filters variables matching sensitive patterns (e.g., `KEY`,
|
||||
`TOKEN`).
|
||||
that automatically filters variables matching sensitive patterns (for example,
|
||||
`KEY`, `TOKEN`).
|
||||
|
||||
> **Disabled by Default**: Environment redaction is currently **OFF by
|
||||
> default**. We strongly recommend enabling it if you are running third-party
|
||||
|
|
@ -511,7 +512,7 @@ chmod +x .gemini/hooks/my-hook.sh
|
|||
```
|
||||
|
||||
**Windows Note**: On Windows, ensure your execution policy allows running
|
||||
scripts (e.g., `Get-ExecutionPolicy`).
|
||||
scripts (for example, `Get-ExecutionPolicy`).
|
||||
|
||||
**Verify script path:** Ensure the path in `settings.json` resolves correctly.
|
||||
|
||||
|
|
|
|||
|
|
@ -63,9 +63,9 @@ Hooks communicate via `stdin` (Input) and `stdout` (Output).
|
|||
2. **Pollution = Failure**: If `stdout` contains non-JSON text, parsing will
|
||||
fail. The CLI will default to "Allow" and treat the entire output as a
|
||||
`systemMessage`.
|
||||
3. **Debug via Stderr**: Use `stderr` for **all** logging and debugging (e.g.,
|
||||
`echo "debug" >&2`). Gemini CLI captures `stderr` but never attempts to parse
|
||||
it as JSON.
|
||||
3. **Debug via Stderr**: Use `stderr` for **all** logging and debugging (for
|
||||
example, `echo "debug" >&2`). Gemini CLI captures `stderr` but never attempts
|
||||
to parse it as JSON.
|
||||
|
||||
#### Exit codes
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ execution:
|
|||
|
||||
| Exit Code | Label | Behavioral Impact |
|
||||
| --------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| **0** | **Success** | The `stdout` is parsed as JSON. **Preferred code** for all logic, including intentional blocks (e.g., `{"decision": "deny"}`). |
|
||||
| **0** | **Success** | The `stdout` is parsed as JSON. **Preferred code** for all logic, including intentional blocks (for example, `{"decision": "deny"}`). |
|
||||
| **2** | **System Block** | **Critical Block**. The target action (tool, turn, or stop) is aborted. `stderr` is used as the rejection reason. High severity; used for security stops or script failures. |
|
||||
| **Other** | **Warning** | Non-fatal failure. A warning is shown, but the interaction proceeds using original parameters. |
|
||||
|
||||
|
|
@ -84,8 +84,9 @@ You can filter which specific tools or triggers fire your hook using the
|
|||
`matcher` field.
|
||||
|
||||
- **Tool events** (`BeforeTool`, `AfterTool`): Matchers are **Regular
|
||||
Expressions**. (e.g., `"write_.*"`).
|
||||
- **Lifecycle events**: Matchers are **Exact Strings**. (e.g., `"startup"`).
|
||||
Expressions**. (for example, `"write_.*"`).
|
||||
- **Lifecycle events**: Matchers are **Exact Strings**. (for example,
|
||||
`"startup"`).
|
||||
- **Wildcards**: `"*"` or `""` (empty string) matches all occurrences.
|
||||
|
||||
## Configuration
|
||||
|
|
@ -151,8 +152,8 @@ Hooks are executed with a sanitized environment.
|
|||
|
||||
**Project-level hooks** are particularly risky when opening untrusted projects.
|
||||
Gemini CLI **fingerprints** project hooks. If a hook's name or command changes
|
||||
(e.g., via `git pull`), it is treated as a **new, untrusted hook** and you will
|
||||
be warned before it executes.
|
||||
(for example, via `git pull`), it is treated as a **new, untrusted hook** and
|
||||
you will be warned before it executes.
|
||||
|
||||
See [Security Considerations](../hooks/best-practices.md#using-hooks-securely)
|
||||
for a detailed threat model.
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ including JSON schemas and API details.
|
|||
|
||||
## Configuration schema
|
||||
|
||||
Hooks are defined in `settings.json` within the `hooks` object. Each event
|
||||
(e.g., `BeforeTool`) contains an array of **hook definitions**.
|
||||
Hooks are defined in `settings.json` within the `hooks` object. Each event (for
|
||||
example, `BeforeTool`) contains an array of **hook definitions**.
|
||||
|
||||
### Hook definition
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ All hooks receive these common fields via `stdin`:
|
|||
"session_id": string, // Unique ID for the current session
|
||||
"transcript_path": string, // Absolute path to session transcript JSON
|
||||
"cwd": string, // Current working directory
|
||||
"hook_event_name": string, // The firing event (e.g. "BeforeTool")
|
||||
"hook_event_name": string, // The firing event (for example "BeforeTool")
|
||||
"timestamp": string // ISO 8601 execution time
|
||||
}
|
||||
```
|
||||
|
|
@ -81,12 +81,12 @@ Most hooks support these fields in their `stdout` JSON:
|
|||
For `BeforeTool` and `AfterTool` events, the `matcher` field in your settings is
|
||||
compared against the name of the tool being executed.
|
||||
|
||||
- **Built-in Tools**: You can match any built-in tool (e.g., `read_file`,
|
||||
- **Built-in Tools**: You can match any built-in tool (for example, `read_file`,
|
||||
`run_shell_command`). See the [Tools Reference](../reference/tools) for a full
|
||||
list of available tool names.
|
||||
- **MCP Tools**: Tools from MCP servers follow the naming pattern
|
||||
`mcp_<server_name>_<tool_name>`.
|
||||
- **Regex Support**: Matchers support regular expressions (e.g.,
|
||||
- **Regex Support**: Matchers support regular expressions (for example,
|
||||
`matcher: "read_.*"` matches all file reading tools).
|
||||
|
||||
### `BeforeTool`
|
||||
|
|
@ -194,7 +194,7 @@ request format.
|
|||
(generation params).
|
||||
- **Relevant Output Fields**:
|
||||
- `hookSpecificOutput.llm_request`: An object that **overrides** parts of the
|
||||
outgoing request (e.g., changing models or temperature).
|
||||
outgoing request (for example, changing models or temperature).
|
||||
- `hookSpecificOutput.llm_response`: A **Synthetic Response** object. If
|
||||
provided, the CLI skips the LLM call entirely and uses this as the response.
|
||||
- `decision`: Set to `"deny"` to block the request and abort the turn.
|
||||
|
|
@ -271,14 +271,14 @@ telemetry.
|
|||
|
||||
### `Notification`
|
||||
|
||||
Fires when the CLI emits a system alert (e.g., Tool Permissions). Used for
|
||||
external logging or cross-platform alerts.
|
||||
Fires when the CLI emits a system alert (for example, Tool Permissions). Used
|
||||
for external logging or cross-platform alerts.
|
||||
|
||||
- **Input Fields**:
|
||||
- `notification_type`: (`"ToolPermission"`)
|
||||
- `message`: Summary of the alert.
|
||||
- `details`: JSON object with alert-specific metadata (e.g., tool name, file
|
||||
path).
|
||||
- `details`: JSON object with alert-specific metadata (for example, tool name,
|
||||
file path).
|
||||
- **Relevant Output Fields**:
|
||||
- `systemMessage`: Displayed alongside the system alert.
|
||||
- **Observability Only**: This hook **cannot** block alerts or grant permissions
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ Protocol (MCP)**.
|
|||
|
||||
- **Protocol:** The server must be a valid MCP server. We recommend using an
|
||||
existing MCP SDK for your language of choice if available.
|
||||
- **Endpoint:** The server should expose a single endpoint (e.g., `/mcp`) for
|
||||
all MCP communication.
|
||||
- **Port:** The server **MUST** listen on a dynamically assigned port (i.e.,
|
||||
- **Endpoint:** The server should expose a single endpoint (for example, `/mcp`)
|
||||
for all MCP communication.
|
||||
- **Port:** The server **MUST** listen on a dynamically assigned port (that is,
|
||||
listen on port `0`).
|
||||
|
||||
### 2. Discovery mechanism: The port file
|
||||
|
|
@ -68,15 +68,15 @@ creating a "discovery file."
|
|||
The CLI will include this token in an `Authorization: Bearer <token>` header
|
||||
on all requests.
|
||||
- `ideInfo` (object, required): Information about the IDE.
|
||||
- `name` (string, required): A short, lowercase identifier for the IDE
|
||||
(e.g., `vscode`, `jetbrains`).
|
||||
- `displayName` (string, required): A user-friendly name for the IDE (e.g.,
|
||||
`VS Code`, `JetBrains IDE`).
|
||||
- `name` (string, required): A short, lowercase identifier for the IDE (for
|
||||
example, `vscode`, `jetbrains`).
|
||||
- `displayName` (string, required): A user-friendly name for the IDE (for
|
||||
example, `VS Code`, `JetBrains IDE`).
|
||||
|
||||
- **Authentication:** To secure the connection, the plugin **MUST** generate a
|
||||
unique, secret token and include it in the discovery file. The CLI will then
|
||||
include this token in the `Authorization` header for all requests to the MCP
|
||||
server (e.g., `Authorization: Bearer a-very-secret-token`). Your server
|
||||
server (for example, `Authorization: Bearer a-very-secret-token`). Your server
|
||||
**MUST** validate this token on every request and reject any that are
|
||||
unauthorized.
|
||||
- **Tie-breaking with environment variables (recommended):** For the most
|
||||
|
|
@ -135,7 +135,7 @@ to the CLI whenever the user's context changes.
|
|||
<!-- prettier-ignore -->
|
||||
> [!NOTE]
|
||||
> The `openFiles` list should only include files that exist on disk.
|
||||
> Virtual files (e.g., unsaved files without a path, editor settings pages)
|
||||
> Virtual files (for example, unsaved files without a path, editor settings pages)
|
||||
> **MUST** be excluded.
|
||||
|
||||
### How the CLI uses this context
|
||||
|
|
@ -188,7 +188,7 @@ The plugin **MUST** register an `openDiff` tool on its MCP server.
|
|||
`CallToolResult` to acknowledge the request and report whether the diff view
|
||||
was successfully opened.
|
||||
- On Success: If the diff view was opened successfully, the response **MUST**
|
||||
contain empty content (i.e., `content: []`).
|
||||
contain empty content (that is, `content: []`).
|
||||
- On Failure: If an error prevented the diff view from opening, the response
|
||||
**MUST** have `isError: true` and include a `TextContent` block in the
|
||||
`content` array describing the error.
|
||||
|
|
@ -223,9 +223,9 @@ The plugin **MUST** register a `closeDiff` tool on its MCP server.
|
|||
|
||||
### `ide/diffAccepted` notification
|
||||
|
||||
When the user accepts the changes in a diff view (e.g., by clicking an "Apply"
|
||||
or "Save" button), the plugin **MUST** send an `ide/diffAccepted` notification
|
||||
to the CLI.
|
||||
When the user accepts the changes in a diff view (for example, by clicking an
|
||||
"Apply" or "Save" button), the plugin **MUST** send an `ide/diffAccepted`
|
||||
notification to the CLI.
|
||||
|
||||
- **Payload:** The notification parameters **MUST** include the file path and
|
||||
the final content of the file. The content may differ from the original
|
||||
|
|
@ -242,7 +242,7 @@ to the CLI.
|
|||
|
||||
### `ide/diffRejected` notification
|
||||
|
||||
When the user rejects the changes (e.g., by closing the diff view without
|
||||
When the user rejects the changes (for example, by closing the diff view without
|
||||
accepting), the plugin **MUST** send an `ide/diffRejected` notification to the
|
||||
CLI.
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ editor.
|
|||
**To accept a diff**, you can perform any of the following actions:
|
||||
|
||||
- Click the **checkmark icon** in the diff editor's title bar.
|
||||
- Save the file (e.g., with `Cmd+S` or `Ctrl+S`).
|
||||
- Save the file (for example, with `Cmd+S` or `Ctrl+S`).
|
||||
- Open the Command Palette and run **Gemini CLI: Accept Diff**.
|
||||
- Respond with `yes` in the CLI when prompted.
|
||||
|
||||
|
|
@ -208,7 +208,7 @@ directly through their in-built registry features.
|
|||
|
||||
## Using with sandboxing
|
||||
|
||||
If you are using Gemini CLI within a sandbox, please be aware of the following:
|
||||
If you are using Gemini CLI within a sandbox, be aware of the following:
|
||||
|
||||
- **On macOS:** The IDE integration requires network access to communicate with
|
||||
the IDE companion extension. You must use a Seatbelt profile that allows
|
||||
|
|
@ -299,5 +299,5 @@ to connect using the provided PID.
|
|||
|
||||
### ACP integration errors
|
||||
|
||||
For issues related to ACP integration, please refer to the debugging and
|
||||
telemetry section in the [ACP Mode](../cli/acp-mode.md) documentation.
|
||||
For issues related to ACP integration, refer to the debugging and telemetry
|
||||
section in the [ACP Mode](../cli/acp-mode.md) documentation.
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ in this project.
|
|||
## Overview
|
||||
|
||||
The integration tests are designed to validate the end-to-end functionality of
|
||||
the Gemini CLI. They execute the built binary in a controlled environment and
|
||||
verify that it behaves as expected when interacting with the file system.
|
||||
Gemini CLI. They execute the built binary in a controlled environment and verify
|
||||
that it behaves as expected when interacting with the file system.
|
||||
|
||||
These tests are located in the `integration-tests` directory and are run using a
|
||||
custom test runner.
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ is to perform an initial analysis and apply the correct labels.
|
|||
- It uses a Gemini model to analyze the issue's title and body against a
|
||||
detailed set of guidelines.
|
||||
- **Applies one `area/*` label**: Categorizes the issue into a functional area
|
||||
of the project (e.g., `area/ux`, `area/models`, `area/platform`).
|
||||
- **Applies one `kind/*` label**: Identifies the type of issue (e.g.,
|
||||
of the project (for example, `area/ux`, `area/models`, `area/platform`).
|
||||
- **Applies one `kind/*` label**: Identifies the type of issue (for example,
|
||||
`kind/bug`, `kind/enhancement`, `kind/question`).
|
||||
- **Applies one `priority/*` label**: Assigns a priority from P0 (critical) to
|
||||
P3 (low) based on the described impact.
|
||||
|
|
@ -50,8 +50,8 @@ is to perform an initial analysis and apply the correct labels.
|
|||
- **What you should do**:
|
||||
- Fill out the issue template as completely as possible. The more detail you
|
||||
provide, the more accurate the triage will be.
|
||||
- If the `status/need-information` label is added, please provide the
|
||||
requested details in a comment.
|
||||
- If the `status/need-information` label is added, provide the requested
|
||||
details in a comment.
|
||||
|
||||
### 2. When you open a pull request: `Continuous Integration (CI)`
|
||||
|
||||
|
|
@ -84,7 +84,8 @@ issues and have consistent labels.
|
|||
- **When it runs**: Every 15 minutes on all open pull requests.
|
||||
- **What it does**:
|
||||
- **Checks for a linked issue**: The bot scans your PR description for a
|
||||
keyword that links it to an issue (e.g., `Fixes #123`, `Closes #456`).
|
||||
keyword that links it to an issue (for example, `Fixes #123`,
|
||||
`Closes #456`).
|
||||
- **Adds `status/need-issue`**: If no linked issue is found, the bot will add
|
||||
the `status/need-issue` label to your PR. This is a clear signal that an
|
||||
issue needs to be created and linked.
|
||||
|
|
@ -156,7 +157,7 @@ and will never be auto-unassigned.
|
|||
### 6. Release automation
|
||||
|
||||
This workflow handles the process of packaging and publishing new versions of
|
||||
the Gemini CLI.
|
||||
Gemini CLI.
|
||||
|
||||
- **Workflow File**: `.github/workflows/release-manual.yml`
|
||||
- **When it runs**: On a daily schedule for "nightly" releases, and manually for
|
||||
|
|
@ -171,4 +172,4 @@ the Gemini CLI.
|
|||
will be included in the very next nightly release.
|
||||
|
||||
We hope this detailed overview is helpful. If you have any questions about our
|
||||
automation or processes, please don't hesitate to ask!
|
||||
automation or processes, don't hesitate to ask!
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ This monorepo contains two main packages: `@google/gemini-cli` and
|
|||
|
||||
## `@google/gemini-cli`
|
||||
|
||||
This is the main package for the Gemini CLI. It is responsible for the user
|
||||
This is the main package for Gemini CLI. It is responsible for the user
|
||||
interface, command parsing, and all other user-facing functionality.
|
||||
|
||||
When this package is published, it is bundled into a single executable file.
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ Slash commands provide meta-level control over the CLI itself.
|
|||
|
||||
### `/docs`
|
||||
|
||||
- **Description:** Open the Gemini CLI documentation in your browser.
|
||||
- **Description:** Open Gemini CLI documentation in your browser.
|
||||
|
||||
### `/editor`
|
||||
|
||||
|
|
@ -400,8 +400,8 @@ Slash commands provide meta-level control over the CLI itself.
|
|||
|
||||
### `/shells` (or `/bashes`)
|
||||
|
||||
- **Description:** Toggle the background shells view. This allows you to view
|
||||
and manage long-running processes that you've sent to the background.
|
||||
- **Description:** Toggle the background shells view. This lets you view and
|
||||
manage long-running processes that you've sent to the background.
|
||||
|
||||
### `/setup-github`
|
||||
|
||||
|
|
@ -474,7 +474,8 @@ Slash commands provide meta-level control over the CLI itself.
|
|||
input area supports vim-style navigation and editing commands in both NORMAL
|
||||
and INSERT modes.
|
||||
- **Features:**
|
||||
- **Count support:** Prefix commands with numbers (e.g., `3h`, `5w`, `10G`)
|
||||
- **Count support:** Prefix commands with numbers (for example, `3h`, `5w`,
|
||||
`10G`)
|
||||
- **Editing commands:** Delete with `x`, change with `c`, insert with `i`,
|
||||
`a`, `o`, `O`; complex operations like `dd`, `cc`, `dw`, `cw`
|
||||
- **INSERT mode:** Standard text input with escape to return to NORMAL mode
|
||||
|
|
@ -490,9 +491,8 @@ Slash commands provide meta-level control over the CLI itself.
|
|||
### Custom commands
|
||||
|
||||
Custom commands allow you to create personalized shortcuts for your most-used
|
||||
prompts. For detailed instructions on how to create, manage, and use them,
|
||||
please see the dedicated
|
||||
[Custom Commands documentation](../cli/custom-commands.md).
|
||||
prompts. For detailed instructions on how to create, manage, and use them, see
|
||||
the dedicated [Custom Commands documentation](../cli/custom-commands.md).
|
||||
|
||||
## Input prompt shortcuts
|
||||
|
||||
|
|
@ -523,7 +523,7 @@ your prompt to Gemini. These commands include git-aware filtering.
|
|||
- If a path to a single file is provided, the content of that file is read.
|
||||
- If a path to a directory is provided, the command attempts to read the
|
||||
content of files within that directory and any subdirectories.
|
||||
- Spaces in paths should be escaped with a backslash (e.g.,
|
||||
- Spaces in paths should be escaped with a backslash (for example,
|
||||
`@My\ Documents/file.txt`).
|
||||
- The command uses the `read_many_files` tool internally. The content is
|
||||
fetched and then inserted into your query before being sent to the Gemini
|
||||
|
|
@ -549,8 +549,8 @@ your prompt to Gemini. These commands include git-aware filtering.
|
|||
- If the path specified after `@` is not found or is invalid, an error message
|
||||
will be displayed, and the query might not be sent to the Gemini model, or it
|
||||
will be sent without the file content.
|
||||
- If the `read_many_files` tool encounters an error (e.g., permission issues),
|
||||
this will also be reported.
|
||||
- If the `read_many_files` tool encounters an error (for example, permission
|
||||
issues), this will also be reported.
|
||||
|
||||
## Shell mode and passthrough commands (`!`)
|
||||
|
||||
|
|
@ -583,4 +583,4 @@ Gemini CLI.
|
|||
- **Environment variable:** When a command is executed via `!` or in shell mode,
|
||||
the `GEMINI_CLI=1` environment variable is set in the subprocess's
|
||||
environment. This allows scripts or tools to detect if they are being run from
|
||||
within the Gemini CLI.
|
||||
within Gemini CLI.
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ Additionally, each extension can have its own `.env` file in its directory,
|
|||
which will be loaded automatically.
|
||||
|
||||
**Note for Enterprise Users:** For guidance on deploying and managing Gemini CLI
|
||||
in a corporate environment, please see the
|
||||
in a corporate environment, see the
|
||||
[Enterprise Configuration](../cli/enterprise.md) documentation.
|
||||
|
||||
### The `.gemini` directory in your project
|
||||
|
|
@ -79,7 +79,7 @@ in a corporate environment, please see the
|
|||
In addition to a project settings file, a project's `.gemini` directory can
|
||||
contain other project-specific files related to Gemini CLI's operation, such as:
|
||||
|
||||
- [Custom sandbox profiles](#sandboxing) (e.g.,
|
||||
- [Custom sandbox profiles](#sandboxing) (for example,
|
||||
`.gemini/sandbox-macos-custom.sb`, `.gemini/sandbox.Dockerfile`).
|
||||
|
||||
### Available settings in `settings.json`
|
||||
|
|
@ -1912,15 +1912,15 @@ 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. Every discovered tool is
|
||||
prepended with the `mcp_` prefix and its server alias to form a fully qualified
|
||||
name (FQN) (e.g., `mcp_serverAlias_actualToolName`) to avoid conflicts. Note
|
||||
that the system might strip certain schema properties from MCP tool definitions
|
||||
for compatibility. At least one of `command`, `url`, or `httpUrl` must be
|
||||
provided. If multiple are specified, the order of precedence is `httpUrl`, then
|
||||
`url`, then `command`.
|
||||
name (FQN) (for example, `mcp_serverAlias_actualToolName`) to avoid conflicts.
|
||||
Note that the system might strip certain schema properties from MCP tool
|
||||
definitions for compatibility. At least one of `command`, `url`, or `httpUrl`
|
||||
must be provided. If multiple are specified, the order of precedence is
|
||||
`httpUrl`, then `url`, then `command`.
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
> [!WARNING]
|
||||
> Avoid using underscores (`_`) in your server aliases (e.g., use
|
||||
> Avoid using underscores (`_`) in your server aliases (for example, use
|
||||
> `my-server` instead of `my_server`). The underlying policy engine parses Fully
|
||||
> Qualified Names (`mcp_server_tool`) using the first underscore after the
|
||||
> `mcp_` prefix. An underscore in your server alias will cause the parser to
|
||||
|
|
@ -2086,8 +2086,8 @@ the `advanced.excludedEnvVars` setting in your `settings.json` file.
|
|||
- Your API key for the Gemini API.
|
||||
- One of several available
|
||||
[authentication methods](../get-started/authentication.md).
|
||||
- Set this in your shell profile (e.g., `~/.bashrc`, `~/.zshrc`) or an `.env`
|
||||
file.
|
||||
- Set this in your shell profile (for example, `~/.bashrc`, `~/.zshrc`) or an
|
||||
`.env` file.
|
||||
- **`GEMINI_MODEL`**:
|
||||
- Specifies the default Gemini model to use.
|
||||
- Overrides the hardcoded default
|
||||
|
|
@ -2171,7 +2171,7 @@ the `advanced.excludedEnvVars` setting in your `settings.json` file.
|
|||
Any other value is treated as disabling it.
|
||||
- Overrides the `telemetry.useCollector` setting.
|
||||
- **`GOOGLE_CLOUD_LOCATION`**:
|
||||
- Your Google Cloud Project Location (e.g., us-central1).
|
||||
- Your Google Cloud Project Location (for example, us-central1).
|
||||
- Required for using Vertex AI in non-express mode.
|
||||
- Example: `export GOOGLE_CLOUD_LOCATION="YOUR_PROJECT_LOCATION"` (Windows
|
||||
PowerShell: `$env:GOOGLE_CLOUD_LOCATION="YOUR_PROJECT_LOCATION"`).
|
||||
|
|
@ -2202,7 +2202,7 @@ the `advanced.excludedEnvVars` setting in your `settings.json` file.
|
|||
- `strict-proxied`: Same as `strict-open` but routes network through proxy.
|
||||
- `<profile_name>`: Uses a custom profile. To define a custom profile, create
|
||||
a file named `sandbox-macos-<profile_name>.sb` in your project's `.gemini/`
|
||||
directory (e.g., `my-project/.gemini/sandbox-macos-custom.sb`).
|
||||
directory (for example, `my-project/.gemini/sandbox-macos-custom.sb`).
|
||||
- **`DEBUG` or `DEBUG_MODE`** (often used by underlying libraries or the CLI
|
||||
itself):
|
||||
- Set to `true` or `1` to enable verbose debug logging, which can be helpful
|
||||
|
|
@ -2241,7 +2241,7 @@ from the system or loaded from `.env` files.
|
|||
|
||||
**Allowlist (Never Redacted):**
|
||||
|
||||
- Common system variables (e.g., `PATH`, `HOME`, `USER`, `SHELL`, `TERM`,
|
||||
- Common system variables (for example, `PATH`, `HOME`, `USER`, `SHELL`, `TERM`,
|
||||
`LANG`).
|
||||
- Variables starting with `GEMINI_CLI_`.
|
||||
- GitHub Action specific variables.
|
||||
|
|
@ -2367,7 +2367,7 @@ for that specific session.
|
|||
While not strictly configuration for the CLI's _behavior_, context files
|
||||
(defaulting to `GEMINI.md` but configurable via the `context.fileName` setting)
|
||||
are crucial for configuring the _instructional context_ (also referred to as
|
||||
"memory") provided to the Gemini model. This powerful feature allows you to give
|
||||
"memory") provided to the Gemini model. This powerful feature lets you give
|
||||
project-specific instructions, coding style guides, or any relevant background
|
||||
information to the AI, making its responses more tailored and accurate to your
|
||||
needs. The CLI includes UI elements, such as an indicator in the footer showing
|
||||
|
|
@ -2378,7 +2378,7 @@ context.
|
|||
that you want the Gemini model to be aware of during your interactions. The
|
||||
system is designed to manage this instructional context hierarchically.
|
||||
|
||||
### Example context file content (e.g., `GEMINI.md`)
|
||||
### Example context file content (for example, `GEMINI.md`)
|
||||
|
||||
Here's a conceptual example of what a context file at the root of a TypeScript
|
||||
project might contain:
|
||||
|
|
@ -2388,7 +2388,7 @@ project might contain:
|
|||
|
||||
## General Instructions:
|
||||
|
||||
- When generating new TypeScript code, please follow the existing coding style.
|
||||
- When generating new TypeScript code, follow the existing coding style.
|
||||
- Ensure all new functions and classes have JSDoc comments.
|
||||
- Prefer functional programming paradigms where appropriate.
|
||||
- All code should be compatible with TypeScript 5.0 and Node.js 20+.
|
||||
|
|
@ -2396,7 +2396,7 @@ project might contain:
|
|||
## Coding Style:
|
||||
|
||||
- Use 2 spaces for indentation.
|
||||
- Interface names should be prefixed with `I` (e.g., `IUserService`).
|
||||
- Interface names should be prefixed with `I` (for example, `IUserService`).
|
||||
- Private class members should be prefixed with an underscore (`_`).
|
||||
- Always use strict equality (`===` and `!==`).
|
||||
|
||||
|
|
@ -2410,7 +2410,7 @@ project might contain:
|
|||
## Regarding Dependencies:
|
||||
|
||||
- Avoid introducing new external dependencies unless absolutely necessary.
|
||||
- If a new dependency is required, please state the reason.
|
||||
- If a new dependency is required, state the reason.
|
||||
```
|
||||
|
||||
This example demonstrates how you can provide general project context, specific
|
||||
|
|
@ -2420,13 +2420,13 @@ you. Project-specific context files are highly encouraged to establish
|
|||
conventions and context.
|
||||
|
||||
- **Hierarchical loading and precedence:** The CLI implements a sophisticated
|
||||
hierarchical memory system by loading context files (e.g., `GEMINI.md`) from
|
||||
several locations. Content from files lower in this list (more specific)
|
||||
hierarchical memory system by loading context files (for example, `GEMINI.md`)
|
||||
from several locations. Content from files lower in this list (more specific)
|
||||
typically overrides or supplements content from files higher up (more
|
||||
general). The exact concatenation order and final context can be inspected
|
||||
using the `/memory show` command. The typical loading order is:
|
||||
1. **Global context file:**
|
||||
- Location: `~/.gemini/<configured-context-filename>` (e.g.,
|
||||
- Location: `~/.gemini/<configured-context-filename>` (for example,
|
||||
`~/.gemini/GEMINI.md` in your user home directory).
|
||||
- Scope: Provides default instructions for all your projects.
|
||||
2. **Project root and ancestors context files:**
|
||||
|
|
@ -2463,12 +2463,12 @@ conventions and context.
|
|||
|
||||
By understanding and utilizing these configuration layers and the hierarchical
|
||||
nature of context files, you can effectively manage the AI's memory and tailor
|
||||
the Gemini CLI's responses to your specific needs and projects.
|
||||
Gemini CLI's responses to your specific needs and projects.
|
||||
|
||||
## Sandboxing
|
||||
|
||||
The Gemini CLI can execute potentially unsafe operations (like shell commands
|
||||
and file modifications) within a sandboxed environment to protect your system.
|
||||
Gemini CLI can execute potentially unsafe operations (like shell commands and
|
||||
file modifications) within a sandboxed environment to protect your system.
|
||||
|
||||
Sandboxing is disabled by default, but you can enable it in a few ways:
|
||||
|
||||
|
|
@ -2505,9 +2505,9 @@ BUILD_SANDBOX=1 gemini -s
|
|||
|
||||
## Usage statistics
|
||||
|
||||
To help us improve the Gemini CLI, we collect anonymized usage statistics. This
|
||||
data helps us understand how the CLI is used, identify common issues, and
|
||||
prioritize new features.
|
||||
To help us improve Gemini CLI, we collect anonymized usage statistics. This data
|
||||
helps us understand how the CLI is used, identify common issues, and prioritize
|
||||
new features.
|
||||
|
||||
**What we collect:**
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
# Memory Import Processor
|
||||
|
||||
The Memory Import Processor is a feature that allows you to modularize your
|
||||
GEMINI.md files by importing content from other files using the `@file.md`
|
||||
syntax.
|
||||
The Memory Import Processor is a feature that lets you modularize your GEMINI.md
|
||||
files by importing content from other files using the `@file.md` syntax.
|
||||
|
||||
## Overview
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
# Policy engine
|
||||
|
||||
The Gemini CLI includes a powerful policy engine that provides fine-grained
|
||||
control over tool execution. It allows users and administrators to define rules
|
||||
that determine whether a tool call should be allowed, denied, or require user
|
||||
Gemini CLI includes a powerful policy engine that provides fine-grained control
|
||||
over tool execution. It allows users and administrators to define rules that
|
||||
determine whether a tool call should be allowed, denied, or require user
|
||||
confirmation.
|
||||
|
||||
## Quick start
|
||||
|
|
@ -23,9 +23,9 @@ To create your first policy:
|
|||
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.gemini\policies"
|
||||
```
|
||||
|
||||
2. **Create a new policy file** (e.g., `~/.gemini/policies/my-rules.toml`). You
|
||||
can use any filename ending in `.toml`; all such files in this directory
|
||||
will be loaded and combined:
|
||||
2. **Create a new policy file** (for example,
|
||||
`~/.gemini/policies/my-rules.toml`). You can use any filename ending in
|
||||
`.toml`; all such files in this directory will be loaded and combined:
|
||||
```toml
|
||||
[[rule]]
|
||||
toolName = "run_shell_command"
|
||||
|
|
@ -33,7 +33,7 @@ To create your first policy:
|
|||
decision = "deny"
|
||||
priority = 100
|
||||
```
|
||||
3. **Run a command** that triggers the policy (e.g., ask Gemini CLI to
|
||||
3. **Run a command** that triggers the policy (for example, ask Gemini CLI to
|
||||
`rm -rf /`). The tool will now be blocked automatically.
|
||||
|
||||
## Core concepts
|
||||
|
|
@ -127,13 +127,13 @@ rule with the highest priority wins**.
|
|||
To provide a clear hierarchy, policies are organized into three tiers. Each tier
|
||||
has a designated number that forms the base of the final priority calculation.
|
||||
|
||||
| Tier | Base | Description |
|
||||
| :-------- | :--- | :------------------------------------------------------------------------- |
|
||||
| Default | 1 | Built-in policies that ship with the Gemini CLI. |
|
||||
| Extension | 2 | Policies defined in extensions. |
|
||||
| Workspace | 3 | Policies defined in the current workspace's configuration directory. |
|
||||
| User | 4 | Custom policies defined by the user. |
|
||||
| Admin | 5 | Policies managed by an administrator (e.g., in an enterprise environment). |
|
||||
| Tier | Base | Description |
|
||||
| :-------- | :--- | :-------------------------------------------------------------------------------- |
|
||||
| Default | 1 | Built-in policies that ship with Gemini CLI. |
|
||||
| Extension | 2 | Policies defined in extensions. |
|
||||
| Workspace | 3 | Policies defined in the current workspace's configuration directory. |
|
||||
| User | 4 | Custom policies defined by the user. |
|
||||
| Admin | 5 | Policies managed by an administrator (for example, in an enterprise environment). |
|
||||
|
||||
Within a TOML policy file, you assign a priority value from **0 to 999**. The
|
||||
engine transforms this into a final priority using the following formula:
|
||||
|
|
@ -159,8 +159,8 @@ For example:
|
|||
|
||||
Approval modes allow the policy engine to apply different sets of rules based on
|
||||
the CLI's operational mode. A rule in a TOML policy file can be associated with
|
||||
one or more modes (e.g., `yolo`, `autoEdit`, `plan`). The rule will only be
|
||||
active if the CLI is running in one of its specified modes. If a rule has no
|
||||
one or more modes (for example, `yolo`, `autoEdit`, `plan`). The rule will only
|
||||
be active if the CLI is running in one of its specified modes. If a rule has no
|
||||
modes specified, it is always active.
|
||||
|
||||
- `default`: The standard interactive mode where most write tools require
|
||||
|
|
@ -257,7 +257,7 @@ To prevent privilege escalation, the CLI enforces strict security checks on the
|
|||
directory are **ignored**.
|
||||
|
||||
- **Linux / macOS:** Must be owned by `root` (UID 0) and NOT writable by group
|
||||
or others (e.g., `chmod 755`).
|
||||
or others (for example, `chmod 755`).
|
||||
- **Windows:** Must be in `C:\ProgramData`. Standard users (`Users`, `Everyone`)
|
||||
must NOT have `Write`, `Modify`, or `Full Control` permissions. If you see a
|
||||
security warning, use the folder properties to remove write permissions for
|
||||
|
|
@ -386,7 +386,7 @@ policies, as it is much more robust than manually writing Fully Qualified Names
|
|||
|
||||
<!-- prettier-ignore -->
|
||||
> [!WARNING]
|
||||
> Do not use underscores (`_`) in your MCP server names (e.g., use
|
||||
> Do not use underscores (`_`) in your MCP server names (for example, use
|
||||
> `my-server` rather than `my_server`). The policy parser splits Fully Qualified
|
||||
> Names (`mcp_server_tool`) on the _first_ underscore following the `mcp_`
|
||||
> prefix. If your server name contains an underscore, the parser will
|
||||
|
|
@ -397,7 +397,8 @@ policies, as it is much more robust than manually writing Fully Qualified Names
|
|||
|
||||
Combine `mcpName` and `toolName` to target a single operation. When using
|
||||
`mcpName`, the `toolName` field should strictly be the simple name of the tool
|
||||
(e.g., `search`), **not** the Fully Qualified Name (e.g., `mcp_server_search`).
|
||||
(for example, `search`), **not** the Fully Qualified Name (for example,
|
||||
`mcp_server_search`).
|
||||
|
||||
```toml
|
||||
# Allows the `search` tool on the `my-jira-server` MCP
|
||||
|
|
@ -467,8 +468,8 @@ deny_message = "Deep codebase analysis is restricted for this session."
|
|||
|
||||
## Default policies
|
||||
|
||||
The Gemini CLI ships with a set of default policies to provide a safe
|
||||
out-of-the-box experience.
|
||||
Gemini CLI ships with a set of default policies to provide a safe out-of-the-box
|
||||
experience.
|
||||
|
||||
- **Read-only tools** (like `read_file`, `glob`) are generally **allowed**.
|
||||
- **Agent delegation** defaults to **`ask_user`** to ensure remote agents can
|
||||
|
|
|
|||
|
|
@ -113,12 +113,24 @@ each tool.
|
|||
| :-------------- | :------ | :----------------------------------------------------------------------------------------------------------------- |
|
||||
| `complete_task` | `Other` | Finalizes a subagent's mission and returns the result to the parent agent. This tool is not available to the user. |
|
||||
|
||||
### Task Tracking
|
||||
|
||||
| Tool | Kind | Description |
|
||||
| :----------------------- | :------ | :-------------------------------------------------------------------------- |
|
||||
| `tracker_add_dependency` | `Think` | Adds a dependency between two existing tasks in the tracker. |
|
||||
| `tracker_create_task` | `Think` | Creates a new task in the internal tracker to monitor progress. |
|
||||
| `tracker_get_task` | `Think` | Retrieves the details and current status of a specific tracked task. |
|
||||
| `tracker_list_tasks` | `Think` | Lists all tasks currently being tracked. |
|
||||
| `tracker_update_task` | `Think` | Updates the status or details of an existing task. |
|
||||
| `tracker_visualize` | `Think` | Generates a visual representation of the current task dependency graph. |
|
||||
| `update_topic` | `Think` | Updates the current topic and status to keep the user informed of progress. |
|
||||
|
||||
### Web
|
||||
|
||||
| Tool | Kind | Description |
|
||||
| :-------------------------------------------- | :------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [`google_web_search`](../tools/web-search.md) | `Search` | Performs a Google Search to find up-to-date information. |
|
||||
| [`web_fetch`](../tools/web-fetch.md) | `Fetch` | Retrieves and processes content from specific URLs. **Warning:** This tool can access local and private network addresses (e.g., localhost), which may pose a security risk if used with untrusted prompts. In Plan Mode, this tool requires explicit user confirmation. |
|
||||
| Tool | Kind | Description |
|
||||
| :-------------------------------------------- | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| [`google_web_search`](../tools/web-search.md) | `Search` | Performs a Google Search to find up-to-date information. |
|
||||
| [`web_fetch`](../tools/web-fetch.md) | `Fetch` | Retrieves and processes content from specific URLs. **Warning:** This tool can access local and private network addresses (for example, localhost), which may pose a security risk if used with untrusted prompts. In Plan Mode, this tool requires explicit user confirmation. |
|
||||
|
||||
## Under the hood
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Release confidence strategy
|
||||
|
||||
This document outlines the strategy for gaining confidence in every release of
|
||||
the Gemini CLI. It serves as a checklist and quality gate for release manager to
|
||||
Gemini CLI. It serves as a checklist and quality gate for release manager to
|
||||
ensure we are shipping a high-quality product.
|
||||
|
||||
## The goal
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ promotion flow is:
|
|||
### Preview
|
||||
|
||||
These releases will not have been fully vetted and may contain regressions or
|
||||
other outstanding issues. Please help us test and install with `preview` tag.
|
||||
other outstanding issues. Help us test and install with `preview` tag.
|
||||
|
||||
```bash
|
||||
npm install -g @google/gemini-cli@preview
|
||||
|
|
@ -126,8 +126,8 @@ specific version from any branch, tag, or commit SHA.
|
|||
2. Select the **Release: Manual** workflow from the list.
|
||||
3. Click the **Run workflow** dropdown button.
|
||||
4. Fill in the required inputs:
|
||||
- **Version**: The exact version to release (e.g., `v0.6.1`). This must be a
|
||||
valid semantic version with a `v` prefix.
|
||||
- **Version**: The exact version to release (for example, `v0.6.1`). This
|
||||
must be a valid semantic version with a `v` prefix.
|
||||
- **Ref**: The branch, tag, or full commit SHA to release from.
|
||||
- **NPM Channel**: The npm channel to publish to. The options are `preview`,
|
||||
`nightly`, `latest` (for stable releases), and `dev`. The default is
|
||||
|
|
@ -165,9 +165,10 @@ require a full release cycle.
|
|||
3. Click the **Run workflow** dropdown button.
|
||||
4. Fill in the required inputs:
|
||||
- **Version**: The existing package version that you want to point the tag
|
||||
to (e.g., `0.5.0-preview-2`). This version **must** already be published
|
||||
to the npm registry.
|
||||
- **Channel**: The npm `dist-tag` to apply (e.g., `preview`, `stable`).
|
||||
to (for example, `0.5.0-preview-2`). This version **must** already be
|
||||
published to the npm registry.
|
||||
- **Channel**: The npm `dist-tag` to apply (for example, `preview`,
|
||||
`stable`).
|
||||
- **Dry Run**: Leave as `true` to log the action without making changes, or
|
||||
set to `false` to perform the live tag change.
|
||||
- **Environment**: Select the appropriate environment. The `dev` environment
|
||||
|
|
@ -227,7 +228,7 @@ workflow.
|
|||
This workflow will automatically:
|
||||
|
||||
1. Find the latest release tag for the channel.
|
||||
2. Create a release branch from that tag if one doesn't exist (e.g.,
|
||||
2. Create a release branch from that tag if one doesn't exist (for example,
|
||||
`release/v0.5.1-pr-12345`).
|
||||
3. Create a new hotfix branch from the release branch.
|
||||
4. Cherry-pick your specified commit into the hotfix branch.
|
||||
|
|
@ -282,9 +283,8 @@ created:
|
|||
6. **Update the PR description**: Consider updating the PR title and description
|
||||
to reflect that it includes multiple fixes.
|
||||
|
||||
This approach allows you to group related fixes into a single patch release
|
||||
while maintaining full control over what gets included and how conflicts are
|
||||
resolved.
|
||||
This approach lets you group related fixes into a single patch release while
|
||||
maintaining full control over what gets included and how conflicts are resolved.
|
||||
|
||||
#### 3. Automatic release
|
||||
|
||||
|
|
@ -302,9 +302,9 @@ consistently and reliably.
|
|||
#### Troubleshooting: Older branch workflows
|
||||
|
||||
**Issue**: If the patch trigger workflow fails with errors like "Resource not
|
||||
accessible by integration" or references to non-existent workflow files (e.g.,
|
||||
`patch-release.yml`), this indicates the hotfix branch contains an outdated
|
||||
version of the workflow files.
|
||||
accessible by integration" or references to non-existent workflow files (for
|
||||
example, `patch-release.yml`), this indicates the hotfix branch contains an
|
||||
outdated version of the workflow files.
|
||||
|
||||
**Root cause**: When a PR is merged, GitHub Actions runs the workflow definition
|
||||
from the **source branch** (the hotfix branch), not from the target branch (the
|
||||
|
|
@ -428,7 +428,7 @@ This command will do the following:
|
|||
|
||||
You can then inspect the generated tarballs to ensure that they contain the
|
||||
correct files and that the `package.json` files have been updated correctly. The
|
||||
tarballs will be created in the root of each package's directory (e.g.,
|
||||
tarballs will be created in the root of each package's directory (for example,
|
||||
`packages/cli/google-gemini-cli-0.1.6.tgz`).
|
||||
|
||||
By performing a dry run, you can be confident that your changes to the packaging
|
||||
|
|
@ -477,9 +477,9 @@ executable that enables `npx` usage directly from the GitHub repository.
|
|||
1. **The JavaScript bundle is created:**
|
||||
- **What happens:** The built JavaScript from both `packages/core/dist` and
|
||||
`packages/cli/dist`, along with all third-party JavaScript dependencies,
|
||||
are bundled by `esbuild` into a single, executable JavaScript file (e.g.,
|
||||
`gemini.js`). The `node-pty` library is excluded from this bundle as it
|
||||
contains native binaries.
|
||||
are bundled by `esbuild` into a single, executable JavaScript file (for
|
||||
example, `gemini.js`). The `node-pty` library is excluded from this bundle
|
||||
as it contains native binaries.
|
||||
- **Why:** This creates a single, optimized file that contains all the
|
||||
necessary application code. It simplifies execution for users who want to
|
||||
run the CLI without a full `npm install`, as all dependencies (including
|
||||
|
|
@ -540,9 +540,9 @@ The list of available labels is not currently populated correctly. If you want
|
|||
to add a label that does not appear alphabetically in the first 30 labels in the
|
||||
repo, you must use your browser's developer tools to manually modify the UI:
|
||||
|
||||
1. Open your browser's developer tools (e.g., Chrome DevTools).
|
||||
1. Open your browser's developer tools (for example, Chrome DevTools).
|
||||
2. In the `/github-settings` dialog, inspect the list of labels.
|
||||
3. Locate one of the `<li>` elements representing a label.
|
||||
4. In the HTML, modify the `data-option-value` attribute of that `<li>` element
|
||||
to the desired label name (e.g., `release-failure`).
|
||||
to the desired label name (for example, `release-failure`).
|
||||
5. Click on your modified label in the UI to select it, then save your settings.
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ problems encountered while using Gemini CLI.
|
|||
This section addresses common questions about Gemini CLI usage, security, and
|
||||
troubleshooting general errors.
|
||||
|
||||
### Why can't I use third-party software (e.g. Claude Code, OpenClaw, OpenCode) with Gemini CLI?
|
||||
### Why can't I use third-party software like Claude Code, OpenClaw, or OpenCode with Gemini CLI?
|
||||
|
||||
Using third-party software, tools, or services to harvest or piggyback on Gemini
|
||||
CLI's OAuth authentication to access our backend services is a direct violation
|
||||
|
|
@ -113,8 +113,8 @@ export GOOGLE_CLOUD_PROJECT="your-project-id"
|
|||
$env:GOOGLE_CLOUD_PROJECT="your-project-id"
|
||||
```
|
||||
|
||||
To make this setting permanent, add this line to your shell's startup file
|
||||
(e.g., `~/.bashrc`, `~/.zshrc`).
|
||||
To make this setting permanent, add this line to your shell's startup file (for
|
||||
example, `~/.bashrc`, `~/.zshrc`).
|
||||
|
||||
### What is the best way to store my API keys securely?
|
||||
|
||||
|
|
@ -131,9 +131,9 @@ To store your API keys securely, you can:
|
|||
Manager, or a secret manager on Linux). You can then have your scripts or
|
||||
environment load the key from the secure storage at runtime.
|
||||
|
||||
### Where are the Gemini CLI configuration and settings files stored?
|
||||
### Where are Gemini CLI configuration and settings files stored?
|
||||
|
||||
The Gemini CLI configuration is stored in two `settings.json` files:
|
||||
Gemini CLI configuration is stored in two `settings.json` files:
|
||||
|
||||
1. In your home directory: `~/.gemini/settings.json`.
|
||||
2. In your project's root directory: `./.gemini/settings.json`.
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
# Gemini CLI: License, Terms of Service, and Privacy Notices
|
||||
|
||||
Gemini CLI is an open-source tool that lets you interact with Google's powerful
|
||||
AI services directly from your command-line interface. The Gemini CLI software
|
||||
is licensed under the
|
||||
AI services directly from your command-line interface. Gemini CLI software is
|
||||
licensed under the
|
||||
[Apache 2.0 license](https://github.com/google-gemini/gemini-cli/blob/main/LICENSE).
|
||||
When you use Gemini CLI to access or use Google’s services, the Terms of Service
|
||||
and Privacy Notices applicable to those services apply to such access and use.
|
||||
|
||||
Directly accessing the services powering Gemini CLI (e.g., the Gemini Code
|
||||
Assist service) using third-party software, tools, or services (for example,
|
||||
using OpenClaw with Gemini CLI OAuth) is a violation of applicable terms and
|
||||
policies. Such actions may be grounds for suspension or termination of your
|
||||
account.
|
||||
Directly accessing the services powering Gemini CLI (for example, the Gemini
|
||||
Code Assist service) using third-party software, tools, or services (for
|
||||
example, using OpenClaw with Gemini CLI OAuth) is a violation of applicable
|
||||
terms and policies. Such actions may be grounds for suspension or termination of
|
||||
your account.
|
||||
|
||||
Your Gemini CLI Usage Statistics are handled in accordance with Google's Privacy
|
||||
Policy.
|
||||
|
|
@ -19,7 +19,7 @@ Policy.
|
|||
<!-- prettier-ignore -->
|
||||
> [!NOTE]
|
||||
> See [quotas and pricing](quota-and-pricing.md) for the quota and
|
||||
> pricing details that apply to your usage of the Gemini CLI.
|
||||
> pricing details that apply to your usage of Gemini CLI.
|
||||
|
||||
## Supported authentication methods
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ If you log in with your Google account and you do not already have a Gemini Code
|
|||
Assist account associated with your Google account, you will be directed to the
|
||||
sign up flow for Gemini Code Assist for individuals. If your Google account is
|
||||
managed by your organization, your administrator may not permit access to Gemini
|
||||
Code Assist for individuals. Please see the
|
||||
Code Assist for individuals. See the
|
||||
[Gemini Code Assist for individuals FAQs](https://developers.google.com/gemini-code-assist/resources/faqs)
|
||||
for further information.
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ If you are using a Gemini API key for authentication with the
|
|||
[Gemini Developer API](https://ai.google.dev/gemini-api/docs), these Terms of
|
||||
Service and Privacy Notice documents apply:
|
||||
|
||||
- Terms of Service: Your use of the Gemini CLI is governed by the
|
||||
- Terms of Service: Your use of Gemini CLI is governed by the
|
||||
[Gemini API Terms of Service](https://ai.google.dev/gemini-api/terms). These
|
||||
terms may differ depending on whether you are using an unpaid or paid service:
|
||||
- For unpaid services, refer to the
|
||||
|
|
@ -92,7 +92,7 @@ If you are using a Gemini API key for authentication with a
|
|||
[Vertex AI GenAI API](https://cloud.google.com/vertex-ai/generative-ai/docs/reference/rest)
|
||||
backend, these Terms of Service and Privacy Notice documents apply:
|
||||
|
||||
- Terms of Service: Your use of the Gemini CLI is governed by the
|
||||
- Terms of Service: Your use of Gemini CLI is governed by the
|
||||
[Google Cloud Platform Service Terms](https://cloud.google.com/terms/service-terms/).
|
||||
- Privacy Notice: The collection and use of your data is described in the
|
||||
[Google Cloud Privacy Notice](https://cloud.google.com/terms/cloud-privacy-notice).
|
||||
|
|
|
|||
|
|
@ -80,9 +80,9 @@ topics on:
|
|||
directory is in your `PATH`. You can update Gemini CLI using the command
|
||||
`npm install -g @google/gemini-cli@latest`.
|
||||
- If you are running `gemini` from source, ensure you are using the correct
|
||||
command to invoke it (e.g., `node packages/cli/dist/index.js ...`). To
|
||||
update Gemini CLI, pull the latest changes from the repository, and then
|
||||
rebuild using the command `npm run build`.
|
||||
command to invoke it (for example, `node packages/cli/dist/index.js ...`).
|
||||
To update Gemini CLI, pull the latest changes from the repository, and
|
||||
then rebuild using the command `npm run build`.
|
||||
|
||||
- **Error: `MODULE_NOT_FOUND` or import errors.**
|
||||
- **Cause:** Dependencies are not installed correctly, or the project hasn't
|
||||
|
|
@ -101,18 +101,18 @@ topics on:
|
|||
configuration.
|
||||
|
||||
- **Gemini CLI is not running in interactive mode in "CI" environments**
|
||||
- **Issue:** The Gemini CLI does not enter interactive mode (no prompt
|
||||
appears) if an environment variable starting with `CI_` (e.g., `CI_TOKEN`)
|
||||
is set. This is because the `is-in-ci` package, used by the underlying UI
|
||||
- **Issue:** Gemini CLI does not enter interactive mode (no prompt appears) if
|
||||
an environment variable starting with `CI_` (for example, `CI_TOKEN`) is
|
||||
set. This is because the `is-in-ci` package, used by the underlying UI
|
||||
framework, detects these variables and assumes a non-interactive CI
|
||||
environment.
|
||||
- **Cause:** The `is-in-ci` package checks for the presence of `CI`,
|
||||
`CONTINUOUS_INTEGRATION`, or any environment variable with a `CI_` prefix.
|
||||
When any of these are found, it signals that the environment is
|
||||
non-interactive, which prevents the Gemini CLI from starting in its
|
||||
interactive mode.
|
||||
non-interactive, which prevents Gemini CLI from starting in its interactive
|
||||
mode.
|
||||
- **Solution:** If the `CI_` prefixed variable is not needed for the CLI to
|
||||
function, you can temporarily unset it for the command. e.g.,
|
||||
function, you can temporarily unset it for the command. For example,
|
||||
`env -u CI_TOKEN gemini`
|
||||
|
||||
- **DEBUG mode not working from project .env file**
|
||||
|
|
@ -126,7 +126,7 @@ topics on:
|
|||
|
||||
- **Warning: `npm WARN deprecated node-domexception@1.0.0` or
|
||||
`npm WARN deprecated glob` during install/update**
|
||||
- **Issue:** When installing or updating the Gemini CLI globally via
|
||||
- **Issue:** When installing or updating Gemini CLI globally via
|
||||
`npm install -g @google/gemini-cli` or `npm update -g @google/gemini-cli`,
|
||||
you might see deprecation warnings regarding `node-domexception` or old
|
||||
versions of `glob`.
|
||||
|
|
@ -141,14 +141,14 @@ topics on:
|
|||
|
||||
## Exit codes
|
||||
|
||||
The Gemini CLI uses specific exit codes to indicate the reason for termination.
|
||||
This is especially useful for scripting and automation.
|
||||
Gemini CLI uses specific exit codes to indicate the reason for termination. This
|
||||
is especially useful for scripting and automation.
|
||||
|
||||
| Exit Code | Error Type | Description |
|
||||
| --------- | -------------------------- | --------------------------------------------------------------------------------------------------- |
|
||||
| 41 | `FatalAuthenticationError` | An error occurred during the authentication process. |
|
||||
| 42 | `FatalInputError` | Invalid or missing input was provided to the CLI. (non-interactive mode only) |
|
||||
| 44 | `FatalSandboxError` | An error occurred with the sandboxing environment (e.g., Docker, Podman, or Seatbelt). |
|
||||
| 44 | `FatalSandboxError` | An error occurred with the sandboxing environment (for example, Docker, Podman, or Seatbelt). |
|
||||
| 52 | `FatalConfigError` | A configuration file (`settings.json`) is invalid or contains errors. |
|
||||
| 53 | `FatalTurnLimitedError` | The maximum number of conversational turns for the session was reached. (non-interactive mode only) |
|
||||
|
||||
|
|
@ -164,8 +164,8 @@ This is especially useful for scripting and automation.
|
|||
- Check the server console output for error messages or stack traces.
|
||||
- Increase log verbosity if configurable. For example, set the `DEBUG_MODE`
|
||||
environment variable to `true` or `1`.
|
||||
- Use Node.js debugging tools (e.g., `node --inspect`) if you need to step
|
||||
through server-side code.
|
||||
- Use Node.js debugging tools (for example, `node --inspect`) if you need to
|
||||
step through server-side code.
|
||||
|
||||
- **Tool issues:**
|
||||
- If a specific tool is failing, try to isolate the issue by running the
|
||||
|
|
@ -182,7 +182,7 @@ This is especially useful for scripting and automation.
|
|||
## Existing GitHub issues similar to yours or creating new issues
|
||||
|
||||
If you encounter an issue that was not covered here in this _Troubleshooting
|
||||
guide_, consider searching the Gemini CLI
|
||||
guide_, consider searching Gemini CLI
|
||||
[Issue tracker on GitHub](https://github.com/google-gemini/gemini-cli/issues).
|
||||
If you can't find an issue similar to yours, consider creating a new GitHub
|
||||
Issue with a detailed description. Pull requests are also welcome!
|
||||
|
|
|
|||
|
|
@ -28,8 +28,9 @@ Remove-Item -Path (Join-Path $env:LocalAppData "npm-cache\_npx") -Recurse -Force
|
|||
|
||||
## Method 2: Using npm (global install)
|
||||
|
||||
If you installed the CLI globally (e.g., `npm install -g @google/gemini-cli`),
|
||||
use the `npm uninstall` command with the `-g` flag to remove it.
|
||||
If you installed the CLI globally (for example,
|
||||
`npm install -g @google/gemini-cli`), use the `npm uninstall` command with the
|
||||
`-g` flag to remove it.
|
||||
|
||||
```bash
|
||||
npm uninstall -g @google/gemini-cli
|
||||
|
|
@ -39,7 +40,7 @@ This command completely removes the package from your system.
|
|||
|
||||
## Method 3: Homebrew
|
||||
|
||||
If you installed the CLI globally using Homebrew (e.g.,
|
||||
If you installed the CLI globally using Homebrew (for example,
|
||||
`brew install gemini-cli`), use the `brew uninstall` command to remove it.
|
||||
|
||||
```bash
|
||||
|
|
@ -48,7 +49,7 @@ brew uninstall gemini-cli
|
|||
|
||||
## Method 4: MacPorts
|
||||
|
||||
If you installed the CLI globally using MacPorts (e.g.,
|
||||
If you installed the CLI globally using MacPorts (for example,
|
||||
`sudo port install gemini-cli`), use the `port uninstall` command to remove it.
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ confirmation.
|
|||
Each question object has the following properties:
|
||||
- `question` (string, required): The complete question text.
|
||||
- `header` (string, required): A short label (max 16 chars) displayed as a
|
||||
chip/tag (e.g., "Auth", "Database").
|
||||
chip/tag (for example, "Auth", "Database").
|
||||
- `type` (string, optional): The type of question. Defaults to `'choice'`.
|
||||
- `'choice'`: Multiple-choice with options (supports multi-select).
|
||||
- `'text'`: Free-form text input.
|
||||
|
|
@ -35,7 +35,7 @@ confirmation.
|
|||
- Returns the user's answers to the model.
|
||||
|
||||
- **Output (`llmContent`):** A JSON string containing the user's answers,
|
||||
indexed by question position (e.g.,
|
||||
indexed by question position (for example,
|
||||
`{"answers":{"0": "Option A", "1": "Some text"}}`).
|
||||
|
||||
- **Confirmation:** Yes. The tool inherently involves user interaction.
|
||||
|
|
@ -75,7 +75,7 @@ confirmation.
|
|||
"header": "Project Name",
|
||||
"question": "What is the name of your new project?",
|
||||
"type": "text",
|
||||
"placeholder": "e.g., my-awesome-app"
|
||||
"placeholder": "for example, my-awesome-app"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# File system tools reference
|
||||
|
||||
The Gemini CLI core provides a suite of tools for interacting with the local
|
||||
file system. These tools allow the model to explore and modify your codebase.
|
||||
Gemini CLI core provides a suite of tools for interacting with the local file
|
||||
system. These tools allow the model to explore and modify your codebase.
|
||||
|
||||
## Technical reference
|
||||
|
||||
|
|
@ -49,8 +49,8 @@ Finds files matching specific glob patterns across the workspace.
|
|||
- **Display name:** FindFiles
|
||||
- **File:** `glob.ts`
|
||||
- **Parameters:**
|
||||
- `pattern` (string, required): The glob pattern to match against (e.g.,
|
||||
`"*.py"`, `"src/**/*.js"`).
|
||||
- `pattern` (string, required): The glob pattern to match against (for
|
||||
example, `"*.py"`, `"src/**/*.js"`).
|
||||
- `path` (string, optional): The absolute path to the directory to search
|
||||
within. If omitted, searches the tool's root directory.
|
||||
- `case_sensitive` (boolean, optional): Whether the search should be
|
||||
|
|
@ -78,18 +78,18 @@ lines containing matches, along with their file paths and line numbers.
|
|||
- **File:** `grep.ts`
|
||||
- **Parameters:**
|
||||
- `pattern` (string, required): The regular expression (regex) to search for
|
||||
(e.g., `"function\s+myFunction"`).
|
||||
(for example, `"function\s+myFunction"`).
|
||||
- `path` (string, optional): The absolute path to the directory to search
|
||||
within. Defaults to the current working directory.
|
||||
- `include` (string, optional): A glob pattern to filter which files are
|
||||
searched (e.g., `"*.js"`, `"src/**/*.{ts,tsx}"`). If omitted, searches most
|
||||
files (respecting common ignores).
|
||||
searched (for example, `"*.js"`, `"src/**/*.{ts,tsx}"`). If omitted,
|
||||
searches most files (respecting common ignores).
|
||||
- **Behavior:**
|
||||
- Uses `git grep` if available in a Git repository for speed; otherwise, falls
|
||||
back to system `grep` or a JavaScript-based search.
|
||||
- Returns a list of matching lines, each prefixed with its file path (relative
|
||||
to the search directory) and line number.
|
||||
- **Output (`llmContent`):** A formatted string of matches, e.g.:
|
||||
- **Output (`llmContent`):** A formatted string of matches, for example:
|
||||
```
|
||||
Found 3 matches for pattern "myFunction" in path "." (filter: "*.ts"):
|
||||
---
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# MCP servers with the Gemini CLI
|
||||
# MCP servers with Gemini CLI
|
||||
|
||||
This document provides a guide to configuring and using Model Context Protocol
|
||||
(MCP) servers with the Gemini CLI.
|
||||
(MCP) servers with Gemini CLI.
|
||||
|
||||
## What is an MCP server?
|
||||
|
||||
|
|
@ -10,7 +10,7 @@ CLI through the Model Context Protocol, allowing it to interact with external
|
|||
systems and data sources. MCP servers act as a bridge between the Gemini model
|
||||
and your local environment or other services like APIs.
|
||||
|
||||
An MCP server enables the Gemini CLI to:
|
||||
An MCP server enables Gemini CLI to:
|
||||
|
||||
- **Discover tools:** List available tools, their descriptions, and parameters
|
||||
through standardized schema definitions.
|
||||
|
|
@ -19,13 +19,13 @@ An MCP server enables the Gemini CLI to:
|
|||
- **Access resources:** Read data from specific resources that the server
|
||||
exposes (files, API payloads, reports, etc.).
|
||||
|
||||
With an MCP server, you can extend the Gemini CLI's capabilities to perform
|
||||
actions beyond its built-in features, such as interacting with databases, APIs,
|
||||
custom scripts, or specialized workflows.
|
||||
With an MCP server, you can extend Gemini CLI's capabilities to perform actions
|
||||
beyond its built-in features, such as interacting with databases, APIs, custom
|
||||
scripts, or specialized workflows.
|
||||
|
||||
## Core integration architecture
|
||||
|
||||
The Gemini CLI integrates with MCP servers through a sophisticated discovery and
|
||||
Gemini CLI integrates with MCP servers through a sophisticated discovery and
|
||||
execution system built into the core package (`packages/core/src/tools/`):
|
||||
|
||||
### Discovery Layer (`mcp-client.ts`)
|
||||
|
|
@ -54,7 +54,7 @@ Each discovered MCP tool is wrapped in a `DiscoveredMCPTool` instance that:
|
|||
|
||||
### Transport mechanisms
|
||||
|
||||
The Gemini CLI supports three MCP transport types:
|
||||
Gemini CLI supports three MCP transport types:
|
||||
|
||||
- **Stdio Transport:** Spawns a subprocess and communicates via stdin/stdout
|
||||
- **SSE Transport:** Connects to Server-Sent Events endpoints
|
||||
|
|
@ -88,9 +88,9 @@ in the conversation.
|
|||
|
||||
## How to set up your MCP server
|
||||
|
||||
The Gemini CLI uses the `mcpServers` configuration in your `settings.json` file
|
||||
to locate and connect to MCP servers. This configuration supports multiple
|
||||
servers with different transport mechanisms.
|
||||
Gemini CLI uses the `mcpServers` configuration in your `settings.json` file to
|
||||
locate and connect to MCP servers. This configuration supports multiple servers
|
||||
with different transport mechanisms.
|
||||
|
||||
### Configure the MCP server in settings.json
|
||||
|
||||
|
|
@ -155,7 +155,8 @@ Each server configuration supports the following properties:
|
|||
#### Required (one of the following)
|
||||
|
||||
- **`command`** (string): Path to the executable for Stdio transport
|
||||
- **`url`** (string): SSE endpoint URL (e.g., `"http://localhost:8080/sse"`)
|
||||
- **`url`** (string): SSE endpoint URL (for example,
|
||||
`"http://localhost:8080/sse"`)
|
||||
- **`httpUrl`** (string): HTTP streaming endpoint URL
|
||||
|
||||
#### Optional
|
||||
|
|
@ -188,7 +189,7 @@ Each server configuration supports the following properties:
|
|||
### Environment variable expansion
|
||||
|
||||
Gemini CLI automatically expands environment variables in the `env` block of
|
||||
your MCP server configuration. This allows you to securely reference variables
|
||||
your MCP server configuration. This lets you securely reference variables
|
||||
defined in your shell or environment without hardcoding sensitive information
|
||||
directly in your `settings.json` file.
|
||||
|
||||
|
|
@ -241,13 +242,14 @@ specific data with that server.
|
|||
<!-- prettier-ignore -->
|
||||
> [!NOTE]
|
||||
> Even when explicitly defined, you should avoid hardcoding secrets.
|
||||
> Instead, use environment variable expansion (e.g., `"MY_KEY": "$MY_KEY"`) to
|
||||
> securely pull the value from your host environment at runtime.
|
||||
> Instead, use environment variable expansion
|
||||
> (for example, `"MY_KEY": "$MY_KEY"`) to securely pull the value from your host
|
||||
> environment at runtime.
|
||||
|
||||
### OAuth support for remote MCP servers
|
||||
|
||||
The Gemini CLI supports OAuth 2.0 authentication for remote MCP servers using
|
||||
SSE or HTTP transports. This enables secure access to MCP servers that require
|
||||
Gemini CLI supports OAuth 2.0 authentication for remote MCP servers using SSE or
|
||||
HTTP transports. This enables secure access to MCP servers that require
|
||||
authentication.
|
||||
|
||||
#### Automatic OAuth discovery
|
||||
|
|
@ -403,7 +405,7 @@ then be used to authenticate with the MCP server.
|
|||
5. **Grant all users and groups** who will access the MCP Server the necessary
|
||||
permissions to
|
||||
[impersonate the service account](https://cloud.google.com/docs/authentication/use-service-account-impersonation)
|
||||
(i.e., `roles/iam.serviceAccountTokenCreator`).
|
||||
(for example, `roles/iam.serviceAccountTokenCreator`).
|
||||
6. **[Enable](https://console.cloud.google.com/apis/library/iamcredentials.googleapis.com)
|
||||
the IAM Credentials API** for your project.
|
||||
|
||||
|
|
@ -532,8 +534,8 @@ then be used to authenticate with the MCP server.
|
|||
|
||||
## Discovery process deep dive
|
||||
|
||||
When the Gemini CLI starts, it performs MCP server discovery through the
|
||||
following detailed process:
|
||||
When Gemini CLI starts, it performs MCP server discovery through the following
|
||||
detailed process:
|
||||
|
||||
### 1. Server iteration and connection
|
||||
|
||||
|
|
@ -583,7 +585,7 @@ every discovered MCP tool is assigned a strict namespace.
|
|||
|
||||
<!-- prettier-ignore -->
|
||||
> [!WARNING]
|
||||
> Do not use underscores (`_`) in your MCP server names (e.g., use
|
||||
> Do not use underscores (`_`) in your MCP server names (for example, use
|
||||
> `my-server` rather than `my_server`). The policy parser splits Fully Qualified
|
||||
> Names (`mcp_server_tool`) on the _first_ underscore following the `mcp_`
|
||||
> prefix. If your server name contains an underscore, the parser will
|
||||
|
|
@ -888,7 +890,7 @@ use.
|
|||
|
||||
MCP tools are not limited to returning simple text. You can return rich,
|
||||
multi-part content, including text, images, audio, and other binary data in a
|
||||
single tool response. This allows you to build powerful tools that can provide
|
||||
single tool response. This lets you build powerful tools that can provide
|
||||
diverse information to the model in a single turn.
|
||||
|
||||
All data returned from the tool is processed and sent to the model as context
|
||||
|
|
@ -901,8 +903,8 @@ To return rich content, your tool's response must adhere to the MCP
|
|||
specification for a
|
||||
[`CallToolResult`](https://modelcontextprotocol.io/specification/2025-06-18/server/tools#tool-result).
|
||||
The `content` field of the result should be an array of `ContentBlock` objects.
|
||||
The Gemini CLI will correctly process this array, separating text from binary
|
||||
data and packaging it for the model.
|
||||
Gemini CLI will correctly process this array, separating text from binary data
|
||||
and packaging it for the model.
|
||||
|
||||
You can mix and match different content block types in the `content` array. The
|
||||
supported block types include:
|
||||
|
|
@ -938,7 +940,7 @@ text description and an image:
|
|||
}
|
||||
```
|
||||
|
||||
When the Gemini CLI receives this response, it will:
|
||||
When Gemini CLI receives this response, it will:
|
||||
|
||||
1. Extract all the text and combine it into a single `functionResponse` part
|
||||
for the model.
|
||||
|
|
@ -952,8 +954,8 @@ context to the Gemini model.
|
|||
## MCP prompts as slash commands
|
||||
|
||||
In addition to tools, MCP servers can expose predefined prompts that can be
|
||||
executed as slash commands within the Gemini CLI. This allows you to create
|
||||
shortcuts for common or complex queries that can be easily invoked by name.
|
||||
executed as slash commands within Gemini CLI. This lets you create shortcuts for
|
||||
common or complex queries that can be easily invoked by name.
|
||||
|
||||
### Defining prompts on the server
|
||||
|
||||
|
|
@ -1021,8 +1023,8 @@ or, using positional arguments:
|
|||
/poem-writer "Gemini CLI" reverent
|
||||
```
|
||||
|
||||
When you run this command, the Gemini CLI executes the `prompts/get` method on
|
||||
the MCP server with the provided arguments. The server is responsible for
|
||||
When you run this command, Gemini CLI executes the `prompts/get` method on the
|
||||
MCP server with the provided arguments. The server is responsible for
|
||||
substituting the arguments into the prompt template and returning the final
|
||||
prompt text. The CLI then sends this prompt to the model for execution. This
|
||||
provides a convenient way to automate and share common workflows.
|
||||
|
|
@ -1030,10 +1032,10 @@ provides a convenient way to automate and share common workflows.
|
|||
## Managing MCP servers with `gemini mcp`
|
||||
|
||||
While you can always configure MCP servers by manually editing your
|
||||
`settings.json` file, the Gemini CLI provides a convenient set of commands to
|
||||
manage your server configurations programmatically. These commands streamline
|
||||
the process of adding, listing, and removing MCP servers without needing to
|
||||
directly edit JSON files.
|
||||
`settings.json` file, Gemini CLI provides a convenient set of commands to manage
|
||||
your server configurations programmatically. These commands streamline the
|
||||
process of adding, listing, and removing MCP servers without needing to directly
|
||||
edit JSON files.
|
||||
|
||||
### Adding a server (`gemini mcp add`)
|
||||
|
||||
|
|
@ -1056,9 +1058,9 @@ gemini mcp add [options] <name> <commandOrUrl> [args...]
|
|||
|
||||
- `-s, --scope`: Configuration scope (user or project). [default: "project"]
|
||||
- `-t, --transport`: Transport type (stdio, sse, http). [default: "stdio"]
|
||||
- `-e, --env`: Set environment variables (e.g. -e KEY=value).
|
||||
- `-H, --header`: Set HTTP headers for SSE and HTTP transports (e.g. -H
|
||||
"X-Api-Key: abc123" -H "Authorization: Bearer abc123").
|
||||
- `-e, --env`: Set environment variables (for example, `-e KEY=value`).
|
||||
- `-H, --header`: Set HTTP headers for SSE and HTTP transports (for example,
|
||||
`-H "X-Api-Key: abc123" -H "Authorization: Bearer abc123"`).
|
||||
- `--timeout`: Set connection timeout in milliseconds.
|
||||
- `--trust`: Trust the server (bypass all tool call confirmation prompts).
|
||||
- `--description`: Set the description for the server.
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ The tool returns a JSON object containing:
|
|||
## Configuration
|
||||
|
||||
You can configure the behavior of the `run_shell_command` tool by modifying your
|
||||
`settings.json` file or by using the `/settings` command in the Gemini CLI.
|
||||
`settings.json` file or by using the `/settings` command in Gemini CLI.
|
||||
|
||||
### Enabling interactive commands
|
||||
|
||||
|
|
@ -93,9 +93,9 @@ applies when `tools.shell.enableInteractiveShell` is enabled.
|
|||
## Interactive commands
|
||||
|
||||
The `run_shell_command` tool now supports interactive commands by integrating a
|
||||
pseudo-terminal (pty). This allows you to run commands that require real-time
|
||||
user input, such as text editors (`vim`, `nano`), terminal-based UIs (`htop`),
|
||||
and interactive version control operations (`git rebase -i`).
|
||||
pseudo-terminal (pty). This lets you run commands that require real-time user
|
||||
input, such as text editors (`vim`, `nano`), terminal-based UIs (`htop`), and
|
||||
interactive version control operations (`git rebase -i`).
|
||||
|
||||
When an interactive command is running, you can send input to it from the Gemini
|
||||
CLI. To focus on the interactive shell, press `Tab`. The terminal output,
|
||||
|
|
@ -116,7 +116,7 @@ including complex TUIs, will be rendered correctly.
|
|||
|
||||
When `run_shell_command` executes a command, it sets the `GEMINI_CLI=1`
|
||||
environment variable in the subprocess's environment. This allows scripts or
|
||||
tools to detect if they are being run from within the Gemini CLI.
|
||||
tools to detect if they are being run from within Gemini CLI.
|
||||
|
||||
## Command restrictions
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue