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>
$ tuimark play app.tui --data sample.json --cols 72 --rows 16 --script hero.ndjson --frames72×16
a service list and a detail pane: the cursor moves to a failing service, enter fires deploy, and the rollout bar fills as its latency comes back downa service list and a detail pane: the cursor moves to a failing service, enter fires deploy, and the rollout bar fills as its latency comes back downa service list and a detail pane: the cursor moves to a failing service, enter fires deploy, and the rollout bar fills as its latency comes back downa service list and a detail pane: the cursor moves to a failing service, enter fires deploy, and the rollout bar fills as its latency comes back down
events what your host receives
  1. 1 show services {"s":"auth"} null
  2. 3 show services {"s":"billing"} null
  3. 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
  1. 01
    Check ittuimark version
  2. 02
    Start a projecttuimark new my-app
  3. 03
    Brief your agenttuimark 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.

document
  • <tui>
  • <style>
  • <keymap>
  • <bind>
  • <screen>
layout
  • <col>
  • <row>
  • <box>
  • <scroll>
  • <spacer>
  • <tabs>
  • <tab>
content
  • <text>
  • <rule>
  • <sparkline>
  • <hints>
interactive
  • <list>
  • <item>
  • <input>
  • <button>
  • <progress>
  • <table>
  • <column>
  • <checkbox>
  • <select>
overlay
  • <modal>
composition
  • <include>
  • <fragment>
  • <template>
  • <use>
  • <slot>
more
  • <img>
  • <textarea>
tuimark agents > AGENTS.md

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.md

Tags and attributes CSS properties Diagnostics

02 · 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. 1 validatetuimark validate app.tui --data sample.json

    Every problem is a code with a position: V for parse, L for layout, B for bindings.

  2. 2 dumptuimark dump app.tui --data sample.json --cols 72 --format json

    The frame as data: the text grid, every node’s rectangle, focus, and the errors.

  3. 3 playtuimark play app.tui --data sample.json --input "down enter"

    Replay keys, typing, and clicks with no terminal, and read which actions fired.

dump --format json excerpt
{
  "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]
}
play: events step · action · source · keys · value
1 show services {"s":"auth"} null
3 show services {"s":"billing"} null
5 deploy services {"s":"billing"} null

The authoring loop Dumps and tools Golden tests

03 · 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))
who does what

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.

Go API TypeScript client Host protocol

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.

$ tuimark play examples/kit-gallery/app.tui --data examples/kit-gallery/sample.json --cols 110 --rows 30110×30
kit gallery: the basics tab with a breadcrumb, badges, buttons, alerts and stat cards in the kit components, under the tab strip and the key hintskit gallery: the basics tab with a breadcrumb, badges, buttons, alerts and stat cards in the kit components, under the tab strip and the key hints
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.

tuimark mcp

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"] }
  }
}

MCP server

tuimark lsp · VS Code

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

Editors

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.

All examples

▸ next

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/tuimark
tuimark new my-app && cd my-app && tuimark run app.tui --data sample.json