Skip to content

CLI Reference

Complete reference for the Hex1b CLI tool (dotnet hex1b / hex1b).

For an introduction and usage guide, see CLI Tool.

Global Options

These options apply to all commands:

OptionTypeDescription
--jsonflagOutput results as JSON

terminal

Manage terminal lifecycle, metadata, and connections.

terminal list

List all known terminals.

bash
hex1b terminal list

Discovers terminals via their diagnostics sockets. Shows terminal ID, dimensions, process info, and recording status.

terminal start

Start a hosted terminal.

bash
hex1b terminal start [options] -- <command...>
ArgumentDescription
commandCommand and arguments to run (after --)
OptionTypeDefaultDescription
--widthint120Terminal width in columns
--heightint30Terminal height in rows
--cwdstringWorking directory for the command
--recordstringRecord session to an asciinema .cast file
--attachflagImmediately attach to the terminal after starting

Examples:

bash
# Start bash with default dimensions
hex1b terminal start -- bash

# Start htop in a custom-sized terminal
hex1b terminal start --width 160 --height 50 -- htop

# Start and attach immediately
hex1b terminal start --attach -- vim README.md

# Start with recording
hex1b terminal start --record session.cast -- bash

terminal stop

Stop a hosted terminal.

bash
hex1b terminal stop <id>
ArgumentDescription
idTerminal ID (or unique prefix)

terminal info

Show terminal details.

bash
hex1b terminal info <id>
ArgumentDescription
idTerminal ID (or unique prefix)

Returns terminal dimensions, cursor position, process information, recording status, and other metadata.

terminal attach

Attach to a terminal with an interactive TUI mirror.

bash
hex1b terminal attach <id> [options]
ArgumentDescription
idTerminal ID (or unique prefix)
OptionTypeDescription
--resizeflagResize remote terminal to match local terminal dimensions
--leadflagClaim resize leadership (only the leader's resize events control the remote terminal)
--webflagAttach via a web browser using xterm.js instead of the TUI
--portintPort for the web server (0 for random). Only used with --web

Examples:

bash
# Basic attach
hex1b terminal attach abc123

# Attach and resize the remote terminal to match
hex1b terminal attach abc123 --resize --lead

# Attach via web browser
hex1b terminal attach abc123 --web --port 8080

Keyboard shortcuts (TUI mode):

KeyAction
Ctrl+]Open command menu

terminal resize

Resize a terminal.

bash
hex1b terminal resize <id> [options]
ArgumentDescription
idTerminal ID (or unique prefix)
OptionTypeDescription
--widthintNew width in columns
--heightintNew height in rows

At least one of --width or --height must be specified.

terminal clean

Remove stale terminal sockets.

bash
hex1b terminal clean

Scans for diagnostics sockets that no longer have a running process and removes them.

terminal host

Run as a terminal host process (internal). This command is used internally by terminal start and is not intended for direct use.


capture

Capture terminal output including screenshots and recordings.

capture screenshot

Capture a terminal screen screenshot.

bash
hex1b capture screenshot <id> [options]
ArgumentDescription
idTerminal ID (or unique prefix)
OptionTypeDefaultDescription
--formatstringtextOutput format: text, ansi, svg, or html
--outputstringSave to file instead of stdout
--waitstringWait for text to appear before capturing
--timeoutint30Timeout in seconds for --wait
--scrollbackint0Number of scrollback lines to include

Examples:

bash
# Plain text to stdout
hex1b capture screenshot abc123

# SVG with colors saved to file
hex1b capture screenshot abc123 --format svg --output screen.svg

# Wait for app to be ready, then capture
hex1b capture screenshot abc123 --wait "Ready" --timeout 10 --format ansi

# Include scrollback history
hex1b capture screenshot abc123 --scrollback 100

capture recording start

Start recording a terminal session in asciinema .cast format.

bash
hex1b capture recording start <id> [options]
ArgumentDescription
idTerminal ID (or unique prefix)
OptionTypeDescription
--outputstring(required) Output .cast file path
--titlestringRecording title (embedded in the cast file header)
--idle-limitdoubleMax idle time in seconds between frames

Examples:

bash
# Basic recording
hex1b capture recording start abc123 --output demo.cast

# With title and idle limiting
hex1b capture recording start abc123 --output demo.cast --title "Setup Guide" --idle-limit 2.0

capture recording stop

Stop recording a terminal session.

bash
hex1b capture recording stop <id>
ArgumentDescription
idTerminal ID (or unique prefix)

Returns the path of the completed recording file.

capture recording status

Show recording status of a terminal session.

bash
hex1b capture recording status <id>
ArgumentDescription
idTerminal ID (or unique prefix)

Shows whether a recording is active and the output file path.

capture recording playback

Play back an asciinema recording.

bash
hex1b capture recording playback [options]
OptionTypeDefaultDescription
--filestring(required) Path to .cast file
--speeddouble1.0Playback speed multiplier
--playerflagLaunch interactive TUI player with controls

Examples:

bash
# Simple playback to stdout
hex1b capture recording playback --file demo.cast

# Double speed
hex1b capture recording playback --file demo.cast --speed 2.0

# Interactive TUI player
hex1b capture recording playback --file demo.cast --player

TUI player controls (--player):

KeyAction
SpacePlay / Pause
Seek backward 5 seconds
Seek forward 5 seconds
QQuit

keys

Send keystrokes to a terminal.

bash
hex1b keys <id> [options]
ArgumentDescription
idTerminal ID (or unique prefix)
OptionTypeDescription
--textstringType text as keystrokes
--keystringNamed key (see below)
--ctrlflagCtrl modifier
--shiftflagShift modifier
--altflagAlt modifier

Provide either --text or --key (not both).

Named keys: Enter, Tab, Escape, Backspace, Delete, Space, ArrowUp, ArrowDown, ArrowLeft, ArrowRight, Home, End, PageUp, PageDown, Insert, F1F12.

Examples:

bash
# Type text
hex1b keys abc123 --text "hello world"

# Send Enter
hex1b keys abc123 --key Enter

# Ctrl+C
hex1b keys abc123 --key c --ctrl

# Alt+Tab
hex1b keys abc123 --key Tab --alt

mouse

Send mouse input to a terminal.

mouse click

Send a mouse click at coordinates.

bash
hex1b mouse click <id> <x> <y> [options]
ArgumentDescription
idTerminal ID (or unique prefix)
xColumn (0-based)
yRow (0-based)
OptionTypeDefaultDescription
--buttonstringleftMouse button: left, right, or middle

mouse drag

Drag from one coordinate to another.

bash
hex1b mouse drag <id> <x1> <y1> <x2> <y2> [options]
ArgumentDescription
idTerminal ID (or unique prefix)
x1Start column (0-based)
y1Start row (0-based)
x2End column (0-based)
y2End row (0-based)
OptionTypeDefaultDescription
--buttonstringleftMouse button: left, right, or middle

app

TUI application diagnostics for inspecting the widget/node tree.

app tree

Inspect the widget/node tree of a TUI application.

bash
hex1b app tree <id> [options]
ArgumentDescription
idTerminal ID (or unique prefix)
OptionTypeDescription
--focusflagInclude focus ring info
--popupsflagInclude popup stack
--depthintLimit tree depth

Examples:

bash
# Full widget tree
hex1b app tree abc123

# With focus info, limited depth
hex1b app tree abc123 --focus --depth 3

# As JSON
hex1b app tree abc123 --json

assert

Assert on terminal content for scripting and CI. Exits with code 0 on success, non-zero on failure.

bash
hex1b assert <id> [options]
ArgumentDescription
idTerminal ID (or unique prefix)
OptionTypeDefaultDescription
--text-presentstringAssert text is visible on screen
--text-absentstringAssert text is NOT visible on screen
--timeoutint5How long to wait in seconds

Provide at least one of --text-present or --text-absent.

Examples:

bash
# Wait for text to appear
hex1b assert abc123 --text-present "Login successful" --timeout 10

# Verify error is not shown
hex1b assert abc123 --text-absent "Error"

# Use in a CI script
hex1b assert abc123 --text-present "Ready" --timeout 30 || exit 1

agent

AI agent integration commands.

agent init

Initialize a Hex1b agent skill file in a repository. This generates a skill configuration that AI coding agents (GitHub Copilot, Claude, Cursor, etc.) can use to understand how to work with Hex1b in your project.

bash
hex1b agent init [options]
OptionTypeDescription
--pathstringExplicit repo root path (skips auto-detection)
--stdoutflagWrite skill file to stdout instead of disk
--forceflagOverwrite existing skill file

agent mcp

Start the MCP server (stdio transport). This is used for integration with AI agents that support the Model Context Protocol.

bash
hex1b agent mcp

Coming Soon

The agent mcp command is planned for a future release. For MCP integration today, see the standalone MCP Server.

Released under the MIT License.