rtk-ai/rtk

github copilot (v1.0.24) now support modifiedArgs

Open

#1,839 创建于 2026年5月11日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)Rust (2,914 fork)batch import
area:clibughelp wantedpriority:high

仓库指标

Star
 (48,085 star)
PR 合并指标
 (平均合并 11天 1小时) (30 天内合并 45 个 PR)

描述

:robot: This was written by an AI agent on behalf of @paolomainardi.

Summary

Since Copilot CLI v1.0.24 (April 10, 2026), preToolUse hooks support modifiedArgs for transparent command rewriting — the same capability Claude Code has had via updatedInput. The official docs now list modifiedArgs as a supported output field.

However, rtk hook copilot (tested on RTK 0.39.0) is a complete no-op: it returns empty stdout + exit 0 for every command, regardless of whether a rewrite exists.

Reproduction

# Claude hook — works (transparent rewrite)
echo '{"tool_name":"bash","tool_input":{"command":"git status"}}' | rtk hook claude
# → {"hookSpecificOutput":{"hookEventName":"PreToolUse",...,"updatedInput":{"command":"rtk git status"}}}

# Copilot hook — no-op (empty output, exit 0)
echo '{"toolName":"terminal","toolInput":{"command":"git status"}}' | rtk hook copilot
# → (nothing)

# But the rewrite engine knows what to do:
rtk hook check --agent copilot git status
# → rtk git status

Expected behavior

rtk hook copilot should output modifiedArgs in the Copilot CLI format:

{"modifiedArgs":{"command":"rtk git status"}}

This would make the Copilot hook functionally equivalent to the Claude Code hook, enabling transparent rewrite instead of the current no-op behavior.

Context

  • The older deny-with-suggestion approach (from #593) was designed before Copilot CLI supported modifiedArgs. Now that it does, the hook should use it.
  • exclude_commands should also be respected in the copilot hook path, same as for Claude Code.
  • Related: #1774 (rtk init -g --copilot global setup), #1425 (run_in_terminal not recognized)
  • The current no-op means Copilot RTK integration relies entirely on instructions ("always prefix with rtk"), which teaches the AI to bypass safety patterns in tools like OpenCode that match on command prefixes.

Environment

  • RTK: 0.39.0
  • Copilot CLI: tested against v1.0.44 docs (installed version 0.0.405)
  • OS: Linux (Arch)

贡献者指南