smartcli-toolkit 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- smartcli_core/__init__.py +53 -0
- smartcli_core/pty_backend.py +259 -0
- smartcli_core/readiness.py +210 -0
- smartcli_core/screen_model.py +132 -0
- smartcli_core/session.py +244 -0
- smartcli_core/snapshot.py +297 -0
- smartcli_toolkit-0.1.0.dist-info/METADATA +226 -0
- smartcli_toolkit-0.1.0.dist-info/RECORD +11 -0
- smartcli_toolkit-0.1.0.dist-info/WHEEL +5 -0
- smartcli_toolkit-0.1.0.dist-info/licenses/LICENSE +21 -0
- smartcli_toolkit-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: smartcli-toolkit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Pluggable-PTY + pyte screen model + semantic snapshot / readiness core for driving interactive terminal programs (SmartCLI shared core).
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: pyte>=0.8.1
|
|
10
|
+
Requires-Dist: pywinpty>=2.0; platform_system == "Windows"
|
|
11
|
+
Provides-Extra: art
|
|
12
|
+
Requires-Dist: pyfiglet>=1.0.0; extra == "art"
|
|
13
|
+
Provides-Extra: image
|
|
14
|
+
Requires-Dist: Pillow>=10.0.0; extra == "image"
|
|
15
|
+
Provides-Extra: width
|
|
16
|
+
Requires-Dist: wcwidth>=0.2.0; extra == "width"
|
|
17
|
+
Provides-Extra: all
|
|
18
|
+
Requires-Dist: pyfiglet>=1.0.0; extra == "all"
|
|
19
|
+
Requires-Dist: Pillow>=10.0.0; extra == "all"
|
|
20
|
+
Requires-Dist: wcwidth>=0.2.0; extra == "all"
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# SmartCLI
|
|
24
|
+
|
|
25
|
+
**A local Python toolkit for driving, perceiving, and rendering the terminal — three agent skills over one pluggable PTY + `pyte` core.**
|
|
26
|
+
|
|
27
|
+
[](https://www.python.org/)
|
|
28
|
+
[](LICENSE)
|
|
29
|
+
[](CHANGELOG.md)
|
|
30
|
+
[](#features)
|
|
31
|
+
[](#install)
|
|
32
|
+
|
|
33
|
+
## What & why
|
|
34
|
+
|
|
35
|
+
SmartCLI is a workspace for terminal work that agents and humans both do: **driving**
|
|
36
|
+
interactive terminal programs, **perceiving** what a screen actually shows, and
|
|
37
|
+
**rendering** visuals and layouts back out. It is built on one shared, pluggable PTY
|
|
38
|
+
backend plus a `pyte` screen model — chosen over screenshot/vision so a single
|
|
39
|
+
structured screen model feeds both perception (read the screen) and rendering
|
|
40
|
+
(draw the screen). The PTY layer is intentionally **not** tmux-bound: local dev runs
|
|
41
|
+
on Windows via ConPTY (`pywinpty`), while target programs can run under POSIX ptys
|
|
42
|
+
or tmux elsewhere. Three skills sit on that core, each a self-contained tool you run
|
|
43
|
+
in place from the checkout.
|
|
44
|
+
|
|
45
|
+
Verified on Windows 11, Python 3.14.6, `pyte` + `pywinpty` / ConPTY. This machine has
|
|
46
|
+
no real `tmux`, so screenshot reports are honestly labelled `pyte-simulation`, not
|
|
47
|
+
real tmux captures.
|
|
48
|
+
|
|
49
|
+
## Screenshots
|
|
50
|
+
|
|
51
|
+
A small gallery of `cmd-art` effects, rendered through the `fx` engine. Reproduce any
|
|
52
|
+
of these with `python -m fx play <name>` (see [Quickstart](#quickstart)).
|
|
53
|
+
|
|
54
|
+
| | | |
|
|
55
|
+
|:---:|:---:|:---:|
|
|
56
|
+
|  |  |  |
|
|
57
|
+
| **donut** | **fire** | **plasma** |
|
|
58
|
+
|  |  |  |
|
|
59
|
+
| **rain** | **starfield** | **tunnel** |
|
|
60
|
+
|
|
61
|
+
## Install
|
|
62
|
+
|
|
63
|
+
SmartCLI is **not on PyPI yet** — install from a source checkout. Every command below
|
|
64
|
+
works today from a clean clone.
|
|
65
|
+
|
|
66
|
+
**Primary — reproduce the full dev environment** (recommended):
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
git clone <repo-url> SmartCLI
|
|
70
|
+
cd SmartCLI
|
|
71
|
+
python -m pip install -r requirements.txt
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`requirements.txt` pulls only the two required runtime deps: `pyte` (everywhere) and
|
|
75
|
+
`pywinpty` (Windows only — the marker skips it on POSIX, which uses the stdlib `pty`
|
|
76
|
+
backend).
|
|
77
|
+
|
|
78
|
+
**Install the shared core package** (`smartcli_core`):
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pip install .
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
> **Distribution vs import name:** the PyPI distribution is `smartcli-toolkit`
|
|
85
|
+
> (the names `smartcli` / `smart-cli` were taken or blocked), but the importable
|
|
86
|
+
> package is `smartcli_core`. So after `pip install smartcli-toolkit` you still
|
|
87
|
+
> write `from smartcli_core import PtySession`.
|
|
88
|
+
|
|
89
|
+
Honest scope note: `pip install .` installs the clean, importable `smartcli_core`
|
|
90
|
+
package plus its required deps. It does **not** relocate the three skills — those run
|
|
91
|
+
in place via their own entry points (`python -m fx`, `python -m ui`,
|
|
92
|
+
`skills/drive-tui/scripts/tui.py`), exactly as the Quickstart shows. This is by design;
|
|
93
|
+
see the note at the top of [`pyproject.toml`](pyproject.toml).
|
|
94
|
+
|
|
95
|
+
**Optional extras** (real FIGlet fonts, raster images, authoritative cell widths — all
|
|
96
|
+
degrade gracefully to stdlib fallbacks when absent):
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
python -m pip install -r requirements-optional.txt
|
|
100
|
+
# or, from the checkout, via pyproject extras:
|
|
101
|
+
pip install ".[all]" # pyfiglet + Pillow + wcwidth
|
|
102
|
+
pip install ".[art]" # pyfiglet only
|
|
103
|
+
pip install ".[image]" # Pillow only (also: the PNG screenshot harness needs it)
|
|
104
|
+
pip install ".[width]" # wcwidth only
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Windows note:** set UTF-8 output before running any skill so box-drawing and CJK
|
|
108
|
+
glyphs encode cleanly (the CLIs also auto-reconfigure stdout, but set this to be safe):
|
|
109
|
+
|
|
110
|
+
```powershell
|
|
111
|
+
set PYTHONIOENCODING=utf-8
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Verified dep versions on the dev box (Windows 11, CPython 3.14.6): `pyte` 0.8.2,
|
|
115
|
+
`pywinpty` 3.0.5, `pyfiglet` 1.0.4, `Pillow` 12.2.0, `wcwidth` 0.8.1.
|
|
116
|
+
|
|
117
|
+
## Quickstart
|
|
118
|
+
|
|
119
|
+
### cmd-art — terminal visual effects
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
cd skills/cmd-art
|
|
123
|
+
python -m fx list # list all 18 effects
|
|
124
|
+
python -m fx play donut --seconds 5 # play one effect (bounded)
|
|
125
|
+
python -m fx gallery # one frame of each effect
|
|
126
|
+
python -m fx show --seq "donut:fire:3,plasma::3"
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### tui-ui — cell-accurate terminal UI
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
cd skills/tui-ui
|
|
133
|
+
python -m ui widgets # list all 15 widgets
|
|
134
|
+
python -m ui gallery --width 100 --height 30
|
|
135
|
+
python -m ui demo table --width 80 --height 12 --theme dashboard
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### drive-tui — perceive & drive interactive programs
|
|
139
|
+
|
|
140
|
+
Persistent-session CLI (state survives across shell calls):
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
python skills/drive-tui/scripts/tui.py start --cmd "python" --cols 80 --rows 24
|
|
144
|
+
python skills/drive-tui/scripts/tui.py wait-regex --id <SID> ">>> " --timeout-ms 15000
|
|
145
|
+
python skills/drive-tui/scripts/tui.py send-line --id <SID> "print(6*7)"
|
|
146
|
+
python skills/drive-tui/scripts/tui.py snapshot --id <SID>
|
|
147
|
+
python skills/drive-tui/scripts/tui.py close --id <SID>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### As a library
|
|
151
|
+
|
|
152
|
+
The shared core is importable directly:
|
|
153
|
+
|
|
154
|
+
```python
|
|
155
|
+
import sys
|
|
156
|
+
from smartcli_core import PtySession
|
|
157
|
+
|
|
158
|
+
s = PtySession()
|
|
159
|
+
s.start([sys.executable, "-q"])
|
|
160
|
+
s.wait_for(r">>> ") # readiness sync, never a blind sleep
|
|
161
|
+
print(s.snapshot().to_text()) # pyte-backed structured screen
|
|
162
|
+
s.close()
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
For the full command reference, the screenshot/AGENTCLI harnesses, and the regression
|
|
166
|
+
suite, see **[`README-USAGE.md`](README-USAGE.md)**.
|
|
167
|
+
|
|
168
|
+
## Features
|
|
169
|
+
|
|
170
|
+
**`cmd-art`** (`skills/cmd-art`) — a "living-template" effect engine: an `Effect` ABC +
|
|
171
|
+
`@register` decorator + auto-discovery. **18 effects** (donut, fire, plasma, rain,
|
|
172
|
+
starfield, tunnel, text3d, cube, sphere, boids, life, fireworks, sparkle, decrypt,
|
|
173
|
+
gradient_text, banner_scroll, image2ascii, typewriter) across **8 themes** (mono, fire,
|
|
174
|
+
ocean, synthwave, viridis, pastel, matrix-green, rainbow). Effects are pure frame
|
|
175
|
+
producers; `play` is bounded by default and always restores the terminal.
|
|
176
|
+
|
|
177
|
+
**`tui-ui`** (`skills/tui-ui`) — a web-like terminal layout engine emitting tmux-safe
|
|
178
|
+
ANSI frames (SGR color runs + newlines only; no cursor moves, no alt-screen). **15
|
|
179
|
+
widgets** (badge, banner, braille_chart, card, gradient_rule, kv, meter, panel,
|
|
180
|
+
progress, radial_glow, rule, slider_track, table, tabs, tree) over a real **engine**:
|
|
181
|
+
`field.py` (shader compositors), `raster.py` (sub-cell half/quad/braille pixels),
|
|
182
|
+
`box_junction.py` (edge-algebra box joins), `color_model.py` (honest truecolor → 256 →
|
|
183
|
+
16 → mono degrade). Display-cell accurate for CJK/emoji/ZWJ so columns never desync.
|
|
184
|
+
|
|
185
|
+
**`drive-tui`** (`skills/drive-tui`) — drives interactive terminal programs (REPLs,
|
|
186
|
+
menus, pagers, y/N prompts, wizards) through a PTY via a
|
|
187
|
+
perceive → decide → act → wait → confirm loop, never a blind sleep. A thin CLI
|
|
188
|
+
(`scripts/tui.py`) offers a persistent detached session and a one-shot `run` mode, with
|
|
189
|
+
an importable pattern library of **8 recipes** (repl, menu_select, pager, search_filter,
|
|
190
|
+
confirm, form, progress, wizard) that `classify()` a screen and `drive()` it.
|
|
191
|
+
|
|
192
|
+
**Shared core** (`smartcli_core`) — the pluggable PTY backend + `pyte` screen model +
|
|
193
|
+
semantic snapshot + readiness sync (`pty_backend / screen_model / snapshot / readiness /
|
|
194
|
+
session`). The reusable, importable foundation under all three skills.
|
|
195
|
+
|
|
196
|
+
**Knowledge graph** (`knowledge/`) — a 122-note wiki-link graph of exact rendering
|
|
197
|
+
formulas, ANSI sequences, and measured constants, each note carrying a source and
|
|
198
|
+
cross-links. See [`knowledge/INDEX.md`](knowledge/INDEX.md).
|
|
199
|
+
|
|
200
|
+
## Project layout
|
|
201
|
+
|
|
202
|
+
```text
|
|
203
|
+
SmartCLI/
|
|
204
|
+
smartcli_core/ shared PTY + pyte engine (importable package)
|
|
205
|
+
skills/cmd-art/ fx effect package and CLI (18 effects, 8 themes)
|
|
206
|
+
skills/drive-tui/ TUI pattern library and PTY driver CLI (8 recipes)
|
|
207
|
+
skills/tui-ui/ terminal UI layout engine and widgets (15 widgets)
|
|
208
|
+
tools/screenshot/ pyte -> PNG smoke-test harness
|
|
209
|
+
tools/agentcli/ agent-CLI control validation harness
|
|
210
|
+
knowledge/ 122-note knowledge graph (see knowledge/INDEX.md)
|
|
211
|
+
showcase/ rendered effect PNGs (see Screenshots)
|
|
212
|
+
tests/ direct script-style regressions
|
|
213
|
+
research/ archived first-pass research notes
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Documentation
|
|
217
|
+
|
|
218
|
+
- **[`README-USAGE.md`](README-USAGE.md)** — the full usage cheat-sheet: every skill,
|
|
219
|
+
the screenshot and AGENTCLI harnesses, and the regression commands.
|
|
220
|
+
- **[`knowledge/INDEX.md`](knowledge/INDEX.md)** — the 122-note knowledge graph.
|
|
221
|
+
- **[`AGENTCLI-VALIDATION.md`](AGENTCLI-VALIDATION.md)** — agent-CLI control test matrix.
|
|
222
|
+
- **[`CHANGELOG.md`](CHANGELOG.md)** — release history.
|
|
223
|
+
|
|
224
|
+
## License
|
|
225
|
+
|
|
226
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
smartcli_core/__init__.py,sha256=_baqQ8WAl7DanvDRZ6DbwEqXiday4x0VzT5F0Uc1Brk,1229
|
|
2
|
+
smartcli_core/pty_backend.py,sha256=sQ7av4GrRCYAqR0G5AJqArMtjvOWVIBRQuJ8rNzFyyo,7988
|
|
3
|
+
smartcli_core/readiness.py,sha256=eap_mya7o-RaKEA7iriV0I26i_b2CJiyki62QDFseGQ,7278
|
|
4
|
+
smartcli_core/screen_model.py,sha256=OP76OxJRYwjUd-ioLbsjQYtSeLVBnJCcHEbd8QLqO_A,4706
|
|
5
|
+
smartcli_core/session.py,sha256=Olf3iHnCpq4SDEEp4dmSF6ckLe89rLDntTlo5q92JrU,7737
|
|
6
|
+
smartcli_core/snapshot.py,sha256=RA44RkTrko5Q_h6GNmMTldQTEPgKqvSsAB8FDLYEuSw,10797
|
|
7
|
+
smartcli_toolkit-0.1.0.dist-info/licenses/LICENSE,sha256=e0FKb0QeD2o5pneL0SQaTePQYRViG4Wb-sw-6Q53LQw,1078
|
|
8
|
+
smartcli_toolkit-0.1.0.dist-info/METADATA,sha256=xG2o4ExTbS79ayvaADZeCqrCXgVOjM_euzJiP75MkRQ,9859
|
|
9
|
+
smartcli_toolkit-0.1.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
10
|
+
smartcli_toolkit-0.1.0.dist-info/top_level.txt,sha256=svT7ZPxhEf3E95fkz_HX7VfD-BFpkSnSd2O3u4K4MlY,14
|
|
11
|
+
smartcli_toolkit-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SmartCLI contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
smartcli_core
|