Skip to content

Commit d0c9cbc

Browse files
authored
Merge branch 'google-gemini:main' into main
2 parents a0a2394 + cba2720 commit d0c9cbc

File tree

83 files changed

+4329
-1507
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+4329
-1507
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,14 @@ gemini
9797

9898
- Learn how to [contribute to or build from the source](./CONTRIBUTING.md).
9999
- Explore the available **[CLI Commands](./docs/cli/commands.md)**.
100-
- If you encounter any issues, review the **[Troubleshooting guide](./docs/troubleshooting.md)**.
100+
- If you encounter any issues, review the **[troubleshooting guide](./docs/troubleshooting.md)**.
101101
- For more comprehensive documentation, see the [full documentation](./docs/index.md).
102102
- Take a look at some [popular tasks](#popular-tasks) for more inspiration.
103+
- Check out our **[Official Roadmap](./ROADMAP.md)**
103104

104105
### Troubleshooting
105106

106-
Head over to the [troubleshooting](docs/troubleshooting.md) guide if you're
107+
Head over to the [troubleshooting guide](docs/troubleshooting.md) if you're
107108
having issues.
108109

109110
## Popular tasks

ROADMAP.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Gemini CLI Roadmap
2+
3+
The [Official Gemini CLI Roadmap](https://github.com/orgs/google-gemini/projects/11/)
4+
5+
Gemini CLI is an open-source AI agent that brings the power of Gemini directly into your terminal. It provides lightweight access to Gemini, giving you the most direct path from your prompt to our model.
6+
7+
This document outlines our approach to the Gemini CLI roadmap. Here, you'll find our guiding principles and a breakdown of the key areas we are
8+
focused on for development. Our roadmap is not a static list but a dynamic set of priorities that are tracked live in our GitHub Issues.
9+
10+
As an [Apache 2.0 open source project](https://github.com/google-gemini/gemini-cli?tab=Apache-2.0-1-ov-file#readme), we appreciate and welcome [public contributions](https://github.com/google-gemini/gemini-cli/blob/main/CONTRIBUTING.md), and will give first priority to those contributions aligned with our roadmap. If you want to propose a new feature or change to our roadmap, please start by [opening an issue for discussion](https://github.com/google-gemini/gemini-cli/issues/new/choose).
11+
12+
## Disclaimer
13+
14+
This roadmap represents our current thinking and is for informational purposes only. It is not a commitment or a guarantee of future delivery. The development, release, and timing of any features are subject to change, and we may update the roadmap based on community discussions as well as when our priorities evolve.
15+
16+
## Guiding Principles
17+
18+
Our development is guided by the following principles:
19+
20+
- **Power & Simplicity:** Deliver access to state-of-the-art Gemini models with an intuitive and easy-to-use lightweight command-line interface.
21+
- **Extensibility:** An adaptable agent to help you with a variety of use cases and environments along with the ability to run these agents anywhere.
22+
- **Intelligent:** Gemini CLI should be reliably ranked among the best agentic tools as measured by benchmarks like SWE Bench, Terminal Bench, and CSAT.
23+
- **Free and Open Source:** Foster a thriving open source community where cost isn’t a barrier to personal use, and PRs get merged quickly. This means resolving and closing issues, pull requests, and discussion posts quickly.
24+
25+
## How the Roadmap Works
26+
27+
Our roadmap is managed directly through Github Issues. See our entry point Roadmap Issue [here](https://github.com/google-gemini/gemini-cli/issues/4191). This approach allows for transparency and gives you a direct way to learn more or get involved with any specific initiative. All our roadmap items will be tagged as Type:`Feature` and Label:`maintainer` for features we are actively working on, or Type:`Task` and Label:`maintainer` for a more detailed list of tasks.
28+
29+
Issues are organized to provide key information at a glance:
30+
31+
- **Target Quarter:** `Milestone` denotes the anticipated delivery timeline.
32+
- **Feature Area:** Labels such as `area/model` or `area/tooling` categorizes the work.
33+
- **Issue Type:** _Workstream_ => _Epics_ => _Features_ => _Tasks|Bugs_
34+
35+
To see what we're working on, you can filter our issues by these dimensions. See all our items [here](https://github.com/orgs/google-gemini/projects/11/views/19)
36+
37+
## Focus Areas
38+
39+
To better organize our efforts, we categorize our work into several key feature areas. These labels are used on our GitHub Issues to help you filter and
40+
find initiatives that interest you.
41+
42+
- **Authentication:** Secure user access via API keys, Gemini Code Assist login etc.
43+
- **Model:** Support new Gemini models, multi-modality, local execution, and performance tuning.
44+
- **User Experience:** Improve the CLI's usability, performance, interactive features, and documentation.
45+
- **Tooling:** Built-in tools and the MCP ecosystem.
46+
- **Core:** Core functionality of the CLI
47+
- **Extensibility:** Bringing Gemini CLI to other surfaces e.g. GitHub.
48+
- **Contribution:** Improve the contribution process via test automation and CI/CD pipeline enhancements.
49+
- **Platform:** Manage installation, OS support, and the underlying CLI framework.
50+
- **Quality:** Focus on testing, reliability, performance, and overall product quality.
51+
- **Background Agents:** Enable long-running, autonomous tasks and proactive assistance.
52+
- **Security and Privacy:** For all things related to security and privacy
53+
54+
## How to Contribute
55+
56+
Gemini CLI is an open-source project, and we welcome contributions from the community! Whether you're a developer, a designer, or just an enthusiastic user you can find our [Community Guidelines here](https://github.com/google-gemini/gemini-cli/blob/main/CONTRIBUTING.md) to learn how to get started. There are many ways to get involved:
57+
58+
- **Roadmap:** Please review and find areas in our [roadmap](https://github.com/google-gemini/gemini-cli/issues/4191) that you would like to contribute to. Contributions based on this will be easiest to integrate with.
59+
- **Report Bugs:** If you find an issue, please create a bug(https://github.com/google-gemini/gemini-cli/issues/new?template=bug_report.yml) with as much detail as possible. If you believe it is a critical breaking issue preventing direct CLI usage, please tag it as `priorty/p0`.
60+
- **Suggest Features:** Have a great idea? We'd love to hear it! Open a [feature request](https://github.com/google-gemini/gemini-cli/issues/new?template=feature_request.yml).
61+
- **Contribute Code:** Check out our [CONTRIBUTING.md](https://github.com/google-gemini/gemini-cli/blob/main/CONTRIBUTING.md) file for guidelines on how to submit pull requests. We have a list of "good first issues" for new contributors.
62+
- **Write Documentation:** Help us improve our documentation, tutorials, and examples.
63+
We are excited about the future of Gemini CLI and look forward to building it with you!

docs/cli/authentication.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The Gemini CLI requires you to authenticate with Google's AI services. On initia
88
- Note that the web login must be done in a browser that can communicate with the machine Gemini CLI is being run from. (Specifically, the browser will be redirected to a localhost url that Gemini CLI will be listening on).
99
- <a id="workspace-gca">Users may have to specify a GOOGLE_CLOUD_PROJECT if:</a>
1010
1. You have a Google Workspace account. Google Workspace is a paid service for businesses and organizations that provides a suite of productivity tools, including a custom email domain (e.g. your-name@your-company.com), enhanced security features, and administrative controls. These accounts are often managed by an employer or school.
11-
1. You have received a free Code Assist license through the [Google Developer Program](https://developers.google.com/program/plans-and-pricing) (including qualified Google Developer Experts)
11+
1. You have received a Gemini Code Assist license through the [Google Developer Program](https://developers.google.com/program/plans-and-pricing) (including qualified Google Developer Experts)
1212
1. You have been assigned a license to a current Gemini Code Assist standard or enterprise subscription.
1313
1. You are using the product outside the [supported regions](https://developers.google.com/gemini-code-assist/resources/available-locations) for free individual usage.
1414
1. You are a Google account holder under the age of 18

docs/cli/configuration.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,18 @@ In addition to a project settings file, a project's `.gemini` directory can cont
8181
`excludeTools` for `run_shell_command` are based on simple string matching and can be easily bypassed. This feature is **not a security mechanism** and should not be relied upon to safely execute untrusted code. It is recommended to use `coreTools` to explicitly select commands
8282
that can be executed.
8383

84+
- **`allowMCPServers`** (array of strings):
85+
- **Description:** Allows you to specify a list of MCP server names that should be made available to the model. This can be used to restrict the set of MCP servers to connect to. Note that this will be ignored if `--allowed-mcp-server-names` is set.
86+
- **Default:** All MCP servers are available for use by the Gemini model.
87+
- **Example:** `"allowMCPServers": ["myPythonServer"]`.
88+
- **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 MCP servers of their own. This should not be used as an airtight security mechanism.
89+
90+
- **`excludeMCPServers`** (array of strings):
91+
- **Description:** Allows you to specify a list of MCP server names that should be excluded from the model. A server listed in both `excludeMCPServers` and `allowMCPServers` is excluded. Note that this will be ignored if `--allowed-mcp-server-names` is set.
92+
- **Default**: No MCP servers excluded.
93+
- **Example:** `"excludeMCPServers": ["myNodeServer"]`.
94+
- **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 MCP servers of their own. This should not be used as an airtight security mechanism.
95+
8496
- **`autoAccept`** (boolean):
8597
- **Description:** Controls whether the CLI automatically accepts and executes tool calls that are considered safe (e.g., read-only operations) without explicit user confirmation. If set to `true`, the CLI will bypass the confirmation prompt for tools deemed safe.
8698
- **Default:** `false`
@@ -206,6 +218,19 @@ In addition to a project settings file, a project's `.gemini` directory can cont
206218
"maxSessionTurns": 10
207219
```
208220

221+
- **`summarizeToolOutput`** (object):
222+
- **Description:** Enables or disables the summarization of tool output. You can specify the token budget for the summarization using the `tokenBudget` setting.
223+
- Note: Currently only the `run_shell_command` tool is supported.
224+
- **Default:** `{}` (Disabled by default)
225+
- **Example:**
226+
```json
227+
"summarizeToolOutput": {
228+
"run_shell_command": {
229+
"tokenBudget": 2000
230+
}
231+
}
232+
```
233+
209234
### Example `settings.json`:
210235

211236
```json
@@ -232,7 +257,12 @@ In addition to a project settings file, a project's `.gemini` directory can cont
232257
"usageStatisticsEnabled": true,
233258
"hideTips": false,
234259
"hideBanner": false,
235-
"maxSessionTurns": 10
260+
"maxSessionTurns": 10,
261+
"summarizeToolOutput": {
262+
"run_shell_command": {
263+
"tokenBudget": 100
264+
}
265+
}
236266
}
237267
```
238268

package-lock.json

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/cli/src/config/config.test.ts

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,66 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
725725
const config = await loadCliConfig(baseSettings, [], 'test-session', argv);
726726
expect(config.getMcpServers()).toEqual({});
727727
});
728+
729+
it('should read allowMCPServers from settings', async () => {
730+
process.argv = ['node', 'script.js'];
731+
const argv = await parseArguments();
732+
const settings: Settings = {
733+
...baseSettings,
734+
allowMCPServers: ['server1', 'server2'],
735+
};
736+
const config = await loadCliConfig(settings, [], 'test-session', argv);
737+
expect(config.getMcpServers()).toEqual({
738+
server1: { url: 'http://localhost:8080' },
739+
server2: { url: 'http://localhost:8081' },
740+
});
741+
});
742+
743+
it('should read excludeMCPServers from settings', async () => {
744+
process.argv = ['node', 'script.js'];
745+
const argv = await parseArguments();
746+
const settings: Settings = {
747+
...baseSettings,
748+
excludeMCPServers: ['server1', 'server2'],
749+
};
750+
const config = await loadCliConfig(settings, [], 'test-session', argv);
751+
expect(config.getMcpServers()).toEqual({
752+
server3: { url: 'http://localhost:8082' },
753+
});
754+
});
755+
756+
it('should override allowMCPServers with excludeMCPServers if overlapping ', async () => {
757+
process.argv = ['node', 'script.js'];
758+
const argv = await parseArguments();
759+
const settings: Settings = {
760+
...baseSettings,
761+
excludeMCPServers: ['server1'],
762+
allowMCPServers: ['server1', 'server2'],
763+
};
764+
const config = await loadCliConfig(settings, [], 'test-session', argv);
765+
expect(config.getMcpServers()).toEqual({
766+
server2: { url: 'http://localhost:8081' },
767+
});
768+
});
769+
770+
it('should prioritize mcp server flag if set ', async () => {
771+
process.argv = [
772+
'node',
773+
'script.js',
774+
'--allowed-mcp-server-names',
775+
'server1',
776+
];
777+
const argv = await parseArguments();
778+
const settings: Settings = {
779+
...baseSettings,
780+
excludeMCPServers: ['server1'],
781+
allowMCPServers: ['server2'],
782+
};
783+
const config = await loadCliConfig(settings, [], 'test-session', argv);
784+
expect(config.getMcpServers()).toEqual({
785+
server1: { url: 'http://localhost:8080' },
786+
});
787+
});
728788
});
729789

730790
describe('loadCliConfig extensions', () => {
@@ -780,6 +840,7 @@ describe('loadCliConfig ideMode', () => {
780840
// Explicitly delete TERM_PROGRAM and SANDBOX before each test
781841
delete process.env.TERM_PROGRAM;
782842
delete process.env.SANDBOX;
843+
delete process.env.GEMINI_CLI_IDE_SERVER_PORT;
783844
});
784845

785846
afterEach(() => {
@@ -816,6 +877,7 @@ describe('loadCliConfig ideMode', () => {
816877
process.argv = ['node', 'script.js', '--ide-mode'];
817878
const argv = await parseArguments();
818879
process.env.TERM_PROGRAM = 'vscode';
880+
process.env.GEMINI_CLI_IDE_SERVER_PORT = '3000';
819881
const settings: Settings = {};
820882
const config = await loadCliConfig(settings, [], 'test-session', argv);
821883
expect(config.getIdeMode()).toBe(true);
@@ -825,6 +887,7 @@ describe('loadCliConfig ideMode', () => {
825887
process.argv = ['node', 'script.js'];
826888
const argv = await parseArguments();
827889
process.env.TERM_PROGRAM = 'vscode';
890+
process.env.GEMINI_CLI_IDE_SERVER_PORT = '3000';
828891
const settings: Settings = { ideMode: true };
829892
const config = await loadCliConfig(settings, [], 'test-session', argv);
830893
expect(config.getIdeMode()).toBe(true);
@@ -834,6 +897,7 @@ describe('loadCliConfig ideMode', () => {
834897
process.argv = ['node', 'script.js', '--ide-mode'];
835898
const argv = await parseArguments();
836899
process.env.TERM_PROGRAM = 'vscode';
900+
process.env.GEMINI_CLI_IDE_SERVER_PORT = '3000';
837901
const settings: Settings = { ideMode: false };
838902
const config = await loadCliConfig(settings, [], 'test-session', argv);
839903
expect(config.getIdeMode()).toBe(true);
@@ -868,10 +932,11 @@ describe('loadCliConfig ideMode', () => {
868932
expect(config.getIdeMode()).toBe(false);
869933
});
870934

871-
it('should add __ide_server when ideMode is true', async () => {
935+
it('should add _ide_server when ideMode is true', async () => {
872936
process.argv = ['node', 'script.js', '--ide-mode'];
873937
const argv = await parseArguments();
874938
process.env.TERM_PROGRAM = 'vscode';
939+
process.env.GEMINI_CLI_IDE_SERVER_PORT = '3000';
875940
const settings: Settings = {};
876941
const config = await loadCliConfig(settings, [], 'test-session', argv);
877942
expect(config.getIdeMode()).toBe(true);
@@ -881,4 +946,16 @@ describe('loadCliConfig ideMode', () => {
881946
expect(mcpServers['_ide_server'].description).toBe('IDE connection');
882947
expect(mcpServers['_ide_server'].trust).toBe(false);
883948
});
949+
950+
it('should throw an error if ideMode is true and no port is set', async () => {
951+
process.argv = ['node', 'script.js', '--ide-mode'];
952+
const argv = await parseArguments();
953+
process.env.TERM_PROGRAM = 'vscode';
954+
const settings: Settings = {};
955+
await expect(
956+
loadCliConfig(settings, [], 'test-session', argv),
957+
).rejects.toThrow(
958+
"Could not run in ide mode, make sure you're running in vs code integrated terminal. Try running in a fresh terminal.",
959+
);
960+
});
884961
});

packages/cli/src/config/config.ts

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
FileDiscoveryService,
1919
TelemetryTarget,
2020
MCPServerConfig,
21+
IDE_SERVER_NAME,
2122
} from '@google/gemini-cli-core';
2223
import { Settings } from './settings.js';
2324

@@ -273,6 +274,26 @@ export async function loadCliConfig(
273274
let mcpServers = mergeMcpServers(settings, activeExtensions);
274275
const excludeTools = mergeExcludeTools(settings, activeExtensions);
275276

277+
if (!argv.allowedMcpServerNames) {
278+
if (settings.allowMCPServers) {
279+
const allowedNames = new Set(settings.allowMCPServers.filter(Boolean));
280+
if (allowedNames.size > 0) {
281+
mcpServers = Object.fromEntries(
282+
Object.entries(mcpServers).filter(([key]) => allowedNames.has(key)),
283+
);
284+
}
285+
}
286+
287+
if (settings.excludeMCPServers) {
288+
const excludedNames = new Set(settings.excludeMCPServers.filter(Boolean));
289+
if (excludedNames.size > 0) {
290+
mcpServers = Object.fromEntries(
291+
Object.entries(mcpServers).filter(([key]) => !excludedNames.has(key)),
292+
);
293+
}
294+
}
295+
}
296+
276297
if (argv.allowedMcpServerNames) {
277298
const allowedNames = new Set(argv.allowedMcpServerNames.filter(Boolean));
278299
if (allowedNames.size > 0) {
@@ -285,13 +306,20 @@ export async function loadCliConfig(
285306
}
286307

287308
if (ideMode) {
288-
mcpServers['_ide_server'] = new MCPServerConfig(
309+
const companionPort = process.env.GEMINI_CLI_IDE_SERVER_PORT;
310+
if (!companionPort) {
311+
throw new Error(
312+
"Could not run in ide mode, make sure you're running in vs code integrated terminal. Try running in a fresh terminal.",
313+
);
314+
}
315+
const httpUrl = `http://localhost:${companionPort}/mcp`;
316+
mcpServers[IDE_SERVER_NAME] = new MCPServerConfig(
289317
undefined, // command
290318
undefined, // args
291319
undefined, // env
292320
undefined, // cwd
293321
undefined, // url
294-
'http://localhost:3000/mcp', // httpUrl
322+
httpUrl, // httpUrl
295323
undefined, // headers
296324
undefined, // tcp
297325
undefined, // timeout
@@ -362,6 +390,7 @@ export async function loadCliConfig(
362390
version: e.config.version,
363391
})),
364392
noBrowser: !!process.env.NO_BROWSER,
393+
summarizeToolOutput: settings.summarizeToolOutput,
365394
ideMode,
366395
});
367396
}

packages/cli/src/config/settings.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ describe('Settings Loading and Merging', () => {
223223
const systemSettingsContent = {
224224
theme: 'system-theme',
225225
sandbox: false,
226+
allowMCPServers: ['server1', 'server2'],
226227
telemetry: { enabled: false },
227228
};
228229
const userSettingsContent = {
@@ -234,6 +235,7 @@ describe('Settings Loading and Merging', () => {
234235
sandbox: false,
235236
coreTools: ['tool1'],
236237
contextFileName: 'WORKSPACE_CONTEXT.md',
238+
allowMCPServers: ['server1', 'server2', 'server3'],
237239
};
238240

239241
(fs.readFileSync as Mock).mockImplementation(
@@ -259,6 +261,7 @@ describe('Settings Loading and Merging', () => {
259261
telemetry: { enabled: false },
260262
coreTools: ['tool1'],
261263
contextFileName: 'WORKSPACE_CONTEXT.md',
264+
allowMCPServers: ['server1', 'server2'],
262265
});
263266
});
264267

0 commit comments

Comments
 (0)