Skip to content

[P2] Early input capture during REPL init / 启动期间用户输入捕获 #3224

@doudouOUC

Description

@doudouOUC

Priority: P2
Category: performance, ui
Parent: #3011

Problem / 问题

User keystrokes typed during REPL initialization (200-500ms) are lost. Users must wait for the prompt to appear before typing.

REPL 初始化期间(200-500ms)用户输入丢失,必须等待提示符出现后才能输入。

Proposed Solution / 方案

  1. Add packages/cli/src/utils/earlyInput.ts:
    • startCapturingEarlyInput(): enables raw stdin buffering
    • drainEarlyInput(): returns buffered input and stops capturing
  2. Call startCapturingEarlyInput() at the very beginning of main() (before any async work)
  3. Pass buffered input to REPL on render

Reference: Claude Code src/utils/earlyInput.ts — same pattern.

Acceptance Criteria / 验收标准

  • Keystrokes typed during startup appear in REPL input after render
  • No input loss for fast typists
  • No impact on non-interactive mode (stdin pipe)

Metadata

Metadata

Assignees

Labels

category/performancePerformance and optimizationcategory/uiUser interface and displaypriority/P2Medium - Moderately impactful, noticeable problem

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions