Skip to content

refactor: migrate all prompts from inquirer to @inquirer/prompts - #8551

Merged
paulo merged 1 commit into
mainfrom
chore/migrate-inquirer-prompts
Oct 2, 2026
Merged

paulo merged 1 commit into
mainfrom
chore/migrate-inquirer-prompts

Conversation

@paulo

@paulo paulo commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Stacked on #8549, so review that first. This PR moves every remaining prompt off inquirer@8 to @inquirer/prompts and removes inquirer, @types/inquirer and the direct @inquirer/search dependency. rxjs and lodash drop out of the install as a result.

Install size (packed tarball, --ignore-scripts, macOS arm64): main 342 MB, this stack 288 MB (−16%), 65 fewer packages, about 7,700 fewer files.

What changed

Details - All 58 `inquirer.prompt` calls in 30 files now use `select`, `input`, `confirm` or `password`: - `filter` is applied to the returned value, because the new prompts don't support it. - Prompts that asked several questions at once now ask them one after another. - Each conversion keeps the original defaults and validators. - `confirmPrompt` no longer catches every error and exits 0. Ctrl+C now reaches the central handler added in #8549. - "Did you mean" (for mistyped commands and recipe names) works as before: answering yes runs the suggestion, and answering no or waiting 10 seconds exits with the usual hint. The 10-second timeout now uses the prompt's built-in `AbortSignal` support instead of force-closing inquirer's internal UI, which is what caused the crash described below. - Tests that mocked `inquirer.prompt` now mock `@inquirer/prompts`. The shared helper is `mockConfirm()` / `spyOnConfirm()`. - Updated snapshots: `env:list` ×2 and the recipes suggestion. Only escape codes changed.

Behavior changes

  • Fixed a crash: answering "yes" to "did you mean" used to crash a few seconds later with "Netlify CLI has terminated unexpectedly" (ERR_USE_AFTER_CLOSE), because the timeout closed a prompt that was already closed. That no longer happens.
  • Ctrl+C on any prompt: exits 130 with no output. main exits 13 and prints Warning: Detected unsettled top-level await.
  • Validation errors: a rejected input now shows "> You must provide a valid value". inquirer 8 printed nothing for validators that return false.
  • Prompt appearance: answered prompts show ✔ instead of ?, and active prompts show a key-hint line.

  • Open a bug/issue before writing your code 🧑‍💻
  • Read the contribution guidelines 📖
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 9712184f-1379-4697-8579-a771cb00cc2a

📥 Commits

Reviewing files that changed from the base of the PR and between ece6da4 and 21a4a25.

⛔ Files ignored due to path filters (3)
  • package-lock.json is excluded by !**/package-lock.json
  • tests/integration/commands/env/__snapshots__/env.test.ts.snap is excluded by !**/*.snap
  • tests/integration/commands/recipes/__snapshots__/recipes.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (1)
  • package.json
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. 3 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour. Your free on-demand review promotion remains active until October 9, 2026 at 6:00 PM UTC.


📝 Summary

Summary by CodeRabbit

  • Improvements
    • Interactive prompts across commands and setup flows now provide a consistent experience for entering text, choosing options, and confirming actions. Existing questions, choices, defaults, and validation are generally unchanged.
    • Personal access token input continues to trim whitespace before use.
    • Project-selection lists display without pagination.

Walkthrough

The CLI replaces legacy Inquirer prompt calls with direct functions from @inquirer/prompts across commands, utilities, and recipes. Tests now mock those functions and use direct return values. The package manifest adds @inquirer/prompts and removes inquirer, @inquirer/search, and @types/inquirer. Prompt-related changes also include abort-signal timeouts, input handling adjustments, and changed error propagation.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Refactor

Suggested reviewers: serhalp, eduardoboucas

Merge Risk: ⚪ Minimal · up to 21a4a

The prompt dependency migration does not leave the manifest and lockfile out of sync, so the documented CI install workflow is not blocked. No concrete merge-blocking impact is established by the supplied context.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 45 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: migrating all prompts from Inquirer to @inquirer/prompts.
Description check ✅ Passed The description is directly related to the changeset and explains the dependency migration, prompt conversions, behavior changes, and test updates.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 45 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

@pkg-pr-new

pkg-pr-new Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/netlify-cli@8551

commit: 21a4a25

@paulo
paulo added this pull request to stack #8552 October 2, 2026 09:16
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

📊 Benchmark results

Comparing with 511c37d

  • Dependency count: 1,018 ⬇️ 3.44% decrease vs. 511c37d
  • Package size: 381 MB ⬇️ 4.88% decrease vs. 511c37d
  • Number of ts-expect-error directives: 331 ⬇️ 0.60% decrease vs. 511c37d

@paulo

paulo commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

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.

@paulo
paulo force-pushed the chore/migrate-inquirer-prompts branch from ece6da4 to 7bc8e5d Compare October 2, 2026 14:03
@paulo
paulo removed this pull request from stack #8552 October 2, 2026 14:08
Base automatically changed from chore/trim-deps-octokit-autocomplete to main October 2, 2026 14:11
Replace every inquirer.prompt call with the matching @inquirer/prompts
function and drop inquirer, @types/inquirer and the direct
@inquirer/search dependency. confirmPrompt no longer swallows errors, so
Ctrl+C reaches the central ExitPromptError handling.

The 'did you mean' suggestion prompts in the root command and in
`recipes` now use an AbortSignal timeout instead of closing the prompt
UI, which crashed the CLI with ERR_USE_AFTER_CLOSE whenever the user
answered before the timeout.

Tests that mocked inquirer.prompt now mock @inquirer/prompts, and the
env/recipes prompt snapshots are updated for the new rendering.
@paulo
paulo force-pushed the chore/migrate-inquirer-prompts branch from 7bc8e5d to 21a4a25 Compare October 2, 2026 14:31
@paulo
paulo requested a review from JakeChampion October 2, 2026 15:12
@paulo
paulo marked this pull request as ready for review October 2, 2026 15:12
@paulo
paulo requested a review from a team as a code owner October 2, 2026 15:12
@paulo

paulo commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

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.

@paulo
paulo merged commit 7f1c866 into main Oct 2, 2026
38 checks passed
@paulo
paulo deleted the chore/migrate-inquirer-prompts branch October 2, 2026 15:52
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