Repository navigation
Description
When running rtk ls -R <directory>, the output is flattened into a list of names without enough hierarchy context to determine where each entry belongs.
I understand the goal may be to keep the output compact and token-efficient, and I am not asking for full relative paths for every file.
However, the current output removes too much structure. It becomes ambiguous, especially when multiple subdirectories contain files with the same name.
Steps to reproduce
Given a structure like this:
docs/
docs/group-a/
docs/group-a/overview.md
docs/group-a/details.md
docs/group-b/
docs/group-b/overview.md
docs/group-b/examples.md
docs/group-b/nested/
docs/group-b/nested/notes.md
docs/empty-dir/
docs/readme.md
Run:
rtk ls -R docs/Actual behavior
The output is flattened and loses directory context:
group-a/
group-b/
nested/
empty-dir/
readme.md 2.4K
overview.md 1.9K
details.md 3.1K
overview.md 2.2K
examples.md 4.0K
notes.md 1.1K
From this output, it is not possible to determine:
- which directory each file belongs to
- whether
nested/is insidegroup-b/or at the root - whether later entries are still inside a previously listed directory
Expected behavior
The output should remain compact, but preserve enough hierarchy context to be unambiguous.
Full relative paths are not required. However, the output must provide a way to understand directory structure and file ownership.
Example acceptable outputs
A minimal tree format would already solve the ambiguity while staying compact:
readme.md 2.4K
group-a/
overview.md 1.9K
details.md 3.1K
group-b/
overview.md 2.2K
examples.md 4.0K
nested/
notes.md 1.1K
empty-dir/
Another compact option would be a section-based format:
readme.md 2.4K
group-a/
overview.md 1.9K
details.md 3.1K
group-b/
overview.md 2.2K
examples.md 4.0K
group-b/nested/
notes.md 1.1K
empty-dir/
Both formats preserve hierarchy context without requiring full relative paths on every file entry.
The exact format is flexible. The key requirement is that recursive output must make directory context explicit.
Why this matters
Without hierarchy context, recursive output is ambiguous for both humans and scripts, especially when duplicate file names exist in different directories.
Environment
- OS: Windows
- Shells tested: PowerShell, Git Bash, WSL
- RTK version:
0.30.1
Additional context
This does not appear to be shell-specific. The issue seems to be in how recursive output is generated or rendered, as directory hierarchy information is lost.
Activity
pszymkowiak commentedon Mar 20, 2026
🔍 Automated Triage
bugmediumSummary
rtk ls -R flattens recursive output losing directory hierarchy; PR #1251 already open to fix it — deprioritize until PR lands.
Triaged automatically by wshm · This is an automated analysis, not a human review.
fix: ls -R hierarchy + tracking baseline + incompatible flags (#714, #…
fix: ls -R hierarchy + tracking baseline + incompatible flags (rtk-ai…
fix(ls): preserve hierarchy for -R and passthrough incompatible flags (…
fix(ls): keep the directory hierarchy of ls -R, including with -l (#714)