Sign in

    noctui

    A MoonBit-first toolkit for cooking up terminal UIs (ratatui/Charm-style).

    tui
    terminal
    ui
    ratatui
    cli
    Download zip
    Author
    Version
    0.1.0
    License
    MIT
    Last updated
    1 hour ago
    Downloads
    1

    No dependencies

    #Noctui

    A MoonBit toolkit for cooking up terminal UIs.

    The MoonBit counterpart to Rust's ratatui and Go's Charm.

    #Overview

    Noctui's UI model and reusable rendering core are written in MoonBit, without a binding to a foreign UI runtime such as OpenTUI. Native terminal integration isolates unavoidable operating-system interaction behind a narrow platform adapter so it does not leak into application, View, or component APIs.

    Noctui treats ordinary CLI output, interactive prompts, and full-screen TUIs as different surfaces over one terminal UI foundation. They can share logical styles, Unicode and layout rules, renderer-neutral Views, and semantic components without sharing one event loop or terminal lifecycle:

    • ordinary CLI output renders a View to ANSI text and writes it without starting an interactive runtime;
    • a prompt adds question flow, input, validation, redraw, and cleanup around the shared presentation contracts; and
    • a full-screen TUI adds application state, events, frame rendering, buffer diffing, and terminal-session ownership.

    The three surfaces are therefore neither separate products nor three identical runtimes. Noctui keeps reusable presentation below them and puts interaction and resource ownership in the surface that needs it. This lets a CLI grow from styled output to prompts or a full-screen interface without defining its styles, text semantics, and common components again.

    Developers changing Noctui should start with the repository architecture. The implemented interactive Application and Runtime contract is defined in the TUI architecture.

    #Motivation

    There is no MoonBit-first TUI toolkit comparable to ratatui or Charm. The one existing terminal-UI option, onebit-tui, is a binding to OpenTUI rather than a pure-MoonBit library.

    Noctui exists to fill that gap: a from-scratch foundation whose semantic and rendering layers are pure MoonBit. Narrow platform packages provide the unavoidable Node.js 22 and native POSIX terminal integration. Selecting MoonBit's JavaScript backend does not by itself select a JavaScript host: Noctui's JavaScript terminal and standard-stream packages are explicitly Node packages and do not claim browser, Deno, or Bun support.

    #Notes

    • Name — coined by truncating noctuid (the night moths), which naturally embeds "tui" the way ratatouille → ratatui does. The "noct-" (night) root also evokes the terminal: a dark screen you work against.
    • Design — the renderer-neutral core and TUI Application/Runtime are implemented and documented. Target entry packages expose blocking native execution and host-managed Node execution over the same runtime semantics.

    #Examples

    The examples index is a runnable path from a minimal rendered View through styling, layout, reusable components, and full-screen terminal applications on the native and Node.js hosts. It also documents the Node runtime lifecycle example and its automated PTY smoke scenario.