aiwg
Version:
Deployment tool and support utility for AI context. Copies agents, skills, commands, rules, and behaviors into the paths each AI platform reads (Claude Code, Codex, Copilot, Cursor, Warp, OpenClaw, and 6 more) so one source of truth works across 10 platfo
79 lines • 2.15 kB
TypeScript
/**
* Hook Registry
*
* Manages registration and discovery of hook handlers. Organizes hooks
* by lifecycle event and supports priority-based ordering.
*
* @implements @.aiwg/requirements/use-cases/UC-004-extension-system.md
* @architecture @src/extensions/types.ts
* @tests @test/unit/cli/hooks/registry.test.ts
* @issue #58
*/
import type { HookHandler, HookEvent } from './types.js';
/**
* Hook Registry
*
* Central registry for all hook handlers. Provides O(1) lookup by event
* and maintains priority ordering for execution.
*/
export declare class HookRegistry {
/** Map of hook ID to handler */
private handlers;
/** Map of event to sorted list of handler IDs */
private eventMap;
/**
* Register a hook handler
*
* @param handler - Hook handler to register
* @throws Error if hook ID is already registered
*/
register(handler: HookHandler): void;
/**
* Unregister a hook handler
*
* @param id - Hook ID to unregister
*/
unregister(id: string): void;
/**
* Get handlers for a specific event
*
* Returns handlers in priority order (ascending). Optionally filters
* by command name.
*
* @param event - Lifecycle event
* @param command - Optional command name for filtering
* @returns Array of matching handlers in priority order
*/
getHandlers(event: HookEvent, command?: string): HookHandler[];
/**
* Check if a hook is registered
*
* @param id - Hook ID
* @returns True if hook is registered
*/
has(id: string): boolean;
/**
* Get a specific hook handler
*
* @param id - Hook ID
* @returns Handler or undefined if not found
*/
get(id: string): HookHandler | undefined;
/**
* Clear all registered hooks
*/
clear(): void;
/**
* Get all registered handlers
*
* @returns Array of all handlers
*/
getAllHandlers(): HookHandler[];
/**
* Get count of registered hooks
*
* @returns Number of registered hooks
*/
get size(): number;
}
//# sourceMappingURL=registry.d.ts.map