@google/gemini-cli-core 0.32.0-preview.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 (30) hide show
  1. package/dist/docs/cli/cli-reference.md +12 -12
  2. package/dist/docs/cli/custom-commands.md +9 -0
  3. package/dist/docs/cli/enterprise.md +19 -0
  4. package/dist/docs/cli/model.md +5 -14
  5. package/dist/docs/cli/sandbox.md +42 -2
  6. package/dist/docs/cli/telemetry.md +29 -0
  7. package/dist/docs/cli/tutorials/automation.md +101 -5
  8. package/dist/docs/cli/tutorials/mcp-setup.md +8 -0
  9. package/dist/docs/cli/tutorials/skills-getting-started.md +8 -0
  10. package/dist/docs/extensions/writing-extensions.md +16 -0
  11. package/dist/docs/get-started/authentication.md +86 -5
  12. package/dist/docs/get-started/installation.md +1 -1
  13. package/dist/docs/hooks/best-practices.md +33 -1
  14. package/dist/docs/hooks/writing-hooks.md +24 -0
  15. package/dist/docs/ide-integration/index.md +8 -0
  16. package/dist/docs/reference/configuration.md +16 -7
  17. package/dist/docs/reference/policy-engine.md +10 -0
  18. package/dist/docs/resources/faq.md +8 -0
  19. package/dist/docs/resources/troubleshooting.md +4 -1
  20. package/dist/google-gemini-cli-core-0.33.0-nightly.20260227.08ee13613.tgz +0 -0
  21. package/dist/src/core/loggingContentGenerator.d.ts +1 -0
  22. package/dist/src/core/loggingContentGenerator.js +26 -0
  23. package/dist/src/core/loggingContentGenerator.js.map +1 -1
  24. package/dist/src/core/loggingContentGenerator.test.js +42 -0
  25. package/dist/src/core/loggingContentGenerator.test.js.map +1 -1
  26. package/dist/src/generated/git-commit.d.ts +2 -2
  27. package/dist/src/generated/git-commit.js +2 -2
  28. package/dist/src/generated/git-commit.js.map +1 -1
  29. package/dist/tsconfig.tsbuildinfo +1 -1
  30. package/package.json +1 -1
@@ -5,18 +5,18 @@ and parameters.
5
5
 
6
6
  ## CLI commands
7
7
 
8
- | Command | Description | Example |
9
- | ---------------------------------- | ---------------------------------- | --------------------------------------------------- |
10
- | `gemini` | Start interactive REPL | `gemini` |
11
- | `gemini "query"` | Query non-interactively, then exit | `gemini "explain this project"` |
12
- | `cat file \| gemini` | Process piped content | `cat logs.txt \| gemini` |
13
- | `gemini -i "query"` | Execute and continue interactively | `gemini -i "What is the purpose of this project?"` |
14
- | `gemini -r "latest"` | Continue most recent session | `gemini -r "latest"` |
15
- | `gemini -r "latest" "query"` | Continue session with a new prompt | `gemini -r "latest" "Check for type errors"` |
16
- | `gemini -r "<session-id>" "query"` | Resume session by ID | `gemini -r "abc123" "Finish this PR"` |
17
- | `gemini update` | Update to latest version | `gemini update` |
18
- | `gemini extensions` | Manage extensions | See [Extensions Management](#extensions-management) |
19
- | `gemini mcp` | Configure MCP servers | See [MCP Server Management](#mcp-server-management) |
8
+ | Command | Description | Example |
9
+ | ---------------------------------- | ---------------------------------- | ------------------------------------------------------------ |
10
+ | `gemini` | Start interactive REPL | `gemini` |
11
+ | `gemini "query"` | Query non-interactively, then exit | `gemini "explain this project"` |
12
+ | `cat file \| gemini` | Process piped content | `cat logs.txt \| gemini`<br>`Get-Content logs.txt \| gemini` |
13
+ | `gemini -i "query"` | Execute and continue interactively | `gemini -i "What is the purpose of this project?"` |
14
+ | `gemini -r "latest"` | Continue most recent session | `gemini -r "latest"` |
15
+ | `gemini -r "latest" "query"` | Continue session with a new prompt | `gemini -r "latest" "Check for type errors"` |
16
+ | `gemini -r "<session-id>" "query"` | Resume session by ID | `gemini -r "abc123" "Finish this PR"` |
17
+ | `gemini update` | Update to latest version | `gemini update` |
18
+ | `gemini extensions` | Manage extensions | See [Extensions Management](#extensions-management) |
19
+ | `gemini mcp` | Configure MCP servers | See [MCP Server Management](#mcp-server-management) |
20
20
 
21
21
  ### Positional arguments
22
22
 
@@ -278,11 +278,20 @@ Let's create a global command that asks the model to refactor a piece of code.
278
278
  First, ensure the user commands directory exists, then create a `refactor`
279
279
  subdirectory for organization and the final TOML file.
280
280
 
281
+ **macOS/Linux**
282
+
281
283
  ```bash
282
284
  mkdir -p ~/.gemini/commands/refactor
283
285
  touch ~/.gemini/commands/refactor/pure.toml
284
286
  ```
285
287
 
288
+ **Windows (PowerShell)**
289
+
290
+ ```powershell
291
+ New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.gemini\commands\refactor"
292
+ New-Item -ItemType File -Force -Path "$env:USERPROFILE\.gemini\commands\refactor\pure.toml"
293
+ ```
294
+
286
295
  **2. Add the content to the file:**
287
296
 
288
297
  Open `~/.gemini/commands/refactor/pure.toml` in your editor and add the
@@ -203,6 +203,15 @@ with the actual Gemini CLI process, which inherits the environment variable.
203
203
  This makes it significantly more difficult for a user to bypass the enforced
204
204
  settings.
205
205
 
206
+ **PowerShell Profile (Windows alternative):**
207
+
208
+ On Windows, administrators can achieve similar results by adding the environment
209
+ variable to the system-wide or user-specific PowerShell profile:
210
+
211
+ ```powershell
212
+ Add-Content -Path $PROFILE -Value '$env:GEMINI_CLI_SYSTEM_SETTINGS_PATH="C:\ProgramData\gemini-cli\settings.json"'
213
+ ```
214
+
206
215
  ## User isolation in shared environments
207
216
 
208
217
  In shared compute environments (like ML experiment runners or shared build
@@ -214,12 +223,22 @@ use the `GEMINI_CLI_HOME` environment variable to point to a unique directory
214
223
  for a specific user or job. The CLI will create a `.gemini` folder inside the
215
224
  specified path.
216
225
 
226
+ **macOS/Linux**
227
+
217
228
  ```bash
218
229
  # Isolate state for a specific job
219
230
  export GEMINI_CLI_HOME="/tmp/gemini-job-123"
220
231
  gemini
221
232
  ```
222
233
 
234
+ **Windows (PowerShell)**
235
+
236
+ ```powershell
237
+ # Isolate state for a specific job
238
+ $env:GEMINI_CLI_HOME="C:\temp\gemini-job-123"
239
+ gemini
240
+ ```
241
+
223
242
  ## Restricting tool access
224
243
 
225
244
  You can significantly enhance security by controlling which tools the Gemini
@@ -19,24 +19,15 @@ Use the following command in Gemini CLI:
19
19
 
20
20
  Running this command will open a dialog with your options:
21
21
 
22
- | Option | Description | Models |
23
- | ----------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------- |
24
- | Auto (Gemini 3) | Let the system choose the best Gemini 3 model for your task. | gemini-3-pro-preview (if enabled), gemini-3-flash-preview (if enabled) |
25
- | Auto (Gemini 2.5) | Let the system choose the best Gemini 2.5 model for your task. | gemini-2.5-pro, gemini-2.5-flash |
26
- | Manual | Select a specific model. | Any available model. |
22
+ | Option | Description | Models |
23
+ | ----------------- | -------------------------------------------------------------- | -------------------------------------------- |
24
+ | Auto (Gemini 3) | Let the system choose the best Gemini 3 model for your task. | gemini-3-pro-preview, gemini-3-flash-preview |
25
+ | Auto (Gemini 2.5) | Let the system choose the best Gemini 2.5 model for your task. | gemini-2.5-pro, gemini-2.5-flash |
26
+ | Manual | Select a specific model. | Any available model. |
27
27
 
28
28
  We recommend selecting one of the above **Auto** options. However, you can
29
29
  select **Manual** to select a specific model from those available.
30
30
 
31
- ### Gemini 3 and preview features
32
-
33
- > **Note:** Gemini 3 is not currently available on all account types. To learn
34
- > more about Gemini 3 access, refer to
35
- > [Gemini 3 on Gemini CLI](../get-started/gemini-3.md).
36
-
37
- To enable Gemini 3 Pro and Gemini 3 Flash (if available), enable
38
- [**Preview Features** by using the `settings` command](../cli/settings.md).
39
-
40
31
  You can also use the `--model` flag to specify a particular Gemini model on
41
32
  startup. For more details, refer to the
42
33
  [configuration documentation](../reference/configuration.md).
@@ -55,12 +55,27 @@ from your organization's registry.
55
55
  ```bash
56
56
  # Enable sandboxing with command flag
57
57
  gemini -s -p "analyze the code structure"
58
+ ```
59
+
60
+ **Use environment variable**
61
+
62
+ **macOS/Linux**
58
63
 
59
- # Use environment variable
64
+ ```bash
60
65
  export GEMINI_SANDBOX=true
61
66
  gemini -p "run the test suite"
67
+ ```
68
+
69
+ **Windows (PowerShell)**
62
70
 
63
- # Configure in settings.json
71
+ ```powershell
72
+ $env:GEMINI_SANDBOX="true"
73
+ gemini -p "run the test suite"
74
+ ```
75
+
76
+ **Configure in settings.json**
77
+
78
+ ```json
64
79
  {
65
80
  "tools": {
66
81
  "sandbox": "docker"
@@ -99,26 +114,51 @@ use cases.
99
114
 
100
115
  To disable SELinux labeling for volume mounts, you can set the following:
101
116
 
117
+ **macOS/Linux**
118
+
102
119
  ```bash
103
120
  export SANDBOX_FLAGS="--security-opt label=disable"
104
121
  ```
105
122
 
123
+ **Windows (PowerShell)**
124
+
125
+ ```powershell
126
+ $env:SANDBOX_FLAGS="--security-opt label=disable"
127
+ ```
128
+
106
129
  Multiple flags can be provided as a space-separated string:
107
130
 
131
+ **macOS/Linux**
132
+
108
133
  ```bash
109
134
  export SANDBOX_FLAGS="--flag1 --flag2=value"
110
135
  ```
111
136
 
137
+ **Windows (PowerShell)**
138
+
139
+ ```powershell
140
+ $env:SANDBOX_FLAGS="--flag1 --flag2=value"
141
+ ```
142
+
112
143
  ## Linux UID/GID handling
113
144
 
114
145
  The sandbox automatically handles user permissions on Linux. Override these
115
146
  permissions with:
116
147
 
148
+ **macOS/Linux**
149
+
117
150
  ```bash
118
151
  export SANDBOX_SET_UID_GID=true # Force host UID/GID
119
152
  export SANDBOX_SET_UID_GID=false # Disable UID/GID mapping
120
153
  ```
121
154
 
155
+ **Windows (PowerShell)**
156
+
157
+ ```powershell
158
+ $env:SANDBOX_SET_UID_GID="true" # Force host UID/GID
159
+ $env:SANDBOX_SET_UID_GID="false" # Disable UID/GID mapping
160
+ ```
161
+
122
162
  ## Troubleshooting
123
163
 
124
164
  ### Common issues
@@ -103,23 +103,52 @@ Before using either method below, complete these steps:
103
103
 
104
104
  1. Set your Google Cloud project ID:
105
105
  - For telemetry in a separate project from inference:
106
+
107
+ **macOS/Linux**
108
+
106
109
  ```bash
107
110
  export OTLP_GOOGLE_CLOUD_PROJECT="your-telemetry-project-id"
108
111
  ```
112
+
113
+ **Windows (PowerShell)**
114
+
115
+ ```powershell
116
+ $env:OTLP_GOOGLE_CLOUD_PROJECT="your-telemetry-project-id"
117
+ ```
118
+
109
119
  - For telemetry in the same project as inference:
120
+
121
+ **macOS/Linux**
122
+
110
123
  ```bash
111
124
  export GOOGLE_CLOUD_PROJECT="your-project-id"
112
125
  ```
113
126
 
127
+ **Windows (PowerShell)**
128
+
129
+ ```powershell
130
+ $env:GOOGLE_CLOUD_PROJECT="your-project-id"
131
+ ```
132
+
114
133
  2. Authenticate with Google Cloud:
115
134
  - If using a user account:
116
135
  ```bash
117
136
  gcloud auth application-default login
118
137
  ```
119
138
  - If using a service account:
139
+
140
+ **macOS/Linux**
141
+
120
142
  ```bash
121
143
  export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/service-account.json"
122
144
  ```
145
+
146
+ **Windows (PowerShell)**
147
+
148
+ ```powershell
149
+ $env:GOOGLE_APPLICATION_CREDENTIALS="C:\path\to\your\service-account.json"
150
+ ```
151
+
123
152
  3. Make sure your account or service account has these IAM roles:
124
153
  - Cloud Trace Agent
125
154
  - Monitoring Metric Writer
@@ -37,10 +37,18 @@ output.
37
37
 
38
38
  Pipe a file:
39
39
 
40
+ **macOS/Linux**
41
+
40
42
  ```bash
41
43
  cat error.log | gemini "Explain why this failed"
42
44
  ```
43
45
 
46
+ **Windows (PowerShell)**
47
+
48
+ ```powershell
49
+ Get-Content error.log | gemini "Explain why this failed"
50
+ ```
51
+
44
52
  Pipe a command:
45
53
 
46
54
  ```bash
@@ -57,7 +65,10 @@ results to a file.
57
65
  You have a folder of Python scripts and want to generate a `README.md` for each
58
66
  one.
59
67
 
60
- 1. Save the following code as `generate_docs.sh`:
68
+ 1. Save the following code as `generate_docs.sh` (or `generate_docs.ps1` for
69
+ Windows):
70
+
71
+ **macOS/Linux (`generate_docs.sh`)**
61
72
 
62
73
  ```bash
63
74
  #!/bin/bash
@@ -72,13 +83,34 @@ one.
72
83
  done
73
84
  ```
74
85
 
86
+ **Windows PowerShell (`generate_docs.ps1`)**
87
+
88
+ ```powershell
89
+ # Loop through all Python files
90
+ Get-ChildItem -Filter *.py | ForEach-Object {
91
+ Write-Host "Generating docs for $($_.Name)..."
92
+
93
+ $newName = $_.Name -replace '\.py$', '.md'
94
+ # Ask Gemini CLI to generate the documentation and print it to stdout
95
+ gemini "Generate a Markdown documentation summary for @$($_.Name). Print the result to standard output." | Out-File -FilePath $newName -Encoding utf8
96
+ }
97
+ ```
98
+
75
99
  2. Make the script executable and run it in your directory:
76
100
 
101
+ **macOS/Linux**
102
+
77
103
  ```bash
78
104
  chmod +x generate_docs.sh
79
105
  ./generate_docs.sh
80
106
  ```
81
107
 
108
+ **Windows (PowerShell)**
109
+
110
+ ```powershell
111
+ .\generate_docs.ps1
112
+ ```
113
+
82
114
  This creates a corresponding Markdown file for every Python file in the
83
115
  folder.
84
116
 
@@ -90,7 +122,10 @@ like `jq`. To get pure JSON data from the model, combine the
90
122
 
91
123
  ### Scenario: Extract and return structured data
92
124
 
93
- 1. Save the following script as `generate_json.sh`:
125
+ 1. Save the following script as `generate_json.sh` (or `generate_json.ps1` for
126
+ Windows):
127
+
128
+ **macOS/Linux (`generate_json.sh`)**
94
129
 
95
130
  ```bash
96
131
  #!/bin/bash
@@ -105,13 +140,35 @@ like `jq`. To get pure JSON data from the model, combine the
105
140
  gemini --output-format json "Return a raw JSON object with keys 'version' and 'deps' from @package.json" | jq -r '.response' > data.json
106
141
  ```
107
142
 
108
- 2. Run `generate_json.sh`:
143
+ **Windows PowerShell (`generate_json.ps1`)**
144
+
145
+ ```powershell
146
+ # Ensure we are in a project root
147
+ if (-not (Test-Path "package.json")) {
148
+ Write-Error "Error: package.json not found."
149
+ exit 1
150
+ }
151
+
152
+ # Extract data (requires jq installed, or you can use ConvertFrom-Json)
153
+ $output = gemini --output-format json "Return a raw JSON object with keys 'version' and 'deps' from @package.json" | ConvertFrom-Json
154
+ $output.response | Out-File -FilePath data.json -Encoding utf8
155
+ ```
156
+
157
+ 2. Run the script:
158
+
159
+ **macOS/Linux**
109
160
 
110
161
  ```bash
111
162
  chmod +x generate_json.sh
112
163
  ./generate_json.sh
113
164
  ```
114
165
 
166
+ **Windows (PowerShell)**
167
+
168
+ ```powershell
169
+ .\generate_json.ps1
170
+ ```
171
+
115
172
  3. Check `data.json`. The file should look like this:
116
173
 
117
174
  ```json
@@ -129,8 +186,10 @@ Use headless mode to perform custom, automated AI tasks.
129
186
 
130
187
  ### Scenario: Create a "Smart Commit" alias
131
188
 
132
- You can add a function to your shell configuration (like `.zshrc` or `.bashrc`)
133
- to create a `git commit` wrapper that writes the message for you.
189
+ You can add a function to your shell configuration to create a `git commit`
190
+ wrapper that writes the message for you.
191
+
192
+ **macOS/Linux (Bash/Zsh)**
134
193
 
135
194
  1. Open your `.zshrc` file (or `.bashrc` if you use Bash) in your preferred
136
195
  text editor.
@@ -170,6 +229,43 @@ to create a `git commit` wrapper that writes the message for you.
170
229
  source ~/.zshrc
171
230
  ```
172
231
 
232
+ **Windows (PowerShell)**
233
+
234
+ 1. Open your PowerShell profile in your preferred text editor.
235
+
236
+ ```powershell
237
+ notepad $PROFILE
238
+ ```
239
+
240
+ 2. Scroll to the very bottom of the file and paste this code:
241
+
242
+ ```powershell
243
+ function gcommit {
244
+ # Get the diff of staged changes
245
+ $diff = git diff --staged
246
+
247
+ if (-not $diff) {
248
+ Write-Host "No staged changes to commit."
249
+ return
250
+ }
251
+
252
+ # Ask Gemini to write the message
253
+ Write-Host "Generating commit message..."
254
+ $msg = $diff | gemini "Write a concise Conventional Commit message for this diff. Output ONLY the message."
255
+
256
+ # Commit with the generated message
257
+ git commit -m "$msg"
258
+ }
259
+ ```
260
+
261
+ Save your file and exit.
262
+
263
+ 3. Run this command to make the function available immediately:
264
+
265
+ ```powershell
266
+ . $PROFILE
267
+ ```
268
+
173
269
  4. Use your new command:
174
270
 
175
271
  ```bash
@@ -20,10 +20,18 @@ Most MCP servers require authentication. For GitHub, you need a PAT.
20
20
  **Read/Write** access to **Issues** and **Pull Requests**.
21
21
  3. Store it in your environment:
22
22
 
23
+ **macOS/Linux**
24
+
23
25
  ```bash
24
26
  export GITHUB_PERSONAL_ACCESS_TOKEN="github_pat_..."
25
27
  ```
26
28
 
29
+ **Windows (PowerShell)**
30
+
31
+ ```powershell
32
+ $env:GITHUB_PERSONAL_ACCESS_TOKEN="github_pat_..."
33
+ ```
34
+
27
35
  ## How to configure Gemini CLI
28
36
 
29
37
  You tell Gemini about new servers by editing your `settings.json`.
@@ -14,10 +14,18 @@ responding correctly.
14
14
 
15
15
  1. Run the following command to create the folders:
16
16
 
17
+ **macOS/Linux**
18
+
17
19
  ```bash
18
20
  mkdir -p .gemini/skills/api-auditor/scripts
19
21
  ```
20
22
 
23
+ **Windows (PowerShell)**
24
+
25
+ ```powershell
26
+ New-Item -ItemType Directory -Force -Path ".gemini\skills\api-auditor\scripts"
27
+ ```
28
+
21
29
  ### Create the definition
22
30
 
23
31
  1. Create a file at `.gemini/skills/api-auditor/SKILL.md`. This tells the agent
@@ -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