gemini-cli/packages/cli
Bryan Morgan 28ff62e7b1
Added /mcp command support and cleaned up broken tests (#817)
2025-06-07 15:06:18 -04:00
..
src Added /mcp command support and cleaned up broken tests (#817) 2025-06-07 15:06:18 -04:00
README.md Update Gemini Code verbiage -> Gemini CLI 2025-05-14 22:07:03 -07:00
index.ts Exit with an error message if parsing settings.json fails. (#747) 2025-06-06 09:56:45 -07:00
package.json fixed strip-ansi dep by installing it in core package (also ran npm install in cli package that resulted in the minor changes here) (#727) 2025-06-03 13:37:59 -07:00
tsconfig.json feat(cli): add pro model availability check and fallback to flash (#608) 2025-06-02 13:55:54 -07:00
vitest.config.ts feat: Publish test coverage summaries to PRs (#513) 2025-05-27 12:45:28 -07:00

README.md

Gemini CLI

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

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 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.