Commit Graph

128 Commits

Author SHA1 Message Date
Brandon Keiji 4e3ba687a6
fix: forward entire tool call confirmation object through useToolScheduler (#481) 2025-05-22 06:00:36 +00:00
Brandon Keiji 02eec5c8ca
feat: useToolScheduler hook to manage parallel tool calls (#448) 2025-05-21 22:57:53 -07:00
Allen Hutchison efee7c6cce
Feat: Add test coverage scripts and ignore reports (#477) 2025-05-21 17:03:22 -07:00
Jacob Richman d74b0ac81d
Remove unneeded linebreaks in tool description in read-many-files. (#476) 2025-05-21 16:59:23 -07:00
Allen Hutchison 43da8bc747
Fix: Align WebSearchTool API key handling with GeminiClient (#474) 2025-05-21 15:50:53 -07:00
Olcan 2ad666a484
switch to spawn for shell mode (#467) 2025-05-21 09:31:13 -07:00
Olcan c9de822930
fix exit code for shell tool (#465) 2025-05-21 08:51:22 -07:00
Seth Troisi cd13c5881b
Add Logger for command history (#435) 2025-05-21 00:36:22 -07:00
Jacob Richman 937f473651
Update docs and tool description for read-many-files. (#456) 2025-05-20 16:32:49 -07:00
Jacob Richman 716f7875a2
Support Images and PDFs (#447) 2025-05-20 13:02:41 -07:00
Allen Hutchison 93e89215e3
Implementation of web search as a tool (#307) 2025-05-20 11:36:21 -07:00
Olcan 9c72a3ae12
ui tweaks (#442) 2025-05-19 16:58:57 -07:00
Olcan e1e59bf0cd
fix SIGPIPE and race condition causing dropping of final output ( "command not found" error) on cloudtops (#429) 2025-05-19 13:16:11 -07:00
Olcan 750649eb64
indicate system prompt override on bottom right; require GEMINI_SYSTEM_MD to make it more explicit; allow custom paths for read/write (#427) 2025-05-19 11:03:04 -07:00
Olcan 2a3c3d00ea
trim system prompt (#426) 2025-05-19 09:39:05 -07:00
Taylor Mullen 3d74a7061e fix(server): Use console.debug in GrepTool for less verbose logging
- 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-18 23:19:15 -07:00
Taylor Mullen 3aaeb44739 fix(shell): Improve error reporting for shell command failures
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-18 00:25:53 -07:00
Taylor Mullen a0eb8e67c7 fix(glob): Improve glob tool accuracy and output
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-18 00:10:56 -07:00
Taylor Mullen f0b9199a77 refactor: Remove console.error from WriteFileTool
- 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-17 23:06:50 -07:00
Olcan 9749fcb425
ability to write system prompt to file (#414) 2025-05-17 20:14:06 -07:00
Olcan 3bf0304e31
ability to override core system prompt (via .gemini/system.md) and specify core tools via coreTools setting (e.g. coreTools:["ls", "GrepTool", ...]) ; added tests, but did not update docs for now (#413) 2025-05-17 19:45:16 -07:00
Olcan 4de4822219
added timeout setting to mcp server config, also switched to custom config type without "stderr" field that does not make sense in settings (#410) 2025-05-17 16:53:22 -07:00
olcan 324040032a fix multiple mcp servers 2025-05-17 14:14:59 -07:00
Taylor Mullen feb9dee4b1 fix: Prevent WriteFileTool from writing to directory paths
- 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-17 00:01:35 -07:00
Taylor Mullen 5dcdbe64ab refactor: Unify file modification confirmation state
- 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-16 23:34:48 -07:00
Taylor Mullen 58e0224061 Refactor: Use String.prototype.replaceAll() and update TS lib
- 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-16 22:43:50 -07:00
Taylor Mullen e0b88dc8da feat: Strip schema props from MCP tool definitions
- 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-16 22:14:51 -07:00
Taylor Mullen 0e25fdd56e Avoid console.log for MCP
- 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-16 21:19:33 -07:00
Taylor Mullen 7f7f2cd47e GC "add tool registry tests"
- Ok
2025-05-16 17:04:29 -07:00
Allen Hutchison 1bdec55fe1
feat: Implement CLI and model memory management (#371)
Co-authored-by: N. Taylor Mullen <ntaylormullen@google.com>
2025-05-16 16:36:50 -07:00
Olcan d9bd2b0e14
improved mcp support, including standard "mcpServers" setting with multiple named servers with command/args/env/cwd (#392) 2025-05-16 16:29:03 -07:00
Sébastien Cevey 48c3470303
Fix typo in server README.md (#379) 2025-05-16 14:27:25 -07:00
Taylor Mullen 968e09f0b5 fix: Ensure filename is available for diff rendering in write-file
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
2025-05-16 10:13:13 -07:00
sasha-gitg 609757f911
feat: Add support for Vertex AI and Vertex express mode (#380) 2025-05-16 08:06:43 -07:00
N. Taylor Mullen 7d818b46bc
feat: Enable CI test reporting and artifact management (#367) 2025-05-15 22:59:53 -07:00
Taylor Mullen 62455ade9d Fix(write-file): Ensure correct validation method is called in WriteFileTool
- 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."
2025-05-15 15:30:06 -07:00
Taylor Mullen 5b4c9e8e43 Update Gemini Code verbiage -> Gemini CLI
- 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.
2025-05-14 22:07:03 -07:00
Seth Troisi 8ca2390fbf Improve read-many-files display message 2025-05-14 23:56:49 +00:00
Allen Hutchison 89aa1cad41
Add UI memory indicator. (#348)
Co-authored-by: Gregory Shikhman <shikhman@google.com>
2025-05-14 15:19:45 -07:00
Brandon Keiji 521708e294
refactor: break submitQuery into smaller functions (#350) 2025-05-14 15:14:15 -07:00
Allen Hutchison 1245fe4885
This commit introduces the hierarchical memory feature, allowing GEMI… (#327) 2025-05-14 12:37:17 -07:00
Olcan 4a0f5476c0
fall back to ~/.env if .env is not found in current directory or any ancestors (#338) 2025-05-13 15:36:34 -07:00
Olcan 0ae59056d1
mention `git diff --staged` for partial commits (#336) 2025-05-13 14:06:14 -07:00
Olcan 17cce0adf4
use git diff HEAD instead of git diff && git diff --staged (#333) 2025-05-13 12:56:32 -07:00
Taylor Mullen 7d8392bab4 Encourage utilization of `git diff --staged` for commit message writing.
- This enables GC to base commit message changes on actual file content.
2025-05-12 23:51:37 -07:00
Taylor Mullen 3217576743 feat: Enhance `replace` tool reliability with multi-stage edit correction
This commit significantly improves the `replace` tool's robustness by introducing a multi-stage correction mechanism. This directly addresses challenges with LLM-generated tool inputs, particularly the over-escaping of strings sometimes observed with Gemini models, and other minor discrepancies that previously led to failed edits.

The correction process is as follows:
1.  **Targeted Unescaping:** The system first applies a specialized unescaping function to the `old_string` and `new_string` to counteract common LLM-induced escaping patterns.
2.  **LLM-Powered Discrepancy Resolution:** If a unique match for the `old_string` is still not found, the system leverages a Gemini model (`gemini-2.5-flash-preview-04-17`) to:
    *   Identify the most probable intended `old_string` in the file by intelligently correcting minor formatting or escaping differences.
    *   Adjust the `new_string` to correspond with any corrections made to the `old_string`, maintaining the original edit's intent.

This enhancement makes the `replace` tool more resilient and effective, leading to a higher success rate for automated code modifications. The `expected_replacements` parameter has been removed as the tool now focuses on finding a single, unique, and correctable match. The tool's description and error reporting have been updated to reflect these new capabilities.

Fixes https://b.corp.google.com/issues/416933027
2025-05-12 23:33:12 -07:00
Olcan 5ec254253f
ensure no 'undefined' in system prompt (#322) 2025-05-12 16:41:11 -07:00
Olcan 884d6ebfd8
system prompt for working with git (#321) 2025-05-12 16:27:07 -07:00
Taylor Mullen df74594b8f When an error occurs stop processing. 2025-05-12 00:06:20 -07:00
Taylor Mullen 8537aabba4 feat: Add User-Agent to API requests
This change introduces a User-Agent header to all API requests made by the Gemini CLI.

The User-Agent string includes the CLI version, Node.js version, operating system, and architecture. This will help in tracking usage and identifying potential issues.

Fixes https://b.corp.google.com/issues/416353675

Signed-off-by: Gemini
2025-05-11 14:33:58 -07:00