fix(hooks): rewrite producer stage of producer | cat pipelines - #3724
Open
javython999 wants to merge 1 commit into
Open
fix(hooks): rewrite producer stage of producer | cat pipelines#3724javython999 wants to merge 1 commit into
producer | cat pipelines#3724javython999 wants to merge 1 commit into
Conversation
A bare `cat` (no flags, no files) is byte-transparent: it copies stdin to stdout unchanged. `producer | cat` and `producer` are therefore equivalent on stdout, so the producer segment can be rewritten the same way a standalone command would be, without risking a change to what a downstream consumer reads. Previously the hook left pipelines entirely raw except for an allowlisted final-stage rewrite (grep/rg), so `git status | cat` never got the rtk rewrite even though nothing consumes the pipe's output structurally. The exception is scoped to a single stdout pipe with no further pipe stages, so pipelines with real intermediate processing (`a | b | cat`) keep the existing raw-producer contract. Fixes rtk-ai#3722
javython999
force-pushed
the
fix/pipe-rewrite-transparent-cat-sink
branch
from
August 27, 2026 02:11
f668689 to
16ddc78
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A bare
cat(no flags, no files) is byte-transparent: it copies stdin to stdout unchanged.producer | catandproducerare therefore equivalent on stdout, so the producer segment can be rewritten the same way a standalone command would be, without risking a change to what a downstream consumer reads.Previously the hook left pipelines entirely raw except for an allowlisted final-stage rewrite (grep/rg), so
git status | catnever got the rtk rewrite even though nothing consumes the pipe's output structurally.The exception is scoped to a single stdout pipe with no further pipe stages, so pipelines with real intermediate processing (
a | b | cat) keep the existing raw-producer contract.Fixes #3722
Summary
producer | catpipeline (e.g.git status | cat->rtk git status | cat) since a barecatsink is byte-transparentis_transparent_cat_sink/rewrite_producer_before_transparent_sinkinsrc/discover/registry.rs, wired as a fallback when the existing final-stage rewrite finds nothinga | b | cat,cat -n, and|&stderr pipes are unaffectedTest plan
cargo fmt --all && cargo clippy --all-targets && cargo testsrc/discover/registry.rscovering the happy path,&&continuation after the pipe,cat -n(non-transparent), a real intermediate stage beforecat, and the stderr-pipe caseecho '{"tool_name":"Bash","tool_input":{"command":"git status | cat"}}' | rtk hook claudenow rewrites tortk git status | cat