Skip to content

Extract isUserCancellation to a shared location for @inquirer/prompts callers #27028

@tylerbutler

Description

@tylerbutler

Summary

build-tools/packages/build-cli/src/commands/ai.ts defines an isUserCancellation helper (lines 335-342) that detects ExitPromptError, AbortError, and cancellation-related error messages from @inquirer/prompts. This is currently the only place in build-cli that handles prompt cancellation gracefully.

Other commands that use @inquirer/prompts (confirm, rawlist) — including bump.ts, release.ts, release/report.ts, and handlers/checkFunctions.ts — do not catch cancellation at all. Pressing Ctrl+C in those commands produces an unhandled rejection and a raw stack trace.

Proposal

Move isUserCancellation to a shared location (e.g. src/library/prompt.ts) and adopt it in the other @inquirer/prompts callers so that Ctrl+C exits cleanly across all interactive commands.

Context

Identified during code reuse review of the flub ai PR. Deferred because applying the fix across all callers is a broader change.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions