Skip to content

feat(windows): native Copilot Chat hook support without WSL#2269

Draft
yc-mattborja wants to merge 1 commit into
rtk-ai:developfrom
yc-mattborja:feat/windows-native-copilot-hook
Draft

feat(windows): native Copilot Chat hook support without WSL#2269
yc-mattborja wants to merge 1 commit into
rtk-ai:developfrom
yc-mattborja:feat/windows-native-copilot-hook

Conversation

@yc-mattborja
Copy link
Copy Markdown

Summary

Enables full RTK hook support for VS Code Copilot Chat on native Windows — no WSL, bash, or Unix tools required.

The PreToolUse hook mechanism (rtk hook copilot) is a native Rust binary communicating via JSON stdin/stdout. It works identically on Windows, Linux, and macOS. This PR documents the Windows-native path, fixes the broken hook config, and provides automated setup tooling.

Changes

File Change
.github/hooks/rtk-rewrite.json Bug fix: "rtk hook""rtk hook copilot" — bare rtk hook exits code 1 with usage error
docs/WINDOWS-NATIVE.md Architecture diagram, manual setup, supported commands table, troubleshooting
scripts/windows-copilot-setup.ps1 Automated setup: binary install, ripgrep, ls shim, hook config, verification. Fetches latest release dynamically via GitHub API (or accepts -Version pin)
docs/guide/getting-started/installation.md Replace blanket "use WSL" with specific guidance per hook type

Motivation

The installation docs say "For full hook support, use WSL instead" — but this only applies to the Claude Code bash shell hook. The VS Code Copilot Chat hook is a completely different mechanism that already works natively. This PR:

  1. Fixes the broken project-scoped hook config (missing copilot subcommand)
  2. Documents the Windows-native path
  3. Provides a setup script for the few Windows-specific gaps (ls binary, rg)
  4. Corrects misleading "WSL required" language

Testing

Verified on Windows 11 x64 (no WSL, no Rust toolchain):

19/19 commands intercepted and rewritten — 100% catch rate
4/4 rewritten commands execute successfully on native Windows

# Reproduce
$json = '{"tool_name":"runTerminalCommand","tool_input":{"command":"git status"}}'
$json | rtk hook copilot
# → {"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"ask",
#    "updatedInput":{"command":"rtk git status"}}}

Additional notes:

  • Linux/macOS/WSL: Zero changes to existing workflows
  • Claude Code: Shell hook still documented as requiring bash/WSL
  • Setup script: Opt-in, no side effects on non-Windows
  • Hook fix: Makes existing .github/hooks/rtk-rewrite.json functional (was silently broken)
  • No Rust code changes: CI gates (fmt, clippy, test, test-presence) unaffected

Add full Windows-native RTK integration for VS Code Copilot Chat's
PreToolUse hook mechanism. No WSL, bash, or Unix tools required —
the hook is a native Rust binary (rtk hook copilot) that works on
any platform via JSON stdin/stdout.

Changes:
- Fix rtk-rewrite.json: 'rtk hook' -> 'rtk hook copilot' (the hook
  subcommand requires a target; bare 'rtk hook' exits with usage error)
- Add docs/WINDOWS-NATIVE.md: architecture diagram, manual setup,
  supported commands table, troubleshooting guide
- Add scripts/windows-copilot-setup.ps1: automated setup with dynamic
  version fetching, ripgrep install, ls shim, hook configuration,
  and integration verification
- Update installation.md: replace blanket 'use WSL' with specific
  guidance (Copilot hook = native, Claude Code shell hook = WSL)

Signed-off-by: Matt Borja <matt.borja@yc.edu>
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants