From 6cd6e090e7e7b958c130961ea726f7307d302aec Mon Sep 17 00:00:00 2001 From: Dmitry Stoyanov Date: Thu, 19 Mar 2026 14:07:48 +0300 Subject: [PATCH] fix(agents): Fixed issue with gemini extension installation --- src/agents/plugins/gemini/gemini.plugin.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/agents/plugins/gemini/gemini.plugin.ts b/src/agents/plugins/gemini/gemini.plugin.ts index d366d38c..5d1adc62 100644 --- a/src/agents/plugins/gemini/gemini.plugin.ts +++ b/src/agents/plugins/gemini/gemini.plugin.ts @@ -131,12 +131,19 @@ export const GeminiPluginMetadata: AgentMetadata = { // Uses BaseAgentAdapter methods for cross-platform file operations lifecycle: { enrichArgs: (args, config) => { - // Gemini CLI uses -m flag for model selection + // Subcommands that do not accept global -m/--model (e.g. extensions install) + const noModelSubcommands = ['extensions', 'health']; + const firstIsNoModelSubcommand = args[0] && noModelSubcommands.includes(args[0]); + const hasModelArg = args.some((arg, idx) => (arg === '-m' || arg === '--model') && idx < args.length - 1 ); - if (!hasModelArg && config.model) { + if ( + !firstIsNoModelSubcommand && + !hasModelArg && + config.model + ) { return ['-m', config.model, ...args]; }