Skip to content

feat(discover): add jq and yq rewrite rules; add yq TOML filter#1911

Open
tylern91 wants to merge 1 commit into
rtk-ai:developfrom
tylern91:feat/jq-yq-rewrite-rules
Open

feat(discover): add jq and yq rewrite rules; add yq TOML filter#1911
tylern91 wants to merge 1 commit into
rtk-ai:developfrom
tylern91:feat/jq-yq-rewrite-rules

Conversation

@tylern91
Copy link
Copy Markdown

Summary

  • jq: The jq.toml filter (max_lines=40, truncate_lines_at=120) has existed but had no rewrite rule in discover/rules.rs. Bare jq commands were never routed through the filter by the hook. This PR adds the missing RtkRule so the hook auto-rewrites jqrtk jq.

  • yq: yq is the YAML equivalent of jq — same compression pattern. Creates src/filters/yq.toml (max_lines=40, truncate_lines_at=120, strips blank lines) and adds the corresponding RtkRule.

Changes

File Action
src/discover/rules.rs Add jq and yq RtkRule entries (System category)
src/filters/yq.toml CREATE — TOML filter for yq output, 2 inline tests
src/core/toml_filter.rs Filter count 59→60; add jq+yq to expected array; concat assertion 60→61

Test plan

  • cargo fmt --all — clean
  • cargo clippy --all-targets -- -D warnings — zero warnings
  • cargo test --all — 1870 passed, 6 ignored
  • test_builtin_filter_count passes with count=60
  • test_builtin_all_expected_filters_present — jq and yq verified present
  • yq inline tests: short output passthrough, empty input

Closes

Closes #1364 (jq rewrite rule missing from discover)
Closes #1910 (yq filter + rewrite rule)

- Add RtkRule for `jq` routing unfiltered `jq` commands through the
  existing jq.toml filter (max_lines=40, truncate_lines_at=120). The
  filter already existed but had no hook rewrite rule, so bare `jq`
  invocations were never compressed.

- Add RtkRule for `yq` and create src/filters/yq.toml with matching
  filter (max_lines=40, truncate_lines_at=120, strip blank lines).
  `yq` is the YAML counterpart to `jq` and follows the same compression
  pattern.

- Update toml_filter.rs: filter count 59→60, add jq and yq to expected
  array, update concat assertion to 61.

Closes rtk-ai#1364 (jq rewrite rule missing)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add yq rewrite rule and TOML filter for YAML query output compression feat: add rtk jq command for compressing large JSON extraction output

1 participant