Skip to content

feat: migrate user prompts from inquirer to clack - #10836

Draft
serhalp wants to merge 13 commits into
mainfrom
serhalp/feat/clack
Draft

serhalp wants to merge 13 commits into
mainfrom
serhalp/feat/clack

Conversation

@serhalp

@serhalp serhalp commented Nov 13, 2026

Copy link
Copy Markdown
Member

Summary

wippy wip wip

  • test: add coverage for interactive user prompts
  • fix(completion): wait for .zshrc read before writing to it
  • fix(functions): await edge function route registration
  • fix(functions): remove stray $ from download error message
  • refactor(functions): drop no-op template sort tiebreaker
  • fix(recipes): await Deno extension install in vscode recipe
  • fix(link): suggest --git-remote-url, not --gitRemoteUrl
  • fix(init): remove stray backtick from base directory prompt
  • fix(sites): don't ask for a project name twice when left blank
  • fix(database): don't prompt to overwrite files without a TTY
  • fix(recipes): don't prompt for a typo suggestion without a TTY
  • feat: swap inquirer for clack
  • fix: exit 4 instead of hanging when stdin closes mid-prompt

@coderabbitai

coderabbitai Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

📊 Benchmark results

Comparing with 638123c

  • Dependency count: 943 ⬇️ 2.65% decrease vs. 638123c
  • Package size: 361 MB ⬇️ 0.53% decrease vs. 638123c
  • Number of ts-expect-error directives: 271 ⬇️ 3.69% decrease vs. 638123c

@pkg-pr-new

pkg-pr-new Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 895bc13

Add a bunch of missing coverage for interactive prompts, in preparation for swapping the underlying
implementation.
`completion:install` prepended the compinit line from inside an un-awaited `fs.readFile` callback, so
it logged success before anything was written, and a failed read would have written `undefined` into
~/.zshrc.
The netlify.toml append wasn't awaited, so a write failure escaped the surrounding try/catch and we
logged that the route was registered regardless.
It subtracted two objects, which is always `NaN`, which `sort` treats as `0` anyway. The comment
justifying it was about Node 10.
A failed install skipped the handler that prints manual install instructions.
Leaving the name blank is supposed to get you a random one, but `sites:create` passed the blank
answer back into the prompt helper, which treated it as missing and asked again.
`database init` asked whether to overwrite an existing drizzle.config.ts or db/schema.ts even with
`--yes` or without a TTY, where nothing can answer. Now `--yes` overwrites, and a non-interactive run
leaves the file alone and says so.
`recipes <typo>` prompted "Did you mean …?" even when nothing could answer, so in CI it sat there
for the full 10s timeout, then exited 0. It now prints the suggestion to stderr and exits 2 without a
TTY, and exits 2 when the suggestion is declined, like the top-level did-you-mean.
Every prompt now goes through a small wrapper around @clack/prompts in `src/utils/prompts`. It handles
the stuff each call site used to handle (or not) on its own:

- Ctrl+C or Esc prints "Cancelled." and exits 130, after running any shutdown work a command already
  registered (e.g. `netlify dev`'s database)
- piped stdin works: a line feed submits, and stdin is released afterwards so the process can exit
- confirms take a `timeout` after which they count as declined (the did-you-mean prompts use this)
- `defaultValue` doubles as the placeholder, and it's what gets validated when the input is left empty
- autocomplete filters on what's displayed (label and hint), not on the stringified value

Importing @clack/prompts anywhere else is now a lint error.

The prompts look and behave a bit differently, on purpose: confirms submit on `y`/`n` without Enter,
select options show details as hints instead of `name - url` labels, and `env:list` prints revealed
values below the table instead of redrawing it in place.

Also drops @inquirer/prompts, fuzzy, log-update and ansi-escapes, and pins `TERM`
in tests so snapshots don't depend on the terminal they were recorded in.
A prompt reading from a stdin that had already closed (`</dev/null`, a script whose pipe ended, an
agent) waited forever. It now says which prompt went unanswered and exits 4, the "needs-input" code
`--help` already advertises. An answer that arrives in the same final chunk as the end of input still
counts.
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.

1 participant