`rtk ls -R` flattens recursive output and loses hierarchy context
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 81.1k
- Forks
- 5.1k
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 35
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the recursive output generated by rtk ls -R docs/; no source file or test is named in the issue. Reproduce the example with duplicate filenames and nested directories, then add coverage showing that directory context remains unambiguous while output stays compact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100