feat: cap markdown render width on wide terminals + add --width flag#119
Merged
steipete merged 2 commits intosteipete:mainfrom Mar 7, 2026
Merged
feat: cap markdown render width on wide terminals + add --width flag#119steipete merged 2 commits intosteipete:mainfrom
steipete merged 2 commits intosteipete:mainfrom
Conversation
On wide terminals (>120 columns), the rendered summary becomes hard to read because lines stretch across the full width. Cap the default markdown render width at 120 columns for better readability. Add a --width <columns> CLI flag to let users explicitly override the terminal width used for markdown rendering. Fixes steipete#101 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
|
Landed via temp rebase onto main. Thanks @howardpen9! |
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.
Summary
Fixes #101 — wide terminals make summaries tough to read because lines stretch across the full terminal width.
markdownRenderWidth()now appliesMath.min(w - 1, 120), so text stays readable even on very wide terminals. This is the default behavior with no flags needed.--width <columns>CLI flag: Users can explicitly override the render width if they prefer a different value (e.g.,--width 80for narrow output, or--width 200to use the full width).--widthflag works by injecting the value intoenv.COLUMNS, which flows through the existingterminalWidth()→markdownRenderWidth()pipeline — all 7 call sites automatically get the override with zero changes needed.Implementation
src/run/terminal.tsmarkdownRenderWidth()caps atDEFAULT_MAX_RENDER_WIDTH(120)src/run/help.ts--width <columns>CLI optionsrc/run/runner.ts--width, validate ≥ 20, inject intoenv.COLUMNStests/terminal.test.tsTest plan
vitest run tests/terminal.test.ts— all 7 tests pass (3 new)tsc -p tsconfig.build.json --noEmit— cleansummarize "https://example.com"on a wide terminal → verify lines cap at ~120 charssummarize "https://example.com" --width 80→ verify narrower outputsummarize "https://example.com" --width 200→ verify wider output (up to 200)🤖 Generated with Claude Code