Skip to content
This repository was archived by the owner on Jul 4, 2026. It is now read-only.

fix: implement interactive list selection and fix default value display (#69) - #70

Merged
gaureshpai merged 1 commit into
mainfrom
fix/interactive-list-selection-69
Feb 7, 2026
Merged

gaureshpai merged 1 commit into
mainfrom
fix/interactive-list-selection-69

Conversation

@gaureshpai

@gaureshpai gaureshpai commented Feb 7, 2026 •

Copy link
Copy Markdown
Owner

Closes #69

  • Replaces manual numeric input with arrow-key navigation for list prompts.
  • Displays numeric indices (1, 2, 3) alongside a green selection indicator (>).
  • Fixes the bug where default numeric values were not visible to the user.
  • Implements a robust fallback for non-TTY environments (CI/GitHub Actions) to support both numeric input and ANSI arrow sequences.
  • Fixes a terminal hang issue by ensuring stdin is properly paused on close.
  • Updates interactive test cases to align with the new selection method.

Description

Related Issue

Fixes #
Closes #

Type of Change

  • Bug fix (non-breaking change addressing an issue)
  • New feature (non-breaking change adding functionality)
  • Breaking change (fix or feature causing existing functionality to break)
  • Documentation update

Testing

  • Test A
  • Test B

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Screenshots

Additional Notes

Summary by CodeRabbit

  • New Features

    • Enhanced list prompts with arrow key navigation in interactive mode, allowing up/down movement through options
    • Improved support for non-interactive environments with numeric and text-based selection
    • Better terminal state management and graceful handling of keyboard interrupts
  • Tests

    • Updated test scenarios to reflect new input navigation methods

…ay (#69)

- Replaces manual numeric input with arrow-key navigation for list prompts.
- Displays numeric indices (1, 2, 3) alongside a green selection indicator (>).
- Fixes the bug where default numeric values were not visible to the user.
- Implements a robust fallback for non-TTY environments (CI/GitHub Actions)
  to support both numeric input and ANSI arrow sequences.
- Fixes a terminal hang issue by ensuring stdin is properly paused on close.
- Updates interactive test cases to align with the new selection method.
@gaureshpai gaureshpai self-assigned this Feb 7, 2026
@gaureshpai gaureshpai added the bug Something isn't working label Feb 7, 2026
@coderabbitai

coderabbitai Bot commented Feb 7, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Enhanced list-type prompts with interactive TTY navigation using arrow keys and cursor control, while preserving non-TTY fallback supporting numeric or text-based selection. Terminal state properly managed across both modes. Updated interactive tests to use keyboard navigation sequences.

Changes

Cohort / File(s) Summary
Interactive Prompt Implementation
src/lib/prompts.js
Added TTY-aware interactive flow for list prompts with Up/Down navigation, in-place rendering, and cursor management. Implemented non-TTY fallback with numeric or text matching. Added robust input parsing, terminal state cleanup on exit, and default option handling.
Interactive Test Navigation
src/test/interactive.test.js
Updated test sequences to simulate keyboard navigation using down-arrow sequences instead of numeric selections, maintaining same test outcomes with new input method.

Sequence Diagram

sequenceDiagram
    participant User
    participant PromptHandler as Prompt Handler
    participant Terminal
    participant InputParser as Input Parser

    User->>PromptHandler: Initiate list prompt
    PromptHandler->>Terminal: Render options with default highlighted
    
    alt TTY Mode (Interactive)
        loop Navigation
            User->>InputParser: Press Up/Down arrow
            InputParser->>PromptHandler: Parse navigation command
            PromptHandler->>Terminal: Update selection highlight in place
            Terminal->>User: Display updated cursor position
        end
        User->>InputParser: Press Enter
        InputParser->>PromptHandler: Confirm selection
        PromptHandler->>Terminal: Print final selection
        PromptHandler->>Terminal: Restore terminal state & show cursor
        PromptHandler->>User: Resolve with selected option
    else Non-TTY Mode (Piped)
        User->>InputParser: Provide numeric or text input
        InputParser->>PromptHandler: Parse and validate input
        PromptHandler->>PromptHandler: Match against options or use default
        PromptHandler->>User: Resolve with matched option
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Hopping through prompts with arrows so bright,
Up, down, and enter—a terminal delight!
Default values dance, no numbers to hide,
Interactive magic with TTY as guide! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description lists key changes but the template checklist items remain unchecked and testing section lacks details about how changes were validated. Complete the checklist items and provide specific details about testing performed (unit tests run, manual testing scenarios verified).
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: implementing interactive list selection and fixing default value display, directly aligned with the primary objectives.
Linked Issues check ✅ Passed The PR addresses all coding requirements from issue #69: displays numeric indices alongside options, implements interactive list selection with arrow keys, provides non-TTY fallback, and fixes terminal hang issue.
Out of Scope Changes check ✅ Passed All code changes are scoped to implementing interactive list prompts and fixing the default value display issue; no unrelated modifications detected in the summarized changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Docstrings were successfully generated.
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/interactive-list-selection-69

No actionable comments were generated in the recent review. 🎉

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to Reviews > Disable Cache setting

📥 Commits

Reviewing files that changed from the base of the PR and between c3ca613 and 7003621.

📒 Files selected for processing (2)
  • src/lib/prompts.js
  • src/test/interactive.test.js
🧰 Additional context used
🧬 Code graph analysis (2)
src/test/interactive.test.js (2)
src/lib/prompts.js (1)
  • answers (182-182)
src/index.js (2)
  • answers (74-74)
  • answers (293-307)
src/lib/prompts.js (1)
src/lib/colors.js (1)
  • chalk (90-90)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Node 20.x - yarn
  • GitHub Check: Node 20.x - pnpm
  • GitHub Check: Node 20.x - npm
  • GitHub Check: Node 22.x - pnpm
  • GitHub Check: Node 22.x - yarn
  • GitHub Check: Node 22.x - npm
🔇 Additional comments (3)
src/lib/prompts.js (2)

195-198: Good: stdin cleanup prevents terminal hangs.


50-99: No action needed. The code correctly handles all actual list question patterns in the codebase, where defaults are always choice values, not numeric indices.

Likely an incorrect or invalid review comment.

src/test/interactive.test.js (1)

66-67: LGTM: arrow-sequence inputs align with new navigation.

Also applies to: 99-100, 170-171, 188-189

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Feb 7, 2026

Copy link
Copy Markdown
Contributor

✅ CI/CD Test Results

Overall Status: success


View full workflow run

@coderabbitai

coderabbitai Bot commented Feb 7, 2026 •

Copy link
Copy Markdown
Contributor

Caution

Docstrings generation - FAILED

No docstrings were generated.

@gaureshpai

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Feb 7, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@gaureshpai
gaureshpai merged commit 44b64e3 into main Feb 7, 2026
9 checks passed
@gaureshpai
gaureshpai deleted the fix/interactive-list-selection-69 branch February 7, 2026 09:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Default number for options not displayed.

1 participant