Skip to main content
ClaudeWave

Three Agent Skills over one pluggable PTY + pyte core: drive TUIs, design terminal effects, and render cell-accurate UIs. pip install smartcli-toolkit

MCP ServersOfficial Registry2 stars0 forksPythonMITUpdated today
Install in Claude Code / Claude Desktop
Method: UVX (Python) · smartcli-mcp
Claude Code CLI
claude mcp add smartcli -- uvx smartcli-mcp
claude_desktop_config.json (Claude Desktop)
{
  "mcpServers": {
    "smartcli": {
      "command": "uvx",
      "args": ["smartcli-mcp"]
    }
  }
}
1. Run the command above in your terminal (Claude Code), or paste the JSON config into claude_desktop_config.json (Claude Desktop).
2. Replace any <placeholder> values with your API keys or paths.
3. Restart Claude. The MCP server and its tools appear automatically.
Use cases

MCP Servers overview

<!-- Language: English | [简体中文](docs/i18n/README.zh-Hans.md) | [繁體中文](docs/i18n/README.zh-Hant.md) | [日本語](docs/i18n/README.ja.md) | [한국어](docs/i18n/README.ko.md) -->
<!-- mcp-name: io.github.dwgx/smartcli -->
<!-- ^ MCP Registry PyPI ownership marker: this string must appear in the
     published package's README (= PyPI description) and match server.json's
     "name". Do not remove or change without updating server.json. -->

# SmartCLI

*Read this in: **English** · [简体中文](docs/i18n/README.zh-Hans.md) · [繁體中文](docs/i18n/README.zh-Hant.md) · [日本語](docs/i18n/README.ja.md) · [한국어](docs/i18n/README.ko.md)*

**A local Python toolkit for driving, perceiving, and rendering the terminal — three agent skills over one pluggable PTY + `pyte` core.**

[![PyPI](https://img.shields.io/pypi/v/smartcli-toolkit?color=orange)](https://pypi.org/project/smartcli-toolkit/)
[![Python](https://img.shields.io/pypi/pyversions/smartcli-toolkit?color=blue)](https://pypi.org/project/smartcli-toolkit/)
[![CI](https://github.com/dwgx/SmartCLI/actions/workflows/ci.yml/badge.svg)](https://github.com/dwgx/SmartCLI/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/dwgx/SmartCLI/branch/main/graph/badge.svg)](https://codecov.io/gh/dwgx/SmartCLI)
[![License: MIT](https://img.shields.io/pypi/l/smartcli-toolkit?color=green)](LICENSE)
[![Downloads](https://img.shields.io/pypi/dm/smartcli-toolkit?color=blueviolet)](https://pypi.org/project/smartcli-toolkit/)
[![Skills: 3](https://img.shields.io/badge/skills-3-purple)](#features)
[![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey)](#install)

**Let an AI drive, perceive, and render real terminal programs.** SmartCLI reads
the actual screen with a `pyte` cell model — not a byte pipe — so it knows which
menu row is highlighted, presses the right keys, and waits for the screen to
settle. Below: it drives the real **lazygit** TUI end-to-end (arrow-key
navigation, opening a commit diff, highlighting a branch) — no script, no mock.

<p align="center">
  <img src="showcase/drive-lazygit.gif" alt="SmartCLI driving the real lazygit TUI: navigating panels, opening a commit diff, highlighting a branch" width="700">
</p>

```bash
pip install smartcli-toolkit
```

Requires Python 3.10 or newer. The install includes the shared Python library,
the persistent TUI driver, and the stdio MCP server.

### Drive something in 30 seconds

Copy-paste this. It starts a real Python REPL under a PTY, waits for the prompt
(never a blind `sleep`), types into it, and reads the screen back:

```bash
pip install smartcli-toolkit
SID=$(smartcli-tui start --cmd "python3 -i -q" --cols 80 --rows 24 --json | python3 -c "import json,sys;print(json.load(sys.stdin)['sid'])")
smartcli-tui wait-regex --id $SID ">>> " --timeout-ms 15000
smartcli-tui send-line --id $SID "print(6*7)"
smartcli-tui wait-regex --id $SID "42"          # prints the cell grid it sees
smartcli-tui close --id $SID
```

On Windows use `--cmd "py -i -q"`. Swap the command for `vim`, `htop` or
`lazygit` and the same five verbs drive those too — that is the whole point:
**`wait-regex` and friends react to what the screen actually shows**, so an agent
never guesses whether its keystroke landed.

Want the same thing against a real editor, end to end and verifiable?
[`examples/drive_vim.py`](examples/drive_vim.py) drives the actual `vim` binary —
opens a file, appends a line, saves, and then checks the **filesystem**, not the
screen:

```bash
python examples/drive_vim.py
#   [OK ] vim painted its screen
#   [OK ] file contents visible on screen
#   [OK ] alternate screen is active
#   [OK ] typed text appears on screen
#   [OK ] vim restored the main screen on exit
#   [OK ] file on disk really changed
```

Run the same file against `smartcli-toolkit==0.1.8` and two steps fail — and the
file is *never saved*, because a driver that cannot see the alternate screen
mistimes the `:wq`. That is why the emulation work below matters: a wrong screen
model does not error, it silently succeeds at nothing.

Already running an MCP client (Claude Code, Cursor, VS Code)? The same verbs are
MCP tools, with the per-session token attached for you:

```bash
smartcli-mcp        # stdio MCP server; or `uvx --from smartcli-toolkit smartcli-mcp`
```

## What & why

SmartCLI is a workspace for terminal work that agents and humans both do: **driving**
interactive terminal programs, **perceiving** what a screen actually shows, and
**rendering** visuals and layouts back out. It is built on one shared, pluggable PTY
backend plus a `pyte` screen model — chosen over screenshot/vision so a single
structured screen model feeds both perception (read the screen) and rendering
(draw the screen). The PTY layer is intentionally **not** tmux-bound: local dev runs
on Windows via ConPTY (`pywinpty`), while target programs can run under POSIX ptys
or tmux elsewhere. Three skills sit on that core, each a self-contained tool you run
in place from the checkout.

## Driving a real TUI

The demo above is SmartCLI driving **lazygit** — a real full-screen curses app —
through its perceive → act → confirm loop: it reads the `pyte` cell grid (which
row is selected, the alt-screen diff), moves with arrow keys, opens a commit's
diff, and highlights a branch. Captured by driving the actual program in a Linux
container, not scripted or mocked. A byte-stream matcher like pexpect can't
perceive "which row is highlighted"; a screen model can.

**How we know the perception is right.** A screen model is only useful if it
matches what a real terminal shows, so we measure that instead of asserting it:
identical bytes go to a real **tmux** pane and to our model, and the two cell
grids are diffed. Three suites do it — 35 curated cases, a three-way check that
only trusts a behaviour when **tmux *and* GNU screen agree**, and a generative
fuzz over random VT sequences. That campaign found and fixed **12 emulation bugs**,
including the alternate screen buffer (`pyte` implements none of modes
1049/1047/47, so a full-screen program's output used to be painted over the main
screen and never restored). Scope and remaining edges:
[`LIMITATIONS.md`](skills/drive-tui/references/LIMITATIONS.md).

## Live effects

Real captures of the `cmd-art` `fx` engine — each GIF is the actual effect
rendered frame-by-frame through the project's own pipeline (no screen recorder).
Reproduce any with `python -m fx play <name>` (see [Quickstart](#quickstart)).

<p align="center">
  <img src="showcase/fx-solarsystem.gif" alt="ASCII solar system orrery — planets orbiting a pulsing sun" width="620"><br>
  <sub><b>solarsystem</b> — an orrery: planets on elliptical orbits around a pulsing sun</sub>
</p>

| | | |
|:---:|:---:|:---:|
| ![donut](showcase/fx-donut.gif) | ![fire](showcase/fx-fire.gif) | ![rain](showcase/fx-rain.gif) |
| **donut** — the classic ASCII torus | **fire** — demoscene heat field | **rain** — Matrix digital rain |

> 🌐 **[Explore the live showcase →](https://dwgx.github.io/SmartCLI/)** — play with
> the effect engine, drive a menu with arrow keys, and poke the widgets, right in
> your browser.

## Install

**Primary — from PyPI:**

```bash
pip install smartcli-toolkit
```

> **Distribution vs import name:** the PyPI distribution is `smartcli-toolkit`
> (the names `smartcli` / `smart-cli` were taken or blocked), but the importable
> package is `smartcli_core`. So after `pip install smartcli-toolkit` you still
> write `from smartcli_core import PtySession`.

**Alternative — reproduce the full dev environment from a source checkout:**

```bash
git clone https://github.com/dwgx/SmartCLI SmartCLI
cd SmartCLI
python -m pip install -r requirements.txt
```

`requirements.txt` installs `pyte`, the MCP SDK, and `pywinpty` on Windows only
(POSIX uses the stdlib `pty` backend). `pip install .` installs `smartcli_core`
plus the `smartcli-tui`, `smartcli-mcp`, and `smartcli-toolkit` commands. The
visual `cmd-art` and `tui-ui` skills still run in place from a checkout via
`python -m fx` and `python -m ui`.

**Optional extras** (real FIGlet fonts, raster images, authoritative cell widths — all
degrade gracefully to stdlib fallbacks when absent):

```bash
python -m pip install -r requirements-optional.txt
# or, from the checkout, via pyproject extras:
pip install ".[all]"        # pyfiglet + Pillow + wcwidth
pip install ".[art]"        # pyfiglet only
pip install ".[image]"      # Pillow only  (also: the PNG screenshot harness needs it)
pip install ".[width]"      # wcwidth only
```

**Windows note:** set UTF-8 output before running any skill so box-drawing and CJK
glyphs encode cleanly (the CLIs also auto-reconfigure stdout, but set this to be safe):

```powershell
set PYTHONIOENCODING=utf-8
```

Verified dep versions on the dev box (Windows 11, CPython 3.14.6): `pyte` 0.8.2,
`pywinpty` 3.0.5, `pyfiglet` 1.0.4, `Pillow` 12.2.0, `wcwidth` 0.8.1.

**Diagnostics.** `python -m smartcli_core` prints your OS, Python, terminal, PTY
backend, and dependency versions. `smartcli-tui doctor` reports where the core
was loaded from and whether drive dependencies are present. Include both outputs
when filing a terminal-sensitive bug.

## Quickstart

### cmd-art — terminal visual effects

```bash
cd skills/cmd-art
python -m fx list                          # list all 30 effects
python -m fx play donut --seconds 5        # play one effect (bounded)
python -m fx gallery                       # one frame of each effect
python -m fx show --seq "donut:fire:3,plasma::3"
```

### tui-ui — cell-accurate terminal UI

```bash
cd skills/tui-ui
python -m ui widgets                       # list all 17 widgets
python -m ui gallery --width 100 --height 30
python -m ui demo table --width 80 --height 12 --theme dashboard
```

### drive-tui — perceive & drive interactive programs

Persistent-session CLI (state survives across shell calls):

```bash
smartcli-tui start --cmd "python3 -i -q" --cols 80 --rows 24
smartcli-tui wait-regex --id <S
agent-skillsagent-toolsai-agentsansiascii-artclaude-skillcliconptymcpmcp-serverpexpectptypytepythonscreen-scrapingterminalterminal-automationtui

What people ask about SmartCLI

What is dwgx/SmartCLI?

+

dwgx/SmartCLI is mcp servers for the Claude AI ecosystem. Three Agent Skills over one pluggable PTY + pyte core: drive TUIs, design terminal effects, and render cell-accurate UIs. pip install smartcli-toolkit It has 2 GitHub stars and was last updated today.

How do I install SmartCLI?

+

You can install SmartCLI by cloning the repository (https://github.com/dwgx/SmartCLI) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.

Is dwgx/SmartCLI safe to use?

+

dwgx/SmartCLI has not been audited yet by our security agent. Review the original repository on GitHub before using it in production.

Who maintains dwgx/SmartCLI?

+

dwgx/SmartCLI is maintained by dwgx. The last recorded GitHub activity is from today, with 7 open issues.

Are there alternatives to SmartCLI?

+

Yes. On ClaudeWave you can browse similar mcp servers at /categories/mcp, sorted by popularity or recent activity.

Deploy SmartCLI to your cloud

Ship this repo to production in minutes. Each platform spins up its own environment with editable env vars.

Maintain this repo? Add a badge to your README

Drop the badge into your GitHub README to show it's tracked on ClaudeWave. Each badge links back to this page and reflects the live Trust Score.

Featured on ClaudeWave: dwgx/SmartCLI
[![Featured on ClaudeWave](https://claudewave.com/api/badge/dwgx-smartcli)](https://claudewave.com/repo/dwgx-smartcli)
<a href="https://claudewave.com/repo/dwgx-smartcli"><img src="https://claudewave.com/api/badge/dwgx-smartcli" alt="Featured on ClaudeWave: dwgx/SmartCLI" width="320" height="64" /></a>

More MCP Servers

SmartCLI alternatives