Skip to content

Graceful prompt exit#34

Merged
kentcdodds merged 3 commits into
mainfrom
cursor/graceful-prompt-exit-89a2
Jan 26, 2026
Merged

Graceful prompt exit#34
kentcdodds merged 3 commits into
mainfrom
cursor/graceful-prompt-exit-89a2

Conversation

@kentcdodds
Copy link
Copy Markdown
Member

@kentcdodds kentcdodds commented Jan 26, 2026

Gracefully handle Ctrl+C during interactive prompts to prevent verbose stack traces.

This change maps Inquirer's ExitPromptError to a custom PromptCancelled error, which is then specifically handled by the yargs parser to exit cleanly without printing help messages or stack traces.


Open in Cursor Open in Web


Note

Improves interactive CLI robustness by cleanly handling prompt cancellations and yargs failures.

  • Adds handlePromptFailure, isExitPromptError, handlePromptError, and runPrompt in cli-ux.ts to map Inquirer ExitPromptError to PromptCancelled
  • Wraps all Inquirer-based prompts (select, search, input, confirm) with runPrompt to consistently translate cancellations
  • Updates src/cli.ts and process-course/edits/cli.ts to use .fail(handlePromptFailure) and .exitProcess(false) for clean exits without stack traces; keeps PromptCancelled handling in top-level catch
  • Minor typing import adjustment to include Argv

Written by Cursor Bugbot for commit df0c915. This will update automatically on new commits. Configure here.

cursoragent and others added 2 commits January 26, 2026 23:15
Co-authored-by: me <me@kentcdodds.com>
Co-authored-by: me <me@kentcdodds.com>
@cursor
Copy link
Copy Markdown

cursor Bot commented Jan 26, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@kentcdodds kentcdodds marked this pull request as ready for review January 26, 2026 23:28
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is ON. A Cloud Agent has been kicked off to fix the reported issue.

Comment thread src/cli.ts Outdated
…ation

Move handlePromptFailure from src/cli.ts and process-course/edits/cli.ts
to cli-ux.ts to prevent maintenance issues and ensure consistent behavior
across CLI entry points.
@cursor
Copy link
Copy Markdown

cursor Bot commented Jan 26, 2026

Bugbot Autofix resolved the bug found in the latest run.

  • ✅ Fixed: Duplicate handlePromptFailure function across CLI files
    • Centralized the handlePromptFailure function in cli-ux.ts and updated both CLI files to import and use the shared implementation.

@kentcdodds kentcdodds merged commit 8375ba9 into main Jan 26, 2026
6 checks passed
@kentcdodds kentcdodds deleted the cursor/graceful-prompt-exit-89a2 branch January 26, 2026 23:48
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 1.13.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants