fix(find): passthrough safe native predicates#2014
Open
danmunoz wants to merge 1 commit into
Open
Conversation
Signed-off-by: Daniel Munoz <dev@danmunoz.com>
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.
Summary
rtk findto automatically passthrough unsupported read-only nativefindpredicates instead of failing.-name,-iname,-type,-maxdepth, and RTK syntax).findactions out of RTK execution (-delete,-exec,-execdir,-ok,-okdir), so this PR does not introduce a new destructive execution path.Why
I kept running into native
findexpressions that RTK could not parse, especially compound predicates and output-shaping flags such as-not,-o,-path, and-print0.Today those invocations fail first, then the agent has to rerun the equivalent raw command. That causes double calls and extra context output, which breaks RTK's core premise of saving tokens and keeping agent command execution efficient.
This change makes RTK behave more transparently for safe native
findexpressions: if RTK cannot faithfully compact the expression, it proxies the command through nativefindinstead of forcing the user or agent to retry manually.Behavior after this change
rtk find . -name '*.rs' -type f -maxdepth 2still uses RTK's compact filtered output.rtk find '*.rs' src -m 5still uses RTK syntax and compact filtered output.rtk find . -name '*.rs' -not -path '*/target/*'passes through to nativefindand preserves native semantics.rtk find . -name '*.rs' -print0passes through to nativefind, preserving NUL-delimited output for downstream consumers.rtk find src tests -name '*.rs'passes through to nativefind, preserving multi-start-path semantics.rtk find . -name '*.tmp' -deleteremains blocked by RTK; users can run nativefinddirectly when they intentionally want side effects.Non-destructive safety note
This PR is intentionally non-destructive:
findqueries.findactions through RTK. Those actions already failed before this change; this PR narrows the failure behavior to side-effecting actions while allowing read-only unsupported predicates to work via passthrough.Test plan
cargo insta review) - not applicable; no snapshots changedforce_tee_tail_hintorforce_tee_hint) - not applicable; no new truncation pathcargo fmt --all --check && cargo clippy --all-targets && cargo testpassesrtk <command>output inspected