fix(cli): read bootstrap settings from custom home#27425
fix(cli): read bootstrap settings from custom home#27425officialasishkumar wants to merge 1 commit into
Conversation
The lightweight parent process reads advanced.autoConfigureMemory before the full settings loader is available. It previously treated GEMINI_CLI_HOME as the .gemini directory itself, so settings at the normal custom-home path were ignored. Add a small bootstrap settings-path helper that mirrors Storage.getGlobalSettingsPath without importing core, and cover the default-home and custom-home cases. Fixes google-gemini#27421
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the CLI bootstrap process to ensure consistent resolution of global user settings. By extracting the path resolution logic into a dedicated utility, the CLI now correctly handles custom home directory configurations, preventing settings from being ignored during initial memory configuration. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new utility function getBootstrapSettingsPath in packages/cli/src/utils/bootstrapSettings.ts to centralize the resolution of the global settings path. It refactors packages/cli/index.ts to use this utility, ensuring consistent path resolution for the bootstrap process. Additionally, a corresponding test file packages/cli/src/utils/bootstrapSettings.test.ts has been added to verify the logic under different environment configurations. I have no feedback to provide.
Summary
Fix the lightweight CLI bootstrap so it reads global user settings from the same path as the normal storage layer when
GEMINI_CLI_HOMEis set.Details
The bootstrap process reads
advanced.autoConfigureMemorybefore loading the full settings system. It previously treatedGEMINI_CLI_HOMEas the.geminidirectory itself, so$GEMINI_CLI_HOME/.gemini/settings.jsonwas ignored during initial memory configuration.This adds a small bootstrap settings-path helper that mirrors
Storage.getGlobalSettingsPath()without importing core, then uses it frompackages/cli/index.ts. The new unit test covers both the default home path and the customGEMINI_CLI_HOMEpath.Related Issues
Fixes #27421
How to Validate
./node_modules/.bin/prettier --check packages/cli/index.ts packages/cli/src/utils/bootstrapSettings.ts packages/cli/src/utils/bootstrapSettings.test.ts./node_modules/.bin/eslint packages/cli/index.ts packages/cli/src/utils/bootstrapSettings.ts packages/cli/src/utils/bootstrapSettings.test.ts --max-warnings 0timeout 180s ./node_modules/.bin/tsc -p packages/cli/tsconfig.json --noEmit --pretty falsepackages/cli:timeout 180s ../../node_modules/.bin/vitest run src/utils/bootstrapSettings.test.ts --coverage.enabled=false --pool=threadsgetBootstrapSettingsPath()resolvesGEMINI_CLI_HOME=/tmp/custom-gemini-hometo/tmp/custom-gemini-home/.gemini/settings.json.Pre-Merge Checklist