fix(copilot): mirror transactional Node hooks

This commit is contained in:
ZacharyZhang-NY committed 2026-07-20 12:09:24 -04:00
1 parent d0185887fa
commit af8d227b45
17 files changed
+1738 -651

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@ Grok Build adapters write exact `PreToolUse`, `PostToolUse`, and `PostToolUseFai
Cline CLI 3 and Cline IDE use separate file-hook loaders. SDK adapters target CLI 3, write only `$CLINE_DIR/hooks`, preserve its hybrid `tool_call`/`preToolUse` and `tool_result`/`postToolUse` payload, and emit pure JSON cancellation controls. The IDE variant discovers runtime `--hooks-dir`, Documents, and `.clinerules/hooks` roots; Windows selects exact `.ps1` files and macOS/Linux select executable extensionless files. Both runtimes continue after hook crashes, timeouts, and invalid controls while recording the failure.
GitHub Copilot command `preToolUse` hooks deny on crashes and every non-zero exit. Command timeouts continue through the normal permission flow, so `timeout_failure_mode` records that explicit exception when it differs from `failure_mode`.
GitHub Copilot CLI loads user hook files from `$COPILOT_HOME/hooks` or `~/.copilot/hooks` and combines them with policy, repository, inline settings, cross-tool Claude, and plugin sources. Elydora owns one user file with exact `preToolUse`, `postToolUse`, and `postToolUseFailure` handlers and preserves native camelCase fields, including `toolResult` and `error`. Effective settings precedence controls `disableAllHooks`; each managed file also retains its independent disable flag. Command crashes and non-zero exits deny pre-tool execution, while command timeouts continue through the normal permission flow.
Cursor uses the same `preToolUse` and `postToolUse` contract across its CLI and IDE. User, project, and enterprise hook sources merge by documented priority; command exit code `2` denies an action, while per-script `failClosed` controls crash, timeout, and invalid-output behavior.
+12 -2
View File
@@ -163,8 +163,18 @@
"~/.copilot/hooks/*.json",
".github/hooks/*.json"
],
"events": { "before_tool": "preToolUse", "after_tool": "postToolUse" },
"event_fields": { "name": "toolName", "input": "toolArgs", "session": "sessionId" },
"events": {
"before_tool": "preToolUse",
"after_tool": "postToolUse",
"after_tool_failure": "postToolUseFailure"
},
"event_fields": {
"name": "toolName",
"input": "toolArgs",
"session": "sessionId",
"output": "toolResult",
"error": "error"
},
"blocking": {
"mechanism": "any_nonzero_exit",
"failure_mode": "fail_closed",