rtk-ai/rtk

Normalize .venv/bin/ and virtualenv prefixes before registry lookup

Open

#1.206 geöffnet am 10. Apr. 2026

Auf GitHub ansehen
 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)Rust (2.914 Forks)batch import
area:clibugeffort-mediumenhancementhelp wantedpriority:medium

Repository-Metriken

Stars
 (48.085 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 11T 1h) (45 gemergte PRs in 30 T)

Beschreibung

Problem

RTK does not match virtualenv-prefixed tool invocations against its registry, even when a filter exists for the tool.

Repros (rtk 0.35.0):

$ rtk rewrite ".venv/bin/pytest --tb=short"
# exit 1 — no rewrite, even though rtk pytest exists

$ rtk rewrite ".venv/bin/ruff check ."
# exit 1 — no rewrite, even though rtk ruff exists

Note: rtk discover -a classifies these as "MISSED SAVINGS" with status existing (implying RTK can handle them), but rtk rewrite fails. The discover classification is based on tool-name recognition, not actual rewrite-engine matching — this discrepancy is misleading.

Paths to normalize:

  • .venv/bin/<tool> — relative virtualenv (most common)
  • ./.venv/bin/<tool> — explicit relative
  • /home/user/project/.venv/bin/<tool> — absolute path to venv bin directory
  • venv/bin/<tool>, virtualenv/bin/<tool> — alternate venv directory names
  • On Windows: .venv/Scripts/<tool>.exe

Expected behavior

.venv/bin/pytest --tb=short → strip prefix, look up pytest in registry → rtk pytest --tb=short

If the tool has no RTK filter after normalization, fall through to passthrough as today.

Impact

In this project: 550 .venv/bin/pytest and 376 .venv/bin/ruff invocations per rtk discover -a — ~926 total currently passing through unfiltered (~178K estimated saveable tokens).

Contributor Guide