@wxp212/gemini-cli 0.28.3-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +393 -0
  3. package/bundle/builtin/skill-creator/SKILL.md +382 -0
  4. package/bundle/builtin/skill-creator/scripts/init_skill.cjs +235 -0
  5. package/bundle/builtin/skill-creator/scripts/package_skill.cjs +102 -0
  6. package/bundle/builtin/skill-creator/scripts/validate_skill.cjs +127 -0
  7. package/bundle/docs/architecture.md +80 -0
  8. package/bundle/docs/assets/connected_devtools.png +0 -0
  9. package/bundle/docs/assets/gemini-screenshot.png +0 -0
  10. package/bundle/docs/assets/monitoring-dashboard-logs.png +0 -0
  11. package/bundle/docs/assets/monitoring-dashboard-metrics.png +0 -0
  12. package/bundle/docs/assets/monitoring-dashboard-overview.png +0 -0
  13. package/bundle/docs/assets/release_patch.png +0 -0
  14. package/bundle/docs/assets/theme-ansi-light.png +0 -0
  15. package/bundle/docs/assets/theme-ansi.png +0 -0
  16. package/bundle/docs/assets/theme-atom-one.png +0 -0
  17. package/bundle/docs/assets/theme-ayu-light.png +0 -0
  18. package/bundle/docs/assets/theme-ayu.png +0 -0
  19. package/bundle/docs/assets/theme-custom.png +0 -0
  20. package/bundle/docs/assets/theme-default-light.png +0 -0
  21. package/bundle/docs/assets/theme-default.png +0 -0
  22. package/bundle/docs/assets/theme-dracula.png +0 -0
  23. package/bundle/docs/assets/theme-github-light.png +0 -0
  24. package/bundle/docs/assets/theme-github.png +0 -0
  25. package/bundle/docs/assets/theme-google-light.png +0 -0
  26. package/bundle/docs/assets/theme-xcode-light.png +0 -0
  27. package/bundle/docs/changelogs/index.md +743 -0
  28. package/bundle/docs/changelogs/latest.md +338 -0
  29. package/bundle/docs/changelogs/preview.md +437 -0
  30. package/bundle/docs/cli/authentication.md +3 -0
  31. package/bundle/docs/cli/checkpointing.md +94 -0
  32. package/bundle/docs/cli/cli-reference.md +101 -0
  33. package/bundle/docs/cli/commands.md +430 -0
  34. package/bundle/docs/cli/creating-skills.md +80 -0
  35. package/bundle/docs/cli/custom-commands.md +315 -0
  36. package/bundle/docs/cli/enterprise.md +582 -0
  37. package/bundle/docs/cli/gemini-ignore.md +71 -0
  38. package/bundle/docs/cli/gemini-md.md +108 -0
  39. package/bundle/docs/cli/generation-settings.md +210 -0
  40. package/bundle/docs/cli/headless.md +388 -0
  41. package/bundle/docs/cli/index.md +65 -0
  42. package/bundle/docs/cli/keyboard-shortcuts.md +141 -0
  43. package/bundle/docs/cli/model-routing.md +42 -0
  44. package/bundle/docs/cli/model.md +62 -0
  45. package/bundle/docs/cli/rewind.md +51 -0
  46. package/bundle/docs/cli/sandbox.md +171 -0
  47. package/bundle/docs/cli/session-management.md +158 -0
  48. package/bundle/docs/cli/settings.md +141 -0
  49. package/bundle/docs/cli/skills.md +112 -0
  50. package/bundle/docs/cli/system-prompt.md +125 -0
  51. package/bundle/docs/cli/telemetry.md +826 -0
  52. package/bundle/docs/cli/themes.md +235 -0
  53. package/bundle/docs/cli/token-caching.md +20 -0
  54. package/bundle/docs/cli/trusted-folders.md +95 -0
  55. package/bundle/docs/cli/tutorials/skills-getting-started.md +97 -0
  56. package/bundle/docs/cli/tutorials.md +87 -0
  57. package/bundle/docs/cli/uninstall.md +65 -0
  58. package/bundle/docs/core/index.md +107 -0
  59. package/bundle/docs/core/memport.md +246 -0
  60. package/bundle/docs/core/policy-engine.md +305 -0
  61. package/bundle/docs/core/remote-agents.md +84 -0
  62. package/bundle/docs/core/subagents.md +191 -0
  63. package/bundle/docs/core/tools-api.md +131 -0
  64. package/bundle/docs/examples/proxy-script.md +83 -0
  65. package/bundle/docs/extensions/best-practices.md +139 -0
  66. package/bundle/docs/extensions/index.md +45 -0
  67. package/bundle/docs/extensions/reference.md +336 -0
  68. package/bundle/docs/extensions/releasing.md +183 -0
  69. package/bundle/docs/extensions/writing-extensions.md +281 -0
  70. package/bundle/docs/faq.md +154 -0
  71. package/bundle/docs/get-started/authentication.md +321 -0
  72. package/bundle/docs/get-started/configuration-v1.md +880 -0
  73. package/bundle/docs/get-started/configuration.md +1602 -0
  74. package/bundle/docs/get-started/examples.md +219 -0
  75. package/bundle/docs/get-started/gemini-3.md +101 -0
  76. package/bundle/docs/get-started/index.md +71 -0
  77. package/bundle/docs/get-started/installation.md +141 -0
  78. package/bundle/docs/hooks/best-practices.md +677 -0
  79. package/bundle/docs/hooks/index.md +164 -0
  80. package/bundle/docs/hooks/reference.md +322 -0
  81. package/bundle/docs/hooks/writing-hooks.md +450 -0
  82. package/bundle/docs/ide-integration/ide-companion-spec.md +267 -0
  83. package/bundle/docs/ide-integration/index.md +202 -0
  84. package/bundle/docs/index.md +123 -0
  85. package/bundle/docs/integration-tests.md +211 -0
  86. package/bundle/docs/issue-and-pr-automation.md +134 -0
  87. package/bundle/docs/local-development.md +128 -0
  88. package/bundle/docs/mermaid/context.mmd +103 -0
  89. package/bundle/docs/mermaid/render-path.mmd +64 -0
  90. package/bundle/docs/npm.md +62 -0
  91. package/bundle/docs/quota-and-pricing.md +158 -0
  92. package/bundle/docs/release-confidence.md +164 -0
  93. package/bundle/docs/releases.md +540 -0
  94. package/bundle/docs/sidebar.json +152 -0
  95. package/bundle/docs/tools/file-system.md +216 -0
  96. package/bundle/docs/tools/index.md +98 -0
  97. package/bundle/docs/tools/mcp-server.md +1068 -0
  98. package/bundle/docs/tools/memory.md +54 -0
  99. package/bundle/docs/tools/shell.md +260 -0
  100. package/bundle/docs/tools/todos.md +57 -0
  101. package/bundle/docs/tools/web-fetch.md +59 -0
  102. package/bundle/docs/tools/web-search.md +42 -0
  103. package/bundle/docs/tos-privacy.md +96 -0
  104. package/bundle/docs/troubleshooting.md +173 -0
  105. package/bundle/gemini.js +538280 -0
  106. package/bundle/policies/discovered.toml +8 -0
  107. package/bundle/policies/plan.toml +86 -0
  108. package/bundle/policies/read-only.toml +51 -0
  109. package/bundle/policies/write.toml +78 -0
  110. package/bundle/policies/yolo.toml +32 -0
  111. package/bundle/sandbox-macos-permissive-closed.sb +32 -0
  112. package/bundle/sandbox-macos-permissive-open.sb +27 -0
  113. package/bundle/sandbox-macos-permissive-proxied.sb +37 -0
  114. package/bundle/sandbox-macos-restrictive-closed.sb +93 -0
  115. package/bundle/sandbox-macos-restrictive-open.sb +96 -0
  116. package/bundle/sandbox-macos-restrictive-proxied.sb +98 -0
  117. package/package.json +154 -0
@@ -0,0 +1,582 @@
1
+ # Gemini CLI for the enterprise
2
+
3
+ This document outlines configuration patterns and best practices for deploying
4
+ and managing Gemini CLI in an enterprise environment. By leveraging system-level
5
+ settings, administrators can enforce security policies, manage tool access, and
6
+ ensure a consistent experience for all users.
7
+
8
+ > **A note on security:** The patterns described in this document are intended
9
+ > to help administrators create a more controlled and secure environment for
10
+ > using Gemini CLI. However, they should not be considered a foolproof security
11
+ > boundary. A determined user with sufficient privileges on their local machine
12
+ > may still be able to circumvent these configurations. These measures are
13
+ > designed to prevent accidental misuse and enforce corporate policy in a
14
+ > managed environment, not to defend against a malicious actor with local
15
+ > administrative rights.
16
+
17
+ ## Centralized configuration: The system settings file
18
+
19
+ The most powerful tools for enterprise administration are the system-wide
20
+ settings files. These files allow you to define a baseline configuration
21
+ (`system-defaults.json`) and a set of overrides (`settings.json`) that apply to
22
+ all users on a machine. For a complete overview of configuration options, see
23
+ the [Configuration documentation](../get-started/configuration.md).
24
+
25
+ Settings are merged from four files. The precedence order for single-value
26
+ settings (like `theme`) is:
27
+
28
+ 1. System Defaults (`system-defaults.json`)
29
+ 2. User Settings (`~/.gemini/settings.json`)
30
+ 3. Workspace Settings (`<project>/.gemini/settings.json`)
31
+ 4. System Overrides (`settings.json`)
32
+
33
+ This means the System Overrides file has the final say. For settings that are
34
+ arrays (`includeDirectories`) or objects (`mcpServers`), the values are merged.
35
+
36
+ **Example of merging and precedence:**
37
+
38
+ Here is how settings from different levels are combined.
39
+
40
+ - **System defaults `system-defaults.json`:**
41
+
42
+ ```json
43
+ {
44
+ "ui": {
45
+ "theme": "default-corporate-theme"
46
+ },
47
+ "context": {
48
+ "includeDirectories": ["/etc/gemini-cli/common-context"]
49
+ }
50
+ }
51
+ ```
52
+
53
+ - **User `settings.json` (`~/.gemini/settings.json`):**
54
+
55
+ ```json
56
+ {
57
+ "ui": {
58
+ "theme": "user-preferred-dark-theme"
59
+ },
60
+ "mcpServers": {
61
+ "corp-server": {
62
+ "command": "/usr/local/bin/corp-server-dev"
63
+ },
64
+ "user-tool": {
65
+ "command": "npm start --prefix ~/tools/my-tool"
66
+ }
67
+ },
68
+ "context": {
69
+ "includeDirectories": ["~/gemini-context"]
70
+ }
71
+ }
72
+ ```
73
+
74
+ - **Workspace `settings.json` (`<project>/.gemini/settings.json`):**
75
+
76
+ ```json
77
+ {
78
+ "ui": {
79
+ "theme": "project-specific-light-theme"
80
+ },
81
+ "mcpServers": {
82
+ "project-tool": {
83
+ "command": "npm start"
84
+ }
85
+ },
86
+ "context": {
87
+ "includeDirectories": ["./project-context"]
88
+ }
89
+ }
90
+ ```
91
+
92
+ - **System overrides `settings.json`:**
93
+ ```json
94
+ {
95
+ "ui": {
96
+ "theme": "system-enforced-theme"
97
+ },
98
+ "mcpServers": {
99
+ "corp-server": {
100
+ "command": "/usr/local/bin/corp-server-prod"
101
+ }
102
+ },
103
+ "context": {
104
+ "includeDirectories": ["/etc/gemini-cli/global-context"]
105
+ }
106
+ }
107
+ ```
108
+
109
+ This results in the following merged configuration:
110
+
111
+ - **Final merged configuration:**
112
+ ```json
113
+ {
114
+ "ui": {
115
+ "theme": "system-enforced-theme"
116
+ },
117
+ "mcpServers": {
118
+ "corp-server": {
119
+ "command": "/usr/local/bin/corp-server-prod"
120
+ },
121
+ "user-tool": {
122
+ "command": "npm start --prefix ~/tools/my-tool"
123
+ },
124
+ "project-tool": {
125
+ "command": "npm start"
126
+ }
127
+ },
128
+ "context": {
129
+ "includeDirectories": [
130
+ "/etc/gemini-cli/common-context",
131
+ "~/gemini-context",
132
+ "./project-context",
133
+ "/etc/gemini-cli/global-context"
134
+ ]
135
+ }
136
+ }
137
+ ```
138
+
139
+ **Why:**
140
+
141
+ - **`theme`**: The value from the system overrides (`system-enforced-theme`) is
142
+ used, as it has the highest precedence.
143
+ - **`mcpServers`**: The objects are merged. The `corp-server` definition from
144
+ the system overrides takes precedence over the user's definition. The unique
145
+ `user-tool` and `project-tool` are included.
146
+ - **`includeDirectories`**: The arrays are concatenated in the order of System
147
+ Defaults, User, Workspace, and then System Overrides.
148
+
149
+ - **Location**:
150
+ - **Linux**: `/etc/gemini-cli/settings.json`
151
+ - **Windows**: `C:\ProgramData\gemini-cli\settings.json`
152
+ - **macOS**: `/Library/Application Support/GeminiCli/settings.json`
153
+ - The path can be overridden using the `GEMINI_CLI_SYSTEM_SETTINGS_PATH`
154
+ environment variable.
155
+ - **Control**: This file should be managed by system administrators and
156
+ protected with appropriate file permissions to prevent unauthorized
157
+ modification by users.
158
+
159
+ By using the system settings file, you can enforce the security and
160
+ configuration patterns described below.
161
+
162
+ ### Enforcing system settings with a wrapper script
163
+
164
+ While the `GEMINI_CLI_SYSTEM_SETTINGS_PATH` environment variable provides
165
+ flexibility, a user could potentially override it to point to a different
166
+ settings file, bypassing the centrally managed configuration. To mitigate this,
167
+ enterprises can deploy a wrapper script or alias that ensures the environment
168
+ variable is always set to the corporate-controlled path.
169
+
170
+ This approach ensures that no matter how the user calls the `gemini` command,
171
+ the enterprise settings are always loaded with the highest precedence.
172
+
173
+ **Example wrapper script:**
174
+
175
+ Administrators can create a script named `gemini` and place it in a directory
176
+ that appears earlier in the user's `PATH` than the actual Gemini CLI binary
177
+ (e.g., `/usr/local/bin/gemini`).
178
+
179
+ ```bash
180
+ #!/bin/bash
181
+
182
+ # Enforce the path to the corporate system settings file.
183
+ # This ensures that the company's configuration is always applied.
184
+ export GEMINI_CLI_SYSTEM_SETTINGS_PATH="/etc/gemini-cli/settings.json"
185
+
186
+ # Find the original gemini executable.
187
+ # This is a simple example; a more robust solution might be needed
188
+ # depending on the installation method.
189
+ REAL_GEMINI_PATH=$(type -aP gemini | grep -v "^$(type -P gemini)$" | head -n 1)
190
+
191
+ if [ -z "$REAL_GEMINI_PATH" ]; then
192
+ echo "Error: The original 'gemini' executable was not found." >&2
193
+ exit 1
194
+ fi
195
+
196
+ # Pass all arguments to the real Gemini CLI executable.
197
+ exec "$REAL_GEMINI_PATH" "$@"
198
+ ```
199
+
200
+ By deploying this script, the `GEMINI_CLI_SYSTEM_SETTINGS_PATH` is set within
201
+ the script's environment, and the `exec` command replaces the script process
202
+ with the actual Gemini CLI process, which inherits the environment variable.
203
+ This makes it significantly more difficult for a user to bypass the enforced
204
+ settings.
205
+
206
+ ## User isolation in shared environments
207
+
208
+ In shared compute environments (like ML experiment runners or shared build
209
+ servers), you can isolate Gemini CLI state by overriding the user's home
210
+ directory.
211
+
212
+ By default, Gemini CLI stores configuration and history in `~/.gemini`. You can
213
+ use the `GEMINI_CLI_HOME` environment variable to point to a unique directory
214
+ for a specific user or job. The CLI will create a `.gemini` folder inside the
215
+ specified path.
216
+
217
+ ```bash
218
+ # Isolate state for a specific job
219
+ export GEMINI_CLI_HOME="/tmp/gemini-job-123"
220
+ gemini
221
+ ```
222
+
223
+ ## Restricting tool access
224
+
225
+ You can significantly enhance security by controlling which tools the Gemini
226
+ model can use. This is achieved through the `tools.core` and `tools.exclude`
227
+ settings. For a list of available tools, see the
228
+ [Tools documentation](../tools/index.md).
229
+
230
+ ### Allowlisting with `coreTools`
231
+
232
+ The most secure approach is to explicitly add the tools and commands that users
233
+ are permitted to execute to an allowlist. This prevents the use of any tool not
234
+ on the approved list.
235
+
236
+ **Example:** Allow only safe, read-only file operations and listing files.
237
+
238
+ ```json
239
+ {
240
+ "tools": {
241
+ "core": ["ReadFileTool", "GlobTool", "ShellTool(ls)"]
242
+ }
243
+ }
244
+ ```
245
+
246
+ ### Blocklisting with `excludeTools`
247
+
248
+ Alternatively, you can add specific tools that are considered dangerous in your
249
+ environment to a blocklist.
250
+
251
+ **Example:** Prevent the use of the shell tool for removing files.
252
+
253
+ ```json
254
+ {
255
+ "tools": {
256
+ "exclude": ["ShellTool(rm -rf)"]
257
+ }
258
+ }
259
+ ```
260
+
261
+ **Security note:** Blocklisting with `excludeTools` is less secure than
262
+ allowlisting with `coreTools`, as it relies on blocking known-bad commands, and
263
+ clever users may find ways to bypass simple string-based blocks. **Allowlisting
264
+ is the recommended approach.**
265
+
266
+ ### Disabling YOLO mode
267
+
268
+ To ensure that users cannot bypass the confirmation prompt for tool execution,
269
+ you can disable YOLO mode at the policy level. This adds a critical layer of
270
+ safety, as it prevents the model from executing tools without explicit user
271
+ approval.
272
+
273
+ **Example:** Force all tool executions to require user confirmation.
274
+
275
+ ```json
276
+ {
277
+ "security": {
278
+ "disableYoloMode": true
279
+ }
280
+ }
281
+ ```
282
+
283
+ This setting is highly recommended in an enterprise environment to prevent
284
+ unintended tool execution.
285
+
286
+ ## Managing custom tools (MCP servers)
287
+
288
+ If your organization uses custom tools via
289
+ [Model-Context Protocol (MCP) servers](../core/tools-api.md), it is crucial to
290
+ understand how server configurations are managed to apply security policies
291
+ effectively.
292
+
293
+ ### How MCP server configurations are merged
294
+
295
+ Gemini CLI loads `settings.json` files from three levels: System, Workspace, and
296
+ User. When it comes to the `mcpServers` object, these configurations are
297
+ **merged**:
298
+
299
+ 1. **Merging:** The lists of servers from all three levels are combined into a
300
+ single list.
301
+ 2. **Precedence:** If a server with the **same name** is defined at multiple
302
+ levels (e.g., a server named `corp-api` exists in both system and user
303
+ settings), the definition from the highest-precedence level is used. The
304
+ order of precedence is: **System > Workspace > User**.
305
+
306
+ This means a user **cannot** override the definition of a server that is already
307
+ defined in the system-level settings. However, they **can** add new servers with
308
+ unique names.
309
+
310
+ ### Enforcing a catalog of tools
311
+
312
+ The security of your MCP tool ecosystem depends on a combination of defining the
313
+ canonical servers and adding their names to an allowlist.
314
+
315
+ ### Restricting tools within an MCP server
316
+
317
+ For even greater security, especially when dealing with third-party MCP servers,
318
+ you can restrict which specific tools from a server are exposed to the model.
319
+ This is done using the `includeTools` and `excludeTools` properties within a
320
+ server's definition. This allows you to use a subset of tools from a server
321
+ without allowing potentially dangerous ones.
322
+
323
+ Following the principle of least privilege, it is highly recommended to use
324
+ `includeTools` to create an allowlist of only the necessary tools.
325
+
326
+ **Example:** Only allow the `code-search` and `get-ticket-details` tools from a
327
+ third-party MCP server, even if the server offers other tools like
328
+ `delete-ticket`.
329
+
330
+ ```json
331
+ {
332
+ "mcp": {
333
+ "allowed": ["third-party-analyzer"]
334
+ },
335
+ "mcpServers": {
336
+ "third-party-analyzer": {
337
+ "command": "/usr/local/bin/start-3p-analyzer.sh",
338
+ "includeTools": ["code-search", "get-ticket-details"]
339
+ }
340
+ }
341
+ }
342
+ ```
343
+
344
+ #### More secure pattern: Define and add to allowlist in system settings
345
+
346
+ To create a secure, centrally-managed catalog of tools, the system administrator
347
+ **must** do both of the following in the system-level `settings.json` file:
348
+
349
+ 1. **Define the full configuration** for every approved server in the
350
+ `mcpServers` object. This ensures that even if a user defines a server with
351
+ the same name, the secure system-level definition will take precedence.
352
+ 2. **Add the names** of those servers to an allowlist using the `mcp.allowed`
353
+ setting. This is a critical security step that prevents users from running
354
+ any servers that are not on this list. If this setting is omitted, the CLI
355
+ will merge and allow any server defined by the user.
356
+
357
+ **Example system `settings.json`:**
358
+
359
+ 1. Add the _names_ of all approved servers to an allowlist. This will prevent
360
+ users from adding their own servers.
361
+
362
+ 2. Provide the canonical _definition_ for each server on the allowlist.
363
+
364
+ ```json
365
+ {
366
+ "mcp": {
367
+ "allowed": ["corp-data-api", "source-code-analyzer"]
368
+ },
369
+ "mcpServers": {
370
+ "corp-data-api": {
371
+ "command": "/usr/local/bin/start-corp-api.sh",
372
+ "timeout": 5000
373
+ },
374
+ "source-code-analyzer": {
375
+ "command": "/usr/local/bin/start-analyzer.sh"
376
+ }
377
+ }
378
+ }
379
+ ```
380
+
381
+ This pattern is more secure because it uses both definition and an allowlist.
382
+ Any server a user defines will either be overridden by the system definition (if
383
+ it has the same name) or blocked because its name is not in the `mcp.allowed`
384
+ list.
385
+
386
+ ### Less secure pattern: Omitting the allowlist
387
+
388
+ If the administrator defines the `mcpServers` object but fails to also specify
389
+ the `mcp.allowed` allowlist, users may add their own servers.
390
+
391
+ **Example system `settings.json`:**
392
+
393
+ This configuration defines servers but does not enforce the allowlist. The
394
+ administrator has NOT included the "mcp.allowed" setting.
395
+
396
+ ```json
397
+ {
398
+ "mcpServers": {
399
+ "corp-data-api": {
400
+ "command": "/usr/local/bin/start-corp-api.sh"
401
+ }
402
+ }
403
+ }
404
+ ```
405
+
406
+ In this scenario, a user can add their own server in their local
407
+ `settings.json`. Because there is no `mcp.allowed` list to filter the merged
408
+ results, the user's server will be added to the list of available tools and
409
+ allowed to run.
410
+
411
+ ## Enforcing sandboxing for security
412
+
413
+ To mitigate the risk of potentially harmful operations, you can enforce the use
414
+ of sandboxing for all tool execution. The sandbox isolates tool execution in a
415
+ containerized environment.
416
+
417
+ **Example:** Force all tool execution to happen within a Docker sandbox.
418
+
419
+ ```json
420
+ {
421
+ "tools": {
422
+ "sandbox": "docker"
423
+ }
424
+ }
425
+ ```
426
+
427
+ You can also specify a custom, hardened Docker image for the sandbox by building
428
+ a custom `sandbox.Dockerfile` as described in the
429
+ [Sandboxing documentation](./sandbox.md).
430
+
431
+ ## Controlling network access via proxy
432
+
433
+ In corporate environments with strict network policies, you can configure Gemini
434
+ CLI to route all outbound traffic through a corporate proxy. This can be set via
435
+ an environment variable, but it can also be enforced for custom tools via the
436
+ `mcpServers` configuration.
437
+
438
+ **Example (for an MCP server):**
439
+
440
+ ```json
441
+ {
442
+ "mcpServers": {
443
+ "proxied-server": {
444
+ "command": "node",
445
+ "args": ["mcp_server.js"],
446
+ "env": {
447
+ "HTTP_PROXY": "http://proxy.example.com:8080",
448
+ "HTTPS_PROXY": "http://proxy.example.com:8080"
449
+ }
450
+ }
451
+ }
452
+ }
453
+ ```
454
+
455
+ ## Telemetry and auditing
456
+
457
+ For auditing and monitoring purposes, you can configure Gemini CLI to send
458
+ telemetry data to a central location. This allows you to track tool usage and
459
+ other events. For more information, see the
460
+ [telemetry documentation](./telemetry.md).
461
+
462
+ **Example:** Enable telemetry and send it to a local OTLP collector. If
463
+ `otlpEndpoint` is not specified, it defaults to `http://localhost:4317`.
464
+
465
+ ```json
466
+ {
467
+ "telemetry": {
468
+ "enabled": true,
469
+ "target": "gcp",
470
+ "logPrompts": false
471
+ }
472
+ }
473
+ ```
474
+
475
+ **Note:** Ensure that `logPrompts` is set to `false` in an enterprise setting to
476
+ avoid collecting potentially sensitive information from user prompts.
477
+
478
+ ## Authentication
479
+
480
+ You can enforce a specific authentication method for all users by setting the
481
+ `enforcedAuthType` in the system-level `settings.json` file. This prevents users
482
+ from choosing a different authentication method. See the
483
+ [Authentication docs](./authentication.md) for more details.
484
+
485
+ **Example:** Enforce the use of Google login for all users.
486
+
487
+ ```json
488
+ {
489
+ "enforcedAuthType": "oauth-personal"
490
+ }
491
+ ```
492
+
493
+ If a user has a different authentication method configured, they will be
494
+ prompted to switch to the enforced method. In non-interactive mode, the CLI will
495
+ exit with an error if the configured authentication method does not match the
496
+ enforced one.
497
+
498
+ ### Restricting logins to corporate domains
499
+
500
+ For enterprises using Google Workspace, you can enforce that users only
501
+ authenticate with their corporate Google accounts. This is a network-level
502
+ control that is configured on a proxy server, not within Gemini CLI itself. It
503
+ works by intercepting authentication requests to Google and adding a special
504
+ HTTP header.
505
+
506
+ This policy prevents users from logging in with personal Gmail accounts or other
507
+ non-corporate Google accounts.
508
+
509
+ For detailed instructions, see the Google Workspace Admin Help article on
510
+ [blocking access to consumer accounts](https://support.google.com/a/answer/1668854?hl=en#zippy=%2Cstep-choose-a-web-proxy-server%2Cstep-configure-the-network-to-block-certain-accounts).
511
+
512
+ The general steps are as follows:
513
+
514
+ 1. **Intercept Requests**: Configure your web proxy to intercept all requests
515
+ to `google.com`.
516
+ 2. **Add HTTP Header**: For each intercepted request, add the
517
+ `X-GoogApps-Allowed-Domains` HTTP header.
518
+ 3. **Specify Domains**: The value of the header should be a comma-separated
519
+ list of your approved Google Workspace domain names.
520
+
521
+ **Example header:**
522
+
523
+ ```
524
+ X-GoogApps-Allowed-Domains: my-corporate-domain.com, secondary-domain.com
525
+ ```
526
+
527
+ When this header is present, Google's authentication service will only allow
528
+ logins from accounts belonging to the specified domains.
529
+
530
+ ## Putting it all together: example system `settings.json`
531
+
532
+ Here is an example of a system `settings.json` file that combines several of the
533
+ patterns discussed above to create a secure, controlled environment for Gemini
534
+ CLI.
535
+
536
+ ```json
537
+ {
538
+ "tools": {
539
+ "sandbox": "docker",
540
+ "core": [
541
+ "ReadFileTool",
542
+ "GlobTool",
543
+ "ShellTool(ls)",
544
+ "ShellTool(cat)",
545
+ "ShellTool(grep)"
546
+ ]
547
+ },
548
+ "mcp": {
549
+ "allowed": ["corp-tools"]
550
+ },
551
+ "mcpServers": {
552
+ "corp-tools": {
553
+ "command": "/opt/gemini-tools/start.sh",
554
+ "timeout": 5000
555
+ }
556
+ },
557
+ "telemetry": {
558
+ "enabled": true,
559
+ "target": "gcp",
560
+ "otlpEndpoint": "https://telemetry-prod.example.com:4317",
561
+ "logPrompts": false
562
+ },
563
+ "advanced": {
564
+ "bugCommand": {
565
+ "urlTemplate": "https://servicedesk.example.com/new-ticket?title={title}&details={info}"
566
+ }
567
+ },
568
+ "privacy": {
569
+ "usageStatisticsEnabled": false
570
+ }
571
+ }
572
+ ```
573
+
574
+ This configuration:
575
+
576
+ - Forces all tool execution into a Docker sandbox.
577
+ - Strictly uses an allowlist for a small set of safe shell commands and file
578
+ tools.
579
+ - Defines and allows a single corporate MCP server for custom tools.
580
+ - Enables telemetry for auditing, without logging prompt content.
581
+ - Redirects the `/bug` command to an internal ticketing system.
582
+ - Disables general usage statistics collection.
@@ -0,0 +1,71 @@
1
+ # Ignoring files
2
+
3
+ This document provides an overview of the Gemini Ignore (`.geminiignore`)
4
+ feature of the Gemini CLI.
5
+
6
+ The Gemini CLI includes the ability to automatically ignore files, similar to
7
+ `.gitignore` (used by Git) and `.aiexclude` (used by Gemini Code Assist). Adding
8
+ paths to your `.geminiignore` file will exclude them from tools that support
9
+ this feature, although they will still be visible to other services (such as
10
+ Git).
11
+
12
+ ## How it works
13
+
14
+ When you add a path to your `.geminiignore` file, tools that respect this file
15
+ will exclude matching files and directories from their operations. For example,
16
+ when you use the `@` command to share files, any paths in your `.geminiignore`
17
+ file will be automatically excluded.
18
+
19
+ For the most part, `.geminiignore` follows the conventions of `.gitignore`
20
+ files:
21
+
22
+ - Blank lines and lines starting with `#` are ignored.
23
+ - Standard glob patterns are supported (such as `*`, `?`, and `[]`).
24
+ - Putting a `/` at the end will only match directories.
25
+ - Putting a `/` at the beginning anchors the path relative to the
26
+ `.geminiignore` file.
27
+ - `!` negates a pattern.
28
+
29
+ You can update your `.geminiignore` file at any time. To apply the changes, you
30
+ must restart your Gemini CLI session.
31
+
32
+ ## How to use `.geminiignore`
33
+
34
+ To enable `.geminiignore`:
35
+
36
+ 1. Create a file named `.geminiignore` in the root of your project directory.
37
+
38
+ To add a file or directory to `.geminiignore`:
39
+
40
+ 1. Open your `.geminiignore` file.
41
+ 2. Add the path or file you want to ignore, for example: `/archive/` or
42
+ `apikeys.txt`.
43
+
44
+ ### `.geminiignore` examples
45
+
46
+ You can use `.geminiignore` to ignore directories and files:
47
+
48
+ ```
49
+ # Exclude your /packages/ directory and all subdirectories
50
+ /packages/
51
+
52
+ # Exclude your apikeys.txt file
53
+ apikeys.txt
54
+ ```
55
+
56
+ You can use wildcards in your `.geminiignore` file with `*`:
57
+
58
+ ```
59
+ # Exclude all .md files
60
+ *.md
61
+ ```
62
+
63
+ Finally, you can exclude files and directories from exclusion with `!`:
64
+
65
+ ```
66
+ # Exclude all .md files except README.md
67
+ *.md
68
+ !README.md
69
+ ```
70
+
71
+ To remove paths from your `.geminiignore` file, delete the relevant lines.