这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@JayadityaGit
Copy link
Contributor

TL;DR

This PR introduces a new explore subcommand under the /extension command that opens the extensions page in the user's default browser.
It follows the same design and implementation pattern as the existing /docs command.


Dive Deeper

The purpose of this addition is to make it easier for users to discover and explore available extensions directly from the CLI.
The implementation reuses the existing open-library mechanism used by /docs, ensuring consistent behavior and proper handling in both production and test environments.

Comprehensive unit tests are included to validate all key scenarios, ensuring full alignment with the project’s coding conventions and test standards.


Testing Matrix

  🍏 macOS 🪟 Windows 🐧 Linux
npm run
npx
Docker
Podman
Seatbelt

@JayadityaGit JayadityaGit requested a review from a team as a code owner October 23, 2025 21:59
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @JayadityaGit, 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 CLI by adding an explore subcommand to the existing /extension command. This new feature provides a direct and convenient way for users to discover and browse available extensions by automatically opening the extensions webpage in their default browser. The implementation reuses established patterns for opening external links and includes thorough testing to ensure consistent and reliable behavior across various operational contexts.

Highlights

  • New 'explore' subcommand: Introduced a new explore subcommand under the /extension command, allowing users to easily access the extensions page.
  • Browser Integration: The explore subcommand opens the https://geminicli.com/extensions/ URL in the user's default browser, leveraging the open library.
  • Environment Handling: The command intelligently handles different environments: opening the browser in normal mode, providing a URL to copy in sandbox environments, and logging a skipped message in test environments.
  • Comprehensive Testing: Extensive unit tests have been added for the new explore subcommand, covering its behavior across non-sandbox, sandbox, and test environments, ensuring robust functionality.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new explore subcommand for extensions, which opens the extensions documentation page in the browser. The implementation follows the existing pattern of the /docs command and includes unit tests. My review focuses on improving the robustness of the new feature by adding error handling for the browser-opening operation and suggesting a corresponding test case to ensure correctness. Overall, the changes are well-structured and clear.

// Ensure 'open' was not called in test environment
expect(open).not.toHaveBeenCalled();
});
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

While the existing tests cover the success paths well, a key scenario is missing. It's important to also test the failure case where open() might reject (e.g., if a browser cannot be opened). Adding a test for this scenario would ensure your new error handling logic works as expected and prevents unhandled promise rejections.

},
Date.now(),
);
await open(extensionsUrl);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The call to open() can fail for various reasons (e.g., no default browser configured, permissions issues). An unhandled promise rejection here could lead to an uncaught exception, potentially providing a poor user experience. It's better to wrap this call in a try...catch block to gracefully handle any errors and inform the user.

    try {
      await open(extensionsUrl);
    } catch (error) {
      context.ui.addItem(
        {
          type: MessageType.ERROR,
          text: `Failed to open browser. Please open this URL manually: ${extensionsUrl}`,
        },
        Date.now()
      );
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks !

import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { type ExtensionUpdateAction } from '../state/extensions.js';

// Mock the 'open' library similar to docsCommand.test.ts
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove this comment

beforeEach(() => {
vi.resetAllMocks();
mockGetExtensions.mockReturnValue([]);
// Reset the `open` mock as done in docsCommand.test.ts
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

context.ui.addItem(
{
type: MessageType.INFO,
text: `Please open the following URL in your browser to explore extensions:\\n${extensionsUrl}`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"View available extensions at ${extensionsUrl}"

{
type: MessageType.ERROR,
text: `Failed to open browser. Please open this URL manually: ${extensionsUrl}`,
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Failed to open browser. Check out the extensions gallery at ${extensions Url}

Copy link
Collaborator

@chrstnb chrstnb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of nits but overall looks good!

@JayadityaGit
Copy link
Contributor Author

Thank you so much for the review, @chrstnb! I’ll address these right away.

@JayadityaGit
Copy link
Contributor Author

Also, I’m participating in the Hacktoberfest event. Could you please add the hacktoberfest-accepted label to this PR when you get a chance? Thank you so much, @chrstnb! 🙏

Copy link
Collaborator

@chrstnb chrstnb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@chrstnb chrstnb enabled auto-merge October 28, 2025 18:06
@chrstnb chrstnb added this pull request to the merge queue Oct 28, 2025
Merged via the queue into google-gemini:main with commit c2d60d6 Oct 28, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants