Skip to content

Comments

Fix number key hotkeys (1, 2, 3) not working in command approval menu#4978

Merged
marius-kilocode merged 2 commits intomainfrom
fix/approval-number-hotkeys
Jan 13, 2026
Merged

Fix number key hotkeys (1, 2, 3) not working in command approval menu#4978
marius-kilocode merged 2 commits intomainfrom
fix/approval-number-hotkeys

Conversation

@marius-kilocode
Copy link
Collaborator

@marius-kilocode marius-kilocode commented Jan 13, 2026

Summary

Fixes a bug where pressing number keys (1, 2, 3) to select "Always Run" options in the CLI command approval menu didn't work.

Problem

When the approval menu displayed options like:

  • Run Command (y)
  • Always Run "mkdir" (1)
  • Always Run "mkdir test-dir" (2)
  • Always Run full command (3)
  • Reject (n)

Pressing 'y' and 'n' worked correctly, but pressing '1', '2', or '3' did nothing.

Root Cause

The handleApprovalKeys function in cli/src/state/atoms/keyboard.ts only handled down, up, y, n, return, and escape keys. Number keys were never checked against the approval options' hotkeys.

Solution

Added hotkey matching logic at the beginning of handleApprovalKeys to find options by their hotkey and execute them when a matching number key is pressed.

image

@changeset-bot
Copy link

changeset-bot bot commented Jan 13, 2026

🦋 Changeset detected

Latest commit: 4082a13

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@kilocode/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@marius-kilocode marius-kilocode requested a review from a team January 13, 2026 11:38
@marius-kilocode marius-kilocode enabled auto-merge (squash) January 13, 2026 11:38
@kiloconnect
Copy link
Contributor

kiloconnect bot commented Jan 13, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Overview

This PR adds support for number key hotkeys (1, 2, 3) in the CLI command approval menu. The implementation is clean and well-tested.

Key Changes:

  • Added hotkey matching logic in handleApprovalKeys() to find options by their hotkey property
  • When a matching hotkey is found, it selects that option and executes it immediately
  • Comprehensive test coverage added for the new functionality

Code Quality:

  • The implementation correctly checks for hotkey matches before falling through to the existing switch statement
  • Tests cover multiple scenarios: single hierarchy commands, multi-level commands, and edge cases where no matching hotkey exists
  • The changeset is properly formatted for the CLI package
Files Reviewed (3 files)
  • .changeset/fix-approval-number-hotkeys.md - Changeset for the patch
  • cli/src/state/atoms/keyboard.ts - Core implementation (7 lines added)
  • cli/src/state/atoms/__tests__/keyboard.test.ts - Test coverage (150 lines added)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants