@dgxo/mashadevcli 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +393 -0
- package/bundle/builtin/skill-creator/SKILL.md +382 -0
- package/bundle/builtin/skill-creator/scripts/init_skill.cjs +239 -0
- package/bundle/builtin/skill-creator/scripts/package_skill.cjs +131 -0
- package/bundle/builtin/skill-creator/scripts/validate_skill.cjs +131 -0
- package/bundle/docs/CONTRIBUTING.md +1 -0
- package/bundle/docs/admin/enterprise-controls.md +115 -0
- package/bundle/docs/assets/connected_devtools.png +0 -0
- package/bundle/docs/assets/gemini-screenshot.png +0 -0
- package/bundle/docs/assets/monitoring-dashboard-logs.png +0 -0
- package/bundle/docs/assets/monitoring-dashboard-metrics.png +0 -0
- package/bundle/docs/assets/monitoring-dashboard-overview.png +0 -0
- package/bundle/docs/assets/release_patch.png +0 -0
- package/bundle/docs/assets/theme-ansi-light.png +0 -0
- package/bundle/docs/assets/theme-ansi.png +0 -0
- package/bundle/docs/assets/theme-atom-one.png +0 -0
- package/bundle/docs/assets/theme-ayu-light.png +0 -0
- package/bundle/docs/assets/theme-ayu.png +0 -0
- package/bundle/docs/assets/theme-custom.png +0 -0
- package/bundle/docs/assets/theme-default-light.png +0 -0
- package/bundle/docs/assets/theme-default.png +0 -0
- package/bundle/docs/assets/theme-dracula.png +0 -0
- package/bundle/docs/assets/theme-github-light.png +0 -0
- package/bundle/docs/assets/theme-github.png +0 -0
- package/bundle/docs/assets/theme-google-light.png +0 -0
- package/bundle/docs/assets/theme-xcode-light.png +0 -0
- package/bundle/docs/changelogs/index.md +867 -0
- package/bundle/docs/changelogs/latest.md +208 -0
- package/bundle/docs/changelogs/preview.md +187 -0
- package/bundle/docs/cli/checkpointing.md +93 -0
- package/bundle/docs/cli/cli-reference.md +115 -0
- package/bundle/docs/cli/creating-skills.md +80 -0
- package/bundle/docs/cli/custom-commands.md +327 -0
- package/bundle/docs/cli/enterprise.md +604 -0
- package/bundle/docs/cli/gemini-ignore.md +71 -0
- package/bundle/docs/cli/gemini-md.md +116 -0
- package/bundle/docs/cli/generation-settings.md +210 -0
- package/bundle/docs/cli/headless.md +50 -0
- package/bundle/docs/cli/model-routing.md +42 -0
- package/bundle/docs/cli/model.md +53 -0
- package/bundle/docs/cli/plan-mode.md +375 -0
- package/bundle/docs/cli/rewind.md +51 -0
- package/bundle/docs/cli/sandbox.md +257 -0
- package/bundle/docs/cli/session-management.md +184 -0
- package/bundle/docs/cli/settings.md +165 -0
- package/bundle/docs/cli/skills.md +134 -0
- package/bundle/docs/cli/system-prompt.md +125 -0
- package/bundle/docs/cli/telemetry.md +922 -0
- package/bundle/docs/cli/themes.md +269 -0
- package/bundle/docs/cli/token-caching.md +20 -0
- package/bundle/docs/cli/trusted-folders.md +126 -0
- package/bundle/docs/cli/tutorials/automation.md +283 -0
- package/bundle/docs/cli/tutorials/file-management.md +142 -0
- package/bundle/docs/cli/tutorials/mcp-setup.md +113 -0
- package/bundle/docs/cli/tutorials/memory-management.md +126 -0
- package/bundle/docs/cli/tutorials/session-management.md +105 -0
- package/bundle/docs/cli/tutorials/shell-commands.md +107 -0
- package/bundle/docs/cli/tutorials/skills-getting-started.md +110 -0
- package/bundle/docs/cli/tutorials/task-planning.md +93 -0
- package/bundle/docs/cli/tutorials/web-tools.md +78 -0
- package/bundle/docs/core/index.md +107 -0
- package/bundle/docs/core/remote-agents.md +84 -0
- package/bundle/docs/core/subagents.md +307 -0
- package/bundle/docs/examples/proxy-script.md +83 -0
- package/bundle/docs/extensions/best-practices.md +188 -0
- package/bundle/docs/extensions/index.md +61 -0
- package/bundle/docs/extensions/reference.md +333 -0
- package/bundle/docs/extensions/releasing.md +154 -0
- package/bundle/docs/extensions/writing-extensions.md +308 -0
- package/bundle/docs/get-started/authentication.md +402 -0
- package/bundle/docs/get-started/examples.md +139 -0
- package/bundle/docs/get-started/gemini-3.md +115 -0
- package/bundle/docs/get-started/index.md +82 -0
- package/bundle/docs/get-started/installation.md +174 -0
- package/bundle/docs/hooks/best-practices.md +709 -0
- package/bundle/docs/hooks/index.md +164 -0
- package/bundle/docs/hooks/reference.md +330 -0
- package/bundle/docs/hooks/writing-hooks.md +474 -0
- package/bundle/docs/ide-integration/ide-companion-spec.md +267 -0
- package/bundle/docs/ide-integration/index.md +224 -0
- package/bundle/docs/index.md +141 -0
- package/bundle/docs/integration-tests.md +211 -0
- package/bundle/docs/issue-and-pr-automation.md +172 -0
- package/bundle/docs/local-development.md +134 -0
- package/bundle/docs/mermaid/context.mmd +103 -0
- package/bundle/docs/mermaid/render-path.mmd +64 -0
- package/bundle/docs/npm.md +62 -0
- package/bundle/docs/redirects.json +20 -0
- package/bundle/docs/reference/commands.md +526 -0
- package/bundle/docs/reference/configuration.md +1786 -0
- package/bundle/docs/reference/keyboard-shortcuts.md +164 -0
- package/bundle/docs/reference/memport.md +246 -0
- package/bundle/docs/reference/policy-engine.md +364 -0
- package/bundle/docs/reference/tools.md +106 -0
- package/bundle/docs/release-confidence.md +164 -0
- package/bundle/docs/releases.md +540 -0
- package/bundle/docs/resources/faq.md +175 -0
- package/bundle/docs/resources/quota-and-pricing.md +165 -0
- package/bundle/docs/resources/tos-privacy.md +102 -0
- package/bundle/docs/resources/troubleshooting.md +176 -0
- package/bundle/docs/resources/uninstall.md +56 -0
- package/bundle/docs/sidebar.json +233 -0
- package/bundle/docs/tools/activate-skill.md +43 -0
- package/bundle/docs/tools/ask-user.md +95 -0
- package/bundle/docs/tools/file-system.md +129 -0
- package/bundle/docs/tools/internal-docs.md +46 -0
- package/bundle/docs/tools/mcp-server.md +1150 -0
- package/bundle/docs/tools/memory.md +35 -0
- package/bundle/docs/tools/planning.md +58 -0
- package/bundle/docs/tools/shell.md +216 -0
- package/bundle/docs/tools/todos.md +35 -0
- package/bundle/docs/tools/web-fetch.md +35 -0
- package/bundle/docs/tools/web-search.md +32 -0
- package/bundle/docs/update/update-guide.md +111 -0
- package/bundle/masha.js +563471 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/client/main.js +89 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.d.ts +7 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.js +9 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.js.map +1 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.d.ts +48 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.js +299 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.js.map +1 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.d.ts +36 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.js +7 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.js.map +1 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/package.json +32 -0
- package/bundle/policies/conseca.toml +6 -0
- package/bundle/policies/discovered.toml +8 -0
- package/bundle/policies/plan.toml +109 -0
- package/bundle/policies/read-only.toml +53 -0
- package/bundle/policies/write.toml +80 -0
- package/bundle/policies/yolo.toml +54 -0
- package/bundle/sandbox-macos-permissive-open.sb +27 -0
- package/bundle/sandbox-macos-permissive-proxied.sb +37 -0
- package/bundle/sandbox-macos-restrictive-open.sb +96 -0
- package/bundle/sandbox-macos-restrictive-proxied.sb +98 -0
- package/bundle/sandbox-macos-strict-open.sb +131 -0
- package/bundle/sandbox-macos-strict-proxied.sb +133 -0
- package/package.json +169 -0
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
# Gemini CLI authentication setup
|
|
2
|
+
|
|
3
|
+
To use Gemini CLI, you'll need to authenticate with Google. This guide helps you
|
|
4
|
+
quickly find the best way to sign in based on your account type and how you're
|
|
5
|
+
using the CLI.
|
|
6
|
+
|
|
7
|
+
For most users, we recommend starting Gemini CLI and logging in with your
|
|
8
|
+
personal Google account.
|
|
9
|
+
|
|
10
|
+
## Choose your authentication method <a id="auth-methods"></a>
|
|
11
|
+
|
|
12
|
+
Select the authentication method that matches your situation in the table below:
|
|
13
|
+
|
|
14
|
+
| User Type / Scenario | Recommended Authentication Method | Google Cloud Project Required |
|
|
15
|
+
| :--------------------------------------------------------------------- | :--------------------------------------------------------------- | :---------------------------------------------------------- |
|
|
16
|
+
| Individual Google accounts | [Login with Google](#login-google) | No, with exceptions |
|
|
17
|
+
| Organization users with a company, school, or Google Workspace account | [Login with Google](#login-google) | [Yes](#set-gcp) |
|
|
18
|
+
| AI Studio user with a Gemini API key | [Use Gemini API Key](#gemini-api) | No |
|
|
19
|
+
| Google Cloud Vertex AI user | [Vertex AI](#vertex-ai) | [Yes](#set-gcp) |
|
|
20
|
+
| [Headless mode](#headless) | [Use Gemini API Key](#gemini-api) or<br> [Vertex AI](#vertex-ai) | No (for Gemini API Key)<br> [Yes](#set-gcp) (for Vertex AI) |
|
|
21
|
+
|
|
22
|
+
### What is my Google account type?
|
|
23
|
+
|
|
24
|
+
- **Individual Google accounts:** Includes all
|
|
25
|
+
[free tier accounts](../resources/quota-and-pricing.md#free-usage) such as
|
|
26
|
+
Gemini Code Assist for individuals, as well as paid subscriptions for
|
|
27
|
+
[Google AI Pro and Ultra](https://gemini.google/subscriptions/).
|
|
28
|
+
|
|
29
|
+
- **Organization accounts:** Accounts using paid licenses through an
|
|
30
|
+
organization such as a company, school, or
|
|
31
|
+
[Google Workspace](https://workspace.google.com/). Includes
|
|
32
|
+
[Google AI Ultra for Business](https://support.google.com/a/answer/16345165)
|
|
33
|
+
subscriptions.
|
|
34
|
+
|
|
35
|
+
## (Recommended) Login with Google <a id="login-google"></a>
|
|
36
|
+
|
|
37
|
+
If you run Gemini CLI on your local machine, the simplest authentication method
|
|
38
|
+
is logging in with your Google account. This method requires a web browser on a
|
|
39
|
+
machine that can communicate with the terminal running Gemini CLI (e.g., your
|
|
40
|
+
local machine).
|
|
41
|
+
|
|
42
|
+
> **Important:** If you are a **Google AI Pro** or **Google AI Ultra**
|
|
43
|
+
> subscriber, use the Google account associated with your subscription.
|
|
44
|
+
|
|
45
|
+
To authenticate and use Gemini CLI:
|
|
46
|
+
|
|
47
|
+
1. Start the CLI:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
gemini
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
2. Select **Login with Google**. Gemini CLI opens a login prompt using your web
|
|
54
|
+
browser. Follow the on-screen instructions. Your credentials will be cached
|
|
55
|
+
locally for future sessions.
|
|
56
|
+
|
|
57
|
+
### Do I need to set my Google Cloud project?
|
|
58
|
+
|
|
59
|
+
Most individual Google accounts (free and paid) don't require a Google Cloud
|
|
60
|
+
project for authentication. However, you'll need to set a Google Cloud project
|
|
61
|
+
when you meet at least one of the following conditions:
|
|
62
|
+
|
|
63
|
+
- You are using a company, school, or Google Workspace account.
|
|
64
|
+
- You are using a Gemini Code Assist license from the Google Developer Program.
|
|
65
|
+
- You are using a license from a Gemini Code Assist subscription.
|
|
66
|
+
|
|
67
|
+
For instructions, see [Set your Google Cloud Project](#set-gcp).
|
|
68
|
+
|
|
69
|
+
## Use Gemini API key <a id="gemini-api"></a>
|
|
70
|
+
|
|
71
|
+
If you don't want to authenticate using your Google account, you can use an API
|
|
72
|
+
key from Google AI Studio.
|
|
73
|
+
|
|
74
|
+
To authenticate and use Gemini CLI with a Gemini API key:
|
|
75
|
+
|
|
76
|
+
1. Obtain your API key from
|
|
77
|
+
[Google AI Studio](https://aistudio.google.com/app/apikey).
|
|
78
|
+
|
|
79
|
+
2. Set the `GEMINI_API_KEY` environment variable to your key. For example:
|
|
80
|
+
|
|
81
|
+
**macOS/Linux**
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Replace YOUR_GEMINI_API_KEY with the key from AI Studio
|
|
85
|
+
export GEMINI_API_KEY="YOUR_GEMINI_API_KEY"
|
|
86
|
+
```
|
|
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
|
+
|
|
95
|
+
To make this setting persistent, see
|
|
96
|
+
[Persisting Environment Variables](#persisting-vars).
|
|
97
|
+
|
|
98
|
+
3. Start the CLI:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
gemini
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
4. Select **Use Gemini API key**.
|
|
105
|
+
|
|
106
|
+
> **Warning:** Treat API keys, especially for services like Gemini, as sensitive
|
|
107
|
+
> credentials. Protect them to prevent unauthorized access and potential misuse
|
|
108
|
+
> of the service under your account.
|
|
109
|
+
|
|
110
|
+
## Use Vertex AI <a id="vertex-ai"></a>
|
|
111
|
+
|
|
112
|
+
To use Gemini CLI with Google Cloud's Vertex AI platform, choose from the
|
|
113
|
+
following authentication options:
|
|
114
|
+
|
|
115
|
+
- A. Application Default Credentials (ADC) using `gcloud`.
|
|
116
|
+
- B. Service account JSON key.
|
|
117
|
+
- C. Google Cloud API key.
|
|
118
|
+
|
|
119
|
+
Regardless of your authentication method for Vertex AI, you'll need to set
|
|
120
|
+
`GOOGLE_CLOUD_PROJECT` to your Google Cloud project ID with the Vertex AI API
|
|
121
|
+
enabled, and `GOOGLE_CLOUD_LOCATION` to the location of your Vertex AI resources
|
|
122
|
+
or the location where you want to run your jobs.
|
|
123
|
+
|
|
124
|
+
For example:
|
|
125
|
+
|
|
126
|
+
**macOS/Linux**
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# Replace with your project ID and desired location (e.g., us-central1)
|
|
130
|
+
export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"
|
|
131
|
+
export GOOGLE_CLOUD_LOCATION="YOUR_PROJECT_LOCATION"
|
|
132
|
+
```
|
|
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
|
+
|
|
142
|
+
To make any Vertex AI environment variable settings persistent, see
|
|
143
|
+
[Persisting Environment Variables](#persisting-vars).
|
|
144
|
+
|
|
145
|
+
#### A. Vertex AI - application default credentials (ADC) using `gcloud`
|
|
146
|
+
|
|
147
|
+
Consider this authentication method if you have Google Cloud CLI installed.
|
|
148
|
+
|
|
149
|
+
> **Note:** If you have previously set `GOOGLE_API_KEY` or `GEMINI_API_KEY`, you
|
|
150
|
+
> must unset them to use ADC:
|
|
151
|
+
>
|
|
152
|
+
> **macOS/Linux**
|
|
153
|
+
>
|
|
154
|
+
> ```bash
|
|
155
|
+
> unset GOOGLE_API_KEY GEMINI_API_KEY
|
|
156
|
+
> ```
|
|
157
|
+
>
|
|
158
|
+
> **Windows (PowerShell)**
|
|
159
|
+
>
|
|
160
|
+
> ```powershell
|
|
161
|
+
> Remove-Item Env:\GOOGLE_API_KEY, Env:\GEMINI_API_KEY -ErrorAction Ignore
|
|
162
|
+
> ```
|
|
163
|
+
|
|
164
|
+
1. Verify you have a Google Cloud project and Vertex AI API is enabled.
|
|
165
|
+
|
|
166
|
+
2. Log in to Google Cloud:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
gcloud auth application-default login
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
3. [Configure your Google Cloud Project](#set-gcp).
|
|
173
|
+
|
|
174
|
+
4. Start the CLI:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
gemini
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
5. Select **Vertex AI**.
|
|
181
|
+
|
|
182
|
+
#### B. Vertex AI - service account JSON key
|
|
183
|
+
|
|
184
|
+
Consider this method of authentication in non-interactive environments, CI/CD
|
|
185
|
+
pipelines, or if your organization restricts user-based ADC or API key creation.
|
|
186
|
+
|
|
187
|
+
> **Note:** If you have previously set `GOOGLE_API_KEY` or `GEMINI_API_KEY`, you
|
|
188
|
+
> must unset them:
|
|
189
|
+
>
|
|
190
|
+
> **macOS/Linux**
|
|
191
|
+
>
|
|
192
|
+
> ```bash
|
|
193
|
+
> unset GOOGLE_API_KEY GEMINI_API_KEY
|
|
194
|
+
> ```
|
|
195
|
+
>
|
|
196
|
+
> **Windows (PowerShell)**
|
|
197
|
+
>
|
|
198
|
+
> ```powershell
|
|
199
|
+
> Remove-Item Env:\GOOGLE_API_KEY, Env:\GEMINI_API_KEY -ErrorAction Ignore
|
|
200
|
+
> ```
|
|
201
|
+
|
|
202
|
+
1. [Create a service account and key](https://cloud.google.com/iam/docs/keys-create-delete)
|
|
203
|
+
and download the provided JSON file. Assign the "Vertex AI User" role to the
|
|
204
|
+
service account.
|
|
205
|
+
|
|
206
|
+
2. Set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to the JSON
|
|
207
|
+
file's absolute path. For example:
|
|
208
|
+
|
|
209
|
+
**macOS/Linux**
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
# Replace /path/to/your/keyfile.json with the actual path
|
|
213
|
+
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/keyfile.json"
|
|
214
|
+
```
|
|
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
|
+
|
|
223
|
+
3. [Configure your Google Cloud Project](#set-gcp).
|
|
224
|
+
|
|
225
|
+
4. Start the CLI:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
gemini
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
5. Select **Vertex AI**.
|
|
232
|
+
> **Warning:** Protect your service account key file as it gives access to
|
|
233
|
+
> your resources.
|
|
234
|
+
|
|
235
|
+
#### C. Vertex AI - Google Cloud API key
|
|
236
|
+
|
|
237
|
+
1. Obtain a Google Cloud API key:
|
|
238
|
+
[Get an API Key](https://cloud.google.com/vertex-ai/generative-ai/docs/start/api-keys?usertype=newuser).
|
|
239
|
+
|
|
240
|
+
2. Set the `GOOGLE_API_KEY` environment variable:
|
|
241
|
+
|
|
242
|
+
**macOS/Linux**
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
# Replace YOUR_GOOGLE_API_KEY with your Vertex AI API key
|
|
246
|
+
export GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY"
|
|
247
|
+
```
|
|
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
|
+
|
|
256
|
+
> **Note:** If you see errors like
|
|
257
|
+
> `"API keys are not supported by this API..."`, your organization might
|
|
258
|
+
> restrict API key usage for this service. Try the other Vertex AI
|
|
259
|
+
> authentication methods instead.
|
|
260
|
+
|
|
261
|
+
3. [Configure your Google Cloud Project](#set-gcp).
|
|
262
|
+
|
|
263
|
+
4. Start the CLI:
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
gemini
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
5. Select **Vertex AI**.
|
|
270
|
+
|
|
271
|
+
## Set your Google Cloud project <a id="set-gcp"></a>
|
|
272
|
+
|
|
273
|
+
> **Important:** Most individual Google accounts (free and paid) don't require a
|
|
274
|
+
> Google Cloud project for authentication.
|
|
275
|
+
|
|
276
|
+
When you sign in using your Google account, you may need to configure a Google
|
|
277
|
+
Cloud project for Gemini CLI to use. This applies when you meet at least one of
|
|
278
|
+
the following conditions:
|
|
279
|
+
|
|
280
|
+
- You are using a Company, School, or Google Workspace account.
|
|
281
|
+
- You are using a Gemini Code Assist license from the Google Developer Program.
|
|
282
|
+
- You are using a license from a Gemini Code Assist subscription.
|
|
283
|
+
|
|
284
|
+
To configure Gemini CLI to use a Google Cloud project, do the following:
|
|
285
|
+
|
|
286
|
+
1. [Find your Google Cloud Project ID](https://support.google.com/googleapi/answer/7014113).
|
|
287
|
+
|
|
288
|
+
2. [Enable the Gemini for Cloud API](https://cloud.google.com/gemini/docs/discover/set-up-gemini#enable-api).
|
|
289
|
+
|
|
290
|
+
3. [Configure necessary IAM access permissions](https://cloud.google.com/gemini/docs/discover/set-up-gemini#grant-iam).
|
|
291
|
+
|
|
292
|
+
4. Configure your environment variables. Set either the `GOOGLE_CLOUD_PROJECT`
|
|
293
|
+
or `GOOGLE_CLOUD_PROJECT_ID` variable to the project ID to use with Gemini
|
|
294
|
+
CLI. Gemini CLI checks for `GOOGLE_CLOUD_PROJECT` first, then falls back to
|
|
295
|
+
`GOOGLE_CLOUD_PROJECT_ID`.
|
|
296
|
+
|
|
297
|
+
For example, to set the `GOOGLE_CLOUD_PROJECT_ID` variable:
|
|
298
|
+
|
|
299
|
+
**macOS/Linux**
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
# Replace YOUR_PROJECT_ID with your actual Google Cloud project ID
|
|
303
|
+
export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"
|
|
304
|
+
```
|
|
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
|
+
|
|
313
|
+
To make this setting persistent, see
|
|
314
|
+
[Persisting Environment Variables](#persisting-vars).
|
|
315
|
+
|
|
316
|
+
## Persisting environment variables <a id="persisting-vars"></a>
|
|
317
|
+
|
|
318
|
+
To avoid setting environment variables for every terminal session, you can
|
|
319
|
+
persist them with the following methods:
|
|
320
|
+
|
|
321
|
+
1. **Add your environment variables to your shell configuration file:** Append
|
|
322
|
+
the environment variable commands to your shell's startup file.
|
|
323
|
+
|
|
324
|
+
**macOS/Linux** (e.g., `~/.bashrc`, `~/.zshrc`, or `~/.profile`):
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
echo 'export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"' >> ~/.bashrc
|
|
328
|
+
source ~/.bashrc
|
|
329
|
+
```
|
|
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
|
+
|
|
338
|
+
> **Warning:** Be aware that when you export API keys or service account
|
|
339
|
+
> paths in your shell configuration file, any process launched from that
|
|
340
|
+
> shell can read them.
|
|
341
|
+
|
|
342
|
+
2. **Use a `.env` file:** Create a `.gemini/.env` file in your project
|
|
343
|
+
directory or home directory. Gemini CLI automatically loads variables from
|
|
344
|
+
the first `.env` file it finds, searching up from the current directory,
|
|
345
|
+
then in your home directory's `.gemini/.env` (e.g., `~/.gemini/.env` or
|
|
346
|
+
`%USERPROFILE%\.gemini\.env`).
|
|
347
|
+
|
|
348
|
+
Example for user-wide settings:
|
|
349
|
+
|
|
350
|
+
**macOS/Linux**
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
mkdir -p ~/.gemini
|
|
354
|
+
cat >> ~/.gemini/.env <<'EOF'
|
|
355
|
+
GOOGLE_CLOUD_PROJECT="your-project-id"
|
|
356
|
+
# Add other variables like GEMINI_API_KEY as needed
|
|
357
|
+
EOF
|
|
358
|
+
```
|
|
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
|
+
|
|
370
|
+
Variables are loaded from the first file found, not merged.
|
|
371
|
+
|
|
372
|
+
## Running in Google Cloud environments <a id="cloud-env"></a>
|
|
373
|
+
|
|
374
|
+
When running Gemini CLI within certain Google Cloud environments, authentication
|
|
375
|
+
is automatic.
|
|
376
|
+
|
|
377
|
+
In a Google Cloud Shell environment, Gemini CLI typically authenticates
|
|
378
|
+
automatically using your Cloud Shell credentials. In Compute Engine
|
|
379
|
+
environments, Gemini CLI automatically uses Application Default Credentials
|
|
380
|
+
(ADC) from the environment's metadata server.
|
|
381
|
+
|
|
382
|
+
If automatic authentication fails, use one of the interactive methods described
|
|
383
|
+
on this page.
|
|
384
|
+
|
|
385
|
+
## Running in headless mode <a id="headless"></a>
|
|
386
|
+
|
|
387
|
+
[Headless mode](../cli/headless) will use your existing authentication method,
|
|
388
|
+
if an existing authentication credential is cached.
|
|
389
|
+
|
|
390
|
+
If you have not already logged in with an authentication credential, you must
|
|
391
|
+
configure authentication using environment variables:
|
|
392
|
+
|
|
393
|
+
- [Use Gemini API Key](#gemini-api)
|
|
394
|
+
- [Vertex AI](#vertex-ai)
|
|
395
|
+
|
|
396
|
+
## What's next?
|
|
397
|
+
|
|
398
|
+
Your authentication method affects your quotas, pricing, Terms of Service, and
|
|
399
|
+
privacy notices. Review the following pages to learn more:
|
|
400
|
+
|
|
401
|
+
- [Gemini CLI: Quotas and Pricing](../resources/quota-and-pricing.md).
|
|
402
|
+
- [Gemini CLI: Terms of Service and Privacy Notice](../resources/tos-privacy.md).
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Gemini CLI examples
|
|
2
|
+
|
|
3
|
+
Gemini CLI helps you automate common engineering tasks by combining AI reasoning
|
|
4
|
+
with local system tools. This document provides examples of how to use the CLI
|
|
5
|
+
for file management, code analysis, and data transformation.
|
|
6
|
+
|
|
7
|
+
> **Note:** These examples demonstrate potential capabilities. Your actual
|
|
8
|
+
> results can vary based on the model used and your project environment.
|
|
9
|
+
|
|
10
|
+
## Rename your photographs based on content
|
|
11
|
+
|
|
12
|
+
You can use Gemini CLI to automate file management tasks that require visual
|
|
13
|
+
analysis. In this example, Gemini CLI renames images based on their actual
|
|
14
|
+
subject matter.
|
|
15
|
+
|
|
16
|
+
Scenario: You have a folder containing the following files:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
photos/photo1.png
|
|
20
|
+
photos/photo2.png
|
|
21
|
+
photos/photo3.png
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Give Gemini the following prompt:
|
|
25
|
+
|
|
26
|
+
```cli
|
|
27
|
+
Rename the photos in my "photos" directory based on their contents.
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Result: Gemini asks for permission to rename your files.
|
|
31
|
+
|
|
32
|
+
Select **Allow once** and your files are renamed:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
photos/yellow_flowers.png
|
|
36
|
+
photos/antique_dresser.png
|
|
37
|
+
photos/green_android_robot.png
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Explain a repository by reading its code
|
|
41
|
+
|
|
42
|
+
Gemini CLI is effective for rapid codebase exploration. The following example
|
|
43
|
+
shows how to ask Gemini CLI to fetch, analyze, and summarize a remote project.
|
|
44
|
+
|
|
45
|
+
Scenario: You want to understand how a popular open-source utility works by
|
|
46
|
+
inspecting its code, not just its README.
|
|
47
|
+
|
|
48
|
+
Give Gemini CLI the following prompt:
|
|
49
|
+
|
|
50
|
+
```cli
|
|
51
|
+
Clone the 'chalk' repository from https://github.com/chalk/chalk, read its key source files, and explain how it works.
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Result: Gemini performs a sequence of actions to answer your request.
|
|
55
|
+
|
|
56
|
+
1. First, it asks for permission to run `git clone` to download the repository.
|
|
57
|
+
2. Next, it finds the important source files and asks for permission to read
|
|
58
|
+
them.
|
|
59
|
+
3. Finally, after analyzing the code, it provides a summary.
|
|
60
|
+
|
|
61
|
+
Gemini CLI returns an explanation based on the actual source code:
|
|
62
|
+
|
|
63
|
+
```markdown
|
|
64
|
+
The `chalk` library is a popular npm package for styling terminal output with
|
|
65
|
+
colors. After analyzing the source code, here's how it works:
|
|
66
|
+
|
|
67
|
+
- **Core functionality:** The main file sets up a chainable API. Each color or
|
|
68
|
+
modifier (like `bold` or `italic`) is a getter that appends the corresponding
|
|
69
|
+
ANSI escape code to an internal stack.
|
|
70
|
+
|
|
71
|
+
- **Chainable API:** When you call `chalk.red.bold('Hello')`, you are accessing
|
|
72
|
+
getters. The `red` getter adds the red color code, and the `bold` getter adds
|
|
73
|
+
the bold code.
|
|
74
|
+
|
|
75
|
+
- **Output generation:** When the chain is treated as a string (e.g., in
|
|
76
|
+
`console.log`), a final `toString()` method is called. This method joins all
|
|
77
|
+
the stored ANSI codes, wraps them around the input string ('Hello'), and adds
|
|
78
|
+
a reset code at the end. This produces the final, styled string that the
|
|
79
|
+
terminal can render.
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Combine two spreadsheets into one spreadsheet
|
|
83
|
+
|
|
84
|
+
Gemini CLI can process and transform data across multiple files. Use this
|
|
85
|
+
capability to merge reports or reformat data sets without manual copying.
|
|
86
|
+
|
|
87
|
+
Scenario: You have two .csv files: `Revenue - 2023.csv` and
|
|
88
|
+
`Revenue - 2024.csv`. Each file contains monthly revenue figures.
|
|
89
|
+
|
|
90
|
+
Give Gemini CLI the following prompt:
|
|
91
|
+
|
|
92
|
+
```cli
|
|
93
|
+
Combine the two .csv files into a single .csv file, with each year a different column.
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Result: Gemini CLI reads each file and then asks for permission to write a new
|
|
97
|
+
file. Provide your permission and Gemini CLI provides the combined data:
|
|
98
|
+
|
|
99
|
+
```csv
|
|
100
|
+
Month,2023,2024
|
|
101
|
+
January,0,1000
|
|
102
|
+
February,0,1200
|
|
103
|
+
March,0,2400
|
|
104
|
+
April,900,500
|
|
105
|
+
May,1000,800
|
|
106
|
+
June,1000,900
|
|
107
|
+
July,1200,1000
|
|
108
|
+
August,1800,400
|
|
109
|
+
September,2000,2000
|
|
110
|
+
October,2400,3400
|
|
111
|
+
November,3400,1800
|
|
112
|
+
December,2100,9000
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Run unit tests
|
|
116
|
+
|
|
117
|
+
Gemini CLI can generate boilerplate code and tests based on your existing
|
|
118
|
+
implementation. This example demonstrates how to request code coverage for a
|
|
119
|
+
JavaScript component.
|
|
120
|
+
|
|
121
|
+
Scenario: You've written a simple login page. You wish to write unit tests to
|
|
122
|
+
ensure that your login page has code coverage.
|
|
123
|
+
|
|
124
|
+
Give Gemini CLI the following prompt:
|
|
125
|
+
|
|
126
|
+
```cli
|
|
127
|
+
Write unit tests for Login.js.
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Result: Gemini CLI asks for permission to write a new file and creates a test
|
|
131
|
+
for your login page.
|
|
132
|
+
|
|
133
|
+
## Next steps
|
|
134
|
+
|
|
135
|
+
- Follow the [File management](../cli/tutorials/file-management.md) guide to
|
|
136
|
+
start working with your codebase.
|
|
137
|
+
- Follow the [Quickstart](./index.md) to start your first session.
|
|
138
|
+
- See the [Cheatsheet](../cli/cli-reference.md) for a quick reference of
|
|
139
|
+
available commands.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Gemini 3 Pro and Gemini 3 Flash on Gemini CLI
|
|
2
|
+
|
|
3
|
+
Gemini 3 Pro and Gemini 3 Flash are available on Gemini CLI for all users!
|
|
4
|
+
|
|
5
|
+
> **Note:** Gemini 3.1 Pro Preview is rolling out. To determine whether you have
|
|
6
|
+
> access to Gemini 3.1, use the `/model` command and select **Manual**. If you
|
|
7
|
+
> have access, you will see `gemini-3.1-pro-preview`.
|
|
8
|
+
>
|
|
9
|
+
> If you have access to Gemini 3.1, it will be included in model routing when
|
|
10
|
+
> you select **Auto (Gemini 3)**. You can also launch the Gemini 3.1 model
|
|
11
|
+
> directly using the `-m` flag:
|
|
12
|
+
>
|
|
13
|
+
> ```
|
|
14
|
+
> gemini -m gemini-3.1-pro-preview
|
|
15
|
+
> ```
|
|
16
|
+
>
|
|
17
|
+
> Learn more about [models](../cli/model.md) and
|
|
18
|
+
> [model routing](../cli/model-routing.md).
|
|
19
|
+
|
|
20
|
+
## How to get started with Gemini 3 on Gemini CLI
|
|
21
|
+
|
|
22
|
+
Get started by upgrading Gemini CLI to the latest version:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install -g @dgxo/mashadevcli@latest
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
After you’ve confirmed your version is 0.21.1 or later:
|
|
29
|
+
|
|
30
|
+
1. Run `/model`.
|
|
31
|
+
2. Select **Auto (Gemini 3)**.
|
|
32
|
+
|
|
33
|
+
For more information, see [Gemini CLI model selection](../cli/model.md).
|
|
34
|
+
|
|
35
|
+
### Usage limits and fallback
|
|
36
|
+
|
|
37
|
+
Gemini CLI will tell you when you reach your Gemini 3 Pro daily usage limit.
|
|
38
|
+
When you encounter that limit, you’ll be given the option to switch to Gemini
|
|
39
|
+
2.5 Pro, upgrade for higher limits, or stop. You’ll also be told when your usage
|
|
40
|
+
limit resets and Gemini 3 Pro can be used again.
|
|
41
|
+
|
|
42
|
+
Similarly, when you reach your daily usage limit for Gemini 2.5 Pro, you’ll see
|
|
43
|
+
a message prompting fallback to Gemini 2.5 Flash.
|
|
44
|
+
|
|
45
|
+
### Capacity errors
|
|
46
|
+
|
|
47
|
+
There may be times when the Gemini 3 Pro model is overloaded. When that happens,
|
|
48
|
+
Gemini CLI will ask you to decide whether you want to keep trying Gemini 3 Pro
|
|
49
|
+
or fallback to Gemini 2.5 Pro.
|
|
50
|
+
|
|
51
|
+
> **Note:** The **Keep trying** option uses exponential backoff, in which Gemini
|
|
52
|
+
> CLI waits longer between each retry, when the system is busy. If the retry
|
|
53
|
+
> doesn't happen immediately, please wait a few minutes for the request to
|
|
54
|
+
> process.
|
|
55
|
+
|
|
56
|
+
### Model selection and routing types
|
|
57
|
+
|
|
58
|
+
When using Gemini CLI, you may want to control how your requests are routed
|
|
59
|
+
between models. By default, Gemini CLI uses **Auto** routing.
|
|
60
|
+
|
|
61
|
+
When using Gemini 3 Pro, you may want to use Auto routing or Pro routing to
|
|
62
|
+
manage your usage limits:
|
|
63
|
+
|
|
64
|
+
- **Auto routing:** Auto routing first determines whether a prompt involves a
|
|
65
|
+
complex or simple operation. For simple prompts, it will automatically use
|
|
66
|
+
Gemini 2.5 Flash. For complex prompts, if Gemini 3 Pro is enabled, it will use
|
|
67
|
+
Gemini 3 Pro; otherwise, it will use Gemini 2.5 Pro.
|
|
68
|
+
- **Pro routing:** If you want to ensure your task is processed by the most
|
|
69
|
+
capable model, use `/model` and select **Pro**. Gemini CLI will prioritize the
|
|
70
|
+
most capable model available, including Gemini 3 Pro if it has been enabled.
|
|
71
|
+
|
|
72
|
+
To learn more about selecting a model and routing, refer to
|
|
73
|
+
[Gemini CLI Model Selection](../cli/model.md).
|
|
74
|
+
|
|
75
|
+
## How to enable Gemini 3 with Gemini CLI on Gemini Code Assist
|
|
76
|
+
|
|
77
|
+
If you're using Gemini Code Assist Standard or Gemini Code Assist Enterprise,
|
|
78
|
+
enabling Gemini 3 Pro on Gemini CLI requires configuring your release channels.
|
|
79
|
+
Using Gemini 3 Pro will require two steps: administrative enablement and user
|
|
80
|
+
enablement.
|
|
81
|
+
|
|
82
|
+
To learn more about these settings, refer to
|
|
83
|
+
[Configure Gemini Code Assist release channels](https://developers.google.com/gemini-code-assist/docs/configure-release-channels).
|
|
84
|
+
|
|
85
|
+
### Administrator instructions
|
|
86
|
+
|
|
87
|
+
An administrator with **Google Cloud Settings Admin** permissions must follow
|
|
88
|
+
these directions:
|
|
89
|
+
|
|
90
|
+
- Navigate to the Google Cloud Project you're using with Gemini CLI for Code
|
|
91
|
+
Assist.
|
|
92
|
+
- Go to **Admin for Gemini** > **Settings**.
|
|
93
|
+
- Under **Release channels for Gemini Code Assist in local IDEs** select
|
|
94
|
+
**Preview**.
|
|
95
|
+
- Click **Save changes**.
|
|
96
|
+
|
|
97
|
+
### User instructions
|
|
98
|
+
|
|
99
|
+
Wait for two to three minutes after your administrator has enabled **Preview**,
|
|
100
|
+
then:
|
|
101
|
+
|
|
102
|
+
- Open Gemini CLI.
|
|
103
|
+
- Use the `/settings` command.
|
|
104
|
+
- Set **Preview Features** to `true`.
|
|
105
|
+
|
|
106
|
+
Restart Gemini CLI and you should have access to Gemini 3.
|
|
107
|
+
|
|
108
|
+
## Need help?
|
|
109
|
+
|
|
110
|
+
If you need help, we recommend searching for an existing
|
|
111
|
+
[GitHub issue](https://github.com/DGameGT/mashadev-cli/issues). If you
|
|
112
|
+
cannot find a GitHub issue that matches your concern, you can
|
|
113
|
+
[create a new issue](https://github.com/DGameGT/mashadev-cli/issues/new/choose).
|
|
114
|
+
For comments and feedback, consider opening a
|
|
115
|
+
[GitHub discussion](https://github.com/DGameGT/mashadev-cli/discussions).
|