summaryrefslogtreecommitdiff
path: root/packages/server/src
AgeCommit message (Collapse)Author
2025-05-25Fix(diff): Hide whitespace changes in diffs with content changesTaylor Mullen
- Updated the diff generation in `edit.ts` and `write-file.ts` to include the `ignoreWhitespace: true` option. - This ensures that whitespace-only changes are not highlighted in the diff output when there are other content modifications, making the diffs cleaner and easier to review. - Extract default diffing options into single source of truth. Fixes https://github.com/google-gemini/gemini-cli/issues/548
2025-05-25Fix(test): Improve write-file and editCorrector test suitesTaylor Mullen
- Enhanced by: - Mocking and utilities (, ) to allow for more focused unit testing of . - Adding comprehensive tests for the private method, covering new and existing file scenarios, as well as error handling. - Expanding tests for and to verify behavior with the new content correction logic, including diff generation and directory creation. - Refined by: - Introducing robust mocking for and its methods (, , ) to simulate LLM interactions accurately. - Adding extensive test scenarios for , categorized by how matches and how is processed, including direct matches, unescaping, and LLM-based corrections. - Including tests for edge cases like no matches or multiple matches. - Adding a utility for better test isolation. Final fix for https://github.com/google-gemini/gemini-cli/issues/484
2025-05-25Fix(write-file): Correct over-escaping and improve content generationTaylor Mullen
- Leveraged existing edit correction technology from `edit.ts` to address over-escaping issues in `write-file.ts`. - Introduced `ensureCorrectFileContent` for correcting content in new files, where a simple "replace" isnt applicable. This uses a new LLM prompt tailored for correcting potentially problematic string escaping. - Added caching for `ensureCorrectFileContent` to optimize performance. - Refactored `write-file.ts` to integrate these corrections, improving the reliability of file content generation and modification. Part of https://github.com/google-gemini/gemini-cli/issues/484
2025-05-25Ensure edit correction isn't re-done after confirm.Taylor Mullen
- Edit corretion leans on LLM-isms to ensure we properly fix poorly escaped content. Beacues of this we need to ensure that we don't re-run edit correction in many cases. - To ensure this an `LruCache` has been added to capture intermediate steps of edit correction to avoid re-computations. - Max cache size is 50 currently. This means a user can have a muti-confirmation flow of 25 items without recomputing anything (assuming they all break edit correction). - Laid some groundwork for future testing. Part of https://github.com/google-gemini/gemini-cli/issues/484
2025-05-25Correct edits even when auto-accept is enabled.Taylor Mullen
- Prior to this when a user would turn on auto-accept for edits we'd stop ensuring correct edits. This would result in a lot of back and forth by the model. This change also incoporates ensure correct edit into the normal execution flow. - Added edit tests for this. Part of https://github.com/google-gemini/gemini-cli/issues/484
2025-05-25Trim edits if possible.Taylor Mullen
- Since we're now LLM correcting a lot of problematic edits we need to also potentially trim bad edits (llms have a bad habbit of adding whitespace places). Part of https://github.com/google-gemini/gemini-cli/issues/484
2025-05-25Upon finding > 1 occurrences do not attempt auto-correction.Taylor Mullen
- When correcting edits prior to this if we found more than one occurrence we would try to auto-correct the old/new strings. There's no need in this situation because the tool has already provided too vague of an old_string to act upon. Instantly return. Part of https://github.com/google-gemini/gemini-cli/issues/484
2025-05-25refactor: Decouple new_string correction from old_stringTaylor Mullen
- Previously, `new_string` was assumed to be over-escaped if `old_string` was. - This change introduces an explicit check (`newStringPotentiallyEscaped`) to determine if `new_string` itself needs correction. - If `new_string` is potentially escaped, its corrected using an LLM call; otherwise, the original `new_string` is used. - This avoids unnecessary corrections to `new_string` when only `old_string` was problematic. Part of https://github.com/google-gemini/gemini-cli/issues/484
2025-05-25refactor: Correct Gemini's over-escaped new_string in replace toolTaylor Mullen
- Implement a heuristic to detect and unescape `new_string` if it appears Gemini has over-escaped it, while `old_string` is correctly formatted. - This improves the reliability of the replace tool when the model generates an incorrectly escaped replacement string. Part of https://github.com/google-gemini/gemini-cli/issues/484
2025-05-25refactor: Improve editCorrector logic and type safetyTaylor Mullen
- Refactor `ensureCorrectEdit` to clarify the correction flow for `old_string` and `new_string`. - Only correct `new_string` if it was potentially escaped; otherwise, use the original. - Introduce `CorrectedEditParams` and `CorrectedEditResult` interfaces for better type definition. - Relocate `countOccurrences` for better logical grouping. Part of https://github.com/google-gemini/gemini-cli/issues/484
2025-05-23infra: emit errors on no-explicit-any eslint rule (#516)Brandon Keiji
2025-05-23fix: Update dependencies to resolve deprecation warningsTaylor Mullen
2025-05-23MCP SSE support (#511)cornmander
Matches the config format used by other MCP clients.
2025-05-23fix: do not retry cancelled tool calls (#504)Brandon Keiji
2025-05-23Mention Kotlin & Compose (Mutliplatform) in prompt.tsJordan Demeulenaere
2025-05-23Refactor(server): Centralize GEMINI.md discovery logic in server (#498)Allen Hutchison
2025-05-22Fix(server): Ensure debug responses are not recorded after cancellation (#491)Allen Hutchison
2025-05-22Refactor: Consolidate and clarify core mandates and guidelines (#482)N. Taylor Mullen
Co-authored-by: Allen Hutchison <[email protected]>
2025-05-22Fix: Prevent hang in large directories by using BFS for getFolderStru… (#470)Allen Hutchison
Co-authored-by: N. Taylor Mullen <[email protected]>
2025-05-22fix: synchronization between executed tools and turn loops (#488)Brandon Keiji
2025-05-21feat: Update feedback mechanism to use /bug commandTaylor Mullen
- Replaces the previous email-based feedback with a /bug command in the system prompt.
2025-05-22fix: forward entire tool call confirmation object through useToolScheduler ↵Brandon Keiji
(#481)
2025-05-21feat: useToolScheduler hook to manage parallel tool calls (#448)Brandon Keiji
2025-05-21Remove unneeded linebreaks in tool description in read-many-files. (#476)Jacob Richman
2025-05-21Fix: Align WebSearchTool API key handling with GeminiClient (#474)Allen Hutchison
2025-05-21switch to spawn for shell mode (#467)Olcan
2025-05-21fix exit code for shell tool (#465)Olcan
2025-05-21Add Logger for command history (#435)Seth Troisi
2025-05-20Update docs and tool description for read-many-files. (#456)Jacob Richman
2025-05-20Support Images and PDFs (#447)Jacob Richman
2025-05-20Implementation of web search as a tool (#307)Allen Hutchison
2025-05-19ui tweaks (#442)Olcan
2025-05-19fix SIGPIPE and race condition causing dropping of final output ( "command ↵Olcan
not found" error) on cloudtops (#429)
2025-05-19indicate system prompt override on bottom right; require GEMINI_SYSTEM_MD to ↵Olcan
make it more explicit; allow custom paths for read/write (#427)
2025-05-19trim system prompt (#426)Olcan
2025-05-18fix(server): Use console.debug in GrepTool for less verbose loggingTaylor Mullen
- Replaces `console.warn` and `console.error` calls with `console.debug` in `packages/server/src/tools/grep.ts`. This change reduces noise for the user, as `warn` and `error` messages are displayed directly, while `debug` messages are not. - Adds a comprehensive test suite for the GrepTool (`packages/server/src/tools/grep.test.ts`) to ensure its functionality remains robust after these changes and to cover various usage scenarios. - Improves error message consistency in `GrepTool`'s parameter validation and execution. Fixes https://b.corp.google.com/issues/418648813
2025-05-18fix(shell): Improve error reporting for shell command failuresTaylor Mullen
This commit enhances the tool to provide more informative feedback to the user when a shell command fails, especially in non-debug mode. Previously, if a command terminated due to a signal (e.g., SIGPIPE during a with no upstream) or failed without producing stdout/stderr, the user would see no output, making it difficult to diagnose the issue. Changes: - Modified to update the logic. - If a command produces no direct output but results in an error, signal, non-zero exit code, or user cancellation, a concise message indicating this outcome is now shown in . - Utilized the existing utility from for consistent error message formatting, which also resolved previous TypeScript type inference issues. This ensures users receive clearer feedback on command execution status, improving the tool's usability and aiding in troubleshooting. Fixes https://b.corp.google.com/issues/417998119
2025-05-18fix(glob): Improve glob tool accuracy and outputTaylor Mullen
This commit enhances the glob tool by: - Ensuring that glob patterns are used effectively. Previously, simple file names without glob syntax (e.g., "file.ts") would only search the root directory. This change encourages more precise glob patterns (e.g., "**\/file.ts") for broader searches. - Returning absolute file paths instead of relative paths. This provides clearer, less ambiguous output and avoids encouraging the use of relative paths in subsequent operations. - Adding comprehensive tests for various globbing scenarios, including case sensitivity and path specifications. These changes address an issue where the glob tool could not find an expected item when a specific path was provided without appropriate glob syntax, and improve the overall reliability and usability of the tool. Fixes https://b.corp.google.com/issues/418486553
2025-05-17refactor: Remove console.error from WriteFileToolTaylor Mullen
- Removes an unnecessary `console.error` call from the `shouldConfirmExecute` method in the `WriteFileTool` class. - This logging was redundant as validation errors are already handled and returned by the method. - Additionally, `console.error` is not suitable for this scenario, as incorrect arguments can be provided by the LLM, and these are anticipated and managed without needing an error log. Fixes https://b.corp.google.com/issues/418491206
2025-05-17ability to write system prompt to file (#414)Olcan
2025-05-17ability to override core system prompt (via .gemini/system.md) and specify ↵Olcan
core tools via coreTools setting (e.g. coreTools:["ls", "GrepTool", ...]) ; added tests, but did not update docs for now (#413)
2025-05-17added timeout setting to mcp server config, also switched to custom config ↵Olcan
type without "stderr" field that does not make sense in settings (#410)
2025-05-17fix multiple mcp serversolcan
2025-05-17fix: Prevent WriteFileTool from writing to directory pathsTaylor Mullen
- 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
2025-05-16refactor: Unify file modification confirmation stateTaylor Mullen
- 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
2025-05-16Refactor: Use String.prototype.replaceAll() and update TS libTaylor Mullen
- 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
2025-05-16feat: Strip schema props from MCP tool definitionsTaylor Mullen
- 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
2025-05-16Avoid console.log for MCPTaylor Mullen
- Prior to this when attached MCP servers would report content we'd fall back to `console.log` which doesn't work well in an Ink application. Fixes https://github.com/google-gemini/gemini-cli/issues/397
2025-05-16GC "add tool registry tests"Taylor Mullen
- Ok
2025-05-16feat: Implement CLI and model memory management (#371)Allen Hutchison
Co-authored-by: N. Taylor Mullen <[email protected]>