feat: add ignoreLocalEnv setting and --ignore-env flag (#2493)#26445
feat: add ignoreLocalEnv setting and --ignore-env flag (#2493)#26445cocosheng-g merged 3 commits intomainfrom
Conversation
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 enhances the Gemini CLI's environment configuration by providing mechanisms to isolate the tool from local project-specific .env files. By introducing a new setting and a corresponding command-line flag, users can prevent unintended environment variable conflicts while ensuring that necessary global or tool-specific configurations remain accessible. These changes improve the robustness and predictability of the CLI in diverse development environments. 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 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 counter productive. 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 the advanced.ignoreLocalEnv setting and a corresponding --ignore-env CLI flag, allowing users to bypass generic .env files in the project directory while still loading them from the home directory or the .gemini/ folder. The changes include updates to the settings schema, documentation, and the environment loading logic, along with a new test suite to verify isolation behavior. I have no feedback to provide.
|
Size Change: +493 B (0%) Total Size: 33.9 MB
ℹ️ View Unchanged
|
|
was this a duplicate of #24473 by chance? |
Summary
Adds
advanced.ignoreLocalEnvsetting and--ignore-envflag to isolate Gemini CLI from project-specific.envfiles. This prevents conflicts with local project environment variables (e.g.,GOOGLE_CLOUD_PROJECT,NODE_OPTIONS) while still allowing global~/.envand tool-specific.gemini/.envfiles.Details
--ignore-envto ensure isolation before full CLI initialization.findEnvFileto skip generic.envfiles when isolation is active, except for the home directory fallback.advanced.ignoreLocalEnvtosettingsSchema.ts.Related Issues
Fixes #2493
How to Validate
.envfile containingGEMINI_API_KEY=project_key.geminiwith--ignore-envor setadvanced.ignoreLocalEnv: truein global settings..gemini/.envin the same project is STILL loaded.npx vitest run packages/cli/src/config/settings-env-isolation.test.tsPre-Merge Checklist