A single, self-contained Rust binary that is simultaneously a terminal emulator, interactive shell, command runtime, scripting environment, and cross-platform OS abstraction layer.
Zero external crates. Zero runtime dependencies. One executable (~618 KB).
Traditional workflows rely on a stack of disconnected layers:
GUI Terminal Emulator (Alacritty / WezTerm / Windows Terminal)
↓
Shell Binary (Bash / Zsh / PowerShell / CMD)
↓
Core Utilities (coreutils / findutils / procps)
↓
Operating System APIs
xt unifies the entire execution environment into a single executable:
┌──────────────────────────────────────────────┐
│ xt │
│ ONE BINARY │
├──────────────────────────────────────────────┤
│ Terminal Emulator │ Interactive Shell │
│ VT100 / ANSI Engine │ Command Runtime │
│ Typed Pipelines │ Scripting Engine │
│ GPU / CPU Renderer │ Job Manager │
│ OS Abstraction │ History & Completion │
└──────────────────────┬───────────────────────┘
│
┌──────────────────────▼───────────────────────┐
│ Native OS Backend │
├──────────────────────┬───────────────────────┤
│ Windows NT APIs │ Linux / Unix Syscall │
│ Win32 Console FFI │ POSIX termios │
│ Toolhelp32 Snapshot │ /proc Virtual FS │
│ Direct3D / DXGI │ DRM / DRI & Metal │
└──────────────────────┴───────────────────────┘
- Zero Crates Policy: Built entirely from the Rust standard library (
std) and raw platform FFI. No Tokio, no Clap, no Serde, no Crossterm, no Ratatui, no libc, no windows crate. - True Multithreaded Architecture: Decoupled domains for interactive input handling, AST execution, worker pool thread processing, and damage-driven rendering.
- Dual Rendering Backends:
- GPU Accelerated: Probes hardware adapters (Direct3D / DXGI / Vulkan on Windows, DRM/DRI on Linux, Metal on macOS) dynamically without crashing.
- CPU Software Fallback: Clean ANSI differential updating engine redrawing only dirty rows to prevent flickering and conserve CPU cycles.
- Consistent Cross-Platform Semantics: Standard commands (
ls,ps,cat,cd,pwd,cp,mv,rm,mkdir,clear) behave identically across Windows, Linux, and macOS. - Structured Data Pipelines: First-class
Valueobjects (File,Process,Directory,Map,List) allow filtering and projection (ps | where cpu > 10 | select pid name) without brittle text parsing hacks (grep | awk | cut).
xt/
├── Cargo.toml # Zero dependencies
├── README.md # Project documentation
├── bp.md # Architecture specification
├── test_script.xt # Demo scripting file
└── src/
├── lib.rs # Module declarations & public API
├── main.rs # CLI entrypoint, argument dispatch, interactive loop
├── terminal/
│ ├── mod.rs # Terminal coordinator & TerminalSink trait
│ ├── cell.rs # Cell, Color (16/256/TrueColor), CellFlags
│ ├── cursor.rs # Cursor state, shapes, save/restore
│ ├── screen.rs # Virtual grid, scrollback, damage tracking
│ ├── ansi.rs # Incremental VT100/VT220/ECMA-48 escape parser
│ ├── input.rs # Raw key event decoding (arrows, function, ctrl)
│ ├── render.rs # Renderer trait, CpuRenderer, GpuRenderer, AutoRenderer
│ └── selection.rs # Screen grid text selection
├── shell/
│ ├── mod.rs # Interactive REPL, prompt formatting, line editor, completion
│ ├── lexer.rs # Deterministic character scanner (no regex)
│ ├── parser.rs # Recursive descent AST parser
│ ├── ast.rs # Statements, expressions, pipelines, functions, loops
│ ├── expand.rs # Variable interpolation ($VAR), tilde (~), globs (*)
│ ├── variable.rs # Nested lexical scopes & variable environment
│ ├── history.rs # Disk-persisted history navigation (~/.xt_history)
│ └── eval.rs # AST evaluation engine
├── runtime/
│ ├── mod.rs # Runtime coordinator (working dir, env, aliases)
│ ├── value.rs # Structured Value enum & tabular formatters
│ ├── stream.rs # Pipeline streams (Text, Binary, Values)
│ ├── command.rs # Resolution: builtins -> aliases -> PATH executables
│ ├── pipeline.rs # Concurrent pipeline execution & file redirections
│ ├── process.rs # OS process spawning & stream piping
│ ├── jobs.rs # Background job control (&, jobs, fg, bg, wait)
│ └── threadpool.rs # Native worker thread pool using std::sync primitives
├── builtin/
│ ├── mod.rs # Builtin registry & dispatcher
│ ├── filesystem.rs # ls, cd, pwd, cp, mv, rm, mkdir, touch, cat, head, tail, find, stat
│ ├── process.rs # ps, kill, jobs, fg, bg, wait
│ ├── environment.rs # env, set, unset, which
│ ├── shell.rs # echo, printf, history, alias, unalias, where, select, sort, count, exit
│ └── system.rs # clear, title, sleep, date, whoami, sysinfo
├── platform/
│ ├── mod.rs # Platform trait and unified API
│ ├── windows/ # Win32 Console, Toolhelp32 process snapshotting, GPU probe
│ ├── unix/ # POSIX termios, /proc inspection, DRM probe
│ └── macos/ # macOS fallback implementations
├── config/
│ └── mod.rs # Configuration loader (config.xt)
└── util/
└── mod.rs # Table formatter, recursive globbing, byte formatting
- Rust compiler and toolchain (stable, edition 2021).
# Verify build
cargo check
# Run test suite
cargo test
# Build optimized release binary
cargo build --releaseThe resulting executable will be located at target/release/xt (or target/release/xt.exe on Windows).
Launch xt directly without arguments or double-click xt.exe:
./target/release/xtxt opens its own dedicated standalone native window with dark titlebar, Consolas monospace typography, and double-buffered GPU-accelerated rendering. It does not run inside or depend on cmd.exe or external consoles.
If you prefer running inside an existing terminal emulator or headless environment:
xt --clixt -c "echo 'Hello from xt'"
xt -c "ps | select pid name | first 5"
xt -c "ls | where size > 1000"xt script.xtxt provides an ergonomic, shell-like language without legacy quirks:
let name = "developer"
let count = 42
let total = $count * 2
echo "User: $name, Total: $total"
fn greet(user) {
echo "Welcome," $user
}
greet("Ada")
if exists("Cargo.toml") {
echo "Found Rust project"
} else {
echo "No Cargo manifest found"
}
if success {
echo "Previous command succeeded"
}
for file in glob("src/**/*.rs") {
echo "Found source:" $file
}
for item in ["alpha", "beta", "gamma"] {
echo "Item:" $item
}
Traditional shells treat all output as raw byte streams that must be sliced and grepped. xt commands can pass typed structured data directly:
ps | where cpu > 10 | select pid name cpu
Output:
PID NAME CPU
1824 firefox 17.4%
2911 rust-analyzer 13.1%
ls | where size > 5000 | sort size
cat Cargo.toml | where name
ps | select pid name > processes.txt
cargo build 2> errors.log
echo "appended line" >> output.txt
xt separates command execution into Exported Builtins (xtsh exports + native builtins) and the full xtsh UNIX/POSIX Bridge:
Resolution Order (Bare): PATH -> builtin -> not_found
Resolution Order (xtsh): PATH -> xtsh -> builtin -> not_found
| Category | Commands | Description |
|---|---|---|
| Exported (xtsh exports + builtins) | alias, cat, cd, clear, cp, echo, env, exit, head, help, history, kill, ls, mkdir, mv, printf, ps, pwd, rm, select, set, sleep, sort, syscmd, tail, touch, unalias, unset, where, xtenv, xtpkg, xtsh |
All 32 commands resolvable bare in standard PATH -> builtin order |
xtsh-Only Applets |
dirs, caller, compgen, compopt, popd, pushd, test, [, export, declare, local, readonly, read, eval, exec, grep, sed, awk, cut, uniq, wc, tr, tee, chmod, ln, rmdir, du, df, base64, sha256, md5, uname, etc. |
Commands isolated strictly to xtsh (require xtsh <cmd> or shell scripts) |
Diagnostics (xtenv) |
xtenv |
Outputs single platform signature string: "platform arch physical/logical" (e.g. "windows x86_64 8/16") |
xt uses its own shell language for configuration:
- Linux / macOS:
~/.config/xt/config.xt - Windows:
%APPDATA%\xt\config.xt
Example configuration:
alias ll = ls
alias gs = git status
let author = "Engineer"
Terminal semantics are completely independent from windowing, rendering, fonts, and OS process management.
xtis a unified runtime rather than a terminal emulator wrapped around someone else's shell.
This project began purely as an experiment. Because I initially didn't expect it to evolve into a fully functional project, the commit history serves as an unfiltered, raw log of my debugging journey. I chose to leave this history intact to showcase the actual, unpolished problem-solving process involved in wrestling with systems.