Skip to content

feat(ls): cap listing with tee tail hint and standard dotfile semantics - #3470

Merged
aeppling merged 3 commits into
developfrom
feat/ls-cap-tee-tail-hint
Sep 1, 2026
Merged

aeppling merged 3 commits into
developfrom
feat/ls-cap-tee-tail-hint

Conversation

@aeppling

@aeppling aeppling commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

rtk ls silently dropped content: no display cap on large listings, noise-filtered dirs vanished without a trace, and dotfiles were shown by default via a forced -a.

Now:

  • Listings are capped; everything RTK hides (overflow + filtered noise) is recoverable with a single tee tail command that returns only unseen content.
  • Dotfiles follow standard ls behavior, shown only when -a is passed.
  • The TTY-only summary footer is removed; agents never saw it.

- Cap displayed entries at CAP_INVENTORY (50); overflow spills to a tee
  file holding ONLY the dropped entries, recoverable with one command:
  [see remaining: tail -n +1 ~/.local/share/rtk/tee/<ts>_ls-hidden.log]
- Record RTK-filtered noise dirs (non-dot only) in the same tee file and
  surface counts as "... (N more, M filtered)"
- Follow standard ls dotfile semantics: pass -a to the underlying ls only
  when the user asked for it (long format kept for parsing)
- Drop the TTY-only Summary line and extension histogram: agents never
  saw it and it misled humans about agent-visible output

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BZkPEr1jwjMViU4h4uPUpN
@pszymkowiak

Copy link
Copy Markdown
Collaborator

Tested current head (67a3576). Two real bugs confirmed locally, two cleanup points.

1. -A silently drops dot-prefixed noise dirs with zero trace (ls.rs:303)

mkdir -p .git node_modules && touch README.md
/bin/ls -A .        # → .git  node_modules  README.md
rtk ls -A .         # → README.md, "1 filtered" (node_modules only)

The teed recovery file (the one the "N filtered" hint points to) only contains node_modules/ — .git isn't in the listing, isn't counted in "filtered", and isn't in the recovery file. It's just gone. show_all detection (a.contains('a')) doesn't recognize uppercase -A, and the flag isn't stripped before forwarding to the real ls, so the child actually runs with -A (dotfiles included) while rtk's own noise filter still assumes show_all == false and drops them — the exact "filtered dir vanishes without a trace" bug this PR is meant to fix.

2. Tracking label hardcodes -la even when -a wasn't passed

rtk ls .   # no -a flag at all

rtk gain --history records this as rtk ls -la . regardless — the label at line 87 is a fixed string, not built from the actual flags used. Misrepresents what was actually run.

Two smaller cleanup points, not bugs:

  • Same concept named 3 different ways across the file: hidden (the Vec in compact_ls), 'filtered' (its own doc comment), noise (in run()), filtered again (as hidden_hint's param name).
  • hidden_hint() hand-rolls its own two-category overflow text instead of extending the existing shared join_with_overflow helper (core/utils.rs:151).

@aeppling

Copy link
Copy Markdown
Contributor Author

@pszymkowiak updated

@pszymkowiak pszymkowiak left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified locally (merged onto #3798 since develop itself doesn't compile): fmt/clippy clean, 2975 tests pass (+10 new). Smoke-tested the binary: dotfiles now hidden by default and shown with -a, filtered noise dirs produce the ... (N filtered) note plus a one-shot tee tail command containing only the dropped entries — recovery works as advertised. Good call removing the TTY-only summary agents never saw, and recording unparsable lines as hidden instead of silently dropping them. LGTM — merge after #3798.

@aeppling
aeppling merged commit aa40853 into develop Sep 1, 2026
16 of 17 checks passed
@rtk-release-bot rtk-release-bot Bot mentioned this pull request Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants