Skip to content

Registry gap: wc not auto-rewritten despite rtk wc existing #1682

Closed

Description

@LucasSantana-Dev

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.

Activity

  1. pszymkowiak commented on May 27, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟢 Priority low
    🎯 Confidence 88%

    Summary

    Registry missing rewrite rule for wc despite rtk wc existing; add entry in registry.rs alongside other built-ins.

    This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.

    📁 Relevant files
    • src/discover/registry.rs

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

  2. bte808 commented on Jun 5, 2026

    @bte808

    I checked current develop while looking for a small contribution. This appears to be fixed already: src/discover/rules.rs now has a ^wc(\s|$) rule mapping to rtk wc, and src/discover/registry.rs includes regression tests for classifying and rewriting wc -l src/main.rs and multi-file wc invocations.

    Relevant tests I found in current develop:

    • test_classify_wc_supported
    • test_classify_wc_multi_file
    • test_rewrite_wc
    • test_rewrite_wc_multi_file

    So this issue may be ready to close unless there is a remaining release-version concern.

  3. KuSh commented on Sep 5, 2026

    @KuSh
    Collaborator

    This is fixed on develop: the rewrite registry now has a wc rule, and rtk rewrite "wc -l file.txt" returns rtk wc -l file.txt (auto-allow) instead of exiting 1. Multi-file invocations such as wc -lwc *.md are rewritten too, with regression tests covering both. Please reopen or comment if wc is still skipped on the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clibuggood first issueplatform:macospriority:low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions