feat: Enhance CLI usability and update documentation
Summary This pull request introduces a series of enhancements to the Gemini CLI, focusing on improving user experience, code quality, and documentation. These changes include a bug fix for more precise error handling, a refactor to remove redundant code, and a documentation update for better clarity.
Key Changes
- Bug Fix: More Specific Error Handling in install.ts Previously, when a user provided both --source and --path as arguments to the install command, the CLI would throw a generic error. This has been updated to provide a more specific and helpful message, improving the overall user experience.
Before:
if (argv.source && argv.path) {
throw new Error('Arguments source and path are mutually exclusive');
}
After:
if (argv.source && argv.path) {
throw new Error(
'Arguments --source and --path are mutually exclusive. Please provide only one.',
);
}
The corresponding test in install.test.ts has been updated to assert the new error message, ensuring our test suite remains accurate.
- Refactor: Remove Redundant Command Check in shell.ts The isCommandAllowed function was being called in both validateToolParamValues and the execute method of the ShellToolInvocation class. This redundant check has been removed from the execute method to make the code cleaner and more efficient.
Before:
async execute(
signal: AbortSignal,
updateOutput?: (output: string) => void,
terminalColumns?: number,
terminalRows?: number,
): Promise<ToolResult> {
const commandCheck = isCommandAllowed(this.params.command, this.config);
if (!commandCheck.allowed) {
// ...
}
// ...
}
After:
The redundant check has been completely removed from the execute method, and the logic now relies on the validation performed in validateToolParamValues.
- Documentation: Clarify Purpose of tempFilePath in shell.ts A comment has been added to shell.ts to explain the purpose of the tempFilePath variable. This small but important change will help future contributors understand the code more easily.
Before:
const tempFilePath = path. Join(os.tmpdir(), tempFileName);
After:
// This temp file is used to capture the PIDs of backgrounded processes.
const tempFilePath = path.join(os.tmpdir(), tempFileName);
These changes collectively improve the quality and usability of the Gemini CLI. I look forward to your feedback!
Related Issues
- #8185
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
Hello @kklashtorny1,
Thank you for triaging this PR and removing the status/need-issue label.
I have resolved the recent merge conflicts, and I believe the code is now ready for another review. As I'm new to contributing, I'm eager for any feedback.
Could you please approve the CI workflows to run when you have a chance?
Thank you!
Hello @kklashtorny1,
Thank you for triaging this PR and removing the status/need-issue label.
I have resolved the recent merge conflicts, and I believe the code is now ready for another review. As I'm new to contributing, I'm eager for any feedback.
Could you please approve the CI workflows to run when you have a chance?
Thank you!
Hi @pareshjoshij,
Thank you for reaching out! Our team is currently reviewing a high volume of PRs from community contributors and we will get to yours as soon as possible.
Thank you for your patience!
@kklashtorny1 Hi! Whenever you have a bit of spare time, could you please take another look at this PR?