Skip to content

gemini Gemini CLI

Google Gemini CLI is used as an AI agent that can be used directly in a terminal.

I use the Gemini CLI to help generate bash script files and markdown documents for mkdocs-material.

🛠 Installation

Config path: ~/.gemini/

npx https://github.com/google-gemini/gemini-cli
sudo npm install -g @google/gemini-cli
gemini

⚙ Config

  1. Generate a key from Google AI Studio.
  2. Set it as an environment variable in your terminal. Replace YOUR_API_KEY with your generated key.
export GEMINI_API_KEY="YOUR_API_KEY"
export GEMINI_API_KEY="YOUR_API_KEY"

✍ Syntax Files

Syntax files are used to customize the iutput from Gemini.

docs/GEMINI.md
# New Docker Application Guidelines for Gemini

**Context:** This directory contains all Docker applications.
- The `.template` folder is to be used as a template folder for new applications.

## Creating a New Docker Application

To create a new Docker application, follow these steps:

1. **Copy the template:** Copy the `.template` directory to a new directory named after your application (e.g., `my-docker-app/`).

2. **Update the files:** The following files need to be updated with the new application's information:

    - `.env.tmpl.j2`: This file contains environment variables.
      - `CONTAINER_NAME`: Set this to the desired name for the Docker container.
      - Read environmental variables from `compose.yaml` and add them to `.env.tmpl`.
      - The the following default values if the variables exist in `compose.yaml`.
        - `PG_DATABASE=postgress`
        - `PG_USER=postgress`
        - `POSTGRESS_USER=postgress`
        - `PG_PASSWORD=postgress`
        - `POSTGRESS_PASSWORD=postgress`
    -   `compose.yaml.j2`: This is the Docker Compose file.
      - Update the service name from `{{ APP_NAME | lower }}` to your application's name.
      - Update the image name `ghcr.io/{{ USER_NAME }}/{{ APP_NAME | lower }}:1.0.0` with the correct user and image name and the correct application version.
    - `README.md.j2`: This is the documentation for the application.
      - Update the `APP_NAME` to the new application's name.
    - `Taskfile.yml`: This file contains tasks for managing the application.
      - Update `{{ .CONTAINER_NAME }}` to the container name you set in the `.env.tmpl.j2` file.

3.  **Finalize:** Once you have updated these files, you can remove the `.j2` extension from the templated files.

📝 Usage

Once installed and authenticated, start interacting with Gemini from the shell.

Example

git clone https://github.com/google-gemini/gemini-cli
cd gemini-cli
gemini
> Give me a summary of all of the changes that went in yesterday

Start a chat

gemini

Pipe content to the CLI from stdin

echo "Explain the content of this file docs/README.md" | gemini -p

🔗 References