rtk-ai/rtk

TOML filters cannot match `docker exec` commands (built-in docker module claims them first)

Open

#1.356 aberto em 17 de abr. de 2026

Ver no GitHub
 (1 comment) (1 reaction) (0 assignees)Rust (2.914 forks)batch import
area:clibugeffort-mediumfilter-qualityhelp wantedpriority:medium

Métricas do repositório

Stars
 (48.085 stars)
Métricas de merge de PR
 (Mesclagem média 11d 1h) (45 fundiu PRs em 30d)

Description

Problem

User-defined TOML filters in ~/.rtk/filters.toml cannot intercept docker exec commands because the built-in Rust docker module claims the docker command before the TOML fallback path is reached.

The built-in docker module only handles ps, images, logs, and compose. For docker exec, it effectively passes through unchanged (0% savings), but the TOML engine never gets a chance to apply user filters.

Use case

Many development workflows execute tools inside Docker containers:

docker exec my-container vendor/bin/phpunit
docker exec my-container psalm
docker exec my-container phpcs
docker exec my-container infection

These produce the same output as their native counterparts, but TOML filters like this have no effect:

[filters.phpunit]
description = "Compact PHPUnit output from Docker container"
match_command = "^docker\\s+exec\\s+.*vendor/bin/phpunit"
strip_ansi = true
strip_lines_matching = [
  "^\\s*$",
  "^PHPUnit \\d+",
  "^Runtime:",
  "^Configuration:",
  "^\\.+$",
  "^Time:",
  "^Memory:",
]
max_lines = 60
on_empty = "phpunit: all tests passed"

Expected behavior

One of:

  1. The built-in docker module delegates unhandled subcommands (like exec) to the TOML filter engine
  2. TOML match_command can override built-in modules (user filters take precedence)
  3. The docker exec path extracts the inner command and matches TOML filters against it (e.g., matching vendor/bin/phpunit instead of the full docker exec ... vendor/bin/phpunit)

Actual behavior

rtk docker exec <container> <command> always shows 0% savings regardless of TOML filters defined in ~/.rtk/filters.toml.

Environment

  • rtk v0.36.0
  • macOS
  • Installed via Homebrew

Guia do colaborador