This commit modifies the packaging setup to allow the CLI to be
executed directly from its GitHub URL using `npx`, for example:
`npx https://github.com/google-gemini/gemini-cli` (once merged to main).
This is achieved without requiring the bundle to be checked into
the repository.
Key changes and motivations:
- Modify `scripts.prepare` to run `npm run bundle`:
Ensures the CLI bundle is generated automatically when `npx`
installs the package from a git URL. This replaces previous
approaches (e.g., using `prepack`) which were not consistently
triggered in the `npx` environment.
- Update `scripts.bundle` to use a direct path for `esbuild`
and externalize `sqlite3`:
Using `node_modules/.bin/esbuild` provides a more reliable way
to invoke the bundler. Externalizing `sqlite3` is crucial for
correctly handling its native addon, preventing runtime errors.
- Add `bin`, `files`, and root `sqlite3` dependency:
- The `bin` field defines the `gemini` command.
- The `files` array ensures the generated `bundle/` directory is
recognized by npm.
- `sqlite3` is added as a root dependency to ensure it's
installed by `npx` when `gemini-code` is fetched, allowing the
externalized module to be resolved.
These changes collectively ensure that the necessary build artifacts
are created on-the-fly during `npx` installation, providing a
seamless execution experience directly from the GitHub repository URL.
- The streaming state logic in `useGeminiStream.ts` has been updated.
- Previously, the loading indicator was displayed even when the system was
waiting for user confirmation on a tool call.
- This change introduces a `WaitingForConfirmation` state to ensure the
loading indicator is hidden during these confirmation prompts, improving
the user experience.
Implements recursive glob-based file search for both suggestions and execution of the `@` command.
- When typing `@filename`, suggestions will now include files matching `filename` in nested directories.
- Suggestions are sorted by path depth (shallowest first), then directories before files, then alphabetically.
- The maximum recursion depth for suggestions is set to 10.
- When executing an `@filename` command, if the file is not found directly, a recursive search (using the glob tool) is performed to locate the file.
This addresses the first request in issue #461 by allowing users to quickly reference deeply nested files without typing the full path. Also addresses b/416292478.
- Ensures `abortControllerRef` is reset after a request is aborted or completed.
- Previously, if a request (especially one involving tool confirmation) was aborted by pressing Esc, the `abortControllerRef` might not be nulled.
- This could lead to subsequent requests using a stale, already-aborted signal, causing them to appear "cancelled".
- The fix unconditionally sets `abortControllerRef.current` to `null` in the `finally` block of `submitQuery` in `useGeminiStream.ts`.
- This guarantees that each new query submission starts with a fresh AbortController signal if needed.
- Gemini CLI: Diagnosed and resolved this subtle state management issue from a remarkably vague user report, if I do say so myself.
Fixes https://buganizer.corp.google.com/issues/418496499
- The text buffer now correctly interprets `\\\r` (produced by Shift+Enter in the VSCode terminal) as a newline character.
- Added a corresponding test case to `text-buffer.test.ts`.
Fixes https://buganizer.corp.google.com/issues/418505364
- Adds a visual indicator for skipped lines in the diff view.
- Updates tests to verify gap indicator rendering.
- Adjusts line number padding for better alignment.
Fixes https://b.corp.google.com/issues/414453107