rtk-ai/rtk

Registry gap: `wc` not auto-rewritten despite `rtk wc` existing

Open

#1682 aperta il 3 mag 2026

Vedi su GitHub
 (2 commenti) (0 reazioni) (0 assegnatari)Rust (2914 fork)batch import
area:clibuggood first issueplatform:macospriority:low

Metriche repository

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

Descrizione

Summary

rtk rewrite returns exit code 1 ("no RTK equivalent") for wc invocations, even though rtk wc is implemented and listed in rtk --help.

Reproduction

rtk 0.34.1, Apple Silicon:

$ rtk wc --help
Word/line/byte count with compact output (strips paths and padding)

$ rtk rewrite "wc -l file.txt"
$ echo $?
1

$ rtk rewrite "wc -lwc *.md"
$ echo $?
1

Compare to other built-ins, all of which auto-rewrite correctly:

$ rtk rewrite "ls -la"      ; echo $?  # → "rtk ls -la", EC=0
$ rtk rewrite "grep -r foo ."; echo $?  # → "rtk grep -r foo .", EC=0
$ rtk rewrite "tail -100 log"; echo $?  # → "rtk read log --tail-lines 100", EC=0

Why this matters

wc is a high-frequency read-only command (counting lines in logs, source files, output piping) and produces 100% replaceable output — rtk wc strips the path-padding noise that wastes tokens on every call.

Likely fix

Add the rewrite rule in src/discover/registry.rs alongside the existing ls/grep/find/tail entries. Should be EC=0 (auto-allow) per the precedent in #1232.

Marking as good first issue / effort-small.

Guida contributor