Repository navigation
Conversation
JetBrains sends toolName "run_in_terminal" instead of "bash", so detect_format() never matched it. Additionally, JetBrains ignores modifiedArgs and only honors permissionDecision. Add CopilotIde variant to HookFormat with deny-with-suggestion semantics: deny the original command but include the rewritten command in the reason so the user can re-run it manually. Also trims leading whitespace from toolName (JetBrains sometimes pads it) and from the command string. Fixes rtk-ai#2443
Contributor
Author
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 hook copilotwas a no-op in JetBrains IDEs because:detect_format()only matchedtoolName == "bash"— JetBrains Copilot plugin sends"run_in_terminal"insteadmodifiedArgs— it only honorspermissionDecision, so transparent rewriting doesn't workFix
CopilotIde { command: String }variant toHookFormatenum"run_in_terminal"in the camelCase branch ofdetect_format(), with.trim()for JetBrains' occasional leading whitespacepermissionDecisionReason: "RTK: re-run as \{rewritten}` instead."` — this is the only way to communicate the rewrite to JetBrains usersDenyrule matches produce a plain deny with audit logDefer(no rewrite available, unsupported command, already-rtk) returnsNone(passthrough)Tests added
test_detect_jetbrains_run_in_terminal— format detectiontest_detect_jetbrains_command_trimmed— whitespace handlingtest_detect_jetbrains_other_tools_passthrough— non-terminal tools ignoredtest_detect_camelcase_bash_unchanged— existing CopilotCli path preservedtest_copilot_ide_deny_with_suggestion— AskRewrite produces deny + reasontest_copilot_ide_allow_rewrite_also_denies— AllowRewrite also denies (JetBrains limitation)test_copilot_ide_already_rtk_passthrough— already-rtk commands pass throughtest_copilot_ide_unsupported_passthrough— unsupported commands pass throughFixes #2443