v0.5.5 · open source · MIT
Terminal UIs as documents.
Write .tui and .tcss, let any language drive it, let agents design it.
Structure is markup, style is a small CSS, data is JSON, and behavior is named actions. One runtime lays it out on a cell grid, paints it, and prints any frame as JSON, so a coding agent can check what it built without seeing a screen.
<tui>
<style src="theme.tcss"/>
<keymap>
<bind keys="enter" action="deploy" when="#services:focus" label="deploy"/>
<bind keys="q" action="quit" label="quit"/>
</keymap>
<screen focus="#services">
<row id="body">
<list id="services" title="services" each="services as s" key="s.id"
bind="selected" on:select="show">
<item class:down="s.down"><text>● {s.name}</text></item>
</list>
<col id="detail" title="{current.name}">
<text class="status" class:down="current.down" class:busy="current.busy">{current.status}</text>
<text class="meta">{current.version} · {current.region}</text>
<progress bind="current.rollout"/>
<sparkline id="p99" bind="current.latency" min="0"/>
</col>
</row>
<hints/>
</screen>
</tui>#body { gap: 1; }
#services { width: 24; border: rounded; border-color: $border; }
#services:focus { border-color: $focus; }
#services > item.down { color: $danger; }
#detail { width: 1fr; border: rounded; border-color: $border; padding: 0 1; gap: 1; }
.status { color: $ok; bold: true; }
.status.down { color: $danger; }
.status.busy { color: $warn; }
.meta { color: $muted; wrap: truncate; }
progress { bar: eighths; color: $accent; }
#p99 { height: 1fr; color: $accent; }
.hint-key { color: $accent; bold: true; }
hints { height: 1; }{
"selected": "api",
"services": [
{ "id": "api", "name": "api-gateway", "down": false },
{ "id": "auth", "name": "auth", "down": false },
{ "id": "billing", "name": "billing", "down": true },
{ "id": "search", "name": "search", "down": false },
{ "id": "web", "name": "web", "down": false }
],
"current": {
"name": "api-gateway",
"status": "● healthy",
"version": "v2.14.0",
"region": "eu-west-1",
"rollout": 100,
"down": false,
"busy": false,
"latency": [40, 40, 48, 44, 50, 49, 46, 51, 45, 48, 43, 41, 42, 45, 35, 34, 37, 39, 34, 32, 39, 29, 40, 35, 36, 38, 42, 49, 44, 50, 52, 50, 51, 46, 44, 44, 48, 43, 39, 40, 37, 33, 37, 35, 30, 34, 34, 39, 40, 37, 47, 40, 45, 50, 45, 50]
}
}- 1 show services
{"s":"auth"} null - 3 show services
{"s":"billing"} null - 5 deploy services
{"s":"billing"} null
The terminal is tuimark play replaying ↓ ↓ enter against these three files. The list fires show, the keymap fires deploy, and the script answers them the way a host would, with set.
Install
Install a release with Homebrew
The cask picks the right build for macOS or Linux on Apple Silicon, Intel, or ARM64. The tap is added for you.
brew install --cask abdul-hamid-achik/tap/tuimark- 01Check it
tuimark version - 02Start a project
tuimark new my-app - 03Brief your agent
tuimark agents
01 · a closed vocabulary
Small enough for an agent to hold.
33 tags, 35 CSS properties, and 42 diagnostic codes, and nothing else. An invented tag is V001, not a new widget; an invented property is V003. There are no expressions in markup: computed values come from the data.
- <tui>
- <style>
- <keymap>
- <bind>
- <screen>
- <col>
- <row>
- <box>
- <scroll>
- <spacer>
- <tabs>
- <tab>
- <text>
- <rule>
- <sparkline>
- <hints>
- <list>
- <item>
- <input>
- <button>
- <progress>
- <table>
- <column>
- <checkbox>
- <select>
- <modal>
- <include>
- <fragment>
- <template>
- <use>
- <slot>
- <img>
- <textarea>
The whole language, as a briefing your agent reads before it writes a line: what to edit, the loop, every tag and the attributes it takes, every property and its values, the key tokens, every diagnostic.
It is generated from the runtime’s own catalogs, so it always matches the binary that printed it. Editors and tools read the same vocabulary as JSON from tuimark catalog.
tuimark agents > AGENTS.md02 · the loop
Validate, dump, play. Repeat.
An agent cannot look at a terminal, so Tuimark gives it the frame as data. It edits the files, renders them at 80 and 120 columns, reads back exactly what is on screen, and replays the keys a person would press.
- 1 validate
tuimark validate app.tui --data sample.jsonEvery problem is a code with a position: V for parse, L for layout, B for bindings.
- 2 dump
tuimark dump app.tui --data sample.json --cols 72 --format jsonThe frame as data: the text grid, every node’s rectangle, focus, and the errors.
- 3 play
tuimark play app.tui --data sample.json --input "down enter"Replay keys, typing, and clicks with no terminal, and read which actions fired.
{
"cols": 72, "rows": 16, "ok": true, "focus": "services", "errors": [],
"nodes": [
{"id": "body", "tag": "row", "x": 0, "y": 0, "w": 72, "h": 15},
{"id": "services", "tag": "list", "x": 0, "y": 0, "w": 24, "h": 15, "focused": true, "scroll": {"y": 0, "h": 13}},
{"tag": "item", "x": 1, "y": 1, "w": 22, "h": 1, "key": "api", "selected": true},
{"id": "detail", "tag": "col", "x": 25, "y": 0, "w": 47, "h": 15},
{"id": "p99", "tag": "sparkline", "x": 27, "y": 7, "w": 43, "h": 7},
… 20 more
],
"grid": ["╭─ services ───────────╮ ╭…", … 15 more rows]
}1 show services {"s":"auth"} null
3 show services {"s":"billing"} null
5 deploy services {"s":"billing"} null03 · any language
Your program answers actions. Tuimark does the rest.
The host binds data and handles the action names the document fires. Layout, focus, keys, the mouse, colors, and the terminal stay in the runtime, whether the host is Go, TypeScript, or anything that writes JSON lines.
ui, err := tuimark.Load("app.tui")
if err != nil {
log.Fatal(err)
}
ui.Bind("", fleet.Snapshot())
ui.On("show", func(ev tuimark.Event) error {
return ui.Set("current", fleet.Detail(ev.Keys["s"]))
})
ui.On("deploy", func(ev tuimark.Event) error {
go fleet.Deploy(ev.Keys["s"], func(pct int) {
ui.Set("current.rollout", pct)
})
return nil
})
log.Fatal(ui.Run(os.Stdout))import { spawnHost } from "@thelacanians/tuimark";
const ui = await spawnHost("app.tui", { data: fleet.snapshot() });
ui.on("show", async (ev) => {
await ui.set("current", await fleet.detail(ev.keys.s));
});
ui.on("deploy", (ev) => {
fleet.deploy(ev.keys.s, (pct) => ui.set("current.rollout", pct));
});
process.exit((await ui.exited).code);# tuimark host app.tui fd 4: tuimark -> you, fd 3: you -> tuimark
<- {"type":"ready","protocol":1,"cols":72,"rows":16,"theme":"dark",…}
<- {"type":"event","seq":1,"action":"show","source":"services","keys":{"s":"auth"},"value":null}
-> {"type":"set","path":"current","value":{"name":"auth","status":"● healthy",…}}
-> {"type":"reply","seq":1}
<- {"type":"event","seq":2,"action":"deploy","source":"services","keys":{"s":"billing"},"value":null}
-> {"type":"reply","seq":2}
-> {"type":"set","path":"current.rollout","value":41}The runtime
- layout, sizes, wrapping, and truncation
- focus, the keymap, and the mouse
- colors, light and dark themes
- terminal modes, resizes, and redraws
Your host
- binds the data
- answers the actions the document names
- writes changes back with set
In Go it is a library; from Bun, @thelacanians/tuimark; from anything else, tuimark host speaks JSON lines on two file descriptors.
04 · the kit
Components you copy and own.
Buttons, cards, alerts, a data table, a command palette, dialogs, toasts, and more, as one file of templates you include and two stylesheets. Like shadcn, you copy the kit into your project: no package, no new tags, every color a token you can rebrand. Small helpers in Go and TypeScript do the host’s part: toasts that expire, form validation, dialog routing, the palette’s filter.
examples/kit-gallery: every component on six tabs, in the kit’s dark and light themes.Every component, pictured The kit guide Helpers The gallery app
05 · agents and editors
The same loop over MCP, the same checks as you type.
One binary carries an MCP server for agents without a shell and a language server for your editor. Both run the code the CLI runs, so they never disagree with it.
Five read-only tools: tuimark_validate, tuimark_dump, tuimark_play, tuimark_inspect, and tuimark_agents. Each returns exactly what its command prints.
claude mcp add tuimark -- tuimark mcp{
"mcpServers": {
"tuimark": { "command": "tuimark", "args": ["mcp"] }
}
}tuimark lsp shows validate’s diagnostics as you type, with a sample.json beside the document as data, and adds completion, hover, go to definition, and formatting from the catalog.
- VS Code extension: highlighting and snippets for .tui and .tcss
- an unknown tag or property is marked while you type
- Neovim, Helix, or any LSP client: run tuimark lsp
06 · examples
Real apps, the same few files.
Every example in the repository is a .tui, a .tcss, and sample data, with a small host. Every picture here is rendered from tuimark play output; press play on the demos.
monitor studio
Nine tabs, a sortable process table with multi-select, gauges and sparklines.
containers
A container dashboard built on the kit: a filterable table, a detail pane, dialogs, and a palette.
agent
A coding-agent chat: transcript, composer, tool activity, and approvals.
gitui
Staged and unstaged files beside a colored diff, a log, and commit details.
http
A request collection, an editor, and the response with its headers.
logs
A live tail with per-level counts and a lines-per-second sparkline.
tasks
A kanban board with lanes, priorities, tags, and cards you move together.
pipeline
CI jobs in parallel with spinners and progress, a failure, and a retry.
music
A player with a spectrum visualizer, a position bar, and a queue.
kit gallery
Every kit component on six tabs; here a focused data table over a build log.
snake
The classic, on an autopilot, with the score and speed climbing.
tetris
Falling pieces, line clears, and a next-piece preview.
chess
A famous game replayed move by move, with the move list.
2048
Sliding tiles that merge and pop, and a climbing score.
minesweeper
A solver flagging mines and opening safe cells.
sudoku
A logic solver filling a puzzle digit by digit.
pomodoro
Big block digits counting down a work session.
spike
Where it started: five tags, two bordered boxes, and a status line.
Write your first screen.
tuimark new writes a project with a document, a stylesheet, sample data, and an AGENTS.md. Hand it to your agent, or open it yourself.
brew install --cask abdul-hamid-achik/tap/tuimarktuimark new my-app && cd my-app && tuimark run app.tui --data sample.json