rtk-ai/rtk

Bug: `rtk ls` returns empty output when shell alias `ls` is mapped to `eza`

Open

#1321 aperta il 15 apr 2026

Vedi su GitHub
 (2 commenti) (10 reazioni) (0 assegnatari)Rust (2914 fork)batch import
area:clibugeffort-mediumfilter-qualityhelp wantedplatform:linuxpriority:mediumresolved-pending-close

Metriche repository

Star
 (48.085 star)
Metriche merge PR
 (Merge medio 11g 1h) (45 PR mergiate in 30 g)

Descrizione

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 --version to 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.

Guida contributor