rtk-ai/rtk
GitHub で見るBug: `rtk ls` returns empty output when shell alias `ls` is mapped to `eza`
Open
#1,321 opened on 2026年4月15日
area:clibugeffort-mediumfilter-qualityhelp wantedplatform:linuxpriority:mediumresolved-pending-close
Repository metrics
- Stars
- (48,085 stars)
- PR merge metrics
- (平均マージ 11d 1h) (30d で 45 merged PRs)
説明
Description
When using zsh with alias ls='eza --icons --group-directories-first', running rtk ls returns empty output, while rtk proxy ls works correctly.
Environment
- OS: Linux
- Shell: zsh
- RTK version: 0.36.0
- eza version: (run
eza --versionto get) - Alias:
ls: aliased to eza --icons --group-directories-first
Reproduction
# 1. Set up eza alias in zsh
alias ls='eza --icons --group-directories-first'
# 2. Run rtk ls - returns empty
rtk ls .
# Output: (empty)
# 3. Run rtk proxy ls - works correctly
rtk proxy ls .
# Output: shows files correctly
# 4. Direct eza works
eza --icons --group-directories-first .
# Output: shows files with icons
Expected Behavior
rtk ls should handle cases where shell ls is aliased to eza, or at least:
- Fallback to raw output when parsing fails
- Provide clear error/warning instead of silently returning empty
Root Cause Analysis
1. RTK's ls filter parses output from underlying ls command
2. When ls is aliased to eza, output format differs (icons, colors, different column structure)
3. Parser fails to parse eza's output, returns empty silently
4. rtk proxy ls bypasses parser, so works correctly
Related Issues
- #803: rtk ls -1 returns empty output (similar parser bug)
- PR #962: fix(ls): strip -1 flag (in progress)
Proposed Solutions
1. Detect shell alias: Before parsing, check if ls is aliased to non-standard tool (eza, exa, lsd)
2. Fallback gracefully: If parser returns empty on non-empty directory, fall back to raw output
3. Add warning: Emit warning when detecting incompatible ls alias
4. Force native ls: Use /usr/bin/ls or command ls internally instead of shell alias
Impact
This breaks RTK's hook integration when users have modern ls replacements (eza/exa/lsd) aliased. AI agents silently get empty directory listings, causing incorrect reasoning about project structure.