From 2792df7c84a8a6c8e9b35230090a75b0c2c008a2 Mon Sep 17 00:00:00 2001 From: Charles Packer Date: Wed, 4 Feb 2026 12:19:44 -0800 Subject: [PATCH] fix: add number key support to approval dialogs (#821) Co-authored-by: Letta --- src/cli/components/InlineBashApproval.tsx | 11 +++++++++++ src/cli/components/InlineFileEditApproval.tsx | 14 ++++++++++++++ src/cli/components/InlineGenericApproval.tsx | 11 +++++++++++ src/cli/components/InlineTaskApproval.tsx | 11 +++++++++++ src/cli/components/StaticPlanApproval.tsx | 11 +++++++++++ 5 files changed, 58 insertions(+) diff --git a/src/cli/components/InlineBashApproval.tsx b/src/cli/components/InlineBashApproval.tsx index 1fd5976..bf8ee6c 100644 --- a/src/cli/components/InlineBashApproval.tsx +++ b/src/cli/components/InlineBashApproval.tsx @@ -114,6 +114,17 @@ export const InlineBashApproval = memo( if (key.escape) { // Cancel (queue denial, return to input) onCancel?.(); + return; + } + + // Number keys for quick selection (only for fixed options, not custom text input) + if (input === "1") { + onApprove(); + return; + } + if (input === "2" && allowPersistence) { + onApproveAlways("project"); + return; } }, { isActive: isFocused }, diff --git a/src/cli/components/InlineFileEditApproval.tsx b/src/cli/components/InlineFileEditApproval.tsx index 331fa95..9b6d7d5 100644 --- a/src/cli/components/InlineFileEditApproval.tsx +++ b/src/cli/components/InlineFileEditApproval.tsx @@ -276,6 +276,20 @@ export const InlineFileEditApproval = memo( } if (key.escape) { onCancel?.(); + return; + } + + // Number keys for quick selection (only for fixed options, not custom text input) + if (input === "1") { + onApprove(diffsToPass.size > 0 ? diffsToPass : undefined); + return; + } + if (input === "2" && allowPersistence) { + onApproveAlways( + "project", + diffsToPass.size > 0 ? diffsToPass : undefined, + ); + return; } }, { isActive: isFocused }, diff --git a/src/cli/components/InlineGenericApproval.tsx b/src/cli/components/InlineGenericApproval.tsx index 837b189..9e51eb6 100644 --- a/src/cli/components/InlineGenericApproval.tsx +++ b/src/cli/components/InlineGenericApproval.tsx @@ -127,6 +127,17 @@ export const InlineGenericApproval = memo( } if (key.escape) { onCancel?.(); + return; + } + + // Number keys for quick selection (only for fixed options, not custom text input) + if (input === "1") { + onApprove(); + return; + } + if (input === "2" && allowPersistence) { + onApproveAlways("project"); + return; } }, { isActive: isFocused }, diff --git a/src/cli/components/InlineTaskApproval.tsx b/src/cli/components/InlineTaskApproval.tsx index 6397262..958e640 100644 --- a/src/cli/components/InlineTaskApproval.tsx +++ b/src/cli/components/InlineTaskApproval.tsx @@ -109,6 +109,17 @@ export const InlineTaskApproval = memo( } if (key.escape) { onCancel?.(); + return; + } + + // Number keys for quick selection (only for fixed options, not custom text input) + if (input === "1") { + onApprove(); + return; + } + if (input === "2" && allowPersistence) { + onApproveAlways("session"); + return; } }, { isActive: isFocused }, diff --git a/src/cli/components/StaticPlanApproval.tsx b/src/cli/components/StaticPlanApproval.tsx index 5ccf766..2010070 100644 --- a/src/cli/components/StaticPlanApproval.tsx +++ b/src/cli/components/StaticPlanApproval.tsx @@ -100,6 +100,17 @@ export const StaticPlanApproval = memo( } if (key.escape) { onKeepPlanning("User cancelled"); + return; + } + + // Number keys for quick selection (only for fixed options, not custom text input) + if (input === "1") { + onApproveAndAcceptEdits(); + return; + } + if (input === "2") { + onApprove(); + return; } }, { isActive: isFocused },