Skip to content

feat(setup): improve demon-setup terminal UX with downstream-safe color#290

Open
viborc wants to merge 1 commit into
mainfrom
feat/setup-terminal-ux
Open

feat(setup): improve demon-setup terminal UX with downstream-safe color#290
viborc wants to merge 1 commit into
mainfrom
feat/setup-terminal-ux

Conversation

@viborc

@viborc viborc commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a tiny stdlib styler (acestep/ui.py) and uses it to colorize the human-facing output of demon-setup and the TensorRT build matrix: green [ok] status, yellow/red warn/fail, light-orange phase banners and titles, green summary labels, and a blue/yellow launch block.
  • Plain color over the existing text. No structural changes, no glyphs/boxes, no reworded or renumbered output.

Downstream-safe by construction

  • Color is emitted only when stdout is an interactive TTY: a pure sys.stdout.isatty() gate, with NO_COLOR / TERM=dumb honored and intentionally no FORCE_COLOR override.
  • On any pipe, file, or captured subprocess (every test and downstream consumer) the gate is off and style() returns its input unchanged, so emitted bytes are byte-identical to before. SGR codes are ASCII-only (no encoding risk); no text, labels, or phase numbers are altered.
  • No new dependency (stdlib os/sys only). obs.py structured logs and build_report.csv are untouched.

Checks

  • pytest tests/unit/test_build_preset.py tests/unit/test_setup_starter_loras.py tests/unit/test_onnx_staleness.py -> 13 passed, unchanged (no test edits).
  • Piped byte-diff (demon-setup, build --dry-run) vs pre-change output: identical, apart from the live disk: NNN GB free number.
  • No ANSI escape bytes in piped/redirected output; color renders on a TTY.

Add a tiny stdlib styler (acestep/ui.py) and use it to colorize the human-facing output of demon-setup and the TensorRT build matrix: green status ([ok]), yellow/red warn/fail, light-orange phase banners and titles, green summary labels, and a blue/yellow launch block. Plain color over the existing text - no structural or wording changes.

Color is emitted ONLY when the target stream is an interactive TTY. The gate is pure sys.stdout.isatty(), with NO_COLOR / TERM=dumb honored and intentionally no FORCE_COLOR override. On any pipe, file, or captured subprocess - i.e. every test and every downstream consumer - the gate is off and style() returns its input unchanged, so emitted bytes are byte-identical to before. SGR codes are ASCII-only (no encoding risk); no text, labels, or phase numbers are altered.

No new dependency (stdlib os/sys only). obs.py structured logs and build_report.csv are untouched.

Verified: the three setup/build unit tests pass unchanged, and a piped byte-diff against pre-change output is identical (apart from the live 'disk: NNN GB free' number).
@viborc viborc requested a review from ryanontheinside June 18, 2026 16:53
@viborc viborc self-assigned this Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant