refactor(core): use absolute paths in GEMINI.md context markers#23135
refactor(core): use absolute paths in GEMINI.md context markers#23135SandyTao520 merged 1 commit intomainfrom
Conversation
Replace relative path computation with absolute file paths in the --- Context from: ... --- markers emitted by concatenateInstructions. Remove the now-unused currentWorkingDirectoryForDisplay parameter from concatenateInstructions and workingDir from categorizeAndConcatenate.
|
Hi @SandyTao520, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this. We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines. Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed. Thank you for your understanding and for being a part of our community! |
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 context management system to ensure that file paths displayed in GEMINI.md context markers are always absolute. This change enhances the determinism and clarity of context markers, making them unambiguous regardless of the command-line interface's invocation location. By simplifying path resolution, the system becomes more robust and easier to debug, as context references will consistently point to their exact location. 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
|
|
Size Change: -387 B (0%) Total Size: 26.2 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
The pull request successfully refactors the GEMINI.md context markers to use absolute paths instead of relative ones. This change simplifies the logic in concatenateInstructions and categorizeAndConcatenate by removing the need to calculate relative paths based on the current working directory. All relevant test assertions have been updated to reflect the new absolute path format, ensuring the correctness of the change. The refactoring improves the determinism and clarity of context markers, as they are now unambiguous regardless of the CLI's invocation location.
Summary
Use absolute paths instead of relative paths in the
--- Context from: ... ---markers when formatting GEMINI.md context. This removes the dependency on the current working directory for display purposes and makes the context markers deterministic and unambiguous regardless of where the CLI is invoked from.Details
concatenateInstructions()now usesitem.filePathdirectly (already absolute) instead of computingpath.relative(cwd, filePath).currentWorkingDirectoryForDisplayparameter fromconcatenateInstructions.workingDirparameter fromcategorizeAndConcatenate.contextManager.tsandmemoryDiscovery.ts.Related Issues
Related to #20062
How to Validate
--- Context from:markers now show absolute paths (e.g.,/Users/you/.gemini/GEMINI.md) instead of relative ones.Pre-Merge Checklist