dcli 0.2.0-rc.4

This is a prerelease version of dcli.
dotnet add package dcli --version 0.2.0-rc.4
                    
NuGet\Install-Package dcli -Version 0.2.0-rc.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="dcli" Version="0.2.0-rc.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="dcli" Version="0.2.0-rc.4" />
                    
Directory.Packages.props
<PackageReference Include="dcli" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add dcli --version 0.2.0-rc.4
                    
#r "nuget: dcli, 0.2.0-rc.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package dcli@0.2.0-rc.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=dcli&version=0.2.0-rc.4&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=dcli&version=0.2.0-rc.4&prerelease
                    
Install as a Cake Tool

dcli

dcli is a C#/.NET (net10.0) inline terminal-rendering library. Styled output flows into the terminal's native scrollback — not an alternate screen — while a small interactive region (input editor, status bar, and dropdown overlays) stays pinned at the bottom. The design is modelled on the rendering style used by Claude Code and similar AI-driven CLI tools.

dcli is a mechanics-and-rendering library. It owns the raw-mode session, the render loop, and the widget layer. The calling application owns data, semantics, and any application protocol.

Requirements

  • .NET 10.0 or later
  • A modern VT-capable terminal:
    • macOS: Terminal.app, iTerm2, Ghostty
    • Windows: Windows Terminal (legacy conhost.exe is not supported)
    • Linux: xterm, xterm-256color, or any xterm-class terminal emulator
  • The process must be attached to a real tty (not redirected to a file or pipe)

Quick start

using Dcli;

// Enter raw mode and start the render loop.
await using Terminal t = await Terminal.StartAsync(new TerminalOptions());

// Append a styled line to the scrollback.
Line greeting = new LineBuilder()
    .Bold("dcli")
    .Text(" — inline terminal rendering")
    .Build();
t.Scrollback.Append(greeting);

// Set a status bar message.
t.Status.SetRows(new LineBuilder().Dim("Press Enter to continue…").Build());

// Ask the user to pick from a list (blocks until the user submits or cancels).
DialogResult<int> result = await t.SelectAsync(
    new SelectRequest(
        Items: ["Option A", "Option B", "Option C"]
            .Select(s => new LineBuilder().Text(s).Build())
            .ToList()),
    cancellationToken: default);

if (result.Outcome == DialogOutcome.Submitted)
{
    t.Scrollback.Append(new LineBuilder()
        .Text($"Selected index: {result.Value}")
        .Build());
}

// DisposeAsync stops the loop and restores the terminal.

Terminal restore is guaranteed on every exit path: normal disposal, unhandled exceptions, and OS signals (SIGTERM/SIGINT on POSIX, process-exit events on Windows).

Public surface

Entry point

Type Purpose
Terminal Concrete lifecycle handle; obtain via Terminal.StartAsync(...).
ITerminal Interface the application should depend on (allows headless fakes in tests).
TerminalOptions Configuration passed to StartAsync (max fixed-region height, frame interval).
TerminalNotSupportedException Thrown by StartAsync when the environment is not VT-capable.

Sub-surfaces (accessed via ITerminal)

Property Interface Purpose
Scrollback IScrollback Append lines, live blocks, and collapsibles.
Input IInput Programmatic text control of the input editor.
Status IStatus Set the status bar rows at the bottom of the fixed region.
Autocomplete IAutocomplete Show and hide the completion dropdown overlay.

Dialogs (methods on ITerminal)

Method Returns Description
SelectAsync DialogResult<int> Single-select list; result is the zero-based selected index.
MultiSelectAsync DialogResult<int[]> Multi-select list; result is the checked indices in ascending order.
ChoiceAsync DialogResult<int> Single-select with an explanatory prompt row.
InputAsync DialogResult<string> Free-text entry dialog, with optional masking for secrets.

All dialogs return DialogOutcome.Submitted on confirmation or DialogOutcome.Cancelled on Escape or cancellation-token cancellation.

Events

Drain ITerminal.Events (ChannelReader<TerminalEvent>) on a background task. Event types:

Type Description
InputSubmitted User pressed Enter; carries the submitted text.
InputChanged Input buffer changed; carries the current text.
KeyPressed A key not consumed by the editor was forwarded to the consumer.
Resized Terminal was resized; carries the new column and row counts.

Styled-text primitives

Type Description
Line Immutable ordered list of Segments forming one logical line.
Segment Immutable run of literal text with a single Style applied.
Style Optional foreground/background Color plus Format flags.
Color Discriminated color: 16 named ANSI, 256-palette index, or 24-bit RGB.
Format [Flags] enum: Bold, Italic, Underline, Dim, Reverse, Strikethrough.
LineBuilder Fluent builder for constructing a Line from styled fragments.

Scrollback handle types

Type Description
ILiveBlock Handle for an in-progress mutable scrollback block (BeginLive).
ICollapsible Handle for a collapsible block that can be expanded once (BeginCollapsible).

Input event types

Type Description
KeyEvent A decoded key press: a KeyCode (Unicode scalar or NamedKey) plus Modifiers.
PasteEvent A bracketed-paste block decoded from UTF-8.
ResizeEvent A terminal resize (not emitted to the consumer; use the Resized terminal event).
NamedKey Enum of non-printable keys: arrows, F-keys, Tab, Enter, Escape, etc.
Modifiers Flags enum: Ctrl, Alt, Shift.
AutocompleteCandidate A completion candidate with display Line and InsertText to apply on accept.

Testing

The companion Dcli.Testing package ships a headless harness — HeadlessTerminal — that runs the full render engine, input parser, and fixed-region composer against in-memory OS edges, so you can drive and assert on terminal UIs without a real tty. See the testing guide.

Documentation

Full guides and a complete API reference live on GitHub: https://github.com/daemonicai/dcli#documentation

License

Mozilla Public License 2.0

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on dcli:

Package Downloads
dcli.testing

Headless test harness for the dcli inline terminal-rendering library.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0-rc.4 0 5/31/2026
0.2.0-rc.2 54 5/28/2026

- Inline scrollback rendering: styled output flows into native terminal scrollback with a pinned interactive region.
- Awaitable modal dialogs: SelectAsync, MultiSelectAsync, ChoiceAsync, InputAsync.
- Scrollback model: append lines, live mutable blocks, and one-way collapsibles.
- Autocomplete dropdown overlay with whole-buffer-replace candidate acceptance.
- Raw-mode VT input pipeline: own termios/Win32 shims, VtInputParser, bracketed-paste, SIGWINCH resize. Validated on macOS.