gemini-cli/packages/cli
Brandon Keiji 7ad6556623
feat: publish docker image alongside npm package (#197)
2025-04-28 13:25:19 -07:00
..
bin feat: prototype publish sandbox script with npm package (#182) 2025-04-25 17:30:50 -07:00
src env flags SANDBOX_{MOUNTS,ENV}, improved debugging through sandbox that should now work in all scenarios (#201) 2025-04-28 12:44:34 -07:00
.npmrc feat: publish docker image alongside npm package (#197) 2025-04-28 13:25:19 -07:00
Dockerfile.sandbox feat: publish docker image alongside npm package (#197) 2025-04-28 13:25:19 -07:00
README.md docs: Add setup instructions for API key to README (#1) 2025-04-17 11:59:12 -07:00
index.ts feat: add alias to the cli bin directive (#126) 2025-04-23 01:04:34 +00:00
package.json feat: publish docker image alongside npm package (#197) 2025-04-28 13:25:19 -07:00
tsconfig.json enable json imports (#165) 2025-04-24 18:30:19 -07:00

README.md

Gemini Code CLI

This package contains the core command-line interface for Gemini Code.

Setup

  1. Get a Gemini API Key: Obtain your API key from Google AI Studio: https://aistudio.google.com/app/apikey
  2. Set Environment Variable: Set the GEMINI_API_KEY environment variable to your obtained key. You can do this temporarily in your current shell session:
    export GEMINI_API_KEY="YOUR_API_KEY"
    
    Or add it to your shell's configuration file (like ~/.bashrc, ~/.zshrc, or ~/.profile) for persistence:
    echo 'export GEMINI_API_KEY="YOUR_API_KEY"' >> ~/.bashrc # Or your preferred shell config file
    source ~/.bashrc # Reload the config
    
    Replace "YOUR_API_KEY" with your actual key.

Building

To build only the CLI package, navigate to this directory (packages/cli) and run:

npm run build

This command executes the TypeScript compiler (tsc) as defined in this package's package.json. Ensure dependencies have been installed from the root directory (npm install) first.

Running

To start the Gemini Code CLI directly from this directory:

npm start

This command executes node dist/gemini.js as defined in this package's package.json.

Debugging

To debug the CLI application using VS Code:

  1. Start the CLI in debug mode from this directory (packages/cli):
    npm run debug
    
    This command runs node --inspect-brk dist/gemini.js, pausing execution until a debugger attaches.
  2. In VS Code (opened at the root of the monorepo), use the "Attach" launch configuration (found in .vscode/launch.json). This configuration is set up to attach to the Node.js process listening on port 9229, which is the default port used by --inspect-brk.