mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-29 14:34:55 -07:00
feat(ui): add visual indicators for hook execution (#15408)
This commit is contained in:
@@ -105,10 +105,15 @@ export class HookRunner {
|
||||
hookConfigs: HookConfig[],
|
||||
eventName: HookEventName,
|
||||
input: HookInput,
|
||||
onHookStart?: (config: HookConfig, index: number) => void,
|
||||
onHookEnd?: (config: HookConfig, result: HookExecutionResult) => void,
|
||||
): Promise<HookExecutionResult[]> {
|
||||
const promises = hookConfigs.map((config) =>
|
||||
this.executeHook(config, eventName, input),
|
||||
);
|
||||
const promises = hookConfigs.map(async (config, index) => {
|
||||
onHookStart?.(config, index);
|
||||
const result = await this.executeHook(config, eventName, input);
|
||||
onHookEnd?.(config, result);
|
||||
return result;
|
||||
});
|
||||
|
||||
return Promise.all(promises);
|
||||
}
|
||||
@@ -120,12 +125,17 @@ export class HookRunner {
|
||||
hookConfigs: HookConfig[],
|
||||
eventName: HookEventName,
|
||||
input: HookInput,
|
||||
onHookStart?: (config: HookConfig, index: number) => void,
|
||||
onHookEnd?: (config: HookConfig, result: HookExecutionResult) => void,
|
||||
): Promise<HookExecutionResult[]> {
|
||||
const results: HookExecutionResult[] = [];
|
||||
let currentInput = input;
|
||||
|
||||
for (const config of hookConfigs) {
|
||||
for (let i = 0; i < hookConfigs.length; i++) {
|
||||
const config = hookConfigs[i];
|
||||
onHookStart?.(config, i);
|
||||
const result = await this.executeHook(config, eventName, currentInput);
|
||||
onHookEnd?.(config, result);
|
||||
results.push(result);
|
||||
|
||||
// If the hook succeeded and has output, use it to modify the input for the next hook
|
||||
|
||||
Reference in New Issue
Block a user