Definition

CLI wrapper

A CLI wrapper is a program that launches, manages, and UI-wraps other command-line tools — how apps like SpaceSpider host Claude Code and Codex CLI.

A CLI wrapper is a program that launches another command-line tool inside its own UI, streams the wrapped CLI's output through a terminal renderer, and forwards user input. SpaceSpider is a CLI wrapper: it hosts Claude Code, Codex CLI, Qwen Code, Kimi CLI, and plain shells in panes of a grid layout.

Why it matters

AI coding CLIs have exploded — every major model provider now ships one. They're powerful but fragmented: you may want all four open at once to compare, or to run them against the same task in parallel. A CLI wrapper makes that practical.

Good wrappers don't redefine the CLI experience; they just make it easier to run, layout, and resume. SpaceSpider's job is to manage PTYs, persist spaces, and stay out of the way when you're actually talking to the agent.

How it works

Under the hood a CLI wrapper needs:

  1. PTY management — spawn each wrapped CLI in its own PTY or ConPTY so it thinks it's in a real terminal
  2. Terminal rendering — a client that understands ANSI escape codes to draw output (SpaceSpider uses @xterm/xterm)
  3. Input forwarding — route keyboard events from the focused pane to the right PTY
  4. Resize handling — propagate window size changes so the child reflows output
  5. Lifecycle — spawn, detect exit, clean up

SpaceSpider layers on per-pane CLI selection (via cliCatalog in the Rust backend), detection (which CLIs are installed via which), and persistence of everything via tauri-plugin-store.

How it's used

Common CLI-wrapper use cases:

  • GUI terminal emulators (Warp, iTerm2, Windows Terminal) — wrappers around one CLI
  • AI workspace tools (SpaceSpider) — wrappers around many CLIs in a grid
  • Task runners that shell out to tools and surface progress
  • IDEs with embedded terminals

See getting-started and first-space to see the wrapper in action.

  • PTY — the plumbing every wrapper needs
  • Terminal multiplexer — a specialized CLI-wrapper form
  • Grid layout — how SpaceSpider arranges wrapped CLIs
  • Space — SpaceSpider's persistent wrapper config
  • Shell — the simplest thing to wrap

FAQ

Does a wrapper slow down the wrapped CLI?

A well-designed wrapper adds microseconds per keystroke and some memory for the renderer. Performance is dominated by the wrapped tool itself (network calls to the LLM, compile times, etc.).

Can I use my own terminal's keybindings inside a wrapped CLI?

Most keystrokes pass through unchanged. Wrappers typically reserve a small number of keys for their own UI (window focus, new space). SpaceSpider keeps this list short; see keyboard-shortcuts.

Related terms