dwgx/SmartCLI / skills/tui-ui
tui-ui
VerifiedDesign web-like user interfaces in the terminal and inside tmux with a cell-grid Canvas, CSS-like box model, flexbox/grid layout, and 17 reusable widgets such as Panel, Table, Card, ProgressBar, Meter, Tabs, Tree, Badge, Banner, and a braille line chart. Use when an agent needs a dashboard, panel, table, status page, TUI layout, tmux dashboard, screenshot-driven CLI/TUI replica, ANSI frame, truecolor render, pyte PNG screenshot smoke test, wide-character alignment, or a new terminal widget.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 18.0 KB |
| _selftest_effort_widgets.py | script | 4.9 KB |
| _shot_effort_widgets.py | script | 4.7 KB |
| examples/effort_selector.py | script | 22.1 KB |
| references/HARD-LESSONS.md | markdown | 7.5 KB |
| references/RENDERING-MODEL.md | markdown | 5.4 KB |
| references/effort-replica-spec.md | markdown | 11.8 KB |
| self_test.py | script | 5.7 KB |
| ui/__init__.py | script | 1.4 KB |
| ui/__main__.py | script | 183 B |
| ui/box.py | script | 9.2 KB |
| ui/cli.py | script | 8.7 KB |
| ui/core.py | script | 26.0 KB |
| ui/field.py | script | 19.7 KB |
| ui/layout.py | script | 11.1 KB |
| ui/raster.py | script | 27.9 KB |
| ui/registry.py | script | 2.7 KB |
| ui/sixel.py | script | 9.2 KB |
| ui/widgets.py | script | 24.3 KB |
| ui/widgets_ext/__init__.py | script | 207 B |
| ui/widgets_ext/braille_chart.py | script | 6.7 KB |
| ui/widgets_ext/fuzzy_filter_list.py | script | 5.0 KB |
| ui/widgets_ext/gradient_rule.py | script | 3.5 KB |
| ui/widgets_ext/preview_pane.py | script | 3.1 KB |
| ui/widgets_ext/radial_glow.py | script | 8.8 KB |
| ui/widgets_ext/slider_track.py | script | 7.7 KB |
ui/registry.py
View on GitHub"""registry.py — widget registry with ``@register`` + folder discovery.
Widgets self-register at import time. :func:`load_all` imports :mod:`ui.widgets`
plus every module under ``ui/widgets_ext/``, so DROPPING A NEW MODULE in that
folder is all it takes to add a widget — mirrors fx/patterns. A module that fails
to import is reported (stderr + :func:`load_errors`) but never takes the rest of
the catalog down.
"""
from __future__ import annotations
import importlib
import pkgutil
import sys
import traceback
from typing import Optional
_REGISTRY: dict[str, type] = {}
_LOADED = False
_LOAD_ERRORS: list[tuple[str, str]] = []
class RegistryError(Exception):
pass
def register(cls: Optional[type] = None, *, replace: bool = False):
"""Class decorator: add a widget to the registry under its ``key``."""
def _do(c: type) -> type:
key = getattr(c, "key", "") or c.__name__.lower()
key = key.lower()
if not replace and key in _REGISTRY:
raise RegistryError(f"widget key already registered: {key!r}")
_REGISTRY[key] = c
return c
return _do(cls) if cls is not None else _do
def get(key: str) -> type:
load_all()
k = key.lower().strip()
if k not in _REGISTRY:
raise KeyError(f"unknown widget {key!r}. Known: {', '.join(sorted(_REGISTRY))}")
return _REGISTRY[k]
def all_widgets() -> list[type]:
load_all()
return [_REGISTRY[k] for k in sorted(_REGISTRY)]
def widget_names() -> list[str]:
load_all()
return sorted(_REGISTRY)
def load_errors() -> list[tuple[str, str]]:
return list(_LOAD_ERRORS)
def load_all(force: bool = False) -> None:
"""Import ui.widgets and every ui/widgets_ext/*.py so ``@register`` runs."""
global _LOADED
if _LOADED and not force:
return
_LOADED = True
# Core widgets module.
try:
importlib.import_module("ui.widgets")
except Exception:
tb = traceback.format_exc()
_LOAD_ERRORS.append(("ui.widgets", tb))
print(f"[ui] WARNING: ui.widgets failed to load: {tb.strip().splitlines()[-1]}",
file=sys.stderr)
# Extension folder (drop-in widgets).
try:
import ui.widgets_ext as pkg
for info in pkgutil.iter_modules(pkg.__path__):
if info.name.startswith("_"):
continue
mod = f"{pkg.__name__}.{info.name}"
try:
importlib.import_module(mod)
except Exception:
tb = traceback.format_exc()
_LOAD_ERRORS.append((mod, tb))
print(f"[ui] WARNING: widget module {mod} failed to load (skipped): "
f"{tb.strip().splitlines()[-1]}", file=sys.stderr)
except Exception:
pass
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |