fix(cli): wrap help output on narrow terminals - #303
Open
claude[bot] wants to merge 1 commit into
Open
Conversation
Commander only wraps a description when the aligned description column
is at least `minWidthToWrap` (40) characters wide. The widest command
term ("cp|copy [options] <src> <dest>") is 30 characters, so that column
is only `columns - 34` wide and the check fails on any terminal narrower
than ~75 columns. When it fails Commander does not fall back to a
narrower column — it stops wrapping altogether and emits each
description as one unwrapped line, up to 192 characters for
`tigris --help`. Narrow terminals rendered worse than the 80-column
default, not better.
Below the readable-column threshold, stack each description under its
own term and wrap it to the full terminal width instead. Verified in a
pty: the longest line at 37/46/60 columns drops from 192 to 37/46/60,
and output at 80 columns and wider is byte-identical to before.
Assisted-by: Claude Opus 5 (1M context) via Claude Code
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RXrAPPY3ZWz7k3E73V6c6M
rbarabas
approved these changes
Sep 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Katie Schilling · Slack thread
Before:
tigris --helpin a 37-column terminal. Every command description runs off the right edge on a single line — the longest is 192 characters, so the output is unreadable and unscrollable. This is not a browser-only problem: it happens in any real terminal narrower than about 75 columns (a split tmux pane, a side-by-side editor terminal, a phone SSH client). It surfaced via the browser shell at tigrisdata.com/try-cli, which reports ~37 columns;packages/cli-shellwas already passing the true width through to the CLI'sprocessshim correctly, so the CLI was seeing 37 and still emitting 192-character lines.After: below the readable-column threshold each description is stacked under its own term and wrapped to the terminal width. Nothing exceeds the terminal width at 37, 46 or 60 columns.
Longest line in
tigris --help, measured in a real pty against a fresh build:How
Commander aligns every description in a column to the right of the command/option terms, and only wraps a description when that column is at least
minWidthToWrap(40) characters wide. Our widest term,cp|copy [options] <src> <dest>, is 30 characters, so the column is onlycolumns - 34wide and the check fails below ~75 columns. Crucially, when it fails Commander does not fall back to a narrower column —Help.formatItemskips wrapping altogether and emits the description as one unwrapped line. That is why narrow terminals rendered worse than the 80-column default rather than better.createProgramnow passes a smallconfigureHelpoverride (narrowHelpConfigurationinpackages/cli/src/cli-core.ts). It keeps Commander's aligned two-column layout whenever the inline column would be at least 34 characters, and otherwise stacks the description under its term and wraps it tocolumns - 6. It also lowersminWidthToWrapso Commander will perform that full-width wrap. The override is applied beforeregisterCommands, so every subcommand inherits it via Commander'scopyInheritedSettings—tigris buckets --helpat 37 columns drops from 182 characters to 43 (the unwrappedUsage:line, which Commander never wraps).No
specs.yamldescriptions were touched.Alternative, if you'd prefer it: the one-line version is
program.configureHelp({ minWidthToWrap: 12 }). I tried it first and it isn't enough — at 37 columns the inline column is only 3 characters wide, so Commander's own floor still vetoes the wrap and the output stays at 192 characters; at 46 columns it does wrap, but into a 12-character ribbon that blowstigris --helpup to 233 lines. Happy to swap to any variant of the threshold (34) or indent (6) you prefer.Checks run
pnpm install --frozen-lockfile— cleanpnpm run lint(Biome, 434 files) — cleanpnpm -r run build— cleanpnpm -r run publint— cleanpackages/clivitest run— 40 files, 1036 passed, 224 skipped (integration tests needing bucket credentials)packages/cli/test/cli-core.test.tspatchfor@tigrisdata/cli), which also switches CI's gated test job on for this PR🤖 Generated with Claude Code
https://claude.ai/code/session_01RXrAPPY3ZWz7k3E73V6c6M
Generated by Claude Code
Note
Low Risk
Help formatting only; no command execution, auth, or data-path changes, and wide-terminal output is intended to stay the same.
Overview
Fixes unreadable
tigris --help(and inherited subcommand--help) when the terminal is narrower than ~75 columns, where Commander stopped wrapping descriptions and emitted lines up to ~192 characters.createProgramnow callsconfigureHelpwithnarrowHelpConfiguration: when the inline description column would be too narrow, each term’s description is stacked underneath and wrapped to the terminal width (with a lowerminWidthToWrapso wrapping actually runs). Wider terminals (roughly 80+ columns) keep Commander’s usual two-column layout.Adds a patch changeset for
@tigrisdata/cliand three unit tests that assert line length, stacked layout at 37 columns, and aligned layout at 100 columns.Reviewed by Cursor Bugbot for commit 5bff7fd. Bugbot is set up for automated code reviews on this repo. Configure here.