Pluggable-PTY + pyte screen model + semantic snapshot / readiness core for driving interactive terminal programs (SmartCLI shared core).
Project description
SmartCLI
A local Python toolkit for driving, perceiving, and rendering the terminal — three agent skills over one pluggable PTY + pyte core.
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.
Verified on Windows 11, Python 3.14.6, pyte + pywinpty / ConPTY. This machine has
no real tmux, so screenshot reports are honestly labelled pyte-simulation, not
real tmux captures.
Screenshots
A small gallery of cmd-art effects, rendered through the fx engine. Reproduce any
of these with python -m fx play <name> (see Quickstart).
| donut | fire | plasma |
| rain | starfield | tunnel |
Install
SmartCLI is not on PyPI yet — install from a source checkout. Every command below works today from a clean clone.
Primary — reproduce the full dev environment (recommended):
git clone https://github.com/dwgx/SmartCLI SmartCLI
cd SmartCLI
python -m pip install -r requirements.txt
requirements.txt pulls only the two required runtime deps: pyte (everywhere) and
pywinpty (Windows only — the marker skips it on POSIX, which uses the stdlib pty
backend).
Install the shared core package (smartcli_core):
pip install .
Distribution vs import name: the PyPI distribution is
smartcli-toolkit(the namessmartcli/smart-cliwere taken or blocked), but the importable package issmartcli_core. So afterpip install smartcli-toolkityou still writefrom smartcli_core import PtySession.
Honest scope note: pip install . installs the clean, importable smartcli_core
package plus its required deps. It does not relocate the three skills — those run
in place via their own entry points (python -m fx, python -m ui,
skills/drive-tui/scripts/tui.py), exactly as the Quickstart shows. This is by design;
see the note at the top of pyproject.toml.
Optional extras (real FIGlet fonts, raster images, authoritative cell widths — all degrade gracefully to stdlib fallbacks when absent):
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):
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.
Quickstart
cmd-art — terminal visual effects
cd skills/cmd-art
python -m fx list # list all 18 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
cd skills/tui-ui
python -m ui widgets # list all 15 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):
python skills/drive-tui/scripts/tui.py start --cmd "python" --cols 80 --rows 24
python skills/drive-tui/scripts/tui.py wait-regex --id <SID> ">>> " --timeout-ms 15000
python skills/drive-tui/scripts/tui.py send-line --id <SID> "print(6*7)"
python skills/drive-tui/scripts/tui.py snapshot --id <SID>
python skills/drive-tui/scripts/tui.py close --id <SID>
As a library
The shared core is importable directly:
import sys
from smartcli_core import PtySession
s = PtySession()
s.start([sys.executable, "-q"])
s.wait_for(r">>> ") # readiness sync, never a blind sleep
print(s.snapshot().to_text()) # pyte-backed structured screen
s.close()
For the full command reference, the screenshot/AGENTCLI harnesses, and the regression
suite, see README-USAGE.md.
Features
cmd-art (skills/cmd-art) — a "living-template" effect engine: an Effect ABC +
@register decorator + auto-discovery. 18 effects (donut, fire, plasma, rain,
starfield, tunnel, text3d, cube, sphere, boids, life, fireworks, sparkle, decrypt,
gradient_text, banner_scroll, image2ascii, typewriter) across 8 themes (mono, fire,
ocean, synthwave, viridis, pastel, matrix-green, rainbow). Effects are pure frame
producers; play is bounded by default and always restores the terminal.
tui-ui (skills/tui-ui) — a web-like terminal layout engine emitting tmux-safe
ANSI frames (SGR color runs + newlines only; no cursor moves, no alt-screen). 15
widgets (badge, banner, braille_chart, card, gradient_rule, kv, meter, panel,
progress, radial_glow, rule, slider_track, table, tabs, tree) over a real engine:
field.py (shader compositors), raster.py (sub-cell half/quad/braille pixels),
box_junction.py (edge-algebra box joins), color_model.py (honest truecolor → 256 →
16 → mono degrade). Display-cell accurate for CJK/emoji/ZWJ so columns never desync.
drive-tui (skills/drive-tui) — drives interactive terminal programs (REPLs,
menus, pagers, y/N prompts, wizards) through a PTY via a
perceive → decide → act → wait → confirm loop, never a blind sleep. A thin CLI
(scripts/tui.py) offers a persistent detached session and a one-shot run mode, with
an importable pattern library of 8 recipes (repl, menu_select, pager, search_filter,
confirm, form, progress, wizard) that classify() a screen and drive() it.
Shared core (smartcli_core) — the pluggable PTY backend + pyte screen model +
semantic snapshot + readiness sync (pty_backend / screen_model / snapshot / readiness /
session). The reusable, importable foundation under all three skills.
Knowledge graph (knowledge/) — a 122-note wiki-link graph of exact rendering
formulas, ANSI sequences, and measured constants, each note carrying a source and
cross-links. See knowledge/INDEX.md.
Project layout
SmartCLI/
smartcli_core/ shared PTY + pyte engine (importable package)
skills/cmd-art/ fx effect package and CLI (18 effects, 8 themes)
skills/drive-tui/ TUI pattern library and PTY driver CLI (8 recipes)
skills/tui-ui/ terminal UI layout engine and widgets (15 widgets)
tools/screenshot/ pyte -> PNG smoke-test harness
tools/agentcli/ agent-CLI control validation harness
knowledge/ 122-note knowledge graph (see knowledge/INDEX.md)
showcase/ rendered effect PNGs (see Screenshots)
tests/ direct script-style regressions
research/ archived first-pass research notes
Documentation
README-USAGE.md— the full usage cheat-sheet: every skill, the screenshot and AGENTCLI harnesses, and the regression commands.knowledge/INDEX.md— the 122-note knowledge graph.AGENTCLI-VALIDATION.md— agent-CLI control test matrix.CHANGELOG.md— release history.
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smartcli_toolkit-0.1.1.tar.gz.
File metadata
- Download URL: smartcli_toolkit-0.1.1.tar.gz
- Upload date:
- Size: 27.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e3c941420189c594a84991aeb3ee15fb51b38d81f0ca3d57e452a6ff280d6f9
|
|
| MD5 |
fff99f09361f8b0ca7812ad339e66a80
|
|
| BLAKE2b-256 |
efdfcdd82491fa9a891d40b7b3fc905c0eaf65fbf0303ffb8046758d958cf89c
|
File details
Details for the file smartcli_toolkit-0.1.1-py3-none-any.whl.
File metadata
- Download URL: smartcli_toolkit-0.1.1-py3-none-any.whl
- Upload date:
- Size: 20.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1b545e92f0e4e8b9c1c0835e23842532cc6e08ecc36caf35edc4dac278a9705
|
|
| MD5 |
978a0772cf73a07e599ced7736083df0
|
|
| BLAKE2b-256 |
53aaf8ed4e8f61f744b7f0e3f2ebd932e229c53abab6e1235dc8a34988d2f217
|