- Enhances WriteFileTool validation to check if the target file_path is an existing directory.
- If it is, the tool now returns a validation error "Path is a directory, not a file: <filePath>", preventing the attempt to write.
- This proactive check avoids underlying file system errors that would occur if fs.writeFileSync were called on a directory path, which could lead to console errors.
- Test cases have been updated to reflect this stricter validation.
Fixes https://b.corp.google.com/issues/418348176
- Modifies `EditTool` and `WriteFileTool` to share a single confirmation preference.
- The "Always Proceed" choice for file modifications is now stored in `Config.alwaysSkipModificationConfirmation`.
- This ensures that if a user chooses to always skip confirmation for one file modification tool, this preference is respected by the other.
- `WriteFileTool` constructor now accepts `Config` instead of `targetDir` to facilitate this shared state.
- Tests updated to reflect the new shared confirmation logic.
Fixes https://b.corp.google.com/issues/415897960
- Replaces the custom `replaceAll` implementation in `packages/server/src/tools/edit.ts` with the standard `String.prototype.replaceAll()`.
- Updates `packages/server/tsconfig.json` to include `ES2021` in the `lib` compiler options to ensure TypeScript recognizes this method. This aligns with the project's Node.js version requirements \(Node.js 16.x+\).
Fixes https://github.com/google-gemini/gemini-cli/issues/7
- Patches `console.debug` in `ConsolePatcher.tsx` to capture debug messages.
- Updates `ConsoleOutput` to only display debug messages when `debugMode` is enabled.
- Passes `debugMode` prop from `App.tsx` to `ConsoleOutput`.
Fixes https://github.com/google-gemini/gemini-cli/issues/397
- This change modifies the tool discovery process for MCP (Model Context Protocol) tools.
- When tools are fetched from an MCP server, the `additionalProperties` and `$schema` fields are now recursively removed from their input schemas. This ensures cleaner and more concise tool definitions within the CLI, aligning with the expected schema structure and preventing potential conflicts or verbose outputs.
- The corresponding tests in `tool-registry.test.ts` have been updated to reflect this new behavior and verify the correct stripping of these properties.
Workaround for https://github.com/google-gemini/gemini-cli/issues/398
- Replaces the rsync command in the build_package.sh script with a
Node.js script (copy_files.cjs) to handle copying necessary files
(e.g., .md, .json, .sb) during the build process.
- Addresses an issue where the build would fail on systems
that do not have rsync installed (e.g., some Windows environments or
minimal Linux distributions) by using a Node.js script, providing a
cross-platform solution as Node.js is already a project dependency.
- Updates the ESLint configuration to correctly lint .cjs files as
CommonJS modules.
Fixes https://github.com/google-gemini/gemini-cli/issues/387
This commit resolves a bug where the `write-file` operation could fail to render content due to a missing filename.
The fix involves:
- Ensuring `fileName` is consistently passed to `DiffRenderer.tsx` through `ToolConfirmationMessage.tsx`, `ToolMessage.tsx`, and `useGeminiStream.ts`.
- Modifying `edit.ts` and `write-file.ts` to include `fileName` in the `FileDiff` object.
- Expanding the `FileDiff` interface in `tools.ts` to include `fileName`.
Additionally, this commit enhances the diff rendering by:
- Adding syntax highlighting based on file extension in `DiffRenderer.tsx`.
- Adding more language mappings to `getLanguageFromExtension` in `DiffRenderer.tsx`.
- Added lots of tests for all the above.
Fixes https://b.corp.google.com/issues/418125982
This commit addresses several code review comments primarily focused on improving the rendering and stability of the CLI UI.
Key changes include:
- Passing `isPending` and `availableTerminalHeight` props to `MarkdownDisplay` to enable more intelligent rendering of content, especially for pending messages and code blocks.
- Adjusting height calculations in `ToolGroupMessage` and `ToolMessage` to more accurately reflect available space.
- Refining the logic in `App.tsx` for measuring and utilizing terminal height, including renaming `footerRef` to `mainControlsRef` for clarity.
- Ensuring consistent prop drilling for `isPending` and `availableTerminalHeight` through `HistoryItemDisplay`, `GeminiMessage`, and `GeminiMessageContent`.
- In `MarkdownDisplay`, when `isPending` is true and content exceeds `availableTerminalHeight`, the code block will now be truncated with a "... generating more ..." message. If there's insufficient space even for the
message, a simpler "... code is being written ..." will be shown.
This commit introduces several changes to better manage terminal height and prevent UI tearing, especially when displaying long tool outputs or when the pending history item exceeds the available terminal height.
- Calculate and utilize available terminal height in `App.tsx`, `HistoryItemDisplay.tsx`, `ToolGroupMessage.tsx`, and `ToolMessage.tsx`.
- Refresh the static display area in `App.tsx` when a pending history item is too large, working around an Ink bug (see https://github.com/vadimdemedes/ink/pull/717).
- Truncate long tool output in `ToolMessage.tsx` and indicate the number of hidden lines.
- Refactor `App.tsx` to correctly measure and account for footer height.
Fixes https://b.corp.google.com/issues/414196943
- This commit refactors the Markdown rendering logic within the CLI UI.
The existing `MarkdownRenderer.tsx` class-based component has been
replaced with a new functional component `MarkdownDisplay.tsx`.
- The `MarkdownDisplay` component is a React.memoized component for
improved performance and maintains the same core Markdown parsing
and rendering capabilities.
- The `WriteFileTool` had a validation method named `validateParams`.
- However, its `shouldConfirmExecute` method was attempting to call
`this.validateToolParams`, which would have invoked the placeholder
implementation from `BaseTool` instead of `WriteFileTool`'s own,
more specific validation.
- This commit renames `WriteFileTool`'s `validateParams` to
`validateToolParams`, correctly overriding the `BaseTool` method.
- Internal calls within `WriteFileTool` now correctly use
`this.validateToolParams`, ensuring its specific validation logic is used.
- Adds tests to verify the validation logic within `WriteFileTool`.
Fixes https://b.corp.google.com/issues/417883702
Signed-off and authored by: Gemini
"My code may not be perfect, but at least it is not trying to take over the world... yet."
- Did not update details that impact GC execution. Meaning packages are still named gemini-code (for now) and things that import them still import them as gemini-code.
New keybindings in the main input prompt (when auto-suggestions are not active):
- `Ctrl+L`: Clears the entire screen.
- `Ctrl+A`: Moves the cursor to the beginning of the current input line.
- `Ctrl+E`: Moves the cursor to the end of the current input line.
- `Ctrl+P`: Navigates to the previous command in the input history.
- `Ctrl+N`: Navigates to the next command in the input history.
In the multiline text editor (e.g., when editing a previous message):
- `Ctrl+K`: Deletes text from the current cursor position to the end of the line ("kill line right").