Replace the unmaintained prompts library, behind a @docusaurus/prompts abstraction
@sameer727 がすでに取り組んでいます。
2026年11月21日 から。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- node.js, typescript
調査の方向性
Start by reading the listed prompt call sites: create-docusaurus, commands/swizzle/prompts.ts, and getHostPort, then inspect the draft migration in pull request #13017 for a reference. The issue proposes a typed @docusaurus/prompts package and shared handling for unanswered prompts, but leaves decisions open about public versus internal scope and end-to-end CI coverage; agree on those before implementation.
索引モデルが issue の本文から書いたものです。
説明
Motivation
Our CLIs use prompts for their interactive questions. It's unmaintained: its last release is v2.4.2 from October 2021, with 148 open issues.
We already hit its bugs:
- When stdin is closed (like in CI), a prompt never settles: Node exits with code 0 and
create-docusaurusdoesn't create the site (terkelg/prompts#316). https://github.com/meta/docusaurus/pull/13011 works around it with abeforeExitlistener. - Answers piped in a single chunk are all read by the first prompt (terkelg/prompts#427).
Where we use it
| Package | Prompts | Types |
|---|---|---|
create-docusaurus |
8 (site name, template, language, git URL, git strategy, custom git command, local path, package manager) | select, text with async validate |
@docusaurus/core swizzle (commands/swizzle/prompts.ts) |
5 (theme, component, danger, action, language) | select, autocomplete with a custom suggest; cancelling exits with code 0 |
@docusaurus/core getHostPort |
1 (use another port?) | confirm, only when process.stdout.isTTY |
Each call site uses the prompts API directly: answers read from an object with type casts, and its own onCancel. Swizzle probably has the same closed-stdin problem as create-docusaurus had.
Proposal: a @docusaurus/prompts abstraction
Create a small @docusaurus/prompts package that our CLIs use instead of a prompt library, keeping the library as an implementation detail:
const language = await askSelect({
message: 'Which language do you want to use?',
choices: [
{name: 'JavaScript', value: 'javascript'},
{name: 'TypeScript', value: 'typescript'},
],
// Named in the error when there is no answer (Ctrl+C, closed stdin)
answerHint: 'the --javascript or --typescript option',
});
- A few typed functions for what we use:
askSelect,askInput,askConfirm,askSearch(autocomplete). They return the answer directly, so no casts. - One consistent behavior when there is no answer (Ctrl+C, closed stdin, no TTY): exit with code 1 and an error that names the CLI argument or option to use instead.
- One place for library workarounds, like the
beforeExitlistener of https://github.com/meta/docusaurus/pull/13011. - Test helpers to answer the prompts, so tests don't depend on the library.
- Swapping the library later only touches this package.
We can do it in two steps: introduce the abstraction on top of prompts (no behavior change for the answered case), then pick another library if we want to.
Library options
Numbers as of November 2026:
prompts (current) |
Inquirer (@inquirer/select + @inquirer/input) |
@clack/prompts |
enquirer |
|
|---|---|---|---|---|
| GitHub stars | 9.3k | 21.6k | 8.1k | 8.0k |
| npm downloads/week | 90.9M | 61.2M (@inquirer/prompts) |
43.3M | 48.0M |
| Latest release | Oct 2021 | Nov 2026 | Nov 2026 | Jul 2023 |
| Releases in the last 12 months | 0 | 25 | 13 | 0 |
| Open issues | 148 | 18 | 95 | 207 |
| Installed packages | 3 | 12 | 6 | 4 |
| Max dependency depth | 2 | 5 | 5 | 3 |
| Closed stdin | exits with code 0 | rejects with ExitPromptError |
exits with code 0 | exits with code 0 |
| Autocomplete (swizzle) | autocomplete |
@inquirer/search |
autocomplete |
autocomplete |
| Module format | CJS | ESM | ESM | CJS |
Other possible solutions:
- Keep
promptsbehind the abstraction, with our workarounds. It's tiny and stable, and the abstraction removes most of the risk of keeping it. - Node's built-in
node:readline/promises: no dependency, but no select or autocomplete UI. The template and language choices would need a typed answer. - Our own minimal implementation of the 4 prompt types on top of
node:readline: no dependency, but more code to maintain (keypresses, rendering, Windows terminals).
Inquirer, an option to consider
It's actively maintained, typed, and split into small packages. It is the only library above that rejects when stdin is closed. https://github.com/meta/docusaurus/pull/13017 is a draft migration of create-docusaurus, as a reference.
Tradeoffs:
- Dependencies: 12 installed packages, 5 levels deep, from about 11 npm maintainer accounts, instead of 3 packages from 2 accounts. We should use the individual
@inquirer/*packages, never the@inquirer/promptsbundle (25 packages, includingiconv-litefor the editor prompt). - Closed stdin: Inquirer doesn't detect the end of stdin itself. It rejects from a
signal-exithook while the process exits, so it can't fall back to a default value at that point. - Ctrl+C: closed stdin and Ctrl+C throw the same
ExitPromptError, so a prompt can't keep a default value on Ctrl+C only. - Testing:
@inquirer/testingrenders prompts in a headless terminal and works well, but it declares 16 optional peer dependencies, includingvitest. In our monorepo, pnpm resolved them to a second copy ofviteandvitest. Our own test helpers would avoid it. - Look: the prompts render slightly differently.
@clack/prompts has the nicest UI but the same closed-stdin problem, and in our test it didn't read piped answers. enquirer has the same problem and is no more maintained than prompts.
Open questions
- A public package (like
@docusaurus/logger), so third-party plugins can use it in their CLI extensions, or an internal module first? - Should we test the closed-stdin behavior end to end in CI, for example by running the CLIs with
< /dev/nullintests-e2e.yml?
(AI-assisted)
- 主要言語
- TypeScript
- スター
- 66.6k
- フォーク
- 10.1k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
facebook/docusaurus のほかの issue
-
write heading ids modifies headings inside tilde and longer fenced code blocks対応中かも @VaibhavBajpaij が 6 日前に担当しました。 オープンbug status: needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
facebook/docusaurus#13061 · コメント 1 件 ·
-
Auto-generated description drops the text between two colons in the first paragraph対応中かも @0z5a が 6 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
facebook/docusaurus#13059 ·
-
Playground cards have inconsistent heights対応中かも @anishagrawal25 が 31 日前に担当しました。 オープンbug status: needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
facebook/docusaurus#12739 · コメント 1 件 ·
-
Page title drops a trailing # from the heading, e.g. # Learn C# becomes "Learn C" (AI-assisted)対応中かも @saiyam-jain-dev が 19 日前に担当しました。 オープンbug status: needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
facebook/docusaurus#12644 · コメント 1 件 ·
-
Firefox clips descenders in documentation sidebar labels on Windows対応中かも @xusnitdinov が 126 日前に担当しました。 オープンbug status: needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
facebook/docusaurus#12299 ·
facebook/docusaurus の issue をすべて見る
似ている issue
-
fix(resources): `flisk resources api` fails with a bare "too many arguments" and no hint; status, logs, down and networks already explain names are not positional対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンarea: cli beginner beginner friendly bug community difficulty: easy dx easy first-timers-only good first issue hacktoberfest help wanted low-hanging fruit mentor available priority: P3 severity: low tech: typescript testing up-for-grabs ux
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
backlog-skill cat:docs documentation effort:s ready-for-agent sev:low
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
LucasSantana-Dev/Lucky#3284 ·
メンテナーはふだん 1 日以内に返信
-
.aif still missing from the pipeline and library MIME maps, AUDIO_INPUTS, and search aliases対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンarea: backend bug priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
snapotter-hq/SnapOtter#5194 ·
メンテナーはふだん 1 日以内に返信
-
needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
homarr-labs/homarr#7671 ·
メンテナーはふだん 1 日以内に返信
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P3
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
openclaw/openclaw#203385 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信