rtk-ai/rtk

Feature request: rtk passthrough for env -u/env VAR=val command prefix

Open

#1,606 创建于 2026年4月29日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)Rust (2,914 fork)batch import
area:clieffort-mediumenhancementhelp wantedpriority:medium

仓库指标

Star
 (48,085 star)
PR 合并指标
 (平均合并 11天 1小时) (30 天内合并 45 个 PR)

描述

Real-world numbers from rtk discover --all --since 30:

Pattern Calls (30d)
env -u VAR ... <cmd> 92

The env prefix (used to unset/override environment variables before invoking another binary, e.g. env -u HTTP_PROXY -u HTTPS_PROXY curl ...) is a common workaround in environments where certain env vars need to be stripped for specific commands. Today this prefix prevents rtk from rewriting the inner command, because the rewrite engine matches on the leading token, sees env, and bails out.

Suggested wrapper behavior:

rtk env <env-args> <inner-cmd> <inner-args...> should:

  1. Parse env flags / VAR=value assignments / -u VAR removals up to the first non-env token
  2. Recursively rewrite the inner command via the standard rtk rewrite pipeline
  3. Re-emit env <env-args> <rewritten-inner-cmd> so the env modifications still apply

Example:

  • Input: env -u HTTP_PROXY -u HTTPS_PROXY curl -s https://example.com/api
  • Output: env -u HTTP_PROXY -u HTTPS_PROXY rtk curl -s https://example.com/api

This mirrors what rtk already does for direct invocations, but lets the env prefix pass through transparently. The savings come from the inner command's normal RTK filter (curl, go, node, etc.), not from env itself.

Methodology: counts come from rtk discover --all --since 30 against the local Claude Code transcript directory.

贡献者指南