fix(gemini): use AfterTool instead of PostToolUse for Gemini CLI hooks#824
Open
Tibsfox wants to merge 1 commit intogsd-build:mainfrom
Open
fix(gemini): use AfterTool instead of PostToolUse for Gemini CLI hooks#824Tibsfox wants to merge 1 commit intogsd-build:mainfrom
Tibsfox wants to merge 1 commit intogsd-build:mainfrom
Conversation
Gemini CLI uses AfterTool as the post-tool hook event name, not PostToolUse (which is Claude Code's event name). The installer was registering the context monitor under PostToolUse for all runtimes, causing Gemini to print "Invalid hook event name" warnings on every run and silently disabling the context monitor. Changes: - install.js: use runtime-aware event name (AfterTool for Gemini, PostToolUse for others) when registering context monitor hook - install.js: uninstall cleans up both PostToolUse and AfterTool entries for backward compatibility with existing installs - gsd-context-monitor.js: runtime-aware hookEventName in output - docs/context-monitor.md: document both event names with Gemini example Closes gsd-build#750 Co-Authored-By: Claude Opus 4.6 <[email protected]>
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
Gemini CLI uses
AfterToolas the post-tool hook event name, notPostToolUse(which is Claude Code's event name). The installer was registering the context monitor underPostToolUsefor all runtimes, causing Gemini to print an "Invalid hook event name" warning on every run and silently disabling the context monitor hook.The comment at install.js:2034 even noted the assumption: "Gemini shares same hook system as Claude Code for now" — this turned out to be incorrect for hook event names.
Changes
bin/install.js: IntroducepostToolEventvariable that resolves toAfterToolwhenruntime === 'gemini',PostToolUseotherwise. Used for both the install and registration paths.bin/install.js(uninstall): Clean up bothPostToolUseandAfterToolentries for backward compatibility — users who installed with the oldPostToolUsekey need their stale entries removed on uninstall/reinstall.hooks/gsd-context-monitor.js: Runtime-awarehookEventNamein output metadata (detects Gemini viaGEMINI_API_KEYenv var).docs/context-monitor.md: Document both event names, add Gemini-specific manual registration example.Verification
npx get-shit-done-cc --gemini --global~/.gemini/settings.json— context monitor should be underhooks.AfterTool, nothooks.PostToolUsegemini -p "ping" --output-format text— no "Invalid hook event name" warningAfterToolandPostToolUseentries cleaned upBackward Compatibility
PostToolUseentries: The uninstall path now cleans up both event names, so reinstalling will migrate toAfterToolautomatically.PostToolUse.Closes #750
🤖 Generated with Claude Code