* First integration of at commands into useGeminiStream.ts * feat: Integrate @ command for file/directory reading - Adds support for `@<path>` commands in the CLI UI to read file or directory contents using the `read_many_files` tool. - Refactors `useGeminiStream` hook to handle slash, passthrough, and @ commands before sending queries to the Gemini API. - Improves history item ID generation to prevent React duplicate key warnings. * fix: Handle additional text after @ command path - Modifies the `@` command processor to parse text following the file/directory path (e.g., `@README.md explain this`). - Includes both the fetched file content and the subsequent text in the query sent to the Gemini API. - Resolves the TODO item in `atCommandProcessor.ts`. * feat: Allow @ command anywhere in query and fix build - Update `atCommandProcessor` to correctly parse `@<path>` commands regardless of their position in the input string using regex. This enables queries like "Explain @README.md to me". - Fix build error in `useGeminiStream` by importing the missing `findSafeSplitPoint` function. * rename isPotentiallyAtCommand to isAtCommand * respond to review comments. |
||
---|---|---|
.. | ||
src | ||
Dockerfile.sandbox | ||
README.md | ||
index.ts | ||
package.json | ||
tsconfig.json |
README.md
Gemini Code CLI
This package contains the core command-line interface for Gemini Code.
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 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:
- 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
.