@google/gemini-cli-core 0.31.0 → 0.33.0-nightly.20260228.1ca5c05d0

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 (323) hide show
  1. package/dist/docs/changelogs/index.md +22 -0
  2. package/dist/docs/changelogs/latest.md +307 -352
  3. package/dist/docs/changelogs/preview.md +391 -293
  4. package/dist/docs/cli/cli-reference.md +12 -12
  5. package/dist/docs/cli/custom-commands.md +9 -0
  6. package/dist/docs/cli/enterprise.md +19 -0
  7. package/dist/docs/cli/model.md +5 -14
  8. package/dist/docs/cli/plan-mode.md +29 -7
  9. package/dist/docs/cli/sandbox.md +42 -2
  10. package/dist/docs/cli/settings.md +15 -6
  11. package/dist/docs/cli/telemetry.md +68 -11
  12. package/dist/docs/cli/tutorials/automation.md +101 -5
  13. package/dist/docs/cli/tutorials/mcp-setup.md +8 -0
  14. package/dist/docs/cli/tutorials/skills-getting-started.md +8 -0
  15. package/dist/docs/extensions/reference.md +36 -0
  16. package/dist/docs/extensions/writing-extensions.md +16 -0
  17. package/dist/docs/get-started/authentication.md +86 -5
  18. package/dist/docs/get-started/installation.md +2 -2
  19. package/dist/docs/hooks/best-practices.md +33 -1
  20. package/dist/docs/hooks/writing-hooks.md +24 -0
  21. package/dist/docs/ide-integration/index.md +8 -0
  22. package/dist/docs/local-development.md +49 -43
  23. package/dist/docs/reference/configuration.md +48 -7
  24. package/dist/docs/reference/keyboard-shortcuts.md +6 -6
  25. package/dist/docs/reference/policy-engine.md +14 -3
  26. package/dist/docs/resources/faq.md +21 -0
  27. package/dist/docs/resources/tos-privacy.md +6 -0
  28. package/dist/docs/resources/troubleshooting.md +4 -1
  29. package/dist/docs/resources/uninstall.md +1 -10
  30. package/dist/docs/tools/mcp-server.md +22 -0
  31. package/dist/google-gemini-cli-core-0.33.0-nightly.20260227.08ee13613.tgz +0 -0
  32. package/dist/src/agents/a2a-client-manager.d.ts +7 -6
  33. package/dist/src/agents/a2a-client-manager.js +8 -9
  34. package/dist/src/agents/a2a-client-manager.js.map +1 -1
  35. package/dist/src/agents/a2a-client-manager.test.js +45 -31
  36. package/dist/src/agents/a2a-client-manager.test.js.map +1 -1
  37. package/dist/src/agents/a2aUtils.d.ts +25 -7
  38. package/dist/src/agents/a2aUtils.js +165 -58
  39. package/dist/src/agents/a2aUtils.js.map +1 -1
  40. package/dist/src/agents/a2aUtils.test.js +170 -27
  41. package/dist/src/agents/a2aUtils.test.js.map +1 -1
  42. package/dist/src/agents/generalist-agent.js +1 -2
  43. package/dist/src/agents/generalist-agent.js.map +1 -1
  44. package/dist/src/agents/registry.test.js +4 -2
  45. package/dist/src/agents/registry.test.js.map +1 -1
  46. package/dist/src/agents/remote-invocation.d.ts +2 -1
  47. package/dist/src/agents/remote-invocation.js +41 -22
  48. package/dist/src/agents/remote-invocation.js.map +1 -1
  49. package/dist/src/agents/remote-invocation.test.js +196 -56
  50. package/dist/src/agents/remote-invocation.test.js.map +1 -1
  51. package/dist/src/agents/subagent-tool-wrapper.js +1 -1
  52. package/dist/src/agents/subagent-tool-wrapper.test.js +1 -1
  53. package/dist/src/agents/subagent-tool.js +15 -2
  54. package/dist/src/agents/subagent-tool.js.map +1 -1
  55. package/dist/src/agents/subagent-tool.test.js +31 -0
  56. package/dist/src/agents/subagent-tool.test.js.map +1 -1
  57. package/dist/src/billing/billing.d.ts +80 -0
  58. package/dist/src/billing/billing.js +127 -0
  59. package/dist/src/billing/billing.js.map +1 -0
  60. package/dist/src/billing/billing.test.d.ts +6 -0
  61. package/dist/src/billing/billing.test.js +182 -0
  62. package/dist/src/billing/billing.test.js.map +1 -0
  63. package/dist/src/billing/index.d.ts +6 -0
  64. package/dist/src/billing/index.js +7 -0
  65. package/dist/src/billing/index.js.map +1 -0
  66. package/dist/src/code_assist/codeAssist.js +1 -1
  67. package/dist/src/code_assist/codeAssist.js.map +1 -1
  68. package/dist/src/code_assist/codeAssist.test.js +2 -2
  69. package/dist/src/code_assist/codeAssist.test.js.map +1 -1
  70. package/dist/src/code_assist/converter.d.ts +9 -4
  71. package/dist/src/code_assist/converter.js +17 -2
  72. package/dist/src/code_assist/converter.js.map +1 -1
  73. package/dist/src/code_assist/converter.test.js.map +1 -1
  74. package/dist/src/code_assist/oauth2.js +6 -3
  75. package/dist/src/code_assist/oauth2.js.map +1 -1
  76. package/dist/src/code_assist/oauth2.test.js +1 -0
  77. package/dist/src/code_assist/oauth2.test.js.map +1 -1
  78. package/dist/src/code_assist/server.d.ts +9 -4
  79. package/dist/src/code_assist/server.js +86 -5
  80. package/dist/src/code_assist/server.js.map +1 -1
  81. package/dist/src/code_assist/server.test.js +11 -0
  82. package/dist/src/code_assist/server.test.js.map +1 -1
  83. package/dist/src/code_assist/setup.d.ts +2 -1
  84. package/dist/src/code_assist/setup.js +15 -4
  85. package/dist/src/code_assist/setup.js.map +1 -1
  86. package/dist/src/code_assist/types.d.ts +33 -10
  87. package/dist/src/code_assist/types.js.map +1 -1
  88. package/dist/src/config/config.d.ts +50 -4
  89. package/dist/src/config/config.js +77 -3
  90. package/dist/src/config/config.js.map +1 -1
  91. package/dist/src/config/config.test.js +151 -1
  92. package/dist/src/config/config.test.js.map +1 -1
  93. package/dist/src/config/storage.d.ts +1 -0
  94. package/dist/src/config/storage.js +3 -0
  95. package/dist/src/config/storage.js.map +1 -1
  96. package/dist/src/core/contentGenerator.d.ts +3 -2
  97. package/dist/src/core/contentGenerator.js +9 -2
  98. package/dist/src/core/contentGenerator.js.map +1 -1
  99. package/dist/src/core/coreToolScheduler.js +2 -1
  100. package/dist/src/core/coreToolScheduler.js.map +1 -1
  101. package/dist/src/core/coreToolScheduler.test.js +21 -2
  102. package/dist/src/core/coreToolScheduler.test.js.map +1 -1
  103. package/dist/src/core/fakeContentGenerator.d.ts +2 -1
  104. package/dist/src/core/fakeContentGenerator.js +1 -0
  105. package/dist/src/core/fakeContentGenerator.js.map +1 -1
  106. package/dist/src/core/geminiChat.js +6 -2
  107. package/dist/src/core/geminiChat.js.map +1 -1
  108. package/dist/src/core/geminiChat.test.js +34 -0
  109. package/dist/src/core/geminiChat.test.js.map +1 -1
  110. package/dist/src/core/localLiteRtLmClient.d.ts +24 -0
  111. package/dist/src/core/localLiteRtLmClient.js +77 -0
  112. package/dist/src/core/localLiteRtLmClient.js.map +1 -0
  113. package/dist/src/core/localLiteRtLmClient.test.d.ts +6 -0
  114. package/dist/src/core/localLiteRtLmClient.test.js +87 -0
  115. package/dist/src/core/localLiteRtLmClient.test.js.map +1 -0
  116. package/dist/src/core/loggingContentGenerator.d.ts +3 -1
  117. package/dist/src/core/loggingContentGenerator.js +65 -17
  118. package/dist/src/core/loggingContentGenerator.js.map +1 -1
  119. package/dist/src/core/loggingContentGenerator.test.js +164 -5
  120. package/dist/src/core/loggingContentGenerator.test.js.map +1 -1
  121. package/dist/src/core/prompts.test.js +1 -1
  122. package/dist/src/core/prompts.test.js.map +1 -1
  123. package/dist/src/fallback/handler.js +2 -0
  124. package/dist/src/fallback/handler.js.map +1 -1
  125. package/dist/src/fallback/types.d.ts +1 -1
  126. package/dist/src/generated/git-commit.d.ts +2 -2
  127. package/dist/src/generated/git-commit.js +2 -2
  128. package/dist/src/generated/git-commit.js.map +1 -1
  129. package/dist/src/index.d.ts +5 -0
  130. package/dist/src/index.js +5 -0
  131. package/dist/src/index.js.map +1 -1
  132. package/dist/src/policy/config.d.ts +18 -6
  133. package/dist/src/policy/config.js +50 -12
  134. package/dist/src/policy/config.js.map +1 -1
  135. package/dist/src/policy/config.test.js +26 -26
  136. package/dist/src/policy/config.test.js.map +1 -1
  137. package/dist/src/policy/policies/plan.toml +1 -1
  138. package/dist/src/policy/policy-engine.d.ts +8 -0
  139. package/dist/src/policy/policy-engine.js +12 -0
  140. package/dist/src/policy/policy-engine.js.map +1 -1
  141. package/dist/src/policy/policy-engine.test.js +93 -0
  142. package/dist/src/policy/policy-engine.test.js.map +1 -1
  143. package/dist/src/policy/toml-loader.d.ts +1 -1
  144. package/dist/src/policy/toml-loader.js +4 -2
  145. package/dist/src/policy/toml-loader.js.map +1 -1
  146. package/dist/src/policy/toml-loader.test.js +15 -12
  147. package/dist/src/policy/toml-loader.test.js.map +1 -1
  148. package/dist/src/policy/workspace-policy.test.js +10 -10
  149. package/dist/src/prompts/snippets.js +43 -27
  150. package/dist/src/prompts/snippets.js.map +1 -1
  151. package/dist/src/routing/modelRouterService.js +19 -11
  152. package/dist/src/routing/modelRouterService.js.map +1 -1
  153. package/dist/src/routing/modelRouterService.test.js +38 -1
  154. package/dist/src/routing/modelRouterService.test.js.map +1 -1
  155. package/dist/src/routing/routingStrategy.d.ts +3 -2
  156. package/dist/src/routing/strategies/classifierStrategy.d.ts +2 -1
  157. package/dist/src/routing/strategies/classifierStrategy.js +1 -1
  158. package/dist/src/routing/strategies/classifierStrategy.js.map +1 -1
  159. package/dist/src/routing/strategies/classifierStrategy.test.js +15 -13
  160. package/dist/src/routing/strategies/classifierStrategy.test.js.map +1 -1
  161. package/dist/src/routing/strategies/compositeStrategy.d.ts +2 -1
  162. package/dist/src/routing/strategies/compositeStrategy.js +3 -3
  163. package/dist/src/routing/strategies/compositeStrategy.js.map +1 -1
  164. package/dist/src/routing/strategies/compositeStrategy.test.js +10 -8
  165. package/dist/src/routing/strategies/compositeStrategy.test.js.map +1 -1
  166. package/dist/src/routing/strategies/defaultStrategy.d.ts +2 -1
  167. package/dist/src/routing/strategies/defaultStrategy.js +1 -1
  168. package/dist/src/routing/strategies/defaultStrategy.js.map +1 -1
  169. package/dist/src/routing/strategies/defaultStrategy.test.js +8 -4
  170. package/dist/src/routing/strategies/defaultStrategy.test.js.map +1 -1
  171. package/dist/src/routing/strategies/fallbackStrategy.d.ts +2 -1
  172. package/dist/src/routing/strategies/fallbackStrategy.js +1 -1
  173. package/dist/src/routing/strategies/fallbackStrategy.js.map +1 -1
  174. package/dist/src/routing/strategies/fallbackStrategy.test.js +6 -5
  175. package/dist/src/routing/strategies/fallbackStrategy.test.js.map +1 -1
  176. package/dist/src/routing/strategies/gemmaClassifierStrategy.d.ts +14 -0
  177. package/dist/src/routing/strategies/gemmaClassifierStrategy.js +182 -0
  178. package/dist/src/routing/strategies/gemmaClassifierStrategy.js.map +1 -0
  179. package/dist/src/routing/strategies/gemmaClassifierStrategy.test.d.ts +6 -0
  180. package/dist/src/routing/strategies/gemmaClassifierStrategy.test.js +218 -0
  181. package/dist/src/routing/strategies/gemmaClassifierStrategy.test.js.map +1 -0
  182. package/dist/src/routing/strategies/numericalClassifierStrategy.d.ts +2 -1
  183. package/dist/src/routing/strategies/numericalClassifierStrategy.js +1 -1
  184. package/dist/src/routing/strategies/numericalClassifierStrategy.js.map +1 -1
  185. package/dist/src/routing/strategies/numericalClassifierStrategy.test.js +24 -22
  186. package/dist/src/routing/strategies/numericalClassifierStrategy.test.js.map +1 -1
  187. package/dist/src/routing/strategies/overrideStrategy.d.ts +2 -1
  188. package/dist/src/routing/strategies/overrideStrategy.js +1 -1
  189. package/dist/src/routing/strategies/overrideStrategy.js.map +1 -1
  190. package/dist/src/routing/strategies/overrideStrategy.test.js +5 -4
  191. package/dist/src/routing/strategies/overrideStrategy.test.js.map +1 -1
  192. package/dist/src/scheduler/scheduler.d.ts +1 -0
  193. package/dist/src/scheduler/scheduler.js +18 -7
  194. package/dist/src/scheduler/scheduler.js.map +1 -1
  195. package/dist/src/scheduler/scheduler.test.js +19 -1
  196. package/dist/src/scheduler/scheduler.test.js.map +1 -1
  197. package/dist/src/scheduler/scheduler_parallel.test.js +94 -3
  198. package/dist/src/scheduler/scheduler_parallel.test.js.map +1 -1
  199. package/dist/src/scheduler/tool-executor.js +21 -12
  200. package/dist/src/scheduler/tool-executor.js.map +1 -1
  201. package/dist/src/scheduler/tool-executor.test.js +54 -0
  202. package/dist/src/scheduler/tool-executor.test.js.map +1 -1
  203. package/dist/src/services/trackerService.d.ts +49 -0
  204. package/dist/src/services/trackerService.js +172 -0
  205. package/dist/src/services/trackerService.js.map +1 -0
  206. package/dist/src/services/trackerService.test.d.ts +6 -0
  207. package/dist/src/services/trackerService.test.js +117 -0
  208. package/dist/src/services/trackerService.test.js.map +1 -0
  209. package/dist/src/services/trackerTypes.d.ts +51 -0
  210. package/dist/src/services/trackerTypes.js +33 -0
  211. package/dist/src/services/trackerTypes.js.map +1 -0
  212. package/dist/src/telemetry/billingEvents.d.ts +75 -0
  213. package/dist/src/telemetry/billingEvents.js +181 -0
  214. package/dist/src/telemetry/billingEvents.js.map +1 -0
  215. package/dist/src/telemetry/billingEvents.test.d.ts +6 -0
  216. package/dist/src/telemetry/billingEvents.test.js +139 -0
  217. package/dist/src/telemetry/billingEvents.test.js.map +1 -0
  218. package/dist/src/telemetry/conseca-logger.test.js +1 -0
  219. package/dist/src/telemetry/conseca-logger.test.js.map +1 -1
  220. package/dist/src/telemetry/constants.d.ts +25 -0
  221. package/dist/src/telemetry/constants.js +29 -0
  222. package/dist/src/telemetry/constants.js.map +1 -1
  223. package/dist/src/telemetry/index.d.ts +3 -1
  224. package/dist/src/telemetry/index.js +5 -1
  225. package/dist/src/telemetry/index.js.map +1 -1
  226. package/dist/src/telemetry/loggers.d.ts +2 -0
  227. package/dist/src/telemetry/loggers.js +10 -0
  228. package/dist/src/telemetry/loggers.js.map +1 -1
  229. package/dist/src/telemetry/loggers.test.js +16 -0
  230. package/dist/src/telemetry/loggers.test.js.map +1 -1
  231. package/dist/src/telemetry/metrics.d.ts +28 -0
  232. package/dist/src/telemetry/metrics.js +40 -0
  233. package/dist/src/telemetry/metrics.js.map +1 -1
  234. package/dist/src/telemetry/sanitize.test.js +1 -0
  235. package/dist/src/telemetry/sanitize.test.js.map +1 -1
  236. package/dist/src/telemetry/sdk.test.js +1 -0
  237. package/dist/src/telemetry/sdk.test.js.map +1 -1
  238. package/dist/src/telemetry/telemetryAttributes.js +2 -0
  239. package/dist/src/telemetry/telemetryAttributes.js.map +1 -1
  240. package/dist/src/telemetry/trace.d.ts +2 -1
  241. package/dist/src/telemetry/trace.js +13 -18
  242. package/dist/src/telemetry/trace.js.map +1 -1
  243. package/dist/src/telemetry/trace.test.d.ts +6 -0
  244. package/dist/src/telemetry/trace.test.js +116 -0
  245. package/dist/src/telemetry/trace.test.js.map +1 -0
  246. package/dist/src/tools/confirmation-policy.test.js +1 -0
  247. package/dist/src/tools/confirmation-policy.test.js.map +1 -1
  248. package/dist/src/tools/definitions/model-family-sets/default-legacy.js +2 -2
  249. package/dist/src/tools/definitions/model-family-sets/default-legacy.js.map +1 -1
  250. package/dist/src/tools/definitions/model-family-sets/gemini-3.js +3 -3
  251. package/dist/src/tools/definitions/model-family-sets/gemini-3.js.map +1 -1
  252. package/dist/src/tools/grep-utils.d.ts +1 -1
  253. package/dist/src/tools/grep-utils.js +4 -4
  254. package/dist/src/tools/grep-utils.js.map +1 -1
  255. package/dist/src/tools/grep.d.ts +1 -1
  256. package/dist/src/tools/grep.js +9 -9
  257. package/dist/src/tools/grep.js.map +1 -1
  258. package/dist/src/tools/grep.test.js +8 -5
  259. package/dist/src/tools/grep.test.js.map +1 -1
  260. package/dist/src/tools/line-endings.test.js +3 -11
  261. package/dist/src/tools/line-endings.test.js.map +1 -1
  262. package/dist/src/tools/mcp-client-manager.d.ts +25 -0
  263. package/dist/src/tools/mcp-client-manager.js +66 -3
  264. package/dist/src/tools/mcp-client-manager.js.map +1 -1
  265. package/dist/src/tools/mcp-client-manager.test.js +47 -0
  266. package/dist/src/tools/mcp-client-manager.test.js.map +1 -1
  267. package/dist/src/tools/mcp-client.d.ts +20 -9
  268. package/dist/src/tools/mcp-client.js +50 -46
  269. package/dist/src/tools/mcp-client.js.map +1 -1
  270. package/dist/src/tools/mcp-client.test.js +96 -84
  271. package/dist/src/tools/mcp-client.test.js.map +1 -1
  272. package/dist/src/tools/mcp-tool.d.ts +3 -3
  273. package/dist/src/tools/mcp-tool.js +1 -0
  274. package/dist/src/tools/mcp-tool.js.map +1 -1
  275. package/dist/src/tools/ripGrep.d.ts +1 -1
  276. package/dist/src/tools/ripGrep.js +7 -7
  277. package/dist/src/tools/ripGrep.js.map +1 -1
  278. package/dist/src/tools/ripGrep.test.js +10 -7
  279. package/dist/src/tools/ripGrep.test.js.map +1 -1
  280. package/dist/src/tools/tools.d.ts +1 -0
  281. package/dist/src/tools/tools.js +1 -0
  282. package/dist/src/tools/tools.js.map +1 -1
  283. package/dist/src/tools/write-file.js +4 -17
  284. package/dist/src/tools/write-file.js.map +1 -1
  285. package/dist/src/tools/write-file.test.js +29 -83
  286. package/dist/src/tools/write-file.test.js.map +1 -1
  287. package/dist/src/utils/editCorrector.d.ts +1 -42
  288. package/dist/src/utils/editCorrector.js +9 -461
  289. package/dist/src/utils/editCorrector.js.map +1 -1
  290. package/dist/src/utils/editCorrector.test.js +17 -421
  291. package/dist/src/utils/editCorrector.test.js.map +1 -1
  292. package/dist/src/utils/envExpansion.js.map +1 -1
  293. package/dist/src/utils/errors.js +7 -0
  294. package/dist/src/utils/errors.js.map +1 -1
  295. package/dist/src/utils/errors_timeout.test.d.ts +6 -0
  296. package/dist/src/utils/errors_timeout.test.js +40 -0
  297. package/dist/src/utils/errors_timeout.test.js.map +1 -0
  298. package/dist/src/utils/extensionLoader.js +35 -0
  299. package/dist/src/utils/extensionLoader.js.map +1 -1
  300. package/dist/src/utils/extensionLoader.test.js +36 -0
  301. package/dist/src/utils/extensionLoader.test.js.map +1 -1
  302. package/dist/src/utils/fetch.js +13 -2
  303. package/dist/src/utils/fetch.js.map +1 -1
  304. package/dist/src/utils/fileUtils.js +0 -1
  305. package/dist/src/utils/fileUtils.js.map +1 -1
  306. package/dist/src/utils/fileUtils.test.js +0 -1
  307. package/dist/src/utils/fileUtils.test.js.map +1 -1
  308. package/dist/src/utils/flashFallback.test.js +24 -0
  309. package/dist/src/utils/flashFallback.test.js.map +1 -1
  310. package/dist/src/utils/googleErrors.d.ts +2 -2
  311. package/dist/src/utils/googleQuotaErrors.d.ts +3 -1
  312. package/dist/src/utils/googleQuotaErrors.js +22 -12
  313. package/dist/src/utils/googleQuotaErrors.js.map +1 -1
  314. package/dist/src/utils/googleQuotaErrors.test.js +33 -1
  315. package/dist/src/utils/googleQuotaErrors.test.js.map +1 -1
  316. package/dist/src/utils/retry.js +4 -2
  317. package/dist/src/utils/retry.js.map +1 -1
  318. package/dist/src/utils/retry.test.js +20 -0
  319. package/dist/src/utils/retry.test.js.map +1 -1
  320. package/dist/src/utils/schemaValidator.js +0 -1
  321. package/dist/src/utils/schemaValidator.js.map +1 -1
  322. package/dist/tsconfig.tsbuildinfo +1 -1
  323. package/package.json +1 -1
@@ -227,6 +227,42 @@ skill definitions in a `skills/` directory. For example,
227
227
  Provide [sub-agents](../core/subagents.md) that users can delegate tasks to. Add
228
228
  agent definition files (`.md`) to an `agents/` directory in your extension root.
229
229
 
230
+ ### <a id="policy-engine"></a>Policy Engine
231
+
232
+ Extensions can contribute policy rules and safety checkers to the Gemini CLI
233
+ [Policy Engine](../reference/policy-engine.md). These rules are defined in
234
+ `.toml` files and take effect when the extension is activated.
235
+
236
+ To add policies, create a `policies/` directory in your extension's root and
237
+ place your `.toml` policy files inside it. Gemini CLI automatically loads all
238
+ `.toml` files from this directory.
239
+
240
+ Rules contributed by extensions run in their own tier (tier 2), alongside
241
+ workspace-defined policies. This tier has higher priority than the default rules
242
+ but lower priority than user or admin policies.
243
+
244
+ > **Warning:** For security, Gemini CLI ignores any `allow` decisions or `yolo`
245
+ > mode configurations in extension policies. This ensures that an extension
246
+ > cannot automatically approve tool calls or bypass security measures without
247
+ > your confirmation.
248
+
249
+ **Example `policies.toml`**
250
+
251
+ ```toml
252
+ [[rule]]
253
+ toolName = "my_server__dangerous_tool"
254
+ decision = "ask_user"
255
+ priority = 100
256
+
257
+ [[safety_checker]]
258
+ toolName = "my_server__write_data"
259
+ priority = 200
260
+ [safety_checker.checker]
261
+ type = "in-process"
262
+ name = "allowed-path"
263
+ required_context = ["environment"]
264
+ ```
265
+
230
266
  ### Themes
231
267
 
232
268
  Extensions can provide custom themes to personalize the CLI UI. Themes are
@@ -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>
@@ -1,6 +1,6 @@
1
1
  # Gemini CLI installation, execution, and releases
2
2
 
3
- This document provides an overview of Gemini CLI's sytem requriements,
3
+ This document provides an overview of Gemini CLI's system requirements,
4
4
  installation methods, and release types.
5
5
 
6
6
  ## Recommended system specifications
@@ -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
 
@@ -1,23 +1,21 @@
1
1
  # Local development guide
2
2
 
3
3
  This guide provides instructions for setting up and using local development
4
- features, such as development tracing.
4
+ features, such as tracing.
5
5
 
6
- ## Development tracing
6
+ ## Tracing
7
7
 
8
- Development traces (dev traces) are OpenTelemetry (OTel) traces that help you
9
- debug your code by instrumenting interesting events like model calls, tool
10
- scheduler, tool calls, etc.
8
+ Traces are OpenTelemetry (OTel) records that help you debug your code by
9
+ instrumenting key events like model calls, tool scheduler operations, and tool
10
+ calls.
11
11
 
12
- Dev traces are verbose and are specifically meant for understanding agent
13
- behavior and debugging issues. They are disabled by default.
12
+ Traces provide deep visibility into agent behavior and are invaluable for
13
+ debugging complex issues. They are captured automatically when telemetry is
14
+ enabled.
14
15
 
15
- To enable dev traces, set the `GEMINI_DEV_TRACING=true` environment variable
16
- when running Gemini CLI.
16
+ ### Viewing traces
17
17
 
18
- ### Viewing dev traces
19
-
20
- You can view dev traces using either Jaeger or the Genkit Developer UI.
18
+ You can view traces using either Jaeger or the Genkit Developer UI.
21
19
 
22
20
  #### Using Genkit
23
21
 
@@ -37,13 +35,12 @@ Genkit provides a web-based UI for viewing traces and other telemetry data.
37
35
  Genkit Developer UI: http://localhost:4000
38
36
  ```
39
37
 
40
- 2. **Run Gemini CLI with dev tracing:**
38
+ 2. **Run Gemini CLI:**
41
39
 
42
- In a separate terminal, run your Gemini CLI command with the
43
- `GEMINI_DEV_TRACING` environment variable:
40
+ In a separate terminal, run your Gemini CLI command:
44
41
 
45
42
  ```bash
46
- GEMINI_DEV_TRACING=true gemini
43
+ gemini
47
44
  ```
48
45
 
49
46
  3. **View the traces:**
@@ -53,7 +50,7 @@ Genkit provides a web-based UI for viewing traces and other telemetry data.
53
50
 
54
51
  #### Using Jaeger
55
52
 
56
- You can view dev traces in the Jaeger UI. To get started, follow these steps:
53
+ You can view traces in the Jaeger UI. To get started, follow these steps:
57
54
 
58
55
  1. **Start the telemetry collector:**
59
56
 
@@ -67,13 +64,12 @@ You can view dev traces in the Jaeger UI. To get started, follow these steps:
67
64
  This command also configures your workspace for local telemetry and provides
68
65
  a link to the Jaeger UI (usually `http://localhost:16686`).
69
66
 
70
- 2. **Run Gemini CLI with dev tracing:**
67
+ 2. **Run Gemini CLI:**
71
68
 
72
- In a separate terminal, run your Gemini CLI command with the
73
- `GEMINI_DEV_TRACING` environment variable:
69
+ In a separate terminal, run your Gemini CLI command:
74
70
 
75
71
  ```bash
76
- GEMINI_DEV_TRACING=true gemini
72
+ gemini
77
73
  ```
78
74
 
79
75
  3. **View the traces:**
@@ -84,10 +80,10 @@ You can view dev traces in the Jaeger UI. To get started, follow these steps:
84
80
  For more detailed information on telemetry, see the
85
81
  [telemetry documentation](./cli/telemetry.md).
86
82
 
87
- ### Instrumenting code with dev traces
83
+ ### Instrumenting code with traces
88
84
 
89
- You can add dev traces to your own code for more detailed instrumentation. This
90
- is useful for debugging and understanding the flow of execution.
85
+ You can add traces to your own code for more detailed instrumentation. This is
86
+ useful for debugging and understanding the flow of execution.
91
87
 
92
88
  Use the `runInDevTraceSpan` function to wrap any section of code in a trace
93
89
  span.
@@ -96,29 +92,39 @@ Here is a basic example:
96
92
 
97
93
  ```typescript
98
94
  import { runInDevTraceSpan } from '@google/gemini-cli-core';
99
-
100
- await runInDevTraceSpan({ name: 'my-custom-span' }, async ({ metadata }) => {
101
- // The `metadata` object allows you to record the input and output of the
102
- // operation as well as other attributes.
103
- metadata.input = { key: 'value' };
104
- // Set custom attributes.
105
- metadata.attributes['gen_ai.request.model'] = 'gemini-4.0-mega';
106
-
107
- // Your code to be traced goes here
108
- try {
109
- const output = await somethingRisky();
110
- metadata.output = output;
111
- return output;
112
- } catch (e) {
113
- metadata.error = e;
114
- throw e;
115
- }
116
- });
95
+ import { GeminiCliOperation } from '@google/gemini-cli-core/lib/telemetry/constants.js';
96
+
97
+ await runInDevTraceSpan(
98
+ {
99
+ operation: GeminiCliOperation.ToolCall,
100
+ attributes: {
101
+ [GEN_AI_AGENT_NAME]: 'gemini-cli',
102
+ },
103
+ },
104
+ async ({ metadata }) => {
105
+ // The `metadata` object allows you to record the input and output of the
106
+ // operation as well as other attributes.
107
+ metadata.input = { key: 'value' };
108
+ // Set custom attributes.
109
+ metadata.attributes['custom.attribute'] = 'custom.value';
110
+
111
+ // Your code to be traced goes here
112
+ try {
113
+ const output = await somethingRisky();
114
+ metadata.output = output;
115
+ return output;
116
+ } catch (e) {
117
+ metadata.error = e;
118
+ throw e;
119
+ }
120
+ },
121
+ );
117
122
  ```
118
123
 
119
124
  In this example:
120
125
 
121
- - `name`: The name of the span, which will be displayed in the trace.
126
+ - `operation`: The operation type of the span, represented by the
127
+ `GeminiCliOperation` enum.
122
128
  - `metadata.input`: (Optional) An object containing the input data for the
123
129
  traced operation.
124
130
  - `metadata.output`: (Optional) An object containing the output data from the