mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-08-02 05:01:04 -07:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 236af8bb0a | |||
| 013f984842 | |||
| f01890b073 | |||
| 7beccfa03c | |||
| a640766f10 | |||
| 9f55fb5010 | |||
| ea3d022c8b | |||
| 313688fd18 | |||
| 843b019cef | |||
| 80ef6f854b | |||
| 316349ca61 | |||
| 179010eb3b |
@@ -1,54 +0,0 @@
|
||||
description="Injects context of all relevant cli files"
|
||||
prompt = """
|
||||
The source code contains the content of absolutely every source code file in
|
||||
packages/cli. In addition to the source code, the following test files are
|
||||
included as they are test files that conform to the project's testing standards:
|
||||
`packages/cli/src/ui/components/InputPrompt.test.tsx` and `packages/cli/src/ui/App.test.tsx`.
|
||||
You should very rarely need to read any other files from packages/cli to resolve
|
||||
prompts.
|
||||
|
||||
!{find packages/cli -path packages/cli/dist -prune -o -type f \\( -name "*.ts" -o -name "*.tsx" \\) ! -name "*.test.ts" ! -name "*.test.tsx" ! -name "*.d.ts" -exec echo "--- {} ---" \\; -exec cat {} \\; && echo "--- packages/cli/src/ui/components/InputPrompt.test.tsx ---" && cat packages/cli/src/ui/components/InputPrompt.test.tsx && echo "--- packages/cli/src/ui/App.test.tsx ---" && cat packages/cli/src/ui/App.test.tsx}
|
||||
|
||||
**Pay extremely close attention to these files.** They define the project's
|
||||
core architecture, component patterns, and testing standards.
|
||||
|
||||
In addition to the code context, you MUST strictly adhere to the following frontend-specific development guidelines while adding code to packages/cli.
|
||||
|
||||
## Testing Standards
|
||||
* **Async Testing**: ALWAYS use `waitFor` from `packages/cli/src/test-utils/async.ts` instead of `vi.waitFor` to prevent flakiness and `act` warnings. NEVER use fixed waits (e.g., `await delay(100)`).
|
||||
* **State Changes**: Wrap all blocks that change component state in `act`.
|
||||
* **Snapshots**: Use `toMatchSnapshot` to verify rendering.
|
||||
* **Rendering**: Use `render` or `renderWithProviders` from `packages/cli/src/test-utils/render.tsx` instead of `ink-testing-library` directly.
|
||||
* **Mocking**:
|
||||
* Reuse existing mocks/fakes where possible.
|
||||
* **Parameterized Tests**: Use parameterized tests with explicit types to reduce duplication and ensure type safety.
|
||||
* Avoid mocking the file system, os, or child_process if at all possible; if you have to mock the Mock critical dependencies (`fs`, `os`, `child_process`) do so ONLY at the top of the file.
|
||||
|
||||
## React & Ink Architecture
|
||||
* **Keyboard Handling**: You MUST use `useKeyPress.ts` from Gemini CLI for keyboard handling, NOT the standard ink library. This is critical for supporting slow terminals and multiple events per frame.
|
||||
* Handle multiple events gracefully (often requires a reducer pattern, see `text-buffer.ts`).
|
||||
* **State Management**:
|
||||
* NEVER trigger side effects from within the body of a `setState` callback. Use a reducer or `useRef` if necessary.
|
||||
* Initialize state explicitly (e.g., use `undefined` rather than `true` if unknown).
|
||||
* **Performance**:
|
||||
* Avoid synchronous file I/O in components.
|
||||
* Do not introduce excessive property drilling; leverage or extend existing providers.
|
||||
|
||||
## Configuration & Settings
|
||||
* **Settings vs Args**: Use settings for user-configurable options; do not add new CLI arguments.
|
||||
* **Schema**: Add new settings to `packages/cli/src/config/settingsSchema.ts`.
|
||||
* **Documentation**:
|
||||
* If `showInDialog: true`, document in `docs/get-started/configuration.md`.
|
||||
* Ensure `requiresRestart` is correctly set.
|
||||
|
||||
## Keyboard Shortcuts
|
||||
* **Registration**: Define new shortcuts in `packages/cli/src/config/keyBindings.ts`.
|
||||
* **Documentation**: Document all new shortcuts in `docs/cli/keyboard-shortcuts.md`.
|
||||
* **Compatibility**: Avoid function keys and common VSCode shortcuts. Be cautious with `Meta` key (Mac-limited support).
|
||||
|
||||
## General
|
||||
* **Logging**: Use `debugLogger` for errors. NEVER leave `console.log/warn/error` in the code.
|
||||
* **TypeScript**: Avoid the non-null assertion operator (`!`).
|
||||
|
||||
{{args}}.
|
||||
"""
|
||||
@@ -1,57 +0,0 @@
|
||||
description="Injects context of all relevant cli files"
|
||||
prompt = """
|
||||
The following output contains the complete
|
||||
source code of the gemini cli library (`packages/cli`), and {packages/core} and representative test files
|
||||
(`packages/cli/src/ui/components/InputPrompt.test.tsx` and `packages/cli/src/ui/App.test.tsx`) that best conform to the project's testing standards.
|
||||
**Pay extremely close attention to these files.** They define the project's
|
||||
core architecture, component patterns, and testing standards.
|
||||
|
||||
The source code contains the content of absolutely every source code file in
|
||||
packages/cli and packages/core. In addition to the source code, the following test files are
|
||||
included as they are test files that conform to the project's testing standards:
|
||||
`packages/cli/src/ui/components/InputPrompt.test.tsx` and `packages/cli/src/ui/App.test.tsx`.
|
||||
You should very rarely need to read any other files from packages/cli to resolve
|
||||
prompts.
|
||||
|
||||
!{find packages/cli packages/core \\( -path packages/cli/dist -o -path packages/core/dist -o -name node_modules \\) -prune -o -type f \\( -name "*.ts" -o -name "*.tsx" \\) ! -name "*.test.ts" ! -name "*.test.tsx" ! -name "*.d.ts" -exec echo "--- {} ---" \\; -exec cat {} \\; && echo "--- packages/cli/src/ui/components/InputPrompt.test.tsx ---" && cat packages/cli/src/ui/components/InputPrompt.test.tsx && echo "--- packages/cli/src/ui/App.test.tsx ---" && cat packages/cli/src/ui/App.test.tsx}
|
||||
|
||||
In addition to the code context, you MUST strictly adhere to the following frontend-specific development guidelines when writing code in packages/cli.
|
||||
|
||||
## Testing Standards
|
||||
* **Async Testing**: ALWAYS use `waitFor` from `packages/cli/src/test-utils/async.ts` instead of `vi.waitFor` to prevent flakiness and `act` warnings. NEVER use fixed waits (e.g., `await delay(100)`).
|
||||
* **State Changes**: Wrap all blocks that change component state in `act`.
|
||||
* **Snapshots**: Use `toMatchSnapshot` to verify rendering.
|
||||
* **Rendering**: Use `render` or `renderWithProviders` from `packages/cli/src/test-utils/render.tsx` instead of `ink-testing-library` directly.
|
||||
* **Mocking**:
|
||||
* Reuse existing mocks/fakes where possible.
|
||||
* **Parameterized Tests**: Use parameterized tests with explicit types to reduce duplication and ensure type safety.
|
||||
* Avoid mocking the file system, os, or child_process if at all possible; if you have to mock the Mock critical dependencies (`fs`, `os`, `child_process`) do so ONLY at the top of the file.
|
||||
|
||||
## React & Ink Architecture
|
||||
* **Keyboard Handling**: You MUST use `useKeyPress.ts` from Gemini CLI for keyboard handling, NOT the standard ink library. This is critical for supporting slow terminals and multiple events per frame.
|
||||
* Handle multiple events gracefully (often requires a reducer pattern, see `text-buffer.ts`).
|
||||
* **State Management**:
|
||||
* NEVER trigger side effects from within the body of a `setState` callback. Use a reducer or `useRef` if necessary.
|
||||
* Initialize state explicitly (e.g., use `undefined` rather than `true` if unknown).
|
||||
* **Performance**:
|
||||
* Avoid synchronous file I/O in components.
|
||||
* Do not introduce excessive property drilling; leverage or extend existing providers.
|
||||
|
||||
## Configuration & Settings
|
||||
* **Settings vs Args**: Use settings for user-configurable options; do not add new CLI arguments.
|
||||
* **Schema**: Add new settings to `packages/cli/src/config/settingsSchema.ts`.
|
||||
* **Documentation**:
|
||||
* If `showInDialog: true`, document in `docs/get-started/configuration.md`.
|
||||
* Ensure `requiresRestart` is correctly set.
|
||||
|
||||
## Keyboard Shortcuts
|
||||
* **Registration**: Define new shortcuts in `packages/cli/src/config/keyBindings.ts`.
|
||||
* **Documentation**: Document all new shortcuts in `docs/cli/keyboard-shortcuts.md`.
|
||||
* **Compatibility**: Avoid function keys and common VSCode shortcuts. Be cautious with `Meta` key (Mac-limited support).
|
||||
|
||||
## General
|
||||
* **Logging**: Use `debugLogger` for errors. NEVER leave `console.log/warn/error` in the code.
|
||||
* **TypeScript**: Avoid the non-null assertion operator (`!`).
|
||||
|
||||
{{args}}.
|
||||
"""
|
||||
@@ -2,6 +2,7 @@ name: 'Bug Report'
|
||||
description: 'Report a bug to help us improve Gemini CLI'
|
||||
labels:
|
||||
- 'status/need-triage'
|
||||
type: 'Bug'
|
||||
body:
|
||||
- type: 'markdown'
|
||||
attributes:
|
||||
|
||||
@@ -262,8 +262,7 @@ runs:
|
||||
--target "${{ steps.release_branch.outputs.BRANCH_NAME }}" \
|
||||
--title "Release ${{ inputs.release-tag }}" \
|
||||
--notes-start-tag "${{ inputs.previous-tag }}" \
|
||||
--generate-notes \
|
||||
${{ inputs.npm-tag != 'latest' && '--prerelease' || '' }}
|
||||
--generate-notes
|
||||
|
||||
- name: '🧹 Clean up release branch'
|
||||
working-directory: '${{ inputs.working-directory }}'
|
||||
|
||||
@@ -75,4 +75,4 @@ runs:
|
||||
gh issue create \
|
||||
--title "Docker build failed" \
|
||||
--body "The docker build failed. See the full run for details: ${DETAILS_URL}" \
|
||||
--label "release-failure"
|
||||
--label "kind/bug,release-failure"
|
||||
|
||||
@@ -93,4 +93,4 @@ runs:
|
||||
gh issue create \
|
||||
--title "Docker build failed" \
|
||||
--body "The docker build failed. See the full run for details: ${DETAILS_URL}" \
|
||||
--label "release-failure"
|
||||
--label "kind/bug,release-failure"
|
||||
|
||||
@@ -108,7 +108,7 @@ jobs:
|
||||
- name: 'Link Checker'
|
||||
uses: 'lycheeverse/lychee-action@885c65f3dc543b57c898c8099f4e08c8afd178a2' # ratchet: lycheeverse/lychee-action@v2.6.1
|
||||
with:
|
||||
args: '--verbose --accept 200,503 ./**/*.md'
|
||||
args: '--verbose ./**/*.md'
|
||||
fail: true
|
||||
test_linux:
|
||||
name: 'Test (Linux)'
|
||||
|
||||
@@ -20,4 +20,4 @@ jobs:
|
||||
id: 'lychee'
|
||||
uses: 'lycheeverse/lychee-action@885c65f3dc543b57c898c8099f4e08c8afd178a2' # ratchet: lycheeverse/lychee-action@v2.6.1
|
||||
with:
|
||||
args: '--verbose --no-progress --accept 200,503 ./**/*.md'
|
||||
args: '--verbose --no-progress ./**/*.md'
|
||||
|
||||
@@ -132,4 +132,4 @@ jobs:
|
||||
gh issue create \
|
||||
--title 'Manual Release Failed for ${RELEASE_TAG} on $(date +'%Y-%m-%d')' \
|
||||
--body 'The manual release workflow failed. See the full run for details: ${DETAILS_URL}' \
|
||||
--label 'release-failure,priority/p0'
|
||||
--label 'kind/bug,release-failure,priority/p0'
|
||||
|
||||
@@ -157,4 +157,4 @@ jobs:
|
||||
gh issue create \
|
||||
--title "Nightly Release Failed for ${RELEASE_TAG} on $(date +'%Y-%m-%d')" \
|
||||
--body "The nightly-release workflow failed. See the full run for details: ${DETAILS_URL}" \
|
||||
--label 'release-failure,priority/p0'
|
||||
--label 'kind/bug,release-failure,priority/p0'
|
||||
|
||||
@@ -205,7 +205,7 @@ jobs:
|
||||
gh issue create \
|
||||
--title 'Patch Release Failed for ${RELEASE_TAG} on $(date +'%Y-%m-%d')' \
|
||||
--body 'The patch-release workflow failed. See the full run for details: ${DETAILS_URL}' \
|
||||
--label 'release-failure,priority/p0'
|
||||
--label 'kind/bug,release-failure,priority/p0'
|
||||
|
||||
- name: 'Comment Success on Original PR'
|
||||
if: '${{ success() && github.event.inputs.original_pr }}'
|
||||
|
||||
@@ -261,7 +261,7 @@ jobs:
|
||||
gh issue create \
|
||||
--title 'Promote Release Failed for ${RELEASE_TAG} on $(date +'%Y-%m-%d')' \
|
||||
--body 'The promote-release workflow failed during preview publish. See the full run for details: ${DETAILS_URL}' \
|
||||
--label 'release-failure,priority/p0'
|
||||
--label 'kind/bug,release-failure,priority/p0'
|
||||
|
||||
publish-stable:
|
||||
name: 'Publish stable'
|
||||
@@ -327,7 +327,7 @@ jobs:
|
||||
gh issue create \
|
||||
--title 'Promote Release Failed for ${RELEASE_TAG} on $(date +'%Y-%m-%d')' \
|
||||
--body 'The promote-release workflow failed during stable publish. See the full run for details: ${DETAILS_URL}' \
|
||||
--label 'release-failure,priority/p0'
|
||||
--label 'kind/bug,release-failure,priority/p0'
|
||||
|
||||
nightly-pr:
|
||||
name: 'Create Nightly PR'
|
||||
@@ -403,4 +403,4 @@ jobs:
|
||||
gh issue create \
|
||||
--title 'Promote Release Failed for ${RELEASE_TAG} on $(date +'%Y-%m-%d')' \
|
||||
--body 'The promote-release workflow failed during nightly PR creation. See the full run for details: ${DETAILS_URL}' \
|
||||
--label 'release-failure,priority/p0'
|
||||
--label 'kind/bug,release-failure,priority/p0'
|
||||
|
||||
@@ -46,4 +46,4 @@ jobs:
|
||||
gh issue create \
|
||||
--title 'Sandbox Release Failed on $(date +'%Y-%m-%d')' \
|
||||
--body 'The sandbox-release workflow failed. See the full run for details: ${DETAILS_URL}' \
|
||||
--label 'release-failure,priority/p0'
|
||||
--label 'kind/bug,release-failure,priority/p0'
|
||||
|
||||
@@ -47,4 +47,4 @@ jobs:
|
||||
gh issue create \
|
||||
--title 'Smoke test failed on ${REF} @ $(date +'%Y-%m-%d')' \
|
||||
--body 'Smoke test build failed. See the full run for details: ${DETAILS_URL}' \
|
||||
--label 'priority/p0'
|
||||
--label 'kind/bug,priority/p0'
|
||||
|
||||
@@ -18,4 +18,3 @@ eslint.config.js
|
||||
gha-creds-*.json
|
||||
junit.xml
|
||||
Thumbs.db
|
||||
.pytest_cache
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# How to contribute
|
||||
# How to Contribute
|
||||
|
||||
We would love to accept your patches and contributions to this project. This
|
||||
document includes:
|
||||
|
||||
@@ -363,38 +363,12 @@ performance.
|
||||
- State updates should be structured to enable granular updates
|
||||
- Side effects should be isolated and dependencies clearly defined
|
||||
|
||||
## Documentation guidelines
|
||||
|
||||
When working in the `/docs` directory, follow the guidelines in this section:
|
||||
|
||||
- **Role:** You are an expert technical writer and AI assistant for contributors
|
||||
to Gemini CLI. Produce professional, accurate, and consistent documentation to
|
||||
guide users of Gemini CLI.
|
||||
- **Technical Accuracy:** Do not invent facts, commands, code, API names, or
|
||||
output. All technical information specific to Gemini CLI must be based on code
|
||||
found within this directory and its subdirectories.
|
||||
- **Style Authority:** Your source for writing guidance and style is the
|
||||
"Documentation contribution process" section in the root directory's
|
||||
`CONTRIBUTING.md` file, as well as any guidelines provided this section.
|
||||
- **Information Architecture Consideration:** Before proposing documentation
|
||||
changes, consider the information architecture. If a change adds significant
|
||||
new content to existing documents, evaluate if creating a new, more focused
|
||||
page or changes to `sidebar.json` would provide a better user experience.
|
||||
- **Proactive User Consideration:** The user experience should be a primary
|
||||
concern when making changes to documentation. Aim to fill gaps in existing
|
||||
knowledge whenever possible while keeping documentation concise and easy for
|
||||
users to understand. If changes might hinder user understanding or
|
||||
accessibility, proactively raise these concerns and propose alternatives.
|
||||
|
||||
## Comments policy
|
||||
|
||||
Only write high-value comments if at all. Avoid talking to the user through
|
||||
comments.
|
||||
|
||||
## General requirements
|
||||
## General style requirements
|
||||
|
||||
- If there is something you do not understand or is ambiguous, seek confirmation
|
||||
or clarification from the user before making changes based on assumptions.
|
||||
- Use hyphens instead of underscores in flag names (e.g. `my-flag` instead of
|
||||
`my_flag`).
|
||||
- Always refer to Gemini CLI as `Gemini CLI`, never `the Gemini CLI`.
|
||||
Use hyphens instead of underscores in flag names (e.g. `my-flag` instead of
|
||||
`my_flag`).
|
||||
|
||||
@@ -187,7 +187,7 @@
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
Copyright 2025 Google LLC
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
[](https://github.com/google-gemini/gemini-cli/actions/workflows/e2e.yml)
|
||||
[](https://www.npmjs.com/package/@google/gemini-cli)
|
||||
[](https://github.com/google-gemini/gemini-cli/blob/main/LICENSE)
|
||||
[](https://codewiki.google/github.com/google-gemini/gemini-cli)
|
||||
<a href="https://codewiki.google/github.com/google-gemini/gemini-cli"><img src="https://www.gstatic.com/_/boq-sdlc-agents-ui/_/r/Mvosg4klCA4.svg" alt="Ask Code Wiki" height="20"></a>
|
||||
|
||||

|
||||
|
||||
@@ -80,9 +80,9 @@ npm install -g @google/gemini-cli@latest
|
||||
|
||||
### Nightly
|
||||
|
||||
- New releases will be published each day at UTC 0000. This will be all changes
|
||||
from the main branch as represented at time of release. It should be assumed
|
||||
there are pending validations and issues. Use `nightly` tag.
|
||||
- New releases will be published each week at UTC 0000 each day, This will be
|
||||
all changes from the main branch as represented at time of release. It should
|
||||
be assumed there are pending validations and issues. Use `nightly` tag.
|
||||
|
||||
```bash
|
||||
npm install -g @google/gemini-cli@nightly
|
||||
|
||||
@@ -37,7 +37,7 @@ input:
|
||||
- **Interaction:** `packages/core` invokes these tools based on requests
|
||||
from the Gemini model.
|
||||
|
||||
## Interaction flow
|
||||
## Interaction Flow
|
||||
|
||||
A typical interaction with the Gemini CLI follows this flow:
|
||||
|
||||
@@ -69,7 +69,7 @@ A typical interaction with the Gemini CLI follows this flow:
|
||||
7. **Display to user:** The CLI package formats and displays the response to
|
||||
the user in the terminal.
|
||||
|
||||
## Key design principles
|
||||
## Key Design Principles
|
||||
|
||||
- **Modularity:** Separating the CLI (frontend) from the Core (backend) allows
|
||||
for independent development and potential future extensions (e.g., different
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 350 KiB |
@@ -1,3 +1,3 @@
|
||||
# Authentication setup
|
||||
# Authentication Setup
|
||||
|
||||
See: [Getting Started - Authentication Setup](../get-started/authentication.md).
|
||||
|
||||
@@ -6,19 +6,19 @@ AI-powered tools. This allows you to safely experiment with and apply code
|
||||
changes, knowing you can instantly revert back to the state before the tool was
|
||||
run.
|
||||
|
||||
## How it works
|
||||
## How It Works
|
||||
|
||||
When you approve a tool that modifies the file system (like `write_file` or
|
||||
`replace`), the CLI automatically creates a "checkpoint." This checkpoint
|
||||
includes:
|
||||
|
||||
1. **A Git snapshot:** A commit is made in a special, shadow Git repository
|
||||
1. **A Git Snapshot:** A commit is made in a special, shadow Git repository
|
||||
located in your home directory (`~/.gemini/history/<project_hash>`). This
|
||||
snapshot captures the complete state of your project files at that moment.
|
||||
It does **not** interfere with your own project's Git repository.
|
||||
2. **Conversation history:** The entire conversation you've had with the agent
|
||||
2. **Conversation History:** The entire conversation you've had with the agent
|
||||
up to that point is saved.
|
||||
3. **The tool call:** The specific tool call that was about to be executed is
|
||||
3. **The Tool Call:** The specific tool call that was about to be executed is
|
||||
also stored.
|
||||
|
||||
If you want to undo the change or simply go back, you can use the `/restore`
|
||||
@@ -35,7 +35,7 @@ repository while the conversation history and tool calls are saved in a JSON
|
||||
file in your project's temporary directory, typically located at
|
||||
`~/.gemini/tmp/<project_hash>/checkpoints`.
|
||||
|
||||
## Enabling the feature
|
||||
## Enabling the Feature
|
||||
|
||||
The Checkpointing feature is disabled by default. To enable it, you need to edit
|
||||
your `settings.json` file.
|
||||
@@ -56,12 +56,12 @@ Add the following key to your `settings.json`:
|
||||
}
|
||||
```
|
||||
|
||||
## Using the `/restore` command
|
||||
## Using the `/restore` Command
|
||||
|
||||
Once enabled, checkpoints are created automatically. To manage them, you use the
|
||||
`/restore` command.
|
||||
|
||||
### List available checkpoints
|
||||
### List Available Checkpoints
|
||||
|
||||
To see a list of all saved checkpoints for the current project, simply run:
|
||||
|
||||
@@ -74,7 +74,7 @@ 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.,
|
||||
`2025-06-22T10-00-00_000Z-my-file.txt-write_file`).
|
||||
|
||||
### Restore a specific checkpoint
|
||||
### Restore a Specific Checkpoint
|
||||
|
||||
To restore your project to a specific checkpoint, use the checkpoint file from
|
||||
the list:
|
||||
|
||||
+6
-21
@@ -1,4 +1,4 @@
|
||||
# CLI commands
|
||||
# CLI Commands
|
||||
|
||||
Gemini CLI supports several built-in commands to help you manage your session,
|
||||
customize the interface, and control its behavior. These commands are prefixed
|
||||
@@ -26,7 +26,7 @@ Slash commands provide meta-level control over the CLI itself.
|
||||
- **Description:** Saves the current conversation history. You must add a
|
||||
`<tag>` for identifying the conversation state.
|
||||
- **Usage:** `/chat save <tag>`
|
||||
- **Details on checkpoint location:** The default locations for saved chat
|
||||
- **Details on Checkpoint Location:** The default locations for saved chat
|
||||
checkpoints are:
|
||||
- Linux/macOS: `~/.gemini/tmp/<project_hash>/`
|
||||
- Windows: `C:\Users\<YourUsername>\.gemini\tmp\<project_hash>\`
|
||||
@@ -164,21 +164,6 @@ Slash commands provide meta-level control over the CLI itself.
|
||||
- **Note:** Only available if checkpointing is configured via
|
||||
[settings](../get-started/configuration.md). See
|
||||
[Checkpointing documentation](../cli/checkpointing.md) for more details.
|
||||
- **`/resume`**
|
||||
- **Description:** Browse and resume previous conversation sessions. Opens an
|
||||
interactive session browser where you can search, filter, and select from
|
||||
automatically saved conversations.
|
||||
- **Features:**
|
||||
- **Session Browser:** Interactive interface showing all saved sessions with
|
||||
timestamps, message counts, and first user message for context
|
||||
- **Search:** Use `/` to search through conversation content across all
|
||||
sessions
|
||||
- **Sorting:** Sort sessions by date or message count
|
||||
- **Management:** Delete unwanted sessions directly from the browser
|
||||
- **Resume:** Select any session to resume and continue the conversation
|
||||
- **Note:** All conversations are automatically saved as you chat - no manual
|
||||
saving required. See [Session Management](../cli/session-management.md) for
|
||||
complete details.
|
||||
|
||||
- [**`/settings`**](./settings.md)
|
||||
- **Description:** Open the settings editor to view and modify Gemini CLI
|
||||
@@ -256,13 +241,13 @@ Slash commands provide meta-level control over the CLI itself.
|
||||
file, making it simpler for them to provide project-specific instructions to
|
||||
the Gemini agent.
|
||||
|
||||
### Custom commands
|
||||
### 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](./custom-commands.md).
|
||||
|
||||
## Input prompt shortcuts
|
||||
## Input Prompt Shortcuts
|
||||
|
||||
These shortcuts apply directly to the input prompt for text manipulation.
|
||||
|
||||
@@ -320,7 +305,7 @@ your prompt to Gemini. These commands include git-aware filtering.
|
||||
- If the `read_many_files` tool encounters an error (e.g., permission issues),
|
||||
this will also be reported.
|
||||
|
||||
## Shell mode and passthrough commands (`!`)
|
||||
## Shell mode & passthrough commands (`!`)
|
||||
|
||||
The `!` prefix lets you interact with your system's shell directly from within
|
||||
Gemini CLI.
|
||||
@@ -348,7 +333,7 @@ Gemini CLI.
|
||||
- **Caution for all `!` usage:** Commands you execute in shell mode have the
|
||||
same permissions and impact as if you ran them directly in your terminal.
|
||||
|
||||
- **Environment variable:** When a command is executed via `!` or in shell mode,
|
||||
- **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.
|
||||
|
||||
+30
-42
@@ -1,4 +1,4 @@
|
||||
# Gemini CLI configuration
|
||||
# Gemini CLI Configuration
|
||||
|
||||
Gemini CLI offers several ways to configure its behavior, including environment
|
||||
variables, command-line arguments, and settings files. This document outlines
|
||||
@@ -144,7 +144,7 @@ contain other project-specific files related to Gemini CLI's operation, such as:
|
||||
be ignored if `--allowed-mcp-server-names` is set.
|
||||
- **Default**: No MCP servers excluded.
|
||||
- **Example:** `"excludeMCPServers": ["myNodeServer"]`.
|
||||
- **Security note:** This uses simple string matching on MCP server names,
|
||||
- **Security Note:** This uses simple string matching on MCP server names,
|
||||
which can be modified. If you're a system administrator looking to prevent
|
||||
users from bypassing this, consider configuring the `mcpServers` at the
|
||||
system settings level such that the user will not be able to configure any
|
||||
@@ -423,7 +423,7 @@ contain other project-specific files related to Gemini CLI's operation, such as:
|
||||
}
|
||||
```
|
||||
|
||||
## Shell history
|
||||
## Shell History
|
||||
|
||||
The CLI keeps a history of shell commands you run. To avoid conflicts between
|
||||
different projects, this history is stored in a project-specific directory
|
||||
@@ -434,7 +434,7 @@ within your user's home folder.
|
||||
path.
|
||||
- The history is stored in a file named `shell_history`.
|
||||
|
||||
## Environment variables and `.env` files
|
||||
## Environment Variables & `.env` Files
|
||||
|
||||
Environment variables are a common way to configure applications, especially for
|
||||
sensitive information like API keys or for settings that might change between
|
||||
@@ -449,7 +449,7 @@ loading order is:
|
||||
the home directory.
|
||||
3. If still not found, it looks for `~/.env` (in the user's home directory).
|
||||
|
||||
**Environment variable exclusion:** Some environment variables (like `DEBUG` and
|
||||
**Environment Variable Exclusion:** Some environment variables (like `DEBUG` and
|
||||
`DEBUG_MODE`) are automatically excluded from being loaded from project `.env`
|
||||
files to prevent interference with gemini-cli behavior. Variables from
|
||||
`.gemini/.env` files are never excluded. You can customize this behavior using
|
||||
@@ -464,18 +464,6 @@ the `excludedProjectEnvVars` setting in your `settings.json` file.
|
||||
- Specifies the default Gemini model to use.
|
||||
- Overrides the hardcoded default
|
||||
- Example: `export GEMINI_MODEL="gemini-2.5-flash"`
|
||||
- **`GEMINI_CLI_CUSTOM_HEADERS`**:
|
||||
- Adds extra HTTP headers to Gemini API and Code Assist requests.
|
||||
- Accepts a comma-separated list of `Name: value` pairs.
|
||||
- Example:
|
||||
`export GEMINI_CLI_CUSTOM_HEADERS="X-My-Header: foo, X-Trace-ID: abc123"`.
|
||||
- **`GEMINI_API_KEY_AUTH_MECHANISM`**:
|
||||
- Specifies how the API key should be sent for authentication when using
|
||||
`AuthType.USE_GEMINI` or `AuthType.USE_VERTEX_AI`.
|
||||
- Valid values are `x-goog-api-key` (default) or `bearer`.
|
||||
- If set to `bearer`, the API key will be sent in the
|
||||
`Authorization: Bearer <key>` header.
|
||||
- Example: `export GEMINI_API_KEY_AUTH_MECHANISM="bearer"`
|
||||
- **`GOOGLE_API_KEY`**:
|
||||
- Your Google Cloud API key.
|
||||
- Required for using Vertex AI in express mode.
|
||||
@@ -486,7 +474,7 @@ the `excludedProjectEnvVars` setting in your `settings.json` file.
|
||||
- Required for using Code Assist or Vertex AI.
|
||||
- If using Vertex AI, ensure you have the necessary permissions in this
|
||||
project.
|
||||
- **Cloud shell note:** When running in a Cloud Shell environment, this
|
||||
- **Cloud Shell Note:** When running in a Cloud Shell environment, this
|
||||
variable defaults to a special project allocated for Cloud Shell users. If
|
||||
you have `GOOGLE_CLOUD_PROJECT` set in your global environment in Cloud
|
||||
Shell, it will be overridden by this default. To use a different project in
|
||||
@@ -506,9 +494,6 @@ the `excludedProjectEnvVars` setting in your `settings.json` file.
|
||||
- **`GEMINI_SANDBOX`**:
|
||||
- Alternative to the `sandbox` setting in `settings.json`.
|
||||
- Accepts `true`, `false`, `docker`, `podman`, or a custom command string.
|
||||
- **`HTTP_PROXY` / `HTTPS_PROXY`**:
|
||||
- Specifies the proxy server to use for outgoing HTTP/HTTPS requests.
|
||||
- Example: `export HTTPS_PROXY="http://proxy.example.com:8080"`
|
||||
- **`SEATBELT_PROFILE`** (macOS specific):
|
||||
- Switches the Seatbelt (`sandbox-exec`) profile on macOS.
|
||||
- `permissive-open`: (Default) Restricts writes to the project folder (and a
|
||||
@@ -547,7 +532,7 @@ the `excludedProjectEnvVars` setting in your `settings.json` file.
|
||||
relative. `~` is supported for the home directory. **Note: This will
|
||||
overwrite the file if it already exists.**
|
||||
|
||||
## Command-line arguments
|
||||
## Command-Line Arguments
|
||||
|
||||
Arguments passed directly when running the CLI can override other configurations
|
||||
for that specific session.
|
||||
@@ -596,6 +581,9 @@ for that specific session.
|
||||
- Example: `gemini -e my-extension -e my-other-extension`
|
||||
- **`--list-extensions`** (**`-l`**):
|
||||
- Lists all available extensions and exits.
|
||||
- **`--proxy`**:
|
||||
- Sets the proxy for the CLI.
|
||||
- Example: `--proxy http://localhost:7890`.
|
||||
- **`--include-directories <dir1,dir2,...>`**:
|
||||
- Includes additional directories in the workspace for multi-directory
|
||||
support.
|
||||
@@ -606,7 +594,7 @@ for that specific session.
|
||||
- **`--version`**:
|
||||
- Displays the version of the CLI.
|
||||
|
||||
## Context files (hierarchical instructional context)
|
||||
## Context Files (Hierarchical Instructional Context)
|
||||
|
||||
While not strictly configuration for the CLI's _behavior_, context files
|
||||
(defaulting to `GEMINI.md` but configurable via the `contextFileName` setting)
|
||||
@@ -622,7 +610,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 (e.g., `GEMINI.md`)
|
||||
|
||||
Here's a conceptual example of what a context file at the root of a TypeScript
|
||||
project might contain:
|
||||
@@ -663,23 +651,23 @@ more relevant and precise your context files are, the better the AI can assist
|
||||
you. Project-specific context files are highly encouraged to establish
|
||||
conventions and context.
|
||||
|
||||
- **Hierarchical loading and precedence:** The CLI implements a sophisticated
|
||||
- **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)
|
||||
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:**
|
||||
1. **Global Context File:**
|
||||
- Location: `~/.gemini/<contextFileName>` (e.g., `~/.gemini/GEMINI.md` in
|
||||
your user home directory).
|
||||
- Scope: Provides default instructions for all your projects.
|
||||
2. **Project root and ancestors context files:**
|
||||
2. **Project Root & Ancestors Context Files:**
|
||||
- Location: The CLI searches for the configured context file in the
|
||||
current working directory and then in each parent directory up to either
|
||||
the project root (identified by a `.git` folder) or your home directory.
|
||||
- Scope: Provides context relevant to the entire project or a significant
|
||||
portion of it.
|
||||
3. **Sub-directory context files (contextual/local):**
|
||||
3. **Sub-directory Context Files (Contextual/Local):**
|
||||
- Location: The CLI also scans for the configured context file in
|
||||
subdirectories _below_ the current working directory (respecting common
|
||||
ignore patterns like `node_modules`, `.git`, etc.). The breadth of this
|
||||
@@ -687,15 +675,15 @@ conventions and context.
|
||||
with a `memoryDiscoveryMaxDirs` field in your `settings.json` file.
|
||||
- Scope: Allows for highly specific instructions relevant to a particular
|
||||
component, module, or subsection of your project.
|
||||
- **Concatenation and UI indication:** The contents of all found context files
|
||||
are concatenated (with separators indicating their origin and path) and
|
||||
provided as part of the system prompt to the Gemini model. The CLI footer
|
||||
displays the count of loaded context files, giving you a quick visual cue
|
||||
about the active instructional context.
|
||||
- **Importing content:** You can modularize your context files by importing
|
||||
- **Concatenation & UI Indication:** The contents of all found context files are
|
||||
concatenated (with separators indicating their origin and path) and provided
|
||||
as part of the system prompt to the Gemini model. The CLI footer displays the
|
||||
count of loaded context files, giving you a quick visual cue about the active
|
||||
instructional context.
|
||||
- **Importing Content:** You can modularize your context files by importing
|
||||
other Markdown files using the `@path/to/file.md` syntax. For more details,
|
||||
see the [Memory Import Processor documentation](../core/memport.md).
|
||||
- **Commands for memory management:**
|
||||
- **Commands for Memory Management:**
|
||||
- Use `/memory refresh` to force a re-scan and reload of all context files
|
||||
from all configured locations. This updates the AI's instructional context.
|
||||
- Use `/memory show` to display the combined instructional context currently
|
||||
@@ -742,7 +730,7 @@ sandbox image:
|
||||
BUILD_SANDBOX=1 gemini -s
|
||||
```
|
||||
|
||||
## Usage statistics
|
||||
## 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
|
||||
@@ -750,22 +738,22 @@ prioritize new features.
|
||||
|
||||
**What we collect:**
|
||||
|
||||
- **Tool calls:** We log the names of the tools that are called, whether they
|
||||
- **Tool Calls:** We log the names of the tools that are called, whether they
|
||||
succeed or fail, and how long they take to execute. We do not collect the
|
||||
arguments passed to the tools or any data returned by them.
|
||||
- **API requests:** We log the Gemini model used for each request, the duration
|
||||
- **API Requests:** We log the Gemini model used for each request, the duration
|
||||
of the request, and whether it was successful. We do not collect the content
|
||||
of the prompts or responses.
|
||||
- **Session information:** We collect information about the configuration of the
|
||||
- **Session Information:** We collect information about the configuration of the
|
||||
CLI, such as the enabled tools and the approval mode.
|
||||
|
||||
**What we DON'T collect:**
|
||||
|
||||
- **Personally identifiable information (PII):** We do not collect any personal
|
||||
- **Personally Identifiable Information (PII):** We do not collect any personal
|
||||
information, such as your name, email address, or API keys.
|
||||
- **Prompt and response content:** We do not log the content of your prompts or
|
||||
- **Prompt and Response Content:** We do not log the content of your prompts or
|
||||
the responses from the Gemini model.
|
||||
- **File content:** We do not log the content of any files that are read or
|
||||
- **File Content:** We do not log the content of any files that are read or
|
||||
written by the CLI.
|
||||
|
||||
**How to opt out:**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Custom commands
|
||||
# Custom Commands
|
||||
|
||||
Custom commands let you save and reuse your favorite or most frequently used
|
||||
prompts as personal shortcuts within Gemini CLI. You can create commands that
|
||||
@@ -9,9 +9,9 @@ all your projects, streamlining your workflow and ensuring consistency.
|
||||
|
||||
Gemini CLI discovers commands from two locations, loaded in a specific order:
|
||||
|
||||
1. **User commands (global):** Located in `~/.gemini/commands/`. These commands
|
||||
1. **User Commands (Global):** Located in `~/.gemini/commands/`. These commands
|
||||
are available in any project you are working on.
|
||||
2. **Project commands (local):** Located in
|
||||
2. **Project Commands (Local):** Located in
|
||||
`<your-project-root>/.gemini/commands/`. These commands are specific to the
|
||||
current project and can be checked into version control to be shared with
|
||||
your team.
|
||||
@@ -30,7 +30,7 @@ separator (`/` or `\`) being converted to a colon (`:`).
|
||||
- A file at `<project>/.gemini/commands/git/commit.toml` becomes the namespaced
|
||||
command `/git:commit`.
|
||||
|
||||
## TOML file format (v1)
|
||||
## TOML File Format (v1)
|
||||
|
||||
Your command definition files must be written in the TOML format and use the
|
||||
`.toml` file extension.
|
||||
@@ -60,7 +60,7 @@ replace that placeholder with the text the user typed after the command name.
|
||||
|
||||
The behavior of this injection depends on where it is used:
|
||||
|
||||
**A. Raw injection (outside shell commands)**
|
||||
**A. Raw injection (outside Shell commands)**
|
||||
|
||||
When used in the main body of the prompt, the arguments are injected exactly as
|
||||
the user typed them.
|
||||
@@ -77,7 +77,7 @@ prompt = "Please provide a code fix for the issue described here: {{args}}."
|
||||
The model receives:
|
||||
`Please provide a code fix for the issue described here: "Button is misaligned".`
|
||||
|
||||
**B. Using arguments in shell commands (inside `!{...}` blocks)**
|
||||
**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
|
||||
@@ -156,7 +156,7 @@ When you run `/changelog 1.2.0 added "New feature"`, the final text sent to the
|
||||
model will be the original prompt followed by two newlines and the command you
|
||||
typed.
|
||||
|
||||
### 3. Executing shell commands with `!{...}`
|
||||
### 3. Executing Shell commands with `!{...}`
|
||||
|
||||
You can make your commands dynamic by executing shell commands directly within
|
||||
your `prompt` and injecting their output. This is ideal for gathering context
|
||||
@@ -302,7 +302,7 @@ Your response should include:
|
||||
"""
|
||||
```
|
||||
|
||||
**3. Run the command:**
|
||||
**3. Run the Command:**
|
||||
|
||||
That's it! You can now run your command in the CLI. First, you might add a file
|
||||
to the context, and then invoke your command:
|
||||
|
||||
+23
-23
@@ -1,11 +1,11 @@
|
||||
# Gemini CLI for the enterprise
|
||||
# Gemini CLI for the Enterprise
|
||||
|
||||
This document outlines configuration patterns and best practices for deploying
|
||||
and managing Gemini CLI in an enterprise environment. By leveraging system-level
|
||||
settings, administrators can enforce security policies, manage tool access, and
|
||||
ensure a consistent experience for all users.
|
||||
|
||||
> **A note on security:** The patterns described in this document are intended
|
||||
> **A Note on Security:** The patterns described in this document are intended
|
||||
> to help administrators create a more controlled and secure environment for
|
||||
> using Gemini CLI. However, they should not be considered a foolproof security
|
||||
> boundary. A determined user with sufficient privileges on their local machine
|
||||
@@ -14,7 +14,7 @@ ensure a consistent experience for all users.
|
||||
> managed environment, not to defend against a malicious actor with local
|
||||
> administrative rights.
|
||||
|
||||
## Centralized configuration: The system settings file
|
||||
## Centralized Configuration: The System Settings File
|
||||
|
||||
The most powerful tools for enterprise administration are the system-wide
|
||||
settings files. These files allow you to define a baseline configuration
|
||||
@@ -33,11 +33,11 @@ settings (like `theme`) is:
|
||||
This means the System Overrides file has the final say. For settings that are
|
||||
arrays (`includeDirectories`) or objects (`mcpServers`), the values are merged.
|
||||
|
||||
**Example of merging and precedence:**
|
||||
**Example of Merging and Precedence:**
|
||||
|
||||
Here is how settings from different levels are combined.
|
||||
|
||||
- **System defaults `system-defaults.json`:**
|
||||
- **System Defaults `system-defaults.json`:**
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -89,7 +89,7 @@ Here is how settings from different levels are combined.
|
||||
}
|
||||
```
|
||||
|
||||
- **System overrides `settings.json`:**
|
||||
- **System Overrides `settings.json`:**
|
||||
```json
|
||||
{
|
||||
"ui": {
|
||||
@@ -108,7 +108,7 @@ Here is how settings from different levels are combined.
|
||||
|
||||
This results in the following merged configuration:
|
||||
|
||||
- **Final merged configuration:**
|
||||
- **Final Merged Configuration:**
|
||||
```json
|
||||
{
|
||||
"ui": {
|
||||
@@ -159,7 +159,7 @@ This results in the following merged configuration:
|
||||
By using the system settings file, you can enforce the security and
|
||||
configuration patterns described below.
|
||||
|
||||
## Restricting tool access
|
||||
## Restricting Tool Access
|
||||
|
||||
You can significantly enhance security by controlling which tools the Gemini
|
||||
model can use. This is achieved through the `tools.core` and `tools.exclude`
|
||||
@@ -197,12 +197,12 @@ environment to a blocklist.
|
||||
}
|
||||
```
|
||||
|
||||
**Security note:** Blocklisting with `excludeTools` is less secure than
|
||||
**Security Note:** Blocklisting with `excludeTools` is less secure than
|
||||
allowlisting with `coreTools`, as it relies on blocking known-bad commands, and
|
||||
clever users may find ways to bypass simple string-based blocks. **Allowlisting
|
||||
is the recommended approach.**
|
||||
|
||||
### Disabling YOLO mode
|
||||
### Disabling YOLO Mode
|
||||
|
||||
To ensure that users cannot bypass the confirmation prompt for tool execution,
|
||||
you can disable YOLO mode at the policy level. This adds a critical layer of
|
||||
@@ -222,14 +222,14 @@ approval.
|
||||
This setting is highly recommended in an enterprise environment to prevent
|
||||
unintended tool execution.
|
||||
|
||||
## Managing custom tools (MCP servers)
|
||||
## Managing Custom Tools (MCP Servers)
|
||||
|
||||
If your organization uses custom tools via
|
||||
[Model-Context Protocol (MCP) servers](../core/tools-api.md), it is crucial to
|
||||
understand how server configurations are managed to apply security policies
|
||||
effectively.
|
||||
|
||||
### How MCP server configurations are merged
|
||||
### How MCP Server Configurations are Merged
|
||||
|
||||
Gemini CLI loads `settings.json` files from three levels: System, Workspace, and
|
||||
User. When it comes to the `mcpServers` object, these configurations are
|
||||
@@ -246,12 +246,12 @@ 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
|
||||
unique names.
|
||||
|
||||
### Enforcing a catalog of tools
|
||||
### Enforcing a Catalog of Tools
|
||||
|
||||
The security of your MCP tool ecosystem depends on a combination of defining the
|
||||
canonical servers and adding their names to an allowlist.
|
||||
|
||||
### Restricting tools within an MCP server
|
||||
### Restricting Tools Within an MCP Server
|
||||
|
||||
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.
|
||||
@@ -280,7 +280,7 @@ third-party MCP server, even if the server offers other tools like
|
||||
}
|
||||
```
|
||||
|
||||
#### More secure pattern: Define and add to allowlist in system settings
|
||||
#### More Secure Pattern: Define and Add to Allowlist in System Settings
|
||||
|
||||
To create a secure, centrally-managed catalog of tools, the system administrator
|
||||
**must** do both of the following in the system-level `settings.json` file:
|
||||
@@ -293,7 +293,7 @@ To create a secure, centrally-managed catalog of tools, the system administrator
|
||||
any servers that are not on this list. If this setting is omitted, the CLI
|
||||
will merge and allow any server defined by the user.
|
||||
|
||||
**Example system `settings.json`:**
|
||||
**Example System `settings.json`:**
|
||||
|
||||
1. Add the _names_ of all approved servers to an allowlist. This will prevent
|
||||
users from adding their own servers.
|
||||
@@ -322,12 +322,12 @@ Any server a user defines will either be overridden by the system definition (if
|
||||
it has the same name) or blocked because its name is not in the `mcp.allowed`
|
||||
list.
|
||||
|
||||
### Less secure pattern: Omitting the allowlist
|
||||
### Less Secure Pattern: Omitting the Allowlist
|
||||
|
||||
If the administrator defines the `mcpServers` object but fails to also specify
|
||||
the `mcp.allowed` allowlist, users may add their own servers.
|
||||
|
||||
**Example system `settings.json`:**
|
||||
**Example System `settings.json`:**
|
||||
|
||||
This configuration defines servers but does not enforce the allowlist. The
|
||||
administrator has NOT included the "mcp.allowed" setting.
|
||||
@@ -347,7 +347,7 @@ In this scenario, a user can add their own server in their local
|
||||
results, the user's server will be added to the list of available tools and
|
||||
allowed to run.
|
||||
|
||||
## Enforcing sandboxing for security
|
||||
## Enforcing Sandboxing for Security
|
||||
|
||||
To mitigate the risk of potentially harmful operations, you can enforce the use
|
||||
of sandboxing for all tool execution. The sandbox isolates tool execution in a
|
||||
@@ -367,14 +367,14 @@ You can also specify a custom, hardened Docker image for the sandbox by building
|
||||
a custom `sandbox.Dockerfile` as described in the
|
||||
[Sandboxing documentation](./sandbox.md).
|
||||
|
||||
## Controlling network access via proxy
|
||||
## Controlling Network Access via Proxy
|
||||
|
||||
In corporate environments with strict network policies, you can configure Gemini
|
||||
CLI to route all outbound traffic through a corporate proxy. This can be set via
|
||||
an environment variable, but it can also be enforced for custom tools via the
|
||||
`mcpServers` configuration.
|
||||
|
||||
**Example (for an MCP server):**
|
||||
**Example (for an MCP Server):**
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -391,7 +391,7 @@ an environment variable, but it can also be enforced for custom tools via the
|
||||
}
|
||||
```
|
||||
|
||||
## Telemetry and auditing
|
||||
## 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
|
||||
@@ -434,7 +434,7 @@ prompted to switch to the enforced method. In non-interactive mode, the CLI will
|
||||
exit with an error if the configured authentication method does not match the
|
||||
enforced one.
|
||||
|
||||
## Putting it all together: Example system `settings.json`
|
||||
## Putting It All Together: Example System `settings.json`
|
||||
|
||||
Here is an example of a system `settings.json` file that combines several of the
|
||||
patterns discussed above to create a secure, controlled environment for Gemini
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Ignoring files
|
||||
# Ignoring Files
|
||||
|
||||
This document provides an overview of the Gemini Ignore (`.geminiignore`)
|
||||
feature of the Gemini CLI.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Provide context with GEMINI.md files
|
||||
# Provide Context with GEMINI.md Files
|
||||
|
||||
Context files, which use the default name `GEMINI.md`, are a powerful feature
|
||||
for providing instructional context to the Gemini model. You can use these files
|
||||
|
||||
@@ -1,210 +0,0 @@
|
||||
# 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
|
||||
behaviors.
|
||||
|
||||
> **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.
|
||||
|
||||
## 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:
|
||||
|
||||
- **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).
|
||||
- **Agent-Scoped Customization**: Applying specific settings only when a
|
||||
particular agent is active.
|
||||
|
||||
The system operates on two core primitives: **Aliases** and **Overrides**.
|
||||
|
||||
## 2. Configuration Primitives
|
||||
|
||||
These settings are located under the `modelConfigs` key in your configuration
|
||||
file.
|
||||
|
||||
### Aliases (`customAliases`)
|
||||
|
||||
Aliases are named, reusable configuration presets. Users should define their own
|
||||
aliases (or override system defaults) in the `customAliases` map.
|
||||
|
||||
- **Inheritance**: An alias can `extends` another alias (including system
|
||||
defaults like `chat-base`), inheriting its `modelConfig`. Child aliases can
|
||||
overwrite or augment inherited settings.
|
||||
- **Abstract Aliases**: An alias is not required to specify a concrete `model`
|
||||
if it serves purely as a base for other aliases.
|
||||
|
||||
**Example Hierarchy**:
|
||||
|
||||
```json
|
||||
"modelConfigs": {
|
||||
"customAliases": {
|
||||
"base": {
|
||||
"modelConfig": {
|
||||
"generateContentConfig": { "temperature": 0.0 }
|
||||
}
|
||||
},
|
||||
"chat-base": {
|
||||
"extends": "base",
|
||||
"modelConfig": {
|
||||
"generateContentConfig": { "temperature": 0.7 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Overrides (`overrides`)
|
||||
|
||||
Overrides are conditional rules that inject configuration based on the runtime
|
||||
context. They are evaluated dynamically for each model request.
|
||||
|
||||
- **Match Criteria**: Overrides apply when the request context matches the
|
||||
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`).
|
||||
|
||||
**Example Override**:
|
||||
|
||||
```json
|
||||
"modelConfigs": {
|
||||
"overrides": [
|
||||
{
|
||||
"match": {
|
||||
"overrideScope": "codebaseInvestigator"
|
||||
},
|
||||
"modelConfig": {
|
||||
"generateContentConfig": { "temperature": 0.1 }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## 3. Resolution Strategy
|
||||
|
||||
The `ModelConfigService` resolves the final configuration through a two-step
|
||||
process:
|
||||
|
||||
### Step 1: Alias Resolution
|
||||
|
||||
The requested model string is looked up in the merged map of system `aliases`
|
||||
and user `customAliases`.
|
||||
|
||||
1. If found, the system recursively resolves the `extends` chain.
|
||||
2. Settings are merged from parent to child (child wins).
|
||||
3. This results in a base `ResolvedModelConfig`.
|
||||
4. If not found, the requested string is treated as the raw model name.
|
||||
|
||||
### Step 2: Override Application
|
||||
|
||||
The system evaluates the `overrides` list against the request context (`model`
|
||||
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).
|
||||
- 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
|
||||
sequentially onto the base configuration.
|
||||
|
||||
## 4. Configuration Reference
|
||||
|
||||
The configuration follows the `ModelConfigServiceConfig` interface.
|
||||
|
||||
### `ModelConfig` Object
|
||||
|
||||
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. |
|
||||
|
||||
### `GenerateContentConfig` (Common Parameters)
|
||||
|
||||
Directly maps to the SDK's `GenerateContentConfig`. Common parameters include:
|
||||
|
||||
- **`temperature`**: (`number`) Controls output randomness. Lower values (0.0)
|
||||
are deterministic; higher values (>0.7) are creative.
|
||||
- **`topP`**: (`number`) Nucleus sampling probability.
|
||||
- **`maxOutputTokens`**: (`number`) Limit on generated response length.
|
||||
- **`thinkingConfig`**: (`object`) Configuration for models with reasoning
|
||||
capabilities (e.g., `thinkingBudget`, `includeThoughts`).
|
||||
|
||||
## 5. Practical Examples
|
||||
|
||||
### Defining a Deterministic Baseline
|
||||
|
||||
Create an alias for tasks requiring high precision, extending the standard chat
|
||||
configuration but enforcing zero temperature.
|
||||
|
||||
```json
|
||||
"modelConfigs": {
|
||||
"customAliases": {
|
||||
"precise-mode": {
|
||||
"extends": "chat-base",
|
||||
"modelConfig": {
|
||||
"generateContentConfig": {
|
||||
"temperature": 0.0,
|
||||
"topP": 1.0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Agent-Specific Parameter Injection
|
||||
|
||||
Enforce extended thinking budgets for a specific agent without altering the
|
||||
global default, e.g. for the `codebaseInvestigator`.
|
||||
|
||||
```json
|
||||
"modelConfigs": {
|
||||
"overrides": [
|
||||
{
|
||||
"match": {
|
||||
"overrideScope": "codebaseInvestigator"
|
||||
},
|
||||
"modelConfig": {
|
||||
"generateContentConfig": {
|
||||
"thinkingConfig": { "thinkingBudget": 4096 }
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Experimental Model Evaluation
|
||||
|
||||
Route traffic for a specific alias to a preview model for A/B testing, without
|
||||
changing client code.
|
||||
|
||||
```json
|
||||
"modelConfigs": {
|
||||
"overrides": [
|
||||
{
|
||||
"match": {
|
||||
"model": "gemini-2.5-pro"
|
||||
},
|
||||
"modelConfig": {
|
||||
"model": "gemini-2.5-pro-experimental-001"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
+17
-17
@@ -1,4 +1,4 @@
|
||||
# Headless mode
|
||||
# Headless Mode
|
||||
|
||||
Headless mode allows you to run Gemini CLI programmatically from command line
|
||||
scripts and automation tools without any interactive UI. This is ideal for
|
||||
@@ -45,9 +45,9 @@ The headless mode provides a headless interface to Gemini CLI that:
|
||||
- Enables automation and scripting workflows
|
||||
- Provides consistent exit codes for error handling
|
||||
|
||||
## Basic usage
|
||||
## Basic Usage
|
||||
|
||||
### Direct prompts
|
||||
### Direct Prompts
|
||||
|
||||
Use the `--prompt` (or `-p`) flag to run in headless mode:
|
||||
|
||||
@@ -55,7 +55,7 @@ Use the `--prompt` (or `-p`) flag to run in headless mode:
|
||||
gemini --prompt "What is machine learning?"
|
||||
```
|
||||
|
||||
### Stdin input
|
||||
### Stdin Input
|
||||
|
||||
Pipe input to Gemini CLI from your terminal:
|
||||
|
||||
@@ -63,7 +63,7 @@ Pipe input to Gemini CLI from your terminal:
|
||||
echo "Explain this code" | gemini
|
||||
```
|
||||
|
||||
### Combining with file input
|
||||
### Combining with File Input
|
||||
|
||||
Read from files and process with Gemini:
|
||||
|
||||
@@ -71,9 +71,9 @@ Read from files and process with Gemini:
|
||||
cat README.md | gemini --prompt "Summarize this documentation"
|
||||
```
|
||||
|
||||
## Output formats
|
||||
## Output Formats
|
||||
|
||||
### Text output (default)
|
||||
### Text Output (Default)
|
||||
|
||||
Standard human-readable output:
|
||||
|
||||
@@ -87,12 +87,12 @@ Response format:
|
||||
The capital of France is Paris.
|
||||
```
|
||||
|
||||
### JSON output
|
||||
### JSON Output
|
||||
|
||||
Returns structured data including response, statistics, and metadata. This
|
||||
format is ideal for programmatic processing and automation scripts.
|
||||
|
||||
#### Response schema
|
||||
#### Response Schema
|
||||
|
||||
The JSON output follows this high-level structure:
|
||||
|
||||
@@ -140,7 +140,7 @@ The JSON output follows this high-level structure:
|
||||
}
|
||||
```
|
||||
|
||||
#### Example usage
|
||||
#### Example Usage
|
||||
|
||||
```bash
|
||||
gemini -p "What is the capital of France?" --output-format json
|
||||
@@ -218,14 +218,14 @@ Response:
|
||||
}
|
||||
```
|
||||
|
||||
### Streaming JSON output
|
||||
### Streaming JSON Output
|
||||
|
||||
Returns real-time events as newline-delimited JSON (JSONL). Each significant
|
||||
action (initialization, messages, tool calls, results) emits immediately as it
|
||||
occurs. This format is ideal for monitoring long-running operations, building
|
||||
UIs with live progress, and creating automation pipelines that react to events.
|
||||
|
||||
#### When to use streaming JSON
|
||||
#### When to Use Streaming JSON
|
||||
|
||||
Use `--output-format stream-json` when you need:
|
||||
|
||||
@@ -237,7 +237,7 @@ Use `--output-format stream-json` when you need:
|
||||
timestamps
|
||||
- **Pipeline integration** - Stream events to logging/monitoring systems
|
||||
|
||||
#### Event types
|
||||
#### Event Types
|
||||
|
||||
The streaming format emits 6 event types:
|
||||
|
||||
@@ -248,7 +248,7 @@ The streaming format emits 6 event types:
|
||||
5. **`error`** - Non-fatal errors and warnings
|
||||
6. **`result`** - Final session outcome with aggregated stats
|
||||
|
||||
#### Basic usage
|
||||
#### Basic Usage
|
||||
|
||||
```bash
|
||||
# Stream events to console
|
||||
@@ -261,7 +261,7 @@ gemini --output-format stream-json --prompt "Analyze this code" > events.jsonl
|
||||
gemini --output-format stream-json --prompt "List files" | jq -r '.type'
|
||||
```
|
||||
|
||||
#### Example output
|
||||
#### Example Output
|
||||
|
||||
Each line is a complete JSON event:
|
||||
|
||||
@@ -274,7 +274,7 @@ Each line is a complete JSON event:
|
||||
{"type":"result","status":"success","stats":{"total_tokens":250,"input_tokens":50,"output_tokens":200,"duration_ms":3000,"tool_calls":1},"timestamp":"2025-10-10T12:00:05.000Z"}
|
||||
```
|
||||
|
||||
### File redirection
|
||||
### File Redirection
|
||||
|
||||
Save output to files or pipe to other commands:
|
||||
|
||||
@@ -292,7 +292,7 @@ gemini -p "Explain microservices" | wc -w
|
||||
gemini -p "List programming languages" | grep -i "python"
|
||||
```
|
||||
|
||||
## Configuration options
|
||||
## Configuration Options
|
||||
|
||||
Key command-line options for headless usage:
|
||||
|
||||
|
||||
+10
-10
@@ -7,17 +7,17 @@ overview of Gemini CLI, see the [main documentation page](../index.md).
|
||||
## Basic features
|
||||
|
||||
- **[Commands](./commands.md):** A reference for all built-in slash commands
|
||||
- **[Custom commands](./custom-commands.md):** Create your own commands and
|
||||
- **[Custom Commands](./custom-commands.md):** Create your own commands and
|
||||
shortcuts for frequently used prompts.
|
||||
- **[Headless mode](./headless.md):** Use Gemini CLI programmatically for
|
||||
- **[Headless Mode](./headless.md):** Use Gemini CLI programmatically for
|
||||
scripting and automation.
|
||||
- **[Model selection](./model.md):** Configure the Gemini AI model used by the
|
||||
- **[Model Selection](./model.md):** Configure the Gemini AI model used by the
|
||||
CLI.
|
||||
- **[Settings](./settings.md):** Configure various aspects of the CLI's behavior
|
||||
and appearance.
|
||||
- **[Themes](./themes.md):** Customizing the CLI's appearance with different
|
||||
themes.
|
||||
- **[Keyboard shortcuts](./keyboard-shortcuts.md):** A reference for all
|
||||
- **[Keyboard Shortcuts](./keyboard-shortcuts.md):** A reference for all
|
||||
keyboard shortcuts to improve your workflow.
|
||||
- **[Tutorials](./tutorials.md):** Step-by-step guides for common tasks.
|
||||
|
||||
@@ -25,18 +25,18 @@ overview of Gemini CLI, see the [main documentation page](../index.md).
|
||||
|
||||
- **[Checkpointing](./checkpointing.md):** Automatically save and restore
|
||||
snapshots of your session and files.
|
||||
- **[Enterprise configuration](./enterprise.md):** Deploying and manage Gemini
|
||||
- **[Enterprise Configuration](./enterprise.md):** Deploying and manage Gemini
|
||||
CLI in an enterprise environment.
|
||||
- **[Sandboxing](./sandbox.md):** Isolate tool execution in a secure,
|
||||
containerized environment.
|
||||
- **[Telemetry](./telemetry.md):** Configure observability to monitor usage and
|
||||
performance.
|
||||
- **[Token caching](./token-caching.md):** Optimize API costs by caching tokens.
|
||||
- **[Trusted folders](./trusted-folders.md):** A security feature to control
|
||||
- **[Token Caching](./token-caching.md):** Optimize API costs by caching tokens.
|
||||
- **[Trusted Folders](./trusted-folders.md):** A security feature to control
|
||||
which projects can use the full capabilities of the CLI.
|
||||
- **[Ignoring files (.geminiignore)](./gemini-ignore.md):** Exclude specific
|
||||
- **[Ignoring Files (.geminiignore)](./gemini-ignore.md):** Exclude specific
|
||||
files and directories from being accessed by tools.
|
||||
- **[Context files (GEMINI.md)](./gemini-md.md):** Provide persistent,
|
||||
- **[Context Files (GEMINI.md)](./gemini-md.md):** Provide persistent,
|
||||
hierarchical context to the model.
|
||||
|
||||
## Non-interactive mode
|
||||
@@ -58,4 +58,4 @@ gemini -p "What is fine tuning?"
|
||||
```
|
||||
|
||||
For comprehensive documentation on headless usage, scripting, automation, and
|
||||
advanced examples, see the **[Headless mode](./headless.md)** guide.
|
||||
advanced examples, see the **[Headless Mode](./headless.md)** guide.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Gemini CLI keyboard shortcuts
|
||||
# Gemini CLI Keyboard Shortcuts
|
||||
|
||||
Gemini CLI ships with a set of default keyboard shortcuts for editing input,
|
||||
navigating history, and controlling the UI. Use this reference to learn the
|
||||
@@ -110,7 +110,7 @@ available combinations.
|
||||
|
||||
<!-- KEYBINDINGS-AUTOGEN:END -->
|
||||
|
||||
## Additional context-specific shortcuts
|
||||
## Additional Context-Specific Shortcuts
|
||||
|
||||
- `Ctrl+Y`: Toggle YOLO (auto-approval) mode for tool calls.
|
||||
- `Shift+Tab`: Toggle Auto Edit (auto-accept edits) mode.
|
||||
|
||||
@@ -1,31 +1,43 @@
|
||||
## Model routing
|
||||
## Model Routing
|
||||
|
||||
Gemini CLI includes a model routing feature that automatically switches to a
|
||||
fallback model in case of a model failure. This feature is enabled by default
|
||||
and provides resilience when the primary model is unavailable.
|
||||
|
||||
## How it works
|
||||
## How it Works
|
||||
|
||||
Model routing is not based on prompt complexity, but is a fallback mechanism.
|
||||
Here's how it works:
|
||||
|
||||
1. **Model failure:** If the currently selected model fails to respond (for
|
||||
1. **Model Failure:** If the currently selected model fails to respond (for
|
||||
example, due to a server error or other issue), the CLI will initiate the
|
||||
fallback process.
|
||||
|
||||
2. **User consent:** The CLI will prompt you to ask if you want to switch to
|
||||
2. **User Consent:** The CLI will prompt you to ask if you want to switch to
|
||||
the fallback model. This is handled by the `fallbackModelHandler`.
|
||||
|
||||
3. **Fallback activation:** If you consent, the CLI will activate the fallback
|
||||
3. **Fallback Activation:** If you consent, the CLI will activate the fallback
|
||||
mode by calling `config.setFallbackMode(true)`.
|
||||
|
||||
4. **Model switch:** On the next request, the CLI will use the
|
||||
4. **Model Switch:** On the next request, the CLI will use the
|
||||
`DEFAULT_GEMINI_FLASH_MODEL` as the fallback model. This is handled by the
|
||||
`resolveModel` function in
|
||||
`packages/cli/src/zed-integration/zedIntegration.ts` which checks if
|
||||
`isInFallbackMode()` is true.
|
||||
|
||||
### Model selection precedence
|
||||
## Configuration
|
||||
|
||||
Model routing is controlled by the `useModelRouter` setting in your
|
||||
`settings.json` file.
|
||||
|
||||
- **`"experimental.useModelRouter": true` (Default):** Enables the model
|
||||
routing/fallback feature.
|
||||
|
||||
- **`"experimental.useModelRouter": false`:** Disables the model
|
||||
routing/fallback feature. If a model fails, the CLI will not attempt to switch
|
||||
to a fallback model.
|
||||
|
||||
### Model Selection Precedence
|
||||
|
||||
The model used by Gemini CLI is determined by the following order of precedence:
|
||||
|
||||
@@ -37,5 +49,8 @@ The model used by Gemini CLI is determined by the following order of precedence:
|
||||
3. **`model.name` in `settings.json`:** If neither of the above are set, the
|
||||
model specified in the `model.name` property of your `settings.json` file
|
||||
will be used.
|
||||
4. **Default model:** If none of the above are set, the default model will be
|
||||
used. The default model is `auto`
|
||||
4. **Default Model:** If none of the above are set, the default model will be
|
||||
used. The default model is determined by the `useModelRouter` setting:
|
||||
- If `useModelRouter` is `true`, the default model is `"auto"`.
|
||||
- If `useModelRouter` is `false`, the default model is the standard Gemini
|
||||
model.
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
# Gemini CLI model selection (`/model` command)
|
||||
# Gemini CLI Model Selection (`/model` Command)
|
||||
|
||||
Select your Gemini CLI model. The `/model` command opens a dialog where you can
|
||||
configure the model used by Gemini CLI, giving you more control over your
|
||||
@@ -21,7 +21,7 @@ Running this command will open a dialog with your model options:
|
||||
| Flash | For tasks that need a balance of speed and reasoning. | gemini-2.5-flash |
|
||||
| Flash-Lite | For simple tasks that need to be done quickly. | gemini-2.5-flash-lite |
|
||||
|
||||
### Gemini 3 Pro and preview features
|
||||
### Gemini 3 Pro and Preview Features
|
||||
|
||||
Note: Gemini 3 is not currently available on all account types. To learn more
|
||||
about Gemini 3 access, refer to
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ Built-in profiles (set via `SEATBELT_PROFILE` env var):
|
||||
- `restrictive-open`: Strict restrictions, network allowed
|
||||
- `restrictive-closed`: Maximum restrictions
|
||||
|
||||
### Custom sandbox flags
|
||||
### Custom Sandbox Flags
|
||||
|
||||
For container-based sandboxing, you can inject custom flags into the `docker` or
|
||||
`podman` command using the `SANDBOX_FLAGS` environment variable. This is useful
|
||||
|
||||
@@ -1,158 +0,0 @@
|
||||
# Session Management
|
||||
|
||||
Gemini CLI includes robust session management features that automatically save
|
||||
your conversation history. This allows you to interrupt your work and resume
|
||||
exactly where you left off, review past interactions, and manage your
|
||||
conversation history effectively.
|
||||
|
||||
## Automatic Saving
|
||||
|
||||
Every time you interact with Gemini CLI, your session is automatically saved.
|
||||
This happens in the background without any manual intervention.
|
||||
|
||||
- **What is saved:** The complete conversation history, including:
|
||||
- Your prompts and the model's responses.
|
||||
- All tool executions (inputs and outputs).
|
||||
- Token usage statistics (input/output/cached, etc.).
|
||||
- Assistant thoughts/reasoning summaries (when available).
|
||||
- **Location:** Sessions are stored in `~/.gemini/tmp/<project_hash>/chats/`.
|
||||
- **Scope:** Sessions are project-specific. Switching directories to a different
|
||||
project will switch to that project's session history.
|
||||
|
||||
## Resuming Sessions
|
||||
|
||||
You can resume a previous session to continue the conversation with all prior
|
||||
context restored.
|
||||
|
||||
### From the Command Line
|
||||
|
||||
When starting the CLI, you can use the `--resume` (or `-r`) flag:
|
||||
|
||||
- **Resume latest:**
|
||||
|
||||
```bash
|
||||
gemini --resume
|
||||
```
|
||||
|
||||
This immediately loads the most recent session.
|
||||
|
||||
- **Resume by index:** First, list available sessions (see
|
||||
[Listing Sessions](#listing-sessions)), then use the index number:
|
||||
|
||||
```bash
|
||||
gemini --resume 1
|
||||
```
|
||||
|
||||
- **Resume by ID:** You can also provide the full session UUID:
|
||||
```bash
|
||||
gemini --resume a1b2c3d4-e5f6-7890-abcd-ef1234567890
|
||||
```
|
||||
|
||||
### From the Interactive Interface
|
||||
|
||||
While the CLI is running, you can use the `/resume` slash command to open the
|
||||
**Session Browser**:
|
||||
|
||||
```text
|
||||
/resume
|
||||
```
|
||||
|
||||
This opens an interactive interface where you can:
|
||||
|
||||
- **Browse:** Scroll through a list of your past sessions.
|
||||
- **Preview:** See details like the session date, message count, and the first
|
||||
user prompt.
|
||||
- **Search:** Press `/` to enter search mode, then type to filter sessions by ID
|
||||
or content.
|
||||
- **Select:** Press `Enter` to resume the selected session.
|
||||
|
||||
## Managing Sessions
|
||||
|
||||
### Listing Sessions
|
||||
|
||||
To see a list of all available sessions for the current project from the command
|
||||
line:
|
||||
|
||||
```bash
|
||||
gemini --list-sessions
|
||||
```
|
||||
|
||||
Output example:
|
||||
|
||||
```text
|
||||
Available sessions for this project (3):
|
||||
|
||||
1. Fix bug in auth (2 days ago) [a1b2c3d4]
|
||||
2. Refactor database schema (5 hours ago) [e5f67890]
|
||||
3. Update documentation (Just now) [abcd1234]
|
||||
```
|
||||
|
||||
### Deleting Sessions
|
||||
|
||||
You can remove old or unwanted sessions to free up space or declutter your
|
||||
history.
|
||||
|
||||
**From the Command Line:** Use the `--delete-session` flag with an index or ID:
|
||||
|
||||
```bash
|
||||
gemini --delete-session 2
|
||||
```
|
||||
|
||||
**From the Session Browser:**
|
||||
|
||||
1. Open the browser with `/resume`.
|
||||
2. Navigate to the session you want to remove.
|
||||
3. Press `x`.
|
||||
|
||||
## Configuration
|
||||
|
||||
You can configure how Gemini CLI manages your session history in your
|
||||
`settings.json` file.
|
||||
|
||||
### Session Retention
|
||||
|
||||
To prevent your history from growing indefinitely, you can enable automatic
|
||||
cleanup policies.
|
||||
|
||||
```json
|
||||
{
|
||||
"general": {
|
||||
"sessionRetention": {
|
||||
"enabled": true,
|
||||
"maxAge": "30d", // Keep sessions for 30 days
|
||||
"maxCount": 50 // Keep the 50 most recent sessions
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- **`enabled`**: (boolean) Master switch for session cleanup. Default is
|
||||
`false`.
|
||||
- **`maxAge`**: (string) Duration to keep sessions (e.g., "24h", "7d", "4w").
|
||||
Sessions older than this will be deleted.
|
||||
- **`maxCount`**: (number) Maximum number of sessions to retain. The oldest
|
||||
sessions exceeding this count will be deleted.
|
||||
- **`minRetention`**: (string) Minimum retention period (safety limit). Defaults
|
||||
to `"1d"`; sessions newer than this period are never deleted by automatic
|
||||
cleanup.
|
||||
|
||||
### Session Limits
|
||||
|
||||
You can also limit the length of individual sessions to prevent context windows
|
||||
from becoming too large and expensive.
|
||||
|
||||
```json
|
||||
{
|
||||
"model": {
|
||||
"maxSessionTurns": 100
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- **`maxSessionTurns`**: (number) The maximum number of turns (user + model
|
||||
exchanges) allowed in a single session. Set to `-1` for unlimited (default).
|
||||
|
||||
**Behavior when limit is reached:**
|
||||
- **Interactive Mode:** The CLI shows an informational message and stops
|
||||
sending requests to the model. You must manually start a new session.
|
||||
- **Non-Interactive Mode:** The CLI exits with an error.
|
||||
@@ -1,4 +1,4 @@
|
||||
# Gemini CLI settings (`/settings` command)
|
||||
# Gemini CLI Settings (`/settings` Command)
|
||||
|
||||
Control your Gemini CLI experience with the `/settings` command. The `/settings`
|
||||
command opens a dialog to view and edit all your Gemini CLI settings, including
|
||||
@@ -106,7 +106,8 @@ they appear in the UI.
|
||||
|
||||
### Experimental
|
||||
|
||||
| UI Label | Setting | Description | Default |
|
||||
| ----------------------------------- | ------------------------------------------------------- | ------------------------------------------------------------ | ------- |
|
||||
| Enable Codebase Investigator | `experimental.codebaseInvestigatorSettings.enabled` | Enable the Codebase Investigator agent. | `true` |
|
||||
| Codebase Investigator Max Num Turns | `experimental.codebaseInvestigatorSettings.maxNumTurns` | Maximum number of turns for the Codebase Investigator agent. | `10` |
|
||||
| UI Label | Setting | Description | Default |
|
||||
| ----------------------------------- | ------------------------------------------------------- | ----------------------------------------------------------------------------- | ------- |
|
||||
| Use Model Router | `experimental.useModelRouter` | Enable model routing to route requests to the best model based on complexity. | `true` |
|
||||
| Enable Codebase Investigator | `experimental.codebaseInvestigatorSettings.enabled` | Enable the Codebase Investigator agent. | `true` |
|
||||
| Codebase Investigator Max Num Turns | `experimental.codebaseInvestigatorSettings.maxNumTurns` | Maximum number of turns for the Codebase Investigator agent. | `10` |
|
||||
|
||||
+50
-45
@@ -3,27 +3,27 @@
|
||||
Learn how to enable and setup OpenTelemetry for Gemini CLI.
|
||||
|
||||
- [Observability with OpenTelemetry](#observability-with-opentelemetry)
|
||||
- [Key benefits](#key-benefits)
|
||||
- [OpenTelemetry integration](#opentelemetry-integration)
|
||||
- [Key Benefits](#key-benefits)
|
||||
- [OpenTelemetry Integration](#opentelemetry-integration)
|
||||
- [Configuration](#configuration)
|
||||
- [Google Cloud telemetry](#google-cloud-telemetry)
|
||||
- [Google Cloud Telemetry](#google-cloud-telemetry)
|
||||
- [Prerequisites](#prerequisites)
|
||||
- [Direct export (recommended)](#direct-export-recommended)
|
||||
- [Collector-based export (advanced)](#collector-based-export-advanced)
|
||||
- [Local telemetry](#local-telemetry)
|
||||
- [File-based output (recommended)](#file-based-output-recommended)
|
||||
- [Collector-based export (advanced)](#collector-based-export-advanced-1)
|
||||
- [Logs and metrics](#logs-and-metrics)
|
||||
- [Direct Export (Recommended)](#direct-export-recommended)
|
||||
- [Collector-Based Export (Advanced)](#collector-based-export-advanced)
|
||||
- [Local Telemetry](#local-telemetry)
|
||||
- [File-based Output (Recommended)](#file-based-output-recommended)
|
||||
- [Collector-Based Export (Advanced)](#collector-based-export-advanced-1)
|
||||
- [Logs and Metrics](#logs-and-metrics)
|
||||
- [Logs](#logs)
|
||||
- [Sessions](#sessions)
|
||||
- [Tools](#tools)
|
||||
- [Files](#files)
|
||||
- [API](#api)
|
||||
- [Model routing](#model-routing)
|
||||
- [Chat and streaming](#chat-and-streaming)
|
||||
- [Model Routing](#model-routing)
|
||||
- [Chat and Streaming](#chat-and-streaming)
|
||||
- [Resilience](#resilience)
|
||||
- [Extensions](#extensions)
|
||||
- [Agent runs](#agent-runs)
|
||||
- [Agent Runs](#agent-runs)
|
||||
- [IDE](#ide)
|
||||
- [UI](#ui)
|
||||
- [Metrics](#metrics)
|
||||
@@ -31,40 +31,40 @@ Learn how to enable and setup OpenTelemetry for Gemini CLI.
|
||||
- [Sessions](#sessions-1)
|
||||
- [Tools](#tools-1)
|
||||
- [API](#api-1)
|
||||
- [Token usage](#token-usage)
|
||||
- [Token Usage](#token-usage)
|
||||
- [Files](#files-1)
|
||||
- [Chat and streaming](#chat-and-streaming-1)
|
||||
- [Model routing](#model-routing-1)
|
||||
- [Agent runs](#agent-runs-1)
|
||||
- [Chat and Streaming](#chat-and-streaming-1)
|
||||
- [Model Routing](#model-routing-1)
|
||||
- [Agent Runs](#agent-runs-1)
|
||||
- [UI](#ui-1)
|
||||
- [Performance](#performance)
|
||||
- [GenAI semantic convention](#genai-semantic-convention)
|
||||
- [GenAI Semantic Convention](#genai-semantic-convention)
|
||||
|
||||
## Key benefits
|
||||
## Key Benefits
|
||||
|
||||
- **🔍 Usage analytics**: Understand interaction patterns and feature adoption
|
||||
- **🔍 Usage Analytics**: Understand interaction patterns and feature adoption
|
||||
across your team
|
||||
- **⚡ Performance monitoring**: Track response times, token consumption, and
|
||||
- **⚡ Performance Monitoring**: Track response times, token consumption, and
|
||||
resource utilization
|
||||
- **🐛 Real-time debugging**: Identify bottlenecks, failures, and error patterns
|
||||
- **🐛 Real-time Debugging**: Identify bottlenecks, failures, and error patterns
|
||||
as they occur
|
||||
- **📊 Workflow optimization**: Make informed decisions to improve
|
||||
- **📊 Workflow Optimization**: Make informed decisions to improve
|
||||
configurations and processes
|
||||
- **🏢 Enterprise governance**: Monitor usage across teams, track costs, ensure
|
||||
- **🏢 Enterprise Governance**: Monitor usage across teams, track costs, ensure
|
||||
compliance, and integrate with existing monitoring infrastructure
|
||||
|
||||
## OpenTelemetry integration
|
||||
## OpenTelemetry Integration
|
||||
|
||||
Built on **[OpenTelemetry]** — the vendor-neutral, industry-standard
|
||||
observability framework — Gemini CLI's observability system provides:
|
||||
|
||||
- **Universal compatibility**: Export to any OpenTelemetry backend (Google
|
||||
- **Universal Compatibility**: Export to any OpenTelemetry backend (Google
|
||||
Cloud, Jaeger, Prometheus, Datadog, etc.)
|
||||
- **Standardized data**: Use consistent formats and collection methods across
|
||||
- **Standardized Data**: Use consistent formats and collection methods across
|
||||
your toolchain
|
||||
- **Future-proof integration**: Connect with existing and future observability
|
||||
- **Future-Proof Integration**: Connect with existing and future observability
|
||||
infrastructure
|
||||
- **No vendor lock-in**: Switch between backends without changing your
|
||||
- **No Vendor Lock-in**: Switch between backends without changing your
|
||||
instrumentation
|
||||
|
||||
[OpenTelemetry]: https://opentelemetry.io/
|
||||
@@ -89,9 +89,9 @@ Environment variables can be used to override the settings in the file.
|
||||
`true` or `1` will enable the feature. Any other value will disable it.
|
||||
|
||||
For detailed information about all configuration options, see the
|
||||
[Configuration guide](../get-started/configuration.md).
|
||||
[Configuration Guide](../get-started/configuration.md).
|
||||
|
||||
## Google Cloud telemetry
|
||||
## Google Cloud Telemetry
|
||||
|
||||
### Prerequisites
|
||||
|
||||
@@ -130,7 +130,7 @@ Before using either method below, complete these steps:
|
||||
--project="$OTLP_GOOGLE_CLOUD_PROJECT"
|
||||
```
|
||||
|
||||
### Direct export (recommended)
|
||||
### Direct Export (Recommended)
|
||||
|
||||
Sends telemetry directly to Google Cloud services. No collector needed.
|
||||
|
||||
@@ -150,7 +150,7 @@ Sends telemetry directly to Google Cloud services. No collector needed.
|
||||
- Metrics: https://console.cloud.google.com/monitoring/metrics-explorer
|
||||
- Traces: https://console.cloud.google.com/traces/list
|
||||
|
||||
### Collector-based export (advanced)
|
||||
### Collector-Based Export (Advanced)
|
||||
|
||||
For custom processing, filtering, or routing, use an OpenTelemetry collector to
|
||||
forward data to Google Cloud.
|
||||
@@ -184,11 +184,11 @@ forward data to Google Cloud.
|
||||
- Open `~/.gemini/tmp/<projectHash>/otel/collector-gcp.log` to view local
|
||||
collector logs.
|
||||
|
||||
## Local telemetry
|
||||
## Local Telemetry
|
||||
|
||||
For local development and debugging, you can capture telemetry data locally:
|
||||
|
||||
### File-based output (recommended)
|
||||
### File-based Output (Recommended)
|
||||
|
||||
1. Enable telemetry in your `.gemini/settings.json`:
|
||||
```json
|
||||
@@ -204,7 +204,7 @@ For local development and debugging, you can capture telemetry data locally:
|
||||
2. Run Gemini CLI and send prompts.
|
||||
3. View logs and metrics in the specified file (e.g., `.gemini/telemetry.log`).
|
||||
|
||||
### Collector-based export (advanced)
|
||||
### Collector-Based Export (Advanced)
|
||||
|
||||
1. Run the automation script:
|
||||
```bash
|
||||
@@ -220,7 +220,7 @@ For local development and debugging, you can capture telemetry data locally:
|
||||
3. View traces at http://localhost:16686 and logs/metrics in the collector log
|
||||
file.
|
||||
|
||||
## Logs and metrics
|
||||
## Logs and Metrics
|
||||
|
||||
The following section describes the structure of logs and metrics generated for
|
||||
Gemini CLI.
|
||||
@@ -361,7 +361,6 @@ Captures Gemini API requests, responses, and errors.
|
||||
- `response_text` (string, optional)
|
||||
- `prompt_id` (string)
|
||||
- `auth_type` (string)
|
||||
- `finish_reasons` (array of strings)
|
||||
|
||||
- `gemini_cli.api_error`: API request failed.
|
||||
- **Attributes**:
|
||||
@@ -378,7 +377,9 @@ Captures Gemini API requests, responses, and errors.
|
||||
- **Attributes**:
|
||||
- `model` (string)
|
||||
|
||||
#### Model routing
|
||||
#### Model Routing
|
||||
|
||||
Tracks model selections via slash commands and router decisions.
|
||||
|
||||
- `gemini_cli.slash_command`: A slash command was executed.
|
||||
- **Attributes**:
|
||||
@@ -399,7 +400,9 @@ Captures Gemini API requests, responses, and errors.
|
||||
- `failed` (boolean)
|
||||
- `error_message` (string, optional)
|
||||
|
||||
#### Chat and streaming
|
||||
#### Chat and Streaming
|
||||
|
||||
Observes streaming integrity, compression, and retry behavior.
|
||||
|
||||
- `gemini_cli.chat_compression`: Chat context was compressed.
|
||||
- **Attributes**:
|
||||
@@ -485,7 +488,9 @@ Tracks extension lifecycle and settings changes.
|
||||
- `extension_source` (string)
|
||||
- `status` (string)
|
||||
|
||||
#### Agent runs
|
||||
#### Agent Runs
|
||||
|
||||
Tracks agent lifecycle and outcomes.
|
||||
|
||||
- `gemini_cli.agent.start`: Agent run started.
|
||||
- **Attributes**:
|
||||
@@ -561,7 +566,7 @@ Tracks API request volume and latency.
|
||||
- `model`
|
||||
- Note: Overlaps with `gen_ai.client.operation.duration` (GenAI conventions).
|
||||
|
||||
##### Token usage
|
||||
##### Token Usage
|
||||
|
||||
Tracks tokens used by model and type.
|
||||
|
||||
@@ -589,7 +594,7 @@ Counts file operations with basic context.
|
||||
- `function_name`
|
||||
- `type` ("added" or "removed")
|
||||
|
||||
##### Chat and streaming
|
||||
##### Chat and Streaming
|
||||
|
||||
Resilience counters for compression, invalid chunks, and retries.
|
||||
|
||||
@@ -608,7 +613,7 @@ Resilience counters for compression, invalid chunks, and retries.
|
||||
- `gemini_cli.chat.content_retry_failure.count` (Counter, Int): Counts requests
|
||||
where all content retries failed.
|
||||
|
||||
##### Model routing
|
||||
##### Model Routing
|
||||
|
||||
Routing latency/failures and slash-command selections.
|
||||
|
||||
@@ -629,7 +634,7 @@ Routing latency/failures and slash-command selections.
|
||||
- `routing.decision_source` (string)
|
||||
- `routing.error_message` (string)
|
||||
|
||||
##### Agent runs
|
||||
##### Agent Runs
|
||||
|
||||
Agent lifecycle metrics: runs, durations, and turns.
|
||||
|
||||
@@ -721,7 +726,7 @@ Optional performance monitoring for startup, CPU/memory, and phase timing.
|
||||
- `current_value` (number)
|
||||
- `baseline_value` (number)
|
||||
|
||||
#### GenAI semantic convention
|
||||
#### GenAI Semantic Convention
|
||||
|
||||
The following metrics comply with [OpenTelemetry GenAI semantic conventions] for
|
||||
standardized observability across GenAI applications:
|
||||
|
||||
+14
-14
@@ -4,19 +4,19 @@ Gemini CLI supports a variety of themes to customize its color scheme and
|
||||
appearance. You can change the theme to suit your preferences via the `/theme`
|
||||
command or `"theme":` configuration setting.
|
||||
|
||||
## Available themes
|
||||
## Available Themes
|
||||
|
||||
Gemini CLI comes with a selection of pre-defined themes, which you can list
|
||||
using the `/theme` command within Gemini CLI:
|
||||
|
||||
- **Dark themes:**
|
||||
- **Dark Themes:**
|
||||
- `ANSI`
|
||||
- `Atom One`
|
||||
- `Ayu`
|
||||
- `Default`
|
||||
- `Dracula`
|
||||
- `GitHub`
|
||||
- **Light themes:**
|
||||
- **Light Themes:**
|
||||
- `ANSI Light`
|
||||
- `Ayu Light`
|
||||
- `Default Light`
|
||||
@@ -24,7 +24,7 @@ using the `/theme` command within Gemini CLI:
|
||||
- `Google Code`
|
||||
- `Xcode`
|
||||
|
||||
### Changing themes
|
||||
### Changing Themes
|
||||
|
||||
1. Enter `/theme` into Gemini CLI.
|
||||
2. A dialog or selection prompt appears, listing the available themes.
|
||||
@@ -36,7 +36,7 @@ using the `/theme` command within Gemini CLI:
|
||||
by a file path), you must remove the `"theme"` setting from the file before you
|
||||
can change the theme using the `/theme` command.
|
||||
|
||||
### Theme persistence
|
||||
### Theme Persistence
|
||||
|
||||
Selected themes are saved in Gemini CLI's
|
||||
[configuration](../get-started/configuration.md) so your preference is
|
||||
@@ -44,13 +44,13 @@ remembered across sessions.
|
||||
|
||||
---
|
||||
|
||||
## Custom color themes
|
||||
## Custom Color Themes
|
||||
|
||||
Gemini CLI allows you to create your own custom color themes by specifying them
|
||||
in your `settings.json` file. This gives you full control over the color palette
|
||||
used in the CLI.
|
||||
|
||||
### How to define a custom theme
|
||||
### How to Define a Custom Theme
|
||||
|
||||
Add a `customThemes` block to your user, project, or system `settings.json`
|
||||
file. Each custom theme is defined as an object with a unique name and a set of
|
||||
@@ -93,7 +93,7 @@ This object supports the keys `primary`, `secondary`, `link`, `accent`, and
|
||||
`response`. When `text.response` is provided it takes precedence over
|
||||
`text.primary` for rendering model responses in chat.
|
||||
|
||||
**Required properties:**
|
||||
**Required Properties:**
|
||||
|
||||
- `name` (must match the key in the `customThemes` object and be a string)
|
||||
- `type` (must be the string `"custom"`)
|
||||
@@ -117,7 +117,7 @@ for a full list of supported names.
|
||||
You can define multiple custom themes by adding more entries to the
|
||||
`customThemes` object.
|
||||
|
||||
### Loading themes from a file
|
||||
### Loading Themes from a File
|
||||
|
||||
In addition to defining custom themes in `settings.json`, you can also load a
|
||||
theme directly from a JSON file by specifying the file path in your
|
||||
@@ -162,17 +162,17 @@ custom theme defined in `settings.json`.
|
||||
}
|
||||
```
|
||||
|
||||
**Security note:** For your safety, Gemini CLI will only load theme files that
|
||||
**Security Note:** For your safety, Gemini CLI will only load theme files that
|
||||
are located within your home directory. If you attempt to load a theme from
|
||||
outside your home directory, a warning will be displayed and the theme will not
|
||||
be loaded. This is to prevent loading potentially malicious theme files from
|
||||
untrusted sources.
|
||||
|
||||
### Example custom theme
|
||||
### Example Custom Theme
|
||||
|
||||
<img src="../assets/theme-custom.png" alt="Custom theme example" width="600" />
|
||||
|
||||
### Using your custom theme
|
||||
### Using Your Custom Theme
|
||||
|
||||
- Select your custom theme using the `/theme` command in Gemini CLI. Your custom
|
||||
theme will appear in the theme selection dialog.
|
||||
@@ -184,7 +184,7 @@ untrusted sources.
|
||||
|
||||
---
|
||||
|
||||
## Dark themes
|
||||
## Dark Themes
|
||||
|
||||
### ANSI
|
||||
|
||||
@@ -210,7 +210,7 @@ untrusted sources.
|
||||
|
||||
<img src="/assets/theme-github.png" alt="GitHub theme" width="600">
|
||||
|
||||
## Light themes
|
||||
## Light Themes
|
||||
|
||||
### ANSI Light
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Token caching and cost optimization
|
||||
# Token Caching and Cost Optimization
|
||||
|
||||
Gemini CLI automatically optimizes API costs through token caching when using
|
||||
API key authentication (Gemini API key or Vertex AI). This feature reuses
|
||||
|
||||
+16
-16
@@ -5,7 +5,7 @@ which projects can use the full capabilities of the 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.
|
||||
|
||||
## Enabling the feature
|
||||
## Enabling the Feature
|
||||
|
||||
The Trusted Folders feature is **disabled by default**. To use it, you must
|
||||
first enable it in your settings.
|
||||
@@ -22,7 +22,7 @@ Add the following to your user `settings.json` file:
|
||||
}
|
||||
```
|
||||
|
||||
## How it works: The trust dialog
|
||||
## 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:
|
||||
@@ -38,58 +38,58 @@ folder, a dialog will automatically appear, prompting you to make a choice:
|
||||
Your choice is saved in a central file (`~/.gemini/trustedFolders.json`), so you
|
||||
will only be asked once per folder.
|
||||
|
||||
## Why trust matters: The impact of an untrusted workspace
|
||||
## 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:
|
||||
|
||||
1. **Workspace settings are ignored**: The CLI will **not** load the
|
||||
1. **Workspace Settings are Ignored**: The CLI will **not** load the
|
||||
`.gemini/settings.json` file from the project. This prevents the loading of
|
||||
custom tools and other potentially dangerous configurations.
|
||||
|
||||
2. **Environment variables are ignored**: The CLI will **not** load any `.env`
|
||||
2. **Environment Variables are Ignored**: The CLI will **not** load any `.env`
|
||||
files from the project.
|
||||
|
||||
3. **Extension management is restricted**: You **cannot install, update, or
|
||||
3. **Extension Management is Restricted**: You **cannot install, update, or
|
||||
uninstall** extensions.
|
||||
|
||||
4. **Tool auto-acceptance is disabled**: You will always be prompted before any
|
||||
4. **Tool Auto-Acceptance is Disabled**: You will always be prompted before any
|
||||
tool is run, even if you have auto-acceptance enabled globally.
|
||||
|
||||
5. **Automatic memory loading is disabled**: The CLI will not automatically
|
||||
5. **Automatic Memory Loading is Disabled**: The CLI will not automatically
|
||||
load files into context from directories specified in local settings.
|
||||
|
||||
6. **MCP servers do not connect**: The CLI will not attempt to connect to any
|
||||
6. **MCP Servers Do Not Connect**: The CLI will not attempt to connect to any
|
||||
[Model Context Protocol (MCP)](../tools/mcp-server.md) servers.
|
||||
|
||||
7. **Custom commands are not loaded**: The CLI will not load any custom
|
||||
7. **Custom Commands are Not Loaded**: The CLI will not load any custom
|
||||
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.
|
||||
|
||||
## Managing your trust settings
|
||||
## Managing Your Trust Settings
|
||||
|
||||
If you need to change a decision or see all your settings, you have a couple of
|
||||
options:
|
||||
|
||||
- **Change the current folder's trust**: Run the `/permissions` command from
|
||||
- **Change the Current Folder's Trust**: Run the `/permissions` command from
|
||||
within the CLI. This will bring up the same interactive dialog, allowing you
|
||||
to change the trust level for the current folder.
|
||||
|
||||
- **View all trust rules**: To see a complete list of all your trusted and
|
||||
- **View All Trust Rules**: To see a complete list of all your trusted and
|
||||
untrusted folder rules, you can inspect the contents of the
|
||||
`~/.gemini/trustedFolders.json` file in your home directory.
|
||||
|
||||
## The trust check process (advanced)
|
||||
## The Trust Check Process (Advanced)
|
||||
|
||||
For advanced users, it's helpful to know the exact order of operations for how
|
||||
trust is determined:
|
||||
|
||||
1. **IDE trust signal**: If you are using the
|
||||
1. **IDE Trust Signal**: If you are using the
|
||||
[IDE Integration](../ide-integration/index.md), the CLI first asks the IDE
|
||||
if the workspace is trusted. The IDE's response takes highest priority.
|
||||
|
||||
2. **Local trust file**: If the IDE is not connected, the CLI checks the
|
||||
2. **Local Trust File**: If the IDE is not connected, the CLI checks the
|
||||
central `~/.gemini/trustedFolders.json` file.
|
||||
|
||||
@@ -8,7 +8,7 @@ This page contains tutorials for interacting with Gemini CLI.
|
||||
> and understand the tools it provides. Your use of third-party servers is at
|
||||
> your own risk.
|
||||
|
||||
This tutorial demonstrates how to set up an MCP server, using the
|
||||
This tutorial demonstrates how to set up a MCP server, using the
|
||||
[GitHub MCP server](https://github.com/github/github-mcp-server) as an example.
|
||||
The GitHub MCP server provides tools for interacting with GitHub repositories,
|
||||
such as creating issues and commenting on pull requests.
|
||||
|
||||
@@ -35,7 +35,7 @@ _PowerShell_
|
||||
Remove-Item -Path (Join-Path $env:LocalAppData "npm-cache\_npx") -Recurse -Force
|
||||
```
|
||||
|
||||
## Method 2: Using npm (global install)
|
||||
## 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.
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# Gemini CLI core
|
||||
# Gemini CLI Core
|
||||
|
||||
Gemini CLI's core package (`packages/core`) is the backend portion of Gemini
|
||||
CLI, handling communication with the Gemini API, managing tools, and processing
|
||||
|
||||
+18
-18
@@ -27,21 +27,21 @@ More content here.
|
||||
@./shared/configuration.md
|
||||
```
|
||||
|
||||
## Supported path formats
|
||||
## Supported Path Formats
|
||||
|
||||
### Relative paths
|
||||
### Relative Paths
|
||||
|
||||
- `@./file.md` - Import from the same directory
|
||||
- `@../file.md` - Import from parent directory
|
||||
- `@./components/file.md` - Import from subdirectory
|
||||
|
||||
### Absolute paths
|
||||
### Absolute Paths
|
||||
|
||||
- `@/absolute/path/to/file.md` - Import using absolute path
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic import
|
||||
### Basic Import
|
||||
|
||||
```markdown
|
||||
# My GEMINI.md
|
||||
@@ -55,7 +55,7 @@ Welcome to my project!
|
||||
@./features/overview.md
|
||||
```
|
||||
|
||||
### Nested imports
|
||||
### Nested Imports
|
||||
|
||||
The imported files can themselves contain imports, creating a nested structure:
|
||||
|
||||
@@ -73,9 +73,9 @@ The imported files can themselves contain imports, creating a nested structure:
|
||||
@./shared/title.md
|
||||
```
|
||||
|
||||
## Safety features
|
||||
## Safety Features
|
||||
|
||||
### Circular import detection
|
||||
### Circular Import Detection
|
||||
|
||||
The processor automatically detects and prevents circular imports:
|
||||
|
||||
@@ -89,37 +89,37 @@ The processor automatically detects and prevents circular imports:
|
||||
@./file-a.md <!-- This will be detected and prevented -->
|
||||
```
|
||||
|
||||
### File access security
|
||||
### File Access Security
|
||||
|
||||
The `validateImportPath` function ensures that imports are only allowed from
|
||||
specified directories, preventing access to sensitive files outside the allowed
|
||||
scope.
|
||||
|
||||
### Maximum import depth
|
||||
### Maximum Import Depth
|
||||
|
||||
To prevent infinite recursion, there's a configurable maximum import depth
|
||||
(default: 5 levels).
|
||||
|
||||
## Error handling
|
||||
## Error Handling
|
||||
|
||||
### Missing files
|
||||
### Missing Files
|
||||
|
||||
If a referenced file doesn't exist, the import will fail gracefully with an
|
||||
error comment in the output.
|
||||
|
||||
### File access errors
|
||||
### File Access Errors
|
||||
|
||||
Permission issues or other file system errors are handled gracefully with
|
||||
appropriate error messages.
|
||||
|
||||
## Code region detection
|
||||
## Code Region Detection
|
||||
|
||||
The import processor uses the `marked` library to detect code blocks and inline
|
||||
code spans, ensuring that `@` imports inside these regions are properly ignored.
|
||||
This provides robust handling of nested code blocks and complex Markdown
|
||||
structures.
|
||||
|
||||
## Import tree structure
|
||||
## Import Tree Structure
|
||||
|
||||
The processor returns an import tree that shows the hierarchy of imported files,
|
||||
similar to Claude's `/memory` feature. This helps users debug problems with
|
||||
@@ -143,7 +143,7 @@ Memory Files
|
||||
The tree preserves the order that files were imported and shows the complete
|
||||
import chain for debugging purposes.
|
||||
|
||||
## Comparison to Claude Code's `/memory` (`claude.md`) approach
|
||||
## Comparison to Claude Code's `/memory` (`claude.md`) Approach
|
||||
|
||||
Claude Code's `/memory` feature (as seen in `claude.md`) produces a flat, linear
|
||||
document by concatenating all included files, always marking file boundaries
|
||||
@@ -154,7 +154,7 @@ for reconstructing the hierarchy if needed.
|
||||
> [!NOTE] The import tree is mainly for clarity during development and has
|
||||
> limited relevance to LLM consumption.
|
||||
|
||||
## API reference
|
||||
## API Reference
|
||||
|
||||
### `processImports(content, basePath, debugMode?, importState?)`
|
||||
|
||||
@@ -225,7 +225,7 @@ directory if no `.git` is found)
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common issues
|
||||
### Common Issues
|
||||
|
||||
1. **Import not working**: Check that the file exists and the path is correct
|
||||
2. **Circular import warnings**: Review your import structure for circular
|
||||
@@ -235,7 +235,7 @@ directory if no `.git` is found)
|
||||
4. **Path resolution issues**: Use absolute paths if relative paths aren't
|
||||
resolving correctly
|
||||
|
||||
### Debug mode
|
||||
### Debug Mode
|
||||
|
||||
Enable debug mode to see detailed logging of the import process:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Policy engine
|
||||
# Policy Engine
|
||||
|
||||
:::note This feature is currently in testing. To enable it, set
|
||||
`tools.enableMessageBusIntegration` to `true` in your `settings.json` file. :::
|
||||
@@ -49,7 +49,7 @@ The `toolName` in the rule must match the name of the tool being called.
|
||||
wildcard. A `toolName` of `my-server__*` will match any tool from the
|
||||
`my-server` MCP.
|
||||
|
||||
#### Arguments pattern
|
||||
#### Arguments Pattern
|
||||
|
||||
If `argsPattern` is specified, the tool's arguments are converted to a stable
|
||||
JSON string, which is then tested against the provided regular expression. If
|
||||
@@ -64,7 +64,7 @@ There are three possible decisions a rule can enforce:
|
||||
- `ask_user`: The user is prompted to approve or deny the tool call. (In
|
||||
non-interactive mode, this is treated as `deny`.)
|
||||
|
||||
### Priority system and tiers
|
||||
### Priority system & tiers
|
||||
|
||||
The policy engine uses a sophisticated priority system to resolve conflicts when
|
||||
multiple rules match a single tool call. The core principle is simple: **the
|
||||
@@ -112,12 +112,12 @@ outcome.
|
||||
|
||||
A rule matches a tool call if all of its conditions are met:
|
||||
|
||||
1. **Tool name**: The `toolName` in the rule must match the name of the tool
|
||||
1. **Tool Name**: The `toolName` in the rule must match the name of the tool
|
||||
being called.
|
||||
- **Wildcards**: For Model-hosting-protocol (MCP) servers, you can use a
|
||||
wildcard. A `toolName` of `my-server__*` will match any tool from the
|
||||
`my-server` MCP.
|
||||
2. **Arguments pattern**: If `argsPattern` is specified, the tool's arguments
|
||||
2. **Arguments Pattern**: If `argsPattern` is specified, the tool's arguments
|
||||
are converted to a stable JSON string, which is then tested against the
|
||||
provided regular expression. If the arguments don't match the pattern, the
|
||||
rule does not apply.
|
||||
@@ -220,7 +220,7 @@ decision = "allow"
|
||||
priority = 200
|
||||
```
|
||||
|
||||
**2. Using a wildcard**
|
||||
**2. Using a Wildcard**
|
||||
|
||||
To create a rule that applies to _all_ tools on a specific MCP server, specify
|
||||
only the `mcpName`.
|
||||
|
||||
+26
-26
@@ -1,11 +1,11 @@
|
||||
# Gemini CLI core: Tools API
|
||||
# Gemini CLI Core: Tools API
|
||||
|
||||
The Gemini CLI core (`packages/core`) features a robust system for defining,
|
||||
registering, and executing tools. These tools extend the capabilities of the
|
||||
Gemini model, allowing it to interact with the local environment, fetch web
|
||||
content, and perform various actions beyond simple text generation.
|
||||
|
||||
## Core concepts
|
||||
## Core Concepts
|
||||
|
||||
- **Tool (`tools.ts`):** An interface and base class (`BaseTool`) that defines
|
||||
the contract for all tools. Each tool must have:
|
||||
@@ -32,35 +32,35 @@ content, and perform various actions beyond simple text generation.
|
||||
- `returnDisplay`: A user-friendly string (often Markdown) or a special object
|
||||
(like `FileDiff`) for display in the CLI.
|
||||
|
||||
- **Returning rich content:** Tools are not limited to returning simple text.
|
||||
- **Returning Rich Content:** Tools are not limited to returning simple text.
|
||||
The `llmContent` can be a `PartListUnion`, which is an array that can contain
|
||||
a mix of `Part` objects (for images, audio, etc.) and `string`s. This allows a
|
||||
single tool execution to return multiple pieces of rich content.
|
||||
|
||||
- **Tool registry (`tool-registry.ts`):** A class (`ToolRegistry`) responsible
|
||||
- **Tool Registry (`tool-registry.ts`):** A class (`ToolRegistry`) responsible
|
||||
for:
|
||||
- **Registering tools:** Holding a collection of all available built-in tools
|
||||
- **Registering Tools:** Holding a collection of all available built-in tools
|
||||
(e.g., `ReadFileTool`, `ShellTool`).
|
||||
- **Discovering tools:** It can also discover tools dynamically:
|
||||
- **Command-based discovery:** If `tools.discoveryCommand` is configured in
|
||||
- **Discovering Tools:** It can also discover tools dynamically:
|
||||
- **Command-based Discovery:** If `tools.discoveryCommand` is configured in
|
||||
settings, this command is executed. It's expected to output JSON
|
||||
describing custom tools, which are then registered as `DiscoveredTool`
|
||||
instances.
|
||||
- **MCP-based discovery:** If `mcp.serverCommand` is configured, the
|
||||
- **MCP-based Discovery:** If `mcp.serverCommand` is configured, the
|
||||
registry can connect to a Model Context Protocol (MCP) server to list and
|
||||
register tools (`DiscoveredMCPTool`).
|
||||
- **Providing schemas:** Exposing the `FunctionDeclaration` schemas of all
|
||||
- **Providing Schemas:** Exposing the `FunctionDeclaration` schemas of all
|
||||
registered tools to the Gemini model, so it knows what tools are available
|
||||
and how to use them.
|
||||
- **Retrieving tools:** Allowing the core to get a specific tool by name for
|
||||
- **Retrieving Tools:** Allowing the core to get a specific tool by name for
|
||||
execution.
|
||||
|
||||
## Built-in tools
|
||||
## Built-in Tools
|
||||
|
||||
The core comes with a suite of pre-defined tools, typically found in
|
||||
`packages/core/src/tools/`. These include:
|
||||
|
||||
- **File system tools:**
|
||||
- **File System Tools:**
|
||||
- `LSTool` (`ls.ts`): Lists directory contents.
|
||||
- `ReadFileTool` (`read-file.ts`): Reads the content of a single file.
|
||||
- `WriteFileTool` (`write-file.ts`): Writes content to a file.
|
||||
@@ -70,26 +70,26 @@ The core comes with a suite of pre-defined tools, typically found in
|
||||
requiring confirmation).
|
||||
- `ReadManyFilesTool` (`read-many-files.ts`): Reads and concatenates content
|
||||
from multiple files or glob patterns (used by the `@` command in CLI).
|
||||
- **Execution tools:**
|
||||
- **Execution Tools:**
|
||||
- `ShellTool` (`shell.ts`): Executes arbitrary shell commands (requires
|
||||
careful sandboxing and user confirmation).
|
||||
- **Web tools:**
|
||||
- **Web Tools:**
|
||||
- `WebFetchTool` (`web-fetch.ts`): Fetches content from a URL.
|
||||
- `WebSearchTool` (`web-search.ts`): Performs a web search.
|
||||
- **Memory tools:**
|
||||
- **Memory Tools:**
|
||||
- `MemoryTool` (`memoryTool.ts`): Interacts with the AI's memory.
|
||||
|
||||
Each of these tools extends `BaseTool` and implements the required methods for
|
||||
its specific functionality.
|
||||
|
||||
## Tool execution flow
|
||||
## Tool Execution Flow
|
||||
|
||||
1. **Model request:** The Gemini model, based on the user's prompt and the
|
||||
1. **Model Request:** The Gemini model, based on the user's prompt and the
|
||||
provided tool schemas, decides to use a tool and returns a `FunctionCall`
|
||||
part in its response, specifying the tool name and arguments.
|
||||
2. **Core receives request:** The core parses this `FunctionCall`.
|
||||
3. **Tool retrieval:** It looks up the requested tool in the `ToolRegistry`.
|
||||
4. **Parameter validation:** The tool's `validateToolParams()` method is
|
||||
2. **Core Receives Request:** The core parses this `FunctionCall`.
|
||||
3. **Tool Retrieval:** It looks up the requested tool in the `ToolRegistry`.
|
||||
4. **Parameter Validation:** The tool's `validateToolParams()` method is
|
||||
called.
|
||||
5. **Confirmation (if needed):**
|
||||
- The tool's `shouldConfirmExecute()` method is called.
|
||||
@@ -99,27 +99,27 @@ its specific functionality.
|
||||
6. **Execution:** If validated and confirmed (or if no confirmation is needed),
|
||||
the core calls the tool's `execute()` method with the provided arguments and
|
||||
an `AbortSignal` (for potential cancellation).
|
||||
7. **Result processing:** The `ToolResult` from `execute()` is received by the
|
||||
7. **Result Processing:** The `ToolResult` from `execute()` is received by the
|
||||
core.
|
||||
8. **Response to model:** The `llmContent` from the `ToolResult` is packaged as
|
||||
8. **Response to Model:** The `llmContent` from the `ToolResult` is packaged as
|
||||
a `FunctionResponse` and sent back to the Gemini model so it can continue
|
||||
generating a user-facing response.
|
||||
9. **Display to user:** The `returnDisplay` from the `ToolResult` is sent to
|
||||
9. **Display to User:** The `returnDisplay` from the `ToolResult` is sent to
|
||||
the CLI to show the user what the tool did.
|
||||
|
||||
## Extending with custom tools
|
||||
## Extending with Custom Tools
|
||||
|
||||
While direct programmatic registration of new tools by users isn't explicitly
|
||||
detailed as a primary workflow in the provided files for typical end-users, the
|
||||
architecture supports extension through:
|
||||
|
||||
- **Command-based discovery:** Advanced users or project administrators can
|
||||
- **Command-based Discovery:** Advanced users or project administrators can
|
||||
define a `tools.discoveryCommand` in `settings.json`. This command, when run
|
||||
by the Gemini CLI core, should output a JSON array of `FunctionDeclaration`
|
||||
objects. The core will then make these available as `DiscoveredTool`
|
||||
instances. The corresponding `tools.callCommand` would then be responsible for
|
||||
actually executing these custom tools.
|
||||
- **MCP server(s):** For more complex scenarios, one or more MCP servers can be
|
||||
- **MCP Server(s):** For more complex scenarios, one or more MCP servers can be
|
||||
set up and configured via the `mcpServers` setting in `settings.json`. The
|
||||
Gemini CLI core can then discover and use tools exposed by these servers. As
|
||||
mentioned, if you have multiple MCP servers, the tool names will be prefixed
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Example proxy script
|
||||
# Example Proxy Script
|
||||
|
||||
The following is an example of a proxy script that can be used with the
|
||||
`GEMINI_SANDBOX_PROXY_COMMAND` environment variable. This script only allows
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Extension releasing
|
||||
# Extension Releasing
|
||||
|
||||
There are two primary ways of releasing extensions to users:
|
||||
|
||||
@@ -64,7 +64,7 @@ If you plan on doing cherry picks, you may want to avoid having your default
|
||||
branch be the stable branch to avoid force-pushing to the default branch which
|
||||
should generally be avoided.
|
||||
|
||||
## Releasing through GitHub releases
|
||||
## Releasing through Github releases
|
||||
|
||||
Gemini CLI extensions can be distributed through
|
||||
[GitHub Releases](https://docs.github.com/en/repositories/releasing-projects-on-github/about-releases).
|
||||
@@ -105,9 +105,9 @@ To ensure Gemini CLI can automatically find the correct release asset for each
|
||||
platform, you must follow this naming convention. The CLI will search for assets
|
||||
in the following order:
|
||||
|
||||
1. **Platform and architecture-Specific:**
|
||||
1. **Platform and Architecture-Specific:**
|
||||
`{platform}.{arch}.{name}.{extension}`
|
||||
2. **Platform-specific:** `{platform}.{name}.{extension}`
|
||||
2. **Platform-Specific:** `{platform}.{name}.{extension}`
|
||||
3. **Generic:** If only one asset is provided, it will be used as a generic
|
||||
fallback.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Getting started with Gemini CLI extensions
|
||||
# Getting Started with Gemini CLI Extensions
|
||||
|
||||
This guide will walk you through creating your first Gemini CLI extension.
|
||||
You'll learn how to set up a new extension, add a custom tool via an MCP server,
|
||||
@@ -10,7 +10,7 @@ file.
|
||||
Before you start, make sure you have the Gemini CLI installed and a basic
|
||||
understanding of Node.js and TypeScript.
|
||||
|
||||
## Step 1: Create a new extension
|
||||
## Step 1: Create a New Extension
|
||||
|
||||
The easiest way to start is by using one of the built-in templates. We'll use
|
||||
the `mcp-server` example as our foundation.
|
||||
@@ -32,7 +32,7 @@ my-first-extension/
|
||||
└── tsconfig.json
|
||||
```
|
||||
|
||||
## Step 2: Understand the extension files
|
||||
## Step 2: Understand the Extension Files
|
||||
|
||||
Let's look at the key files in your new extension.
|
||||
|
||||
@@ -124,7 +124,7 @@ These are standard configuration files for a TypeScript project. The
|
||||
`package.json` file defines dependencies and a `build` script, and
|
||||
`tsconfig.json` configures the TypeScript compiler.
|
||||
|
||||
## Step 3: Build and link your extension
|
||||
## Step 3: Build and Link Your Extension
|
||||
|
||||
Before you can use the extension, you need to compile the TypeScript code and
|
||||
link the extension to your Gemini CLI installation for local development.
|
||||
@@ -158,7 +158,7 @@ link the extension to your Gemini CLI installation for local development.
|
||||
Now, restart your Gemini CLI session. The new `fetch_posts` tool will be
|
||||
available. You can test it by asking: "fetch posts".
|
||||
|
||||
## Step 4: Add a custom command
|
||||
## Step 4: Add a Custom Command
|
||||
|
||||
Custom commands provide a way to create shortcuts for complex prompts. Let's add
|
||||
a command that searches for a pattern in your code.
|
||||
@@ -186,7 +186,7 @@ a command that searches for a pattern in your code.
|
||||
After saving the file, restart the Gemini CLI. You can now run
|
||||
`/fs:grep-code "some pattern"` to use your new command.
|
||||
|
||||
## Step 5: Add a custom `GEMINI.md`
|
||||
## Step 5: Add a Custom `GEMINI.md`
|
||||
|
||||
You can provide persistent context to the model by adding a `GEMINI.md` file to
|
||||
your extension. This is useful for giving the model instructions on how to
|
||||
@@ -222,7 +222,7 @@ need this for extensions built to expose commands and prompts.
|
||||
Restart the CLI again. The model will now have the context from your `GEMINI.md`
|
||||
file in every session where the extension is active.
|
||||
|
||||
## Step 6: Releasing your extension
|
||||
## Step 6: Releasing Your Extension
|
||||
|
||||
Once you are happy with your extension, you can share it with others. The two
|
||||
primary ways of releasing extensions are via a Git repository or through GitHub
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Gemini CLI extensions
|
||||
# Gemini CLI Extensions
|
||||
|
||||
_This documentation is up-to-date with the v0.4.0 release._
|
||||
|
||||
@@ -54,11 +54,10 @@ gemini extensions install <source> [--ref <ref>] [--auto-update] [--pre-release]
|
||||
|
||||
### Uninstalling an extension
|
||||
|
||||
To uninstall one or more extensions, run
|
||||
`gemini extensions uninstall <name...>`:
|
||||
To uninstall, run `gemini extensions uninstall <name>`:
|
||||
|
||||
```
|
||||
gemini extensions uninstall gemini-cli-security gemini-cli-another-extension
|
||||
gemini extensions uninstall gemini-cli-security
|
||||
```
|
||||
|
||||
### Disabling an extension
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# Frequently asked questions (FAQ)
|
||||
# Frequently Asked Questions (FAQ)
|
||||
|
||||
This page provides answers to common questions and solutions to frequent
|
||||
problems encountered while using Gemini CLI.
|
||||
|
||||
+157
-195
@@ -1,198 +1,206 @@
|
||||
# Gemini CLI authentication setup
|
||||
# Gemini CLI Authentication Setup
|
||||
|
||||
To use Gemini CLI, you'll need to authenticate with Google. This guide helps you
|
||||
quickly find the best way to sign in based on your account type and how you're
|
||||
using the CLI.
|
||||
Gemini CLI requires authentication using Google's services. Before using Gemini
|
||||
CLI, configure **one** of the following authentication methods:
|
||||
|
||||
For most users, we recommend starting Gemini CLI and logging in with your
|
||||
personal Google account.
|
||||
- Interactive mode:
|
||||
- Recommended: Login with Google
|
||||
- Use Gemini API key
|
||||
- Use Vertex AI
|
||||
- Headless (non-interactive) mode
|
||||
- Google Cloud Environments (Cloud Shell, Compute Engine, etc.)
|
||||
|
||||
## Choose your authentication method <a id="auth-methods"></a>
|
||||
## Quick Check: Running in Google Cloud Shell?
|
||||
|
||||
Select the authentication method that matches your situation in the table below:
|
||||
If you are running the Gemini CLI within a Google Cloud Shell environment,
|
||||
authentication is typically automatic using your Cloud Shell credentials.
|
||||
|
||||
| User Type / Scenario | Recommended Authentication Method | Google Cloud Project Required |
|
||||
| :--------------------------------------------------------------------- | :--------------------------------------------------------------- | :---------------------------------------------------------- |
|
||||
| Individual Google accounts | [Login with Google](#login-google) | No, with exceptions |
|
||||
| Organization users with a company, school, or Google Workspace account | [Login with Google](#login-google) | [Yes](#set-gcp) |
|
||||
| AI Studio user with a Gemini API key | [Use Gemini API Key](#gemini-api) | No |
|
||||
| Google Cloud Vertex AI user | [Vertex AI](#vertex-ai) | [Yes](#set-gcp) |
|
||||
| [Headless mode](#headless) | [Use Gemini API Key](#gemini-api) or<br> [Vertex AI](#vertex-ai) | No (for Gemini API Key)<br> [Yes](#set-gcp) (for Vertex AI) |
|
||||
### Other Google Cloud Environments (e.g., Compute Engine)
|
||||
|
||||
### What is my Google account type?
|
||||
Some other Google Cloud environments, such as Compute Engine VMs, might also
|
||||
support automatic authentication. In these environments, Gemini CLI can
|
||||
automatically use Application Default Credentials (ADC) sourced from the
|
||||
environment's metadata server.
|
||||
|
||||
- **Individual Google accounts:** Includes all
|
||||
[free tier accounts](../quota-and-pricing/#free-usage) such as Gemini Code
|
||||
Assist for individuals, as well as paid subscriptions for
|
||||
[Google AI Pro and Ultra](https://gemini.google/subscriptions/).
|
||||
If automatic authentication does not occur in your environment, you will need to
|
||||
use one of the interactive methods described below.
|
||||
|
||||
- **Organization accounts:** Accounts using paid licenses through an
|
||||
organization such as a company, school, or
|
||||
[Google Workspace](https://workspace.google.com/). Includes
|
||||
[Google AI Ultra for Business](https://support.google.com/a/answer/16345165)
|
||||
subscriptions.
|
||||
## Authenticate in Interactive mode
|
||||
|
||||
## (Recommended) Login with Google <a id="login-google"></a>
|
||||
When you run Gemini CLI through the command-line, Gemini CLI will provide the
|
||||
following options:
|
||||
|
||||
If you run Gemini CLI on your local machine, the simplest authentication method
|
||||
is logging in with your Google account. This method requires a web browser on a
|
||||
machine that can communicate with the terminal running Gemini CLI (e.g., your
|
||||
local machine).
|
||||
```bash
|
||||
> 1. Login with Google
|
||||
> 2. Use Gemini API key
|
||||
> 3. Vertex AI
|
||||
```
|
||||
|
||||
> **Important:** If you are a **Google AI Pro** or **Google AI Ultra**
|
||||
> subscriber, use the Google account associated with your subscription.
|
||||
The following sections provide instructions for each of these authentication
|
||||
options.
|
||||
|
||||
To authenticate and use Gemini CLI:
|
||||
### Recommended: Login with Google
|
||||
|
||||
1. Start the CLI:
|
||||
If you are running Gemini CLI on your local machine, the simplest method is
|
||||
logging in with your Google account.
|
||||
|
||||
```bash
|
||||
gemini
|
||||
```
|
||||
> **Important:** Use this method if you are a **Google AI Pro** or **Google AI
|
||||
> Ultra** subscriber.
|
||||
|
||||
2. Select **Login with Google**. Gemini CLI opens a login prompt using your web
|
||||
browser. Follow the on-screen instructions. Your credentials will be cached
|
||||
locally for future sessions.
|
||||
1. Select **Login with Google**. Gemini CLI will open a login prompt using your
|
||||
web browser.
|
||||
|
||||
### Do I need to set my Google Cloud project?
|
||||
If you are a **Google AI Pro** or **Google AI Ultra** subscriber, login with
|
||||
the Google account associated with your subscription.
|
||||
|
||||
Most individual Google accounts (free and paid) don't require a Google Cloud
|
||||
project for authentication. However, you'll need to set a Google Cloud project
|
||||
when you meet at least one of the following conditions:
|
||||
2. Follow the on-screen instructions. Your credentials will be cached locally
|
||||
for future sessions.
|
||||
|
||||
- You are using a company, school, or Google Workspace account.
|
||||
- You are using a Gemini Code Assist license from the Google Developer Program.
|
||||
- You are using a license from a Gemini Code Assist subscription.
|
||||
> **Note:** This method requires a web browser on a machine that can
|
||||
> communicate with the terminal running the CLI (e.g., your local machine).
|
||||
> The browser will be redirected to a `localhost` URL that the CLI listens on
|
||||
> during setup.
|
||||
|
||||
For instructions, see [Set your Google Cloud Project](#set-gcp).
|
||||
#### (Optional) Set your Google Cloud Project
|
||||
|
||||
## Use Gemini API key <a id="gemini-api"></a>
|
||||
When you log in using a Google account, you may be prompted to select a
|
||||
`GOOGLE_CLOUD_PROJECT`.
|
||||
|
||||
This can be necessary if you are:
|
||||
|
||||
- Using a Google Workspace account.
|
||||
- Using a Gemini Code Assist license from the Google Developer Program.
|
||||
- Using a license from a Gemini Code Assist subscription.
|
||||
- Using the product outside the
|
||||
[supported regions](https://developers.google.com/gemini-code-assist/resources/available-locations)
|
||||
for free individual usage.
|
||||
- A Google account holder under the age of 18.
|
||||
|
||||
If you fall into one of these categories, you must:
|
||||
|
||||
1. Have a Google Cloud Project ID.
|
||||
2. [Enable the Gemini for Cloud API](https://cloud.google.com/gemini/docs/discover/set-up-gemini#enable-api).
|
||||
3. [Configure necessary IAM access permissions](https://cloud.google.com/gemini/docs/discover/set-up-gemini#grant-iam).
|
||||
|
||||
To set the project ID, you can export either the `GOOGLE_CLOUD_PROJECT` or
|
||||
`GOOGLE_CLOUD_PROJECT_ID` environment variable. The CLI checks for
|
||||
`GOOGLE_CLOUD_PROJECT` first, then falls back to `GOOGLE_CLOUD_PROJECT_ID` :
|
||||
|
||||
```bash
|
||||
# Replace YOUR_PROJECT_ID with your actual Google Cloud Project ID
|
||||
# Using the standard variable:
|
||||
export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"
|
||||
|
||||
# Or, using the fallback variable:
|
||||
export GOOGLE_CLOUD_PROJECT_ID="YOUR_PROJECT_ID"
|
||||
```
|
||||
|
||||
To make this setting persistent, see
|
||||
[Persisting Environment Variables](#persisting-environment-variables).
|
||||
|
||||
### Use Gemini API Key
|
||||
|
||||
If you don't want to authenticate using your Google account, you can use an API
|
||||
key from Google AI Studio.
|
||||
|
||||
To authenticate and use Gemini CLI with a Gemini API key:
|
||||
1. Obtain your API key from
|
||||
[Google AI Studio](https://aistudio.google.com/app/apikey).
|
||||
2. Set the `GEMINI_API_KEY` environment variable:
|
||||
|
||||
1. Obtain your API key from
|
||||
[Google AI Studio](https://aistudio.google.com/app/apikey).
|
||||
```bash
|
||||
# Replace YOUR_GEMINI_API_KEY with the key from AI Studio
|
||||
export GEMINI_API_KEY="YOUR_GEMINI_API_KEY"
|
||||
```
|
||||
|
||||
2. Set the `GEMINI_API_KEY` environment variable to your key. For example:
|
||||
|
||||
```bash
|
||||
# Replace YOUR_GEMINI_API_KEY with the key from AI Studio
|
||||
export GEMINI_API_KEY="YOUR_GEMINI_API_KEY"
|
||||
```
|
||||
|
||||
To make this setting persistent, see
|
||||
[Persisting Environment Variables](#persisting-vars).
|
||||
|
||||
3. Start the CLI:
|
||||
|
||||
```bash
|
||||
gemini
|
||||
```
|
||||
|
||||
4. Select **Use Gemini API key**.
|
||||
To make this setting persistent, see
|
||||
[Persisting Environment Variables](#persisting-environment-variables).
|
||||
|
||||
> **Warning:** Treat API keys, especially for services like Gemini, as sensitive
|
||||
> credentials. Protect them to prevent unauthorized access and potential misuse
|
||||
> of the service under your account.
|
||||
|
||||
## Use Vertex AI <a id="vertex-ai"></a>
|
||||
### Use Vertex AI
|
||||
|
||||
To use Gemini CLI with Google Cloud's Vertex AI platform, choose from the
|
||||
following authentication options:
|
||||
If you intend to use Google Cloud's Vertex AI platform, you have several
|
||||
authentication options:
|
||||
|
||||
- A. Application Default Credentials (ADC) using `gcloud`.
|
||||
- B. Service account JSON key.
|
||||
- C. Google Cloud API key.
|
||||
- Application Default Credentials (ADC) and `gcloud`.
|
||||
- A Service Account JSON key.
|
||||
- A Google Cloud API key.
|
||||
|
||||
Regardless of your authentication method for Vertex AI, you'll need to set
|
||||
`GOOGLE_CLOUD_PROJECT` to your Google Cloud project ID with the Vertex AI API
|
||||
enabled, and `GOOGLE_CLOUD_LOCATION` to the location of your Vertex AI resources
|
||||
or the location where you want to run your jobs.
|
||||
#### First: Set required environment variables
|
||||
|
||||
For example:
|
||||
Regardless of your method of authentication, you'll typically need to set the
|
||||
following variables: `GOOGLE_CLOUD_PROJECT` (or `GOOGLE_CLOUD_PROJECT_ID`) and
|
||||
`GOOGLE_CLOUD_LOCATION`.
|
||||
|
||||
To set these variables:
|
||||
|
||||
```bash
|
||||
# Replace with your project ID and desired location (e.g., us-central1)
|
||||
# You can use GOOGLE_CLOUD_PROJECT_ID as a fallback for GOOGLE_CLOUD_PROJECT
|
||||
export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"
|
||||
export GOOGLE_CLOUD_LOCATION="YOUR_PROJECT_LOCATION"
|
||||
```
|
||||
|
||||
To make any Vertex AI environment variable settings persistent, see
|
||||
[Persisting Environment Variables](#persisting-vars).
|
||||
#### A. Vertex AI - Application Default Credentials (ADC) using `gcloud`
|
||||
|
||||
#### A. Vertex AI - application default credentials (ADC) using `gcloud`
|
||||
|
||||
Consider this authentication method if you have Google Cloud CLI installed.
|
||||
Consider this method of authentication if you have Google Cloud CLI installed.
|
||||
|
||||
> **Note:** If you have previously set `GOOGLE_API_KEY` or `GEMINI_API_KEY`, you
|
||||
> must unset them to use ADC:
|
||||
>
|
||||
> ```bash
|
||||
> unset GOOGLE_API_KEY GEMINI_API_KEY
|
||||
> ```
|
||||
|
||||
1. Verify you have a Google Cloud project and Vertex AI API is enabled.
|
||||
```bash
|
||||
unset GOOGLE_API_KEY GEMINI_API_KEY
|
||||
```
|
||||
|
||||
2. Log in to Google Cloud:
|
||||
1. Ensure you have a Google Cloud project and Vertex AI API is enabled.
|
||||
2. Log in to Google Cloud:
|
||||
|
||||
```bash
|
||||
gcloud auth application-default login
|
||||
```
|
||||
```bash
|
||||
gcloud auth application-default login
|
||||
```
|
||||
|
||||
3. [Configure your Google Cloud Project](#set-gcp).
|
||||
See
|
||||
[Set up Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc)
|
||||
for details.
|
||||
|
||||
4. Start the CLI:
|
||||
3. Ensure `GOOGLE_CLOUD_PROJECT` (or `GOOGLE_CLOUD_PROJECT_ID`) and
|
||||
`GOOGLE_CLOUD_LOCATION` are set.
|
||||
|
||||
```bash
|
||||
gemini
|
||||
```
|
||||
#### B. Vertex AI - Service Account JSON key
|
||||
|
||||
5. Select **Vertex AI**.
|
||||
|
||||
#### B. Vertex AI - service account JSON key
|
||||
|
||||
Consider this method of authentication in non-interactive environments, CI/CD
|
||||
pipelines, or if your organization restricts user-based ADC or API key creation.
|
||||
Consider this method of authentication in non-interactive environments, CI/CD,
|
||||
or if your organization restricts user-based ADC or API key creation.
|
||||
|
||||
> **Note:** If you have previously set `GOOGLE_API_KEY` or `GEMINI_API_KEY`, you
|
||||
> must unset them:
|
||||
>
|
||||
> ```bash
|
||||
> unset GOOGLE_API_KEY GEMINI_API_KEY
|
||||
> ```
|
||||
|
||||
```bash
|
||||
unset GOOGLE_API_KEY GEMINI_API_KEY
|
||||
```
|
||||
|
||||
1. [Create a service account and key](https://cloud.google.com/iam/docs/keys-create-delete)
|
||||
and download the provided JSON file. Assign the "Vertex AI User" role to the
|
||||
service account.
|
||||
|
||||
2. Set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to the JSON
|
||||
file's absolute path. For example:
|
||||
file's absolute path:
|
||||
|
||||
```bash
|
||||
# Replace /path/to/your/keyfile.json with the actual path
|
||||
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/keyfile.json"
|
||||
```
|
||||
|
||||
3. [Configure your Google Cloud Project](#set-gcp).
|
||||
3. Ensure `GOOGLE_CLOUD_PROJECT` (or `GOOGLE_CLOUD_PROJECT_ID`) and
|
||||
`GOOGLE_CLOUD_LOCATION` are set.
|
||||
|
||||
4. Start the CLI:
|
||||
|
||||
```bash
|
||||
gemini
|
||||
```
|
||||
|
||||
5. Select **Vertex AI**.
|
||||
> **Warning:** Protect your service account key file as it gives access to
|
||||
> your resources.
|
||||
> **Warning:** Protect your service account key file as it provides access to
|
||||
> your resources.
|
||||
|
||||
#### C. Vertex AI - Google Cloud API key
|
||||
|
||||
1. Obtain a Google Cloud API key:
|
||||
[Get an API Key](https://cloud.google.com/vertex-ai/generative-ai/docs/start/api-keys?usertype=newuser).
|
||||
|
||||
2. Set the `GOOGLE_API_KEY` environment variable:
|
||||
|
||||
```bash
|
||||
@@ -202,59 +210,17 @@ pipelines, or if your organization restricts user-based ADC or API key creation.
|
||||
|
||||
> **Note:** If you see errors like
|
||||
> `"API keys are not supported by this API..."`, your organization might
|
||||
> restrict API key usage for this service. Try the other Vertex AI
|
||||
> authentication methods instead.
|
||||
> restrict API key usage for this service. Try the
|
||||
> [Service Account JSON Key](#b-vertex-ai-service-account-json-key) or
|
||||
> [ADC](#a-vertex-ai-application-default-credentials-adc-using-gcloud)
|
||||
> methods instead.
|
||||
|
||||
3. [Configure your Google Cloud Project](#set-gcp).
|
||||
To make any of these Vertex AI environment variable settings persistent, see
|
||||
[Persisting Environment Variables](#persisting-environment-variables).
|
||||
|
||||
4. Start the CLI:
|
||||
## Persisting Environment Variables
|
||||
|
||||
```bash
|
||||
gemini
|
||||
```
|
||||
|
||||
5. Select **Vertex AI**.
|
||||
|
||||
## Set your Google Cloud project <a id="set-gcp"></a>
|
||||
|
||||
> **Important:** Most individual Google accounts (free and paid) don't require a
|
||||
> Google Cloud project for authentication.
|
||||
|
||||
When you sign in using your Google account, you may need to configure a Google
|
||||
Cloud project for Gemini CLI to use. This applies when you meet at least one of
|
||||
the following conditions:
|
||||
|
||||
- You are using a Company, School, or Google Workspace account.
|
||||
- You are using a Gemini Code Assist license from the Google Developer Program.
|
||||
- You are using a license from a Gemini Code Assist subscription.
|
||||
|
||||
To configure Gemini CLI to use a Google Cloud project, do the following:
|
||||
|
||||
1. [Find your Google Cloud Project ID](https://support.google.com/googleapi/answer/7014113).
|
||||
|
||||
2. [Enable the Gemini for Cloud API](https://cloud.google.com/gemini/docs/discover/set-up-gemini#enable-api).
|
||||
|
||||
3. [Configure necessary IAM access permissions](https://cloud.google.com/gemini/docs/discover/set-up-gemini#grant-iam).
|
||||
|
||||
4. Configure your environment variables. Set either the `GOOGLE_CLOUD_PROJECT`
|
||||
or `GOOGLE_CLOUD_PROJECT_ID` variable to the project ID to use with Gemini
|
||||
CLI. Gemini CLI checks for `GOOGLE_CLOUD_PROJECT` first, then falls back to
|
||||
`GOOGLE_CLOUD_PROJECT_ID`.
|
||||
|
||||
For example, to set the `GOOGLE_CLOUD_PROJECT_ID` variable:
|
||||
|
||||
```bash
|
||||
# Replace YOUR_PROJECT_ID with your actual Google Cloud project ID
|
||||
export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"
|
||||
```
|
||||
|
||||
To make this setting persistent, see
|
||||
[Persisting Environment Variables](#persisting-vars).
|
||||
|
||||
## Persisting environment variables <a id="persisting-vars"></a>
|
||||
|
||||
To avoid setting environment variables for every terminal session, you can
|
||||
persist them with the following methods:
|
||||
To avoid setting environment variables in every terminal session, you can:
|
||||
|
||||
1. **Add your environment variables to your shell configuration file:** Append
|
||||
the `export ...` commands to your shell's startup file (e.g., `~/.bashrc`,
|
||||
@@ -267,9 +233,9 @@ persist them with the following methods:
|
||||
source ~/.bashrc
|
||||
```
|
||||
|
||||
> **Warning:** Be aware that when you export API keys or service account
|
||||
> paths in your shell configuration file, any process launched from that
|
||||
> shell can read them.
|
||||
> **Warning:** Be advised that when you export API keys or service account
|
||||
> paths in your shell configuration file, any process executed from the
|
||||
> shell can potentially read them.
|
||||
|
||||
2. **Use a `.env` file:** Create a `.gemini/.env` file in your project
|
||||
directory or home directory. Gemini CLI automatically loads variables from
|
||||
@@ -286,31 +252,27 @@ persist them with the following methods:
|
||||
EOF
|
||||
```
|
||||
|
||||
Variables are loaded from the first file found, not merged.
|
||||
Variables are loaded from the first file found, not merged.
|
||||
|
||||
## Running in Google Cloud environments <a id="cloud-env"></a>
|
||||
## Non-interactive mode / headless environments
|
||||
|
||||
When running Gemini CLI within certain Google Cloud environments, authentication
|
||||
is automatic.
|
||||
Non-interative mode / headless environments will use your existing
|
||||
authentication method, if an existing authentication credential is cached.
|
||||
|
||||
In a Google Cloud Shell environment, Gemini CLI typically authenticates
|
||||
automatically using your Cloud Shell credentials. In Compute Engine
|
||||
environments, Gemini CLI automatically uses Application Default Credentials
|
||||
(ADC) from the environment's metadata server.
|
||||
If you have not already logged in with an authentication credential (such as a
|
||||
Google account), you **must** configure authentication using environment
|
||||
variables:
|
||||
|
||||
If automatic authentication fails, use one of the interactive methods described
|
||||
on this page.
|
||||
1. **Gemini API Key:** Set `GEMINI_API_KEY`.
|
||||
2. **Vertex AI:**
|
||||
- Set `GOOGLE_GENAI_USE_VERTEXAI=true`.
|
||||
- **With Google Cloud API Key:** Set `GOOGLE_API_KEY`.
|
||||
- **With ADC:** Ensure ADC is configured (e.g., via a service account with
|
||||
`GOOGLE_APPLICATION_CREDENTIALS`) and set `GOOGLE_CLOUD_PROJECT` (or
|
||||
`GOOGLE_CLOUD_PROJECT_ID`) and `GOOGLE_CLOUD_LOCATION`.
|
||||
|
||||
## Running in headless mode <a id="headless"></a>
|
||||
|
||||
[Headless mode](../cli/headless) will use your existing authentication method,
|
||||
if an existing authentication credential is cached.
|
||||
|
||||
If you have not already logged in with an authentication credential, you must
|
||||
configure authentication using environment variables:
|
||||
|
||||
- [Use Gemini API Key](#gemini-api)
|
||||
- [Vertex AI](#vertex-ai)
|
||||
The CLI will exit with an error in non-interactive mode if no suitable
|
||||
environment variables are found.
|
||||
|
||||
## What's next?
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Gemini CLI configuration
|
||||
# Gemini CLI Configuration
|
||||
|
||||
**Note on deprecated configuration format**
|
||||
**Note on Deprecated Configuration Format**
|
||||
|
||||
This document describes the legacy v1 format for the `settings.json` file. This
|
||||
format is now deprecated.
|
||||
@@ -132,7 +132,7 @@ contain other project-specific files related to Gemini CLI's operation, such as:
|
||||
}
|
||||
```
|
||||
|
||||
### Troubleshooting file search performance
|
||||
### Troubleshooting File Search Performance
|
||||
|
||||
If you are experiencing performance issues with file searching (e.g., with `@`
|
||||
completions), especially in projects with a very large number of files, here are
|
||||
@@ -144,12 +144,12 @@ a few things you can try in order of recommendation:
|
||||
the total number of files crawled is the most effective way to improve
|
||||
performance.
|
||||
|
||||
2. **Disable fuzzy search:** If ignoring files is not enough, you can disable
|
||||
2. **Disable Fuzzy Search:** If ignoring files is not enough, you can disable
|
||||
fuzzy search by setting `disableFuzzySearch` to `true` in your
|
||||
`settings.json` file. This will use a simpler, non-fuzzy matching algorithm,
|
||||
which can be faster.
|
||||
|
||||
3. **Disable recursive file search:** As a last resort, you can disable
|
||||
3. **Disable Recursive File Search:** As a last resort, you can disable
|
||||
recursive file search entirely by setting `enableRecursiveFileSearch` to
|
||||
`false`. This will be the fastest option as it avoids a recursive crawl of
|
||||
your project. However, it means you will need to type the full path to files
|
||||
@@ -194,7 +194,7 @@ a few things you can try in order of recommendation:
|
||||
`--allowed-mcp-server-names` is set.
|
||||
- **Default:** All MCP servers are available for use by the Gemini model.
|
||||
- **Example:** `"allowMCPServers": ["myPythonServer"]`.
|
||||
- **Security note:** This uses simple string matching on MCP server names,
|
||||
- **Security Note:** This uses simple string matching on MCP server names,
|
||||
which can be modified. If you're a system administrator looking to prevent
|
||||
users from bypassing this, consider configuring the `mcpServers` at the
|
||||
system settings level such that the user will not be able to configure any
|
||||
@@ -208,7 +208,7 @@ a few things you can try in order of recommendation:
|
||||
be ignored if `--allowed-mcp-server-names` is set.
|
||||
- **Default**: No MCP servers excluded.
|
||||
- **Example:** `"excludeMCPServers": ["myNodeServer"]`.
|
||||
- **Security note:** This uses simple string matching on MCP server names,
|
||||
- **Security Note:** This uses simple string matching on MCP server names,
|
||||
which can be modified. If you're a system administrator looking to prevent
|
||||
users from bypassing this, consider configuring the `mcpServers` at the
|
||||
system settings level such that the user will not be able to configure any
|
||||
@@ -538,7 +538,7 @@ a few things you can try in order of recommendation:
|
||||
}
|
||||
```
|
||||
|
||||
## Shell history
|
||||
## Shell History
|
||||
|
||||
The CLI keeps a history of shell commands you run. To avoid conflicts between
|
||||
different projects, this history is stored in a project-specific directory
|
||||
@@ -549,7 +549,7 @@ within your user's home folder.
|
||||
path.
|
||||
- The history is stored in a file named `shell_history`.
|
||||
|
||||
## Environment variables and `.env` files
|
||||
## Environment Variables & `.env` Files
|
||||
|
||||
Environment variables are a common way to configure applications, especially for
|
||||
sensitive information like API keys or for settings that might change between
|
||||
@@ -566,7 +566,7 @@ loading order is:
|
||||
the home directory.
|
||||
3. If still not found, it looks for `~/.env` (in the user's home directory).
|
||||
|
||||
**Environment variable exclusion:** Some environment variables (like `DEBUG` and
|
||||
**Environment Variable Exclusion:** Some environment variables (like `DEBUG` and
|
||||
`DEBUG_MODE`) are automatically excluded from being loaded from project `.env`
|
||||
files to prevent interference with gemini-cli behavior. Variables from
|
||||
`.gemini/.env` files are never excluded. You can customize this behavior using
|
||||
@@ -591,7 +591,7 @@ the `excludedProjectEnvVars` setting in your `settings.json` file.
|
||||
- Required for using Code Assist or Vertex AI.
|
||||
- If using Vertex AI, ensure you have the necessary permissions in this
|
||||
project.
|
||||
- **Cloud Shell note:** When running in a Cloud Shell environment, this
|
||||
- **Cloud Shell Note:** When running in a Cloud Shell environment, this
|
||||
variable defaults to a special project allocated for Cloud Shell users. If
|
||||
you have `GOOGLE_CLOUD_PROJECT` set in your global environment in Cloud
|
||||
Shell, it will be overridden by this default. To use a different project in
|
||||
@@ -611,9 +611,6 @@ the `excludedProjectEnvVars` setting in your `settings.json` file.
|
||||
- **`GEMINI_SANDBOX`**:
|
||||
- Alternative to the `sandbox` setting in `settings.json`.
|
||||
- Accepts `true`, `false`, `docker`, `podman`, or a custom command string.
|
||||
- **`HTTP_PROXY` / `HTTPS_PROXY`**:
|
||||
- Specifies the proxy server to use for outgoing HTTP/HTTPS requests.
|
||||
- Example: `export HTTPS_PROXY="http://proxy.example.com:8080"`
|
||||
- **`SEATBELT_PROFILE`** (macOS specific):
|
||||
- Switches the Seatbelt (`sandbox-exec`) profile on macOS.
|
||||
- `permissive-open`: (Default) Restricts writes to the project folder (and a
|
||||
@@ -639,7 +636,7 @@ the `excludedProjectEnvVars` setting in your `settings.json` file.
|
||||
- Specifies the endpoint for the code assist server.
|
||||
- This is useful for development and testing.
|
||||
|
||||
## Command-line arguments
|
||||
## Command-Line Arguments
|
||||
|
||||
Arguments passed directly when running the CLI can override other configurations
|
||||
for that specific session.
|
||||
@@ -702,6 +699,9 @@ for that specific session.
|
||||
- Example: `gemini -e my-extension -e my-other-extension`
|
||||
- **`--list-extensions`** (**`-l`**):
|
||||
- Lists all available extensions and exits.
|
||||
- **`--proxy`**:
|
||||
- Sets the proxy for the CLI.
|
||||
- Example: `--proxy http://localhost:7890`.
|
||||
- **`--include-directories <dir1,dir2,...>`**:
|
||||
- Includes additional directories in the workspace for multi-directory
|
||||
support.
|
||||
@@ -714,7 +714,7 @@ for that specific session.
|
||||
- **`--version`**:
|
||||
- Displays the version of the CLI.
|
||||
|
||||
## Context files (hierarchical instructional context)
|
||||
## Context Files (Hierarchical Instructional Context)
|
||||
|
||||
While not strictly configuration for the CLI's _behavior_, context files
|
||||
(defaulting to `GEMINI.md` but configurable via the `contextFileName` setting)
|
||||
@@ -730,7 +730,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 (e.g., `GEMINI.md`)
|
||||
|
||||
Here's a conceptual example of what a context file at the root of a TypeScript
|
||||
project might contain:
|
||||
@@ -771,23 +771,23 @@ more relevant and precise your context files are, the better the AI can assist
|
||||
you. Project-specific context files are highly encouraged to establish
|
||||
conventions and context.
|
||||
|
||||
- **Hierarchical loading and precedence:** The CLI implements a sophisticated
|
||||
- **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)
|
||||
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:**
|
||||
1. **Global Context File:**
|
||||
- Location: `~/.gemini/<contextFileName>` (e.g., `~/.gemini/GEMINI.md` in
|
||||
your user home directory).
|
||||
- Scope: Provides default instructions for all your projects.
|
||||
2. **Project root and ancestors context files:**
|
||||
2. **Project Root & Ancestors Context Files:**
|
||||
- Location: The CLI searches for the configured context file in the
|
||||
current working directory and then in each parent directory up to either
|
||||
the project root (identified by a `.git` folder) or your home directory.
|
||||
- Scope: Provides context relevant to the entire project or a significant
|
||||
portion of it.
|
||||
3. **Sub-directory context files (contextual/local):**
|
||||
3. **Sub-directory Context Files (Contextual/Local):**
|
||||
- Location: The CLI also scans for the configured context file in
|
||||
subdirectories _below_ the current working directory (respecting common
|
||||
ignore patterns like `node_modules`, `.git`, etc.). The breadth of this
|
||||
@@ -795,15 +795,15 @@ conventions and context.
|
||||
with a `memoryDiscoveryMaxDirs` field in your `settings.json` file.
|
||||
- Scope: Allows for highly specific instructions relevant to a particular
|
||||
component, module, or subsection of your project.
|
||||
- **Concatenation and UI indication:** The contents of all found context files
|
||||
are concatenated (with separators indicating their origin and path) and
|
||||
provided as part of the system prompt to the Gemini model. The CLI footer
|
||||
displays the count of loaded context files, giving you a quick visual cue
|
||||
about the active instructional context.
|
||||
- **Importing content:** You can modularize your context files by importing
|
||||
- **Concatenation & UI Indication:** The contents of all found context files are
|
||||
concatenated (with separators indicating their origin and path) and provided
|
||||
as part of the system prompt to the Gemini model. The CLI footer displays the
|
||||
count of loaded context files, giving you a quick visual cue about the active
|
||||
instructional context.
|
||||
- **Importing Content:** You can modularize your context files by importing
|
||||
other Markdown files using the `@path/to/file.md` syntax. For more details,
|
||||
see the [Memory Import Processor documentation](../core/memport.md).
|
||||
- **Commands for memory management:**
|
||||
- **Commands for Memory Management:**
|
||||
- Use `/memory refresh` to force a re-scan and reload of all context files
|
||||
from all configured locations. This updates the AI's instructional context.
|
||||
- Use `/memory show` to display the combined instructional context currently
|
||||
@@ -850,7 +850,7 @@ sandbox image:
|
||||
BUILD_SANDBOX=1 gemini -s
|
||||
```
|
||||
|
||||
## Usage statistics
|
||||
## 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
|
||||
@@ -858,22 +858,22 @@ prioritize new features.
|
||||
|
||||
**What we collect:**
|
||||
|
||||
- **Tool calls:** We log the names of the tools that are called, whether they
|
||||
- **Tool Calls:** We log the names of the tools that are called, whether they
|
||||
succeed or fail, and how long they take to execute. We do not collect the
|
||||
arguments passed to the tools or any data returned by them.
|
||||
- **API requests:** We log the Gemini model used for each request, the duration
|
||||
- **API Requests:** We log the Gemini model used for each request, the duration
|
||||
of the request, and whether it was successful. We do not collect the content
|
||||
of the prompts or responses.
|
||||
- **Session information:** We collect information about the configuration of the
|
||||
- **Session Information:** We collect information about the configuration of the
|
||||
CLI, such as the enabled tools and the approval mode.
|
||||
|
||||
**What we DON'T collect:**
|
||||
|
||||
- **Personally identifiable information (PII):** We do not collect any personal
|
||||
- **Personally Identifiable Information (PII):** We do not collect any personal
|
||||
information, such as your name, email address, or API keys.
|
||||
- **Prompt and response content:** We do not log the content of your prompts or
|
||||
- **Prompt and Response Content:** We do not log the content of your prompts or
|
||||
the responses from the Gemini model.
|
||||
- **File content:** We do not log the content of any files that are read or
|
||||
- **File Content:** We do not log the content of any files that are read or
|
||||
written by the CLI.
|
||||
|
||||
**How to opt out:**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Gemini CLI configuration
|
||||
# Gemini CLI Configuration
|
||||
|
||||
> **Note on configuration format, 9/17/25:** The format of the `settings.json`
|
||||
> **Note on Configuration Format, 9/17/25:** The format of the `settings.json`
|
||||
> file has been updated to a new, more organized structure.
|
||||
>
|
||||
> - The new format will be supported in the stable release starting
|
||||
@@ -317,212 +317,7 @@ their corresponding top-level category object in your `settings.json` file.
|
||||
- **Description:** Named presets for model configs. Can be used in place of a
|
||||
model name and can inherit from other aliases using an `extends` property.
|
||||
- **Default:**
|
||||
|
||||
```json
|
||||
{
|
||||
"base": {
|
||||
"modelConfig": {
|
||||
"generateContentConfig": {
|
||||
"temperature": 0,
|
||||
"topP": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"chat-base": {
|
||||
"extends": "base",
|
||||
"modelConfig": {
|
||||
"generateContentConfig": {
|
||||
"thinkingConfig": {
|
||||
"includeThoughts": true
|
||||
},
|
||||
"temperature": 1,
|
||||
"topP": 0.95,
|
||||
"topK": 64
|
||||
}
|
||||
}
|
||||
},
|
||||
"chat-base-2.5": {
|
||||
"extends": "chat-base",
|
||||
"modelConfig": {
|
||||
"generateContentConfig": {
|
||||
"thinkingConfig": {
|
||||
"thinkingBudget": 8192
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"chat-base-3": {
|
||||
"extends": "chat-base",
|
||||
"modelConfig": {
|
||||
"generateContentConfig": {
|
||||
"thinkingConfig": {
|
||||
"thinkingLevel": "HIGH"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"gemini-3-pro-preview": {
|
||||
"extends": "chat-base-3",
|
||||
"modelConfig": {
|
||||
"model": "gemini-3-pro-preview"
|
||||
}
|
||||
},
|
||||
"gemini-2.5-pro": {
|
||||
"extends": "chat-base-2.5",
|
||||
"modelConfig": {
|
||||
"model": "gemini-2.5-pro"
|
||||
}
|
||||
},
|
||||
"gemini-2.5-flash": {
|
||||
"extends": "chat-base-2.5",
|
||||
"modelConfig": {
|
||||
"model": "gemini-2.5-flash"
|
||||
}
|
||||
},
|
||||
"gemini-2.5-flash-lite": {
|
||||
"extends": "chat-base-2.5",
|
||||
"modelConfig": {
|
||||
"model": "gemini-2.5-flash-lite"
|
||||
}
|
||||
},
|
||||
"gemini-2.5-flash-base": {
|
||||
"extends": "base",
|
||||
"modelConfig": {
|
||||
"model": "gemini-2.5-flash"
|
||||
}
|
||||
},
|
||||
"classifier": {
|
||||
"extends": "base",
|
||||
"modelConfig": {
|
||||
"model": "gemini-2.5-flash-lite",
|
||||
"generateContentConfig": {
|
||||
"maxOutputTokens": 1024,
|
||||
"thinkingConfig": {
|
||||
"thinkingBudget": 512
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"prompt-completion": {
|
||||
"extends": "base",
|
||||
"modelConfig": {
|
||||
"model": "gemini-2.5-flash-lite",
|
||||
"generateContentConfig": {
|
||||
"temperature": 0.3,
|
||||
"maxOutputTokens": 16000,
|
||||
"thinkingConfig": {
|
||||
"thinkingBudget": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"edit-corrector": {
|
||||
"extends": "base",
|
||||
"modelConfig": {
|
||||
"model": "gemini-2.5-flash-lite",
|
||||
"generateContentConfig": {
|
||||
"thinkingConfig": {
|
||||
"thinkingBudget": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"summarizer-default": {
|
||||
"extends": "base",
|
||||
"modelConfig": {
|
||||
"model": "gemini-2.5-flash-lite",
|
||||
"generateContentConfig": {
|
||||
"maxOutputTokens": 2000
|
||||
}
|
||||
}
|
||||
},
|
||||
"summarizer-shell": {
|
||||
"extends": "base",
|
||||
"modelConfig": {
|
||||
"model": "gemini-2.5-flash-lite",
|
||||
"generateContentConfig": {
|
||||
"maxOutputTokens": 2000
|
||||
}
|
||||
}
|
||||
},
|
||||
"web-search": {
|
||||
"extends": "gemini-2.5-flash-base",
|
||||
"modelConfig": {
|
||||
"generateContentConfig": {
|
||||
"tools": [
|
||||
{
|
||||
"googleSearch": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"web-fetch": {
|
||||
"extends": "gemini-2.5-flash-base",
|
||||
"modelConfig": {
|
||||
"generateContentConfig": {
|
||||
"tools": [
|
||||
{
|
||||
"urlContext": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"web-fetch-fallback": {
|
||||
"extends": "gemini-2.5-flash-base",
|
||||
"modelConfig": {}
|
||||
},
|
||||
"loop-detection": {
|
||||
"extends": "gemini-2.5-flash-base",
|
||||
"modelConfig": {}
|
||||
},
|
||||
"loop-detection-double-check": {
|
||||
"extends": "base",
|
||||
"modelConfig": {
|
||||
"model": "gemini-2.5-pro"
|
||||
}
|
||||
},
|
||||
"llm-edit-fixer": {
|
||||
"extends": "gemini-2.5-flash-base",
|
||||
"modelConfig": {}
|
||||
},
|
||||
"next-speaker-checker": {
|
||||
"extends": "gemini-2.5-flash-base",
|
||||
"modelConfig": {}
|
||||
},
|
||||
"chat-compression-3-pro": {
|
||||
"modelConfig": {
|
||||
"model": "gemini-3-pro-preview"
|
||||
}
|
||||
},
|
||||
"chat-compression-2.5-pro": {
|
||||
"modelConfig": {
|
||||
"model": "gemini-2.5-pro"
|
||||
}
|
||||
},
|
||||
"chat-compression-2.5-flash": {
|
||||
"modelConfig": {
|
||||
"model": "gemini-2.5-flash"
|
||||
}
|
||||
},
|
||||
"chat-compression-2.5-flash-lite": {
|
||||
"modelConfig": {
|
||||
"model": "gemini-2.5-flash-lite"
|
||||
}
|
||||
},
|
||||
"chat-compression-default": {
|
||||
"modelConfig": {
|
||||
"model": "gemini-2.5-pro"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- **`modelConfigs.customAliases`** (object):
|
||||
- **Description:** Custom named presets for model configs. These are merged
|
||||
with (and override) the built-in aliases.
|
||||
- **Default:** `{}`
|
||||
`{"base":{"modelConfig":{"generateContentConfig":{"temperature":0,"topP":1}}},"chat-base":{"extends":"base","modelConfig":{"generateContentConfig":{"thinkingConfig":{"includeThoughts":true},"temperature":1,"topP":0.95,"topK":64}}},"chat-base-2.5":{"extends":"chat-base","modelConfig":{"generateContentConfig":{"thinkingConfig":{"thinkingBudget":8192}}}},"chat-base-3":{"extends":"chat-base","modelConfig":{"generateContentConfig":{"thinkingConfig":{"thinkingLevel":"HIGH"}}}},"gemini-3-pro-preview":{"extends":"chat-base-3","modelConfig":{"model":"gemini-3-pro-preview"}},"gemini-2.5-pro":{"extends":"chat-base-2.5","modelConfig":{"model":"gemini-2.5-pro"}},"gemini-2.5-flash":{"extends":"chat-base-2.5","modelConfig":{"model":"gemini-2.5-flash"}},"gemini-2.5-flash-lite":{"extends":"chat-base-2.5","modelConfig":{"model":"gemini-2.5-flash-lite"}},"gemini-2.5-flash-base":{"extends":"base","modelConfig":{"model":"gemini-2.5-flash"}},"classifier":{"extends":"base","modelConfig":{"model":"gemini-2.5-flash-lite","generateContentConfig":{"maxOutputTokens":1024,"thinkingConfig":{"thinkingBudget":512}}}},"prompt-completion":{"extends":"base","modelConfig":{"model":"gemini-2.5-flash-lite","generateContentConfig":{"temperature":0.3,"maxOutputTokens":16000,"thinkingConfig":{"thinkingBudget":0}}}},"edit-corrector":{"extends":"base","modelConfig":{"model":"gemini-2.5-flash-lite","generateContentConfig":{"thinkingConfig":{"thinkingBudget":0}}}},"summarizer-default":{"extends":"base","modelConfig":{"model":"gemini-2.5-flash-lite","generateContentConfig":{"maxOutputTokens":2000}}},"summarizer-shell":{"extends":"base","modelConfig":{"model":"gemini-2.5-flash-lite","generateContentConfig":{"maxOutputTokens":2000}}},"web-search":{"extends":"gemini-2.5-flash-base","modelConfig":{"generateContentConfig":{"tools":[{"googleSearch":{}}]}}},"web-fetch":{"extends":"gemini-2.5-flash-base","modelConfig":{"generateContentConfig":{"tools":[{"urlContext":{}}]}}},"web-fetch-fallback":{"extends":"gemini-2.5-flash-base","modelConfig":{}},"loop-detection":{"extends":"gemini-2.5-flash-base","modelConfig":{}},"loop-detection-double-check":{"extends":"base","modelConfig":{"model":"gemini-2.5-pro"}},"llm-edit-fixer":{"extends":"gemini-2.5-flash-base","modelConfig":{}},"next-speaker-checker":{"extends":"gemini-2.5-flash-base","modelConfig":{}}}`
|
||||
|
||||
- **`modelConfigs.overrides`** (array):
|
||||
- **Description:** Apply specific configuration overrides based on matches,
|
||||
@@ -600,11 +395,6 @@ their corresponding top-level category object in your `settings.json` file.
|
||||
- **Description:** Show color in shell output.
|
||||
- **Default:** `false`
|
||||
|
||||
- **`tools.shell.inactivityTimeout`** (number):
|
||||
- **Description:** The maximum time in seconds allowed without output from the
|
||||
shell command. Defaults to 5 minutes.
|
||||
- **Default:** `300`
|
||||
|
||||
- **`tools.autoAccept`** (boolean):
|
||||
- **Description:** Automatically accept and execute tool calls that are
|
||||
considered safe (e.g., read-only operations).
|
||||
@@ -755,11 +545,7 @@ their corresponding top-level category object in your `settings.json` file.
|
||||
|
||||
- **`advanced.excludedEnvVars`** (array):
|
||||
- **Description:** Environment variables to exclude from project context.
|
||||
- **Default:**
|
||||
|
||||
```json
|
||||
["DEBUG", "DEBUG_MODE"]
|
||||
```
|
||||
- **Default:** `["DEBUG","DEBUG_MODE"]`
|
||||
|
||||
- **`advanced.bugCommand`** (object):
|
||||
- **Description:** Configuration for the bug report command.
|
||||
@@ -777,14 +563,10 @@ their corresponding top-level category object in your `settings.json` file.
|
||||
- **Default:** `false`
|
||||
- **Requires restart:** Yes
|
||||
|
||||
- **`experimental.isModelAvailabilityServiceEnabled`** (boolean):
|
||||
- **Description:** Enable model routing using new availability service.
|
||||
- **Default:** `false`
|
||||
- **Requires restart:** Yes
|
||||
|
||||
- **`experimental.jitContext`** (boolean):
|
||||
- **Description:** Enable Just-In-Time (JIT) context loading.
|
||||
- **Default:** `false`
|
||||
- **`experimental.useModelRouter`** (boolean):
|
||||
- **Description:** Enable model routing to route requests to the best model
|
||||
based on complexity.
|
||||
- **Default:** `true`
|
||||
- **Requires restart:** Yes
|
||||
|
||||
- **`experimental.codebaseInvestigatorSettings.enabled`** (boolean):
|
||||
@@ -892,12 +674,7 @@ of v0.3.0:
|
||||
{
|
||||
"general": {
|
||||
"vimMode": true,
|
||||
"preferredEditor": "code",
|
||||
"sessionRetention": {
|
||||
"enabled": true,
|
||||
"maxAge": "30d",
|
||||
"maxCount": 100
|
||||
}
|
||||
"preferredEditor": "code"
|
||||
},
|
||||
"ui": {
|
||||
"theme": "GitHub",
|
||||
@@ -955,7 +732,7 @@ of v0.3.0:
|
||||
}
|
||||
```
|
||||
|
||||
## Shell history
|
||||
## Shell History
|
||||
|
||||
The CLI keeps a history of shell commands you run. To avoid conflicts between
|
||||
different projects, this history is stored in a project-specific directory
|
||||
@@ -966,7 +743,7 @@ within your user's home folder.
|
||||
path.
|
||||
- The history is stored in a file named `shell_history`.
|
||||
|
||||
## Environment variables and `.env` files
|
||||
## Environment Variables & `.env` Files
|
||||
|
||||
Environment variables are a common way to configure applications, especially for
|
||||
sensitive information like API keys or for settings that might change between
|
||||
@@ -983,7 +760,7 @@ loading order is:
|
||||
the home directory.
|
||||
3. If still not found, it looks for `~/.env` (in the user's home directory).
|
||||
|
||||
**Environment variable exclusion:** Some environment variables (like `DEBUG` and
|
||||
**Environment Variable Exclusion:** Some environment variables (like `DEBUG` and
|
||||
`DEBUG_MODE`) are automatically excluded from being loaded from project `.env`
|
||||
files to prevent interference with gemini-cli behavior. Variables from
|
||||
`.gemini/.env` files are never excluded. You can customize this behavior using
|
||||
@@ -1008,7 +785,7 @@ the `advanced.excludedEnvVars` setting in your `settings.json` file.
|
||||
- Required for using Code Assist or Vertex AI.
|
||||
- If using Vertex AI, ensure you have the necessary permissions in this
|
||||
project.
|
||||
- **Cloud Shell note:** When running in a Cloud Shell environment, this
|
||||
- **Cloud Shell Note:** When running in a Cloud Shell environment, this
|
||||
variable defaults to a special project allocated for Cloud Shell users. If
|
||||
you have `GOOGLE_CLOUD_PROJECT` set in your global environment in Cloud
|
||||
Shell, it will be overridden by this default. To use a different project in
|
||||
@@ -1077,7 +854,7 @@ the `advanced.excludedEnvVars` setting in your `settings.json` file.
|
||||
- Specifies the endpoint for the code assist server.
|
||||
- This is useful for development and testing.
|
||||
|
||||
## Command-line arguments
|
||||
## Command-Line Arguments
|
||||
|
||||
Arguments passed directly when running the CLI can override other configurations
|
||||
for that specific session.
|
||||
@@ -1133,24 +910,6 @@ for that specific session.
|
||||
- Example: `gemini -e my-extension -e my-other-extension`
|
||||
- **`--list-extensions`** (**`-l`**):
|
||||
- Lists all available extensions and exits.
|
||||
- **`--resume [session_id]`** (**`-r [session_id]`**):
|
||||
- Resume a previous chat session. Use "latest" for the most recent session,
|
||||
provide a session index number, or provide a full session UUID.
|
||||
- If no session_id is provided, defaults to "latest".
|
||||
- Example: `gemini --resume 5` or `gemini --resume latest` or
|
||||
`gemini --resume a1b2c3d4-e5f6-7890-abcd-ef1234567890` or `gemini --resume`
|
||||
- See [Session Management](../cli/session-management.md) for more details.
|
||||
- **`--list-sessions`**:
|
||||
- List all available chat sessions for the current project and exit.
|
||||
- Shows session indices, dates, message counts, and preview of first user
|
||||
message.
|
||||
- Example: `gemini --list-sessions`
|
||||
- **`--delete-session <identifier>`**:
|
||||
- Delete a specific chat session by its index number or full session UUID.
|
||||
- Use `--list-sessions` first to see available sessions, their indices, and
|
||||
UUIDs.
|
||||
- Example: `gemini --delete-session 3` or
|
||||
`gemini --delete-session a1b2c3d4-e5f6-7890-abcd-ef1234567890`
|
||||
- **`--include-directories <dir1,dir2,...>`**:
|
||||
- Includes additional directories in the workspace for multi-directory
|
||||
support.
|
||||
@@ -1172,7 +931,7 @@ for that specific session.
|
||||
- **`--record-responses`**:
|
||||
- Path to a file to record model responses for testing.
|
||||
|
||||
## Context files (hierarchical instructional context)
|
||||
## Context Files (Hierarchical Instructional Context)
|
||||
|
||||
While not strictly configuration for the CLI's _behavior_, context files
|
||||
(defaulting to `GEMINI.md` but configurable via the `context.fileName` setting)
|
||||
@@ -1188,7 +947,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 (e.g., `GEMINI.md`)
|
||||
|
||||
Here's a conceptual example of what a context file at the root of a TypeScript
|
||||
project might contain:
|
||||
@@ -1229,23 +988,23 @@ more relevant and precise your context files are, the better the AI can assist
|
||||
you. Project-specific context files are highly encouraged to establish
|
||||
conventions and context.
|
||||
|
||||
- **Hierarchical loading and precedence:** The CLI implements a sophisticated
|
||||
- **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)
|
||||
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:**
|
||||
1. **Global Context File:**
|
||||
- Location: `~/.gemini/<configured-context-filename>` (e.g.,
|
||||
`~/.gemini/GEMINI.md` in your user home directory).
|
||||
- Scope: Provides default instructions for all your projects.
|
||||
2. **Project root and ancestors context files:**
|
||||
2. **Project Root & Ancestors Context Files:**
|
||||
- Location: The CLI searches for the configured context file in the
|
||||
current working directory and then in each parent directory up to either
|
||||
the project root (identified by a `.git` folder) or your home directory.
|
||||
- Scope: Provides context relevant to the entire project or a significant
|
||||
portion of it.
|
||||
3. **Sub-directory context files (contextual/local):**
|
||||
3. **Sub-directory Context Files (Contextual/Local):**
|
||||
- Location: The CLI also scans for the configured context file in
|
||||
subdirectories _below_ the current working directory (respecting common
|
||||
ignore patterns like `node_modules`, `.git`, etc.). The breadth of this
|
||||
@@ -1254,15 +1013,15 @@ conventions and context.
|
||||
file.
|
||||
- Scope: Allows for highly specific instructions relevant to a particular
|
||||
component, module, or subsection of your project.
|
||||
- **Concatenation and UI indication:** The contents of all found context files
|
||||
are concatenated (with separators indicating their origin and path) and
|
||||
provided as part of the system prompt to the Gemini model. The CLI footer
|
||||
displays the count of loaded context files, giving you a quick visual cue
|
||||
about the active instructional context.
|
||||
- **Importing content:** You can modularize your context files by importing
|
||||
- **Concatenation & UI Indication:** The contents of all found context files are
|
||||
concatenated (with separators indicating their origin and path) and provided
|
||||
as part of the system prompt to the Gemini model. The CLI footer displays the
|
||||
count of loaded context files, giving you a quick visual cue about the active
|
||||
instructional context.
|
||||
- **Importing Content:** You can modularize your context files by importing
|
||||
other Markdown files using the `@path/to/file.md` syntax. For more details,
|
||||
see the [Memory Import Processor documentation](../core/memport.md).
|
||||
- **Commands for memory management:**
|
||||
- **Commands for Memory Management:**
|
||||
- Use `/memory refresh` to force a re-scan and reload of all context files
|
||||
from all configured locations. This updates the AI's instructional context.
|
||||
- Use `/memory show` to display the combined instructional context currently
|
||||
@@ -1309,7 +1068,7 @@ sandbox image:
|
||||
BUILD_SANDBOX=1 gemini -s
|
||||
```
|
||||
|
||||
## Usage statistics
|
||||
## 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
|
||||
@@ -1317,22 +1076,22 @@ prioritize new features.
|
||||
|
||||
**What we collect:**
|
||||
|
||||
- **Tool calls:** We log the names of the tools that are called, whether they
|
||||
- **Tool Calls:** We log the names of the tools that are called, whether they
|
||||
succeed or fail, and how long they take to execute. We do not collect the
|
||||
arguments passed to the tools or any data returned by them.
|
||||
- **API requests:** We log the Gemini model used for each request, the duration
|
||||
- **API Requests:** We log the Gemini model used for each request, the duration
|
||||
of the request, and whether it was successful. We do not collect the content
|
||||
of the prompts or responses.
|
||||
- **Session information:** We collect information about the configuration of the
|
||||
- **Session Information:** We collect information about the configuration of the
|
||||
CLI, such as the enabled tools and the approval mode.
|
||||
|
||||
**What we DON'T collect:**
|
||||
|
||||
- **Personally identifiable information (PII):** We do not collect any personal
|
||||
- **Personally Identifiable Information (PII):** We do not collect any personal
|
||||
information, such as your name, email address, or API keys.
|
||||
- **Prompt and response content:** We do not log the content of your prompts or
|
||||
- **Prompt and Response Content:** We do not log the content of your prompts or
|
||||
the responses from the Gemini model.
|
||||
- **File content:** We do not log the content of any files that are read or
|
||||
- **File Content:** We do not log the content of any files that are read or
|
||||
written by the CLI.
|
||||
|
||||
**How to opt out:**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Note: This page will be replaced by [installation.md](installation.md).
|
||||
|
||||
# Gemini CLI installation, execution, and deployment
|
||||
# Gemini CLI Installation, Execution, and Deployment
|
||||
|
||||
Install and run Gemini CLI. This document provides an overview of Gemini CLI's
|
||||
installation methods and deployment architecture.
|
||||
@@ -44,7 +44,7 @@ downloading the Gemini CLI package from the NPM registry.
|
||||
For security and isolation, Gemini CLI can be run inside a container. This is
|
||||
the default way that the CLI executes tools that might have side effects.
|
||||
|
||||
- **Directly from the registry:** You can run the published sandbox image
|
||||
- **Directly from the Registry:** You can run the published sandbox image
|
||||
directly. This is useful for environments where you only have Docker and want
|
||||
to run the CLI.
|
||||
```bash
|
||||
@@ -63,7 +63,7 @@ the default way that the CLI executes tools that might have side effects.
|
||||
Contributors to the project will want to run the CLI directly from the source
|
||||
code.
|
||||
|
||||
- **Development mode:** This method provides hot-reloading and is useful for
|
||||
- **Development Mode:** This method provides hot-reloading and is useful for
|
||||
active development.
|
||||
```bash
|
||||
# From the root of the repository
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Gemini CLI examples
|
||||
# Gemini CLI Examples
|
||||
|
||||
Not sure where to get started with Gemini CLI? This document covers examples on
|
||||
how to use Gemini CLI for a variety of tasks.
|
||||
@@ -57,7 +57,7 @@ Gemini CLI will return an explanation based on the actual source code:
|
||||
The `chalk` library is a popular npm package for styling terminal output with
|
||||
colors. After analyzing the source code, here's how it works:
|
||||
|
||||
- **Core functionality:** The main file sets up a chainable API. Each color or
|
||||
- **Core Functionality:** The main file sets up a chainable API. Each color or
|
||||
modifier (like `bold` or `italic`) is a getter that appends the corresponding
|
||||
ANSI escape code to an internal stack.
|
||||
|
||||
@@ -65,7 +65,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 (e.g., 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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Gemini 3 Pro on Gemini CLI (join the waitlist)
|
||||
# Gemini 3 Pro on Gemini CLI (Join the Waitlist)
|
||||
|
||||
We’re excited to bring Gemini 3 Pro to Gemini CLI. For Google AI Ultra users
|
||||
(Google AI Ultra for Business is not currently supported) and paid Gemini and
|
||||
@@ -8,7 +8,7 @@ For everyone else, we're gradually expanding access
|
||||
waitlist now to access Gemini 3 Pro once approved.
|
||||
|
||||
**Note:** Please wait until you have been approved to use Gemini 3 Pro to enable
|
||||
**preview features**. If enabled early, the CLI will fallback to Gemini 2.5 Pro.
|
||||
**Preview Features**. If enabled early, the CLI will fallback to Gemini 2.5 Pro.
|
||||
|
||||
## Do I need to join the waitlist?
|
||||
|
||||
@@ -81,7 +81,7 @@ 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
|
||||
process.
|
||||
|
||||
## Model selection and routing types
|
||||
## Model selection & routing types
|
||||
|
||||
When using Gemini CLI, you may want to control how your requests are routed
|
||||
between models. By default, Gemini CLI uses **Auto** routing.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Get started with Gemini CLI
|
||||
# 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.
|
||||
@@ -28,24 +28,19 @@ For more installation options, see [Gemini CLI Installation](./installation.md).
|
||||
|
||||
## Authenticate
|
||||
|
||||
To begin using Gemini CLI, you must authenticate with a Google service. In most
|
||||
cases, you can log in with your existing Google account:
|
||||
To begin using Gemini CLI, you must authenticate with a Google service. The most
|
||||
straightforward authentication method uses your existing Google account:
|
||||
|
||||
1. Run Gemini CLI after installation:
|
||||
|
||||
```bash
|
||||
gemini
|
||||
```
|
||||
|
||||
2. When asked "How would you like to authenticate for this project?" select **1.
|
||||
Login with Google**.
|
||||
|
||||
3. Select your Google account.
|
||||
|
||||
4. Click on **Sign in**.
|
||||
|
||||
Certain account types may require you to configure a Google Cloud project. For
|
||||
more information, including other authentication methods, see
|
||||
For other authentication options and information, see
|
||||
[Gemini CLI Authentication Setup](./authentication.md).
|
||||
|
||||
## Configure
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Gemini CLI installation, execution, and deployment
|
||||
# Gemini CLI Installation, Execution, and Deployment
|
||||
|
||||
Install and run Gemini CLI. This document provides an overview of Gemini CLI's
|
||||
installation methods and deployment architecture.
|
||||
@@ -42,7 +42,7 @@ downloading the Gemini CLI package from the NPM registry.
|
||||
For security and isolation, Gemini CLI can be run inside a container. This is
|
||||
the default way that the CLI executes tools that might have side effects.
|
||||
|
||||
- **Directly from the registry:** You can run the published sandbox image
|
||||
- **Directly from the Registry:** You can run the published sandbox image
|
||||
directly. This is useful for environments where you only have Docker and want
|
||||
to run the CLI.
|
||||
```bash
|
||||
@@ -61,13 +61,13 @@ the default way that the CLI executes tools that might have side effects.
|
||||
Contributors to the project will want to run the CLI directly from the source
|
||||
code.
|
||||
|
||||
- **Development mode:** This method provides hot-reloading and is useful for
|
||||
- **Development Mode:** This method provides hot-reloading and is useful for
|
||||
active development.
|
||||
```bash
|
||||
# From the root of the repository
|
||||
npm run start
|
||||
```
|
||||
- **Production-like mode (linked package):** This method simulates a global
|
||||
- **Production-like mode (Linked package):** This method simulates a global
|
||||
installation by linking your local package. It's useful for testing a local
|
||||
build in a production workflow.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Gemini CLI companion plugin: Interface specification
|
||||
# Gemini CLI Companion Plugin: Interface Specification
|
||||
|
||||
> Last Updated: September 15, 2025
|
||||
|
||||
@@ -9,11 +9,11 @@ awareness) are provided by the official extension
|
||||
This specification is for contributors who wish to bring similar functionality
|
||||
to other editors like JetBrains IDEs, Sublime Text, etc.
|
||||
|
||||
## I. The communication interface
|
||||
## I. The Communication Interface
|
||||
|
||||
Gemini CLI and the IDE plugin communicate through a local communication channel.
|
||||
|
||||
### 1. Transport layer: MCP over HTTP
|
||||
### 1. Transport Layer: MCP over HTTP
|
||||
|
||||
The plugin **MUST** run a local HTTP server that implements the **Model Context
|
||||
Protocol (MCP)**.
|
||||
@@ -25,24 +25,24 @@ Protocol (MCP)**.
|
||||
- **Port:** The server **MUST** listen on a dynamically assigned port (i.e.,
|
||||
listen on port `0`).
|
||||
|
||||
### 2. Discovery mechanism: The port file
|
||||
### 2. Discovery Mechanism: The Port File
|
||||
|
||||
For Gemini CLI to connect, it needs to discover which IDE instance it's running
|
||||
in and what port your server is using. The plugin **MUST** facilitate this by
|
||||
creating a "discovery file."
|
||||
|
||||
- **How the CLI finds the file:** The CLI determines the Process ID (PID) of the
|
||||
- **How the CLI Finds the File:** The CLI determines the Process ID (PID) of the
|
||||
IDE it's running in by traversing the process tree. It then looks for a
|
||||
discovery file that contains this PID in its name.
|
||||
- **File location:** The file must be created in a specific directory:
|
||||
- **File Location:** The file must be created in a specific directory:
|
||||
`os.tmpdir()/gemini/ide/`. Your plugin must create this directory if it
|
||||
doesn't exist.
|
||||
- **File naming convention:** The filename is critical and **MUST** follow the
|
||||
- **File Naming Convention:** The filename is critical and **MUST** follow the
|
||||
pattern: `gemini-ide-server-${PID}-${PORT}.json`
|
||||
- `${PID}`: The process ID of the parent IDE process. Your plugin must
|
||||
determine this PID and include it in the filename.
|
||||
- `${PORT}`: The port your MCP server is listening on.
|
||||
- **File content and workspace validation:** The file **MUST** contain a JSON
|
||||
- **File Content & Workspace Validation:** The file **MUST** contain a JSON
|
||||
object with the following structure:
|
||||
|
||||
```json
|
||||
@@ -79,7 +79,7 @@ creating a "discovery file."
|
||||
server (e.g., `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
|
||||
- **Tie-Breaking with Environment Variables (Recommended):** For the most
|
||||
reliable experience, your plugin **SHOULD** both create the discovery file and
|
||||
set the `GEMINI_CLI_IDE_SERVER_PORT` environment variable in the integrated
|
||||
terminal. The file serves as the primary discovery mechanism, but the
|
||||
@@ -88,18 +88,18 @@ creating a "discovery file."
|
||||
`GEMINI_CLI_IDE_SERVER_PORT` variable to identify and connect to the correct
|
||||
window's server.
|
||||
|
||||
## II. The context interface
|
||||
## II. The Context Interface
|
||||
|
||||
To enable context awareness, the plugin **MAY** provide the CLI with real-time
|
||||
information about the user's activity in the IDE.
|
||||
|
||||
### `ide/contextUpdate` notification
|
||||
### `ide/contextUpdate` Notification
|
||||
|
||||
The plugin **MAY** send an `ide/contextUpdate`
|
||||
[notification](https://modelcontextprotocol.io/specification/2025-06-18/basic/index#notifications)
|
||||
to the CLI whenever the user's context changes.
|
||||
|
||||
- **Triggering events:** This notification should be sent (with a recommended
|
||||
- **Triggering Events:** This notification should be sent (with a recommended
|
||||
debounce of 50ms) when:
|
||||
- A file is opened, closed, or focused.
|
||||
- The user's cursor position or text selection changes in the active file.
|
||||
@@ -136,16 +136,16 @@ to the CLI whenever the user's context changes.
|
||||
Virtual files (e.g., unsaved files without a path, editor settings pages)
|
||||
**MUST** be excluded.
|
||||
|
||||
### How the CLI uses this context
|
||||
### How the CLI Uses This Context
|
||||
|
||||
After receiving the `IdeContext` object, the CLI performs several normalization
|
||||
and truncation steps before sending the information to the model.
|
||||
|
||||
- **File ordering:** The CLI uses the `timestamp` field to determine the most
|
||||
- **File Ordering:** The CLI uses the `timestamp` field to determine the most
|
||||
recently used files. It sorts the `openFiles` list based on this value.
|
||||
Therefore, your plugin **MUST** provide an accurate Unix timestamp for when a
|
||||
file was last focused.
|
||||
- **Active file:** The CLI considers only the most recent file (after sorting)
|
||||
- **Active File:** The CLI considers only the most recent file (after sorting)
|
||||
to be the "active" file. It will ignore the `isActive` flag on all other files
|
||||
and clear their `cursor` and `selectedText` fields. Your plugin should focus
|
||||
on setting `isActive: true` and providing cursor/selection details only for
|
||||
@@ -156,14 +156,14 @@ and truncation steps before sending the information to the model.
|
||||
While the CLI handles the final truncation, it is highly recommended that your
|
||||
plugin also limits the amount of context it sends.
|
||||
|
||||
## III. The diffing interface
|
||||
## III. The Diffing Interface
|
||||
|
||||
To enable interactive code modifications, the plugin **MAY** expose a diffing
|
||||
interface. This allows the CLI to request that the IDE open a diff view, showing
|
||||
proposed changes to a file. The user can then review, edit, and ultimately
|
||||
accept or reject these changes directly within the IDE.
|
||||
|
||||
### `openDiff` tool
|
||||
### `openDiff` Tool
|
||||
|
||||
The plugin **MUST** register an `openDiff` tool on its MCP server.
|
||||
|
||||
@@ -194,7 +194,7 @@ The plugin **MUST** register an `openDiff` tool on its MCP server.
|
||||
The actual outcome of the diff (acceptance or rejection) is communicated
|
||||
asynchronously via notifications.
|
||||
|
||||
### `closeDiff` tool
|
||||
### `closeDiff` Tool
|
||||
|
||||
The plugin **MUST** register a `closeDiff` tool on its MCP server.
|
||||
|
||||
@@ -219,7 +219,7 @@ The plugin **MUST** register a `closeDiff` tool on its MCP server.
|
||||
**MUST** have `isError: true` and include a `TextContent` block in the
|
||||
`content` array describing the error.
|
||||
|
||||
### `ide/diffAccepted` notification
|
||||
### `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
|
||||
@@ -238,7 +238,7 @@ to the CLI.
|
||||
}
|
||||
```
|
||||
|
||||
### `ide/diffRejected` notification
|
||||
### `ide/diffRejected` Notification
|
||||
|
||||
When the user rejects the changes (e.g., by closing the diff view without
|
||||
accepting), the plugin **MUST** send an `ide/diffRejected` notification to the
|
||||
@@ -254,14 +254,14 @@ CLI.
|
||||
}
|
||||
```
|
||||
|
||||
## IV. The lifecycle interface
|
||||
## IV. The Lifecycle Interface
|
||||
|
||||
The plugin **MUST** manage its resources and the discovery file correctly based
|
||||
on the IDE's lifecycle.
|
||||
|
||||
- **On activation (IDE startup/plugin enabled):**
|
||||
- **On Activation (IDE startup/plugin enabled):**
|
||||
1. Start the MCP server.
|
||||
2. Create the discovery file.
|
||||
- **On deactivation (IDE shutdown/plugin disabled):**
|
||||
- **On Deactivation (IDE shutdown/plugin disabled):**
|
||||
1. Stop the MCP server.
|
||||
2. Delete the discovery file.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# IDE integration
|
||||
# IDE Integration
|
||||
|
||||
Gemini CLI can integrate with your IDE to provide a more seamless and
|
||||
context-aware experience. This integration allows the CLI to understand your
|
||||
@@ -11,18 +11,18 @@ support VS Code extensions. To build support for other editors, see the
|
||||
|
||||
## Features
|
||||
|
||||
- **Workspace context:** The CLI automatically gains awareness of your workspace
|
||||
- **Workspace Context:** The CLI automatically gains awareness of your workspace
|
||||
to provide more relevant and accurate responses. This context includes:
|
||||
- The **10 most recently accessed files** in your workspace.
|
||||
- Your active cursor position.
|
||||
- Any text you have selected (up to a 16KB limit; longer selections will be
|
||||
truncated).
|
||||
|
||||
- **Native diffing:** When Gemini suggests code modifications, you can view the
|
||||
- **Native Diffing:** When Gemini suggests code modifications, you can view the
|
||||
changes directly within your IDE's native diff viewer. This allows you to
|
||||
review, edit, and accept or reject the suggested changes seamlessly.
|
||||
|
||||
- **VS Code commands:** You can access Gemini CLI features directly from the VS
|
||||
- **VS Code Commands:** You can access Gemini CLI features directly from the VS
|
||||
Code Command Palette (`Cmd+Shift+P` or `Ctrl+Shift+P`):
|
||||
- `Gemini CLI: Run`: Starts a new Gemini CLI session in the integrated
|
||||
terminal.
|
||||
@@ -32,18 +32,18 @@ support VS Code extensions. To build support for other editors, see the
|
||||
- `Gemini CLI: View Third-Party Notices`: Displays the third-party notices for
|
||||
the extension.
|
||||
|
||||
## Installation and setup
|
||||
## Installation and Setup
|
||||
|
||||
There are three ways to set up the IDE integration:
|
||||
|
||||
### 1. Automatic nudge (recommended)
|
||||
### 1. Automatic Nudge (Recommended)
|
||||
|
||||
When you run Gemini CLI inside a supported editor, it will automatically detect
|
||||
your environment and prompt you to connect. Answering "Yes" will automatically
|
||||
run the necessary setup, which includes installing the companion extension and
|
||||
enabling the connection.
|
||||
|
||||
### 2. Manual installation from CLI
|
||||
### 2. Manual Installation from CLI
|
||||
|
||||
If you previously dismissed the prompt or want to install the extension
|
||||
manually, you can run the following command inside Gemini CLI:
|
||||
@@ -54,13 +54,13 @@ manually, you can run the following command inside Gemini CLI:
|
||||
|
||||
This will find the correct extension for your IDE and install it.
|
||||
|
||||
### 3. Manual installation from a marketplace
|
||||
### 3. Manual Installation from a Marketplace
|
||||
|
||||
You can also install the extension directly from a marketplace.
|
||||
|
||||
- **For Visual Studio Code:** Install from the
|
||||
[VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=google.gemini-cli-vscode-ide-companion).
|
||||
- **For VS Code forks:** To support forks of VS Code, the extension is also
|
||||
- **For VS Code Forks:** To support forks of VS Code, the extension is also
|
||||
published on the
|
||||
[Open VSX Registry](https://open-vsx.org/extension/google/gemini-cli-vscode-ide-companion).
|
||||
Follow your editor's instructions for installing extensions from this
|
||||
@@ -75,7 +75,7 @@ You can also install the extension directly from a marketplace.
|
||||
|
||||
## Usage
|
||||
|
||||
### Enabling and disabling
|
||||
### Enabling and Disabling
|
||||
|
||||
You can control the IDE integration from within the CLI:
|
||||
|
||||
@@ -91,7 +91,7 @@ You can control the IDE integration from within the CLI:
|
||||
When enabled, Gemini CLI will automatically attempt to connect to the IDE
|
||||
companion extension.
|
||||
|
||||
### Checking the status
|
||||
### Checking the Status
|
||||
|
||||
To check the connection status and see the context the CLI has received from the
|
||||
IDE, run:
|
||||
@@ -106,7 +106,7 @@ recently opened files it is aware of.
|
||||
> [!NOTE] The file list is limited to 10 recently accessed files within your
|
||||
> workspace and only includes local files on disk.)
|
||||
|
||||
### Working with diffs
|
||||
### Working with Diffs
|
||||
|
||||
When you ask Gemini to modify a file, it can open a diff view directly in your
|
||||
editor.
|
||||
@@ -131,14 +131,14 @@ accepting them.
|
||||
If you select ‘Yes, allow always’ in the CLI, changes will no longer show up in
|
||||
the IDE as they will be auto-accepted.
|
||||
|
||||
## Using with sandboxing
|
||||
## Using with Sandboxing
|
||||
|
||||
If you are using Gemini CLI within a sandbox, please 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
|
||||
network access.
|
||||
- **In a Docker container:** If you run Gemini CLI inside a Docker (or Podman)
|
||||
- **In a Docker Container:** If you run Gemini CLI inside a Docker (or Podman)
|
||||
container, the IDE integration can still connect to the VS Code extension
|
||||
running on your host machine. The CLI is configured to automatically find the
|
||||
IDE server on `host.docker.internal`. No special configuration is usually
|
||||
@@ -150,7 +150,7 @@ If you are using Gemini CLI within a sandbox, please be aware of the following:
|
||||
If you encounter issues with IDE integration, here are some common error
|
||||
messages and how to resolve them.
|
||||
|
||||
### Connection errors
|
||||
### Connection Errors
|
||||
|
||||
- **Message:**
|
||||
`🔴 Disconnected: Failed to connect to IDE companion extension in [IDE Name]. Please ensure the extension is running. To install the extension, run /ide install.`
|
||||
@@ -170,7 +170,7 @@ messages and how to resolve them.
|
||||
- **Solution:** Run `/ide enable` to try and reconnect. If the issue
|
||||
continues, open a new terminal window or restart your IDE.
|
||||
|
||||
### Configuration errors
|
||||
### Configuration Errors
|
||||
|
||||
- **Message:**
|
||||
`🔴 Disconnected: Directory mismatch. Gemini CLI is running in a different location than the open workspace in [IDE Name]. Please run the CLI from one of the following directories: [List of directories]`
|
||||
@@ -184,7 +184,7 @@ messages and how to resolve them.
|
||||
- **Cause:** You have no workspace open in your IDE.
|
||||
- **Solution:** Open a workspace in your IDE and restart the CLI.
|
||||
|
||||
### General errors
|
||||
### General Errors
|
||||
|
||||
- **Message:**
|
||||
`IDE integration is not supported in your current environment. To use this feature, run Gemini CLI in one of these supported IDEs: [List of IDEs]`
|
||||
|
||||
+49
-73
@@ -1,10 +1,10 @@
|
||||
# Welcome to Gemini CLI documentation
|
||||
|
||||
This documentation provides a comprehensive guide to installing, using, and
|
||||
developing Gemini CLI, a tool that lets you interact with Gemini models through
|
||||
a command-line interface.
|
||||
developing Gemini CLI. This tool lets you interact with Gemini models through a
|
||||
command-line interface.
|
||||
|
||||
## Gemini CLI overview
|
||||
## Overview
|
||||
|
||||
Gemini CLI brings the capabilities of Gemini models to your terminal in an
|
||||
interactive Read-Eval-Print Loop (REPL) environment. Gemini CLI consists of a
|
||||
@@ -18,58 +18,41 @@ file system operations, running shells, and web fetching, which are managed by
|
||||
|
||||
This documentation is organized into the following sections:
|
||||
|
||||
### Overview
|
||||
|
||||
- **[Architecture overview](./architecture.md):** Understand the high-level
|
||||
design of Gemini CLI, including its components and how they interact.
|
||||
- **[Contribution guide](../CONTRIBUTING.md):** Information for contributors and
|
||||
developers, including setup, building, testing, and coding conventions.
|
||||
|
||||
### Get started
|
||||
|
||||
- **[Gemini CLI quickstart](./get-started/index.md):** Let's get started with
|
||||
- **[Gemini CLI Quickstart](./get-started/index.md):** Let's get started with
|
||||
Gemini CLI.
|
||||
- **[Gemini 3 Pro on Gemini CLI](./get-started/gemini-3.md):** Learn how to
|
||||
enable and use Gemini 3.
|
||||
- **[Authentication](./get-started/authentication.md):** Authenticate to Gemini
|
||||
CLI.
|
||||
- **[Configuration](./get-started/configuration.md):** Learn how to configure
|
||||
the CLI.
|
||||
- **[Installation](./get-started/installation.md):** Install and run Gemini CLI.
|
||||
- **[Authentication](./get-started/authentication.md):** Authenticate Gemini
|
||||
CLI.
|
||||
- **[Configuration](./get-started/configuration.md):** Information on
|
||||
configuring the CLI.
|
||||
- **[Examples](./get-started/examples.md):** Example usage of Gemini CLI.
|
||||
- **[Get started with Gemini 3](./get-started/gemini-3.md):** Learn how to
|
||||
enable and use Gemini 3.
|
||||
|
||||
### CLI
|
||||
|
||||
- **[Introduction: Gemini CLI](./cli/index.md):** Overview of the command-line
|
||||
interface.
|
||||
- **[CLI overview](./cli/index.md):** Overview of the command-line interface.
|
||||
- **[Commands](./cli/commands.md):** Description of available CLI commands.
|
||||
- **[Checkpointing](./cli/checkpointing.md):** Documentation for the
|
||||
checkpointing feature.
|
||||
- **[Custom commands](./cli/custom-commands.md):** Create your own commands and
|
||||
shortcuts for frequently used prompts.
|
||||
- **[Enterprise](./cli/enterprise.md):** Gemini CLI for enterprise.
|
||||
- **[Headless mode](./cli/headless.md):** Use Gemini CLI programmatically for
|
||||
scripting and automation.
|
||||
- **[Keyboard shortcuts](./cli/keyboard-shortcuts.md):** A reference for all
|
||||
keyboard shortcuts to improve your workflow.
|
||||
- **[Model selection](./cli/model.md):** Select the model used to process your
|
||||
- **[Model Selection](./cli/model.md):** Select the model used to process your
|
||||
commands with `/model`.
|
||||
- **[Sandbox](./cli/sandbox.md):** Isolate tool execution in a secure,
|
||||
containerized environment.
|
||||
- **[Settings](./cli/settings.md):** Configure various aspects of the CLI's
|
||||
behavior and appearance with `/settings`.
|
||||
- **[Telemetry](./cli/telemetry.md):** Overview of telemetry in the CLI.
|
||||
- **[Themes](./cli/themes.md):** Themes for Gemini CLI.
|
||||
- **[Token caching](./cli/token-caching.md):** Token caching and optimization.
|
||||
- **[Token Caching](./cli/token-caching.md):** Token caching and optimization.
|
||||
- **[Tutorials](./cli/tutorials.md):** Tutorials for Gemini CLI.
|
||||
- **[Checkpointing](./cli/checkpointing.md):** Documentation for the
|
||||
checkpointing feature.
|
||||
- **[Telemetry](./cli/telemetry.md):** Overview of telemetry in the CLI.
|
||||
- **[Trusted Folders](./cli/trusted-folders.md):** An overview of the Trusted
|
||||
Folders security feature.
|
||||
- **[Tutorials](./cli/tutorials.md):** Tutorials for Gemini CLI.
|
||||
- **[Uninstall](./cli/uninstall.md):** Methods for uninstalling the Gemini CLI.
|
||||
|
||||
### Core
|
||||
|
||||
- **[Introduction: Gemini CLI core](./core/index.md):** Information about Gemini
|
||||
CLI core.
|
||||
- **[Gemini CLI core overview](./core/index.md):** Information about Gemini CLI
|
||||
core.
|
||||
- **[Memport](./core/memport.md):** Using the Memory Import Processor.
|
||||
- **[Tools API](./core/tools-api.md):** Information on how the core manages and
|
||||
exposes tools.
|
||||
@@ -78,58 +61,51 @@ This documentation is organized into the following sections:
|
||||
|
||||
### Tools
|
||||
|
||||
- **[Introduction: Gemini CLI tools](./tools/index.md):** Information about
|
||||
Gemini CLI's tools.
|
||||
- **[File system tools](./tools/file-system.md):** Documentation for the
|
||||
- **[Gemini CLI tools overview](./tools/index.md):** Information about Gemini
|
||||
CLI's tools.
|
||||
- **[File System Tools](./tools/file-system.md):** Documentation for the
|
||||
`read_file` and `write_file` tools.
|
||||
- **[Shell tool](./tools/shell.md):** Documentation for the `run_shell_command`
|
||||
tool.
|
||||
- **[Web fetch tool](./tools/web-fetch.md):** Documentation for the `web_fetch`
|
||||
tool.
|
||||
- **[Web search tool](./tools/web-search.md):** Documentation for the
|
||||
`google_web_search` tool.
|
||||
- **[Memory tool](./tools/memory.md):** Documentation for the `save_memory`
|
||||
tool.
|
||||
- **[Todo tool](./tools/todos.md):** Documentation for the `write_todos` tool.
|
||||
- **[MCP servers](./tools/mcp-server.md):** Using MCP servers with Gemini CLI.
|
||||
- **[Shell Tool](./tools/shell.md):** Documentation for the `run_shell_command`
|
||||
tool.
|
||||
- **[Web Fetch Tool](./tools/web-fetch.md):** Documentation for the `web_fetch`
|
||||
tool.
|
||||
- **[Web Search Tool](./tools/web-search.md):** Documentation for the
|
||||
`google_web_search` tool.
|
||||
- **[Memory Tool](./tools/memory.md):** Documentation for the `save_memory`
|
||||
tool.
|
||||
- **[Todo Tool](./tools/todos.md):** Documentation for the `write_todos` tool.
|
||||
|
||||
### Extensions
|
||||
|
||||
- **[Introduction: Extensions](./extensions/index.md):** How to extend the CLI
|
||||
with new functionality.
|
||||
- **[Get Started with extensions](./extensions/getting-started-extensions.md):**
|
||||
- **[Extensions](./extensions/index.md):** How to extend the CLI with new
|
||||
functionality.
|
||||
- **[Get Started with Extensions](./extensions/getting-started-extensions.md):**
|
||||
Learn how to build your own extension.
|
||||
- **[Extension releasing](./extensions/extension-releasing.md):** How to release
|
||||
- **[Extension Releasing](./extensions/extension-releasing.md):** How to release
|
||||
Gemini CLI extensions.
|
||||
|
||||
### IDE integration
|
||||
|
||||
- **[Introduction to IDE integration](./ide-integration/index.md):** Connect the
|
||||
CLI to your editor.
|
||||
- **[IDE companion extension spec](./ide-integration/ide-companion-spec.md):**
|
||||
- **[IDE Integration](./ide-integration/index.md):** Connect the CLI to your
|
||||
editor.
|
||||
- **[IDE Companion Extension Spec](./ide-integration/ide-companion-spec.md):**
|
||||
Spec for building IDE companion extensions.
|
||||
|
||||
### Development
|
||||
### About the Gemini CLI project
|
||||
|
||||
- **[Architecture Overview](./architecture.md):** Understand the high-level
|
||||
design of Gemini CLI, including its components and how they interact.
|
||||
- **[Contributing & Development Guide](../CONTRIBUTING.md):** Information for
|
||||
contributors and developers, including setup, building, testing, and coding
|
||||
conventions.
|
||||
- **[NPM](./npm.md):** Details on how the project's packages are structured.
|
||||
- **[Troubleshooting Guide](./troubleshooting.md):** Find solutions to common
|
||||
problems.
|
||||
- **[FAQ](./faq.md):** Frequently asked questions.
|
||||
- **[Terms of Service and Privacy Notice](./tos-privacy.md):** Information on
|
||||
the terms of service and privacy notices applicable to your use of Gemini CLI.
|
||||
- **[Releases](./releases.md):** Information on the project's releases and
|
||||
deployment cadence.
|
||||
- **[Changelog](./changelogs/index.md):** Highlights and notable changes to
|
||||
Gemini CLI.
|
||||
- **[Integration tests](./integration-tests.md):** Information about the
|
||||
integration testing framework used in this project.
|
||||
- **[Issue and PR automation](./issue-and-pr-automation.md):** A detailed
|
||||
overview of the automated processes we use to manage and triage issues and
|
||||
pull requests.
|
||||
|
||||
### Support
|
||||
|
||||
- **[FAQ](./faq.md):** Frequently asked questions.
|
||||
- **[Troubleshooting guide](./troubleshooting.md):** Find solutions to common
|
||||
problems.
|
||||
- **[Quota and pricing](./quota-and-pricing.md):** Learn about the free tier and
|
||||
paid options.
|
||||
- **[Terms of service and privacy notice](./tos-privacy.md):** Information on
|
||||
the terms of service and privacy notices applicable to your use of Gemini CLI.
|
||||
|
||||
We hope this documentation helps you make the most of Gemini CLI!
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Integration tests
|
||||
# Integration Tests
|
||||
|
||||
This document provides information about the integration testing framework used
|
||||
in this project.
|
||||
@@ -86,7 +86,7 @@ with the deflake script or workflow to make sure that it is not flaky.
|
||||
npm run deflake -- --runs=5 --command="npm run test:e2e -- -- --test-name-pattern '<your-new-test-name>'"
|
||||
```
|
||||
|
||||
#### Deflake workflow
|
||||
#### Deflake Workflow
|
||||
|
||||
```bash
|
||||
gh workflow run deflake.yml --ref <your-branch> -f test_name_pattern="<your-test-name-pattern>"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Automation and triage processes
|
||||
# Automation and Triage Processes
|
||||
|
||||
This document provides a detailed overview of the automated processes we use to
|
||||
manage and triage issues and pull requests. Our goal is to provide prompt
|
||||
@@ -6,7 +6,7 @@ feedback and ensure that contributions are reviewed and integrated efficiently.
|
||||
Understanding this automation will help you as a contributor know what to expect
|
||||
and how to best interact with our repository bots.
|
||||
|
||||
## Guiding principle: Issues and pull requests
|
||||
## Guiding Principle: Issues and Pull Requests
|
||||
|
||||
First and foremost, almost every Pull Request (PR) should be linked to a
|
||||
corresponding Issue. The issue describes the "what" and the "why" (the bug or
|
||||
@@ -16,12 +16,12 @@ automation is built around this principle.
|
||||
|
||||
---
|
||||
|
||||
## Detailed automation workflows
|
||||
## Detailed Automation Workflows
|
||||
|
||||
Here is a breakdown of the specific automation workflows that run in our
|
||||
repository.
|
||||
|
||||
### 1. When you open an issue: `Automated Issue Triage`
|
||||
### 1. When you open an Issue: `Automated Issue Triage`
|
||||
|
||||
This is the first bot you will interact with when you create an issue. Its job
|
||||
is to perform an initial analysis and apply the correct labels.
|
||||
@@ -48,7 +48,7 @@ is to perform an initial analysis and apply the correct labels.
|
||||
- If the `status/need-information` label is added, please provide the
|
||||
requested details in a comment.
|
||||
|
||||
### 2. When you open a pull request: `Continuous Integration (CI)`
|
||||
### 2. When you open a Pull Request: `Continuous Integration (CI)`
|
||||
|
||||
This workflow ensures that all changes meet our quality standards before they
|
||||
can be merged.
|
||||
@@ -70,7 +70,7 @@ can be merged.
|
||||
- If a check fails (a red "X" ❌), click the "Details" link next to the failed
|
||||
check to view the logs, identify the problem, and push a fix.
|
||||
|
||||
### 3. Ongoing triage for pull requests: `PR Auditing and Label Sync`
|
||||
### 3. Ongoing Triage for Pull Requests: `PR Auditing and Label Sync`
|
||||
|
||||
This workflow runs periodically to ensure all open PRs are correctly linked to
|
||||
issues and have consistent labels.
|
||||
@@ -93,7 +93,7 @@ issues and have consistent labels.
|
||||
- This will ensure your PR is correctly categorized and moves through the
|
||||
review process smoothly.
|
||||
|
||||
### 4. Ongoing triage for issues: `Scheduled Issue Triage`
|
||||
### 4. Ongoing Triage for Issues: `Scheduled Issue Triage`
|
||||
|
||||
This is a fallback workflow to ensure that no issue gets missed by the triage
|
||||
process.
|
||||
@@ -110,7 +110,7 @@ process.
|
||||
ensure every issue is eventually categorized, even if the initial triage
|
||||
fails.
|
||||
|
||||
### 5. Release automation
|
||||
### 5. Release Automation
|
||||
|
||||
This workflow handles the process of packaging and publishing new versions of
|
||||
the Gemini CLI.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# Local development guide
|
||||
# Local Development Guide
|
||||
|
||||
This guide provides instructions for setting up and using local development
|
||||
features, such as development tracing.
|
||||
|
||||
## Development tracing
|
||||
## Development Tracing
|
||||
|
||||
Development traces (dev traces) are OpenTelemetry (OTel) traces that help you
|
||||
debug your code by instrumenting interesting events like model calls, tool
|
||||
@@ -15,7 +15,7 @@ behaviour and debugging issues. They are disabled by default.
|
||||
To enable dev traces, set the `GEMINI_DEV_TRACING=true` environment variable
|
||||
when running Gemini CLI.
|
||||
|
||||
### Viewing dev traces
|
||||
### Viewing Dev Traces
|
||||
|
||||
You can view dev traces using either Jaeger or the Genkit Developer UI.
|
||||
|
||||
@@ -23,7 +23,7 @@ You can view dev traces using either Jaeger or the Genkit Developer UI.
|
||||
|
||||
Genkit provides a web-based UI for viewing traces and other telemetry data.
|
||||
|
||||
1. **Start the Genkit telemetry server:**
|
||||
1. **Start the Genkit Telemetry Server:**
|
||||
|
||||
Run the following command to start the Genkit server:
|
||||
|
||||
@@ -37,7 +37,7 @@ Genkit provides a web-based UI for viewing traces and other telemetry data.
|
||||
Genkit Developer UI: http://localhost:4000
|
||||
```
|
||||
|
||||
2. **Run Gemini CLI with dev tracing:**
|
||||
2. **Run Gemini CLI with Dev Tracing:**
|
||||
|
||||
In a separate terminal, run your Gemini CLI command with the
|
||||
`GEMINI_DEV_TRACING` environment variable:
|
||||
@@ -46,7 +46,7 @@ Genkit provides a web-based UI for viewing traces and other telemetry data.
|
||||
GEMINI_DEV_TRACING=true gemini
|
||||
```
|
||||
|
||||
3. **View the traces:**
|
||||
3. **View the Traces:**
|
||||
|
||||
Open the Genkit Developer UI URL in your browser and navigate to the
|
||||
**Traces** tab to view the traces.
|
||||
@@ -84,7 +84,7 @@ You can view dev traces in the Jaeger UI. To get started, follow these steps:
|
||||
For more detailed information on telemetry, see the
|
||||
[telemetry documentation](./cli/telemetry.md).
|
||||
|
||||
### Instrumenting code with dev traces
|
||||
### Instrumenting Code with Dev Traces
|
||||
|
||||
You can add dev traces to your own code for more detailed instrumentation. This
|
||||
is useful for debugging and understanding the flow of execution.
|
||||
|
||||
+7
-7
@@ -1,4 +1,4 @@
|
||||
# Package overview
|
||||
# Package Overview
|
||||
|
||||
This monorepo contains two main packages: `@google/gemini-cli` and
|
||||
`@google/gemini-cli-core`.
|
||||
@@ -25,7 +25,7 @@ Node.js package with its own dependencies. This allows it to be used as a
|
||||
standalone package in other projects, if needed. All transpiled js code in the
|
||||
`dist` folder is included in the package.
|
||||
|
||||
## NPM workspaces
|
||||
## NPM Workspaces
|
||||
|
||||
This project uses
|
||||
[NPM Workspaces](https://docs.npmjs.com/cli/v10/using-npm/workspaces) to manage
|
||||
@@ -33,7 +33,7 @@ the packages within this monorepo. This simplifies development by allowing us to
|
||||
manage dependencies and run scripts across multiple packages from the root of
|
||||
the project.
|
||||
|
||||
### How it works
|
||||
### How it Works
|
||||
|
||||
The root `package.json` file defines the workspaces for this project:
|
||||
|
||||
@@ -46,17 +46,17 @@ The root `package.json` file defines the workspaces for this project:
|
||||
This tells NPM that any folder inside the `packages` directory is a separate
|
||||
package that should be managed as part of the workspace.
|
||||
|
||||
### Benefits of workspaces
|
||||
### Benefits of Workspaces
|
||||
|
||||
- **Simplified dependency management**: Running `npm install` from the root of
|
||||
- **Simplified Dependency Management**: Running `npm install` from the root of
|
||||
the project will install all dependencies for all packages in the workspace
|
||||
and link them together. This means you don't need to run `npm install` in each
|
||||
package's directory.
|
||||
- **Automatic linking**: Packages within the workspace can depend on each other.
|
||||
- **Automatic Linking**: Packages within the workspace can depend on each other.
|
||||
When you run `npm install`, NPM will automatically create symlinks between the
|
||||
packages. This means that when you make changes to one package, the changes
|
||||
are immediately available to other packages that depend on it.
|
||||
- **Simplified script execution**: You can run scripts in any package from the
|
||||
- **Simplified Script Execution**: You can run scripts in any package from the
|
||||
root of the project using the `--workspace` flag. For example, to run the
|
||||
`build` script in the `cli` package, you can run
|
||||
`npm run build --workspace @google/gemini-cli`.
|
||||
|
||||
+23
-19
@@ -1,17 +1,20 @@
|
||||
# Gemini CLI: Quotas and pricing
|
||||
# Gemini CLI: Quotas and Pricing
|
||||
|
||||
Gemini CLI offers a generous free tier that covers many individual developers'
|
||||
use cases. For enterprise or professional usage, or if you need higher limits,
|
||||
several options are available depending on your authentication account type.
|
||||
Gemini CLI offers a generous free tier that covers the use cases for many
|
||||
individual developers. For enterprise / professional usage, or if you need
|
||||
higher limits, there are multiple possible avenues depending on what type of
|
||||
account you use to authenticate.
|
||||
|
||||
See [privacy and terms](./tos-privacy.md) for details on the Privacy Policy and
|
||||
See [privacy and terms](./tos-privacy.md) for details on Privacy policy and
|
||||
Terms of Service.
|
||||
|
||||
> **Note:** Published prices are list price; additional negotiated commercial
|
||||
> discounting may apply.
|
||||
> [!NOTE]
|
||||
>
|
||||
> Published prices are list price; additional negotiated commercial discounting
|
||||
> may apply.
|
||||
|
||||
This article outlines the specific quotas and pricing applicable to Gemini CLI
|
||||
when using different authentication methods.
|
||||
This article outlines the specific quotas and pricing applicable to the Gemini
|
||||
CLI when using different authentication methods.
|
||||
|
||||
Generally, there are three categories to choose from:
|
||||
|
||||
@@ -21,7 +24,7 @@ Generally, there are three categories to choose from:
|
||||
- Pay-As-You-Go: The most flexible option for professional use, long-running
|
||||
tasks, or when you need full control over your usage.
|
||||
|
||||
## Free usage
|
||||
## Free Usage
|
||||
|
||||
Your journey begins with a generous free tier, perfect for experimentation and
|
||||
light use.
|
||||
@@ -41,7 +44,7 @@ Assist for individuals. This includes:
|
||||
Learn more at
|
||||
[Gemini Code Assist for Individuals Limits](https://developers.google.com/gemini-code-assist/resources/quotas#quotas-for-agent-mode-gemini-cli).
|
||||
|
||||
### Log in with Gemini API Key (unpaid)
|
||||
### Log in with Gemini API Key (Unpaid)
|
||||
|
||||
If you are using a Gemini API key, you can also benefit from a free tier. This
|
||||
includes:
|
||||
@@ -69,9 +72,11 @@ Learn more at
|
||||
If you use up your initial number of requests, you can continue to benefit from
|
||||
Gemini CLI by upgrading to one of the following subscriptions:
|
||||
|
||||
- [Google AI Pro and AI Ultra](https://gemini.google/subscriptions/). This is
|
||||
recommended for individual developers. Quotas and pricing are based on a fixed
|
||||
price subscription.
|
||||
- [Google AI Pro and AI Ultra](https://cloud.google.com/products/gemini/pricing)
|
||||
by signing up at
|
||||
[Set up Gemini Code Assist](https://goo.gle/set-up-gemini-code-assist). This
|
||||
is recommended for individual developers. Quotas and pricing are based on a
|
||||
fixed price subscription.
|
||||
|
||||
For predictable costs, you can log in with Google.
|
||||
|
||||
@@ -80,8 +85,7 @@ Gemini CLI by upgrading to one of the following subscriptions:
|
||||
|
||||
- [Purchase a Gemini Code Assist Subscription through Google Cloud ](https://cloud.google.com/gemini/docs/codeassist/overview)
|
||||
by signing up in the Google Cloud console. Learn more at
|
||||
[Set up Gemini Code Assist](https://cloud.google.com/gemini/docs/discover/set-up-gemini).
|
||||
|
||||
[Set up Gemini Code Assist](https://cloud.google.com/gemini/docs/discover/set-up-gemini)
|
||||
Quotas and pricing are based on a fixed price subscription with assigned
|
||||
license seats. For predictable costs, you can sign in with Google.
|
||||
|
||||
@@ -97,7 +101,7 @@ Gemini CLI by upgrading to one of the following subscriptions:
|
||||
|
||||
[Learn more about Gemini Code Assist Standard and Enterprise license limits](https://developers.google.com/gemini-code-assist/resources/quotas#quotas-for-agent-mode-gemini-cli).
|
||||
|
||||
## Pay as you go
|
||||
## Pay As You Go
|
||||
|
||||
If you hit your daily request limits or exhaust your Gemini Pro quota even after
|
||||
upgrading, the most flexible solution is to switch to a pay-as-you-go model,
|
||||
@@ -127,7 +131,7 @@ It’s important to highlight that when using an API key, you pay per token/call
|
||||
This can be more expensive for many small calls with few tokens, but it's the
|
||||
only way to ensure your workflow isn't interrupted by quota limits.
|
||||
|
||||
## Gemini for workspace plans
|
||||
## Gemini for Workspace plans
|
||||
|
||||
These plans currently apply only to the use of Gemini web-based products
|
||||
provided by Google-based experiences (for example, the Gemini web app or the
|
||||
@@ -135,7 +139,7 @@ Flow video editor). These plans do not apply to the API usage which powers the
|
||||
Gemini CLI. Supporting these plans is under active consideration for future
|
||||
support.
|
||||
|
||||
## Tips to avoid high costs
|
||||
## Tips to Avoid High Costs
|
||||
|
||||
When using a Pay as you Go API key, be mindful of your usage to avoid unexpected
|
||||
costs.
|
||||
|
||||
+20
-20
@@ -1,21 +1,21 @@
|
||||
# Release confidence strategy
|
||||
# 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
|
||||
ensure we are shipping a high-quality product.
|
||||
|
||||
## The goal
|
||||
## The Goal
|
||||
|
||||
To answer the question, "Is this release _truly_ ready for our users?" with a
|
||||
high degree of confidence, based on a holistic evaluation of automated signals,
|
||||
manual verification, and data.
|
||||
|
||||
## Level 1: Automated gates (must pass)
|
||||
## Level 1: Automated Gates (Must Pass)
|
||||
|
||||
These are the baseline requirements. If any of these fail, the release is a
|
||||
no-go.
|
||||
|
||||
### 1. CI/CD health
|
||||
### 1. CI/CD Health
|
||||
|
||||
All workflows in `.github/workflows/ci.yml` must pass on the `main` branch (for
|
||||
nightly) or the release branch (for preview/stable).
|
||||
@@ -31,7 +31,7 @@ nightly) or the release branch (for preview/stable).
|
||||
pass.
|
||||
- **Build:** The project must build and bundle successfully.
|
||||
|
||||
### 2. End-to-end (E2E) tests
|
||||
### 2. End-to-End (E2E) Tests
|
||||
|
||||
All workflows in `.github/workflows/e2e.yml` must pass.
|
||||
|
||||
@@ -39,7 +39,7 @@ All workflows in `.github/workflows/e2e.yml` must pass.
|
||||
- **Sandboxing:** Tests must pass with both `sandbox:none` and `sandbox:docker`
|
||||
on Linux.
|
||||
|
||||
### 3. Post-deployment smoke tests
|
||||
### 3. Post-Deployment Smoke Tests
|
||||
|
||||
After a release is published to npm, the `smoke-test.yml` workflow runs. This
|
||||
must pass to confirm the package is installable and the binary is executable.
|
||||
@@ -48,11 +48,11 @@ must pass to confirm the package is installable and the binary is executable.
|
||||
correct version without error.
|
||||
- **Platform:** Currently runs on `ubuntu-latest`.
|
||||
|
||||
## Level 2: Manual verification and dogfooding
|
||||
## Level 2: Manual Verification & Dogfooding
|
||||
|
||||
Automated tests cannot catch everything, especially UX issues.
|
||||
|
||||
### 1. Dogfooding via `preview` tag
|
||||
### 1. Dogfooding via `preview` Tag
|
||||
|
||||
The weekly release cadence promotes code from `main` -> `nightly` -> `preview`
|
||||
-> `stable`.
|
||||
@@ -66,7 +66,7 @@ The weekly release cadence promotes code from `main` -> `nightly` -> `preview`
|
||||
- **Goal:** To catch regressions and UX issues in day-to-day usage before they
|
||||
reach the broad user base.
|
||||
|
||||
### 2. Critical user journey (CUJ) checklist
|
||||
### 2. Critical User Journey (CUJ) Checklist
|
||||
|
||||
Before promoting a `preview` release to `stable`, a release manager must
|
||||
manually run through this checklist.
|
||||
@@ -84,15 +84,15 @@ manually run through this checklist.
|
||||
- [ ] API Key
|
||||
- [ ] Vertex AI
|
||||
|
||||
- **Basic prompting:**
|
||||
- **Basic Prompting:**
|
||||
- [ ] Run `gemini "Tell me a joke"` and verify a sensible response.
|
||||
- [ ] Run in interactive mode: `gemini`. Ask a follow-up question to test
|
||||
context.
|
||||
|
||||
- **Piped input:**
|
||||
- **Piped Input:**
|
||||
- [ ] Run `echo "Summarize this" | gemini` and verify it processes stdin.
|
||||
|
||||
- **Context management:**
|
||||
- **Context Management:**
|
||||
- [ ] In interactive mode, use `@file` to add a local file to context. Ask a
|
||||
question about it.
|
||||
|
||||
@@ -100,20 +100,20 @@ manually run through this checklist.
|
||||
- [ ] In interactive mode run `/settings` and make modifications
|
||||
- [ ] Validate that setting is changed
|
||||
|
||||
- **Function calling:**
|
||||
- **Function Calling:**
|
||||
- [ ] In interactive mode, ask gemini to "create a file named hello.md with
|
||||
the content 'hello world'" and verify the file is created correctly.
|
||||
|
||||
If any of these CUJs fail, the release is a no-go until a patch is applied to
|
||||
the `preview` channel.
|
||||
|
||||
### 3. Pre-Launch bug bash (tier 1 and 2 launches)
|
||||
### 3. Pre-Launch Bug Bash (Tier 1 & 2 Launches)
|
||||
|
||||
For high-impact releases, an organized bug bash is required to ensure a higher
|
||||
level of quality and to catch issues across a wider range of environments and
|
||||
use cases.
|
||||
|
||||
**Definition of tiers:**
|
||||
**Definition of Tiers:**
|
||||
|
||||
- **Tier 1:** Industry-Moving News 🚀
|
||||
- **Tier 2:** Important News for Our Users 📣
|
||||
@@ -125,7 +125,7 @@ use cases.
|
||||
A bug bash must be scheduled at least **72 hours in advance** of any Tier 1 or
|
||||
Tier 2 launch.
|
||||
|
||||
**Rule of thumb:**
|
||||
**Rule of Thumb:**
|
||||
|
||||
A bug bash should be considered for any release that involves:
|
||||
|
||||
@@ -134,22 +134,22 @@ A bug bash should be considered for any release that involves:
|
||||
- Media relations or press outreach
|
||||
- A "Turbo" launch event
|
||||
|
||||
## Level 3: Telemetry and data review
|
||||
## Level 3: Telemetry & Data Review
|
||||
|
||||
### Dashboard health
|
||||
### Dashboard Health
|
||||
|
||||
- [ ] Go to `go/gemini-cli-dash`.
|
||||
- [ ] Navigate to the "Tool Call" tab.
|
||||
- [ ] Validate that there are no spikes in errors for the release you would like
|
||||
to promote.
|
||||
|
||||
### Model evaluation
|
||||
### Model Evaluation
|
||||
|
||||
- [ ] Navigate to `go/gemini-cli-offline-evals-dash`.
|
||||
- [ ] Make sure that the release you want to promote's recurring run is within
|
||||
average eval runs.
|
||||
|
||||
## The "go/no-go" decision
|
||||
## The "Go/No-Go" Decision
|
||||
|
||||
Before triggering the `Release: Promote` workflow to move `preview` to `stable`:
|
||||
|
||||
|
||||
+40
-40
@@ -1,4 +1,4 @@
|
||||
# Gemini CLI releases
|
||||
# Gemini CLI Releases
|
||||
|
||||
## `dev` vs `prod` environment
|
||||
|
||||
@@ -22,7 +22,7 @@ More information can be found about these systems in the
|
||||
| Core | @google/gemini-cli-core | @google-gemini/gemini-cli-core A2A Server |
|
||||
| A2A Server | @google/gemini-cli-a2a-server | @google-gemini/gemini-cli-a2a-server |
|
||||
|
||||
## Release cadence and tags
|
||||
## Release Cadence and Tags
|
||||
|
||||
We will follow https://semver.org/ as closely as possible but will call out when
|
||||
or if we have to deviate from it. Our weekly releases will be minor version
|
||||
@@ -66,24 +66,24 @@ npm install -g @google/gemini-cli@latest
|
||||
npm install -g @google/gemini-cli@nightly
|
||||
```
|
||||
|
||||
## Weekly release promotion
|
||||
## Weekly Release Promotion
|
||||
|
||||
Each Tuesday, the on-call engineer will trigger the "Promote Release" workflow.
|
||||
This single action automates the entire weekly release process:
|
||||
|
||||
1. **Promotes preview to stable:** The workflow identifies the latest `preview`
|
||||
1. **Promotes Preview to Stable:** The workflow identifies the latest `preview`
|
||||
release and promotes it to `stable`. This becomes the new `latest` version
|
||||
on npm.
|
||||
2. **Promotes nightly to preview:** The latest `nightly` release is then
|
||||
2. **Promotes Nightly to Preview:** The latest `nightly` release is then
|
||||
promoted to become the new `preview` version.
|
||||
3. **Prepares for next nightly:** A pull request is automatically created and
|
||||
3. **Prepares for next Nightly:** A pull request is automatically created and
|
||||
merged to bump the version in `main` in preparation for the next nightly
|
||||
release.
|
||||
|
||||
This process ensures a consistent and reliable release cadence with minimal
|
||||
manual intervention.
|
||||
|
||||
### Source of truth for versioning
|
||||
### Source of Truth for Versioning
|
||||
|
||||
To ensure the highest reliability, the release promotion process uses the **NPM
|
||||
registry as the single source of truth** for determining the current version of
|
||||
@@ -92,16 +92,16 @@ each release channel (`stable`, `preview`, and `nightly`).
|
||||
1. **Fetch from NPM:** The workflow begins by querying NPM's `dist-tags`
|
||||
(`latest`, `preview`, `nightly`) to get the exact version strings for the
|
||||
packages currently available to users.
|
||||
2. **Cross-check for integrity:** For each version retrieved from NPM, the
|
||||
2. **Cross-Check for Integrity:** For each version retrieved from NPM, the
|
||||
workflow performs a critical integrity check:
|
||||
- It verifies that a corresponding **git tag** exists in the repository.
|
||||
- It verifies that a corresponding **GitHub release** has been created.
|
||||
3. **Halt on discrepancy:** If either the git tag or the GitHub Release is
|
||||
- It verifies that a corresponding **GitHub Release** has been created.
|
||||
3. **Halt on Discrepancy:** If either the git tag or the GitHub Release is
|
||||
missing for a version listed on NPM, the workflow will immediately fail.
|
||||
This strict check prevents promotions from a broken or incomplete previous
|
||||
release and alerts the on-call engineer to a release state inconsistency
|
||||
that must be manually resolved.
|
||||
4. **Calculate next version:** Only after these checks pass does the workflow
|
||||
4. **Calculate Next Version:** Only after these checks pass does the workflow
|
||||
proceed to calculate the next semantic version based on the trusted version
|
||||
numbers retrieved from NPM.
|
||||
|
||||
@@ -109,14 +109,14 @@ This NPM-first approach, backed by integrity checks, makes the release process
|
||||
highly robust and prevents the kinds of versioning discrepancies that can arise
|
||||
from relying solely on git history or API outputs.
|
||||
|
||||
## Manual releases
|
||||
## Manual Releases
|
||||
|
||||
For situations requiring a release outside of the regular nightly and weekly
|
||||
promotion schedule, and NOT already covered by patching process, you can use the
|
||||
`Release: Manual` workflow. This workflow provides a direct way to publish a
|
||||
specific version from any branch, tag, or commit SHA.
|
||||
|
||||
### How to create a manual release
|
||||
### How to Create a Manual Release
|
||||
|
||||
1. Navigate to the **Actions** tab of the repository.
|
||||
2. Select the **Release: Manual** workflow from the list.
|
||||
@@ -144,7 +144,7 @@ The workflow will then proceed to test (if not skipped), build, and publish the
|
||||
release. If the workflow fails during a non-dry run, it will automatically
|
||||
create a GitHub issue with the failure details.
|
||||
|
||||
## Rollback/rollforward
|
||||
## Rollback/Rollforward
|
||||
|
||||
In the event that a release has a critical regression, you can quickly roll back
|
||||
to a previous stable version or roll forward to a new patch by changing the npm
|
||||
@@ -154,7 +154,7 @@ way to do this.
|
||||
This is the preferred method for both rollbacks and rollforwards, as it does not
|
||||
require a full release cycle.
|
||||
|
||||
### How to change a release tag
|
||||
### How to Change a Release Tag
|
||||
|
||||
1. Navigate to the **Actions** tab of the repository.
|
||||
2. Select the **Release: Change Tags** workflow from the list.
|
||||
@@ -181,13 +181,13 @@ channel to the specified version.
|
||||
If a critical bug that is already fixed on `main` needs to be patched on a
|
||||
`stable` or `preview` release, the process is now highly automated.
|
||||
|
||||
### How to patch
|
||||
### How to Patch
|
||||
|
||||
#### 1. Create the patch pull request
|
||||
#### 1. Create the Patch Pull Request
|
||||
|
||||
There are two ways to create a patch pull request:
|
||||
|
||||
**Option A: From a GitHub comment (recommended)**
|
||||
**Option A: From a GitHub Comment (Recommended)**
|
||||
|
||||
After a pull request containing the fix has been merged, a maintainer can add a
|
||||
comment on that same PR with the following format:
|
||||
@@ -212,7 +212,7 @@ The `Release: Patch from Comment` workflow will automatically find the merge
|
||||
commit SHA and trigger the `Release: Patch (1) Create PR` workflow. If the PR is
|
||||
not yet merged, it will post a comment indicating the failure.
|
||||
|
||||
**Option B: Manually triggering the workflow**
|
||||
**Option B: Manually Triggering the Workflow**
|
||||
|
||||
Navigate to the **Actions** tab and run the **Release: Patch (1) Create PR**
|
||||
workflow.
|
||||
@@ -229,17 +229,17 @@ This workflow will automatically:
|
||||
4. Cherry-pick your specified commit into the hotfix branch.
|
||||
5. Create a pull request from the hotfix branch back to the release branch.
|
||||
|
||||
#### 2. Review and merge
|
||||
#### 2. Review and Merge
|
||||
|
||||
Review the automatically created pull request(s) to ensure the cherry-pick was
|
||||
successful and the changes are correct. Once approved, merge the pull request.
|
||||
|
||||
**Security note:** The `release/*` branches are protected by branch protection
|
||||
**Security Note:** The `release/*` branches are protected by branch protection
|
||||
rules. A pull request to one of these branches requires at least one review from
|
||||
a code owner before it can be merged. This ensures that no unauthorized code is
|
||||
released.
|
||||
|
||||
#### 2.5. Adding multiple commits to a hotfix (advanced)
|
||||
#### 2.5. Adding Multiple Commits to a Hotfix (Advanced)
|
||||
|
||||
If you need to include multiple fixes in a single patch release, you can add
|
||||
additional commits to the hotfix branch after the initial patch PR has been
|
||||
@@ -280,7 +280,7 @@ 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.
|
||||
|
||||
#### 3. Automatic release
|
||||
#### 3. Automatic Release
|
||||
|
||||
Upon merging the pull request, the `Release: Patch (2) Trigger` workflow is
|
||||
automatically triggered. It will then start the `Release: Patch (3) Release`
|
||||
@@ -293,21 +293,21 @@ workflow, which will:
|
||||
This fully automated process ensures that patches are created and released
|
||||
consistently and reliably.
|
||||
|
||||
#### Troubleshooting: Older branch workflows
|
||||
#### 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.
|
||||
|
||||
**Root cause**: When a PR is merged, GitHub Actions runs the workflow definition
|
||||
**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
|
||||
release branch). If the hotfix branch was created from an older release branch
|
||||
that predates workflow improvements, it will use the old workflow logic.
|
||||
|
||||
**Solutions**:
|
||||
|
||||
**Option 1: Manual trigger (quick fix)** Manually trigger the updated workflow
|
||||
**Option 1: Manual Trigger (Quick Fix)** Manually trigger the updated workflow
|
||||
from the branch with the latest workflow code:
|
||||
|
||||
```bash
|
||||
@@ -337,7 +337,7 @@ gh workflow run release-patch-2-trigger.yml --ref main \
|
||||
the latest workflow improvements (usually `main`, but could be a feature branch
|
||||
if testing updates).
|
||||
|
||||
**Option 2: Update the hotfix branch** Merge the latest main branch into your
|
||||
**Option 2: Update the Hotfix Branch** Merge the latest main branch into your
|
||||
hotfix branch to get the updated workflows:
|
||||
|
||||
```bash
|
||||
@@ -348,7 +348,7 @@ git push
|
||||
|
||||
Then close and reopen the PR to retrigger the workflow with the updated version.
|
||||
|
||||
**Option 3: Direct release trigger** Skip the trigger workflow entirely and
|
||||
**Option 3: Direct Release Trigger** Skip the trigger workflow entirely and
|
||||
directly run the release workflow:
|
||||
|
||||
```bash
|
||||
@@ -367,7 +367,7 @@ We also run a Google cloud build called
|
||||
docker to match your release. This will also be moved to GH and combined with
|
||||
the main release file once service account permissions are sorted out.
|
||||
|
||||
## Release validation
|
||||
## Release Validation
|
||||
|
||||
After pushing a new release smoke testing should be performed to ensure that the
|
||||
packages are working as expected. This can be done by installing the packages
|
||||
@@ -384,7 +384,7 @@ correctly.
|
||||
is recommended to ensure that the packages are working as expected. We'll
|
||||
codify this more in the future.
|
||||
|
||||
## Local testing and validation: Changes to the packaging and publishing process
|
||||
## Local Testing and Validation: Changes to the Packaging and Publishing Process
|
||||
|
||||
If you need to test the release process without actually publishing to NPM or
|
||||
creating a public GitHub release, you can trigger the workflow manually from the
|
||||
@@ -428,7 +428,7 @@ tarballs will be created in the root of each package's directory (e.g.,
|
||||
By performing a dry run, you can be confident that your changes to the packaging
|
||||
process are correct and that the packages will be published successfully.
|
||||
|
||||
## Release deep dive
|
||||
## Release Deep Dive
|
||||
|
||||
The release process creates two distinct types of artifacts for different
|
||||
distribution channels: standard packages for the NPM registry and a single,
|
||||
@@ -436,14 +436,14 @@ self-contained executable for GitHub Releases.
|
||||
|
||||
Here are the key stages:
|
||||
|
||||
**Stage 1: Pre-release sanity checks and versioning**
|
||||
**Stage 1: Pre-Release Sanity Checks and Versioning**
|
||||
|
||||
- **What happens:** Before any files are moved, the process ensures the project
|
||||
is in a good state. This involves running tests, linting, and type-checking
|
||||
(`npm run preflight`). The version number in the root `package.json` and
|
||||
`packages/cli/package.json` is updated to the new release version.
|
||||
|
||||
**Stage 2: Building the source code for NPM**
|
||||
**Stage 2: Building the Source Code for NPM**
|
||||
|
||||
- **What happens:** The TypeScript source code in `packages/core/src` and
|
||||
`packages/cli/src` is compiled into standard JavaScript.
|
||||
@@ -454,7 +454,7 @@ Here are the key stages:
|
||||
into plain JavaScript that can be run by Node.js. The `core` package is built
|
||||
first as the `cli` package depends on it.
|
||||
|
||||
**Stage 3: Publishing standard packages to NPM**
|
||||
**Stage 3: Publishing Standard Packages to NPM**
|
||||
|
||||
- **What happens:** The `npm publish` command is run for the
|
||||
`@google/gemini-cli-core` and `@google/gemini-cli` packages.
|
||||
@@ -463,12 +463,12 @@ Here are the key stages:
|
||||
`npm` will handle installing the `@google/gemini-cli-core` dependency
|
||||
automatically. The code in these packages is not bundled into a single file.
|
||||
|
||||
**Stage 4: Assembling and creating the GitHub release asset**
|
||||
**Stage 4: Assembling and Creating the GitHub Release Asset**
|
||||
|
||||
This stage happens _after_ the NPM publish and creates the single-file
|
||||
executable that enables `npx` usage directly from the GitHub repository.
|
||||
|
||||
1. **The JavaScript bundle is created:**
|
||||
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.,
|
||||
@@ -479,7 +479,7 @@ executable that enables `npx` usage directly from the GitHub repository.
|
||||
run the CLI without a full `npm install`, as all dependencies (including
|
||||
the `core` package) are included directly.
|
||||
|
||||
2. **The `bundle` directory is assembled:**
|
||||
2. **The `bundle` Directory is Assembled:**
|
||||
- **What happens:** A temporary `bundle` folder is created at the project
|
||||
root. The single `gemini.js` executable is placed inside it, along with
|
||||
other essential files.
|
||||
@@ -491,7 +491,7 @@ executable that enables `npx` usage directly from the GitHub repository.
|
||||
- **Why:** This creates a clean, self-contained directory with everything
|
||||
needed to run the CLI and understand its license and usage.
|
||||
|
||||
3. **The GitHub release is created:**
|
||||
3. **The GitHub Release is Created:**
|
||||
- **What happens:** The contents of the `bundle` directory, including the
|
||||
`gemini.js` executable, are attached as assets to a new GitHub Release.
|
||||
- **Why:** This makes the single-file version of the CLI available for
|
||||
@@ -499,12 +499,12 @@ executable that enables `npx` usage directly from the GitHub repository.
|
||||
`npx https://github.com/google-gemini/gemini-cli` command, which downloads
|
||||
and runs this specific bundled asset.
|
||||
|
||||
**Summary of artifacts**
|
||||
**Summary of Artifacts**
|
||||
|
||||
- **NPM:** Publishes standard, un-bundled Node.js packages. The primary artifact
|
||||
is the code in `packages/cli/dist`, which depends on
|
||||
`@google/gemini-cli-core`.
|
||||
- **GitHub release:** Publishes a single, bundled `gemini.js` file that contains
|
||||
- **GitHub Release:** Publishes a single, bundled `gemini.js` file that contains
|
||||
all dependencies, for easy execution via `npx`.
|
||||
|
||||
This dual-artifact process ensures that both traditional `npm` users and those
|
||||
|
||||
+21
-25
@@ -7,20 +7,20 @@
|
||||
"slug": "docs"
|
||||
},
|
||||
{
|
||||
"label": "Architecture overview",
|
||||
"label": "Architecture Overview",
|
||||
"slug": "docs/architecture"
|
||||
},
|
||||
{
|
||||
"label": "Contribution guide",
|
||||
"label": "Contribution Guide",
|
||||
"slug": "docs/contributing"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Get started",
|
||||
"label": "Get Started",
|
||||
"items": [
|
||||
{
|
||||
"label": "Gemini CLI quickstart",
|
||||
"label": "Gemini CLI Quickstart",
|
||||
"slug": "docs/get-started"
|
||||
},
|
||||
{
|
||||
@@ -61,7 +61,7 @@
|
||||
"slug": "docs/cli/checkpointing"
|
||||
},
|
||||
{
|
||||
"label": "Custom commands",
|
||||
"label": "Custom Commands",
|
||||
"slug": "docs/cli/custom-commands"
|
||||
},
|
||||
{
|
||||
@@ -69,25 +69,21 @@
|
||||
"slug": "docs/cli/enterprise"
|
||||
},
|
||||
{
|
||||
"label": "Headless mode",
|
||||
"label": "Headless Mode",
|
||||
"slug": "docs/cli/headless"
|
||||
},
|
||||
{
|
||||
"label": "Keyboard shortcuts",
|
||||
"label": "Keyboard Shortcuts",
|
||||
"slug": "docs/cli/keyboard-shortcuts"
|
||||
},
|
||||
{
|
||||
"label": "Model selection",
|
||||
"label": "Model Selection",
|
||||
"slug": "docs/cli/model"
|
||||
},
|
||||
{
|
||||
"label": "Sandbox",
|
||||
"slug": "docs/cli/sandbox"
|
||||
},
|
||||
{
|
||||
"label": "Session Management",
|
||||
"slug": "docs/cli/session-management"
|
||||
},
|
||||
{
|
||||
"label": "Settings",
|
||||
"slug": "docs/cli/settings"
|
||||
@@ -101,7 +97,7 @@
|
||||
"slug": "docs/cli/themes"
|
||||
},
|
||||
{
|
||||
"label": "Token caching",
|
||||
"label": "Token Caching",
|
||||
"slug": "docs/cli/token-caching"
|
||||
},
|
||||
{
|
||||
@@ -147,7 +143,7 @@
|
||||
"slug": "docs/tools"
|
||||
},
|
||||
{
|
||||
"label": "File system",
|
||||
"label": "File System",
|
||||
"slug": "docs/tools/file-system"
|
||||
},
|
||||
{
|
||||
@@ -155,11 +151,11 @@
|
||||
"slug": "docs/tools/shell"
|
||||
},
|
||||
{
|
||||
"label": "Web fetch",
|
||||
"label": "Web Fetch",
|
||||
"slug": "docs/tools/web-fetch"
|
||||
},
|
||||
{
|
||||
"label": "Web search",
|
||||
"label": "Web Search",
|
||||
"slug": "docs/tools/web-search"
|
||||
},
|
||||
{
|
||||
@@ -171,7 +167,7 @@
|
||||
"slug": "docs/tools/todos"
|
||||
},
|
||||
{
|
||||
"label": "MCP servers",
|
||||
"label": "MCP Servers",
|
||||
"slug": "docs/tools/mcp-server"
|
||||
}
|
||||
]
|
||||
@@ -184,24 +180,24 @@
|
||||
"slug": "docs/extensions"
|
||||
},
|
||||
{
|
||||
"label": "Get started with extensions",
|
||||
"label": "Get Started with Extensions",
|
||||
"slug": "docs/extensions/getting-started-extensions"
|
||||
},
|
||||
{
|
||||
"label": "Extension releasing",
|
||||
"label": "Extension Releasing",
|
||||
"slug": "docs/extensions/extension-releasing"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "IDE integration",
|
||||
"label": "IDE Integration",
|
||||
"items": [
|
||||
{
|
||||
"label": "Introduction",
|
||||
"slug": "docs/ide-integration"
|
||||
},
|
||||
{
|
||||
"label": "IDE companion spec",
|
||||
"label": "IDE Companion Spec",
|
||||
"slug": "docs/ide-integration/ide-companion-spec"
|
||||
}
|
||||
]
|
||||
@@ -222,11 +218,11 @@
|
||||
"slug": "docs/changelogs"
|
||||
},
|
||||
{
|
||||
"label": "Integration tests",
|
||||
"label": "Integration Tests",
|
||||
"slug": "docs/integration-tests"
|
||||
},
|
||||
{
|
||||
"label": "Issue and PR automation",
|
||||
"label": "Issue and PR Automation",
|
||||
"slug": "docs/issue-and-pr-automation"
|
||||
}
|
||||
]
|
||||
@@ -243,11 +239,11 @@
|
||||
"slug": "docs/troubleshooting"
|
||||
},
|
||||
{
|
||||
"label": "Quota and pricing",
|
||||
"label": "Quota and Pricing",
|
||||
"slug": "docs/quota-and-pricing"
|
||||
},
|
||||
{
|
||||
"label": "Terms of service",
|
||||
"label": "Terms of Service",
|
||||
"slug": "docs/tos-privacy"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -184,7 +184,7 @@ context around the `old_string` to ensure it modifies the correct location.
|
||||
- If `old_string` is provided, it reads the `file_path` and attempts to find
|
||||
exactly one occurrence of `old_string`.
|
||||
- If one occurrence is found, it replaces it with `new_string`.
|
||||
- **Enhanced reliability (multi-stage edit correction):** To significantly
|
||||
- **Enhanced Reliability (Multi-Stage Edit Correction):** To significantly
|
||||
improve the success rate of edits, especially when the model-provided
|
||||
`old_string` might not be perfectly precise, the tool incorporates a
|
||||
multi-stage edit correction mechanism.
|
||||
|
||||
+69
-75
@@ -23,7 +23,7 @@ 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.
|
||||
|
||||
## Core integration architecture
|
||||
## Core Integration Architecture
|
||||
|
||||
The Gemini CLI integrates with MCP servers through a sophisticated discovery and
|
||||
execution system built into the core package (`packages/core/src/tools/`):
|
||||
@@ -41,7 +41,7 @@ The discovery process is orchestrated by `discoverMcpTools()`, which:
|
||||
API
|
||||
5. **Registers tools** in the global tool registry with conflict resolution
|
||||
|
||||
### Execution layer (`mcp-tool.ts`)
|
||||
### Execution Layer (`mcp-tool.ts`)
|
||||
|
||||
Each discovered MCP tool is wrapped in a `DiscoveredMCPTool` instance that:
|
||||
|
||||
@@ -51,7 +51,7 @@ Each discovered MCP tool is wrapped in a `DiscoveredMCPTool` instance that:
|
||||
- **Processes responses** for both the LLM context and user display
|
||||
- **Maintains connection state** and handles timeouts
|
||||
|
||||
### Transport mechanisms
|
||||
### Transport Mechanisms
|
||||
|
||||
The Gemini CLI supports three MCP transport types:
|
||||
|
||||
@@ -72,7 +72,7 @@ through the top-level `mcpServers` object for specific server definitions, and
|
||||
through the `mcp` object for global settings that control server discovery and
|
||||
execution.
|
||||
|
||||
#### Global MCP settings (`mcp`)
|
||||
#### Global MCP Settings (`mcp`)
|
||||
|
||||
The `mcp` object in your `settings.json` allows you to define global rules for
|
||||
all MCP servers.
|
||||
@@ -95,12 +95,12 @@ all MCP servers.
|
||||
}
|
||||
```
|
||||
|
||||
#### Server-specific configuration (`mcpServers`)
|
||||
#### Server-Specific Configuration (`mcpServers`)
|
||||
|
||||
The `mcpServers` object is where you define each individual MCP server you want
|
||||
the CLI to connect to.
|
||||
|
||||
### Configuration structure
|
||||
### Configuration Structure
|
||||
|
||||
Add an `mcpServers` object to your `settings.json` file:
|
||||
|
||||
@@ -121,7 +121,7 @@ Add an `mcpServers` object to your `settings.json` file:
|
||||
}
|
||||
```
|
||||
|
||||
### Configuration properties
|
||||
### Configuration Properties
|
||||
|
||||
Each server configuration supports the following properties:
|
||||
|
||||
@@ -157,13 +157,13 @@ Each server configuration supports the following properties:
|
||||
Service Account to impersonate. Used with
|
||||
`authProviderType: 'service_account_impersonation'`.
|
||||
|
||||
### OAuth support for remote MCP servers
|
||||
### 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
|
||||
authentication.
|
||||
|
||||
#### Automatic OAuth discovery
|
||||
#### Automatic OAuth Discovery
|
||||
|
||||
For servers that support OAuth discovery, you can omit the OAuth configuration
|
||||
and let the CLI discover it automatically:
|
||||
@@ -185,7 +185,7 @@ The CLI will automatically:
|
||||
- Perform dynamic client registration if supported
|
||||
- Handle the OAuth flow and token management
|
||||
|
||||
#### Authentication flow
|
||||
#### Authentication Flow
|
||||
|
||||
When connecting to an OAuth-enabled server:
|
||||
|
||||
@@ -196,7 +196,7 @@ When connecting to an OAuth-enabled server:
|
||||
5. **Tokens are stored** securely for future use
|
||||
6. **Connection retry** succeeds with valid tokens
|
||||
|
||||
#### Browser redirect requirements
|
||||
#### Browser Redirect Requirements
|
||||
|
||||
**Important:** OAuth authentication requires that your local machine can:
|
||||
|
||||
@@ -209,7 +209,7 @@ This feature will not work in:
|
||||
- Remote SSH sessions without X11 forwarding
|
||||
- Containerized environments without browser support
|
||||
|
||||
#### Managing OAuth authentication
|
||||
#### Managing OAuth Authentication
|
||||
|
||||
Use the `/mcp auth` command to manage OAuth authentication:
|
||||
|
||||
@@ -224,7 +224,7 @@ Use the `/mcp auth` command to manage OAuth authentication:
|
||||
/mcp auth serverName
|
||||
```
|
||||
|
||||
#### OAuth configuration properties
|
||||
#### OAuth Configuration Properties
|
||||
|
||||
- **`enabled`** (boolean): Enable OAuth for this server
|
||||
- **`clientId`** (string): OAuth client identifier (optional with dynamic
|
||||
@@ -239,7 +239,7 @@ Use the `/mcp auth` command to manage OAuth authentication:
|
||||
- **`tokenParamName`** (string): Query parameter name for tokens in SSE URLs
|
||||
- **`audiences`** (string[]): Audiences the token is valid for
|
||||
|
||||
#### Token management
|
||||
#### Token Management
|
||||
|
||||
OAuth tokens are automatically:
|
||||
|
||||
@@ -248,7 +248,7 @@ OAuth tokens are automatically:
|
||||
- **Validated** before each connection attempt
|
||||
- **Cleaned up** when invalid or expired
|
||||
|
||||
#### Authentication provider type
|
||||
#### Authentication Provider Type
|
||||
|
||||
You can specify the authentication provider type using the `authProviderType`
|
||||
property:
|
||||
@@ -265,7 +265,7 @@ property:
|
||||
accessing IAP-protected services (this was specifically designed for Cloud
|
||||
Run services).
|
||||
|
||||
#### Google credentials
|
||||
#### Google Credentials
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -281,7 +281,7 @@ property:
|
||||
}
|
||||
```
|
||||
|
||||
#### Service account impersonation
|
||||
#### Service Account Impersonation
|
||||
|
||||
To authenticate with a server using Service Account Impersonation, you must set
|
||||
the `authProviderType` to `service_account_impersonation` and provide the
|
||||
@@ -296,7 +296,7 @@ The CLI will use your local Application Default Credentials (ADC) to generate an
|
||||
OIDC ID token for the specified service account and audience. This token will
|
||||
then be used to authenticate with the MCP server.
|
||||
|
||||
#### Setup instructions
|
||||
#### Setup Instructions
|
||||
|
||||
1. **[Create](https://cloud.google.com/iap/docs/oauth-client-creation) or use an
|
||||
existing OAuth 2.0 client ID.** To use an existing OAuth 2.0 client ID,
|
||||
@@ -318,9 +318,9 @@ then be used to authenticate with the MCP server.
|
||||
6. **[Enable](https://console.cloud.google.com/apis/library/iamcredentials.googleapis.com)
|
||||
the IAM Credentials API** for your project.
|
||||
|
||||
### Example configurations
|
||||
### Example Configurations
|
||||
|
||||
#### Python MCP server (stdio)
|
||||
#### Python MCP Server (Stdio)
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -339,7 +339,7 @@ then be used to authenticate with the MCP server.
|
||||
}
|
||||
```
|
||||
|
||||
#### Node.js MCP server (stdio)
|
||||
#### Node.js MCP Server (Stdio)
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -354,7 +354,7 @@ then be used to authenticate with the MCP server.
|
||||
}
|
||||
```
|
||||
|
||||
#### Docker-based MCP server
|
||||
#### Docker-based MCP Server
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -379,7 +379,7 @@ then be used to authenticate with the MCP server.
|
||||
}
|
||||
```
|
||||
|
||||
#### HTTP-based MCP server
|
||||
#### HTTP-based MCP Server
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -392,7 +392,7 @@ then be used to authenticate with the MCP server.
|
||||
}
|
||||
```
|
||||
|
||||
#### HTTP-based MCP Server with custom headers
|
||||
#### HTTP-based MCP Server with Custom Headers
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -410,7 +410,7 @@ then be used to authenticate with the MCP server.
|
||||
}
|
||||
```
|
||||
|
||||
#### MCP server with tool filtering
|
||||
#### MCP Server with Tool Filtering
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -426,7 +426,7 @@ then be used to authenticate with the MCP server.
|
||||
}
|
||||
```
|
||||
|
||||
### SSE MCP server with SA impersonation
|
||||
### SSE MCP Server with SA Impersonation
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -441,12 +441,12 @@ then be used to authenticate with the MCP server.
|
||||
}
|
||||
```
|
||||
|
||||
## Discovery process deep dive
|
||||
## Discovery Process Deep Dive
|
||||
|
||||
When the Gemini CLI starts, it performs MCP server discovery through the
|
||||
following detailed process:
|
||||
|
||||
### 1. Server iteration and connection
|
||||
### 1. Server Iteration and Connection
|
||||
|
||||
For each configured server in `mcpServers`:
|
||||
|
||||
@@ -460,7 +460,7 @@ For each configured server in `mcpServers`:
|
||||
4. **Error handling:** Connection failures are logged and the server status is
|
||||
set to `DISCONNECTED`
|
||||
|
||||
### 2. Tool discovery
|
||||
### 2. Tool Discovery
|
||||
|
||||
Upon successful connection:
|
||||
|
||||
@@ -475,7 +475,7 @@ Upon successful connection:
|
||||
- Names longer than 63 characters are truncated with middle replacement
|
||||
(`___`)
|
||||
|
||||
### 3. Conflict resolution
|
||||
### 3. Conflict Resolution
|
||||
|
||||
When multiple servers expose tools with the same name:
|
||||
|
||||
@@ -486,7 +486,7 @@ When multiple servers expose tools with the same name:
|
||||
3. **Registry tracking:** The tool registry maintains mappings between server
|
||||
names and their tools
|
||||
|
||||
### 4. Schema processing
|
||||
### 4. Schema Processing
|
||||
|
||||
Tool parameter schemas undergo sanitization for Gemini API compatibility:
|
||||
|
||||
@@ -496,7 +496,7 @@ Tool parameter schemas undergo sanitization for Gemini API compatibility:
|
||||
compatibility)
|
||||
- **Recursive processing** applies to nested schemas
|
||||
|
||||
### 5. Connection management
|
||||
### 5. Connection Management
|
||||
|
||||
After discovery:
|
||||
|
||||
@@ -507,23 +507,23 @@ After discovery:
|
||||
- **Status updates:** Final server statuses are set to `CONNECTED` or
|
||||
`DISCONNECTED`
|
||||
|
||||
## Tool execution flow
|
||||
## Tool Execution Flow
|
||||
|
||||
When the Gemini model decides to use an MCP tool, the following execution flow
|
||||
occurs:
|
||||
|
||||
### 1. Tool invocation
|
||||
### 1. Tool Invocation
|
||||
|
||||
The model generates a `FunctionCall` with:
|
||||
|
||||
- **Tool name:** The registered name (potentially prefixed)
|
||||
- **Arguments:** JSON object matching the tool's parameter schema
|
||||
|
||||
### 2. Confirmation process
|
||||
### 2. Confirmation Process
|
||||
|
||||
Each `DiscoveredMCPTool` implements sophisticated confirmation logic:
|
||||
|
||||
#### Trust-based bypass
|
||||
#### Trust-based Bypass
|
||||
|
||||
```typescript
|
||||
if (this.trust) {
|
||||
@@ -531,14 +531,14 @@ if (this.trust) {
|
||||
}
|
||||
```
|
||||
|
||||
#### Dynamic allow-listing
|
||||
#### Dynamic Allow-listing
|
||||
|
||||
The system maintains internal allow-lists for:
|
||||
|
||||
- **Server-level:** `serverName` → All tools from this server are trusted
|
||||
- **Tool-level:** `serverName.toolName` → This specific tool is trusted
|
||||
|
||||
#### User choice handling
|
||||
#### User Choice Handling
|
||||
|
||||
When confirmation is required, users can choose:
|
||||
|
||||
@@ -566,7 +566,7 @@ Upon confirmation (or trust bypass):
|
||||
3. **Response processing:** Results are formatted for both LLM context and user
|
||||
display
|
||||
|
||||
### 4. Response handling
|
||||
### 4. Response Handling
|
||||
|
||||
The execution result contains:
|
||||
|
||||
@@ -576,7 +576,7 @@ The execution result contains:
|
||||
|
||||
## How to interact with your MCP server
|
||||
|
||||
### Using the `/mcp` command
|
||||
### Using the `/mcp` Command
|
||||
|
||||
The `/mcp` command provides comprehensive information about your MCP server
|
||||
setup:
|
||||
@@ -593,7 +593,7 @@ This displays:
|
||||
- **Available tools:** List of tools from each server with descriptions
|
||||
- **Discovery state:** Overall discovery process status
|
||||
|
||||
### Example `/mcp` output
|
||||
### Example `/mcp` Output
|
||||
|
||||
```
|
||||
MCP Servers Status:
|
||||
@@ -615,7 +615,7 @@ MCP Servers Status:
|
||||
Discovery State: COMPLETED
|
||||
```
|
||||
|
||||
### Tool usage
|
||||
### Tool Usage
|
||||
|
||||
Once discovered, MCP tools are available to the Gemini model like built-in
|
||||
tools. The model will automatically:
|
||||
@@ -625,27 +625,27 @@ tools. The model will automatically:
|
||||
3. **Execute tools** with proper parameters
|
||||
4. **Display results** in a user-friendly format
|
||||
|
||||
## Status monitoring and troubleshooting
|
||||
## Status Monitoring and Troubleshooting
|
||||
|
||||
### Connection states
|
||||
### Connection States
|
||||
|
||||
The MCP integration tracks several states:
|
||||
|
||||
#### Server status (`MCPServerStatus`)
|
||||
#### Server Status (`MCPServerStatus`)
|
||||
|
||||
- **`DISCONNECTED`:** Server is not connected or has errors
|
||||
- **`CONNECTING`:** Connection attempt in progress
|
||||
- **`CONNECTED`:** Server is connected and ready
|
||||
|
||||
#### Discovery state (`MCPDiscoveryState`)
|
||||
#### Discovery State (`MCPDiscoveryState`)
|
||||
|
||||
- **`NOT_STARTED`:** Discovery hasn't begun
|
||||
- **`IN_PROGRESS`:** Currently discovering servers
|
||||
- **`COMPLETED`:** Discovery finished (with or without errors)
|
||||
|
||||
### Common issues and solutions
|
||||
### Common Issues and Solutions
|
||||
|
||||
#### Server won't connect
|
||||
#### Server Won't Connect
|
||||
|
||||
**Symptoms:** Server shows `DISCONNECTED` status
|
||||
|
||||
@@ -657,7 +657,7 @@ The MCP integration tracks several states:
|
||||
4. **Review logs:** Look for error messages in the CLI output
|
||||
5. **Verify permissions:** Ensure the CLI can execute the server command
|
||||
|
||||
#### No tools discovered
|
||||
#### No Tools Discovered
|
||||
|
||||
**Symptoms:** Server connects but no tools are available
|
||||
|
||||
@@ -669,7 +669,7 @@ The MCP integration tracks several states:
|
||||
3. **Review server logs:** Check stderr output for server-side errors
|
||||
4. **Test tool listing:** Manually test your server's tool discovery endpoint
|
||||
|
||||
#### Tools not executing
|
||||
#### Tools Not Executing
|
||||
|
||||
**Symptoms:** Tools are discovered but fail during execution
|
||||
|
||||
@@ -680,7 +680,7 @@ The MCP integration tracks several states:
|
||||
3. **Error handling:** Check if your tool is throwing unhandled exceptions
|
||||
4. **Timeout issues:** Consider increasing the `timeout` setting
|
||||
|
||||
#### Sandbox compatibility
|
||||
#### Sandbox Compatibility
|
||||
|
||||
**Symptoms:** MCP servers fail when sandboxing is enabled
|
||||
|
||||
@@ -693,7 +693,7 @@ The MCP integration tracks several states:
|
||||
4. **Environment variables:** Verify required environment variables are passed
|
||||
through
|
||||
|
||||
### Debugging tips
|
||||
### Debugging Tips
|
||||
|
||||
1. **Enable debug mode:** Run the CLI with `--debug` for verbose output
|
||||
2. **Check stderr:** MCP server stderr is captured and logged (INFO messages
|
||||
@@ -703,9 +703,9 @@ The MCP integration tracks several states:
|
||||
functionality
|
||||
5. **Use `/mcp` frequently:** Monitor server status during development
|
||||
|
||||
## Important notes
|
||||
## Important Notes
|
||||
|
||||
### Security sonsiderations
|
||||
### Security Considerations
|
||||
|
||||
- **Trust settings:** The `trust` option bypasses all confirmation dialogs. Use
|
||||
cautiously and only for servers you completely control
|
||||
@@ -716,7 +716,7 @@ The MCP integration tracks several states:
|
||||
- **Private data:** Using broadly scoped personal access tokens can lead to
|
||||
information leakage between repositories
|
||||
|
||||
### Performance and resource management
|
||||
### Performance and Resource Management
|
||||
|
||||
- **Connection persistence:** The CLI maintains persistent connections to
|
||||
servers that successfully register tools
|
||||
@@ -727,7 +727,7 @@ The MCP integration tracks several states:
|
||||
- **Resource monitoring:** MCP servers run as separate processes and consume
|
||||
system resources
|
||||
|
||||
### Schema compatibility
|
||||
### Schema Compatibility
|
||||
|
||||
- **Property stripping:** The system automatically removes certain schema
|
||||
properties (`$schema`, `additionalProperties`) for Gemini API compatibility
|
||||
@@ -740,7 +740,7 @@ This comprehensive integration makes MCP servers a powerful way to extend the
|
||||
Gemini CLI's capabilities while maintaining security, reliability, and ease of
|
||||
use.
|
||||
|
||||
## Returning rich content from tools
|
||||
## Returning Rich Content from Tools
|
||||
|
||||
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
|
||||
@@ -751,7 +751,7 @@ All data returned from the tool is processed and sent to the model as context
|
||||
for its next generation, enabling it to reason about or summarize the provided
|
||||
information.
|
||||
|
||||
### How it works
|
||||
### How It Works
|
||||
|
||||
To return rich content, your tool's response must adhere to the MCP
|
||||
specification for a
|
||||
@@ -769,7 +769,7 @@ supported block types include:
|
||||
- `resource` (embedded content)
|
||||
- `resource_link`
|
||||
|
||||
### Example: Returning text and an image
|
||||
### Example: Returning Text and an Image
|
||||
|
||||
Here is an example of a valid JSON response from an MCP tool that returns both a
|
||||
text description and an image:
|
||||
@@ -805,13 +805,13 @@ When the Gemini CLI receives this response, it will:
|
||||
This enables you to build sophisticated tools that can provide rich, multi-modal
|
||||
context to the Gemini model.
|
||||
|
||||
## MCP prompts as slash commands
|
||||
## 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.
|
||||
|
||||
### Defining prompts on the server
|
||||
### Defining Prompts on the Server
|
||||
|
||||
Here's a small example of a stdio MCP server that defines prompts:
|
||||
|
||||
@@ -862,7 +862,7 @@ This can be included in `settings.json` under `mcpServers` with:
|
||||
}
|
||||
```
|
||||
|
||||
### Invoking prompts
|
||||
### Invoking Prompts
|
||||
|
||||
Once a prompt is discovered, you can invoke it using its name as a slash
|
||||
command. The CLI will automatically handle parsing arguments.
|
||||
@@ -883,7 +883,7 @@ 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.
|
||||
|
||||
## Managing MCP servers with `gemini mcp`
|
||||
## 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
|
||||
@@ -891,7 +891,7 @@ 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`)
|
||||
### Adding a Server (`gemini mcp add`)
|
||||
|
||||
The `add` command configures a new MCP server in your `settings.json`. Based on
|
||||
the scope (`-s, --scope`), it will be added to either the user config
|
||||
@@ -908,7 +908,7 @@ gemini mcp add [options] <name> <commandOrUrl> [args...]
|
||||
`http`/`sse`).
|
||||
- `[args...]`: Optional arguments for a `stdio` command.
|
||||
|
||||
**Options (flags):**
|
||||
**Options (Flags):**
|
||||
|
||||
- `-s, --scope`: Configuration scope (user or project). [default: "project"]
|
||||
- `-t, --transport`: Transport type (stdio, sse, http). [default: "stdio"]
|
||||
@@ -966,7 +966,7 @@ gemini mcp add --transport sse sse-server https://api.example.com/sse/
|
||||
gemini mcp add --transport sse --header "Authorization: Bearer abc123" secure-sse https://api.example.com/sse/
|
||||
```
|
||||
|
||||
### Listing servers (`gemini mcp list`)
|
||||
### Listing Servers (`gemini mcp list`)
|
||||
|
||||
To view all MCP servers currently configured, use the `list` command. It
|
||||
displays each server's name, configuration details, and connection status. This
|
||||
@@ -978,7 +978,7 @@ command has no flags.
|
||||
gemini mcp list
|
||||
```
|
||||
|
||||
**Example output:**
|
||||
**Example Output:**
|
||||
|
||||
```sh
|
||||
✓ stdio-server: command: python3 server.py (stdio) - Connected
|
||||
@@ -986,7 +986,7 @@ gemini mcp list
|
||||
✗ sse-server: https://api.example.com/sse (sse) - Disconnected
|
||||
```
|
||||
|
||||
### Removing a server (`gemini mcp remove`)
|
||||
### Removing a Server (`gemini mcp remove`)
|
||||
|
||||
To delete a server from your configuration, use the `remove` command with the
|
||||
server's name.
|
||||
@@ -997,7 +997,7 @@ server's name.
|
||||
gemini mcp remove <name>
|
||||
```
|
||||
|
||||
**Options (flags):**
|
||||
**Options (Flags):**
|
||||
|
||||
- `-s, --scope`: Configuration scope (user or project). [default: "project"]
|
||||
|
||||
@@ -1009,9 +1009,3 @@ gemini mcp remove my-server
|
||||
|
||||
This will find and delete the "my-server" entry from the `mcpServers` object in
|
||||
the appropriate `settings.json` file based on the scope (`-s, --scope`).
|
||||
|
||||
## Instructions
|
||||
|
||||
Gemini CLI supports
|
||||
[MCP server instructions](https://modelcontextprotocol.io/specification/2025-06-18/schema#initializeresult),
|
||||
which will be appended to the system instructions.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Memory tool (`save_memory`)
|
||||
# Memory Tool (`save_memory`)
|
||||
|
||||
This document describes the `save_memory` tool for the Gemini CLI.
|
||||
|
||||
|
||||
+12
-12
@@ -1,4 +1,4 @@
|
||||
# Shell tool (`run_shell_command`)
|
||||
# Shell Tool (`run_shell_command`)
|
||||
|
||||
This document describes the `run_shell_command` tool for the Gemini CLI.
|
||||
|
||||
@@ -71,7 +71,7 @@ run_shell_command(command="npm run dev &", description="Start development server
|
||||
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.
|
||||
|
||||
### Enabling interactive commands
|
||||
### Enabling Interactive Commands
|
||||
|
||||
To enable interactive commands, you need to set the
|
||||
`tools.shell.enableInteractiveShell` setting to `true`. This will use `node-pty`
|
||||
@@ -91,7 +91,7 @@ implementation, which does not support interactive commands.
|
||||
}
|
||||
```
|
||||
|
||||
### Showing color in output
|
||||
### Showing Color in Output
|
||||
|
||||
To show color in the shell output, you need to set the `tools.shell.showColor`
|
||||
setting to `true`. **Note: This setting only applies when
|
||||
@@ -109,7 +109,7 @@ setting to `true`. **Note: This setting only applies when
|
||||
}
|
||||
```
|
||||
|
||||
### Setting the pager
|
||||
### Setting the Pager
|
||||
|
||||
You can set a custom pager for the shell output by setting the
|
||||
`tools.shell.pager` setting. The default pager is `cat`. **Note: This setting
|
||||
@@ -127,7 +127,7 @@ only applies when `tools.shell.enableInteractiveShell` is enabled.**
|
||||
}
|
||||
```
|
||||
|
||||
## Interactive commands
|
||||
## 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
|
||||
@@ -149,13 +149,13 @@ including complex TUIs, will be rendered correctly.
|
||||
background. The `Background PIDs` field will contain the process ID of the
|
||||
background process.
|
||||
|
||||
## Environment variables
|
||||
## Environment Variables
|
||||
|
||||
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.
|
||||
|
||||
## Command restrictions
|
||||
## Command Restrictions
|
||||
|
||||
You can restrict the commands that can be executed by the `run_shell_command`
|
||||
tool by using the `tools.core` and `tools.exclude` settings in your
|
||||
@@ -174,16 +174,16 @@ configuration file.
|
||||
|
||||
The validation logic is designed to be secure and flexible:
|
||||
|
||||
1. **Command chaining disabled**: The tool automatically splits commands
|
||||
1. **Command Chaining Disabled**: The tool automatically splits commands
|
||||
chained with `&&`, `||`, or `;` and validates each part separately. If any
|
||||
part of the chain is disallowed, the entire command is blocked.
|
||||
2. **Prefix matching**: The tool uses prefix matching. For example, if you
|
||||
2. **Prefix Matching**: The tool uses prefix matching. For example, if you
|
||||
allow `git`, you can run `git status` or `git log`.
|
||||
3. **Blocklist precedence**: The `tools.exclude` list is always checked first.
|
||||
3. **Blocklist Precedence**: The `tools.exclude` list is always checked first.
|
||||
If a command matches a blocked prefix, it will be denied, even if it also
|
||||
matches an allowed prefix in `tools.core`.
|
||||
|
||||
### Command restriction examples
|
||||
### Command Restriction Examples
|
||||
|
||||
**Allow only specific command prefixes**
|
||||
|
||||
@@ -251,7 +251,7 @@ To block all shell commands, add the `run_shell_command` wildcard to
|
||||
- `ls -l`: Blocked
|
||||
- `any other command`: Blocked
|
||||
|
||||
## Security note for `excludeTools`
|
||||
## Security Note for `excludeTools`
|
||||
|
||||
Command-specific restrictions in `excludeTools` for `run_shell_command` are
|
||||
based on simple string matching and can be easily bypassed. This feature is
|
||||
|
||||
+5
-5
@@ -1,4 +1,4 @@
|
||||
# Todo tool (`write_todos`)
|
||||
# Todo Tool (`write_todos`)
|
||||
|
||||
This document describes the `write_todos` tool for the Gemini CLI.
|
||||
|
||||
@@ -24,11 +24,11 @@ alignment where the agent is less likely to lose track of its current goal.
|
||||
The agent uses this tool to break down complex multi-step requests into a clear
|
||||
plan.
|
||||
|
||||
- **Progress tracking:** The agent updates this list as it works, marking tasks
|
||||
- **Progress Tracking:** The agent updates this list as it works, marking tasks
|
||||
as `completed` when done.
|
||||
- **Single socus:** Only one task will be marked `in_progress` at a time,
|
||||
- **Single Focus:** Only one task will be marked `in_progress` at a time,
|
||||
indicating exactly what the agent is currently working on.
|
||||
- **Dynamic updates:** The plan may evolve as the agent discovers new
|
||||
- **Dynamic Updates:** The plan may evolve as the agent discovers new
|
||||
information, leading to new tasks being added or unnecessary ones being
|
||||
cancelled.
|
||||
|
||||
@@ -53,5 +53,5 @@ write_todos({
|
||||
- **Enabling:** This tool is enabled by default. You can disable it in your
|
||||
`settings.json` file by setting `"useWriteTodos": false`.
|
||||
|
||||
- **Intended use:** This tool is primarily used by the agent for complex,
|
||||
- **Intended Use:** This tool is primarily used by the agent for complex,
|
||||
multi-turn tasks. It is generally not used for simple, single-turn questions.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Web fetch tool (`web_fetch`)
|
||||
# Web Fetch Tool (`web_fetch`)
|
||||
|
||||
This document describes the `web_fetch` tool for the Gemini CLI.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Web search tool (`google_web_search`)
|
||||
# Web Search Tool (`google_web_search`)
|
||||
|
||||
This document describes the `google_web_search` tool.
|
||||
|
||||
|
||||
+9
-27
@@ -10,31 +10,13 @@ topics on:
|
||||
|
||||
## Authentication or login errors
|
||||
|
||||
- **Error:
|
||||
`You must be a named user on your organization's Gemini Code Assist Standard edition subscription to use this service. Please contact your administrator to request an entitlement to Gemini Code Assist Standard edition.`**
|
||||
- **Cause:** This error might occur if Gemini CLI detects the
|
||||
`GOOGLE_CLOUD_PROJECT` or `GOOGLE_CLOUD_PROJECT_ID` environment variable is
|
||||
defined. Setting these variables forces an organization subscription check.
|
||||
This might be an issue if you are using an individual Google account not
|
||||
linked to an organizational subscription.
|
||||
|
||||
- **Solution:**
|
||||
- **Individual Users:** Unset the `GOOGLE_CLOUD_PROJECT` and
|
||||
`GOOGLE_CLOUD_PROJECT_ID` environment variables. Check and remove these
|
||||
variables from your shell configuration files (for example, `.bashrc`,
|
||||
`.zshrc`) and any `.env` files. If this doesn't resolve the issue, try
|
||||
using a different Google account.
|
||||
|
||||
- **Organizational Users:** Contact your Google Cloud administrator to be
|
||||
added to your organization's Gemini Code Assist subscription.
|
||||
|
||||
- **Error: `Failed to login. Message: Request contains an invalid argument`**
|
||||
- **Cause:** Users with Google Workspace accounts or Google Cloud accounts
|
||||
associated with their Gmail accounts may not be able to activate the free
|
||||
tier of the Google Code Assist plan.
|
||||
- **Solution:** For Google Cloud accounts, you can work around this by setting
|
||||
`GOOGLE_CLOUD_PROJECT` to your project ID. Alternatively, you can obtain the
|
||||
Gemini API key from
|
||||
- Users with Google Workspace accounts or Google Cloud accounts associated
|
||||
with their Gmail accounts may not be able to activate the free tier of the
|
||||
Google Code Assist plan.
|
||||
- For Google Cloud accounts, you can work around this by setting
|
||||
`GOOGLE_CLOUD_PROJECT` to your project ID.
|
||||
- Alternatively, you can obtain the Gemini API key from
|
||||
[Google AI Studio](http://aistudio.google.com/app/apikey), which also
|
||||
includes a separate free tier.
|
||||
|
||||
@@ -108,7 +90,7 @@ topics on:
|
||||
`advanced.excludedEnvVars` setting in your `settings.json` to exclude fewer
|
||||
variables.
|
||||
|
||||
## Exit codes
|
||||
## Exit Codes
|
||||
|
||||
The Gemini CLI uses specific exit codes to indicate the reason for termination.
|
||||
This is especially useful for scripting and automation.
|
||||
@@ -121,7 +103,7 @@ This is especially useful for scripting and automation.
|
||||
| 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) |
|
||||
|
||||
## Debugging tips
|
||||
## Debugging Tips
|
||||
|
||||
- **CLI debugging:**
|
||||
- Use the `--verbose` flag (if available) with CLI commands for more detailed
|
||||
@@ -147,7 +129,7 @@ This is especially useful for scripting and automation.
|
||||
- Always run `npm run preflight` before committing code. This can catch many
|
||||
common issues related to formatting, linting, and type errors.
|
||||
|
||||
## Existing GitHub issues similar to yours or creating new issues
|
||||
## 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
|
||||
|
||||
+1
-7
@@ -29,6 +29,7 @@ export default tseslint.config(
|
||||
// Global ignores
|
||||
ignores: [
|
||||
'node_modules/*',
|
||||
'.integration-tests/**',
|
||||
'eslint.config.js',
|
||||
'packages/**/dist/**',
|
||||
'bundle/**',
|
||||
@@ -80,11 +81,6 @@ export default tseslint.config(
|
||||
},
|
||||
},
|
||||
languageOptions: {
|
||||
parser: tseslint.parser,
|
||||
parserOptions: {
|
||||
projectService: true,
|
||||
tsconfigRootDir: projectRoot,
|
||||
},
|
||||
globals: {
|
||||
...globals.node,
|
||||
...globals.es2021,
|
||||
@@ -122,8 +118,6 @@ export default tseslint.config(
|
||||
caughtErrorsIgnorePattern: '^_',
|
||||
},
|
||||
],
|
||||
// Prevent async errors from bypassing catch handlers
|
||||
'@typescript-eslint/return-await': ['error', 'in-try-catch'],
|
||||
'import/no-internal-modules': [
|
||||
'error',
|
||||
{
|
||||
|
||||
@@ -13,8 +13,6 @@ import { safeJsonStringify } from '@google/gemini-cli-core/src/utils/safeJsonStr
|
||||
import { env } from 'node:process';
|
||||
import { platform } from 'node:os';
|
||||
|
||||
import stripAnsi from 'strip-ansi';
|
||||
|
||||
const itIf = (condition: boolean) => (condition ? it : it.skip);
|
||||
|
||||
describe('extension reloading', () => {
|
||||
@@ -78,25 +76,15 @@ describe('extension reloading', () => {
|
||||
await run.expectText(
|
||||
'test-extension (v0.0.1) - active (update available)',
|
||||
);
|
||||
// Wait for the UI to settle and retry the command until we see the update
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
|
||||
// Poll for the updated list
|
||||
await rig.pollCommand(
|
||||
() => run.sendKeys('\u0015/mcp list\r'),
|
||||
() => {
|
||||
const output = stripAnsi(run.output);
|
||||
return (
|
||||
output.includes(
|
||||
'test-server (from test-extension) - Ready (1 tool)',
|
||||
) && output.includes('- hello')
|
||||
);
|
||||
},
|
||||
30000, // 30s timeout
|
||||
await run.sendText('/mcp list');
|
||||
await run.type('\r');
|
||||
await run.expectText(
|
||||
'test-server (from test-extension) - Ready (1 tool)',
|
||||
);
|
||||
await run.expectText('- hello');
|
||||
|
||||
// Update the extension, expect the list to update, and mcp servers as well.
|
||||
await run.sendKeys('\u0015/extensions update test-extension');
|
||||
await run.sendKeys('/extensions update test-extension');
|
||||
await run.expectText('/extensions update test-extension');
|
||||
await run.sendKeys('\r');
|
||||
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||
@@ -108,31 +96,16 @@ describe('extension reloading', () => {
|
||||
await run.expectText(
|
||||
'Extension "test-extension" successfully updated: 0.0.1 → 0.0.2',
|
||||
);
|
||||
|
||||
// Poll for the updated extension version
|
||||
await rig.pollCommand(
|
||||
() => run.sendKeys('\u0015/extensions list\r'),
|
||||
() =>
|
||||
stripAnsi(run.output).includes(
|
||||
'test-extension (v0.0.2) - active (updated)',
|
||||
),
|
||||
30000,
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
await run.sendText('/extensions list');
|
||||
await run.type('\r');
|
||||
await run.expectText('test-extension (v0.0.2) - active (updated)');
|
||||
await run.sendText('/mcp list');
|
||||
await run.type('\r');
|
||||
await run.expectText(
|
||||
'test-server (from test-extension) - Ready (1 tool)',
|
||||
);
|
||||
|
||||
// Poll for the updated mcp tool
|
||||
await rig.pollCommand(
|
||||
() => run.sendKeys('\u0015/mcp list\r'),
|
||||
() => {
|
||||
const output = stripAnsi(run.output);
|
||||
return (
|
||||
output.includes(
|
||||
'test-server (from test-extension) - Ready (1 tool)',
|
||||
) && output.includes('- goodbye')
|
||||
);
|
||||
},
|
||||
30000,
|
||||
);
|
||||
|
||||
await run.expectText('- goodbye');
|
||||
await run.sendText('/quit');
|
||||
await run.sendKeys('\r');
|
||||
|
||||
|
||||
@@ -74,10 +74,6 @@ export async function setup() {
|
||||
export async function teardown() {
|
||||
// Cleanup the test run directory unless KEEP_OUTPUT is set
|
||||
if (process.env['KEEP_OUTPUT'] !== 'true' && runDir) {
|
||||
try {
|
||||
await rm(runDir, { recursive: true, force: true });
|
||||
} catch (e) {
|
||||
console.warn('Failed to clean up test run directory:', e);
|
||||
}
|
||||
await rm(runDir, { recursive: true, force: true });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"**Addressing the Inquiry**\n\nI've grasped the core of the user's question and identified that no tools are needed. My focus is now on crafting a straightforward, direct response that fully addresses their query without any unnecessary complexity. The goal is to provide a clear and concise answer.\n\n\n","thought":true}],"role":"model"},"index":0}],"usageMetadata":{"promptTokenCount":12777,"totalTokenCount":12802,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12777}],"thoughtsTokenCount":25}},{"candidates":[{"content":{"parts":[{"text":"4","thoughtSignature":"CiQBcsjafBFqw6veocEvtOGGuQcsyHdcNrXDIn19n9ImwBBwcYQKdgFyyNp8g7o8Ji++OXoqml4gbLPIB2DQbXcaRQfRuYefF8RxMEpzJSITZBlT1VpJQoeYmQcb9c8dg/POmo5d3ZcuLbpVJpbjMIV1SoUI4KEn3zqz7a8BFuyq3zY4VEliRWMZO21JMd8qp59M9m64hX7W1YPyzu8KPwFyyNp8aNCD7P1NJDG3csQkiMW/0jWdPkh+7+XxT7i3ku/lYH4yTEShdicPcmnzoPGhEWTUDr/4Lx+A0DnVGQ=="}],"role":"model"},"finishReason":"STOP","index":0}],"usageMetadata":{"promptTokenCount":12777,"totalTokenCount":12802,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12777}],"thoughtsTokenCount":25}}]}
|
||||
@@ -1,2 +0,0 @@
|
||||
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"**Analyzing File Access**\n\nI've realized the `read_file` tool is perfect for accessing the contents of `test-file.txt`. My next step is to call this tool and set the `file_path` parameter to `test-file.txt`.\n\n\n","thought":true}],"role":"model"},"index":0}],"usageMetadata":{"promptTokenCount":12785,"totalTokenCount":12841,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12785}],"thoughtsTokenCount":56}},{"candidates":[{"content":{"parts":[{"functionCall":{"name":"read_file","args":{"file_path":"test-file.txt"}},"thoughtSignature":"CiQBcsjafE9D7iAF+V3wpXP81/VmxiMeSFA6afML/lAB76U6QFQKXgFyyNp8i/vhxpkTQ5Cq81QTeEJDDMaYihzSTFMqO4Vj0+CLNtoy+SC/LmqA+WaXh4tm6UCNFTzB2fpVW13YOU1oVYhLpVpeck746YExu1MOSTAq7AC9Yz8ZoelXdecKdwFyyNp8q0PejiY9K1osdOJ02tOHAzAb8ZCSFHtHamEPxRB93krGMNvuIYC1jM1JnC/fzpH8gYV+0/xkoPJMHpF/aSzWq4kZ/j5cUhMYaqKJTulY8ZZGfawnXG7z0spmmr06gwfgILa+HK++xQhhTphMQCobX5hyCjUBcsjafHY6eJfVNitYmfruLV1mnoYnNViHuAOOOni9jIz4VMIjLbClKkb2rpVfHIjx+vZSHA=="}],"role":"model"},"finishReason":"STOP","index":0}],"usageMetadata":{"promptTokenCount":12785,"candidatesTokenCount":20,"totalTokenCount":12861,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12785}],"thoughtsTokenCount":56}}]}
|
||||
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"This"}],"role":"model"},"index":0}],"usageMetadata":{"promptTokenCount":12889,"candidatesTokenCount":1,"totalTokenCount":12890,"cachedContentTokenCount":12206,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12889}],"cacheTokensDetails":[{"modality":"TEXT","tokenCount":12206}]}},{"candidates":[{"content":{"parts":[{"text":" is test content"}],"role":"model"},"finishReason":"STOP","index":0}],"usageMetadata":{"promptTokenCount":12889,"candidatesTokenCount":4,"totalTokenCount":12893,"cachedContentTokenCount":12206,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12889}],"cacheTokensDetails":[{"modality":"TEXT","tokenCount":12206}]}}]}
|
||||
@@ -1,4 +0,0 @@
|
||||
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"**Formulating the Write Operation**\n\nOkay, I'm now clear on the user's intent: they want a file called `approved.txt`, containing the words \"Approved content.\" I've decided to leverage the `write_file` tool. The specific parameter assignments seem straightforward; `file_path` will be \"approved.txt\", and the file's `content` will precisely mirror the desired output string.\n\n\n","thought":true}],"role":"model"},"index":0}],"usageMetadata":{"promptTokenCount":12778,"totalTokenCount":12838,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12778}],"thoughtsTokenCount":60}},{"candidates":[{"content":{"parts":[{"functionCall":{"name":"write_file","args":{"content":"Approved content","file_path":"approved.txt"}},"thoughtSignature":"CiQBcsjafF4NswdygCBTU7cA/yXVRcUI3XHwV+E8BDg/hRr1MaoKZQFyyNp8HRY1qEvivtg0LpYPo1022IfTY3QIeigqGvSoRVospxT5MBggc9nRbwH2vrdhZ772IdqOCrpjNHs3wc+h0AF4JzjlBet6+yC2m7TdenVOkzVAtqnNDMQAIS1gDZyKs8w/CngBcsjafOeuyDQtxuK7JCafKjtfvPvoKOkVxzDetQtHesBkPtv1Xng9dkP77jLH44hn9rrg7yA+za6vssiFZUjC/FU25pCWQgIhM+K7nt3wbAgoOZRqra2gRr3od2D3osV/UpYhy8MoloykqrWvHDOzT/0KScpHarwKXQFyyNp8qabyDYlfElywQBjqQT4f6My7+Ln9AbKZQz4NaEe90ESg4jr4jjANxyd/WKzRheaBq7BYxTHQSeShgQbVjk2D0tZO4hAN+CToMtQwJl95Ss4ZEov6gAwMNA=="}],"role":"model"},"finishReason":"STOP","index":0}],"usageMetadata":{"promptTokenCount":12778,"candidatesTokenCount":24,"totalTokenCount":12862,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12778}],"thoughtsTokenCount":60}}]}
|
||||
{"method":"generateContentStream","response":[{"candidates":[{"content":{"role":"model"},"finishReason":"STOP","index":0}],"usageMetadata":{"promptTokenCount":12939,"totalTokenCount":12939,"cachedContentTokenCount":12203,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12939}],"cacheTokensDetails":[{"modality":"TEXT","tokenCount":12203}]}}]}
|
||||
{"method":"generateContentStream","response":[{"candidates":[{"content":{"role":"model"},"finishReason":"STOP","index":0}],"usageMetadata":{"promptTokenCount":12939,"totalTokenCount":12939,"cachedContentTokenCount":12203,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12939}],"cacheTokensDetails":[{"modality":"TEXT","tokenCount":12203}]}}]}
|
||||
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"**Confirming File Creation**\n\nI've successfully created the file `approved.txt`, and I've verified that it contains the intended content, \"Approved content\". Moving on.\n\n\n","thought":true}],"role":"model"},"index":0}],"usageMetadata":{"promptTokenCount":12887,"totalTokenCount":12932,"cachedContentTokenCount":12198,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12887}],"cacheTokensDetails":[{"modality":"TEXT","tokenCount":12198}],"thoughtsTokenCount":45}},{"candidates":[{"content":{"parts":[{"text":"**Assessing File Contents**\n\nI'm now checking the content of `approved.txt`. I used `cat` to display its contents, and it confirms the initial content of \"Approved content\" is present. My next step will be based on this verification.\n\n\n","thought":true}],"role":"model"},"index":0}],"usageMetadata":{"promptTokenCount":12887,"totalTokenCount":12946,"cachedContentTokenCount":12198,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12887}],"cacheTokensDetails":[{"modality":"TEXT","tokenCount":12198}],"thoughtsTokenCount":59}},{"candidates":[{"content":{"parts":[{"text":"I have created the file. What would you like me to do next?","thoughtSignature":"CiQBcsjafEAq9BWRwBqUousKwXME0A2Wh1tJI5cJC9ROpr9Cix8KagFyyNp81VagWC/YxtY8zCAiThU3BHMVh5wZIsGIWv1NNIXqACLQLoSeLhWEneb6CBkKdbKBugy6g9+jP5phYt+Vz5oYuO1Op2kM1qWjFmEQyr71TUISNtZ9zrOHNQKKW7K9ukUi0paw85YKoAEBcsjafF6QLINjBWwQPZh6EPVNGk4wojTKglNp7xy5vclYBbq58A6A8AtZUHKYA2cV32SLb2TGcPnkE4iKunvPf6sZy9Uc7gKA+x/OgSl7i5m0wSpMOh9fLpGt4CNtieigpxHkNAdxdZ5qzGvCkBFWYhaZAWGbj7+1YibIKJFNjX9yEz1T5dOQmVmceu80dFyz+fwl7RiOXSGR5xK4J7DeClYBcsjafPUccUubdSVLFmRohU4bBtQzLvXxw25mqm5TKANLKINQoloZ+xfXzfe8xw/WZL/mg30AqQErBXPNnLk5vIWLK7suuFAZ7oXdisTCj3MRa1HQmQ=="}],"role":"model"},"finishReason":"STOP","index":0}],"usageMetadata":{"promptTokenCount":12887,"candidatesTokenCount":13,"totalTokenCount":12959,"cachedContentTokenCount":12198,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12887}],"cacheTokensDetails":[{"modality":"TEXT","tokenCount":12198}],"thoughtsTokenCount":59}}]}
|
||||
@@ -1 +0,0 @@
|
||||
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"**Responding Truthfully**\n\nI've determined the user's question is straightforward and doesn't necessitate tools. My primary focus now is ensuring a truthful and direct response, without getting caught up in unnecessary complexity. The goal is clarity and accuracy in my reply.\n\n\n","thought":true}],"role":"model"},"index":0}],"usageMetadata":{"promptTokenCount":12795,"totalTokenCount":12818,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12795}],"thoughtsTokenCount":23}},{"candidates":[{"content":{"parts":[{"text":"Hello! I'm doing well, thank you. I'm ready to help you with your software engineering tasks. All","thoughtSignature":"CiQBcsjafEYrS7SUZE2xuCgUZ7+hs+NrTRZFywSgq09wuKUzD5gKbQFyyNp8snmh8vfDLLCmnKl2shxGR5McWLmRDIQx+gvyW9ipB+5v5R3tvYgBY0yYGxuB8XPHJDP8unxCqg2koazS050HLU5NZaF74m9KDAWrnWPqQ2hDPc9suJRZpcTse5R+nepMu+oXWEsD03UKOwFyyNp82dmgHDF2DLELc6ly78JDLDmb4kM4qkXmuT8OP7Nu5z2o8kkHiKD4HTx0srjLi6u6dN4ufA0o"}],"role":"model"},"index":0}],"usageMetadata":{"promptTokenCount":12795,"candidatesTokenCount":24,"totalTokenCount":12842,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12795}],"thoughtsTokenCount":23}},{"candidates":[{"content":{"parts":[{"text":" our interactions are logged for security and compliance purposes. How can I assist you today?"}],"role":"model"},"finishReason":"STOP","index":0}],"usageMetadata":{"promptTokenCount":12795,"candidatesTokenCount":41,"totalTokenCount":12859,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12795}],"thoughtsTokenCount":23}}]}
|
||||
@@ -1 +0,0 @@
|
||||
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"**Initiating String Output**\n\nI'm now fully focused on directly outputting the specified string. The process has been simplified to its core objective, eliminating extraneous steps. All systems are go for immediate execution of the requested string output.\n\n\n","thought":true}],"role":"model"},"index":0}],"usageMetadata":{"promptTokenCount":12419,"totalTokenCount":12439,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12419}],"thoughtsTokenCount":20}},{"candidates":[{"content":{"parts":[{"text":"The security hook modified this request successfully.","thoughtSignature":"CiQBcsjafAsmW87n4ndCW3YiNIqK6jp0zaTwTjz12vWiwbCFNAUKdQFyyNp808SX5BqCBNZt+dlgsPf74u9W6ofevKGwkTTHQZWJEQiJR2j4uRfESTazuawuWfzKfNJq5Zml6fokNR9jzmQM+Jf4FHw95Jd4lneap+YGO9x5nZMNDI1cHRx0vs4BYW9GWY7lBIM8xKtaEkPrwqc88goiAXLI2nx5o6VrBpXs6jzf5maZIauSYw42zlnkqdDEMI20rg=="}],"role":"model"},"finishReason":"STOP","index":0}],"usageMetadata":{"promptTokenCount":12419,"candidatesTokenCount":7,"totalTokenCount":12446,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12419}],"thoughtsTokenCount":20}}]}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,2 +0,0 @@
|
||||
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"**Constructing File Parameters**\n\nI'm currently focused on the parameters needed for creating `test.txt`. The `write_file` tool seems ideal. I've settled on the `file_path` being \"test.txt\" and the `content` parameter being \"Hello World\". This should result in the desired file creation.\n\n\n","thought":true}],"role":"model"},"index":0}],"usageMetadata":{"promptTokenCount":12779,"totalTokenCount":12843,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12779}],"thoughtsTokenCount":64}},{"candidates":[{"content":{"parts":[{"functionCall":{"name":"write_file","args":{"file_path":"test.txt","content":"Hello World"}},"thoughtSignature":"CiQBcsjafGeGML0hnm03md4ExPwk5i2rcaNDqetrrKnEoEFjxRcKYQFyyNp8rs78myvJfPMuC2AWyTHEoWUps7GWpGu/2VU1BB3ekI32yO0q9KSKkmGX28Palht22I77ac5HsFTuutPBDWIqSkrERkzOh3HKJE2MXzsVJJGHX3jVBirJ+Y8F1OAKcQFyyNp8pMKA4E8M3PhbuhDzOv3c9tVEgCQ4W6kzmZHBQeUQNuHVLw1cZfx/aichP6fJeZEJPCXROa7WEWPbwY9evB+ofTqjiifUXo0l4smudNHAerr7UrspQVDwGRGnWBkKiy9a6V5q6XkEhYci+2tBCnIBcsjafNb1jWT0qNMJcPcb8Ngu9xVLsMxb3DEftWMblDwnwv+tMaaQWeXVav8HgSYyg/P40pfOgOtASYZAHZGDhkwfbYY8J1Br8Y71kpEzoImbeQwALV1LMsr1uHQjq2nekTjmOXbIFr68Ef44BzFSBuI="}],"role":"model"},"finishReason":"STOP","index":0}],"usageMetadata":{"promptTokenCount":12779,"candidatesTokenCount":24,"totalTokenCount":12867,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12779}],"thoughtsTokenCount":64}}]}
|
||||
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"**Acknowledge the Block**\n\nI've hit a snag. The file creation was blocked, as you saw. Rather than persisting, I'm waiting on your next instructions. I'm ready to proceed, but need your input on how to adjust course.\n\n\n","thought":true}],"role":"model"},"index":0}],"usageMetadata":{"promptTokenCount":12886,"totalTokenCount":12925,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12886}],"thoughtsTokenCount":39}},{"candidates":[{"content":{"parts":[{"text":"I am sorry, but I was unable to create the file as the request was blocked by the security policy.","thoughtSignature":"CikBcsjafKIxdnJr+6NHip/3cc9MiaqA+EfxMy6T2dArrEw3Ga3y69q7fgppAXLI2nxri+Z6NSOI3wvN+xmipbnuKNWfZKMWHN/amQSZcMqIoFNpTyt1t8B/MIGtIVpQ8CfQQAypanAIGa4G+tEhKxOXIdFNktSLB/Yrr0HQQAkD6t12s8S0KTdH5P4xmAII4gdwvSXzCnIBcsjafO06UBT/9dUO7OcS6UItneCNaFUEwAzcn5nGO0kUfu50lTPEwPTGNgrOc8FB303GEcIjZpTXc5X737oyAxqgRk7fY10vwBGOJk+PuiVIQeZQKTazZ7Q90W2d2MRTIAatQYi572oiw4m6vqLJg7o="}],"role":"model"},"finishReason":"STOP","index":0}],"usageMetadata":{"promptTokenCount":12886,"candidatesTokenCount":21,"totalTokenCount":12946,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12886}],"thoughtsTokenCount":39}}]}
|
||||
@@ -1,2 +0,0 @@
|
||||
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"**Defining File Parameters**\n\nI've decided on the filename: `error-test.txt`. I'll populate it with the text \"testing error handling\". The `write_file` tool seems ideal for this, given its clear functionality. I'm focusing on assigning the values of `file_path` as `error-test.txt` and `content` as \"testing error handling\" to initiate the tool.\n\n\n","thought":true}],"role":"model"},"index":0}],"usageMetadata":{"promptTokenCount":12786,"totalTokenCount":12852,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12786}],"thoughtsTokenCount":66}},{"candidates":[{"content":{"parts":[{"functionCall":{"name":"write_file","args":{"file_path":"error-test.txt","content":"testing error handling"}},"thoughtSignature":"CiQBcsjafMeH+OLl4BHZIH0Hg2b339mDmV+8hSLTIZ8rBtABe/sKZwFyyNp8Gh1K04S9kcEId8vXyr9F9ium+5Hpc2KjkW6gfIcXRYrwYA9kvwQT9i7xz/0Dtr39FNkcqJil59sI1MrRKI+SfMtAOxo85PPV5Dd5oWaFEgufexxZIjJoJrxocUw0TMwU1SMKeAFyyNp8D36DcvOYdJEs4SbdRH/WP+abiCnPTKHuV1lFxuZXcyig/HEv2+uGN3XgdRu5kKLto0DbkaRRrjb5Z9w9MytOzQzg0ffZnvUyE1uyCJInBV+kSnosrNi81+WSlKnCPhQO67i7y3H0zPmoQSSIw2e1VadZdAprAXLI2nwchfIb/xiTeWb2cnNDPj98A31b/i80QyRXEnQp2DAlwvPSp/CLs+J82tzps+lFFcKXT3QRID+/Y7D3wTxxKiET3/dwobW4y9hrHP+DhzU5h1GC5fOcvximpOl9KUp98viPrOAaMqs="}],"role":"model"},"index":0}],"usageMetadata":{"promptTokenCount":12786,"candidatesTokenCount":27,"totalTokenCount":12879,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12786}],"thoughtsTokenCount":66}},{"candidates":[{"content":{"role":"model"},"finishReason":"STOP","index":0}],"usageMetadata":{"promptTokenCount":12786,"candidatesTokenCount":27,"totalTokenCount":12879,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12786}],"thoughtsTokenCount":66}}]}
|
||||
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"OK."}],"role":"model"},"finishReason":"STOP","index":0}],"usageMetadata":{"promptTokenCount":12951,"candidatesTokenCount":2,"totalTokenCount":12953,"cachedContentTokenCount":12203,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12951}],"cacheTokensDetails":[{"modality":"TEXT","tokenCount":12203}]}}]}
|
||||
@@ -1,2 +0,0 @@
|
||||
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"**Defining File Creation**\n\nI'm thinking about the user's intent to generate a file named \"input-test.txt\" with the content \" test\". I've determined that the `write_file` tool is suitable. I've parsed `file_path` as \"input-test.txt\" and `content` as \" test\". This should accomplish the user's need.\n\n\n","thought":true}],"role":"model"},"index":0}],"usageMetadata":{"promptTokenCount":12778,"totalTokenCount":12840,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12778}],"thoughtsTokenCount":62}},{"candidates":[{"content":{"parts":[{"functionCall":{"name":"write_file","args":{"file_path":"input-test.txt","content":"test"}},"thoughtSignature":"CiQBcsjafCO/Ifs3Lj/Gtzy2ylSYoGB3GXjJby4F3R8FxWp+hP0KZwFyyNp8oD7KvcSYXDimGOiqAdxtdOJpc2tFJbHm2Jw7ahiuKLtoKZWE+1bBZEWVKxC0dCQIeIcxZ0SaLn7tDbfc2qPzhyUA46d/T1+e314SFLWW1asIOBkQ4T0sFDAFPZ4m9bFm3UkKbAFyyNp8EAnclI0wYCGwpg0AOOV52F5J9Hc2EeaXkGsc6hCnba7aNhPucWYIn2Da8FK2IJAWUWaNvGNGoNUZETaG+iL9+6KRJgN3Ql/wQzQ2pHUvTGHC3RkfMGTQ+YCQKvlOReilps5lDmMnhQpTAXLI2nzcl9Aqd0Nb/w934w+tqz1Jth7GlQVMYktHOl7Hgkoykfh3NzM67SEAilxjowfBL6MY7UBUP3YGwi1CXVVa4d0wHnMD9BJYp2w8ztZch8I="}],"role":"model"},"finishReason":"STOP","index":0}],"usageMetadata":{"promptTokenCount":12778,"candidatesTokenCount":25,"totalTokenCount":12865,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12778}],"thoughtsTokenCount":62}}]}
|
||||
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"**File Creation Achieved**\n\nI've successfully created the file as requested. Now, I'm ready to move on to the next instruction whenever it arrives. I am now awaiting the next task.\n\n\n","thought":true}],"role":"model"},"index":0}],"usageMetadata":{"promptTokenCount":12940,"totalTokenCount":12965,"cachedContentTokenCount":12203,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12940}],"cacheTokensDetails":[{"modality":"TEXT","tokenCount":12203}],"thoughtsTokenCount":25}},{"candidates":[{"content":{"parts":[{"text":"Done.","thoughtSignature":"CiQBcsjafEwfH5zTnAjEjloMcDDflS/MmoH03HXVl8HoQ04vmVIKcQFyyNp8/6HrBz8vokXB1Ms1zW51p32T3Ni3HEbgSFPHMGZt9LHFtLkLzuFrxym66z1Tcb5tqj+7jAdpM/dIUb6ecrKj9FWqMB+QR4BSxdAiJSiL8Rp+Pc5ckCtT1nrv4C5w3/fhCNE4WvZzeyGPt+PACjsBcsjafNWzUJcHxgKp6MYWQ8RW0QrGerM51nkgXHBafxY5KwTznX4B/ETccGnXX3zSciaJiZR1FfudVw=="}],"role":"model"},"finishReason":"STOP","index":0}],"usageMetadata":{"promptTokenCount":12940,"candidatesTokenCount":1,"totalTokenCount":12966,"cachedContentTokenCount":12203,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12940}],"cacheTokensDetails":[{"modality":"TEXT","tokenCount":12203}],"thoughtsTokenCount":25}}]}
|
||||
@@ -1,2 +0,0 @@
|
||||
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"**Initializing File Creation**\n\nI've decided on the `write_file` tool to create the telemetry file. I'll pass \"telemetry-test.txt\" as the file path, and an empty string for the content, as the user didn't specify anything to include. This is the initial setup; the file should now exist.\n\n\n","thought":true}],"role":"model"},"index":0}],"usageMetadata":{"promptTokenCount":12779,"totalTokenCount":12850,"cachedContentTokenCount":12204,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12779}],"cacheTokensDetails":[{"modality":"TEXT","tokenCount":12204}],"thoughtsTokenCount":71}},{"candidates":[{"content":{"parts":[{"functionCall":{"name":"write_file","args":{"content":"","file_path":"telemetry-test.txt"}},"thoughtSignature":"CiQBcsjafG+JDSqtKOK+ZvSjZQZmS91c1Gz0YyTiirI2u5+rhEIKZAFyyNp8DNXb+xHILTC+FVlEifqEHdrmfFNBLKojci1UIBhcZpQ4UXCMkxUXYKO34IjTlyLgSsjVbbXWEFXatb/z/RtTDcf51uc3YOEwlDScGempkJxfFgcPfIiD7bhuHBqdQfUKfAFyyNp8wZ71h+QjdfVw12PwDXWgGZ0Xed1GuyJXuqAwpWnwxDIvsDaPwDFYyLR1XDiIZZk4AvFCGt6HGMSLRuPh4K3i9CVnDc5hcjyvMIde0idAFMrgs2Mq5SARfCPrWkqyq2f0Q0WonUl2n7yr/sDQ78rx2E6qXyUJ8XMKfAFyyNp8DdTYLttyI0jknqAeZDxdFmHtpJUI8UKP5YHzpQc8Qn80OJcwhZSRH4HRKCqoC7Sukq/A5vJ5T468WqgjOoLlPLq02bYRTf/q6LC1ogEhdLHrcFv2jDeCdXJJ8NHv3O4DZAUAk1W5Gd0428zMFOxH3AgkWwEGuow="}],"role":"model"},"finishReason":"STOP","index":0}],"usageMetadata":{"promptTokenCount":12779,"candidatesTokenCount":24,"totalTokenCount":12874,"cachedContentTokenCount":12204,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12779}],"cacheTokensDetails":[{"modality":"TEXT","tokenCount":12204}],"thoughtsTokenCount":71}}]}
|
||||
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"OK."}],"role":"model"},"finishReason":"STOP","index":0}],"usageMetadata":{"promptTokenCount":12951,"candidatesTokenCount":2,"totalTokenCount":12953,"cachedContentTokenCount":12202,"promptTokensDetails":[{"modality":"TEXT","tokenCount":12951}],"cacheTokensDetails":[{"modality":"TEXT","tokenCount":12202}]}}]}
|
||||
@@ -1,932 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2025 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
||||
import { TestRig } from './test-helper.js';
|
||||
import { join } from 'node:path';
|
||||
import { writeFileSync } from 'node:fs';
|
||||
|
||||
describe('Hooks System Integration', () => {
|
||||
let rig: TestRig;
|
||||
|
||||
beforeEach(() => {
|
||||
rig = new TestRig();
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
if (rig) {
|
||||
await rig.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
describe('Command Hooks - Blocking Behavior', () => {
|
||||
it('should block tool execution when hook returns block decision', async () => {
|
||||
await rig.setup(
|
||||
'should block tool execution when hook returns block decision',
|
||||
{
|
||||
fakeResponsesPath: join(
|
||||
import.meta.dirname,
|
||||
'hooks-system.block-tool.responses',
|
||||
),
|
||||
settings: {
|
||||
tools: {
|
||||
enableHooks: true,
|
||||
},
|
||||
hooks: {
|
||||
BeforeTool: [
|
||||
{
|
||||
matcher: 'write_file',
|
||||
sequential: true,
|
||||
hooks: [
|
||||
{
|
||||
type: 'command',
|
||||
command:
|
||||
'echo "{\\"decision\\": \\"block\\", \\"reason\\": \\"File writing blocked by security policy\\"}"',
|
||||
timeout: 5000,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const prompt = 'Create a file called test.txt with content "Hello World"';
|
||||
const result = await rig.run(prompt);
|
||||
|
||||
// The hook should block the write_file tool
|
||||
const toolLogs = rig.readToolLogs();
|
||||
const writeFileCalls = toolLogs.filter(
|
||||
(t) =>
|
||||
t.toolRequest.name === 'write_file' && t.toolRequest.success === true,
|
||||
);
|
||||
|
||||
// Tool should not be called due to blocking hook
|
||||
expect(writeFileCalls).toHaveLength(0);
|
||||
|
||||
// Result should mention the blocking reason
|
||||
expect(result).toContain('File writing blocked by security policy');
|
||||
|
||||
// Should generate hook telemetry
|
||||
const hookTelemetryFound = await rig.waitForTelemetryEvent('hook_call');
|
||||
expect(hookTelemetryFound).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should allow tool execution when hook returns allow decision', async () => {
|
||||
await rig.setup(
|
||||
'should allow tool execution when hook returns allow decision',
|
||||
{
|
||||
fakeResponsesPath: join(
|
||||
import.meta.dirname,
|
||||
'hooks-system.allow-tool.responses',
|
||||
),
|
||||
settings: {
|
||||
tools: {
|
||||
enableHooks: true,
|
||||
},
|
||||
hooks: {
|
||||
BeforeTool: [
|
||||
{
|
||||
matcher: 'write_file',
|
||||
hooks: [
|
||||
{
|
||||
type: 'command',
|
||||
command:
|
||||
'echo "{\\"decision\\": \\"allow\\", \\"reason\\": \\"File writing approved\\"}"',
|
||||
timeout: 5000,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const prompt =
|
||||
'Create a file called approved.txt with content "Approved content"';
|
||||
await rig.run(prompt);
|
||||
|
||||
// The hook should allow the write_file tool
|
||||
const foundWriteFile = await rig.waitForToolCall('write_file');
|
||||
expect(foundWriteFile).toBeTruthy();
|
||||
|
||||
// File should be created
|
||||
const fileContent = rig.readFile('approved.txt');
|
||||
expect(fileContent).toContain('Approved content');
|
||||
|
||||
// Should generate hook telemetry
|
||||
const hookTelemetryFound = await rig.waitForTelemetryEvent('hook_call');
|
||||
expect(hookTelemetryFound).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Command Hooks - Additional Context', () => {
|
||||
it('should add additional context from AfterTool hooks', async () => {
|
||||
const command =
|
||||
'echo "{\\"hookSpecificOutput\\": {\\"hookEventName\\": \\"AfterTool\\", \\"additionalContext\\": \\"Security scan: File content appears safe\\"}}"';
|
||||
await rig.setup('should add additional context from AfterTool hooks', {
|
||||
fakeResponsesPath: join(
|
||||
import.meta.dirname,
|
||||
'hooks-system.after-tool-context.responses',
|
||||
),
|
||||
settings: {
|
||||
tools: {
|
||||
enableHooks: true,
|
||||
},
|
||||
hooks: {
|
||||
AfterTool: [
|
||||
{
|
||||
matcher: 'read_file',
|
||||
hooks: [
|
||||
{
|
||||
type: 'command',
|
||||
command: command,
|
||||
timeout: 5000,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// Create a test file to read
|
||||
rig.createFile('test-file.txt', 'This is test content');
|
||||
|
||||
const prompt =
|
||||
'Read the contents of test-file.txt and tell me what it contains';
|
||||
await rig.run(prompt);
|
||||
|
||||
// Should find read_file tool call
|
||||
const foundReadFile = await rig.waitForToolCall('read_file');
|
||||
expect(foundReadFile).toBeTruthy();
|
||||
|
||||
// Should generate hook telemetry
|
||||
const hookTelemetryFound = rig.readHookLogs();
|
||||
expect(hookTelemetryFound.length).toBeGreaterThan(0);
|
||||
expect(hookTelemetryFound[0].hookCall.hook_event_name).toBe('AfterTool');
|
||||
expect(hookTelemetryFound[0].hookCall.hook_name).toBe(command);
|
||||
expect(hookTelemetryFound[0].hookCall.hook_input).toBeDefined();
|
||||
expect(hookTelemetryFound[0].hookCall.hook_output).toBeDefined();
|
||||
expect(hookTelemetryFound[0].hookCall.exit_code).toBe(0);
|
||||
expect(hookTelemetryFound[0].hookCall.stdout).toBeDefined();
|
||||
expect(hookTelemetryFound[0].hookCall.stderr).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('BeforeModel Hooks - LLM Request Modification', () => {
|
||||
it('should modify LLM requests with BeforeModel hooks', async () => {
|
||||
// Create a hook script that replaces the LLM request with a modified version
|
||||
// Note: Providing messages in the hook output REPLACES the entire conversation
|
||||
await rig.setup('should modify LLM requests with BeforeModel hooks', {
|
||||
fakeResponsesPath: join(
|
||||
import.meta.dirname,
|
||||
'hooks-system.before-model.responses',
|
||||
),
|
||||
});
|
||||
const hookScript = `#!/bin/bash
|
||||
echo '{
|
||||
"decision": "allow",
|
||||
"hookSpecificOutput": {
|
||||
"hookEventName": "BeforeModel",
|
||||
"llm_request": {
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
"content": "Please respond with exactly: The security hook modified this request successfully."
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}'`;
|
||||
|
||||
const scriptPath = join(rig.testDir!, 'before_model_hook.sh');
|
||||
writeFileSync(scriptPath, hookScript);
|
||||
// Make executable
|
||||
const { execSync } = await import('node:child_process');
|
||||
execSync(`chmod +x "${scriptPath}"`);
|
||||
|
||||
await rig.setup('should modify LLM requests with BeforeModel hooks', {
|
||||
settings: {
|
||||
tools: {
|
||||
enableHooks: true,
|
||||
},
|
||||
hooks: {
|
||||
BeforeModel: [
|
||||
{
|
||||
hooks: [
|
||||
{
|
||||
type: 'command',
|
||||
command: scriptPath,
|
||||
timeout: 5000,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const prompt = 'Tell me a story';
|
||||
const result = await rig.run(prompt);
|
||||
|
||||
// The hook should have replaced the request entirely
|
||||
// Verify that the model responded to the modified request, not the original
|
||||
expect(result).toBeDefined();
|
||||
expect(result.length).toBeGreaterThan(0);
|
||||
// The response should contain the expected text from the modified request
|
||||
expect(result.toLowerCase()).toContain('security hook modified');
|
||||
|
||||
// Should generate hook telemetry
|
||||
|
||||
// Should generate hook telemetry
|
||||
const hookTelemetryFound = rig.readHookLogs();
|
||||
expect(hookTelemetryFound.length).toBeGreaterThan(0);
|
||||
expect(hookTelemetryFound[0].hookCall.hook_event_name).toBe(
|
||||
'BeforeModel',
|
||||
);
|
||||
expect(hookTelemetryFound[0].hookCall.hook_name).toBe(scriptPath);
|
||||
expect(hookTelemetryFound[0].hookCall.hook_input).toBeDefined();
|
||||
expect(hookTelemetryFound[0].hookCall.hook_output).toBeDefined();
|
||||
expect(hookTelemetryFound[0].hookCall.exit_code).toBe(0);
|
||||
expect(hookTelemetryFound[0].hookCall.stdout).toBeDefined();
|
||||
expect(hookTelemetryFound[0].hookCall.stderr).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('AfterModel Hooks - LLM Response Modification', () => {
|
||||
it.skipIf(process.platform === 'win32')(
|
||||
'should modify LLM responses with AfterModel hooks',
|
||||
async () => {
|
||||
await rig.setup('should modify LLM responses with AfterModel hooks', {
|
||||
fakeResponsesPath: join(
|
||||
import.meta.dirname,
|
||||
'hooks-system.after-model.responses',
|
||||
),
|
||||
});
|
||||
// Create a hook script that modifies the LLM response
|
||||
const hookScript = `#!/bin/bash
|
||||
echo '{
|
||||
"hookSpecificOutput": {
|
||||
"hookEventName": "AfterModel",
|
||||
"llm_response": {
|
||||
"candidates": [
|
||||
{
|
||||
"content": {
|
||||
"role": "model",
|
||||
"parts": [
|
||||
"[FILTERED] Response has been filtered for security compliance."
|
||||
]
|
||||
},
|
||||
"finishReason": "STOP"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}'`;
|
||||
|
||||
const scriptPath = join(rig.testDir!, 'after_model_hook.sh');
|
||||
writeFileSync(scriptPath, hookScript);
|
||||
const { execSync } = await import('node:child_process');
|
||||
execSync(`chmod +x "${scriptPath}"`);
|
||||
|
||||
await rig.setup('should modify LLM responses with AfterModel hooks', {
|
||||
settings: {
|
||||
tools: {
|
||||
enableHooks: true,
|
||||
},
|
||||
hooks: {
|
||||
AfterModel: [
|
||||
{
|
||||
hooks: [
|
||||
{
|
||||
type: 'command',
|
||||
command: scriptPath,
|
||||
timeout: 5000,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const prompt = 'What is 2 + 2?';
|
||||
const result = await rig.run(prompt);
|
||||
|
||||
// The hook should have replaced the model response
|
||||
expect(result).toContain(
|
||||
'[FILTERED] Response has been filtered for security compliance',
|
||||
);
|
||||
|
||||
// Should generate hook telemetry
|
||||
const hookTelemetryFound = await rig.waitForTelemetryEvent('hook_call');
|
||||
expect(hookTelemetryFound).toBeTruthy();
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
describe('BeforeToolSelection Hooks - Tool Configuration', () => {
|
||||
it('should modify tool selection with BeforeToolSelection hooks', async () => {
|
||||
await rig.setup(
|
||||
'should modify tool selection with BeforeToolSelection hooks',
|
||||
{
|
||||
fakeResponsesPath: join(
|
||||
import.meta.dirname,
|
||||
'hooks-system.before-tool-selection.responses',
|
||||
),
|
||||
},
|
||||
);
|
||||
// Create a hook script that restricts available tools
|
||||
const hookScript = `#!/bin/bash
|
||||
echo '{
|
||||
"hookSpecificOutput": {
|
||||
"hookEventName": "BeforeToolSelection",
|
||||
"toolConfig": {
|
||||
"mode": "ANY",
|
||||
"allowedFunctionNames": ["read_file", "run_shell_command"]
|
||||
}
|
||||
}
|
||||
}'`;
|
||||
|
||||
const scriptPath = join(rig.testDir!, 'before_tool_selection_hook.sh');
|
||||
writeFileSync(scriptPath, hookScript);
|
||||
const { execSync } = await import('node:child_process');
|
||||
execSync(`chmod +x "${scriptPath}"`);
|
||||
|
||||
await rig.setup(
|
||||
'should modify tool selection with BeforeToolSelection hooks',
|
||||
{
|
||||
settings: {
|
||||
debugMode: true,
|
||||
tools: {
|
||||
enableHooks: true,
|
||||
},
|
||||
hooks: {
|
||||
BeforeToolSelection: [
|
||||
{
|
||||
hooks: [
|
||||
{
|
||||
type: 'command',
|
||||
command: scriptPath,
|
||||
timeout: 5000,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
// Create a test file
|
||||
rig.createFile('new_file_data.txt', 'test data');
|
||||
|
||||
const prompt =
|
||||
'Check the content of new_file_data.txt, after that run echo command to see the content';
|
||||
await rig.run(prompt);
|
||||
|
||||
// Should use read_file (allowed) but not run_shell_command (not in allowed list)
|
||||
const foundReadFile = await rig.waitForToolCall('read_file');
|
||||
expect(foundReadFile).toBeTruthy();
|
||||
|
||||
// Should generate hook telemetry indicating the hook was called
|
||||
const hookTelemetryFound = await rig.waitForTelemetryEvent('hook_call');
|
||||
expect(hookTelemetryFound).toBeTruthy();
|
||||
|
||||
// Verify the hook was called for BeforeToolSelection event
|
||||
const hookLogs = rig.readHookLogs();
|
||||
const beforeToolSelectionHook = hookLogs.find(
|
||||
(log) => log.hookCall.hook_event_name === 'BeforeToolSelection',
|
||||
);
|
||||
expect(beforeToolSelectionHook).toBeDefined();
|
||||
expect(beforeToolSelectionHook?.hookCall.success).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('BeforeAgent Hooks - Prompt Augmentation', () => {
|
||||
it('should augment prompts with BeforeAgent hooks', async () => {
|
||||
await rig.setup('should augment prompts with BeforeAgent hooks', {
|
||||
fakeResponsesPath: join(
|
||||
import.meta.dirname,
|
||||
'hooks-system.before-agent.responses',
|
||||
),
|
||||
});
|
||||
// Create a hook script that adds context to the prompt
|
||||
const hookScript = `#!/bin/bash
|
||||
echo '{
|
||||
"decision": "allow",
|
||||
"hookSpecificOutput": {
|
||||
"hookEventName": "BeforeAgent",
|
||||
"additionalContext": "SYSTEM INSTRUCTION: You are in a secure environment. Always mention security compliance in your responses."
|
||||
}
|
||||
}'`;
|
||||
|
||||
const scriptPath = join(rig.testDir!, 'before_agent_hook.sh');
|
||||
writeFileSync(scriptPath, hookScript);
|
||||
const { execSync } = await import('node:child_process');
|
||||
execSync(`chmod +x "${scriptPath}"`);
|
||||
|
||||
await rig.setup('should augment prompts with BeforeAgent hooks', {
|
||||
settings: {
|
||||
tools: {
|
||||
enableHooks: true,
|
||||
},
|
||||
hooks: {
|
||||
BeforeAgent: [
|
||||
{
|
||||
hooks: [
|
||||
{
|
||||
type: 'command',
|
||||
command: scriptPath,
|
||||
timeout: 5000,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const prompt = 'Hello, how are you?';
|
||||
const result = await rig.run(prompt);
|
||||
|
||||
// The hook should have added security context, which should influence the response
|
||||
expect(result).toContain('security');
|
||||
|
||||
// Should generate hook telemetry
|
||||
const hookTelemetryFound = await rig.waitForTelemetryEvent('hook_call');
|
||||
expect(hookTelemetryFound).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe.skip('Notification Hooks - Permission Handling', () => {
|
||||
it('should handle notification hooks for tool permissions', async () => {
|
||||
await rig.setup('should handle notification hooks for tool permissions');
|
||||
// Create a hook script that logs notification events
|
||||
const hookScript = `#!/bin/bash
|
||||
echo '{
|
||||
"suppressOutput": false,
|
||||
"systemMessage": "Permission request logged by security hook"
|
||||
}'`;
|
||||
|
||||
const scriptPath = join(rig.testDir!, 'notification_hook.sh');
|
||||
writeFileSync(scriptPath, hookScript);
|
||||
const { execSync } = await import('node:child_process');
|
||||
execSync(`chmod +x "${scriptPath}"`);
|
||||
|
||||
await rig.setup('should handle notification hooks for tool permissions', {
|
||||
settings: {
|
||||
// Configure tools to enable hooks and require confirmation to trigger notifications
|
||||
tools: {
|
||||
enableHooks: true,
|
||||
confirmationRequired: ['run_shell_command'],
|
||||
},
|
||||
hooks: {
|
||||
Notification: [
|
||||
{
|
||||
matcher: 'ToolPermission',
|
||||
hooks: [
|
||||
{
|
||||
type: 'command',
|
||||
command: scriptPath,
|
||||
timeout: 5000,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const prompt =
|
||||
'Run the command "echo test" (this should trigger a permission prompt)';
|
||||
|
||||
// Use stdin to automatically approve the permission
|
||||
await rig.run({
|
||||
prompt,
|
||||
stdin: 'y\n', // Approve the permission
|
||||
});
|
||||
|
||||
// Should find the shell command execution
|
||||
const foundShellCommand = await rig.waitForToolCall('run_shell_command');
|
||||
expect(foundShellCommand).toBeTruthy();
|
||||
|
||||
// Should generate hook telemetry
|
||||
const hookTelemetryFound = await rig.waitForTelemetryEvent('hook_call');
|
||||
expect(hookTelemetryFound).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Sequential Hook Execution', () => {
|
||||
// Note: This test checks telemetry for hook context in API requests,
|
||||
// which behaves differently with mocked responses. Keeping real LLM calls.
|
||||
it.skipIf(process.platform === 'win32')(
|
||||
'should execute hooks sequentially when configured',
|
||||
async () => {
|
||||
await rig.setup('should execute hooks sequentially when configured');
|
||||
// Create two hooks that modify the input sequentially
|
||||
const hook1Script = `#!/bin/bash
|
||||
echo '{
|
||||
"decision": "allow",
|
||||
"hookSpecificOutput": {
|
||||
"hookEventName": "BeforeAgent",
|
||||
"additionalContext": "Step 1: Initial validation passed."
|
||||
}
|
||||
}'`;
|
||||
|
||||
const hook2Script = `#!/bin/bash
|
||||
echo '{
|
||||
"decision": "allow",
|
||||
"hookSpecificOutput": {
|
||||
"hookEventName": "BeforeAgent",
|
||||
"additionalContext": "Step 2: Security check completed."
|
||||
}
|
||||
}'`;
|
||||
|
||||
const script1Path = join(rig.testDir!, 'sequential_hook1.sh');
|
||||
const script2Path = join(rig.testDir!, 'sequential_hook2.sh');
|
||||
|
||||
writeFileSync(script1Path, hook1Script);
|
||||
writeFileSync(script2Path, hook2Script);
|
||||
const { execSync } = await import('node:child_process');
|
||||
execSync(`chmod +x "${script1Path}"`);
|
||||
execSync(`chmod +x "${script2Path}"`);
|
||||
|
||||
await rig.setup('should execute hooks sequentially when configured', {
|
||||
settings: {
|
||||
tools: {
|
||||
enableHooks: true,
|
||||
},
|
||||
hooks: {
|
||||
BeforeAgent: [
|
||||
{
|
||||
sequential: true,
|
||||
hooks: [
|
||||
{
|
||||
type: 'command',
|
||||
command: script1Path,
|
||||
timeout: 5000,
|
||||
},
|
||||
{
|
||||
type: 'command',
|
||||
command: script2Path,
|
||||
timeout: 5000,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const prompt = 'Hello, please help me with a task';
|
||||
await rig.run(prompt);
|
||||
|
||||
// Should generate hook telemetry
|
||||
let hookTelemetryFound = await rig.waitForTelemetryEvent('hook_call');
|
||||
expect(hookTelemetryFound).toBeTruthy();
|
||||
hookTelemetryFound = await rig.waitForTelemetryEvent('api_request');
|
||||
const apiRequests = rig.readAllApiRequest();
|
||||
const apiRequestsTexts = apiRequests
|
||||
?.filter(
|
||||
(request) =>
|
||||
'attributes' in request &&
|
||||
typeof request['attributes'] === 'object' &&
|
||||
request['attributes'] !== null &&
|
||||
'request_text' in request['attributes'] &&
|
||||
typeof request['attributes']['request_text'] === 'string',
|
||||
)
|
||||
.map((request) => request['attributes']['request_text']);
|
||||
expect(apiRequestsTexts).toBeDefined();
|
||||
let hasBeforeAgentHookContext = false;
|
||||
let hasAfterToolHookContext = false;
|
||||
for (const requestText of apiRequestsTexts) {
|
||||
if (requestText.includes('Step 1: Initial validation passed')) {
|
||||
hasBeforeAgentHookContext = true;
|
||||
}
|
||||
if (requestText.includes('Step 2: Security check completed')) {
|
||||
hasAfterToolHookContext = true;
|
||||
}
|
||||
}
|
||||
expect(hasBeforeAgentHookContext).toBeTruthy();
|
||||
expect(hasAfterToolHookContext).toBeTruthy();
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
describe('Hook Input/Output Validation', () => {
|
||||
it('should provide correct input format to hooks', async () => {
|
||||
await rig.setup('should provide correct input format to hooks', {
|
||||
fakeResponsesPath: join(
|
||||
import.meta.dirname,
|
||||
'hooks-system.input-validation.responses',
|
||||
),
|
||||
});
|
||||
// Create a hook script that validates the input format
|
||||
const hookScript = `#!/bin/bash
|
||||
# Read JSON input from stdin
|
||||
input=$(cat)
|
||||
|
||||
# Check for required fields
|
||||
if echo "$input" | jq -e '.session_id and .cwd and .hook_event_name and .timestamp and .tool_name and .tool_input' > /dev/null 2>&1; then
|
||||
echo '{"decision": "allow", "reason": "Input format is correct"}'
|
||||
exit 0
|
||||
else
|
||||
echo '{"decision": "block", "reason": "Input format is invalid"}'
|
||||
exit 0
|
||||
fi`;
|
||||
|
||||
const scriptPath = join(rig.testDir!, 'input_validation_hook.sh');
|
||||
writeFileSync(scriptPath, hookScript);
|
||||
const { execSync } = await import('node:child_process');
|
||||
execSync(`chmod +x "${scriptPath}"`);
|
||||
|
||||
await rig.setup('should provide correct input format to hooks', {
|
||||
settings: {
|
||||
tools: {
|
||||
enableHooks: true,
|
||||
},
|
||||
hooks: {
|
||||
BeforeTool: [
|
||||
{
|
||||
hooks: [
|
||||
{
|
||||
type: 'command',
|
||||
command: scriptPath,
|
||||
timeout: 5000,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const prompt = 'Create a file called input-test.txt with content "test"';
|
||||
await rig.run(prompt);
|
||||
|
||||
// Hook should validate input format successfully
|
||||
const foundWriteFile = await rig.waitForToolCall('write_file');
|
||||
expect(foundWriteFile).toBeTruthy();
|
||||
|
||||
// Check that the file was created (hook allowed it)
|
||||
const fileContent = rig.readFile('input-test.txt');
|
||||
expect(fileContent).toContain('test');
|
||||
|
||||
// Should generate hook telemetry
|
||||
const hookTelemetryFound = await rig.waitForTelemetryEvent('hook_call');
|
||||
expect(hookTelemetryFound).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Multiple Event Types', () => {
|
||||
// Note: This test checks telemetry for hook context in API requests,
|
||||
// which behaves differently with mocked responses. Keeping real LLM calls.
|
||||
it.skipIf(process.platform === 'win32')(
|
||||
'should handle hooks for all major event types',
|
||||
async () => {
|
||||
await rig.setup('should handle hooks for all major event types');
|
||||
// Create hook scripts for different events
|
||||
const beforeToolScript = `#!/bin/bash
|
||||
echo '{"decision": "allow", "systemMessage": "BeforeTool: File operation logged"}'`;
|
||||
|
||||
const afterToolScript = `#!/bin/bash
|
||||
echo '{"hookSpecificOutput": {"hookEventName": "AfterTool", "additionalContext": "AfterTool: Operation completed successfully"}}'`;
|
||||
|
||||
const beforeAgentScript = `#!/bin/bash
|
||||
echo '{"decision": "allow", "hookSpecificOutput": {"hookEventName": "BeforeAgent", "additionalContext": "BeforeAgent: User request processed"}}'`;
|
||||
|
||||
const beforeToolPath = join(rig.testDir!, 'before_tool.sh');
|
||||
const afterToolPath = join(rig.testDir!, 'after_tool.sh');
|
||||
const beforeAgentPath = join(rig.testDir!, 'before_agent.sh');
|
||||
|
||||
writeFileSync(beforeToolPath, beforeToolScript);
|
||||
writeFileSync(afterToolPath, afterToolScript);
|
||||
writeFileSync(beforeAgentPath, beforeAgentScript);
|
||||
|
||||
const { execSync } = await import('node:child_process');
|
||||
execSync(`chmod +x "${beforeToolPath}"`);
|
||||
execSync(`chmod +x "${afterToolPath}"`);
|
||||
execSync(`chmod +x "${beforeAgentPath}"`);
|
||||
|
||||
await rig.setup('should handle hooks for all major event types', {
|
||||
settings: {
|
||||
tools: {
|
||||
enableHooks: true,
|
||||
},
|
||||
hooks: {
|
||||
BeforeAgent: [
|
||||
{
|
||||
hooks: [
|
||||
{
|
||||
type: 'command',
|
||||
command: beforeAgentPath,
|
||||
timeout: 5000,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
BeforeTool: [
|
||||
{
|
||||
matcher: 'write_file',
|
||||
hooks: [
|
||||
{
|
||||
type: 'command',
|
||||
command: beforeToolPath,
|
||||
timeout: 5000,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
AfterTool: [
|
||||
{
|
||||
matcher: 'write_file',
|
||||
hooks: [
|
||||
{
|
||||
type: 'command',
|
||||
command: afterToolPath,
|
||||
timeout: 5000,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const prompt =
|
||||
'Create a file called multi-event-test.txt with content ' +
|
||||
'"testing multiple events", and then please reply with ' +
|
||||
'everything I say just after this:"';
|
||||
const result = await rig.run(prompt);
|
||||
|
||||
// Should execute write_file tool
|
||||
const foundWriteFile = await rig.waitForToolCall('write_file');
|
||||
expect(foundWriteFile).toBeTruthy();
|
||||
|
||||
// File should be created
|
||||
const fileContent = rig.readFile('multi-event-test.txt');
|
||||
expect(fileContent).toContain('testing multiple events');
|
||||
|
||||
// Result should contain context from all hooks
|
||||
expect(result).toContain('BeforeTool: File operation logged');
|
||||
|
||||
// Should generate hook telemetry
|
||||
let hookTelemetryFound = await rig.waitForTelemetryEvent('hook_call');
|
||||
expect(hookTelemetryFound).toBeTruthy();
|
||||
hookTelemetryFound = await rig.waitForTelemetryEvent('api_request');
|
||||
const apiRequests = rig.readAllApiRequest();
|
||||
const apiRequestsTexts = apiRequests
|
||||
?.filter(
|
||||
(request) =>
|
||||
'attributes' in request &&
|
||||
typeof request['attributes'] === 'object' &&
|
||||
request['attributes'] !== null &&
|
||||
'request_text' in request['attributes'] &&
|
||||
typeof request['attributes']['request_text'] === 'string',
|
||||
)
|
||||
.map((request) => request['attributes']['request_text']);
|
||||
expect(apiRequestsTexts).toBeDefined();
|
||||
let hasBeforeAgentHookContext = false;
|
||||
let hasAfterToolHookContext = false;
|
||||
for (const requestText of apiRequestsTexts) {
|
||||
if (requestText.includes('BeforeAgent: User request processed')) {
|
||||
hasBeforeAgentHookContext = true;
|
||||
}
|
||||
if (
|
||||
requestText.includes('AfterTool: Operation completed successfully')
|
||||
) {
|
||||
hasAfterToolHookContext = true;
|
||||
}
|
||||
}
|
||||
expect(hasBeforeAgentHookContext).toBeTruthy();
|
||||
expect(hasAfterToolHookContext).toBeTruthy();
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
describe('Hook Error Handling', () => {
|
||||
it('should handle hook failures gracefully', async () => {
|
||||
await rig.setup('should handle hook failures gracefully', {
|
||||
fakeResponsesPath: join(
|
||||
import.meta.dirname,
|
||||
'hooks-system.error-handling.responses',
|
||||
),
|
||||
});
|
||||
// Create a hook script that fails
|
||||
const failingHookScript = `#!/bin/bash
|
||||
echo "Hook encountered an error" >&2
|
||||
exit 1`;
|
||||
|
||||
const workingHookScript = `#!/bin/bash
|
||||
echo '{"decision": "allow", "reason": "Working hook succeeded"}'`;
|
||||
|
||||
const failingPath = join(rig.testDir!, 'failing_hook.sh');
|
||||
const workingPath = join(rig.testDir!, 'working_hook.sh');
|
||||
|
||||
writeFileSync(failingPath, failingHookScript);
|
||||
writeFileSync(workingPath, workingHookScript);
|
||||
const { execSync } = await import('node:child_process');
|
||||
execSync(`chmod +x "${failingPath}"`);
|
||||
execSync(`chmod +x "${workingPath}"`);
|
||||
|
||||
await rig.setup('should handle hook failures gracefully', {
|
||||
settings: {
|
||||
tools: {
|
||||
enableHooks: true,
|
||||
},
|
||||
hooks: {
|
||||
BeforeTool: [
|
||||
{
|
||||
hooks: [
|
||||
{
|
||||
type: 'command',
|
||||
command: failingPath,
|
||||
timeout: 5000,
|
||||
},
|
||||
{
|
||||
type: 'command',
|
||||
command: workingPath,
|
||||
timeout: 5000,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const prompt =
|
||||
'Create a file called error-test.txt with content "testing error handling"';
|
||||
await rig.run(prompt);
|
||||
|
||||
// Despite one hook failing, the working hook should still allow the operation
|
||||
const foundWriteFile = await rig.waitForToolCall('write_file');
|
||||
expect(foundWriteFile).toBeTruthy();
|
||||
|
||||
// File should be created
|
||||
const fileContent = rig.readFile('error-test.txt');
|
||||
expect(fileContent).toContain('testing error handling');
|
||||
|
||||
// Should generate hook telemetry
|
||||
const hookTelemetryFound = await rig.waitForTelemetryEvent('hook_call');
|
||||
expect(hookTelemetryFound).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Hook Telemetry and Observability', () => {
|
||||
it('should generate telemetry events for hook executions', async () => {
|
||||
await rig.setup('should generate telemetry events for hook executions', {
|
||||
fakeResponsesPath: join(
|
||||
import.meta.dirname,
|
||||
'hooks-system.telemetry.responses',
|
||||
),
|
||||
});
|
||||
const hookScript = `#!/bin/bash
|
||||
echo '{"decision": "allow", "reason": "Telemetry test hook"}'`;
|
||||
|
||||
const scriptPath = join(rig.testDir!, 'telemetry_hook.sh');
|
||||
writeFileSync(scriptPath, hookScript);
|
||||
const { execSync } = await import('node:child_process');
|
||||
execSync(`chmod +x "${scriptPath}"`);
|
||||
|
||||
await rig.setup('should generate telemetry events for hook executions', {
|
||||
settings: {
|
||||
tools: {
|
||||
enableHooks: true,
|
||||
},
|
||||
hooks: {
|
||||
BeforeTool: [
|
||||
{
|
||||
hooks: [
|
||||
{
|
||||
type: 'command',
|
||||
command: scriptPath,
|
||||
timeout: 5000,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const prompt = 'Create a file called telemetry-test.txt';
|
||||
await rig.run(prompt);
|
||||
|
||||
// Should execute the tool
|
||||
const foundWriteFile = await rig.waitForToolCall('write_file');
|
||||
expect(foundWriteFile).toBeTruthy();
|
||||
|
||||
// Should generate hook telemetry
|
||||
const hookTelemetryFound = await rig.waitForTelemetryEvent('hook_call');
|
||||
expect(hookTelemetryFound).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -7,7 +7,6 @@
|
||||
import { expect, describe, it, beforeEach, afterEach } from 'vitest';
|
||||
import { TestRig } from './test-helper.js';
|
||||
import { join } from 'node:path';
|
||||
import { ExitCodes } from '@google/gemini-cli-core/src/index.js';
|
||||
|
||||
describe('JSON output', () => {
|
||||
let rig: TestRig;
|
||||
@@ -82,7 +81,7 @@ describe('JSON output', () => {
|
||||
|
||||
expect(payload.error).toBeDefined();
|
||||
expect(payload.error.type).toBe('Error');
|
||||
expect(payload.error.code).toBe(ExitCodes.FATAL_AUTHENTICATION_ERROR);
|
||||
expect(payload.error.code).toBe(1);
|
||||
expect(payload.error.message).toContain(
|
||||
"enforced authentication type is 'gemini-api-key'",
|
||||
);
|
||||
|
||||
@@ -27,7 +27,7 @@ describe('mixed input crash prevention', () => {
|
||||
expect(error).toBeInstanceOf(Error);
|
||||
const err = error as Error;
|
||||
|
||||
expect(err.message).toContain('Process exited with code 42');
|
||||
expect(err.message).toContain('Process exited with code 1');
|
||||
expect(err.message).toContain(
|
||||
'--prompt-interactive flag cannot be used when input is piped',
|
||||
);
|
||||
|
||||
@@ -159,14 +159,6 @@ interface ParsedLog {
|
||||
success?: boolean;
|
||||
duration_ms?: number;
|
||||
request_text?: string;
|
||||
hook_event_name?: string;
|
||||
hook_name?: string;
|
||||
hook_input?: Record<string, unknown>;
|
||||
hook_output?: Record<string, unknown>;
|
||||
exit_code?: number;
|
||||
stdout?: string;
|
||||
stderr?: string;
|
||||
error?: string;
|
||||
};
|
||||
scopeMetrics?: {
|
||||
metrics: {
|
||||
@@ -960,16 +952,6 @@ export class TestRig {
|
||||
return logs;
|
||||
}
|
||||
|
||||
readAllApiRequest(): ParsedLog[] {
|
||||
const logs = this._readAndParseTelemetryLog();
|
||||
const apiRequests = logs.filter(
|
||||
(logData) =>
|
||||
logData.attributes &&
|
||||
logData.attributes['event.name'] === 'gemini_cli.api_request',
|
||||
);
|
||||
return apiRequests;
|
||||
}
|
||||
|
||||
readLastApiRequest(): ParsedLog | null {
|
||||
const logs = this._readAndParseTelemetryLog();
|
||||
const apiRequests = logs.filter(
|
||||
@@ -1046,66 +1028,4 @@ export class TestRig {
|
||||
await run.expectText(' Type your message or @path/to/file', 30000);
|
||||
return run;
|
||||
}
|
||||
|
||||
readHookLogs() {
|
||||
const parsedLogs = this._readAndParseTelemetryLog();
|
||||
const logs: {
|
||||
hookCall: {
|
||||
hook_event_name: string;
|
||||
hook_name: string;
|
||||
hook_input: Record<string, unknown>;
|
||||
hook_output: Record<string, unknown>;
|
||||
exit_code: number;
|
||||
stdout: string;
|
||||
stderr: string;
|
||||
duration_ms: number;
|
||||
success: boolean;
|
||||
error: string;
|
||||
};
|
||||
}[] = [];
|
||||
|
||||
for (const logData of parsedLogs) {
|
||||
// Look for tool call logs
|
||||
if (
|
||||
logData.attributes &&
|
||||
logData.attributes['event.name'] === 'gemini_cli.hook_call'
|
||||
) {
|
||||
logs.push({
|
||||
hookCall: {
|
||||
hook_event_name: logData.attributes.hook_event_name ?? '',
|
||||
hook_name: logData.attributes.hook_name ?? '',
|
||||
hook_input: logData.attributes.hook_input ?? {},
|
||||
hook_output: logData.attributes.hook_output ?? {},
|
||||
exit_code: logData.attributes.exit_code ?? 0,
|
||||
stdout: logData.attributes.stdout ?? '',
|
||||
stderr: logData.attributes.stderr ?? '',
|
||||
duration_ms: logData.attributes.duration_ms ?? 0,
|
||||
success: logData.attributes.success ?? false,
|
||||
error: logData.attributes.error ?? '',
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return logs;
|
||||
}
|
||||
|
||||
async pollCommand(
|
||||
commandFn: () => Promise<void>,
|
||||
predicateFn: () => boolean,
|
||||
timeout: number = 30000,
|
||||
interval: number = 1000,
|
||||
) {
|
||||
const startTime = Date.now();
|
||||
while (Date.now() - startTime < timeout) {
|
||||
await commandFn();
|
||||
// Give it a moment to process
|
||||
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||
if (predicateFn()) {
|
||||
return;
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, interval));
|
||||
}
|
||||
throw new Error(`pollCommand timed out after ${timeout}ms`);
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+25
-29
@@ -1,17 +1,17 @@
|
||||
{
|
||||
"name": "@google/gemini-cli",
|
||||
"version": "0.20.0",
|
||||
"version": "0.18.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@google/gemini-cli",
|
||||
"version": "0.20.0",
|
||||
"version": "0.18.1",
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"ink": "npm:@jrichman/ink@6.4.6",
|
||||
"ink": "npm:@jrichman/ink@6.4.5",
|
||||
"latest-version": "^9.0.0",
|
||||
"simple-git": "^3.28.0"
|
||||
},
|
||||
@@ -2047,9 +2047,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@modelcontextprotocol/sdk": {
|
||||
"version": "1.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.23.0.tgz",
|
||||
"integrity": "sha512-MCGd4K9aZKvuSqdoBkdMvZNcYXCkZRYVs/Gh92mdV5IHbctX9H9uIvd4X93+9g8tBbXv08sxc/QHXTzf8y65bA==",
|
||||
"version": "1.22.0",
|
||||
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.22.0.tgz",
|
||||
"integrity": "sha512-VUpl106XVTCpDmTBil2ehgJZjhyLY2QZikzF8NvTXtLRF1CvO5iEE2UNZdVIUer35vFOwMKYeUGbjJtvPWan3g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ajv": "^8.17.1",
|
||||
@@ -2063,22 +2063,18 @@
|
||||
"express-rate-limit": "^7.5.0",
|
||||
"pkce-challenge": "^5.0.0",
|
||||
"raw-body": "^3.0.0",
|
||||
"zod": "^3.25 || ^4.0",
|
||||
"zod-to-json-schema": "^3.25.0"
|
||||
"zod": "^3.23.8",
|
||||
"zod-to-json-schema": "^3.24.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@cfworker/json-schema": "^4.1.1",
|
||||
"zod": "^3.25 || ^4.0"
|
||||
"@cfworker/json-schema": "^4.1.1"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@cfworker/json-schema": {
|
||||
"optional": true
|
||||
},
|
||||
"zod": {
|
||||
"optional": false
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -10315,9 +10311,9 @@
|
||||
},
|
||||
"node_modules/ink": {
|
||||
"name": "@jrichman/ink",
|
||||
"version": "6.4.6",
|
||||
"resolved": "https://registry.npmjs.org/@jrichman/ink/-/ink-6.4.6.tgz",
|
||||
"integrity": "sha512-QHl6l1cl3zPCaRMzt9TUbTX6Q5SzvkGEZDDad0DmSf5SPmT1/90k6pGPejEvDCJprkitwObXpPaTWGHItqsy4g==",
|
||||
"version": "6.4.5",
|
||||
"resolved": "https://registry.npmjs.org/@jrichman/ink/-/ink-6.4.5.tgz",
|
||||
"integrity": "sha512-mIDkZqtJbedL9XDOoqoJt3S8aGQVqEJYnCnSeLlYzkpUWCsSWC0hW40yJ0DLH86lcl8k5R5lv/9C2i/3746nWw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@alcalzone/ansi-tokenize": "^0.2.1",
|
||||
@@ -17604,17 +17600,17 @@
|
||||
}
|
||||
},
|
||||
"node_modules/zod-to-json-schema": {
|
||||
"version": "3.25.0",
|
||||
"resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.0.tgz",
|
||||
"integrity": "sha512-HvWtU2UG41LALjajJrML6uQejQhNJx+JBO9IflpSja4R03iNWfKXrj6W2h7ljuLyc1nKS+9yDyL/9tD1U/yBnQ==",
|
||||
"version": "3.24.6",
|
||||
"resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.24.6.tgz",
|
||||
"integrity": "sha512-h/z3PKvcTcTetyjl1fkj79MHNEjm+HpD6NXheWjzOekY7kV+lwDYnHw+ivHkijnCSMz1yJaWBD9vu/Fcmk+vEg==",
|
||||
"license": "ISC",
|
||||
"peerDependencies": {
|
||||
"zod": "^3.25 || ^4"
|
||||
"zod": "^3.24.1"
|
||||
}
|
||||
},
|
||||
"packages/a2a-server": {
|
||||
"name": "@google/gemini-cli-a2a-server",
|
||||
"version": "0.20.0",
|
||||
"version": "0.18.1",
|
||||
"dependencies": {
|
||||
"@a2a-js/sdk": "^0.3.2",
|
||||
"@google-cloud/storage": "^7.16.0",
|
||||
@@ -17904,12 +17900,12 @@
|
||||
},
|
||||
"packages/cli": {
|
||||
"name": "@google/gemini-cli",
|
||||
"version": "0.20.0",
|
||||
"version": "0.18.1",
|
||||
"dependencies": {
|
||||
"@google/gemini-cli-core": "file:../core",
|
||||
"@google/genai": "1.30.0",
|
||||
"@iarna/toml": "^2.2.5",
|
||||
"@modelcontextprotocol/sdk": "^1.23.0",
|
||||
"@modelcontextprotocol/sdk": "^1.15.1",
|
||||
"@types/update-notifier": "^6.0.8",
|
||||
"ansi-regex": "^6.2.2",
|
||||
"clipboardy": "^5.0.0",
|
||||
@@ -17921,7 +17917,7 @@
|
||||
"fzf": "^0.5.2",
|
||||
"glob": "^12.0.0",
|
||||
"highlight.js": "^11.11.1",
|
||||
"ink": "npm:@jrichman/ink@6.4.6",
|
||||
"ink": "npm:@jrichman/ink@6.4.5",
|
||||
"ink-gradient": "^3.0.0",
|
||||
"ink-spinner": "^5.0.0",
|
||||
"latest-version": "^9.0.0",
|
||||
@@ -18005,7 +18001,7 @@
|
||||
},
|
||||
"packages/core": {
|
||||
"name": "@google/gemini-cli-core",
|
||||
"version": "0.20.0",
|
||||
"version": "0.18.1",
|
||||
"dependencies": {
|
||||
"@google-cloud/logging": "^11.2.1",
|
||||
"@google-cloud/opentelemetry-cloud-monitoring-exporter": "^0.21.0",
|
||||
@@ -18013,7 +18009,7 @@
|
||||
"@google/genai": "1.30.0",
|
||||
"@iarna/toml": "^2.2.5",
|
||||
"@joshua.litt/get-ripgrep": "^0.0.3",
|
||||
"@modelcontextprotocol/sdk": "^1.23.0",
|
||||
"@modelcontextprotocol/sdk": "^1.11.0",
|
||||
"@opentelemetry/api": "^1.9.0",
|
||||
"@opentelemetry/exporter-logs-otlp-grpc": "^0.203.0",
|
||||
"@opentelemetry/exporter-logs-otlp-http": "^0.203.0",
|
||||
@@ -18149,7 +18145,7 @@
|
||||
},
|
||||
"packages/test-utils": {
|
||||
"name": "@google/gemini-cli-test-utils",
|
||||
"version": "0.20.0",
|
||||
"version": "0.18.1",
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"typescript": "^5.3.3"
|
||||
@@ -18160,10 +18156,10 @@
|
||||
},
|
||||
"packages/vscode-ide-companion": {
|
||||
"name": "gemini-cli-vscode-ide-companion",
|
||||
"version": "0.20.0",
|
||||
"version": "0.18.1",
|
||||
"license": "LICENSE",
|
||||
"dependencies": {
|
||||
"@modelcontextprotocol/sdk": "^1.23.0",
|
||||
"@modelcontextprotocol/sdk": "^1.15.1",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^5.1.0",
|
||||
"zod": "^3.25.76"
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@google/gemini-cli",
|
||||
"version": "0.20.0",
|
||||
"version": "0.18.1",
|
||||
"engines": {
|
||||
"node": ">=20.0.0"
|
||||
},
|
||||
@@ -14,7 +14,7 @@
|
||||
"url": "git+https://github.com/google-gemini/gemini-cli.git"
|
||||
},
|
||||
"config": {
|
||||
"sandboxImageUri": "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.20.0"
|
||||
"sandboxImageUri": "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.18.1"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "cross-env NODE_ENV=development node scripts/start.js",
|
||||
@@ -62,7 +62,7 @@
|
||||
"pre-commit": "node scripts/pre-commit.js"
|
||||
},
|
||||
"overrides": {
|
||||
"ink": "npm:@jrichman/ink@6.4.6",
|
||||
"ink": "npm:@jrichman/ink@6.4.5",
|
||||
"wrap-ansi": "9.0.2",
|
||||
"cliui": {
|
||||
"wrap-ansi": "7.0.0"
|
||||
@@ -119,7 +119,7 @@
|
||||
"yargs": "^17.7.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"ink": "npm:@jrichman/ink@6.4.6",
|
||||
"ink": "npm:@jrichman/ink@6.4.5",
|
||||
"latest-version": "^9.0.0",
|
||||
"simple-git": "^3.28.0"
|
||||
},
|
||||
|
||||
@@ -153,7 +153,7 @@ syntax = "proto3";
|
||||
|
||||
import "google/protobuf/struct.proto";
|
||||
|
||||
// ToolCall is the central message representing a tool's execution lifecycle.
|
||||
// ToolCall is the central message represeting a tool's execution lifecycle.
|
||||
// The entire object is sent from the agent to client on every update.
|
||||
message ToolCall {
|
||||
// A unique identifier, assigned by the agent
|
||||
@@ -197,7 +197,7 @@ enum ToolCallStatus {
|
||||
CANCELLED = 5;
|
||||
}
|
||||
|
||||
// ToolOutput represents the final, successful, output of a tool
|
||||
// ToolOuput represents the final, successful, output of a tool
|
||||
message ToolOutput {
|
||||
oneof result {
|
||||
string text = 1;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user