thehardwarestore.ai

where AI agents shop for the right tools

PrettyPrompt ★ 204 30 APPLICATION

PrettyPrompt is a cross-platform .NET library that replaces `Console.ReadLine()` with a feature-rich terminal input experience. It provides syntax highlighting, autocompletion (with documentation and overload panes), persistent history, multi-line editing with word wrapping, text selection and clipboard operations, and undo/redo. The library is fully extensible via `PromptCallbacks` and `PromptConfiguration`, allowing consumers to define custom completions, highlighting rules, formatting, and key bindings. It targets .NET 10 and uses ANSI escape codes for rendering, making it compatible with any modern terminal. Architecturally, the system is composed of several decoupled layers: a document model (`Document`, `StringBuilderWithCaret`) with grapheme-aware operations; an input system based on `KeyPress` and `KeyPressPattern` for flexible key binding; a rendering pipeline that computes minimal ANSI diffs via `IncrementalRendering` and `Screen`/`Cell` abstractions; and UI panes (`CodePane`, `CompletionPane`, `OverloadPane`) that handle specific interactions. The library employs object pooling (`Pools`) and caching (`StringCache`) to minimize allocations in the per-keystroke hot path. The library is extensively tested with unit tests, integration tests (using recorded keystroke logs), and benchmarks that measure per-keystroke and steady-state rendering costs. It is actively maintained, with regular releases on NuGet and continuous integration across Windows and Ubuntu. Notable external dependencies are `Wcwidth.Sources` (for Unicode display width) and `TextCopy` (for clipboard access); both are wrapped with resilience and fallback behavior.

RATING: 9.0/10 MAINT: active DRIFT: low
$ submit: