@google/gemini-cli-core 0.32.0-preview.0 → 0.33.0-preview.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 (216) hide show
  1. package/README.md +11 -9
  2. package/dist/docs/CONTRIBUTING.md +7 -4
  3. package/dist/docs/changelogs/index.md +24 -2
  4. package/dist/docs/changelogs/latest.md +389 -310
  5. package/dist/docs/changelogs/preview.md +186 -394
  6. package/dist/docs/cli/cli-reference.md +12 -12
  7. package/dist/docs/cli/custom-commands.md +9 -0
  8. package/dist/docs/cli/enterprise.md +19 -0
  9. package/dist/docs/cli/model.md +5 -14
  10. package/dist/docs/cli/plan-mode.md +38 -7
  11. package/dist/docs/cli/sandbox.md +42 -2
  12. package/dist/docs/cli/session-management.md +16 -7
  13. package/dist/docs/cli/settings.md +10 -10
  14. package/dist/docs/cli/telemetry.md +29 -0
  15. package/dist/docs/cli/tutorials/automation.md +101 -5
  16. package/dist/docs/cli/tutorials/mcp-setup.md +8 -0
  17. package/dist/docs/cli/tutorials/skills-getting-started.md +8 -0
  18. package/dist/docs/extensions/reference.md +9 -1
  19. package/dist/docs/extensions/writing-extensions.md +16 -0
  20. package/dist/docs/get-started/authentication.md +86 -5
  21. package/dist/docs/get-started/installation.md +1 -1
  22. package/dist/docs/hooks/best-practices.md +33 -1
  23. package/dist/docs/hooks/writing-hooks.md +24 -0
  24. package/dist/docs/ide-integration/index.md +8 -0
  25. package/dist/docs/reference/commands.md +3 -0
  26. package/dist/docs/reference/configuration.md +19 -15
  27. package/dist/docs/reference/keyboard-shortcuts.md +10 -0
  28. package/dist/docs/reference/policy-engine.md +10 -0
  29. package/dist/docs/resources/faq.md +8 -0
  30. package/dist/docs/resources/troubleshooting.md +4 -1
  31. package/dist/docs/sidebar.json +8 -1
  32. package/dist/src/agents/a2aUtils.d.ts +2 -0
  33. package/dist/src/agents/a2aUtils.js +12 -0
  34. package/dist/src/agents/a2aUtils.js.map +1 -1
  35. package/dist/src/agents/a2aUtils.test.js +50 -1
  36. package/dist/src/agents/a2aUtils.test.js.map +1 -1
  37. package/dist/src/agents/agentLoader.d.ts +2 -1
  38. package/dist/src/agents/agentLoader.js +17 -4
  39. package/dist/src/agents/agentLoader.js.map +1 -1
  40. package/dist/src/agents/agentLoader.test.js +46 -0
  41. package/dist/src/agents/agentLoader.test.js.map +1 -1
  42. package/dist/src/agents/auth-provider/factory.js +6 -3
  43. package/dist/src/agents/auth-provider/factory.js.map +1 -1
  44. package/dist/src/agents/auth-provider/http-provider.d.ts +28 -0
  45. package/dist/src/agents/auth-provider/http-provider.js +73 -0
  46. package/dist/src/agents/auth-provider/http-provider.js.map +1 -0
  47. package/dist/src/agents/auth-provider/http-provider.test.d.ts +6 -0
  48. package/dist/src/agents/auth-provider/http-provider.test.js +112 -0
  49. package/dist/src/agents/auth-provider/http-provider.test.js.map +1 -0
  50. package/dist/src/agents/auth-provider/types.d.ts +5 -0
  51. package/dist/src/agents/browser/browserAgentInvocation.d.ts +2 -3
  52. package/dist/src/agents/browser/browserAgentInvocation.js +1 -1
  53. package/dist/src/agents/browser/browserAgentInvocation.js.map +1 -1
  54. package/dist/src/agents/local-executor.js +36 -7
  55. package/dist/src/agents/local-executor.js.map +1 -1
  56. package/dist/src/agents/local-executor.test.js +18 -13
  57. package/dist/src/agents/local-executor.test.js.map +1 -1
  58. package/dist/src/agents/local-invocation.d.ts +3 -4
  59. package/dist/src/agents/local-invocation.js +164 -11
  60. package/dist/src/agents/local-invocation.js.map +1 -1
  61. package/dist/src/agents/local-invocation.test.js +49 -29
  62. package/dist/src/agents/local-invocation.test.js.map +1 -1
  63. package/dist/src/agents/registry.js +66 -12
  64. package/dist/src/agents/registry.js.map +1 -1
  65. package/dist/src/agents/registry.test.js +220 -0
  66. package/dist/src/agents/registry.test.js.map +1 -1
  67. package/dist/src/agents/remote-invocation.d.ts +2 -1
  68. package/dist/src/agents/remote-invocation.js +20 -2
  69. package/dist/src/agents/remote-invocation.js.map +1 -1
  70. package/dist/src/agents/remote-invocation.test.js +62 -10
  71. package/dist/src/agents/remote-invocation.test.js.map +1 -1
  72. package/dist/src/agents/subagent-tool.js.map +1 -1
  73. package/dist/src/agents/subagent-tool.test.js +7 -0
  74. package/dist/src/agents/subagent-tool.test.js.map +1 -1
  75. package/dist/src/agents/types.d.ts +18 -0
  76. package/dist/src/agents/types.js +6 -0
  77. package/dist/src/agents/types.js.map +1 -1
  78. package/dist/src/code_assist/server.js.map +1 -1
  79. package/dist/src/config/config.d.ts +11 -4
  80. package/dist/src/config/config.js +23 -47
  81. package/dist/src/config/config.js.map +1 -1
  82. package/dist/src/config/config.test.js +29 -101
  83. package/dist/src/config/config.test.js.map +1 -1
  84. package/dist/src/core/client.js +5 -3
  85. package/dist/src/core/client.js.map +1 -1
  86. package/dist/src/core/client.test.js +47 -7
  87. package/dist/src/core/client.test.js.map +1 -1
  88. package/dist/src/core/coreToolHookTriggers.d.ts +3 -3
  89. package/dist/src/core/coreToolHookTriggers.js.map +1 -1
  90. package/dist/src/core/coreToolScheduler.js +38 -22
  91. package/dist/src/core/coreToolScheduler.js.map +1 -1
  92. package/dist/src/core/geminiChat.d.ts +2 -2
  93. package/dist/src/core/geminiChat.js +3 -0
  94. package/dist/src/core/geminiChat.js.map +1 -1
  95. package/dist/src/core/loggingContentGenerator.d.ts +1 -0
  96. package/dist/src/core/loggingContentGenerator.js +31 -1
  97. package/dist/src/core/loggingContentGenerator.js.map +1 -1
  98. package/dist/src/core/loggingContentGenerator.test.js +94 -0
  99. package/dist/src/core/loggingContentGenerator.test.js.map +1 -1
  100. package/dist/src/generated/git-commit.d.ts +2 -2
  101. package/dist/src/generated/git-commit.js +2 -2
  102. package/dist/src/hooks/hookRunner.js +30 -4
  103. package/dist/src/hooks/hookRunner.js.map +1 -1
  104. package/dist/src/index.d.ts +1 -0
  105. package/dist/src/index.js +1 -0
  106. package/dist/src/index.js.map +1 -1
  107. package/dist/src/mcp/mcp-oauth-provider.d.ts +43 -0
  108. package/dist/src/mcp/mcp-oauth-provider.js +67 -0
  109. package/dist/src/mcp/mcp-oauth-provider.js.map +1 -0
  110. package/dist/src/mcp/mcp-oauth-provider.test.d.ts +6 -0
  111. package/dist/src/mcp/mcp-oauth-provider.test.js +63 -0
  112. package/dist/src/mcp/mcp-oauth-provider.test.js.map +1 -0
  113. package/dist/src/policy/config.d.ts +1 -1
  114. package/dist/src/policy/config.js +4 -3
  115. package/dist/src/policy/config.js.map +1 -1
  116. package/dist/src/policy/policies/plan.toml +50 -13
  117. package/dist/src/policy/policies/read-only.toml +12 -11
  118. package/dist/src/policy/policies/write.toml +12 -11
  119. package/dist/src/policy/policies/yolo.toml +21 -11
  120. package/dist/src/policy/policy-engine.test.js +62 -2
  121. package/dist/src/policy/policy-engine.test.js.map +1 -1
  122. package/dist/src/policy/toml-loader.d.ts +19 -1
  123. package/dist/src/policy/toml-loader.js +127 -0
  124. package/dist/src/policy/toml-loader.js.map +1 -1
  125. package/dist/src/policy/toml-loader.test.js +218 -14
  126. package/dist/src/policy/toml-loader.test.js.map +1 -1
  127. package/dist/src/prompts/snippets.js +7 -7
  128. package/dist/src/prompts/snippets.js.map +1 -1
  129. package/dist/src/scheduler/scheduler.js +1 -1
  130. package/dist/src/scheduler/scheduler.js.map +1 -1
  131. package/dist/src/scheduler/scheduler.test.js +1 -1
  132. package/dist/src/scheduler/scheduler.test.js.map +1 -1
  133. package/dist/src/scheduler/state-manager.d.ts +1 -2
  134. package/dist/src/scheduler/state-manager.js +19 -10
  135. package/dist/src/scheduler/state-manager.js.map +1 -1
  136. package/dist/src/scheduler/tool-executor.d.ts +3 -2
  137. package/dist/src/scheduler/tool-executor.js +89 -32
  138. package/dist/src/scheduler/tool-executor.js.map +1 -1
  139. package/dist/src/scheduler/tool-executor.test.js +191 -0
  140. package/dist/src/scheduler/tool-executor.test.js.map +1 -1
  141. package/dist/src/scheduler/types.d.ts +3 -4
  142. package/dist/src/services/chatRecordingService.js +12 -0
  143. package/dist/src/services/chatRecordingService.js.map +1 -1
  144. package/dist/src/services/chatRecordingService.test.js +15 -4
  145. package/dist/src/services/chatRecordingService.test.js.map +1 -1
  146. package/dist/src/services/loopDetectionService.d.ts +2 -1
  147. package/dist/src/services/loopDetectionService.js +49 -11
  148. package/dist/src/services/loopDetectionService.js.map +1 -1
  149. package/dist/src/services/loopDetectionService.test.js +63 -22
  150. package/dist/src/services/loopDetectionService.test.js.map +1 -1
  151. package/dist/src/skills/builtin/skill-creator/scripts/package_skill.cjs +35 -10
  152. package/dist/src/tools/ask-user.d.ts +1 -0
  153. package/dist/src/tools/ask-user.js +2 -1
  154. package/dist/src/tools/ask-user.js.map +1 -1
  155. package/dist/src/tools/definitions/base-declarations.d.ts +51 -0
  156. package/dist/src/tools/definitions/base-declarations.js +75 -1
  157. package/dist/src/tools/definitions/base-declarations.js.map +1 -1
  158. package/dist/src/tools/definitions/coreTools.d.ts +1 -1
  159. package/dist/src/tools/definitions/coreTools.js +5 -1
  160. package/dist/src/tools/definitions/coreTools.js.map +1 -1
  161. package/dist/src/tools/definitions/dynamic-declaration-helpers.js +14 -12
  162. package/dist/src/tools/definitions/dynamic-declaration-helpers.js.map +1 -1
  163. package/dist/src/tools/definitions/model-family-sets/default-legacy.js +97 -81
  164. package/dist/src/tools/definitions/model-family-sets/default-legacy.js.map +1 -1
  165. package/dist/src/tools/definitions/model-family-sets/gemini-3.js +99 -82
  166. package/dist/src/tools/definitions/model-family-sets/gemini-3.js.map +1 -1
  167. package/dist/src/tools/enter-plan-mode.d.ts +1 -0
  168. package/dist/src/tools/enter-plan-mode.js +2 -1
  169. package/dist/src/tools/enter-plan-mode.js.map +1 -1
  170. package/dist/src/tools/exit-plan-mode.d.ts +1 -0
  171. package/dist/src/tools/exit-plan-mode.js +2 -1
  172. package/dist/src/tools/exit-plan-mode.js.map +1 -1
  173. package/dist/src/tools/mcp-client.d.ts +6 -0
  174. package/dist/src/tools/mcp-client.js +14 -0
  175. package/dist/src/tools/mcp-client.js.map +1 -1
  176. package/dist/src/tools/mcp-tool.js +20 -9
  177. package/dist/src/tools/mcp-tool.js.map +1 -1
  178. package/dist/src/tools/mcp-tool.test.js +48 -1
  179. package/dist/src/tools/mcp-tool.test.js.map +1 -1
  180. package/dist/src/tools/read-file.test.js +7 -0
  181. package/dist/src/tools/read-file.test.js.map +1 -1
  182. package/dist/src/tools/shell.d.ts +2 -3
  183. package/dist/src/tools/shell.js +10 -9
  184. package/dist/src/tools/shell.js.map +1 -1
  185. package/dist/src/tools/tool-names.d.ts +2 -2
  186. package/dist/src/tools/tool-names.js +14 -4
  187. package/dist/src/tools/tool-names.js.map +1 -1
  188. package/dist/src/tools/tool-names.test.js +2 -0
  189. package/dist/src/tools/tool-names.test.js.map +1 -1
  190. package/dist/src/tools/tool-registry.d.ts +3 -2
  191. package/dist/src/tools/tool-registry.js +41 -5
  192. package/dist/src/tools/tool-registry.js.map +1 -1
  193. package/dist/src/tools/tool-registry.test.js +42 -7
  194. package/dist/src/tools/tool-registry.test.js.map +1 -1
  195. package/dist/src/tools/tools.d.ts +6 -4
  196. package/dist/src/tools/tools.js.map +1 -1
  197. package/dist/src/utils/constants.d.ts +3 -0
  198. package/dist/src/utils/constants.js +3 -0
  199. package/dist/src/utils/constants.js.map +1 -1
  200. package/dist/src/utils/errors.d.ts +4 -0
  201. package/dist/src/utils/errors.js +6 -0
  202. package/dist/src/utils/errors.js.map +1 -1
  203. package/dist/src/utils/errors.test.js +20 -1
  204. package/dist/src/utils/errors.test.js.map +1 -1
  205. package/dist/src/utils/fetch.js +1 -1
  206. package/dist/src/utils/fetch.js.map +1 -1
  207. package/dist/src/utils/fileUtils.d.ts +0 -1
  208. package/dist/src/utils/fileUtils.js +5 -7
  209. package/dist/src/utils/fileUtils.js.map +1 -1
  210. package/dist/src/utils/tool-utils.d.ts +11 -4
  211. package/dist/src/utils/tool-utils.js +18 -5
  212. package/dist/src/utils/tool-utils.js.map +1 -1
  213. package/dist/src/utils/tool-utils.test.js +8 -0
  214. package/dist/src/utils/tool-utils.test.js.map +1 -1
  215. package/dist/tsconfig.tsbuildinfo +1 -1
  216. package/package.json +1 -1
@@ -122,7 +122,10 @@ The manifest file defines the extension's behavior and configuration.
122
122
  }
123
123
  },
124
124
  "contextFileName": "GEMINI.md",
125
- "excludeTools": ["run_shell_command"]
125
+ "excludeTools": ["run_shell_command"],
126
+ "plan": {
127
+ "directory": ".gemini/plans"
128
+ }
126
129
  }
127
130
  ```
128
131
 
@@ -157,6 +160,11 @@ The manifest file defines the extension's behavior and configuration.
157
160
  `"excludeTools": ["run_shell_command(rm -rf)"]` will block the `rm -rf`
158
161
  command. Note that this differs from the MCP server `excludeTools`
159
162
  functionality, which can be listed in the MCP server config.
163
+ - `plan`: Planning features configuration.
164
+ - `directory`: The directory where planning artifacts are stored. This serves
165
+ as a fallback if the user hasn't specified a plan directory in their
166
+ settings. If not specified by either the extension or the user, the default
167
+ is `~/.gemini/tmp/<project>/<session-id>/plans/`.
160
168
 
161
169
  When Gemini CLI starts, it loads all the extensions and merges their
162
170
  configurations. If there are any conflicts, the workspace configuration takes
@@ -189,10 +189,18 @@ Custom commands create shortcuts for complex prompts.
189
189
 
190
190
  1. Create a `commands` directory and a subdirectory for your command group:
191
191
 
192
+ **macOS/Linux**
193
+
192
194
  ```bash
193
195
  mkdir -p commands/fs
194
196
  ```
195
197
 
198
+ **Windows (PowerShell)**
199
+
200
+ ```powershell
201
+ New-Item -ItemType Directory -Force -Path "commands\fs"
202
+ ```
203
+
196
204
  2. Create a file named `commands/fs/grep-code.toml`:
197
205
 
198
206
  ```toml
@@ -252,10 +260,18 @@ Skills are activated only when needed, which saves context tokens.
252
260
 
253
261
  1. Create a `skills` directory and a subdirectory for your skill:
254
262
 
263
+ **macOS/Linux**
264
+
255
265
  ```bash
256
266
  mkdir -p skills/security-audit
257
267
  ```
258
268
 
269
+ **Windows (PowerShell)**
270
+
271
+ ```powershell
272
+ New-Item -ItemType Directory -Force -Path "skills\security-audit"
273
+ ```
274
+
259
275
  2. Create a `skills/security-audit/SKILL.md` file:
260
276
 
261
277
  ```markdown
@@ -78,11 +78,20 @@ To authenticate and use Gemini CLI with a Gemini API key:
78
78
 
79
79
  2. Set the `GEMINI_API_KEY` environment variable to your key. For example:
80
80
 
81
+ **macOS/Linux**
82
+
81
83
  ```bash
82
84
  # Replace YOUR_GEMINI_API_KEY with the key from AI Studio
83
85
  export GEMINI_API_KEY="YOUR_GEMINI_API_KEY"
84
86
  ```
85
87
 
88
+ **Windows (PowerShell)**
89
+
90
+ ```powershell
91
+ # Replace YOUR_GEMINI_API_KEY with the key from AI Studio
92
+ $env:GEMINI_API_KEY="YOUR_GEMINI_API_KEY"
93
+ ```
94
+
86
95
  To make this setting persistent, see
87
96
  [Persisting Environment Variables](#persisting-vars).
88
97
 
@@ -114,12 +123,22 @@ or the location where you want to run your jobs.
114
123
 
115
124
  For example:
116
125
 
126
+ **macOS/Linux**
127
+
117
128
  ```bash
118
129
  # Replace with your project ID and desired location (e.g., us-central1)
119
130
  export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"
120
131
  export GOOGLE_CLOUD_LOCATION="YOUR_PROJECT_LOCATION"
121
132
  ```
122
133
 
134
+ **Windows (PowerShell)**
135
+
136
+ ```powershell
137
+ # Replace with your project ID and desired location (e.g., us-central1)
138
+ $env:GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"
139
+ $env:GOOGLE_CLOUD_LOCATION="YOUR_PROJECT_LOCATION"
140
+ ```
141
+
123
142
  To make any Vertex AI environment variable settings persistent, see
124
143
  [Persisting Environment Variables](#persisting-vars).
125
144
 
@@ -130,9 +149,17 @@ Consider this authentication method if you have Google Cloud CLI installed.
130
149
  > **Note:** If you have previously set `GOOGLE_API_KEY` or `GEMINI_API_KEY`, you
131
150
  > must unset them to use ADC:
132
151
  >
152
+ > **macOS/Linux**
153
+ >
133
154
  > ```bash
134
155
  > unset GOOGLE_API_KEY GEMINI_API_KEY
135
156
  > ```
157
+ >
158
+ > **Windows (PowerShell)**
159
+ >
160
+ > ```powershell
161
+ > Remove-Item Env:\GOOGLE_API_KEY, Env:\GEMINI_API_KEY -ErrorAction Ignore
162
+ > ```
136
163
 
137
164
  1. Verify you have a Google Cloud project and Vertex AI API is enabled.
138
165
 
@@ -160,9 +187,17 @@ pipelines, or if your organization restricts user-based ADC or API key creation.
160
187
  > **Note:** If you have previously set `GOOGLE_API_KEY` or `GEMINI_API_KEY`, you
161
188
  > must unset them:
162
189
  >
190
+ > **macOS/Linux**
191
+ >
163
192
  > ```bash
164
193
  > unset GOOGLE_API_KEY GEMINI_API_KEY
165
194
  > ```
195
+ >
196
+ > **Windows (PowerShell)**
197
+ >
198
+ > ```powershell
199
+ > Remove-Item Env:\GOOGLE_API_KEY, Env:\GEMINI_API_KEY -ErrorAction Ignore
200
+ > ```
166
201
 
167
202
  1. [Create a service account and key](https://cloud.google.com/iam/docs/keys-create-delete)
168
203
  and download the provided JSON file. Assign the "Vertex AI User" role to the
@@ -171,11 +206,20 @@ pipelines, or if your organization restricts user-based ADC or API key creation.
171
206
  2. Set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to the JSON
172
207
  file's absolute path. For example:
173
208
 
209
+ **macOS/Linux**
210
+
174
211
  ```bash
175
212
  # Replace /path/to/your/keyfile.json with the actual path
176
213
  export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/keyfile.json"
177
214
  ```
178
215
 
216
+ **Windows (PowerShell)**
217
+
218
+ ```powershell
219
+ # Replace C:\path\to\your\keyfile.json with the actual path
220
+ $env:GOOGLE_APPLICATION_CREDENTIALS="C:\path\to\your\keyfile.json"
221
+ ```
222
+
179
223
  3. [Configure your Google Cloud Project](#set-gcp).
180
224
 
181
225
  4. Start the CLI:
@@ -195,11 +239,20 @@ pipelines, or if your organization restricts user-based ADC or API key creation.
195
239
 
196
240
  2. Set the `GOOGLE_API_KEY` environment variable:
197
241
 
242
+ **macOS/Linux**
243
+
198
244
  ```bash
199
245
  # Replace YOUR_GOOGLE_API_KEY with your Vertex AI API key
200
246
  export GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY"
201
247
  ```
202
248
 
249
+ **Windows (PowerShell)**
250
+
251
+ ```powershell
252
+ # Replace YOUR_GOOGLE_API_KEY with your Vertex AI API key
253
+ $env:GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY"
254
+ ```
255
+
203
256
  > **Note:** If you see errors like
204
257
  > `"API keys are not supported by this API..."`, your organization might
205
258
  > restrict API key usage for this service. Try the other Vertex AI
@@ -243,11 +296,20 @@ To configure Gemini CLI to use a Google Cloud project, do the following:
243
296
 
244
297
  For example, to set the `GOOGLE_CLOUD_PROJECT_ID` variable:
245
298
 
299
+ **macOS/Linux**
300
+
246
301
  ```bash
247
302
  # Replace YOUR_PROJECT_ID with your actual Google Cloud project ID
248
303
  export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"
249
304
  ```
250
305
 
306
+ **Windows (PowerShell)**
307
+
308
+ ```powershell
309
+ # Replace YOUR_PROJECT_ID with your actual Google Cloud project ID
310
+ $env:GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"
311
+ ```
312
+
251
313
  To make this setting persistent, see
252
314
  [Persisting Environment Variables](#persisting-vars).
253
315
 
@@ -257,16 +319,22 @@ To avoid setting environment variables for every terminal session, you can
257
319
  persist them with the following methods:
258
320
 
259
321
  1. **Add your environment variables to your shell configuration file:** Append
260
- the `export ...` commands to your shell's startup file (e.g., `~/.bashrc`,
261
- `~/.zshrc`, or `~/.profile`) and reload your shell (e.g.,
262
- `source ~/.bashrc`).
322
+ the environment variable commands to your shell's startup file.
323
+
324
+ **macOS/Linux** (e.g., `~/.bashrc`, `~/.zshrc`, or `~/.profile`):
263
325
 
264
326
  ```bash
265
- # Example for .bashrc
266
327
  echo 'export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"' >> ~/.bashrc
267
328
  source ~/.bashrc
268
329
  ```
269
330
 
331
+ **Windows (PowerShell)** (e.g., `$PROFILE`):
332
+
333
+ ```powershell
334
+ Add-Content -Path $PROFILE -Value '$env:GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"'
335
+ . $PROFILE
336
+ ```
337
+
270
338
  > **Warning:** Be aware that when you export API keys or service account
271
339
  > paths in your shell configuration file, any process launched from that
272
340
  > shell can read them.
@@ -274,10 +342,13 @@ persist them with the following methods:
274
342
  2. **Use a `.env` file:** Create a `.gemini/.env` file in your project
275
343
  directory or home directory. Gemini CLI automatically loads variables from
276
344
  the first `.env` file it finds, searching up from the current directory,
277
- then in `~/.gemini/.env` or `~/.env`. `.gemini/.env` is recommended.
345
+ then in your home directory's `.gemini/.env` (e.g., `~/.gemini/.env` or
346
+ `%USERPROFILE%\.gemini\.env`).
278
347
 
279
348
  Example for user-wide settings:
280
349
 
350
+ **macOS/Linux**
351
+
281
352
  ```bash
282
353
  mkdir -p ~/.gemini
283
354
  cat >> ~/.gemini/.env <<'EOF'
@@ -286,6 +357,16 @@ persist them with the following methods:
286
357
  EOF
287
358
  ```
288
359
 
360
+ **Windows (PowerShell)**
361
+
362
+ ```powershell
363
+ New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.gemini"
364
+ @"
365
+ GOOGLE_CLOUD_PROJECT="your-project-id"
366
+ # Add other variables like GEMINI_API_KEY as needed
367
+ "@ | Out-File -FilePath "$env:USERPROFILE\.gemini\.env" -Encoding utf8 -Append
368
+ ```
369
+
289
370
  Variables are loaded from the first file found, not merged.
290
371
 
291
372
  ## Running in Google Cloud environments <a id="cloud-env"></a>
@@ -13,7 +13,7 @@ installation methods, and release types.
13
13
  - "Casual" usage: 4GB+ RAM (short sessions, common tasks and edits)
14
14
  - "Power" usage: 16GB+ RAM (long sessions, large codebases, deep context)
15
15
  - **Runtime:** Node.js 20.0.0+
16
- - **Shell:** Bash or Zsh
16
+ - **Shell:** Bash, Zsh, or PowerShell
17
17
  - **Location:**
18
18
  [Gemini Code Assist supported locations](https://developers.google.com/gemini-code-assist/resources/available-locations#americas)
19
19
  - **Internet connection required**
@@ -167,6 +167,8 @@ try {
167
167
  Run hook scripts manually with sample JSON input to verify they behave as
168
168
  expected before hooking them up to the CLI.
169
169
 
170
+ **macOS/Linux**
171
+
170
172
  ```bash
171
173
  # Create test input
172
174
  cat > test-input.json << 'EOF'
@@ -187,7 +189,30 @@ cat test-input.json | .gemini/hooks/my-hook.sh
187
189
 
188
190
  # Check exit code
189
191
  echo "Exit code: $?"
192
+ ```
193
+
194
+ **Windows (PowerShell)**
190
195
 
196
+ ```powershell
197
+ # Create test input
198
+ @"
199
+ {
200
+ "session_id": "test-123",
201
+ "cwd": "C:\\temp\\test",
202
+ "hook_event_name": "BeforeTool",
203
+ "tool_name": "write_file",
204
+ "tool_input": {
205
+ "file_path": "test.txt",
206
+ "content": "Test content"
207
+ }
208
+ }
209
+ "@ | Out-File -FilePath test-input.json -Encoding utf8
210
+
211
+ # Test the hook
212
+ Get-Content test-input.json | .\.gemini\hooks\my-hook.ps1
213
+
214
+ # Check exit code
215
+ Write-Host "Exit code: $LASTEXITCODE"
191
216
  ```
192
217
 
193
218
  ### Check exit codes
@@ -333,7 +358,7 @@ tool_name=$(echo "$input" | jq -r '.tool_name')
333
358
 
334
359
  ### Make scripts executable
335
360
 
336
- Always make hook scripts executable:
361
+ Always make hook scripts executable on macOS/Linux:
337
362
 
338
363
  ```bash
339
364
  chmod +x .gemini/hooks/*.sh
@@ -341,6 +366,10 @@ chmod +x .gemini/hooks/*.js
341
366
 
342
367
  ```
343
368
 
369
+ **Windows Note**: On Windows, PowerShell scripts (`.ps1`) don't use `chmod`, but
370
+ you may need to ensure your execution policy allows them to run (e.g.,
371
+ `Set-ExecutionPolicy RemoteSigned -Scope CurrentUser`).
372
+
344
373
  ### Version control
345
374
 
346
375
  Commit hooks to share with your team:
@@ -481,6 +510,9 @@ ls -la .gemini/hooks/my-hook.sh
481
510
  chmod +x .gemini/hooks/my-hook.sh
482
511
  ```
483
512
 
513
+ **Windows Note**: On Windows, ensure your execution policy allows running
514
+ scripts (e.g., `Get-ExecutionPolicy`).
515
+
484
516
  **Verify script path:** Ensure the path in `settings.json` resolves correctly.
485
517
 
486
518
  ```bash
@@ -28,6 +28,8 @@ Create a directory for hooks and a simple logging script.
28
28
  > This example uses `jq` to parse JSON. If you don't have it installed, you can
29
29
  > perform similar logic using Node.js or Python.
30
30
 
31
+ **macOS/Linux**
32
+
31
33
  ```bash
32
34
  mkdir -p .gemini/hooks
33
35
  cat > .gemini/hooks/log-tools.sh << 'EOF'
@@ -52,6 +54,28 @@ EOF
52
54
  chmod +x .gemini/hooks/log-tools.sh
53
55
  ```
54
56
 
57
+ **Windows (PowerShell)**
58
+
59
+ ```powershell
60
+ New-Item -ItemType Directory -Force -Path ".gemini\hooks"
61
+ @"
62
+ # Read hook input from stdin
63
+ `$inputJson = `$input | Out-String | ConvertFrom-Json
64
+
65
+ # Extract tool name
66
+ `$toolName = `$inputJson.tool_name
67
+
68
+ # Log to stderr (visible in terminal if hook fails, or captured in logs)
69
+ [Console]::Error.WriteLine("Logging tool: `$toolName")
70
+
71
+ # Log to file
72
+ "[`$(Get-Date -Format 'o')] Tool executed: `$toolName" | Out-File -FilePath ".gemini\tool-log.txt" -Append -Encoding utf8
73
+
74
+ # Return success with empty JSON
75
+ "{}"
76
+ "@ | Out-File -FilePath ".gemini\hooks\log-tools.ps1" -Encoding utf8
77
+ ```
78
+
55
79
  ## Exit Code Strategies
56
80
 
57
81
  There are two ways to control or block an action in Gemini CLI:
@@ -177,10 +177,18 @@ standalone terminal and want to manually associate it with a specific IDE
177
177
  instance, you can set the `GEMINI_CLI_IDE_PID` environment variable to the
178
178
  process ID (PID) of your IDE.
179
179
 
180
+ **macOS/Linux**
181
+
180
182
  ```bash
181
183
  export GEMINI_CLI_IDE_PID=12345
182
184
  ```
183
185
 
186
+ **Windows (PowerShell)**
187
+
188
+ ```powershell
189
+ $env:GEMINI_CLI_IDE_PID=12345
190
+ ```
191
+
184
192
  When this variable is set, Gemini CLI will skip automatic detection and attempt
185
193
  to connect using the provided PID.
186
194
 
@@ -270,6 +270,9 @@ Slash commands provide meta-level control over the CLI itself.
270
270
  one has been generated.
271
271
  - **Note:** This feature requires the `experimental.plan` setting to be
272
272
  enabled in your configuration.
273
+ - **Sub-commands:**
274
+ - **`copy`**:
275
+ - **Description:** Copy the currently approved plan to your clipboard.
273
276
 
274
277
  ### `/policies`
275
278
 
@@ -159,12 +159,12 @@ their corresponding top-level category object in your `settings.json` file.
159
159
 
160
160
  - **`general.sessionRetention.enabled`** (boolean):
161
161
  - **Description:** Enable automatic session cleanup
162
- - **Default:** `false`
162
+ - **Default:** `true`
163
163
 
164
164
  - **`general.sessionRetention.maxAge`** (string):
165
165
  - **Description:** Automatically delete chats older than this time period
166
166
  (e.g., "30d", "7d", "24h", "1w")
167
- - **Default:** `undefined`
167
+ - **Default:** `"30d"`
168
168
 
169
169
  - **`general.sessionRetention.maxCount`** (number):
170
170
  - **Description:** Alternative: Maximum number of sessions to keep (most
@@ -175,11 +175,6 @@ their corresponding top-level category object in your `settings.json` file.
175
175
  - **Description:** Minimum retention period (safety limit, defaults to "1d")
176
176
  - **Default:** `"1d"`
177
177
 
178
- - **`general.sessionRetention.warningAcknowledged`** (boolean):
179
- - **Description:** INTERNAL: Whether the user has acknowledged the session
180
- retention warning
181
- - **Default:** `false`
182
-
183
178
  #### `output`
184
179
 
185
180
  - **`output.format`** (enum):
@@ -268,7 +263,7 @@ their corresponding top-level category object in your `settings.json` file.
268
263
  - **Default:** `false`
269
264
 
270
265
  - **`ui.footer.hideContextPercentage`** (boolean):
271
- - **Description:** Hides the context window remaining percentage.
266
+ - **Description:** Hides the context window usage percentage.
272
267
  - **Default:** `true`
273
268
 
274
269
  - **`ui.hideFooter`** (boolean):
@@ -1332,7 +1327,8 @@ the `advanced.excludedEnvVars` setting in your `settings.json` file.
1332
1327
  - **`GEMINI_MODEL`**:
1333
1328
  - Specifies the default Gemini model to use.
1334
1329
  - Overrides the hardcoded default
1335
- - Example: `export GEMINI_MODEL="gemini-3-flash-preview"`
1330
+ - Example: `export GEMINI_MODEL="gemini-3-flash-preview"` (Windows PowerShell:
1331
+ `$env:GEMINI_MODEL="gemini-3-flash-preview"`)
1336
1332
  - **`GEMINI_CLI_IDE_PID`**:
1337
1333
  - Manually specifies the PID of the IDE process to use for integration. This
1338
1334
  is useful when running Gemini CLI in a standalone terminal while still
@@ -1344,12 +1340,14 @@ the `advanced.excludedEnvVars` setting in your `settings.json` file.
1344
1340
  - By default, this is the user's system home directory. The CLI will create a
1345
1341
  `.gemini` folder inside this directory.
1346
1342
  - Useful for shared compute environments or keeping CLI state isolated.
1347
- - Example: `export GEMINI_CLI_HOME="/path/to/user/config"`
1343
+ - Example: `export GEMINI_CLI_HOME="/path/to/user/config"` (Windows
1344
+ PowerShell: `$env:GEMINI_CLI_HOME="C:\path\to\user\config"`)
1348
1345
  - **`GOOGLE_API_KEY`**:
1349
1346
  - Your Google Cloud API key.
1350
1347
  - Required for using Vertex AI in express mode.
1351
1348
  - Ensure you have the necessary permissions.
1352
- - Example: `export GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY"`.
1349
+ - Example: `export GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY"` (Windows PowerShell:
1350
+ `$env:GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY"`).
1353
1351
  - **`GOOGLE_CLOUD_PROJECT`**:
1354
1352
  - Your Google Cloud Project ID.
1355
1353
  - Required for using Code Assist or Vertex AI.
@@ -1360,18 +1358,23 @@ the `advanced.excludedEnvVars` setting in your `settings.json` file.
1360
1358
  you have `GOOGLE_CLOUD_PROJECT` set in your global environment in Cloud
1361
1359
  Shell, it will be overridden by this default. To use a different project in
1362
1360
  Cloud Shell, you must define `GOOGLE_CLOUD_PROJECT` in a `.env` file.
1363
- - Example: `export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"`.
1361
+ - Example: `export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"` (Windows
1362
+ PowerShell: `$env:GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"`).
1364
1363
  - **`GOOGLE_APPLICATION_CREDENTIALS`** (string):
1365
1364
  - **Description:** The path to your Google Application Credentials JSON file.
1366
1365
  - **Example:**
1367
1366
  `export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/credentials.json"`
1367
+ (Windows PowerShell:
1368
+ `$env:GOOGLE_APPLICATION_CREDENTIALS="C:\path\to\your\credentials.json"`)
1368
1369
  - **`GOOGLE_GENAI_API_VERSION`**:
1369
1370
  - Specifies the API version to use for Gemini API requests.
1370
1371
  - When set, overrides the default API version used by the SDK.
1371
- - Example: `export GOOGLE_GENAI_API_VERSION="v1"`
1372
+ - Example: `export GOOGLE_GENAI_API_VERSION="v1"` (Windows PowerShell:
1373
+ `$env:GOOGLE_GENAI_API_VERSION="v1"`)
1372
1374
  - **`OTLP_GOOGLE_CLOUD_PROJECT`**:
1373
1375
  - Your Google Cloud Project ID for Telemetry in Google Cloud
1374
- - Example: `export OTLP_GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"`.
1376
+ - Example: `export OTLP_GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"` (Windows
1377
+ PowerShell: `$env:OTLP_GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"`).
1375
1378
  - **`GEMINI_TELEMETRY_ENABLED`**:
1376
1379
  - Set to `true` or `1` to enable telemetry. Any other value is treated as
1377
1380
  disabling it.
@@ -1399,7 +1402,8 @@ the `advanced.excludedEnvVars` setting in your `settings.json` file.
1399
1402
  - **`GOOGLE_CLOUD_LOCATION`**:
1400
1403
  - Your Google Cloud Project Location (e.g., us-central1).
1401
1404
  - Required for using Vertex AI in non-express mode.
1402
- - Example: `export GOOGLE_CLOUD_LOCATION="YOUR_PROJECT_LOCATION"`.
1405
+ - Example: `export GOOGLE_CLOUD_LOCATION="YOUR_PROJECT_LOCATION"` (Windows
1406
+ PowerShell: `$env:GOOGLE_CLOUD_LOCATION="YOUR_PROJECT_LOCATION"`).
1403
1407
  - **`GEMINI_SANDBOX`**:
1404
1408
  - Alternative to the `sandbox` setting in `settings.json`.
1405
1409
  - Accepts `true`, `false`, `docker`, `podman`, or a custom command string.
@@ -152,3 +152,13 @@ available combinations.
152
152
  inline when the cursor is over the placeholder.
153
153
  - `Double-click` on a paste placeholder (alternate buffer mode only): Expand to
154
154
  view full content inline. Double-click again to collapse.
155
+
156
+ ## Limitations
157
+
158
+ - On [Windows Terminal](https://en.wikipedia.org/wiki/Windows_Terminal):
159
+ - `shift+enter` is not supported.
160
+ - `shift+tab`
161
+ [is not supported](https://github.com/google-gemini/gemini-cli/issues/20314)
162
+ on Node 20 and earlier versions of Node 22.
163
+ - On macOS's [Terminal](<https://en.wikipedia.org/wiki/Terminal_(macOS)>):
164
+ - `shift+enter` is not supported.
@@ -10,9 +10,19 @@ confirmation.
10
10
  To create your first policy:
11
11
 
12
12
  1. **Create the policy directory** if it doesn't exist:
13
+
14
+ **macOS/Linux**
15
+
13
16
  ```bash
14
17
  mkdir -p ~/.gemini/policies
15
18
  ```
19
+
20
+ **Windows (PowerShell)**
21
+
22
+ ```powershell
23
+ New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.gemini\policies"
24
+ ```
25
+
16
26
  2. **Create a new policy file** (e.g., `~/.gemini/policies/my-rules.toml`). You
17
27
  can use any filename ending in `.toml`; all such files in this directory
18
28
  will be loaded and combined:
@@ -88,10 +88,18 @@ You can configure your Google Cloud Project ID using an environment variable.
88
88
 
89
89
  Set the `GOOGLE_CLOUD_PROJECT` environment variable in your shell:
90
90
 
91
+ **macOS/Linux**
92
+
91
93
  ```bash
92
94
  export GOOGLE_CLOUD_PROJECT="your-project-id"
93
95
  ```
94
96
 
97
+ **Windows (PowerShell)**
98
+
99
+ ```powershell
100
+ $env:GOOGLE_CLOUD_PROJECT="your-project-id"
101
+ ```
102
+
95
103
  To make this setting permanent, add this line to your shell's startup file
96
104
  (e.g., `~/.bashrc`, `~/.zshrc`).
97
105
 
@@ -55,10 +55,13 @@ topics on:
55
55
  - Set the `NODE_USE_SYSTEM_CA=1` environment variable to tell Node.js to use
56
56
  the operating system's native certificate store (where corporate
57
57
  certificates are typically already installed).
58
- - Example: `export NODE_USE_SYSTEM_CA=1`
58
+ - Example: `export NODE_USE_SYSTEM_CA=1` (Windows PowerShell:
59
+ `$env:NODE_USE_SYSTEM_CA=1`)
59
60
  - Set the `NODE_EXTRA_CA_CERTS` environment variable to the absolute path of
60
61
  your corporate root CA certificate file.
61
62
  - Example: `export NODE_EXTRA_CA_CERTS=/path/to/your/corporate-ca.crt`
63
+ (Windows PowerShell:
64
+ `$env:NODE_EXTRA_CA_CERTS="C:\path\to\your\corporate-ca.crt"`)
62
65
 
63
66
  ## Common error messages and solutions
64
67
 
@@ -94,7 +94,14 @@
94
94
  { "label": "Agent Skills", "slug": "docs/cli/skills" },
95
95
  { "label": "Checkpointing", "slug": "docs/cli/checkpointing" },
96
96
  { "label": "Headless mode", "slug": "docs/cli/headless" },
97
- { "label": "Hooks", "slug": "docs/hooks" },
97
+ {
98
+ "label": "Hooks",
99
+ "collapsed": true,
100
+ "items": [
101
+ { "label": "Overview", "slug": "docs/hooks" },
102
+ { "label": "Reference", "slug": "docs/hooks/reference" }
103
+ ]
104
+ },
98
105
  { "label": "IDE integration", "slug": "docs/ide-integration" },
99
106
  { "label": "MCP servers", "slug": "docs/tools/mcp-server" },
100
107
  { "label": "Model routing", "slug": "docs/cli/model-routing" },
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import type { Message, TaskState } from '@a2a-js/sdk';
7
7
  import type { SendMessageResult } from './a2a-client-manager.js';
8
+ export declare const AUTH_REQUIRED_MSG = "[Authorization Required] The agent has indicated it requires authorization to proceed. Please follow the agent's instructions.";
8
9
  /**
9
10
  * Reassembles incremental A2A streaming updates into a coherent result.
10
11
  * Shows sequential status/messages followed by all reassembled artifacts.
@@ -17,6 +18,7 @@ export declare class A2AResultReassembler {
17
18
  * Processes a new chunk from the A2A stream.
18
19
  */
19
20
  update(chunk: SendMessageResult): void;
21
+ private appendStateInstructions;
20
22
  private pushMessage;
21
23
  /**
22
24
  * Returns a human-readable string representation of the current reassembled state.
@@ -3,6 +3,7 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ export const AUTH_REQUIRED_MSG = `[Authorization Required] The agent has indicated it requires authorization to proceed. Please follow the agent's instructions.`;
6
7
  /**
7
8
  * Reassembles incremental A2A streaming updates into a coherent result.
8
9
  * Shows sequential status/messages followed by all reassembled artifacts.
@@ -19,6 +20,7 @@ export class A2AResultReassembler {
19
20
  return;
20
21
  switch (chunk.kind) {
21
22
  case 'status-update':
23
+ this.appendStateInstructions(chunk.status?.state);
22
24
  this.pushMessage(chunk.status?.message);
23
25
  break;
24
26
  case 'artifact-update':
@@ -49,6 +51,7 @@ export class A2AResultReassembler {
49
51
  }
50
52
  break;
51
53
  case 'task':
54
+ this.appendStateInstructions(chunk.status?.state);
52
55
  this.pushMessage(chunk.status?.message);
53
56
  if (chunk.artifacts) {
54
57
  for (const art of chunk.artifacts) {
@@ -85,6 +88,15 @@ export class A2AResultReassembler {
85
88
  break;
86
89
  }
87
90
  }
91
+ appendStateInstructions(state) {
92
+ if (state !== 'auth-required') {
93
+ return;
94
+ }
95
+ // Prevent duplicate instructions if multiple chunks report auth-required
96
+ if (!this.messageLog.includes(AUTH_REQUIRED_MSG)) {
97
+ this.messageLog.push(AUTH_REQUIRED_MSG);
98
+ }
99
+ }
88
100
  pushMessage(message) {
89
101
  if (!message)
90
102
  return;