feat(hooks): display hook system messages in UI#24616
Conversation
…etting - Introduces a new `hooksConfig.showOutput` setting (default `false`). - Parses JSON output from hooks to extract `systemMessage`. - Emits a new `HookSystemMessage` event to the UI when a hook returns a system message and `showOutput` is enabled. - Updates the React CLI app to listen for these events and render them inline in the chat history.
|
Hi @mbleigh, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this. We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines. Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed. Thank you for your understanding and for being a part of our community! |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enables better visibility into hook execution by allowing hooks to send system messages directly to the CLI UI. By introducing a configurable setting, users can now opt-in to see feedback from their hooks, which is rendered as part of the chat history. This improves the extensibility of the hook system and provides clearer user feedback during automated processes. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
You already have 7 pull requests open. Please work on getting existing PRs merged before opening more. |
There was a problem hiding this comment.
Code Review
This pull request introduces a new configuration setting, hooksConfig.showOutput, which allows users to display informational messages returned by hooks directly in the CLI UI. The changes include updating the configuration schemas, documentation, and core event handling to capture and emit hook system messages when they are returned in JSON format. The UI components were also updated to render these messages with an optional source indicator. I have no feedback to provide as there were no review comments to assess.
Note: Security Review did not run due to the size of the PR.
|
Size Change: +1.29 kB (0%) Total Size: 34 MB
ℹ️ View Unchanged
|
abhipatel12
left a comment
There was a problem hiding this comment.
Couple settings nits but LGTM!
Summary
Introduces the ability for hooks to display system messages in the CLI UI. This is controlled by a new advanced setting
hooksConfig.showOutput.Details
hooksConfig.showOutputto settings schema andConfigclass.HookRunnerto track the format of hook output (jsonvstext) in theHookExecutionResult.HookEventHandlerto emit ahook-system-messageevent when a hook returns asystemMessagein JSON format and the setting is enabled.AppContainerin the CLI to listen forhook-system-messageand add it to the chat history as anINFOmessage.InfoMessagecomponent to optionally display the source (hook name) of the message.HookExecutionResultto includeoutputFormatinstead of adding it to theHookOutputinterface.Preview of hook content:
Related Issues
Related to hook extensibility and user feedback.
How to Validate
gemini config set hooksConfig.showOutput truesystemMessage, e.g.,echo '{"decision": "allow", "systemMessage": "Hello from hook!"}'Pre-Merge Checklist