Skip to content

feat(pipe): add command filtering for pipe commands#2032

Open
dsd2077 wants to merge 2 commits into
rtk-ai:developfrom
dsd2077:develop
Open

feat(pipe): add command filtering for pipe commands#2032
dsd2077 wants to merge 2 commits into
rtk-ai:developfrom
dsd2077:develop

Conversation

@dsd2077
Copy link
Copy Markdown

@dsd2077 dsd2077 commented May 22, 2026

Summary

  • Add rtk pipe --command <command> so pipe mode can choose a more accurate stdin filter from the command that produced the output.
  • Reuse RTK’s existing command rewrite and CLI parsing paths for command-aware filter selection instead of maintaining a separate command parser.
  • Keep explicit --filter precedence and fall back to output auto-detection when --command cannot identify a unique filter.

Test plan

  • cargo fmt
  • cargo test pipe_command_filter
  • cargo test pipe_cmd
  • cargo test
  • Manual testing: ./target/debug/rtk pipe --command 'rg main' output inspected
  • Manual testing: ./target/debug/rtk pipe --command 'cargo test' output inspected

Important: All PRs must target the develop branch (not master).
See CONTRIBUTING.md for details.

dsd2077 and others added 2 commits May 22, 2026 10:37
- Introduced a new `command` argument to the `pipe` command to specify the original command that produced stdin, allowing for more precise filter resolution.
- Implemented functions to determine the appropriate pipe filter based on the command provided.
- Updated the `run` function in `pipe_cmd` to accept an optional command filter.
- Added tests to ensure correct parsing and functionality of the new command filtering feature.
- Refactored existing code to utilize a new utility function for determining UTF-8 character boundaries.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 22, 2026

CLA assistant check
All committers have signed the CLA.

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.

2 participants