@dgxo/mashadevcli 1.1.0

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 (140) 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 +239 -0
  5. package/bundle/builtin/skill-creator/scripts/package_skill.cjs +131 -0
  6. package/bundle/builtin/skill-creator/scripts/validate_skill.cjs +131 -0
  7. package/bundle/docs/CONTRIBUTING.md +1 -0
  8. package/bundle/docs/admin/enterprise-controls.md +115 -0
  9. package/bundle/docs/assets/connected_devtools.png +0 -0
  10. package/bundle/docs/assets/gemini-screenshot.png +0 -0
  11. package/bundle/docs/assets/monitoring-dashboard-logs.png +0 -0
  12. package/bundle/docs/assets/monitoring-dashboard-metrics.png +0 -0
  13. package/bundle/docs/assets/monitoring-dashboard-overview.png +0 -0
  14. package/bundle/docs/assets/release_patch.png +0 -0
  15. package/bundle/docs/assets/theme-ansi-light.png +0 -0
  16. package/bundle/docs/assets/theme-ansi.png +0 -0
  17. package/bundle/docs/assets/theme-atom-one.png +0 -0
  18. package/bundle/docs/assets/theme-ayu-light.png +0 -0
  19. package/bundle/docs/assets/theme-ayu.png +0 -0
  20. package/bundle/docs/assets/theme-custom.png +0 -0
  21. package/bundle/docs/assets/theme-default-light.png +0 -0
  22. package/bundle/docs/assets/theme-default.png +0 -0
  23. package/bundle/docs/assets/theme-dracula.png +0 -0
  24. package/bundle/docs/assets/theme-github-light.png +0 -0
  25. package/bundle/docs/assets/theme-github.png +0 -0
  26. package/bundle/docs/assets/theme-google-light.png +0 -0
  27. package/bundle/docs/assets/theme-xcode-light.png +0 -0
  28. package/bundle/docs/changelogs/index.md +867 -0
  29. package/bundle/docs/changelogs/latest.md +208 -0
  30. package/bundle/docs/changelogs/preview.md +187 -0
  31. package/bundle/docs/cli/checkpointing.md +93 -0
  32. package/bundle/docs/cli/cli-reference.md +115 -0
  33. package/bundle/docs/cli/creating-skills.md +80 -0
  34. package/bundle/docs/cli/custom-commands.md +327 -0
  35. package/bundle/docs/cli/enterprise.md +604 -0
  36. package/bundle/docs/cli/gemini-ignore.md +71 -0
  37. package/bundle/docs/cli/gemini-md.md +116 -0
  38. package/bundle/docs/cli/generation-settings.md +210 -0
  39. package/bundle/docs/cli/headless.md +50 -0
  40. package/bundle/docs/cli/model-routing.md +42 -0
  41. package/bundle/docs/cli/model.md +53 -0
  42. package/bundle/docs/cli/plan-mode.md +375 -0
  43. package/bundle/docs/cli/rewind.md +51 -0
  44. package/bundle/docs/cli/sandbox.md +257 -0
  45. package/bundle/docs/cli/session-management.md +184 -0
  46. package/bundle/docs/cli/settings.md +165 -0
  47. package/bundle/docs/cli/skills.md +134 -0
  48. package/bundle/docs/cli/system-prompt.md +125 -0
  49. package/bundle/docs/cli/telemetry.md +922 -0
  50. package/bundle/docs/cli/themes.md +269 -0
  51. package/bundle/docs/cli/token-caching.md +20 -0
  52. package/bundle/docs/cli/trusted-folders.md +126 -0
  53. package/bundle/docs/cli/tutorials/automation.md +283 -0
  54. package/bundle/docs/cli/tutorials/file-management.md +142 -0
  55. package/bundle/docs/cli/tutorials/mcp-setup.md +113 -0
  56. package/bundle/docs/cli/tutorials/memory-management.md +126 -0
  57. package/bundle/docs/cli/tutorials/session-management.md +105 -0
  58. package/bundle/docs/cli/tutorials/shell-commands.md +107 -0
  59. package/bundle/docs/cli/tutorials/skills-getting-started.md +110 -0
  60. package/bundle/docs/cli/tutorials/task-planning.md +93 -0
  61. package/bundle/docs/cli/tutorials/web-tools.md +78 -0
  62. package/bundle/docs/core/index.md +107 -0
  63. package/bundle/docs/core/remote-agents.md +84 -0
  64. package/bundle/docs/core/subagents.md +307 -0
  65. package/bundle/docs/examples/proxy-script.md +83 -0
  66. package/bundle/docs/extensions/best-practices.md +188 -0
  67. package/bundle/docs/extensions/index.md +61 -0
  68. package/bundle/docs/extensions/reference.md +333 -0
  69. package/bundle/docs/extensions/releasing.md +154 -0
  70. package/bundle/docs/extensions/writing-extensions.md +308 -0
  71. package/bundle/docs/get-started/authentication.md +402 -0
  72. package/bundle/docs/get-started/examples.md +139 -0
  73. package/bundle/docs/get-started/gemini-3.md +115 -0
  74. package/bundle/docs/get-started/index.md +82 -0
  75. package/bundle/docs/get-started/installation.md +174 -0
  76. package/bundle/docs/hooks/best-practices.md +709 -0
  77. package/bundle/docs/hooks/index.md +164 -0
  78. package/bundle/docs/hooks/reference.md +330 -0
  79. package/bundle/docs/hooks/writing-hooks.md +474 -0
  80. package/bundle/docs/ide-integration/ide-companion-spec.md +267 -0
  81. package/bundle/docs/ide-integration/index.md +224 -0
  82. package/bundle/docs/index.md +141 -0
  83. package/bundle/docs/integration-tests.md +211 -0
  84. package/bundle/docs/issue-and-pr-automation.md +172 -0
  85. package/bundle/docs/local-development.md +134 -0
  86. package/bundle/docs/mermaid/context.mmd +103 -0
  87. package/bundle/docs/mermaid/render-path.mmd +64 -0
  88. package/bundle/docs/npm.md +62 -0
  89. package/bundle/docs/redirects.json +20 -0
  90. package/bundle/docs/reference/commands.md +526 -0
  91. package/bundle/docs/reference/configuration.md +1786 -0
  92. package/bundle/docs/reference/keyboard-shortcuts.md +164 -0
  93. package/bundle/docs/reference/memport.md +246 -0
  94. package/bundle/docs/reference/policy-engine.md +364 -0
  95. package/bundle/docs/reference/tools.md +106 -0
  96. package/bundle/docs/release-confidence.md +164 -0
  97. package/bundle/docs/releases.md +540 -0
  98. package/bundle/docs/resources/faq.md +175 -0
  99. package/bundle/docs/resources/quota-and-pricing.md +165 -0
  100. package/bundle/docs/resources/tos-privacy.md +102 -0
  101. package/bundle/docs/resources/troubleshooting.md +176 -0
  102. package/bundle/docs/resources/uninstall.md +56 -0
  103. package/bundle/docs/sidebar.json +233 -0
  104. package/bundle/docs/tools/activate-skill.md +43 -0
  105. package/bundle/docs/tools/ask-user.md +95 -0
  106. package/bundle/docs/tools/file-system.md +129 -0
  107. package/bundle/docs/tools/internal-docs.md +46 -0
  108. package/bundle/docs/tools/mcp-server.md +1150 -0
  109. package/bundle/docs/tools/memory.md +35 -0
  110. package/bundle/docs/tools/planning.md +58 -0
  111. package/bundle/docs/tools/shell.md +216 -0
  112. package/bundle/docs/tools/todos.md +35 -0
  113. package/bundle/docs/tools/web-fetch.md +35 -0
  114. package/bundle/docs/tools/web-search.md +32 -0
  115. package/bundle/docs/update/update-guide.md +111 -0
  116. package/bundle/masha.js +563471 -0
  117. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/client/main.js +89 -0
  118. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.d.ts +7 -0
  119. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.js +9 -0
  120. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.js.map +1 -0
  121. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.d.ts +48 -0
  122. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.js +299 -0
  123. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.js.map +1 -0
  124. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.d.ts +36 -0
  125. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.js +7 -0
  126. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.js.map +1 -0
  127. package/bundle/node_modules/@dgxo/mashadevcli-devtools/package.json +32 -0
  128. package/bundle/policies/conseca.toml +6 -0
  129. package/bundle/policies/discovered.toml +8 -0
  130. package/bundle/policies/plan.toml +109 -0
  131. package/bundle/policies/read-only.toml +53 -0
  132. package/bundle/policies/write.toml +80 -0
  133. package/bundle/policies/yolo.toml +54 -0
  134. package/bundle/sandbox-macos-permissive-open.sb +27 -0
  135. package/bundle/sandbox-macos-permissive-proxied.sb +37 -0
  136. package/bundle/sandbox-macos-restrictive-open.sb +96 -0
  137. package/bundle/sandbox-macos-restrictive-proxied.sb +98 -0
  138. package/bundle/sandbox-macos-strict-open.sb +131 -0
  139. package/bundle/sandbox-macos-strict-proxied.sb +133 -0
  140. package/package.json +169 -0
@@ -0,0 +1,604 @@
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](../reference/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
+ **PowerShell Profile (Windows alternative):**
207
+
208
+ On Windows, administrators can achieve similar results by adding the environment
209
+ variable to the system-wide or user-specific PowerShell profile:
210
+
211
+ ```powershell
212
+ Add-Content -Path $PROFILE -Value '$env:GEMINI_CLI_SYSTEM_SETTINGS_PATH="C:\ProgramData\gemini-cli\settings.json"'
213
+ ```
214
+
215
+ ## User isolation in shared environments
216
+
217
+ In shared compute environments (like ML experiment runners or shared build
218
+ servers), you can isolate Gemini CLI state by overriding the user's home
219
+ directory.
220
+
221
+ By default, Gemini CLI stores configuration and history in `~/.gemini`. You can
222
+ use the `GEMINI_CLI_HOME` environment variable to point to a unique directory
223
+ for a specific user or job. The CLI will create a `.gemini` folder inside the
224
+ specified path.
225
+
226
+ **macOS/Linux**
227
+
228
+ ```bash
229
+ # Isolate state for a specific job
230
+ export GEMINI_CLI_HOME="/tmp/gemini-job-123"
231
+ gemini
232
+ ```
233
+
234
+ **Windows (PowerShell)**
235
+
236
+ ```powershell
237
+ # Isolate state for a specific job
238
+ $env:GEMINI_CLI_HOME="C:\temp\gemini-job-123"
239
+ gemini
240
+ ```
241
+
242
+ ## Restricting tool access
243
+
244
+ You can significantly enhance security by controlling which tools the Gemini
245
+ model can use. This is achieved through the `tools.core` setting and the
246
+ [Policy Engine](../reference/policy-engine.md). For a list of available tools,
247
+ see the [Tools reference](../reference/tools.md).
248
+
249
+ ### Allowlisting with `coreTools`
250
+
251
+ The most secure approach is to explicitly add the tools and commands that users
252
+ are permitted to execute to an allowlist. This prevents the use of any tool not
253
+ on the approved list.
254
+
255
+ **Example:** Allow only safe, read-only file operations and listing files.
256
+
257
+ ```json
258
+ {
259
+ "tools": {
260
+ "core": ["ReadFileTool", "GlobTool", "ShellTool(ls)"]
261
+ }
262
+ }
263
+ ```
264
+
265
+ ### Blocklisting with `excludeTools` (Deprecated)
266
+
267
+ > **Deprecated:** Use the [Policy Engine](../reference/policy-engine.md) for
268
+ > more robust control.
269
+
270
+ Alternatively, you can add specific tools that are considered dangerous in your
271
+ environment to a blocklist.
272
+
273
+ **Example:** Prevent the use of the shell tool for removing files.
274
+
275
+ ```json
276
+ {
277
+ "tools": {
278
+ "exclude": ["ShellTool(rm -rf)"]
279
+ }
280
+ }
281
+ ```
282
+
283
+ **Security note:** Blocklisting with `excludeTools` is less secure than
284
+ allowlisting with `coreTools`, as it relies on blocking known-bad commands, and
285
+ clever users may find ways to bypass simple string-based blocks. **Allowlisting
286
+ is the recommended approach.**
287
+
288
+ ### Disabling YOLO mode
289
+
290
+ To ensure that users cannot bypass the confirmation prompt for tool execution,
291
+ you can disable YOLO mode at the policy level. This adds a critical layer of
292
+ safety, as it prevents the model from executing tools without explicit user
293
+ approval.
294
+
295
+ **Example:** Force all tool executions to require user confirmation.
296
+
297
+ ```json
298
+ {
299
+ "security": {
300
+ "disableYoloMode": true
301
+ }
302
+ }
303
+ ```
304
+
305
+ This setting is highly recommended in an enterprise environment to prevent
306
+ unintended tool execution.
307
+
308
+ ## Managing custom tools (MCP servers)
309
+
310
+ If your organization uses custom tools via
311
+ [Model-Context Protocol (MCP) servers](../tools/mcp-server.md), it is crucial to
312
+ understand how server configurations are managed to apply security policies
313
+ effectively.
314
+
315
+ ### How MCP server configurations are merged
316
+
317
+ Gemini CLI loads `settings.json` files from three levels: System, Workspace, and
318
+ User. When it comes to the `mcpServers` object, these configurations are
319
+ **merged**:
320
+
321
+ 1. **Merging:** The lists of servers from all three levels are combined into a
322
+ single list.
323
+ 2. **Precedence:** If a server with the **same name** is defined at multiple
324
+ levels (e.g., a server named `corp-api` exists in both system and user
325
+ settings), the definition from the highest-precedence level is used. The
326
+ order of precedence is: **System > Workspace > User**.
327
+
328
+ This means a user **cannot** override the definition of a server that is already
329
+ defined in the system-level settings. However, they **can** add new servers with
330
+ unique names.
331
+
332
+ ### Enforcing a catalog of tools
333
+
334
+ The security of your MCP tool ecosystem depends on a combination of defining the
335
+ canonical servers and adding their names to an allowlist.
336
+
337
+ ### Restricting tools within an MCP server
338
+
339
+ For even greater security, especially when dealing with third-party MCP servers,
340
+ you can restrict which specific tools from a server are exposed to the model.
341
+ This is done using the `includeTools` and `excludeTools` properties within a
342
+ server's definition. This allows you to use a subset of tools from a server
343
+ without allowing potentially dangerous ones.
344
+
345
+ Following the principle of least privilege, it is highly recommended to use
346
+ `includeTools` to create an allowlist of only the necessary tools.
347
+
348
+ **Example:** Only allow the `code-search` and `get-ticket-details` tools from a
349
+ third-party MCP server, even if the server offers other tools like
350
+ `delete-ticket`.
351
+
352
+ ```json
353
+ {
354
+ "mcp": {
355
+ "allowed": ["third-party-analyzer"]
356
+ },
357
+ "mcpServers": {
358
+ "third-party-analyzer": {
359
+ "command": "/usr/local/bin/start-3p-analyzer.sh",
360
+ "includeTools": ["code-search", "get-ticket-details"]
361
+ }
362
+ }
363
+ }
364
+ ```
365
+
366
+ #### More secure pattern: Define and add to allowlist in system settings
367
+
368
+ To create a secure, centrally-managed catalog of tools, the system administrator
369
+ **must** do both of the following in the system-level `settings.json` file:
370
+
371
+ 1. **Define the full configuration** for every approved server in the
372
+ `mcpServers` object. This ensures that even if a user defines a server with
373
+ the same name, the secure system-level definition will take precedence.
374
+ 2. **Add the names** of those servers to an allowlist using the `mcp.allowed`
375
+ setting. This is a critical security step that prevents users from running
376
+ any servers that are not on this list. If this setting is omitted, the CLI
377
+ will merge and allow any server defined by the user.
378
+
379
+ **Example system `settings.json`:**
380
+
381
+ 1. Add the _names_ of all approved servers to an allowlist. This will prevent
382
+ users from adding their own servers.
383
+
384
+ 2. Provide the canonical _definition_ for each server on the allowlist.
385
+
386
+ ```json
387
+ {
388
+ "mcp": {
389
+ "allowed": ["corp-data-api", "source-code-analyzer"]
390
+ },
391
+ "mcpServers": {
392
+ "corp-data-api": {
393
+ "command": "/usr/local/bin/start-corp-api.sh",
394
+ "timeout": 5000
395
+ },
396
+ "source-code-analyzer": {
397
+ "command": "/usr/local/bin/start-analyzer.sh"
398
+ }
399
+ }
400
+ }
401
+ ```
402
+
403
+ This pattern is more secure because it uses both definition and an allowlist.
404
+ Any server a user defines will either be overridden by the system definition (if
405
+ it has the same name) or blocked because its name is not in the `mcp.allowed`
406
+ list.
407
+
408
+ ### Less secure pattern: Omitting the allowlist
409
+
410
+ If the administrator defines the `mcpServers` object but fails to also specify
411
+ the `mcp.allowed` allowlist, users may add their own servers.
412
+
413
+ **Example system `settings.json`:**
414
+
415
+ This configuration defines servers but does not enforce the allowlist. The
416
+ administrator has NOT included the "mcp.allowed" setting.
417
+
418
+ ```json
419
+ {
420
+ "mcpServers": {
421
+ "corp-data-api": {
422
+ "command": "/usr/local/bin/start-corp-api.sh"
423
+ }
424
+ }
425
+ }
426
+ ```
427
+
428
+ In this scenario, a user can add their own server in their local
429
+ `settings.json`. Because there is no `mcp.allowed` list to filter the merged
430
+ results, the user's server will be added to the list of available tools and
431
+ allowed to run.
432
+
433
+ ## Enforcing sandboxing for security
434
+
435
+ To mitigate the risk of potentially harmful operations, you can enforce the use
436
+ of sandboxing for all tool execution. The sandbox isolates tool execution in a
437
+ containerized environment.
438
+
439
+ **Example:** Force all tool execution to happen within a Docker sandbox.
440
+
441
+ ```json
442
+ {
443
+ "tools": {
444
+ "sandbox": "docker"
445
+ }
446
+ }
447
+ ```
448
+
449
+ You can also specify a custom, hardened Docker image for the sandbox by building
450
+ a custom `sandbox.Dockerfile` as described in the
451
+ [Sandboxing documentation](./sandbox.md).
452
+
453
+ ## Controlling network access via proxy
454
+
455
+ In corporate environments with strict network policies, you can configure Gemini
456
+ CLI to route all outbound traffic through a corporate proxy. This can be set via
457
+ an environment variable, but it can also be enforced for custom tools via the
458
+ `mcpServers` configuration.
459
+
460
+ **Example (for an MCP server):**
461
+
462
+ ```json
463
+ {
464
+ "mcpServers": {
465
+ "proxied-server": {
466
+ "command": "node",
467
+ "args": ["mcp_server.js"],
468
+ "env": {
469
+ "HTTP_PROXY": "http://proxy.example.com:8080",
470
+ "HTTPS_PROXY": "http://proxy.example.com:8080"
471
+ }
472
+ }
473
+ }
474
+ }
475
+ ```
476
+
477
+ ## Telemetry and auditing
478
+
479
+ For auditing and monitoring purposes, you can configure Gemini CLI to send
480
+ telemetry data to a central location. This allows you to track tool usage and
481
+ other events. For more information, see the
482
+ [telemetry documentation](./telemetry.md).
483
+
484
+ **Example:** Enable telemetry and send it to a local OTLP collector. If
485
+ `otlpEndpoint` is not specified, it defaults to `http://localhost:4317`.
486
+
487
+ ```json
488
+ {
489
+ "telemetry": {
490
+ "enabled": true,
491
+ "target": "gcp",
492
+ "logPrompts": false
493
+ }
494
+ }
495
+ ```
496
+
497
+ **Note:** Ensure that `logPrompts` is set to `false` in an enterprise setting to
498
+ avoid collecting potentially sensitive information from user prompts.
499
+
500
+ ## Authentication
501
+
502
+ You can enforce a specific authentication method for all users by setting the
503
+ `enforcedAuthType` in the system-level `settings.json` file. This prevents users
504
+ from choosing a different authentication method. See the
505
+ [Authentication docs](../get-started/authentication.md) for more details.
506
+
507
+ **Example:** Enforce the use of Google login for all users.
508
+
509
+ ```json
510
+ {
511
+ "enforcedAuthType": "oauth-personal"
512
+ }
513
+ ```
514
+
515
+ If a user has a different authentication method configured, they will be
516
+ prompted to switch to the enforced method. In non-interactive mode, the CLI will
517
+ exit with an error if the configured authentication method does not match the
518
+ enforced one.
519
+
520
+ ### Restricting logins to corporate domains
521
+
522
+ For enterprises using Google Workspace, you can enforce that users only
523
+ authenticate with their corporate Google accounts. This is a network-level
524
+ control that is configured on a proxy server, not within Gemini CLI itself. It
525
+ works by intercepting authentication requests to Google and adding a special
526
+ HTTP header.
527
+
528
+ This policy prevents users from logging in with personal Gmail accounts or other
529
+ non-corporate Google accounts.
530
+
531
+ For detailed instructions, see the Google Workspace Admin Help article on
532
+ [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).
533
+
534
+ The general steps are as follows:
535
+
536
+ 1. **Intercept Requests**: Configure your web proxy to intercept all requests
537
+ to `google.com`.
538
+ 2. **Add HTTP Header**: For each intercepted request, add the
539
+ `X-GoogApps-Allowed-Domains` HTTP header.
540
+ 3. **Specify Domains**: The value of the header should be a comma-separated
541
+ list of your approved Google Workspace domain names.
542
+
543
+ **Example header:**
544
+
545
+ ```
546
+ X-GoogApps-Allowed-Domains: my-corporate-domain.com, secondary-domain.com
547
+ ```
548
+
549
+ When this header is present, Google's authentication service will only allow
550
+ logins from accounts belonging to the specified domains.
551
+
552
+ ## Putting it all together: example system `settings.json`
553
+
554
+ Here is an example of a system `settings.json` file that combines several of the
555
+ patterns discussed above to create a secure, controlled environment for Gemini
556
+ CLI.
557
+
558
+ ```json
559
+ {
560
+ "tools": {
561
+ "sandbox": "docker",
562
+ "core": [
563
+ "ReadFileTool",
564
+ "GlobTool",
565
+ "ShellTool(ls)",
566
+ "ShellTool(cat)",
567
+ "ShellTool(grep)"
568
+ ]
569
+ },
570
+ "mcp": {
571
+ "allowed": ["corp-tools"]
572
+ },
573
+ "mcpServers": {
574
+ "corp-tools": {
575
+ "command": "/opt/gemini-tools/start.sh",
576
+ "timeout": 5000
577
+ }
578
+ },
579
+ "telemetry": {
580
+ "enabled": true,
581
+ "target": "gcp",
582
+ "otlpEndpoint": "https://telemetry-prod.example.com:4317",
583
+ "logPrompts": false
584
+ },
585
+ "advanced": {
586
+ "bugCommand": {
587
+ "urlTemplate": "https://servicedesk.example.com/new-ticket?title={title}&details={info}"
588
+ }
589
+ },
590
+ "privacy": {
591
+ "usageStatisticsEnabled": false
592
+ }
593
+ }
594
+ ```
595
+
596
+ This configuration:
597
+
598
+ - Forces all tool execution into a Docker sandbox.
599
+ - Strictly uses an allowlist for a small set of safe shell commands and file
600
+ tools.
601
+ - Defines and allows a single corporate MCP server for custom tools.
602
+ - Enables telemetry for auditing, without logging prompt content.
603
+ - Redirects the `/bug` command to an internal ticketing system.
604
+ - 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.