@@ -20,6 +20,7 @@ import {
2020} from '@qwen-code/qwen-code-core' ;
2121import { SettingScope } from '../../config/settings.js' ;
2222import open from 'open' ;
23+ import { extensionToOutputString } from '../../commands/extensions/utils.js' ;
2324
2425const EXTENSION_EXPLORE_URL = {
2526 Gemini : 'https://geminicli.com/extensions/' ,
@@ -475,6 +476,53 @@ async function enableAction(context: CommandContext, args: string) {
475476 }
476477}
477478
479+ async function detailAction ( context : CommandContext , args : string ) {
480+ const extensionManager = context . services . config ?. getExtensionManager ( ) ;
481+ if ( ! ( extensionManager instanceof ExtensionManager ) ) {
482+ console . error (
483+ `Cannot ${ context . invocation ?. name } extensions in this environment` ,
484+ ) ;
485+ return ;
486+ }
487+
488+ const name = args . trim ( ) ;
489+ if ( ! name ) {
490+ context . ui . addItem (
491+ {
492+ type : MessageType . ERROR ,
493+ text : t ( 'Usage: /extensions detail <extension-name>' ) ,
494+ } ,
495+ Date . now ( ) ,
496+ ) ;
497+ return ;
498+ }
499+
500+ const extensions = context . services . config ! . getExtensions ( ) ;
501+ const extension = extensions . find ( ( extension ) => extension . name === name ) ;
502+ if ( ! extension ) {
503+ context . ui . addItem (
504+ {
505+ type : MessageType . ERROR ,
506+ text : t ( 'Extension "{{name}}" not found.' , { name } ) ,
507+ } ,
508+ Date . now ( ) ,
509+ ) ;
510+ return ;
511+ }
512+ context . ui . addItem (
513+ {
514+ type : MessageType . INFO ,
515+ text : extensionToOutputString (
516+ extension ,
517+ extensionManager ,
518+ process . cwd ( ) ,
519+ true ,
520+ ) ,
521+ } ,
522+ Date . now ( ) ,
523+ ) ;
524+ }
525+
478526export async function completeExtensions (
479527 context : CommandContext ,
480528 partialArg : string ,
@@ -495,7 +543,10 @@ export async function completeExtensions(
495543 name . startsWith ( partialArg ) ,
496544 ) ;
497545
498- if ( context . invocation ?. name !== 'uninstall' ) {
546+ if (
547+ context . invocation ?. name !== 'uninstall' &&
548+ context . invocation ?. name !== 'detail'
549+ ) {
499550 if ( '--all' . startsWith ( partialArg ) || 'all' . startsWith ( partialArg ) ) {
500551 suggestions . unshift ( '--all' ) ;
501552 }
@@ -594,6 +645,16 @@ const uninstallCommand: SlashCommand = {
594645 completion : completeExtensions ,
595646} ;
596647
648+ const detailCommand : SlashCommand = {
649+ name : 'detail' ,
650+ get description ( ) {
651+ return t ( 'Get detail of an extension' ) ;
652+ } ,
653+ kind : CommandKind . BUILT_IN ,
654+ action : detailAction ,
655+ completion : completeExtensions ,
656+ } ;
657+
597658export const extensionsCommand : SlashCommand = {
598659 name : 'extensions' ,
599660 get description ( ) {
@@ -608,6 +669,7 @@ export const extensionsCommand: SlashCommand = {
608669 installCommand ,
609670 uninstallCommand ,
610671 exploreExtensionsCommand ,
672+ detailCommand ,
611673 ] ,
612674 action : ( context , args ) =>
613675 // Default to list if no subcommand is provided
0 commit comments