rtk-ai/rtk

feat: add yq rewrite rule and TOML filter for YAML query output compression

Open

#1,910 创建于 2026年5月16日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)Rust (2,914 fork)batch import
area:clienhancementgood first issuepriority:low

仓库指标

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

描述

Problem

yq is the YAML counterpart to jq — it produces verbose YAML output that can be large when querying multi-document manifests, Kubernetes configs, or Helm values files. Currently rtk has no hook rewrite rule for yq, so bare yq commands are never compressed even though a simple truncation filter would save significant tokens.

Proposed Solution

Add a yq rewrite rule to src/discover/rules.rs and create src/filters/yq.toml following the same pattern as the existing jq.toml:

  • match_command = "^yq\\b"
  • strip_lines_matching = ["^\\s*$"] — remove blank lines
  • max_lines = 40
  • truncate_lines_at = 120

Related

  • Similar to #1364 (jq rewrite rule) — same compression pattern for structured query tools
  • jq.toml already exists as the template for this approach

贡献者指南