Skip to content

Commit 8b63284

Browse files
shanselmanclaude
andcommitted
Fix Gemini hook format - use flat structure without nested hooks array
Claude Code requires: {"hooks": [{"type": "command", ...}]} Gemini CLI requires: [{"type": "command", ...}] Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent fb2f3b3 commit 8b63284

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

main.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -766,20 +766,14 @@ bool install_gemini(const std::wstring& exePath) {
766766
}
767767
}
768768

769-
// Build hook structure with nested "hooks" array (required by Gemini CLI)
770-
JsonObject innerHook;
771-
innerHook.SetNamedValue(L"type", JsonValue::CreateStringValue(L"command"));
769+
// Build hook structure (Gemini uses flat structure, no nested "hooks" array)
770+
JsonObject hookItem;
771+
hookItem.SetNamedValue(L"type", JsonValue::CreateStringValue(L"command"));
772772

773773
std::wstring escapedPath = escape_json_string(exePath);
774774
std::wstring command = escapedPath + L" \"Gemini finished\" -t \"Gemini\"";
775-
innerHook.SetNamedValue(L"command", JsonValue::CreateStringValue(command));
776-
innerHook.SetNamedValue(L"timeout", JsonValue::CreateNumberValue(5000));
777-
778-
JsonArray innerHooks;
779-
innerHooks.Append(innerHook);
780-
781-
JsonObject hookItem;
782-
hookItem.SetNamedValue(L"hooks", innerHooks);
775+
hookItem.SetNamedValue(L"command", JsonValue::CreateStringValue(command));
776+
hookItem.SetNamedValue(L"timeout", JsonValue::CreateNumberValue(5000));
783777

784778
// Get or create hooks object
785779
JsonObject hooksObj;

0 commit comments

Comments
 (0)