mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 12:54:07 -07:00
Minor changes from the initial docs audit.
This commit is contained in:
@@ -7,9 +7,9 @@ create files, and control what Gemini CLI can see.
|
|||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
- Gemini CLI installed and authenticated.
|
- Gemini CLI installed and authenticated.
|
||||||
- A project directory to work with (e.g., a git repository).
|
- A project directory to work with (for example, a git repository).
|
||||||
|
|
||||||
## How to give the agent context (Reading files)
|
## Providing context by reading files
|
||||||
|
|
||||||
Gemini CLI will generally try to read relevant files, sometimes prompting you
|
Gemini CLI will generally try to read relevant files, sometimes prompting you
|
||||||
for access (depending on your settings). To ensure that Gemini CLI uses a file,
|
for access (depending on your settings). To ensure that Gemini CLI uses a file,
|
||||||
@@ -58,7 +58,7 @@ You know there's a `UserProfile` component, but you don't know where it lives.
|
|||||||
```
|
```
|
||||||
|
|
||||||
Gemini uses the `glob` or `list_directory` tools to search your project
|
Gemini uses the `glob` or `list_directory` tools to search your project
|
||||||
structure. It will return the specific path (e.g.,
|
structure. It will return the specific path (for example,
|
||||||
`src/components/UserProfile.tsx`), which you can then use with `@` in your next
|
`src/components/UserProfile.tsx`), which you can then use with `@` in your next
|
||||||
turn.
|
turn.
|
||||||
|
|
||||||
@@ -111,8 +111,8 @@ or, better yet, run your project's tests.
|
|||||||
`Run the tests for the UserProfile component.`
|
`Run the tests for the UserProfile component.`
|
||||||
```
|
```
|
||||||
|
|
||||||
Gemini CLI uses the `run_shell_command` tool to execute your test runner (e.g.,
|
Gemini CLI uses the `run_shell_command` tool to execute your test runner (for
|
||||||
`npm test` or `jest`). This ensures the changes didn't break existing
|
example, `npm test` or `jest`). This ensures the changes didn't break existing
|
||||||
functionality.
|
functionality.
|
||||||
|
|
||||||
## Advanced: Controlling what Gemini sees
|
## Advanced: Controlling what Gemini sees
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ persistent facts, and inspect the active context.
|
|||||||
|
|
||||||
## Why manage context?
|
## Why manage context?
|
||||||
|
|
||||||
Out of the box, Gemini CLI is smart but generic. It doesn't know your preferred
|
Gemini CLI is powerful but general. It doesn't know your preferred testing
|
||||||
testing framework, your indentation style, or that you hate using `any` in
|
framework, your indentation style, or or your preference against `any` in
|
||||||
TypeScript. Context management solves this by giving the agent persistent
|
TypeScript. Context management solves this by giving the agent persistent
|
||||||
memory.
|
memory.
|
||||||
|
|
||||||
@@ -109,11 +109,11 @@ immediately. Force a reload with:
|
|||||||
|
|
||||||
## Best practices
|
## Best practices
|
||||||
|
|
||||||
- **Keep it focused:** Don't dump your entire internal wiki into `GEMINI.md`.
|
- **Keep it focused:** Avoid adding excessive content to `GEMINI.md`. Keep
|
||||||
Keep instructions actionable and relevant to code generation.
|
instructions actionable and relevant to code generation.
|
||||||
- **Use negative constraints:** Explicitly telling the agent what _not_ to do
|
- **Use negative constraints:** Explicitly telling the agent what _not_ to do
|
||||||
(e.g., "Do not use class components") is often more effective than vague
|
(for example, "Do not use class components") is often more effective than
|
||||||
positive instructions.
|
vague positive instructions.
|
||||||
- **Review often:** Periodically check your `GEMINI.md` files to remove outdated
|
- **Review often:** Periodically check your `GEMINI.md` files to remove outdated
|
||||||
rules.
|
rules.
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ automate complex workflows, and manage background processes safely.
|
|||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
- Gemini CLI installed and authenticated.
|
- Gemini CLI installed and authenticated.
|
||||||
- Basic familiarity with your system's shell (Bash, Zsh, PowerShell, etc.).
|
- Basic familiarity with your system's shell (Bash, Zsh, PowerShell, and so on).
|
||||||
|
|
||||||
## How to run commands directly (`!`)
|
## How to run commands directly (`!`)
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ You want to run tests and fix any failures.
|
|||||||
6. Gemini uses `replace` to fix the bug.
|
6. Gemini uses `replace` to fix the bug.
|
||||||
7. Gemini runs `npm test` again to verify the fix.
|
7. Gemini runs `npm test` again to verify the fix.
|
||||||
|
|
||||||
This loop turns Gemini into an autonomous engineer.
|
This loop allows Gemini to work autonomously.
|
||||||
|
|
||||||
## How to manage background processes
|
## How to manage background processes
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ confirmation prompts) by streaming the output to you. However, for highly
|
|||||||
interactive tools (like `vim` or `top`), it's often better to run them yourself
|
interactive tools (like `vim` or `top`), it's often better to run them yourself
|
||||||
in a separate terminal window or use the `!` prefix.
|
in a separate terminal window or use the `!` prefix.
|
||||||
|
|
||||||
## Safety first
|
## Safety features
|
||||||
|
|
||||||
Giving an AI access to your shell is powerful but risky. Gemini CLI includes
|
Giving an AI access to your shell is powerful but risky. Gemini CLI includes
|
||||||
several safety layers.
|
several safety layers.
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ Select the authentication method that matches your situation in the table below:
|
|||||||
|
|
||||||
If you run Gemini CLI on your local machine, the simplest authentication method
|
If you run Gemini CLI on your local machine, the simplest authentication method
|
||||||
is logging in with your Google account. This method requires a web browser on a
|
is logging in with your Google account. This method requires a web browser on a
|
||||||
machine that can communicate with the terminal running Gemini CLI (e.g., your
|
machine that can communicate with the terminal running Gemini CLI (for example,
|
||||||
local machine).
|
your local machine).
|
||||||
|
|
||||||
> **Important:** If you are a **Google AI Pro** or **Google AI Ultra**
|
> **Important:** If you are a **Google AI Pro** or **Google AI Ultra**
|
||||||
> subscriber, use the Google account associated with your subscription.
|
> subscriber, use the Google account associated with your subscription.
|
||||||
@@ -130,7 +130,7 @@ For example:
|
|||||||
**macOS/Linux**
|
**macOS/Linux**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Replace with your project ID and desired location (e.g., us-central1)
|
# Replace with your project ID and desired location (for example, us-central1)
|
||||||
export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"
|
export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"
|
||||||
export GOOGLE_CLOUD_LOCATION="YOUR_PROJECT_LOCATION"
|
export GOOGLE_CLOUD_LOCATION="YOUR_PROJECT_LOCATION"
|
||||||
```
|
```
|
||||||
@@ -138,7 +138,7 @@ export GOOGLE_CLOUD_LOCATION="YOUR_PROJECT_LOCATION"
|
|||||||
**Windows (PowerShell)**
|
**Windows (PowerShell)**
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
# Replace with your project ID and desired location (e.g., us-central1)
|
# Replace with your project ID and desired location (for example, us-central1)
|
||||||
$env:GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"
|
$env:GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"
|
||||||
$env:GOOGLE_CLOUD_LOCATION="YOUR_PROJECT_LOCATION"
|
$env:GOOGLE_CLOUD_LOCATION="YOUR_PROJECT_LOCATION"
|
||||||
```
|
```
|
||||||
@@ -325,14 +325,14 @@ persist them with the following methods:
|
|||||||
1. **Add your environment variables to your shell configuration file:** Append
|
1. **Add your environment variables to your shell configuration file:** Append
|
||||||
the environment variable commands to your shell's startup file.
|
the environment variable commands to your shell's startup file.
|
||||||
|
|
||||||
**macOS/Linux** (e.g., `~/.bashrc`, `~/.zshrc`, or `~/.profile`):
|
**macOS/Linux** (for example, `~/.bashrc`, `~/.zshrc`, or `~/.profile`):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
echo 'export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"' >> ~/.bashrc
|
echo 'export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"' >> ~/.bashrc
|
||||||
source ~/.bashrc
|
source ~/.bashrc
|
||||||
```
|
```
|
||||||
|
|
||||||
**Windows (PowerShell)** (e.g., `$PROFILE`):
|
**Windows (PowerShell)** (for example, `$PROFILE`):
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
Add-Content -Path $PROFILE -Value '$env:GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"'
|
Add-Content -Path $PROFILE -Value '$env:GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"'
|
||||||
@@ -346,8 +346,8 @@ persist them with the following methods:
|
|||||||
2. **Use a `.env` file:** Create a `.gemini/.env` file in your project
|
2. **Use a `.env` file:** Create a `.gemini/.env` file in your project
|
||||||
directory or home directory. Gemini CLI automatically loads variables from
|
directory or home directory. Gemini CLI automatically loads variables from
|
||||||
the first `.env` file it finds, searching up from the current directory,
|
the first `.env` file it finds, searching up from the current directory,
|
||||||
then in your home directory's `.gemini/.env` (e.g., `~/.gemini/.env` or
|
then in your home directory's `.gemini/.env` (for example, `~/.gemini/.env`
|
||||||
`%USERPROFILE%\.gemini\.env`).
|
or `%USERPROFILE%\.gemini\.env`).
|
||||||
|
|
||||||
Example for user-wide settings:
|
Example for user-wide settings:
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ Get started by upgrading Gemini CLI to the latest version:
|
|||||||
npm install -g @google/gemini-cli@latest
|
npm install -g @google/gemini-cli@latest
|
||||||
```
|
```
|
||||||
|
|
||||||
After you’ve confirmed your version is 0.21.1 or later:
|
If your version is 0.21.1 or later:
|
||||||
|
|
||||||
1. Run `/model`.
|
1. Run `/model`.
|
||||||
2. Select **Auto (Gemini 3)**.
|
2. Select **Auto (Gemini 3)**.
|
||||||
@@ -109,7 +109,7 @@ then:
|
|||||||
|
|
||||||
Restart Gemini CLI and you should have access to Gemini 3.
|
Restart Gemini CLI and you should have access to Gemini 3.
|
||||||
|
|
||||||
## Need help?
|
## Next steps
|
||||||
|
|
||||||
If you need help, we recommend searching for an existing
|
If you need help, we recommend searching for an existing
|
||||||
[GitHub issue](https://github.com/google-gemini/gemini-cli/issues). If you
|
[GitHub issue](https://github.com/google-gemini/gemini-cli/issues). If you
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ the default way that the CLI executes tools that might have side effects.
|
|||||||
to run the CLI.
|
to run the CLI.
|
||||||
```bash
|
```bash
|
||||||
# Run the published sandbox image
|
# Run the published sandbox image
|
||||||
docker run --rm -it us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.1.1
|
docker run --rm -it us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:latest
|
||||||
```
|
```
|
||||||
- **Using the `--sandbox` flag:** If you have Gemini CLI installed locally
|
- **Using the `--sandbox` flag:** If you have Gemini CLI installed locally
|
||||||
(using the standard installation described above), you can instruct it to run
|
(using the standard installation described above), you can instruct it to run
|
||||||
|
|||||||
Reference in New Issue
Block a user