feat: in-process Lua core handler for copilot (#47, phase 3)#66
Merged
Conversation
Flips Copilot to the in-process orchestrator that claudecode (#63) and opencode (#65) already use. The shims become thin RPC wrappers into code-preview.pre_tool / code-preview.post_tool; the Copilot-specific {toolName, cwd, toolArgs} translation now lives in the new `copilot` entry of pre_tool.normalisers. Copilot has no permission-decision analogue, so its emitter is `none`. When Neovim is unreachable the shims abstain silently (exit 0). Preserved the bash-side noise-tool short-circuit (view/glob/grep/ls/ report_intent) as a perf filter — Copilot has no per-tool hook matcher and no TS-side allowlist, so without this every chatty tool firing would pay for socket discovery plus an RPC round-trip. The Lua map remains the source of truth; the bash case is purely a fast-path. Defensive empty-path/command branch in the normaliser drops tool_name to nil for Edit/Write/Bash/ApplyPatch with blank critical fields, matching the old shim's explicit skip-on-empty guard. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Updates the E2E test headers in tests/backends/copilot/* to point at the
in-process Lua flow (pre_tool.handle / post_tool.handle / apply/patch.lua)
instead of the retired bin/core-{pre,post}-tool.sh path. Also reframes the
"regression fixed in core-post-tool.sh" comment around the patch-paths loop
in post_tool.lua that the test actually guards now.
Adds a note in normalisers.lua (copilot block) explaining that paths are
collapsed through vim.fs.normalize — the old bash copilot shim preserved
paths verbatim, so this is a deliberate behavioural change to match the
canonical-key invariant opencode already follows.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.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
backends/copilot/code-{preview,close}-diff.shbecome thin RPC wrappers; the{toolName, cwd, toolArgs}→ canonical translation now lives in a newcopilotentry ofpre_tool.normalisers.none(default). When Neovim is unreachable, the shims abstain silently (exit 0) and Copilot falls back to its native flow.view/glob/grep/ls/report_intent) as a perf filter — Copilot has no per-tool hook matcher (unlike Claude Code) and no TS-side allowlist (unlike opencode), so without this every chatty tool firing would pay for socket discovery + an RPC round-trip just to get anil tool_nameback. The Lua map remains the source of truth; the bash case is purely a fast-path.tool_nametonilfor Edit/Write/Bash/ApplyPatch with blank critical fields, matching the old shim's explicitif [[ -z "$FP" ]]; then exit 0guard.Closes the Copilot half of #47 phase 3 (collapsed with phase 4 per the pattern set by #63 and #65).
Test plan
./tests/run_lua.sh— all green, including 15 new copilot normaliser rows./tests/run.sh— all 68 E2E tests pass (claudecode + opencode + copilot)🤖 Generated with Claude Code