feat(cli): add git-style pager to diff and log commands#10472
feat(cli): add git-style pager to diff and log commands#10472davidfirst wants to merge 16 commits into
Conversation
diff and log now pipe report output through a pager (less by default) when stdout is an interactive terminal, and print everything at once for AI-agents, CI, and piped output. Add --pager/--no-pager flags plus BIT_PAGER/PAGER/BIT_NO_PAGER env overrides. Opt-in per command via a new Command.pager flag.
PR Summary by Qodofeat(cli): git-style pager for
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Code Review by Qodo
1.
|
measure the rendered output against the terminal size and only invoke the pager when it exceeds one screen. avoids the stuck 'press q to exit' behavior for short output, which the version-dependent 'less -F' fails to auto-quit on modern less (>=590, where -X breaks -F). --pager still forces paging.
|
Code review by qodo was updated up to the latest commit 6c64e4b |
reuse the shared removeChalkCharacters helper from @teambit/legacy.utils instead of a hand-rolled ansi regex, and tidy a doc comment. no behavior change.
|
Code review by qodo was updated up to the latest commit c0ad1f7 |
- writeToPager: resolve success only on a clean/signal exit; a non-zero pager exit now falls back to a direct write instead of silently dropping output (qodo). - parse BIT_PAGER/PAGER with a quote-aware tokenizer so pager paths containing spaces work (qodo). - enable paging for 'bit lane diff' and 'bit lane history-diff', which render the same diff output.
|
Code review by qodo was updated up to the latest commit 785d8e5 |
|
Code review by qodo was updated up to the latest commit 163776d |
- resolve pager env with '??' so BIT_PAGER="" (or PAGER="") disables paging instead of falling through to less (qodo). - cap fitsOnScreen's split at rows+1 lines so the array doesn't scale with large output (qodo).
|
Code review by qodo was updated up to the latest commit 6a333aa |
check the explicit --no-pager/--pager flags before the BIT_NO_PAGER env var so a single 'bit diff --pager' can force paging even when BIT_NO_PAGER is exported globally (qodo).
|
Code review by qodo was updated up to the latest commit c52c23b |
thread a 'force' flag into writeToPager so an explicit --pager falls back to a real pager even when BIT_PAGER is set to an empty string or 'cat' (which otherwise disable paging). without --pager the disable convention is preserved (qodo).
|
Code review by qodo was updated up to the latest commit f510bc7 |
isInteractiveTerminal now disables paging when an AI-agent env var is present even if set to an empty string, matching the documented 'when any is present we never page' intent (qodo).
|
Code review by qodo was updated up to the latest commit dbc3b21 |
add an isEnvSet helper and use it for CI, the ai-agent markers, and BIT_NO_PAGER so an empty-string value still disables paging (consistent, and keeps the 'CI/automation never pages' guarantee) (qodo).
|
Code review by qodo was updated up to the latest commit 4e42146 |
gate the LESS=FRX default on the resolved pager command being less (basename match, incl. paths and less.exe) so it doesn't leak into other pagers or wrapper scripts (qodo).
|
Code review by qodo was updated up to the latest commit 887a4f7 |
|
Code review by qodo was updated up to the latest commit e3c7a75 |
isDaemon covers both the bit-cli-server (IPC, no terminal) and the experimental 'bit cli' REPL (a pager would contend with readline over the TTY); neither should page. comment-only, behavior unchanged (qodo).
|
Code review by qodo was updated up to the latest commit 0430dd1 |
the promise resolves after the pager process exits (not on handoff); document that accurately so future callers know it blocks until the pager quits (qodo).
|
Code review by qodo was updated up to the latest commit 9cfc75a |
the capsule build can resolve two copies of @teambit/component.sources (peer variant), producing a spurious TS2345 on applyTransformers that doesn't reproduce in local tsc. add a targeted @ts-ignore to unblock 'bit ci pr'. unrelated to the pager change in this PR.
|
Code review by qodo was updated up to the latest commit 63b5835 |
`bit diff` and `bit log` printed everything at once with no pager. This adds git-style paging: interactive terminals get a pager, while AI-agents, CI, and piped output keep getting the full output at once (so agents never receive partial/paged data).