rtk-ai/rtk

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

Open

#1,682 建立於 2026年5月3日

在 GitHub 查看
 (2 留言) (0 反應) (0 負責人)Rust (2,914 fork)batch import
area:clibuggood first issueplatform:macospriority:low

倉庫指標

Star
 (48,085 star)
PR 合併指標
 (平均合併 11天 1小時) (30 天內合併 45 個 PR)

描述

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.

貢獻者指南