Skip to content

Wrap every remaining output path and fix the TTY detection - #5

Merged
gurnben merged 1 commit into
mainfrom
fix/wrap-remaining-paths
Oct 21, 2026
Merged

gurnben merged 1 commit into
mainfrom
fix/wrap-remaining-paths

Conversation

@gurnben

@gurnben gurnben commented Oct 21, 2026

Copy link
Copy Markdown
Member

Summary

Several print paths bypassed the terminal-width wrapping added earlier, producing the odd, not-left-aligned output:

  • Unwrapped lines: the full-permission and standalone-profile warnings (141 cells on a 60-column terminal), artifact path lines in the run summary, doctor check details, and init step logs.
  • Misaligned blocks: the run summary's harness-error text kept the source indentation of the harness's styled error boxes (crush renders its 401 box with heavy leading padding), so printed lines started mid-screen.
  • Overflowing table: the skills table's four fixed columns (28+15+11+3) cannot fit a narrow terminal at all.

Fixes:

  • Every remaining print path wraps to the measured terminal width.
  • The harness-error block is normalized for display: per-line trimming drops the error-box decoration so re-wrapped lines start at the left edge (the journal keeps the raw bytes).
  • The skills table drops its description column below ~77 columns instead of overflowing.
  • Bonus hang fix: while verifying, traust-cli skills < /dev/null hung forever — interactive screens gated on "stdin is a character device", which /dev/null satisfies, so the picker opened and waited. The check is now a real ioctl-based terminal test (term.IsTerminal) on both stdin and stdout.

Verification

  • PTY capture at 60 columns with ANSI-aware width measurement: zero over-width lines across run output (progress, summary, harness-error block), doctor, and the skills table; all continuation lines left-aligned (intended indents only).
  • New regression tests for the block normalization (trim + wrap + newline preservation); full suite with race detector, vet, staticcheck clean.

💘 Generated with Crush

Several print paths bypassed the terminal-width wrapping added earlier:
the full-permission and standalone-profile warnings (141 cells on a
60-column terminal), the run summary's harness-error block — which kept
the source indentation of the harness's styled error boxes, so lines
started mid-screen — artifact paths, doctor details, init step logs,
and the skills table, whose four fixed columns cannot fit a narrow
terminal at all.

All of them now wrap to the measured width. The harness-error block is
normalized for display: per-line trimming drops the error-box
decoration so re-wrapped lines start at the left edge (the journal
keeps the raw bytes), and the skills table drops its description
column below ~77 columns instead of overflowing.

Fixing this surfaced a hang: interactive screens gated on "stdin is a
character device", which /dev/null satisfies — `traust-cli skills <
/dev/null` opened the picker and waited forever. The check is now a
real ioctl-based terminal test on both stdin and stdout.

Verified by capturing PTY output at 60 columns and measuring every
line's display width: zero over-width lines across run output, doctor
and the skills table, with all continuation lines left-aligned.

💘 Generated with Crush

Assisted-by: Crush:rits/zai-org/glm-5-3
@gurnben
gurnben requested a review from a team as a code owner October 21, 2026 15:02
@gurnben
gurnben merged commit 128277c into main Oct 21, 2026
2 checks passed
@gurnben
gurnben deleted the fix/wrap-remaining-paths branch October 21, 2026 15:06
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