## Problem `rtk ls <dir> | wc -l` returns a count inflated by 2 (blank line + summary line) because the `📊` summary is always written to stdout. ```bash rtk ls src/ | wc -l # returns N+2 (wrong) ls src/ | wc -l # returns N (correct) ``` This breaks any script that pipes `rtk ls` to count files or process entries. ## Unix Convention Metadata/summary goes to stderr or is suppressed when stdout is not a TTY. RTK already uses this pattern in `gain.rs` via `std::io::IsTerminal`. `ls` itself does this — no summary when piped. ## Proposed Fix Suppress the `📊` summary line when stdout is piped (not a TTY). Show it only in interactive mode. ### Changes to `src/ls.rs` - Add `use std::io::IsTerminal;` - Split `compact_ls()` return value into `(entries: String, summary: String)` tuple - In `run()`: always print entries, only print summary when `stdout().is_terminal()` - Track only what is actually sent to stdout for `rtk gain` accuracy ## Verification ```bash # Pipe mode — should NOT show summary rtk ls src/ | wc -l # TTY mode — should show summary rtk ls src/ ```
Activity
pszymkowiak commentedon Mar 20, 2026
🔍 Automated Triage
buglowSummary
rtk ls summary line written to stdout inflates pipe counts; should be suppressed when stdout is not a TTY. PR #503 already in progress.
📁 Relevant files
src/ls.rsTriaged automatically by wshm · This is an automated analysis, not a human review.
fix(ls): suppress summary line when stdout is piped
fix(ls): suppress summary line when stdout is piped