-
Notifications
You must be signed in to change notification settings - Fork 9.5k
feat: Add explore subcommand for extension #11846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
chrstnb
merged 10 commits into
google-gemini:main
from
JayadityaGit:feat/extension-explore
Oct 28, 2025
+156
−2
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
52d553f
explore subcommand for extension
JayadityaGit c9f72e0
Merge branch 'main' into feat/extension-explore
JayadityaGit baebbc1
Merge branch 'main' into feat/extension-explore
JayadityaGit 8960398
geminiRefinments
JayadityaGit 695f186
Merge branch 'main' into feat/extension-explore
JayadityaGit 9ef9dad
refinements
JayadityaGit 7e7eb1d
refactor: remove redundant comment from extensionsCommand.test.ts
JayadityaGit 1014ee0
Merge branch 'main' into feat/extension-explore
JayadityaGit 5b3a21c
Merge branch 'main' into feat/extension-explore
JayadityaGit 53c26af
Merge branch 'main' into feat/extension-explore
chrstnb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,8 @@ import { | |
| type SlashCommand, | ||
| CommandKind, | ||
| } from './types.js'; | ||
| import open from 'open'; | ||
| import process from 'node:process'; | ||
|
|
||
| async function listAction(context: CommandContext) { | ||
| const historyItem: HistoryItemExtensionsList = { | ||
|
|
@@ -112,6 +114,51 @@ function updateAction(context: CommandContext, args: string): Promise<void> { | |
| return updateComplete.then((_) => {}); | ||
| } | ||
|
|
||
| async function exploreAction(context: CommandContext) { | ||
| const extensionsUrl = 'https://geminicli.com/extensions/'; | ||
|
|
||
| // Only check for NODE_ENV for explicit test mode, not for unit test framework | ||
| if (process.env['NODE_ENV'] === 'test') { | ||
| context.ui.addItem( | ||
| { | ||
| type: MessageType.INFO, | ||
| text: `Would open extensions page in your browser: ${extensionsUrl} (skipped in test environment)`, | ||
| }, | ||
| Date.now(), | ||
| ); | ||
| } else if ( | ||
| process.env['SANDBOX'] && | ||
| process.env['SANDBOX'] !== 'sandbox-exec' | ||
| ) { | ||
| context.ui.addItem( | ||
| { | ||
| type: MessageType.INFO, | ||
| text: `View available extensions at ${extensionsUrl}`, | ||
| }, | ||
| Date.now(), | ||
| ); | ||
| } else { | ||
| context.ui.addItem( | ||
| { | ||
| type: MessageType.INFO, | ||
| text: `Opening extensions page in your browser: ${extensionsUrl}`, | ||
| }, | ||
| Date.now(), | ||
| ); | ||
| try { | ||
| await open(extensionsUrl); | ||
| } catch (_error) { | ||
| context.ui.addItem( | ||
| { | ||
| type: MessageType.ERROR, | ||
| text: `Failed to open browser. Check out the extensions gallery at ${extensionsUrl}`, | ||
| }, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Failed to open browser. Check out the extensions gallery at ${extensions Url} |
||
| Date.now(), | ||
| ); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| const listExtensionsCommand: SlashCommand = { | ||
| name: 'list', | ||
| description: 'List active extensions', | ||
|
|
@@ -141,11 +188,22 @@ const updateExtensionsCommand: SlashCommand = { | |
| }, | ||
| }; | ||
|
|
||
| const exploreExtensionsCommand: SlashCommand = { | ||
| name: 'explore', | ||
| description: 'Open extensions page in your browser', | ||
| kind: CommandKind.BUILT_IN, | ||
| action: exploreAction, | ||
| }; | ||
|
|
||
| export const extensionsCommand: SlashCommand = { | ||
| name: 'extensions', | ||
| description: 'Manage extensions', | ||
| kind: CommandKind.BUILT_IN, | ||
| subCommands: [listExtensionsCommand, updateExtensionsCommand], | ||
| subCommands: [ | ||
| listExtensionsCommand, | ||
| updateExtensionsCommand, | ||
| exploreExtensionsCommand, | ||
| ], | ||
| action: (context, args) => | ||
| // Default to list if no subcommand is provided | ||
| listExtensionsCommand.action!(context, args), | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.