rtk icon indicating copy to clipboard operation
rtk copied to clipboard

`rtk ls -1` returns empty output

Open NickSdot opened this issue 8 months ago โ€ข 7 comments

I let Claude explain itself what went wrong...

Bug

rtk ls -1 <directory> returns empty output even when the directory contains files.

Reproduction

# Standard ls works
ls -1 .concept/plan/
# Shows 11 files                                                                                                                                                          
                
# RTK ls without flags works                                                                                                                                              
rtk ls .concept/plan/                                                                                                                                                   
# Shows 11 files with sizes                                                                                                                                               
                                                                                                                                                                        
# RTK ls -1 fails                                                                                                                                                       
rtk ls -1 .concept/plan/                                                                                                                                                  
# Returns empty         

Expected

rtk ls -1 should return one filename per line, same as ls -1.

Impact

When Claude Code hooks rewrite ls -1 โ†’ rtk ls -1, the command silently returns no output, causing Claude to incorrectly report directories as empty.

NickSdot avatar Mar 25 '26 04:03 NickSdot

hey @NickSdot I experiment the issue myself too, it looks like plenty of flags break the internal format for the compact_ls parser. I am creating a PR to address this now.

msegoviadev avatar Mar 25 '26 19:03 msegoviadev

[w] wshm ยท Automated triage by AI

๐Ÿ” Automated Triage

๐Ÿ› Category bug
๐ŸŸ  Priority high
๐ŸŽฏ Confidence 95%

Summary

The -1 flag causes rtk ls to return empty output instead of one-filename-per-line; a fix PR (#962) is already in progress.

This looks like a simple fix. Only repo maintainers can trigger auto-fix.


Triaged automatically by wshm ยท This is an automated analysis, not a human review.

pszymkowiak avatar Mar 26 '26 08:03 pszymkowiak

Hasn't this been fixed yet? Running the rtk ls command also returns empty output

KingingWang avatar Apr 14 '26 03:04 KingingWang

same for me. this skill is basically unusable without fixing this bug

sizhky avatar Apr 28 '26 18:04 sizhky

Should be resolved in https://github.com/rtk-ai/rtk/pull/1692 aka 0.39.0

aeppling avatar May 06 '26 16:05 aeppling

Confermo bug presente in rtk 0.35.0 (macOS arm64, Homebrew). Use case aggiuntivo: il bug si manifesta in chain di comandi quando il PreToolUse Claude Code hook riscrive entrambi.

# Repro minimale (in Claude Code, hook attivo):
ls -1 /some/dir; echo MID; ls -1 /another/dir

Il rewrite produce rtk ls -1 X; echo MID; rtk ls -1 Y, e entrambi gli rtk ls -1 ritornano (empty) (esadecimale 28656d707479290a). Effetto pratico: false positive di 'directory vuota' che fa skippare logica anti-doppione (caso reale: orchestratore daily-check che ha mancato di rilevare il report del giorno).

Workaround per ora: exclude_commands = ["ls"] in ~/Library/Application Support/rtk/config.toml.

Resto in attesa della release del fix. Thanks.

francescotinti avatar May 10 '26 22:05 francescotinti

Fix shipped in v0.39.0 via #1692 (per @aeppling's note above). Closing as resolved.

If anyone still hits rtk ls -1 returning empty output on v0.39.0 or newer, please reopen with:

  • rtk --version
  • OS / shell
  • exact command (including any hook rewrite if running inside Claude Code)

Thanks @msegoviadev for the PR, and @KingingWang / @sizhky / @francescotinti for the repros.

pszymkowiak avatar May 11 '26 18:05 pszymkowiak