nimterm
Terminal UI primitives for Nim applications and agent frontends. Compose a widget tree, run it in the terminal, and ship it as a native binary.
Summary
| Latest Version | Unknown |
|---|---|
| License | MIT |
| CI Status | Failing |
| Stars | 0 |
| Forks | 0 |
| Open Issues | 0 |
| Last Commit | 2026-09-18 |
| Downloads | 0 |
| Last Indexed | 2026-09-21 06:38 |
Tags
Installation
nimble install nimterm
choosenim install nimterm
git clone https://github.com/martineastwood/nimterm
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| nimterm | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Source
| Repository | https://github.com/martineastwood/nimterm |
|---|---|
| Homepage | https://nimterm.niminal.dev |
| Registry Source | github |
README
nimterm
Terminal UI primitives for Nim applications and agent frontends. Compose a widget tree, run it in the terminal, and ship it as a native binary.
nimterm is built for apps that stream model output, show tool calls, collect approvals, and ask for the occasional decision. It does not call models or depend on nimgent. Adapt any AI SDK, subprocess, or remote service to the event vocabulary and render it.
Install
You need Nim 2.0 or later:
nimble install nimterm
Hello, terminal
Create hello.nim:
import nimterm
let screen = newPanel(
newText("Hello from nimterm"),
title = "Welcome")
var app = newApp(newPlatformBackend(fullscreen = false), screen)
app.run()
Compile and run from an interactive terminal:
nim c -r hello.nim
Use fullscreen = false to keep completed output in shell scrollback. Omit it
or set it to true for the alternate screen.
Collect input
Stack widgets in a column and handle the action a widget emits:
import nimterm
let input = newInput(prefix = "Say: ")
let screen = newColumn(@[
Widget(newCard("nimterm", "Type a message, then press Enter.")),
Widget(input)])
var app = newApp(newPlatformBackend(fullscreen = false), screen)
app.onAction = proc (app: var App, action: UiAction) =
if action.kind == "submit":
app.running = false
echo "You entered: " & action.value
app.run()
Pick from a menu
Menus emit a select action when the user presses Enter:
import nimterm
let menu = newMenu(@[
MenuItem(label: "Continue", description: "Keep working"),
MenuItem(label: "Quit", description: "Close the app")])
var app = newApp(newPlatformBackend(), menu)
app.onAction = proc (app: var App, action: UiAction) =
if action.kind == "select" and action.index == 1:
app.running = false
app.run()
Stream an agent transcript
Feed lifecycle events into a retained transcript widget. No provider SDK required:
import nimterm
let transcript = newTranscript()
let view = newTranscriptWidget(transcript)
var app = newApp(newPlatformBackend(fullscreen = false), view)
app.onEvent = proc (app: var App, event: UiEvent): EventResponse =
if event.kind == uiAgent:
view.apply(event.agent)
app.invalidate()
return eventHandled
eventIgnored
app.run()
The transcript renders thinking, assistant text, tool calls, approvals, and diffs as they arrive. nimlet uses this path for its interactive terminal app.
What you get
- Widgets for agent UIs: transcripts, panels, cards, input, menus, questions, Markdown, and diffs.
- A small application loop:
newApp, normalizedUiEventvalues, andUiActionresults from widgets. - Testable rendering: measure, lay out, and paint onto a canvas you can assert on without a live terminal.
- Themes and text layout: semantic styles, ANSI-aware width, wrapping, and built-in dark and light palettes.
- POSIX and Windows backends:
newPlatformBackendselects the native terminal bridge at compile time.
Documentation
Full documentation lives at nimterm.niminal.dev.
- Introduction
- Quickstart
- Widgets
- Agent frontends
- Input and events
- Styling and themes
- Testing
- Core API
License
MIT. See LICENSE.