From bbe95f1eaa8f5351c58e0866ba938415db7891e4 Mon Sep 17 00:00:00 2001 From: Abhi <43648792+abhipatel12@users.noreply.github.com> Date: Wed, 23 Jul 2025 16:11:23 -0400 Subject: feat(commands): Implement argument handling for custom commands via a prompt pipeline (#4702) --- packages/cli/src/ui/hooks/slashCommandProcessor.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'packages/cli/src/ui/hooks/slashCommandProcessor.ts') diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.ts index 48be0470..fa2b0b12 100644 --- a/packages/cli/src/ui/hooks/slashCommandProcessor.ts +++ b/packages/cli/src/ui/hooks/slashCommandProcessor.ts @@ -238,7 +238,18 @@ export const useSlashCommandProcessor = ( const args = parts.slice(pathIndex).join(' '); if (commandToExecute.action) { - const result = await commandToExecute.action(commandContext, args); + const fullCommandContext: CommandContext = { + ...commandContext, + invocation: { + raw: trimmed, + name: commandToExecute.name, + args, + }, + }; + const result = await commandToExecute.action( + fullCommandContext, + args, + ); if (result) { switch (result.type) { @@ -288,9 +299,9 @@ export const useSlashCommandProcessor = ( await config ?.getGeminiClient() ?.setHistory(result.clientHistory); - commandContext.ui.clear(); + fullCommandContext.ui.clear(); result.history.forEach((item, index) => { - commandContext.ui.addItem(item, index); + fullCommandContext.ui.addItem(item, index); }); return { type: 'handled' }; } -- cgit v1.2.3