feat(hook): extend Gemini BeforeTool hook to intercept read_file tool…#806
Open
Ross-cripto wants to merge 1 commit intortk-ai:masterfrom
Open
feat(hook): extend Gemini BeforeTool hook to intercept read_file tool…#806Ross-cripto wants to merge 1 commit intortk-ai:masterfrom
Ross-cripto wants to merge 1 commit intortk-ai:masterfrom
Conversation
…tk-ai#796 - Route `read_file` alongside `run_shell_command` in `run_gemini()` - Pre-apply `start_line`/`end_line` slice before filtering, then override both in the response to prevent Gemini's merge from re-applying original (now wrong) line numbers to the filtered file - Write filtered content to `~/.local/share/rtk/filtered/{ts}-{stem}.rtk` (timestamp-first so lexicographic sort in rotation is chronological) - Rotate filtered dir to keep last 20 files, mirroring tee.rs pattern - Fallback to allow for unreadable/binary files, slices <500 chars, and slices with <10% savings Closes rtk-ai#796
|
|
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.
… #796
read_filealongsiderun_shell_commandinrun_gemini()start_line/end_lineslice before filtering, then override both in the response to prevent Gemini's merge from re-applying original (now wrong) line numbers to the filtered file~/.local/share/rtk/filtered/{ts}-{stem}.rtk(timestamp-first so lexicographic sort in rotation is chronological)Closes #796
Summary
Test plan
cargo fmt --all && cargo clippy --all-targets && cargo testrtk <command>output inspected