gemini-cli/packages/cli
DeWitt Clinton 068b505d5e
Reduce excessive diff separators in CLI. (#535)
Increases the threshold for rendering diff separators in the CLI's diff display. Previously, a separator was shown for gaps of more than one context line, leading to excessive separators in diffs with many small changes close together (Issue #534).

By increasing `MAX_CONTEXT_LINES_WITHOUT_GAP` to 5, we allow for more context lines before a separator is added, significantly reducing visual clutter in such diffs.

Added a test case to `DiffRenderer.test.tsx` to verify that separators are not rendered for small gaps within the new threshold.
2025-05-25 10:26:51 -07:00
..
src Reduce excessive diff separators in CLI. (#535) 2025-05-25 10:26:51 -07:00
Dockerfile.sandbox fix: set .npmrc in HOME dir before publishing (#206) 2025-04-28 18:16:42 -07:00
README.md Update Gemini Code verbiage -> Gemini CLI 2025-05-14 22:07:03 -07:00
index.ts feat: add alias to the cli bin directive (#126) 2025-04-23 01:04:34 +00:00
package.json Feat: Add test coverage scripts and ignore reports (#477) 2025-05-21 17:03:22 -07:00
tsconfig.json fix: use flat config for react eslint plugin (#265) 2025-05-06 08:48:26 -07:00
vitest.config.ts Fix an issue where types/react was a different version from our main … (#231) 2025-04-30 16:33:43 -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.