`rtk ls`: `-a` is ignored; `-1` controls hidden-entry visibility instead
Summary
In rtk ls, the -a flag has no effect on which entries are listed, and -1 — which should only control one-entry-per-line formatting — is what determines whether hidden entries appear. The result is that three of the four common flag combinations disagree with native ls.
Environment
- rtk 0.45.0 (Homebrew)
- macOS 26.3.1, arm64
- Default config; no
lsalias;LANGunset,LC_COLLATE=C
Reproduction
mkdir -p /tmp/rtkrepro && cd /tmp/rtkrepro
touch visible.txt .hidden
| form | native ls |
rtk ls |
correct? |
|---|---|---|---|
| (no flags) | visible.txt |
.hidden visible.txt |
no — shows a dotfile that should be hidden |
-1 |
visible.txt |
. .. .hidden visible.txt |
no — adds ., .. and a dotfile |
-a |
. .. .hidden visible.txt |
.hidden visible.txt |
no — omits . and .. |
-1a |
. .. .hidden visible.txt |
. .. .hidden visible.txt |
yes |
Deterministic across repeated runs. Exit code is 0 in all cases.
Expected
rtk ls should honour -a for hidden-entry inclusion, and -1 should affect formatting only. Concretely: without -a, entries beginning with . should be omitted; with -a, . and .. should be included.
Impact
On a real project directory this inflates the listing noticeably — a repo root here returns 25 entries from ls -1 and 32 from rtk ls -1, the extras being ., .., .DS_Store, .claude, .git, .gitignore, .superpowers. Since rtk exists to reduce tokens sent to an LLM, -1 listings are currently larger than the native command they replace, and consumers that count entries will over-count.
Possibly related
This may be a regression from the fix for #803 (rtk ls -1 returned empty output), which this version does resolve — -1 no longer returns (empty). I have not read the implementation, so the connection is a guess rather than a finding.
wshm · Automated triage by AI
🔍 Automated Triage
| 🐛 Category | bug |
| 🟠 Priority | high |
| 🎯 Confidence | 95% |
Summary
rtk ls has -a and -1 flag semantics swapped/conflated (hidden-entry filtering tied to -1 instead of -a, likely a regression from the #3527/#803 fix); restore correct flag independence so -a controls hidden entries and -1 only controls line formatting.
This looks like a simple fix that could be auto-resolved. Repo maintainers can use
/wshm fixto attempt it.
📁 Relevant files
src/commands/ls.rs
Triaged automatically by wshm · This is an automated analysis, not a human review.
Partially fixed on develop — not labelling this resolved-pending-close, because one of the four rows still diverges.
Re-ran the table against a build of current develop (8b891a5c), LC_ALL=C, in the repro directory (visible.txt + .hidden):
| form | native ls |
rtk ls on develop |
correct? |
|---|---|---|---|
| (no flags) | visible.txt |
visible.txt |
yes (was showing the dotfile) |
-1 |
visible.txt |
visible.txt |
yes (was adding ., .., .hidden) |
-a |
. .. .hidden visible.txt |
.hidden visible.txt |
no — still omits . and .. |
-1a |
. .. .hidden visible.txt |
.hidden visible.txt |
no — same |
So the -1-controls-hidden-entries half of this report is gone, and -a no longer has "no effect". What remains is narrower than the title: rtk ls -a lists dotfiles but drops the . and .. entries that native ls -a includes.
Worth deciding deliberately rather than fixing by reflex — ./.. in a compacted listing are arguably noise RTK is right to drop, in which case this should be closed as intended behaviour and the omission documented. Flagging for a maintainer call.
Fixed by #3470, shipped in v0.47.0: rtk ls -a lists hidden files, -1 is accepted and changes nothing, and the output is already one entry per line, so the two problems reported here no longer happen. . and .. are left out of the listing on purpose. If you still see a difference from native ls on the latest release, please comment with the command and the directory contents.