rtk-ai/rtk

Feature Request rtk ssh subcommand — remote command output filtering

Open

#333 创建于 2026年3月5日

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

仓库指标

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

描述

rtk ssh subcommand — remote command output filtering

Running rtk discover on a codebase with multiple remote dev servers shows SSH as by far the largest unhandled savings opportunity:

TOP UNHANDLED COMMANDS

Command Count Example
ssh [host] 787 ssh host "cd /project && git log --oneline -20"
ssh [host2] 200 ssh host2 "cat /etc/some-config"
ssh [host3] 30 ssh host3 "diff /path/file1 /path/file2"

~1,000 SSH invocations in 30 days, all piping back verbose output that rtk could filter if it had a way to intercept.

Proposed: rtk ssh

rtk ssh user@host "pytest tests/"        # pipe remote stdout through rtk pytest
rtk ssh user@host "git log -n 20"        # pipe through rtk git log
rtk ssh user@host "cat big-file.log"     # pipe through rtk log

The subcommand would:

  1. Execute the remote command via SSH normally
  2. Detect the remote command type (first token after the quoted string)
  3. Pipe stdout through the appropriate existing rtk filter

Why the hook can't handle this today

The PreToolUse hook could rewrite ssh host "cmd"ssh host "cmd" 2>&1 | rtk log, but this breaks exit codes and interactive sessions, so a dedicated subcommand is safer.

Fallback behaviour

If the remote command type isn't recognised, pipe through rtk log (dedup + truncate) as a generic fallback — still better than raw output.

Environment: macOS, Claude Code PreToolUse hook, rtk 0.24.0

贡献者指南