- Introduced a 'validating' state for tool calls to prevent the input box from reappearing while waiting for a tool's `shouldConfirmExecute` method to complete. - When a tool call is initiated, it's now immediately set to a 'validating' status. This ensures the UI remains in a busy/responding state. - `useGeminiStream` now considers the 'validating' state as part of `StreamingState.Responding`. - `useToolScheduler` has been updated to: - Set the initial status of new tool calls to 'validating'. - Asynchronously perform the `shouldConfirmExecute` check. - Transition to 'awaiting_approval' or 'scheduled' based on the check's outcome. - This resolves an issue where a slow `shouldConfirmExecute` could lead to the input prompt becoming active again before the tool call lifecycle was fully determined. While 'validating' is currently treated similarly to 'executing' in the UI, this new state provides a foundation for more customized user experiences during this phase in the future. Fixes https://github.com/google-gemini/gemini-cli/issues/527 |
||
---|---|---|
.. | ||
src | ||
Dockerfile.sandbox | ||
README.md | ||
index.ts | ||
package.json | ||
tsconfig.json | ||
vitest.config.ts |
README.md
Gemini CLI
This package contains the core command-line interface for Gemini CLI.
Setup
- Get a Gemini API Key: Obtain your API key from Google AI Studio: https://aistudio.google.com/app/apikey
- Set Environment Variable: Set the
GEMINI_API_KEY
environment variable to your obtained key. You can do this temporarily in your current shell session:
Or add it to your shell's configuration file (likeexport GEMINI_API_KEY="YOUR_API_KEY"
~/.bashrc
,~/.zshrc
, or~/.profile
) for persistence:
Replaceecho 'export GEMINI_API_KEY="YOUR_API_KEY"' >> ~/.bashrc # Or your preferred shell config file source ~/.bashrc # Reload the config
"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:
- Start the CLI in debug mode from this directory (
packages/cli
):
This command runsnpm run debug
node --inspect-brk dist/gemini.js
, pausing execution until a debugger attaches. - 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
.