rtk-ai/rtk

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

Open

#1,321 创建于 2026年4月15日

在 GitHub 查看
 (2 评论) (10 反应) (0 负责人)Rust (2,914 fork)batch import
area:clibugeffort-mediumfilter-qualityhelp wantedplatform:linuxpriority:mediumresolved-pending-close

仓库指标

Star
 (48,085 star)
PR 合并指标
 (平均合并 11天 1小时) (30 天内合并 45 个 PR)

描述

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.

贡献者指南