feat(hooks): Implement hooks system infrastructure with CLI and UI management#1988
Merged
DennisYu07 merged 30 commits intomainfrom Mar 6, 2026
Merged
feat(hooks): Implement hooks system infrastructure with CLI and UI management#1988DennisYu07 merged 30 commits intomainfrom
DennisYu07 merged 30 commits intomainfrom
Conversation
Contributor
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
This was referenced Mar 1, 2026
This reverts commit c9126e0.
This was referenced Mar 2, 2026
This was referenced Mar 3, 2026
This was referenced Mar 3, 2026
This was referenced Mar 4, 2026
Collaborator
Author
|
stop hook: stop.hook.mp4userpromptsubmit: 3.5.mp4 |
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.
TLDR
This PR implements the hooks system infrastructure for Qwen Code, enabling custom command execution at key lifecycle events.
/hookslist|enable|disableDive Deeper
The hooks system follows a clear layered architecture: HookEventHandler orchestrates the flow; HookPlanner decides which hooks to run and how; HookRegistry provides the pool of available hooks; HookRunner actually executes the commands; HookAggregator merges the results from multiple executions
1、HookRunner
Responsibility: Executes command hooks as child processes
Key Methods:
executeHook(hookConfig, eventName, input) - Execute single hookexecuteHooksParallel()- Run hooks simultaneouslyexecuteHooksSequential()- Run hooks one by one, passing output to nextFeatures:
2、HookAggregator
Responsibility: Merges multiple hook outputs using event-specific strategies
Key Methods:
aggregateResults(results, eventName)- Merge execution results3、HookPlanner
Responsibility: Selects matching hooks and creates execution plans
Key Methods:
createExecutionPlan(eventName, context?)- Generate execution plan4. HookRegistry
Responsibility: Loads, validates, and manages hook configurations
Key Methods:
initialize()- Load hooks from configgetHooksForEvent(eventName)- Get enabled hooks for eventsetHookEnabled(hookName, enabled)- Enable/disable hookFeatures:
5. HookEventHandler
Responsibility: Coordinates event triggering and execution
Key Methods:
fireUserPromptSubmitEvent(prompt)- Trigger on user prompt submitfireStopEvent(stopHookActive, lastAssistantMessage)- Trigger on stopReviewer Test Plan
1、Run Unit Tests
2、UI Command Testing
/hooksList CommandTesting Matrix
Linked issues / bugs