Repository navigation
feat(cli): polish color, completions, narrow-terminal output (#958) - #1115
Conversation
Adds NO_COLOR environment-variable support to `should_use_plain` so downstream pipelines that follow the cross-tool no-color.org convention get ANSI-free output without having to set the Polylogue-specific POLYLOGUE_FORCE_PLAIN override. Adds a width-aware layout for `output_summary_list` and `output_search_hits`: at wide (>=80), mid (>=60), narrow (>=40), and sub-narrow widths the column set and title-truncation budget degrade gracefully so a 40-column terminal still produces a readable table. Pins both contracts with `tests/unit/cli/test_color_and_layout.py`. Ref #958 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
CLI polish pass for #958 covering two concrete user-visible behaviors:
NO_COLOR support and graceful narrow-terminal output. The existing
completions surface (
polylogue/cli/shell_completion_values.py, lastrevised by #1109) already covers the issue's dynamic-completer
acceptance criteria — provider names, conversation IDs, tags, repo,
cwd-prefix, tool names — so this PR does not touch it.
Problem
POLYLOGUE_FORCE_PLAINbut ignored the cross-toolNO_COLORconvention (https://no-color.org/). Downstream pipelinessetting
NO_COLOR=1still got ANSI escape codes in any TTY path.output_summary_listandoutput_search_hitsbuilt fixed-shape Richtables (ID/Date/Provider/Title/Msgs[/Match]) with a 63-char title
budget, regardless of terminal width. At narrow widths (≤60 columns)
the table overflowed; at the 40-column edge it became unreadable.
Solution
polylogue/cli/shared/formatting.py:no_color_requested()honors theNO_COLORenv var per theno-color.org spec (presence of any non-empty value = no color).
should_use_plain()now bridgesNO_COLORto plain mode, matchingthe user-visible effect ("no color in output") without touching
polylogue/ui/(owned by another lane). Documented as a deliberateshort-form: true color-suppression-without-layout-drop would require
flipping
no_color=Falseinpolylogue/ui/facade.py.polylogue/cli/query_output.py:_summary_list_layout(width),_search_hit_layout(width),_title_budget(width)helpers pin a deterministicwide(≥80)/mid(≥60)/narrow(≥40)/sub-narrow column selection.
output_summary_listandoutput_search_hitsconsultenv.ui.console.widthand assemble columns/rows from the selectedset; below 40 columns we fall back to a single
titlecolumn ratherthan letting Rich wrap.
tests/unit/cli/test_color_and_layout.py:NO_COLORdetection semantics (presence vs empty), theshould_use_plainbridge, end-to-endpolylogue listbyte-levelANSI absence under
NO_COLOR=1, the layout column sets at everybreakpoint, and the title-budget monotonicity contract.
Out of scope (deferred to follow-ups):
NO_COLOR(requirespolylogue/ui/facade.pyedit; ui/ is owned by another lane).ergonomics pass).
Verification
The new contracts (
test_color_and_layout.py) cover both behaviors:13 tests, all pinned to public-observable surfaces (env var, exit
codes, column-set tuples, title-budget integers).
Ref #958
🤖 Generated with Claude Code