DRAFT: Prompt: Esc is ignored — only Ctrl-C/Ctrl-D cancel a prompt
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- node.js, typescript
- 領域
- cli
調査の方向性
Start with packages/effect/src/cli/Prompt.ts:3615-3642 and inspect handleSelectProcess alongside the other prompt process handlers. Read packages/platform/node-shared/src/NodeTerminal.ts:176-178 and verify the existing escape key behavior with the provided pseudo-terminal reproduction. Done should establish the intended Esc behavior and reflect it consistently in the relevant prompt handling or documentation, with coverage where the repository provides an appropriate test location.
索引モデルが issue の本文から書いたものです。
説明
We use Prompt in interactive CLIs and noticed that Esc does nothing in a prompt. We aren't sure whether that's intended.
What we observed
Pressing Esc in a Prompt.Select beeps (\x07), and the prompt keeps waiting. Enter then submits the highlighted choice. The only ways to back out of a prompt are Ctrl-C and Ctrl-D, which surface as Terminal.QuitError. Some other terminal prompt libraries treat Esc as cancel, so users try it and nothing happens.
Environment: [email protected] (tag [email protected], ad61db8) and @effect/[email protected], on Node 26.10.0 and macOS. From reading the source, the same lines are unchanged on main at 8b0eac6 (packages/effect/src/cli/Prompt.ts:3615-3642).
Reproduction
import * as NodeRuntime from "@effect/platform-node/NodeRuntime"
import * as NodeServices from "@effect/platform-node/NodeServices"
import { Console, Effect } from "effect"
import { Prompt } from "effect/cli"
const pick = Prompt.Select({
message: "Pick one",
choices: [{ title: "a", value: "a" }, { title: "b", value: "b" }]
})
Prompt.run(pick).pipe(
Effect.flatMap((value) => Console.log(`\nselected: ${value}`)),
Effect.catchTag("QuitError", () => Console.log("\nQuitError")),
Effect.provide(NodeServices.layer),
NodeRuntime.runMain
)
We ran node repro.ts under a pseudo-terminal, sent keystrokes to it, and captured the raw output live (escape bytes shown escaped).
Esc, then Enter half a second later. The \x07 after the first frame is the beep for Esc; the prompt then submits a:
\x1b[?25l\x1b[96m?\x1b[0m \x1b[1mPick one\x1b[0m \x1b[90m›\x1b[0m \r\n\x1b[96m❯\x1b[0m \x1b[4m\x1b[96ma\x1b[0m \r\n b \x07\x1b[2K\x1b[1G\x1b[2K\x1b[G\x1b[32m✔\x1b[0m \x1b[1mPick one\x1b[0m \x1b[90m…\x1b[0m \x1b[37ma\x1b[0m\r\n\x1b[?25h\r\nselected: a\r\n
The control, Ctrl-C:
\x1b[?25l\x1b[96m?\x1b[0m \x1b[1mPick one\x1b[0m \x1b[90m›\x1b[0m \r\n\x1b[96m❯\x1b[0m \x1b[4m\x1b[96ma\x1b[0m \r\n b \x07\x1b[?25h\r\nQuitError\r\n
The key does reach the prompt. Reading one event from Terminal.readInput under the same pseudo-terminal and pressing Esc prints key.name="escape".
Where it happens
Prompt.ts:3615-3642:handleSelectProcesshas no"escape"case, so the key falls todefault, which returnsAction.Beep(). The other built-in prompts'processhandlers have no"escape"case either;grep -n escape packages/effect/src/cli/Prompt.tsfinds nothing.NodeTerminal.ts:176-178: the defaultshouldQuitends input on Ctrl-C or Ctrl-D only.
Is this intended?
If Esc is left unbound on purpose, for example to leave it free for a future use, a line in the Prompt docs would help users. If not, one possible direction is to treat "escape" like Ctrl-C and fail with QuitError. Existing handling of cancellation, such as Flag.withFallbackPrompt re-failing with the original missing-option error, would then apply to it unchanged. Another is a Prompt option that opts into this behaviour. readline's escapeCodeTimeout: 50 in NodeTerminal already separates a lone Esc from the start of an arrow-key sequence, as the key.name check above shows.
- 主要言語
- TypeScript
- スター
- 16.7k
- フォーク
- 808
- 平均マージ
- 10時間 17分
- マージ済み PR(30日)
- 850
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Effect-TS/effect のほかの issue
-
[email protected]: crypto declarations require a global CryptoKey type, breaking Node-only type-checks with @types/node 22 and 24対応中かも @effect-bot が今日担当しました。 オープンbug
Effect-TS/effect#10196 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
OpenApi.fromApi (4.1.0) emits duplicate component schemas with a _1 suffix when the encoded side differs再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 47/100
メンテナーはふだん 1 日以内に返信
-
`fromJsonSchemaDocument`: import open `patternProperties`対応中かも @effect-bot が 2 日前に担当しました。 オープン
Effect-TS/effect#10048 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
Effect-TS/effect の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
components-web-app/docs#307 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
localstack/localstack-mcp-server#112 ·
メンテナーはふだん 1 日以内に返信
-
area:frontend kind:bug priority:p1 ready
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
bug ready-for-agent
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
PhyberApex/kuroshiro#1687 ·
メンテナーはふだん 1 日以内に返信
-
Performance (Web Vitals) collector: LCP/FCP from background tabs are not discarded, inflating p75オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
umami-software/umami#4720 ·
メンテナーはふだん 3 日以内に返信