feat(hooks): adds support for RuntimeHook functions. (#19598)

This commit is contained in:
Michael Bleigh
2026-02-24 13:03:36 -08:00
committed by GitHub
parent 6510347d5b
commit d47d4855db
17 changed files with 410 additions and 68 deletions
+6 -3
View File
@@ -8,7 +8,7 @@ import type { Config } from '../config/config.js';
import type { HookPlanner, HookEventContext } from './hookPlanner.js';
import type { HookRunner } from './hookRunner.js';
import type { HookAggregator, AggregatedHookResult } from './hookAggregator.js';
import { HookEventName } from './types.js';
import { HookEventName, HookType } from './types.js';
import type {
HookConfig,
HookInput,
@@ -500,7 +500,10 @@ export class HookEventHandler {
* Get hook name from config for display or telemetry
*/
private getHookName(config: HookConfig): string {
return config.name || config.command || 'unknown-command';
if (config.type === HookType.Command) {
return config.name || config.command || 'unknown-command';
}
return config.name || 'unknown-hook';
}
/**
@@ -513,7 +516,7 @@ export class HookEventHandler {
/**
* Get hook type from execution result for telemetry
*/
private getHookTypeFromResult(result: HookExecutionResult): 'command' {
private getHookTypeFromResult(result: HookExecutionResult): HookType {
return result.hookConfig.type;
}
}