@google/gemini-cli-core 0.21.0-nightly.20251218.739c02bd6 → 0.21.0-nightly.20251220.41a1a3eed

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 (212) hide show
  1. package/dist/docs/CONTRIBUTING.md +546 -0
  2. package/dist/docs/architecture.md +80 -0
  3. package/dist/docs/assets/connected_devtools.png +0 -0
  4. package/dist/docs/assets/gemini-screenshot.png +0 -0
  5. package/dist/docs/assets/release_patch.png +0 -0
  6. package/dist/docs/assets/theme-ansi-light.png +0 -0
  7. package/dist/docs/assets/theme-ansi.png +0 -0
  8. package/dist/docs/assets/theme-atom-one.png +0 -0
  9. package/dist/docs/assets/theme-ayu-light.png +0 -0
  10. package/dist/docs/assets/theme-ayu.png +0 -0
  11. package/dist/docs/assets/theme-custom.png +0 -0
  12. package/dist/docs/assets/theme-default-light.png +0 -0
  13. package/dist/docs/assets/theme-default.png +0 -0
  14. package/dist/docs/assets/theme-dracula.png +0 -0
  15. package/dist/docs/assets/theme-github-light.png +0 -0
  16. package/dist/docs/assets/theme-github.png +0 -0
  17. package/dist/docs/assets/theme-google-light.png +0 -0
  18. package/dist/docs/assets/theme-xcode-light.png +0 -0
  19. package/dist/docs/changelogs/index.md +592 -0
  20. package/dist/docs/changelogs/latest.md +225 -0
  21. package/dist/docs/changelogs/preview.md +129 -0
  22. package/dist/docs/changelogs/releases.md +896 -0
  23. package/dist/docs/cli/authentication.md +3 -0
  24. package/dist/docs/cli/checkpointing.md +94 -0
  25. package/dist/docs/cli/commands.md +354 -0
  26. package/dist/docs/cli/configuration.md +780 -0
  27. package/dist/docs/cli/custom-commands.md +315 -0
  28. package/dist/docs/cli/enterprise.md +565 -0
  29. package/dist/docs/cli/gemini-ignore.md +71 -0
  30. package/dist/docs/cli/gemini-md.md +108 -0
  31. package/dist/docs/cli/generation-settings.md +210 -0
  32. package/dist/docs/cli/headless.md +388 -0
  33. package/dist/docs/cli/index.md +63 -0
  34. package/dist/docs/cli/keyboard-shortcuts.md +143 -0
  35. package/dist/docs/cli/model-routing.md +37 -0
  36. package/dist/docs/cli/model.md +62 -0
  37. package/dist/docs/cli/sandbox.md +171 -0
  38. package/dist/docs/cli/session-management.md +158 -0
  39. package/dist/docs/cli/settings.md +112 -0
  40. package/dist/docs/cli/system-prompt.md +93 -0
  41. package/dist/docs/cli/telemetry.md +791 -0
  42. package/dist/docs/cli/themes.md +237 -0
  43. package/dist/docs/cli/token-caching.md +20 -0
  44. package/dist/docs/cli/trusted-folders.md +95 -0
  45. package/dist/docs/cli/tutorials.md +83 -0
  46. package/dist/docs/cli/uninstall.md +47 -0
  47. package/dist/docs/core/index.md +101 -0
  48. package/dist/docs/core/memport.md +244 -0
  49. package/dist/docs/core/policy-engine.md +267 -0
  50. package/dist/docs/core/tools-api.md +131 -0
  51. package/dist/docs/examples/proxy-script.md +83 -0
  52. package/dist/docs/extensions/extension-releasing.md +183 -0
  53. package/dist/docs/extensions/getting-started-extensions.md +245 -0
  54. package/dist/docs/extensions/index.md +293 -0
  55. package/dist/docs/faq.md +154 -0
  56. package/dist/docs/get-started/authentication.md +321 -0
  57. package/dist/docs/get-started/configuration-v1.md +888 -0
  58. package/dist/docs/get-started/configuration.md +1444 -0
  59. package/dist/docs/get-started/deployment.md +143 -0
  60. package/dist/docs/get-started/examples.md +219 -0
  61. package/dist/docs/get-started/gemini-3.md +116 -0
  62. package/dist/docs/get-started/index.md +71 -0
  63. package/dist/docs/get-started/installation.md +141 -0
  64. package/dist/docs/hooks/best-practices.md +806 -0
  65. package/dist/docs/hooks/index.md +665 -0
  66. package/dist/docs/hooks/reference.md +168 -0
  67. package/dist/docs/hooks/writing-hooks.md +1026 -0
  68. package/dist/docs/ide-integration/ide-companion-spec.md +267 -0
  69. package/dist/docs/ide-integration/index.md +202 -0
  70. package/dist/docs/index.md +147 -0
  71. package/dist/docs/integration-tests.md +211 -0
  72. package/dist/docs/issue-and-pr-automation.md +134 -0
  73. package/dist/docs/local-development.md +128 -0
  74. package/dist/docs/mermaid/context.mmd +103 -0
  75. package/dist/docs/mermaid/render-path.mmd +64 -0
  76. package/dist/docs/npm.md +62 -0
  77. package/dist/docs/quota-and-pricing.md +158 -0
  78. package/dist/docs/release-confidence.md +164 -0
  79. package/dist/docs/releases.md +540 -0
  80. package/dist/docs/sidebar.json +297 -0
  81. package/dist/docs/tools/file-system.md +217 -0
  82. package/dist/docs/tools/index.md +95 -0
  83. package/dist/docs/tools/mcp-server.md +1044 -0
  84. package/dist/docs/tools/memory.md +54 -0
  85. package/dist/docs/tools/shell.md +260 -0
  86. package/dist/docs/tools/todos.md +57 -0
  87. package/dist/docs/tools/web-fetch.md +59 -0
  88. package/dist/docs/tools/web-search.md +42 -0
  89. package/dist/docs/tos-privacy.md +96 -0
  90. package/dist/docs/troubleshooting.md +158 -0
  91. package/dist/google-gemini-cli-core-0.21.0-nightly.20251219.70696e364.tgz +0 -0
  92. package/dist/src/agents/delegate-to-agent-tool.test.js +1 -0
  93. package/dist/src/agents/delegate-to-agent-tool.test.js.map +1 -1
  94. package/dist/src/agents/introspection-agent.d.ts +23 -0
  95. package/dist/src/agents/introspection-agent.js +72 -0
  96. package/dist/src/agents/introspection-agent.js.map +1 -0
  97. package/dist/src/agents/introspection-agent.test.d.ts +6 -0
  98. package/dist/src/agents/introspection-agent.test.js +47 -0
  99. package/dist/src/agents/introspection-agent.test.js.map +1 -0
  100. package/dist/src/agents/local-executor.d.ts +0 -6
  101. package/dist/src/agents/local-executor.js +73 -47
  102. package/dist/src/agents/local-executor.js.map +1 -1
  103. package/dist/src/agents/local-executor.test.d.ts +1 -7
  104. package/dist/src/agents/local-executor.test.js +27 -9
  105. package/dist/src/agents/local-executor.test.js.map +1 -1
  106. package/dist/src/agents/registry.d.ts +1 -0
  107. package/dist/src/agents/registry.js +51 -7
  108. package/dist/src/agents/registry.js.map +1 -1
  109. package/dist/src/agents/registry.test.js +112 -1
  110. package/dist/src/agents/registry.test.js.map +1 -1
  111. package/dist/src/agents/toml-loader.d.ts +65 -0
  112. package/dist/src/agents/toml-loader.js +176 -0
  113. package/dist/src/agents/toml-loader.js.map +1 -0
  114. package/dist/src/agents/toml-loader.test.d.ts +6 -0
  115. package/dist/src/agents/toml-loader.test.js +190 -0
  116. package/dist/src/agents/toml-loader.test.js.map +1 -0
  117. package/dist/src/availability/modelAvailabilityService.d.ts +2 -1
  118. package/dist/src/config/config.d.ts +9 -0
  119. package/dist/src/config/config.js +29 -0
  120. package/dist/src/config/config.js.map +1 -1
  121. package/dist/src/config/config.test.js +59 -1
  122. package/dist/src/config/config.test.js.map +1 -1
  123. package/dist/src/config/storage.d.ts +2 -0
  124. package/dist/src/config/storage.js +6 -0
  125. package/dist/src/config/storage.js.map +1 -1
  126. package/dist/src/config/storage.test.js +8 -0
  127. package/dist/src/config/storage.test.js.map +1 -1
  128. package/dist/src/core/client.js +8 -4
  129. package/dist/src/core/client.js.map +1 -1
  130. package/dist/src/core/client.test.js +20 -0
  131. package/dist/src/core/client.test.js.map +1 -1
  132. package/dist/src/core/clientHookTriggers.js +2 -2
  133. package/dist/src/core/clientHookTriggers.js.map +1 -1
  134. package/dist/src/core/coreToolHookTriggers.js +3 -3
  135. package/dist/src/core/coreToolHookTriggers.js.map +1 -1
  136. package/dist/src/core/geminiChatHookTriggers.js +3 -3
  137. package/dist/src/core/geminiChatHookTriggers.js.map +1 -1
  138. package/dist/src/core/sessionHookTriggers.js +3 -3
  139. package/dist/src/core/sessionHookTriggers.js.map +1 -1
  140. package/dist/src/generated/git-commit.d.ts +2 -2
  141. package/dist/src/generated/git-commit.js +2 -2
  142. package/dist/src/hooks/hookEventHandler.js +10 -4
  143. package/dist/src/hooks/hookEventHandler.js.map +1 -1
  144. package/dist/src/hooks/hookEventHandler.test.js +40 -0
  145. package/dist/src/hooks/hookEventHandler.test.js.map +1 -1
  146. package/dist/src/hooks/hookPlanner.js +3 -1
  147. package/dist/src/hooks/hookPlanner.js.map +1 -1
  148. package/dist/src/hooks/hookPlanner.test.js +61 -0
  149. package/dist/src/hooks/hookPlanner.test.js.map +1 -1
  150. package/dist/src/hooks/hookRegistry.d.ts +1 -1
  151. package/dist/src/hooks/hookRegistry.js +2 -2
  152. package/dist/src/hooks/hookRegistry.js.map +1 -1
  153. package/dist/src/hooks/hookRegistry.test.js +73 -0
  154. package/dist/src/hooks/hookRegistry.test.js.map +1 -1
  155. package/dist/src/hooks/hookRunner.js +14 -10
  156. package/dist/src/hooks/hookRunner.js.map +1 -1
  157. package/dist/src/hooks/hookRunner.test.js +81 -33
  158. package/dist/src/hooks/hookRunner.test.js.map +1 -1
  159. package/dist/src/hooks/types.d.ts +2 -0
  160. package/dist/src/hooks/types.js.map +1 -1
  161. package/dist/src/mcp/oauth-provider.js +6 -2
  162. package/dist/src/mcp/oauth-provider.js.map +1 -1
  163. package/dist/src/mcp/oauth-provider.test.js +4 -1
  164. package/dist/src/mcp/oauth-provider.test.js.map +1 -1
  165. package/dist/src/mcp/oauth-utils.d.ts +8 -1
  166. package/dist/src/mcp/oauth-utils.js +30 -1
  167. package/dist/src/mcp/oauth-utils.js.map +1 -1
  168. package/dist/src/mcp/oauth-utils.test.js +42 -0
  169. package/dist/src/mcp/oauth-utils.test.js.map +1 -1
  170. package/dist/src/services/contextManager.d.ts +5 -11
  171. package/dist/src/services/contextManager.js +20 -17
  172. package/dist/src/services/contextManager.js.map +1 -1
  173. package/dist/src/services/contextManager.test.js +40 -41
  174. package/dist/src/services/contextManager.test.js.map +1 -1
  175. package/dist/src/services/shellExecutionService.js +18 -2
  176. package/dist/src/services/shellExecutionService.js.map +1 -1
  177. package/dist/src/tools/get-internal-docs.d.ts +27 -0
  178. package/dist/src/tools/get-internal-docs.js +129 -0
  179. package/dist/src/tools/get-internal-docs.js.map +1 -0
  180. package/dist/src/tools/get-internal-docs.test.d.ts +6 -0
  181. package/dist/src/tools/get-internal-docs.test.js +56 -0
  182. package/dist/src/tools/get-internal-docs.test.js.map +1 -0
  183. package/dist/src/tools/tool-names.d.ts +14 -0
  184. package/dist/src/tools/tool-names.js +55 -0
  185. package/dist/src/tools/tool-names.js.map +1 -1
  186. package/dist/src/tools/tool-names.test.d.ts +6 -0
  187. package/dist/src/tools/tool-names.test.js +43 -0
  188. package/dist/src/tools/tool-names.test.js.map +1 -0
  189. package/dist/src/tools/tool-registry.d.ts +0 -1
  190. package/dist/src/tools/tool-registry.js +1 -1
  191. package/dist/src/tools/tool-registry.js.map +1 -1
  192. package/dist/src/tools/tool-registry.test.js +2 -1
  193. package/dist/src/tools/tool-registry.test.js.map +1 -1
  194. package/dist/src/utils/environmentContext.js +3 -0
  195. package/dist/src/utils/environmentContext.js.map +1 -1
  196. package/dist/src/utils/environmentContext.test.js +2 -0
  197. package/dist/src/utils/environmentContext.test.js.map +1 -1
  198. package/dist/src/utils/events.d.ts +3 -2
  199. package/dist/src/utils/events.js.map +1 -1
  200. package/dist/src/utils/googleQuotaErrors.js +20 -0
  201. package/dist/src/utils/googleQuotaErrors.js.map +1 -1
  202. package/dist/src/utils/googleQuotaErrors.test.js +53 -2
  203. package/dist/src/utils/googleQuotaErrors.test.js.map +1 -1
  204. package/dist/src/utils/memoryDiscovery.js +1 -1
  205. package/dist/src/utils/memoryDiscovery.js.map +1 -1
  206. package/dist/src/utils/memoryDiscovery.test.js +3 -1
  207. package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
  208. package/dist/src/utils/shell-utils.js +25 -4
  209. package/dist/src/utils/shell-utils.js.map +1 -1
  210. package/dist/tsconfig.tsbuildinfo +1 -1
  211. package/package.json +1 -6
  212. package/dist/google-gemini-cli-core-0.21.0-nightly.20251216.bb0c0d8ee.tgz +0 -0
@@ -0,0 +1,143 @@
1
+ Note: This page will be replaced by [installation.md](installation.md).
2
+
3
+ # Gemini CLI installation, execution, and deployment
4
+
5
+ Install and run Gemini CLI. This document provides an overview of Gemini CLI's
6
+ installation methods and deployment architecture.
7
+
8
+ ## How to install and/or run Gemini CLI
9
+
10
+ There are several ways to run Gemini CLI. The recommended option depends on how
11
+ you intend to use Gemini CLI.
12
+
13
+ - As a standard installation. This is the most straightforward method of using
14
+ Gemini CLI.
15
+ - In a sandbox. This method offers increased security and isolation.
16
+ - From the source. This is recommended for contributors to the project.
17
+
18
+ ### 1. Standard installation (recommended for standard users)
19
+
20
+ This is the recommended way for end-users to install Gemini CLI. It involves
21
+ downloading the Gemini CLI package from the NPM registry.
22
+
23
+ - **Global install:**
24
+
25
+ ```bash
26
+ npm install -g @google/gemini-cli
27
+ ```
28
+
29
+ Then, run the CLI from anywhere:
30
+
31
+ ```bash
32
+ gemini
33
+ ```
34
+
35
+ - **NPX execution:**
36
+
37
+ ```bash
38
+ # Execute the latest version from NPM without a global install
39
+ npx @google/gemini-cli
40
+ ```
41
+
42
+ ### 2. Run in a sandbox (Docker/Podman)
43
+
44
+ For security and isolation, Gemini CLI can be run inside a container. This is
45
+ the default way that the CLI executes tools that might have side effects.
46
+
47
+ - **Directly from the registry:** You can run the published sandbox image
48
+ directly. This is useful for environments where you only have Docker and want
49
+ to run the CLI.
50
+ ```bash
51
+ # Run the published sandbox image
52
+ docker run --rm -it us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.1.1
53
+ ```
54
+ - **Using the `--sandbox` flag:** If you have Gemini CLI installed locally
55
+ (using the standard installation described above), you can instruct it to run
56
+ inside the sandbox container.
57
+ ```bash
58
+ gemini --sandbox -y -p "your prompt here"
59
+ ```
60
+
61
+ ### 3. Run from source (recommended for Gemini CLI contributors)
62
+
63
+ Contributors to the project will want to run the CLI directly from the source
64
+ code.
65
+
66
+ - **Development mode:** This method provides hot-reloading and is useful for
67
+ active development.
68
+ ```bash
69
+ # From the root of the repository
70
+ npm run start
71
+ ```
72
+ - **Production-like mode (Linked package):** This method simulates a global
73
+ installation by linking your local package. It's useful for testing a local
74
+ build in a production workflow.
75
+
76
+ ```bash
77
+ # Link the local cli package to your global node_modules
78
+ npm link packages/cli
79
+
80
+ # Now you can run your local version using the `gemini` command
81
+ gemini
82
+ ```
83
+
84
+ ---
85
+
86
+ ### 4. Running the latest Gemini CLI commit from GitHub
87
+
88
+ You can run the most recently committed version of Gemini CLI directly from the
89
+ GitHub repository. This is useful for testing features still in development.
90
+
91
+ ```bash
92
+ # Execute the CLI directly from the main branch on GitHub
93
+ npx https://github.com/google-gemini/gemini-cli
94
+ ```
95
+
96
+ ## Deployment architecture
97
+
98
+ The execution methods described above are made possible by the following
99
+ architectural components and processes:
100
+
101
+ **NPM packages**
102
+
103
+ Gemini CLI project is a monorepo that publishes two core packages to the NPM
104
+ registry:
105
+
106
+ - `@google/gemini-cli-core`: The backend, handling logic and tool execution.
107
+ - `@google/gemini-cli`: The user-facing frontend.
108
+
109
+ These packages are used when performing the standard installation and when
110
+ running Gemini CLI from the source.
111
+
112
+ **Build and packaging processes**
113
+
114
+ There are two distinct build processes used, depending on the distribution
115
+ channel:
116
+
117
+ - **NPM publication:** For publishing to the NPM registry, the TypeScript source
118
+ code in `@google/gemini-cli-core` and `@google/gemini-cli` is transpiled into
119
+ standard JavaScript using the TypeScript Compiler (`tsc`). The resulting
120
+ `dist/` directory is what gets published in the NPM package. This is a
121
+ standard approach for TypeScript libraries.
122
+
123
+ - **GitHub `npx` execution:** When running the latest version of Gemini CLI
124
+ directly from GitHub, a different process is triggered by the `prepare` script
125
+ in `package.json`. This script uses `esbuild` to bundle the entire application
126
+ and its dependencies into a single, self-contained JavaScript file. This
127
+ bundle is created on-the-fly on the user's machine and is not checked into the
128
+ repository.
129
+
130
+ **Docker sandbox image**
131
+
132
+ The Docker-based execution method is supported by the `gemini-cli-sandbox`
133
+ container image. This image is published to a container registry and contains a
134
+ pre-installed, global version of Gemini CLI.
135
+
136
+ ## Release process
137
+
138
+ The release process is automated through GitHub Actions. The release workflow
139
+ performs the following actions:
140
+
141
+ 1. Build the NPM packages using `tsc`.
142
+ 2. Publish the NPM packages to the artifact registry.
143
+ 3. Create GitHub releases with bundled assets.
@@ -0,0 +1,219 @@
1
+ # Gemini CLI examples
2
+
3
+ Not sure where to get started with Gemini CLI? This document covers examples on
4
+ how to use Gemini CLI for a variety of tasks.
5
+
6
+ **Note:** Results are examples intended to showcase potential use cases. Your
7
+ results may vary.
8
+
9
+ ## Rename your photographs based on content
10
+
11
+ Scenario: You have a folder containing the following files:
12
+
13
+ ```bash
14
+ photos/photo1.png
15
+ photos/photo2.png
16
+ photos/photo3.png
17
+ ```
18
+
19
+ Give Gemini the following prompt:
20
+
21
+ ```cli
22
+ Rename the photos in my "photos" directory based on their contents.
23
+ ```
24
+
25
+ Result: Gemini will ask for permission to rename your files.
26
+
27
+ Select **Allow once** and your files will be renamed:
28
+
29
+ ```bash
30
+ photos/yellow_flowers.png
31
+ photos/antique_dresser.png
32
+ photos/green_android_robot.png
33
+ ```
34
+
35
+ ## Explain a repository by reading its code
36
+
37
+ Scenario: You want to understand how a popular open-source utility works by
38
+ inspecting its code, not just its README.
39
+
40
+ Give Gemini CLI the following prompt:
41
+
42
+ ```cli
43
+ Clone the 'chalk' repository from https://github.com/chalk/chalk, read its key source files, and explain how it works.
44
+ ```
45
+
46
+ Result: Gemini will perform a sequence of actions to answer your request.
47
+
48
+ 1. First, it will ask for permission to run `git clone` to download the
49
+ repository.
50
+ 2. Next, it will find the important source files and ask for permission to read
51
+ them.
52
+ 3. Finally, after analyzing the code, it will provide a summary.
53
+
54
+ Gemini CLI will return an explanation based on the actual source code:
55
+
56
+ ```markdown
57
+ The `chalk` library is a popular npm package for styling terminal output with
58
+ colors. After analyzing the source code, here's how it works:
59
+
60
+ - **Core functionality:** The main file sets up a chainable API. Each color or
61
+ modifier (like `bold` or `italic`) is a getter that appends the corresponding
62
+ ANSI escape code to an internal stack.
63
+
64
+ - **Chainable API:** When you call `chalk.red.bold('Hello')`, you are accessing
65
+ getters. The `red` getter adds the red color code, and the `bold` getter adds
66
+ the bold code.
67
+
68
+ - **Output generation:** When the chain is treated as a string (e.g., in
69
+ `console.log`), a final `toString()` method is called. This method joins all
70
+ the stored ANSI codes, wraps them around the input string ('Hello'), and adds
71
+ a reset code at the end. This produces the final, styled string that the
72
+ terminal can render.
73
+ ```
74
+
75
+ ## Combine two spreadsheets into one spreadsheet
76
+
77
+ Scenario: You have two .csv files: `Revenue - 2023.csv` and
78
+ `Revenue - 2024.csv`. Each file contains monthly revenue figures, like so:
79
+
80
+ ```csv
81
+ January,0
82
+ February,0
83
+ March,0
84
+ April,900
85
+ May,1000
86
+ June,1000
87
+ July,1200
88
+ August,1800
89
+ September,2000
90
+ October,2400
91
+ November,3400
92
+ December,2100
93
+ ```
94
+
95
+ You want to combine these two .csv files into a single .csv file.
96
+
97
+ Give Gemini CLI the following prompt:
98
+
99
+ ```cli
100
+ Combine the two .csv files into a single .csv file, with each year a different column.
101
+ ```
102
+
103
+ Result: Gemini CLI will read each file and then ask for permission to write a
104
+ new file. Provide your permission and Gemini CLI will provide the following
105
+ .csv:
106
+
107
+ ```csv
108
+ Month,2023,2024
109
+ January,0,1000
110
+ February,0,1200
111
+ March,0,2400
112
+ April,900,500
113
+ May,1000,800
114
+ June,1000,900
115
+ July,1200,1000
116
+ August,1800,400
117
+ September,2000,2000
118
+ October,2400,3400
119
+ November,3400,1800
120
+ December,2100,9000
121
+ ```
122
+
123
+ ## Run unit tests
124
+
125
+ Scenario: You've written a simple login page. You wish to write unit tests to
126
+ ensure that your login page has code coverage.
127
+
128
+ Give Gemini CLI the following prompt:
129
+
130
+ ```cli
131
+ Write unit tests for Login.js.
132
+ ```
133
+
134
+ Result: Gemini CLI will ask for permission to write a new file and create a test
135
+ for your login page
136
+
137
+ ```javascript
138
+ import React from 'react';
139
+ import { render, fireEvent, waitFor } from '@testing-library/react';
140
+ import Login from './Login';
141
+
142
+ // Mock the API call for login
143
+ jest.mock('./api', () => ({
144
+ login: jest.fn(),
145
+ }));
146
+
147
+ describe('Login component', () => {
148
+ it('renders the login form correctly', () => {
149
+ const { getByLabelText, getByText } = render(<Login />);
150
+
151
+ expect(getByLabelText('Username')).toBeInTheDocument();
152
+ expect(getByLabelText('Password')).toBeInTheDocument();
153
+ expect(getByText('Login')).toBeInTheDocument();
154
+ });
155
+
156
+ it('shows an error message with invalid credentials', async () => {
157
+ const { getByLabelText, getByText, findByText } = render(<Login />);
158
+ const usernameInput = getByLabelText('Username');
159
+ const passwordInput = getByLabelText('Password');
160
+ const loginButton = getByText('Login');
161
+
162
+ // Mock the API to return an error
163
+ require('./api').login.mockRejectedValue(new Error('Invalid credentials'));
164
+
165
+ fireEvent.change(usernameInput, { target: { value: 'testuser' } });
166
+ fireEvent.change(passwordInput, { target: { value: 'wrongpassword' } });
167
+ fireEvent.click(loginButton);
168
+
169
+ const errorMessage = await findByText('Invalid credentials');
170
+ expect(errorMessage).toBeInTheDocument();
171
+ });
172
+
173
+ it('logs in successfully with valid credentials', async () => {
174
+ const onLoginSuccess = jest.fn();
175
+ const { getByLabelText, getByText } = render(
176
+ <Login onLoginSuccess={onLoginSuccess} />,
177
+ );
178
+ const usernameInput = getByLabelText('Username');
179
+ const passwordInput = getByLabelText('Password');
180
+ const loginButton = getByText('Login');
181
+
182
+ // Mock the API to return a success message
183
+ require('./api').login.mockResolvedValue({ success: true });
184
+
185
+ fireEvent.change(usernameInput, { target: { value: 'testuser' } });
186
+ fireEvent.change(passwordInput, { target: { value: 'correctpassword' } });
187
+ fireEvent.click(loginButton);
188
+
189
+ await waitFor(() => {
190
+ expect(onLoginSuccess).toHaveBeenCalled();
191
+ });
192
+ });
193
+
194
+ it('disables the submit button while submitting', async () => {
195
+ const { getByLabelText, getByText } = render(<Login />);
196
+ const usernameInput = getByLabelText('Username');
197
+ const passwordInput = getByLabelText('Password');
198
+ const loginButton = getByText('Login');
199
+
200
+ // Mock the API to have a delay
201
+ require('./api').login.mockImplementation(
202
+ () =>
203
+ new Promise((resolve) =>
204
+ setTimeout(() => resolve({ success: true }), 1000),
205
+ ),
206
+ );
207
+
208
+ fireEvent.change(usernameInput, { target: { value: 'testuser' } });
209
+ fireEvent.change(passwordInput, { target: { value: 'correctpassword' } });
210
+ fireEvent.click(loginButton);
211
+
212
+ expect(loginButton).toBeDisabled();
213
+
214
+ await waitFor(() => {
215
+ expect(loginButton).not.toBeDisabled();
216
+ });
217
+ });
218
+ });
219
+ ```
@@ -0,0 +1,116 @@
1
+ # Gemini 3 Pro and Gemini 3 Flash on Gemini CLI
2
+
3
+ Gemini 3 Pro and Gemini 3 Flash are now available on Gemini CLI! Currently, most
4
+ paid customers of Gemini CLI will have access to both Gemini 3 Pro and Gemini 3
5
+ Flash, including the following subscribers:
6
+
7
+ - Google AI Pro and Google AI Ultra (excluding business customers).
8
+ - Gemini Code Assist Standard and Enterprise (requires
9
+ [administrative enablement](#administrator-instructions)).
10
+ - Paid Gemini API and Vertex API key holders.
11
+
12
+ For free tier users:
13
+
14
+ - If you signed up for the waitlist, please check your email for details. We’ve
15
+ onboarded everyone who signed up to the previously available waitlist.
16
+ - If you were not on our waitlist, we’re rolling out additional access gradually
17
+ to ensure the experience remains fast and reliable. Stay tuned for more
18
+ details.
19
+
20
+ ## How to get started with Gemini 3 on Gemini CLI
21
+
22
+ Get started by upgrading Gemini CLI to the latest version (0.21.1):
23
+
24
+ ```bash
25
+ npm install -g @google/gemini-cli@latest
26
+ ```
27
+
28
+ After you’ve confirmed your version is 0.21.1 or later:
29
+
30
+ 1. Use the `/settings` command in Gemini CLI.
31
+ 2. Toggle **Preview Features** to `true`.
32
+ 3. Run `/model` and select **Auto (Gemini 3)**.
33
+
34
+ For more information, see [Gemini CLI model selection](../cli/model.md).
35
+
36
+ ### Usage limits and fallback
37
+
38
+ Gemini CLI will tell you when you reach your Gemini 3 Pro daily usage limit.
39
+ When you encounter that limit, you’ll be given the option to switch to Gemini
40
+ 2.5 Pro, upgrade for higher limits, or stop. You’ll also be told when your usage
41
+ limit resets and Gemini 3 Pro can be used again.
42
+
43
+ Similarly, when you reach your daily usage limit for Gemini 2.5 Pro, you’ll see
44
+ a message prompting fallback to Gemini 2.5 Flash.
45
+
46
+ ### Capacity errors
47
+
48
+ There may be times when the Gemini 3 Pro model is overloaded. When that happens,
49
+ Gemini CLI will ask you to decide whether you want to keep trying Gemini 3 Pro
50
+ or fallback to Gemini 2.5 Pro.
51
+
52
+ > **Note:** The **Keep trying** option uses exponential backoff, in which Gemini
53
+ > CLI waits longer between each retry, when the system is busy. If the retry
54
+ > doesn't happen immediately, please wait a few minutes for the request to
55
+ > process.
56
+
57
+ ### Model selection and routing types
58
+
59
+ When using Gemini CLI, you may want to control how your requests are routed
60
+ between models. By default, Gemini CLI uses **Auto** routing.
61
+
62
+ When using Gemini 3 Pro, you may want to use Auto routing or Pro routing to
63
+ manage your usage limits:
64
+
65
+ - **Auto routing:** Auto routing first determines whether a prompt involves a
66
+ complex or simple operation. For simple prompts, it will automatically use
67
+ Gemini 2.5 Flash. For complex prompts, if Gemini 3 Pro is enabled, it will use
68
+ Gemini 3 Pro; otherwise, it will use Gemini 2.5 Pro.
69
+ - **Pro routing:** If you want to ensure your task is processed by the most
70
+ capable model, use `/model` and select **Pro**. Gemini CLI will prioritize the
71
+ most capable model available, including Gemini 3 Pro if it has been enabled.
72
+
73
+ To learn more about selecting a model and routing, refer to
74
+ [Gemini CLI Model Selection](../cli/model.md).
75
+
76
+ ## How to enable Gemini 3 with Gemini CLI on Gemini Code Assist
77
+
78
+ If you're using Gemini Code Assist Standard or Gemini Code Assist Enterprise,
79
+ enabling Gemini 3 Pro on Gemini CLI requires configuring your release channels.
80
+ Using Gemini 3 Pro will require two steps: administrative enablement and user
81
+ enablement.
82
+
83
+ To learn more about these settings, refer to
84
+ [Configure Gemini Code Assist release channels](https://developers.google.com/gemini-code-assist/docs/configure-release-channels).
85
+
86
+ ### Administrator instructions
87
+
88
+ An administrator with **Google Cloud Settings Admin** permissions must follow
89
+ these directions:
90
+
91
+ - Navigate to the Google Cloud Project you're using with Gemini CLI for Code
92
+ Assist.
93
+ - Go to **Admin for Gemini** > **Settings**.
94
+ - Under **Release channels for Gemini Code Assist in local IDEs** select
95
+ **Preview**.
96
+ - Click **Save changes**.
97
+
98
+ ### User instructions
99
+
100
+ Wait for two to three minutes after your administrator has enabled **Preview**,
101
+ then:
102
+
103
+ - Open Gemini CLI.
104
+ - Use the `/settings` command.
105
+ - Set **Preview Features** to `true`.
106
+
107
+ Restart Gemini CLI and you should have access to Gemini 3.
108
+
109
+ ## Need help?
110
+
111
+ If you need help, we recommend searching for an existing
112
+ [GitHub issue](https://github.com/google-gemini/gemini-cli/issues). If you
113
+ cannot find a GitHub issue that matches your concern, you can
114
+ [create a new issue](https://github.com/google-gemini/gemini-cli/issues/new/choose).
115
+ For comments and feedback, consider opening a
116
+ [GitHub discussion](https://github.com/google-gemini/gemini-cli/discussions).
@@ -0,0 +1,71 @@
1
+ # Get started with Gemini CLI
2
+
3
+ Welcome to Gemini CLI! This guide will help you install, configure, and start
4
+ using the Gemini CLI to enhance your workflow right from your terminal.
5
+
6
+ ## Quickstart: Install, authenticate, configure, and use Gemini CLI
7
+
8
+ Gemini CLI brings the power of advanced language models directly to your command
9
+ line interface. As an AI-powered assistant, Gemini CLI can help you with a
10
+ variety of tasks, from understanding and generating code to reviewing and
11
+ editing documents.
12
+
13
+ ## Install
14
+
15
+ The standard method to install and run Gemini CLI uses `npm`:
16
+
17
+ ```bash
18
+ npm install -g @google/gemini-cli
19
+ ```
20
+
21
+ Once Gemini CLI is installed, run Gemini CLI from your command line:
22
+
23
+ ```bash
24
+ gemini
25
+ ```
26
+
27
+ For more installation options, see [Gemini CLI Installation](./installation.md).
28
+
29
+ ## Authenticate
30
+
31
+ To begin using Gemini CLI, you must authenticate with a Google service. In most
32
+ cases, you can log in with your existing Google account:
33
+
34
+ 1. Run Gemini CLI after installation:
35
+
36
+ ```bash
37
+ gemini
38
+ ```
39
+
40
+ 2. When asked "How would you like to authenticate for this project?" select **1.
41
+ Login with Google**.
42
+
43
+ 3. Select your Google account.
44
+
45
+ 4. Click on **Sign in**.
46
+
47
+ Certain account types may require you to configure a Google Cloud project. For
48
+ more information, including other authentication methods, see
49
+ [Gemini CLI Authentication Setup](./authentication.md).
50
+
51
+ ## Configure
52
+
53
+ Gemini CLI offers several ways to configure its behavior, including environment
54
+ variables, command-line arguments, and settings files.
55
+
56
+ To explore your configuration options, see
57
+ [Gemini CLI Configuration](./configuration.md).
58
+
59
+ ## Use
60
+
61
+ Once installed and authenticated, you can start using Gemini CLI by issuing
62
+ commands and prompts in your terminal. Ask it to generate code, explain files,
63
+ and more.
64
+
65
+ To explore the power of Gemini CLI, see [Gemini CLI examples](./examples.md).
66
+
67
+ ## What's next?
68
+
69
+ - Find out more about [Gemini CLI's tools](../tools/index.md).
70
+ - Review [Gemini CLI's commands](../cli/commands.md).
71
+ - Learn how to [get started with Gemini 3](./gemini-3.md).
@@ -0,0 +1,141 @@
1
+ # Gemini CLI installation, execution, and deployment
2
+
3
+ Install and run Gemini CLI. This document provides an overview of Gemini CLI's
4
+ installation methods and deployment architecture.
5
+
6
+ ## How to install and/or run Gemini CLI
7
+
8
+ There are several ways to run Gemini CLI. The recommended option depends on how
9
+ you intend to use Gemini CLI.
10
+
11
+ - As a standard installation. This is the most straightforward method of using
12
+ Gemini CLI.
13
+ - In a sandbox. This method offers increased security and isolation.
14
+ - From the source. This is recommended for contributors to the project.
15
+
16
+ ### 1. Standard installation (recommended for standard users)
17
+
18
+ This is the recommended way for end-users to install Gemini CLI. It involves
19
+ downloading the Gemini CLI package from the NPM registry.
20
+
21
+ - **Global install:**
22
+
23
+ ```bash
24
+ npm install -g @google/gemini-cli
25
+ ```
26
+
27
+ Then, run the CLI from anywhere:
28
+
29
+ ```bash
30
+ gemini
31
+ ```
32
+
33
+ - **NPX execution:**
34
+
35
+ ```bash
36
+ # Execute the latest version from NPM without a global install
37
+ npx @google/gemini-cli
38
+ ```
39
+
40
+ ### 2. Run in a sandbox (Docker/Podman)
41
+
42
+ For security and isolation, Gemini CLI can be run inside a container. This is
43
+ the default way that the CLI executes tools that might have side effects.
44
+
45
+ - **Directly from the registry:** You can run the published sandbox image
46
+ directly. This is useful for environments where you only have Docker and want
47
+ to run the CLI.
48
+ ```bash
49
+ # Run the published sandbox image
50
+ docker run --rm -it us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.1.1
51
+ ```
52
+ - **Using the `--sandbox` flag:** If you have Gemini CLI installed locally
53
+ (using the standard installation described above), you can instruct it to run
54
+ inside the sandbox container.
55
+ ```bash
56
+ gemini --sandbox -y -p "your prompt here"
57
+ ```
58
+
59
+ ### 3. Run from source (recommended for Gemini CLI contributors)
60
+
61
+ Contributors to the project will want to run the CLI directly from the source
62
+ code.
63
+
64
+ - **Development mode:** This method provides hot-reloading and is useful for
65
+ active development.
66
+ ```bash
67
+ # From the root of the repository
68
+ npm run start
69
+ ```
70
+ - **Production-like mode (linked package):** This method simulates a global
71
+ installation by linking your local package. It's useful for testing a local
72
+ build in a production workflow.
73
+
74
+ ```bash
75
+ # Link the local cli package to your global node_modules
76
+ npm link packages/cli
77
+
78
+ # Now you can run your local version using the `gemini` command
79
+ gemini
80
+ ```
81
+
82
+ ---
83
+
84
+ ### 4. Running the latest Gemini CLI commit from GitHub
85
+
86
+ You can run the most recently committed version of Gemini CLI directly from the
87
+ GitHub repository. This is useful for testing features still in development.
88
+
89
+ ```bash
90
+ # Execute the CLI directly from the main branch on GitHub
91
+ npx https://github.com/google-gemini/gemini-cli
92
+ ```
93
+
94
+ ## Deployment architecture
95
+
96
+ The execution methods described above are made possible by the following
97
+ architectural components and processes:
98
+
99
+ **NPM packages**
100
+
101
+ Gemini CLI project is a monorepo that publishes two core packages to the NPM
102
+ registry:
103
+
104
+ - `@google/gemini-cli-core`: The backend, handling logic and tool execution.
105
+ - `@google/gemini-cli`: The user-facing frontend.
106
+
107
+ These packages are used when performing the standard installation and when
108
+ running Gemini CLI from the source.
109
+
110
+ **Build and packaging processes**
111
+
112
+ There are two distinct build processes used, depending on the distribution
113
+ channel:
114
+
115
+ - **NPM publication:** For publishing to the NPM registry, the TypeScript source
116
+ code in `@google/gemini-cli-core` and `@google/gemini-cli` is transpiled into
117
+ standard JavaScript using the TypeScript Compiler (`tsc`). The resulting
118
+ `dist/` directory is what gets published in the NPM package. This is a
119
+ standard approach for TypeScript libraries.
120
+
121
+ - **GitHub `npx` execution:** When running the latest version of Gemini CLI
122
+ directly from GitHub, a different process is triggered by the `prepare` script
123
+ in `package.json`. This script uses `esbuild` to bundle the entire application
124
+ and its dependencies into a single, self-contained JavaScript file. This
125
+ bundle is created on-the-fly on the user's machine and is not checked into the
126
+ repository.
127
+
128
+ **Docker sandbox image**
129
+
130
+ The Docker-based execution method is supported by the `gemini-cli-sandbox`
131
+ container image. This image is published to a container registry and contains a
132
+ pre-installed, global version of Gemini CLI.
133
+
134
+ ## Release process
135
+
136
+ The release process is automated through GitHub Actions. The release workflow
137
+ performs the following actions:
138
+
139
+ 1. Build the NPM packages using `tsc`.
140
+ 2. Publish the NPM packages to the artifact registry.
141
+ 3. Create GitHub releases with bundled assets.