summaryrefslogtreecommitdiff
path: root/packages/cli/src/gemini.ts
AgeCommit message (Collapse)Author
2025-05-13fix: pass startup warnings to app as prop (#342)Brandon Keiji
2025-05-09feat: Improve theme not found handlingTaylor Mullen
Modify to return a boolean instead of throwing an error when a theme is not found. Update CLI startup and hook to handle the boolean return value for more graceful error handling.
2025-05-08Fix: Prevent CLI from crashing when a configured theme is not foundAmir Hardon
Previously, if a theme specified in the user's settings was not found, the CLI would crash during startup. This was particularly affecting users upgrading from older versions as the "ANSI colors only" theme was renamed to "ANSI". This commit adds error handling to catch the theme not found error during initial loading and when setting themes later. Instead of crashing, the application now logs a warning, displays an error message in the UI, and opens the theme selection dialog to allow the user to choose a valid theme.
2025-05-08refined sandbox/seatbelt log message, pass NODE_OPTIONS along to sandboxed ↵Olcan
node (#292)
2025-05-07Continue to work through 429/500s.Taylor Mullen
- The root of this issue was actually a genai SDK bug that was fixed here: https://critique.corp.google.com/cl/753255997 - Upgrade to latest genai SDK for latest bug fixes (including the above) - Removed specific 429 handling for uncaught rejections. Fixes https://b.corp.google.com/issues/413760164
2025-05-02sandbox setting and argument (#243)Olcan
2025-05-01Save settings to ~/.gemini/settings.json and optionally ↵Jacob Richman
/your/workspace/.gemini/settings.json (#237)
2025-05-01refactor: async-ify yargs (#236)Brandon Keiji
2025-04-29refactor: move sandbox js code to its own module (#225)Brandon Keiji
2025-04-29do not even check sandboxing commands (podman/docker/etc) if we are already ↵Olcan
in sandbox (#213)
2025-04-29allow command -v to fail (#212)Olcan
2025-04-29use exec instead of spawn for command -v to go through shell and let it ↵Olcan
interpret command as a shell built-in instead of looking for a command binary on system (note setting shell:true for spawn could also work) (#211)
2025-04-29SANDBOX_SET_UID_GID option for systems where this is necessary (should be ↵Olcan
only rootful docker on linux w/o userns-remap configured) (#210) * SANDBOX_SET_UID_GID option for systems where this is necessary (should be only rootful docker on linux w/o userns-remap configured) * Merge remote-tracking branch 'origin/main' into sandbox_uid_gid
2025-04-28enable servers in sandbox to listen on localhost (127.0.0.1) instead of ↵Olcan
0.0.0.0, ensuring servers can be container/host-agnostic (#207) * enable servers in sandbox to listen on localhost (127.0.0.1) instead of 0.0.0.0, ensuring servers can be container/host-agnostic * Merge remote-tracking branch 'origin/main' into sandbox_localhost_works
2025-04-28SANDBOX_PORTS env var (#204)Olcan
2025-04-28switch to shell tool, deprecating terminal (#203)Olcan
* switch to shell tool, deprecating terminal * Merge remote-tracking branch 'origin/main' into deprecate_terminal
2025-04-28env flags SANDBOX_{MOUNTS,ENV}, improved debugging through sandbox that ↵Olcan
should now work in all scenarios (#201) * env flags SANDBOX_{MOUNTS,ENV}, improved debugging through sandbox that should now work in all scenarios * Merge remote-tracking branch 'origin/main' into sandbox_flags_improved_debugging
2025-04-28ability to (re-)build sandbox outside GC repo root, useful for dev ↵Olcan
iterations (#196)
2025-04-28rename dev image with -dev suffix (#195)Olcan
2025-04-26hop into sandbox (#186)Olcan
2025-04-24better sandbox check (#150)Olcan
2025-04-24in sandboxed run scripts, allow .env to be an in any ancestor directory, ↵Olcan
same as in findEnvFile; also prep for sanboxing with global command (#147)
2025-04-23fix: use process.env.CLI_VERSION to avoid conflicts with NODE_ENV (#139)Brandon Keiji
2025-04-23feat: add CLI version number to footer (#134)Brandon Keiji
2025-04-22Question flag (#125)Allen Hutchison
2025-04-22Initiate the GeminiClient with a configJaana Dogan
Also address the open readability improvement comments from #104.
2025-04-21Piped input (#104)Allen Hutchison
* New method for handling stdin. Bypass Ink, and output to stdout. Makes the CLI work like a typical Unix application when called with piped input. * Fixing a few post-merge errors. * Format code. * Clean up lint and format errors.
2025-04-21Remove duplicate CLI tools module, remove the global tool registry (#89)Jaana Dogan
2025-04-21Remove redundant else branches (#86)Jaana Dogan
Else branches are an anti pattern especially if you can easily return from the previous branch. Over time, else branches cause deep nesting and make code unreadable and unmaintainable. Remove elses where possible.
2025-04-21Fix Gemini Code's (GC) smarts.Taylor Mullen
- The tl;dr; is that GC couldn't see what the user was saying when tool call events happened in response. The rason why this was happening was because we were instantly invoking tools that the model told us to invoke and then instantly re-requesting. This resulted in the bug because the genai APIs can't update the chat history before a full response has been completed (doesn't know how to update if it's incomplete). - To address the above issue I had to do quite the large refactor. The gist is that now turns truly drive everything on the server (vs. a server client split). This ensured that when we got tool invocations we could control when/how re-requesting would happen and then also ensure that history was updated. This change also meant that the server would act as an event publisher to enable the client to react to events rather than try and weave in complex logic between the events. - A BIG change that this changeset incudes is the removal of all of the CLI tools in favor of the server tools. - Removed some dead code as part of this - **NOTE: Confirmations are still broken (they were broken prior to this); however, I've set them up to be able to work in the future, I'll dot hat in a follow up to be less breaking to others.** Fixes https://b.corp.google.com/issues/412320087
2025-04-19Starting to modularize into separate cli / server packages. (#55)Evan Senter
* Starting to move a lot of code into packages/server * More of the massive refactor, builds and runs, some issues though. * Fixing outstanding issue with double messages. * Fixing a minor UI issue. * Fixing the build post-merge. * Running formatting. * Addressing comments.
2025-04-18Add apache2 SPDX headers to all source files (#48)Tyler
2025-04-18minor lint fix (#45)Olcan
2025-04-18Fix remaining tslint errors (YAY).Taylor Mullen
- Also updated ci.yml to ensure that linting failures will break the build. Fully fixes https://b.corp.google.com/issues/411384603
2025-04-18fix: add --build flag to tsc commands (#40)Brandon Keiji
2025-04-18fix: add clean command to individual packages (#36)Brandon Keiji
2025-04-18Manually fix hooks and utils linting errors (partial)Taylor Mullen
- More changes are to come, this is truly a partial change in order to not disrupt as many people as possible. Part of https://b.corp.google.com/issues/411384603
2025-04-18infra: add multipackage support (#34)Brandon Keiji
2025-04-18Web fetch tool (#31)Allen Hutchison
* Adding a web fetch tool.
2025-04-18Introduce a config module to manage configuration (#22)Jaana Dogan
* Introduce a config module to manage configuration * Remove public modifier
2025-04-18Adding a new parameter for model, and updating the default to 2.5 Flash. (#18)Evan Senter
2025-04-17Run `npm run format`Taylor Mullen
- Also updated README.md accordingly. Part of https://b.corp.google.com/issues/411384603
2025-04-17fix: Suppress crash from unhandled 429 stream error via global handlerAllen Hutchison
Introduces a process.on('unhandledRejection') handler in src/gemini.ts as a workaround for an issue where 429 ClientErrors originating from the @google/genai library's sendMessageStream during iteration can cause an unhandled rejection, even when caught within local try/catch blocks in the application code (e.g., in processGeminiStream). The handler specifically identifies this known 429 ClientError based on its type and message content. If matched, it logs a warning indicating the known issue is being suppressed and prevents process.exit(1). Any other genuinely unhandled promise rejections will still be logged as critical errors and will terminate the application, maintaining default behavior for unexpected issues. This workaround mitigates a suspected library-internal problem related to error propagation during asynchronous stream iteration.
2025-04-17Initial commit of Gemini Code CLITaylor Mullen
This commit introduces the initial codebase for the Gemini Code CLI, a command-line interface designed to facilitate interaction with the Gemini API for software engineering tasks. The code was migrated from a previous git repository as a single squashed commit. Core Features & Components: * **Gemini Integration:** Leverages the `@google/genai` SDK to interact with the Gemini models, supporting chat history, streaming responses, and function calling (tools). * **Terminal UI:** Built with Ink (React for CLIs) providing an interactive chat interface within the terminal, including input prompts, message display, loading indicators, and tool interaction elements. * **Tooling Framework:** Implements a robust tool system allowing Gemini to interact with the local environment. Includes tools for: * File system listing (`ls`) * File reading (`read-file`) * Content searching (`grep`) * File globbing (`glob`) * File editing (`edit`) * File writing (`write-file`) * Executing bash commands (`terminal`) * **State Management:** Handles the streaming state of Gemini responses and manages the conversation history. * **Configuration:** Parses command-line arguments (`yargs`) and loads environment variables (`dotenv`) for setup. * **Project Structure:** Organized into `core`, `ui`, `tools`, `config`, and `utils` directories using TypeScript. Includes basic build (`tsc`) and start scripts. This initial version establishes the foundation for a powerful CLI tool enabling developers to use Gemini for coding assistance directly in their terminal environment. --- Created by yours truly: __Gemini Code__