@cleocode/caamp 1.8.1 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,244 @@
1
+ import {
2
+ resolveRegistryTemplatePath
3
+ } from "./chunk-TI6WOJDG.js";
4
+
5
+ // src/core/hooks/types.ts
6
+ var HOOK_CATEGORIES = ["session", "prompt", "tool", "agent", "context"];
7
+ var CANONICAL_HOOK_EVENTS = [
8
+ "SessionStart",
9
+ "SessionEnd",
10
+ "PromptSubmit",
11
+ "ResponseComplete",
12
+ "PreToolUse",
13
+ "PostToolUse",
14
+ "PostToolUseFailure",
15
+ "PermissionRequest",
16
+ "SubagentStart",
17
+ "SubagentStop",
18
+ "PreModel",
19
+ "PostModel",
20
+ "PreCompact",
21
+ "PostCompact",
22
+ "Notification",
23
+ "ConfigChange"
24
+ ];
25
+
26
+ // src/core/hooks/normalizer.ts
27
+ import { readFileSync } from "fs";
28
+ import { dirname, join } from "path";
29
+ import { fileURLToPath } from "url";
30
+ var _mappings = null;
31
+ function findMappingsPath() {
32
+ const thisDir = dirname(fileURLToPath(import.meta.url));
33
+ return join(thisDir, "..", "..", "..", "providers", "hook-mappings.json");
34
+ }
35
+ function loadMappings() {
36
+ if (_mappings) return _mappings;
37
+ const raw = readFileSync(findMappingsPath(), "utf-8");
38
+ _mappings = JSON.parse(raw);
39
+ return _mappings;
40
+ }
41
+ function resetHookMappings() {
42
+ _mappings = null;
43
+ }
44
+ function getCanonicalEvent(event) {
45
+ const data = loadMappings();
46
+ return data.canonicalEvents[event];
47
+ }
48
+ function getAllCanonicalEvents() {
49
+ return loadMappings().canonicalEvents;
50
+ }
51
+ function getCanonicalEventsByCategory(category) {
52
+ const data = loadMappings();
53
+ return CANONICAL_HOOK_EVENTS.filter(
54
+ (event) => data.canonicalEvents[event].category === category
55
+ );
56
+ }
57
+ function getProviderHookProfile(providerId) {
58
+ const data = loadMappings();
59
+ return data.providerMappings[providerId];
60
+ }
61
+ function getMappedProviderIds() {
62
+ return Object.keys(loadMappings().providerMappings);
63
+ }
64
+ function toNative(canonical, providerId) {
65
+ const profile = getProviderHookProfile(providerId);
66
+ if (!profile) return null;
67
+ const mapping = profile.mappings[canonical];
68
+ return mapping?.supported ? mapping.nativeName : null;
69
+ }
70
+ function toCanonical(nativeName, providerId) {
71
+ const profile = getProviderHookProfile(providerId);
72
+ if (!profile) return null;
73
+ for (const [canonical, mapping] of Object.entries(profile.mappings)) {
74
+ if (mapping.supported && mapping.nativeName === nativeName) {
75
+ return canonical;
76
+ }
77
+ }
78
+ return null;
79
+ }
80
+ function toNativeBatch(canonicals, providerId) {
81
+ const data = loadMappings();
82
+ const profile = data.providerMappings[providerId];
83
+ if (!profile) return [];
84
+ const results = [];
85
+ for (const canonical of canonicals) {
86
+ const mapping = profile.mappings[canonical];
87
+ if (mapping?.supported && mapping.nativeName) {
88
+ results.push({
89
+ canonical,
90
+ native: mapping.nativeName,
91
+ providerId,
92
+ category: data.canonicalEvents[canonical].category,
93
+ canBlock: data.canonicalEvents[canonical].canBlock
94
+ });
95
+ }
96
+ }
97
+ return results;
98
+ }
99
+ function supportsHook(canonical, providerId) {
100
+ const profile = getProviderHookProfile(providerId);
101
+ if (!profile) return false;
102
+ return profile.mappings[canonical]?.supported ?? false;
103
+ }
104
+ function getHookSupport(canonical, providerId) {
105
+ const profile = getProviderHookProfile(providerId);
106
+ if (!profile) {
107
+ return { canonical, supported: false, native: null };
108
+ }
109
+ const mapping = profile.mappings[canonical];
110
+ return {
111
+ canonical,
112
+ supported: mapping?.supported ?? false,
113
+ native: mapping?.nativeName ?? null,
114
+ notes: mapping?.notes
115
+ };
116
+ }
117
+ function getSupportedEvents(providerId) {
118
+ const profile = getProviderHookProfile(providerId);
119
+ if (!profile) return [];
120
+ return CANONICAL_HOOK_EVENTS.filter(
121
+ (event) => profile.mappings[event]?.supported
122
+ );
123
+ }
124
+ function getUnsupportedEvents(providerId) {
125
+ const profile = getProviderHookProfile(providerId);
126
+ if (!profile) return [...CANONICAL_HOOK_EVENTS];
127
+ return CANONICAL_HOOK_EVENTS.filter(
128
+ (event) => !profile.mappings[event]?.supported
129
+ );
130
+ }
131
+ function getProvidersForEvent(canonical) {
132
+ const data = loadMappings();
133
+ return Object.entries(data.providerMappings).filter(([, profile]) => profile.mappings[canonical]?.supported).map(([id]) => id);
134
+ }
135
+ function getCommonEvents(providerIds) {
136
+ if (providerIds.length === 0) return [];
137
+ return CANONICAL_HOOK_EVENTS.filter(
138
+ (event) => providerIds.every((id) => supportsHook(event, id))
139
+ );
140
+ }
141
+ function getProviderSummary(providerId) {
142
+ const profile = getProviderHookProfile(providerId);
143
+ if (!profile) return void 0;
144
+ const supported = getSupportedEvents(providerId);
145
+ const unsupported = getUnsupportedEvents(providerId);
146
+ return {
147
+ providerId,
148
+ hookSystem: profile.hookSystem,
149
+ experimental: profile.experimental,
150
+ supportedCount: supported.length,
151
+ totalCanonical: CANONICAL_HOOK_EVENTS.length,
152
+ supported,
153
+ unsupported,
154
+ providerOnly: profile.providerOnlyEvents,
155
+ coverage: Math.round(supported.length / CANONICAL_HOOK_EVENTS.length * 100)
156
+ };
157
+ }
158
+ function buildHookMatrix(providerIds) {
159
+ const data = loadMappings();
160
+ const ids = providerIds ?? Object.keys(data.providerMappings);
161
+ const matrix = {};
162
+ for (const event of CANONICAL_HOOK_EVENTS) {
163
+ matrix[event] = {};
164
+ for (const id of ids) {
165
+ const profile = data.providerMappings[id];
166
+ matrix[event][id] = profile?.mappings[event] ?? {
167
+ nativeName: null,
168
+ supported: false
169
+ };
170
+ }
171
+ }
172
+ return {
173
+ events: [...CANONICAL_HOOK_EVENTS],
174
+ providers: ids,
175
+ matrix
176
+ };
177
+ }
178
+ function getHookSystemType(providerId) {
179
+ const profile = getProviderHookProfile(providerId);
180
+ return profile?.hookSystem ?? "none";
181
+ }
182
+ function getHookConfigPath(providerId) {
183
+ const profile = getProviderHookProfile(providerId);
184
+ if (!profile?.hookConfigPath) return null;
185
+ return resolveRegistryTemplatePath(profile.hookConfigPath);
186
+ }
187
+ function getProviderOnlyEvents(providerId) {
188
+ const profile = getProviderHookProfile(providerId);
189
+ return profile?.providerOnlyEvents ?? [];
190
+ }
191
+ function translateToAll(canonical, providerIds) {
192
+ const result = {};
193
+ for (const id of providerIds) {
194
+ const native = toNative(canonical, id);
195
+ if (native) {
196
+ result[id] = native;
197
+ }
198
+ }
199
+ return result;
200
+ }
201
+ function resolveNativeEvent(nativeName) {
202
+ const data = loadMappings();
203
+ const results = [];
204
+ for (const [providerId, profile] of Object.entries(data.providerMappings)) {
205
+ for (const [canonical, mapping] of Object.entries(profile.mappings)) {
206
+ if (mapping.supported && mapping.nativeName === nativeName) {
207
+ results.push({ providerId, canonical });
208
+ }
209
+ }
210
+ }
211
+ return results;
212
+ }
213
+ function getHookMappingsVersion() {
214
+ return loadMappings().version;
215
+ }
216
+
217
+ export {
218
+ HOOK_CATEGORIES,
219
+ CANONICAL_HOOK_EVENTS,
220
+ resetHookMappings,
221
+ getCanonicalEvent,
222
+ getAllCanonicalEvents,
223
+ getCanonicalEventsByCategory,
224
+ getProviderHookProfile,
225
+ getMappedProviderIds,
226
+ toNative,
227
+ toCanonical,
228
+ toNativeBatch,
229
+ supportsHook,
230
+ getHookSupport,
231
+ getSupportedEvents,
232
+ getUnsupportedEvents,
233
+ getProvidersForEvent,
234
+ getCommonEvents,
235
+ getProviderSummary,
236
+ buildHookMatrix,
237
+ getHookSystemType,
238
+ getHookConfigPath,
239
+ getProviderOnlyEvents,
240
+ translateToAll,
241
+ resolveNativeEvent,
242
+ getHookMappingsVersion
243
+ };
244
+ //# sourceMappingURL=chunk-J7UN457C.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/hooks/types.ts","../src/core/hooks/normalizer.ts"],"sourcesContent":["/**\n * CAAMP Hooks Normalizer - Type Definitions\n *\n * Defines the canonical CAAMP hook event taxonomy and provider mapping types.\n * CAAMP provides a unified hook interface across all providers — consumers\n * use canonical event names, and the normalizer translates to/from\n * provider-native names.\n */\n\n// ── Canonical Hook Events ───────────────────────────────────────────\n\n/**\n * All supported hook category names as a readonly tuple.\n *\n * @remarks\n * Categories group related canonical events for filtering and display.\n * Each canonical event belongs to exactly one category. The tuple is\n * `as const` so it can be used to derive the {@link HookCategory} union type.\n *\n * @public\n */\nexport const HOOK_CATEGORIES = [\"session\", \"prompt\", \"tool\", \"agent\", \"context\"] as const;\n\n/**\n * Union type of valid hook category strings derived from {@link HOOK_CATEGORIES}.\n *\n * @remarks\n * Used to classify canonical events into logical groups such as `\"session\"`,\n * `\"prompt\"`, `\"tool\"`, `\"agent\"`, and `\"context\"`.\n *\n * @public\n */\nexport type HookCategory = (typeof HOOK_CATEGORIES)[number];\n\n/**\n * All CAAMP canonical hook event names as a readonly tuple.\n *\n * @remarks\n * This is the single source of truth for the canonical event taxonomy.\n * Provider-native events are mapped to and from these canonical names\n * by the normalizer. The tuple is `as const` so it can derive the\n * {@link CanonicalHookEvent} union type.\n *\n * @public\n */\nexport const CANONICAL_HOOK_EVENTS = [\n \"SessionStart\",\n \"SessionEnd\",\n \"PromptSubmit\",\n \"ResponseComplete\",\n \"PreToolUse\",\n \"PostToolUse\",\n \"PostToolUseFailure\",\n \"PermissionRequest\",\n \"SubagentStart\",\n \"SubagentStop\",\n \"PreModel\",\n \"PostModel\",\n \"PreCompact\",\n \"PostCompact\",\n \"Notification\",\n \"ConfigChange\",\n] as const;\n\n/**\n * Union type of valid canonical hook event names derived from {@link CANONICAL_HOOK_EVENTS}.\n *\n * @remarks\n * Every provider mapping references these canonical names. Use `toNative()`\n * to translate a canonical event to a provider-specific name, and `toCanonical()`\n * for the reverse direction.\n *\n * @public\n */\nexport type CanonicalHookEvent = (typeof CANONICAL_HOOK_EVENTS)[number];\n\n/**\n * Definition of a canonical hook event including its category and behavior.\n *\n * @remarks\n * Each canonical event has a category for grouping, a human-readable description,\n * and a `canBlock` flag indicating whether a hook handler can prevent the\n * associated action from proceeding.\n *\n * @public\n */\nexport interface CanonicalEventDefinition {\n /** The lifecycle category this event belongs to (e.g. `\"session\"`, `\"tool\"`). */\n category: HookCategory;\n /** Human-readable description of when this event fires. */\n description: string;\n /** Whether a hook handler can block or cancel the associated action. */\n canBlock: boolean;\n}\n\n// ── Provider Hook System Types ──────────────────────────────────────\n\n/**\n * The type of hook system a provider uses.\n *\n * @remarks\n * - `\"config\"` — hooks defined in a configuration file (e.g. Claude Code `.claude/settings.json`)\n * - `\"plugin\"` — hooks implemented via a plugin/extension system\n * - `\"none\"` — provider does not support hooks\n *\n * @public\n */\nexport type HookSystemType = \"config\" | \"plugin\" | \"none\";\n\n/**\n * The mechanism a provider uses to execute hook handlers.\n *\n * @remarks\n * - `\"command\"` — shell command execution\n * - `\"http\"` — HTTP webhook callback\n * - `\"prompt\"` — LLM prompt injection\n * - `\"agent\"` — sub-agent delegation\n * - `\"plugin\"` — native plugin API call\n *\n * @public\n */\nexport type HookHandlerType = \"command\" | \"http\" | \"prompt\" | \"agent\" | \"plugin\";\n\n/**\n * Mapping of a single canonical event to a provider's native representation.\n *\n * @remarks\n * Each entry in a provider's hook profile maps one canonical event to the\n * provider's native event name. If `supported` is `false`, the provider\n * does not fire this event. Optional `notes` capture caveats or limitations.\n *\n * @public\n */\nexport interface HookMapping {\n /** The provider-native event name, or `null` if the event has no native equivalent. */\n nativeName: string | null;\n /** Whether this canonical event is supported by the provider. */\n supported: boolean;\n /**\n * Optional notes about support limitations or behavioral differences.\n *\n * @defaultValue `undefined`\n */\n notes?: string;\n}\n\n/**\n * Complete hook profile for a single provider.\n *\n * @remarks\n * Describes the provider's hook system type, configuration location, supported\n * handler types, and the full mapping of canonical events to native names.\n * This is the primary data structure loaded from `providers/hook-mappings.json`.\n *\n * @public\n */\nexport interface ProviderHookProfile {\n /** The type of hook system the provider uses (`\"config\"`, `\"plugin\"`, or `\"none\"`). */\n hookSystem: HookSystemType;\n /** Filesystem path template to the provider's hook configuration file, or `null`. */\n hookConfigPath: string | null;\n /** The configuration format used for hooks (e.g. `\"json\"`, `\"yaml\"`), or `null`. */\n hookFormat: string | null;\n /** The handler execution mechanisms this provider supports. */\n handlerTypes: HookHandlerType[];\n /** Whether the provider's hook system is considered experimental or unstable. */\n experimental: boolean;\n /** Mapping of every canonical event to this provider's native representation. */\n mappings: Record<CanonicalHookEvent, HookMapping>;\n /** Native event names that exist only in this provider with no canonical equivalent. */\n providerOnlyEvents: string[];\n}\n\n// ── Normalization Result Types ──────────────────────────────────────\n\n/**\n * A fully resolved hook event with both canonical and native names.\n *\n * @remarks\n * Returned by batch translation functions. Contains all the context needed\n * to register or invoke a hook handler: the canonical name for CAAMP logic,\n * the native name for provider-specific calls, and metadata about category\n * and blocking behavior.\n *\n * @public\n */\nexport interface NormalizedHookEvent {\n /** The CAAMP canonical event name. */\n canonical: CanonicalHookEvent;\n /** The provider-native event name. */\n native: string;\n /** The provider this event was resolved for. */\n providerId: string;\n /** The lifecycle category of this event. */\n category: HookCategory;\n /** Whether a handler for this event can block the associated action. */\n canBlock: boolean;\n}\n\n/**\n * Result of querying whether a provider supports a specific canonical event.\n *\n * @remarks\n * Returned by `getHookSupport()`. Includes the native name translation\n * and any notes about support limitations. When `supported` is `false`,\n * `native` will be `null`.\n *\n * @public\n */\nexport interface HookSupportResult {\n /** The canonical event that was queried. */\n canonical: CanonicalHookEvent;\n /** Whether the provider supports this event. */\n supported: boolean;\n /** The provider-native event name, or `null` if unsupported. */\n native: string | null;\n /**\n * Optional notes about support caveats.\n *\n * @defaultValue `undefined`\n */\n notes?: string;\n}\n\n/**\n * Aggregated hook support summary for a single provider.\n *\n * @remarks\n * Provides a high-level view of a provider's hook capabilities including\n * counts, coverage percentage, and lists of supported/unsupported events.\n * Useful for CLI display and provider comparison features.\n *\n * @public\n */\nexport interface ProviderHookSummary {\n /** The provider identifier. */\n providerId: string;\n /** The type of hook system the provider uses. */\n hookSystem: HookSystemType;\n /** Whether the provider's hook system is experimental. */\n experimental: boolean;\n /** Number of canonical events this provider supports. */\n supportedCount: number;\n /** Total number of canonical events in the taxonomy. */\n totalCanonical: number;\n /** List of canonical events this provider supports. */\n supported: CanonicalHookEvent[];\n /** List of canonical events this provider does not support. */\n unsupported: CanonicalHookEvent[];\n /** Native events unique to this provider with no canonical mapping. */\n providerOnly: string[];\n /** Percentage of canonical events supported (0-100). */\n coverage: number;\n}\n\n/**\n * Cross-provider hook support matrix comparing multiple providers.\n *\n * @remarks\n * Built by `buildHookMatrix()`. Provides a two-dimensional view of which\n * canonical events are supported by which providers, with native name\n * translations. Used to render comparison tables in the CLI.\n *\n * @public\n */\nexport interface CrossProviderMatrix {\n /** The canonical events included in this matrix (rows). */\n events: CanonicalHookEvent[];\n /** The provider IDs included in this matrix (columns). */\n providers: string[];\n /** Nested record mapping each canonical event to each provider's hook mapping. */\n matrix: Record<CanonicalHookEvent, Record<string, HookMapping>>;\n}\n\n// ── Hook Mappings Data File Types ───────────────────────────────────\n\n/**\n * Schema for the `providers/hook-mappings.json` data file.\n *\n * @remarks\n * This interface represents the top-level structure of the hook mappings\n * JSON file that serves as the single source of truth for all provider\n * hook configurations. It is loaded and cached by the normalizer module.\n *\n * @public\n */\nexport interface HookMappingsFile {\n /** Semver version string of the hook mappings schema. */\n version: string;\n /** ISO 8601 date string of the last update to mappings data. */\n lastUpdated: string;\n /** Human-readable description of the mappings file purpose. */\n description: string;\n /** Definitions for every canonical event in the taxonomy. */\n canonicalEvents: Record<CanonicalHookEvent, CanonicalEventDefinition>;\n /** Hook profiles keyed by provider ID. */\n providerMappings: Record<string, ProviderHookProfile>;\n}\n","/**\n * CAAMP Hooks Normalizer\n *\n * Translates between CAAMP canonical hook events and provider-native\n * event names. Provides query functions for hook support, cross-provider\n * comparison, and event normalization.\n *\n * This module follows the same pattern as `src/core/mcp/transforms.ts` —\n * a translation layer that lets consumers use one canonical interface\n * while CAAMP handles provider-specific differences.\n */\n\nimport { readFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { resolveRegistryTemplatePath } from \"../paths/standard.js\";\nimport type {\n CanonicalEventDefinition,\n CanonicalHookEvent,\n CrossProviderMatrix,\n HookCategory,\n HookMapping,\n HookMappingsFile,\n HookSupportResult,\n HookSystemType,\n NormalizedHookEvent,\n ProviderHookProfile,\n ProviderHookSummary,\n} from \"./types.js\";\nimport { CANONICAL_HOOK_EVENTS, HOOK_CATEGORIES } from \"./types.js\";\n\n// ── Data Loading ────────────────────────────────────────────────────\n\nlet _mappings: HookMappingsFile | null = null;\n\nfunction findMappingsPath(): string {\n const thisDir = dirname(fileURLToPath(import.meta.url));\n // src/core/hooks/ -> providers/hook-mappings.json\n return join(thisDir, \"..\", \"..\", \"..\", \"providers\", \"hook-mappings.json\");\n}\n\nfunction loadMappings(): HookMappingsFile {\n if (_mappings) return _mappings;\n const raw = readFileSync(findMappingsPath(), \"utf-8\");\n _mappings = JSON.parse(raw) as HookMappingsFile;\n return _mappings;\n}\n\n/**\n * Reset the cached hook mappings data.\n *\n * @remarks\n * Clears the in-memory cache so the next query function call will\n * re-read `providers/hook-mappings.json` from disk. This is primarily\n * intended for test isolation — production code should not need to call this.\n *\n * @example\n * ```typescript\n * import { resetHookMappings, getHookMappingsVersion } from \"./normalizer.js\";\n *\n * // Force a fresh load from disk\n * resetHookMappings();\n * const version = getHookMappingsVersion();\n * ```\n *\n * @public\n */\nexport function resetHookMappings(): void {\n _mappings = null;\n}\n\n// ── Core Query Functions ────────────────────────────────────────────\n\n/**\n * Get the canonical event definition (category, description, canBlock).\n *\n * @remarks\n * Looks up the definition from the hook mappings data file. The returned\n * object contains the event's category, human-readable description, and\n * whether handlers can block the associated action.\n *\n * @param event - The canonical event name to look up.\n * @returns The event definition containing category, description, and canBlock flag.\n *\n * @example\n * ```typescript\n * import { getCanonicalEvent } from \"./normalizer.js\";\n *\n * const def = getCanonicalEvent(\"PreToolUse\");\n * console.log(def.category); // \"tool\"\n * console.log(def.canBlock); // true\n * ```\n *\n * @public\n */\nexport function getCanonicalEvent(event: CanonicalHookEvent): CanonicalEventDefinition {\n const data = loadMappings();\n return data.canonicalEvents[event];\n}\n\n/**\n * Get all canonical event definitions.\n *\n * @remarks\n * Returns the complete map of canonical event names to their definitions.\n * Useful for iterating over the full taxonomy or building UI displays\n * of all available events.\n *\n * @returns A record mapping every canonical event name to its definition.\n *\n * @example\n * ```typescript\n * import { getAllCanonicalEvents } from \"./normalizer.js\";\n *\n * const events = getAllCanonicalEvents();\n * for (const [name, def] of Object.entries(events)) {\n * console.log(`${name}: ${def.description}`);\n * }\n * ```\n *\n * @public\n */\nexport function getAllCanonicalEvents(): Record<CanonicalHookEvent, CanonicalEventDefinition> {\n return loadMappings().canonicalEvents;\n}\n\n/**\n * Get canonical events filtered by category.\n *\n * @remarks\n * Filters the canonical event list to only those belonging to the specified\n * category. Useful for displaying events grouped by lifecycle phase\n * (e.g. all `\"tool\"` events or all `\"session\"` events).\n *\n * @param category - The hook category to filter by (e.g. `\"session\"`, `\"tool\"`).\n * @returns Array of canonical event names that belong to the specified category.\n *\n * @example\n * ```typescript\n * import { getCanonicalEventsByCategory } from \"./normalizer.js\";\n *\n * const toolEvents = getCanonicalEventsByCategory(\"tool\");\n * // [\"PreToolUse\", \"PostToolUse\", \"PostToolUseFailure\"]\n * ```\n *\n * @public\n */\nexport function getCanonicalEventsByCategory(category: HookCategory): CanonicalHookEvent[] {\n const data = loadMappings();\n return CANONICAL_HOOK_EVENTS.filter(\n (event) => data.canonicalEvents[event].category === category,\n );\n}\n\n/**\n * Get the full hook profile for a provider.\n *\n * @remarks\n * Returns the complete hook configuration for a provider including its\n * hook system type, config path, handler types, and all event mappings.\n * Returns `undefined` if the provider has no hook mappings defined.\n *\n * @param providerId - The provider identifier (e.g. `\"claude-code\"`, `\"gemini-cli\"`).\n * @returns The provider's hook profile, or `undefined` if not found.\n *\n * @example\n * ```typescript\n * import { getProviderHookProfile } from \"./normalizer.js\";\n *\n * const profile = getProviderHookProfile(\"claude-code\");\n * if (profile) {\n * console.log(profile.hookSystem); // \"config\"\n * console.log(profile.experimental); // false\n * }\n * ```\n *\n * @public\n */\nexport function getProviderHookProfile(providerId: string): ProviderHookProfile | undefined {\n const data = loadMappings();\n return data.providerMappings[providerId];\n}\n\n/**\n * Get all provider IDs that have hook mappings.\n *\n * @remarks\n * Returns the list of provider identifiers present in the hook mappings\n * data file. This reflects all providers for which CAAMP has hook\n * translation data, regardless of whether they support any events.\n *\n * @returns Array of provider ID strings.\n *\n * @example\n * ```typescript\n * import { getMappedProviderIds } from \"./normalizer.js\";\n *\n * const ids = getMappedProviderIds();\n * // [\"claude-code\", \"gemini-cli\", \"cursor\", \"kimi\", ...]\n * ```\n *\n * @public\n */\nexport function getMappedProviderIds(): string[] {\n return Object.keys(loadMappings().providerMappings);\n}\n\n// ── Normalization: Canonical → Native ───────────────────────────────\n\n/**\n * Translate a CAAMP canonical event name to the provider's native name.\n *\n * @remarks\n * This is the primary forward-translation function. Given a canonical\n * event and a provider ID, it returns the provider-specific event name\n * that should be used when configuring hooks for that provider.\n * Returns `null` if the provider is unknown or does not support the event.\n *\n * @param canonical - The CAAMP canonical event name to translate.\n * @param providerId - The target provider identifier.\n * @returns The native event name, or `null` if unsupported.\n *\n * @example\n * ```typescript\n * import { toNative } from \"./normalizer.js\";\n *\n * toNative(\"PreToolUse\", \"claude-code\"); // \"PreToolUse\"\n * toNative(\"PreToolUse\", \"gemini-cli\"); // \"BeforeTool\"\n * toNative(\"PreToolUse\", \"cursor\"); // \"preToolUse\"\n * toNative(\"PreToolUse\", \"kimi\"); // null\n * ```\n *\n * @public\n */\nexport function toNative(\n canonical: CanonicalHookEvent,\n providerId: string,\n): string | null {\n const profile = getProviderHookProfile(providerId);\n if (!profile) return null;\n const mapping = profile.mappings[canonical];\n return mapping?.supported ? mapping.nativeName : null;\n}\n\n/**\n * Translate a provider-native event name to the CAAMP canonical name.\n *\n * @remarks\n * This is the reverse-translation function. Scans all event mappings\n * for the given provider to find a canonical match for the native name.\n * Returns `null` if no mapping is found or the provider is unknown.\n *\n * @param nativeName - The provider-native event name to look up.\n * @param providerId - The provider identifier to search within.\n * @returns The canonical event name, or `null` if no mapping exists.\n *\n * @example\n * ```typescript\n * import { toCanonical } from \"./normalizer.js\";\n *\n * toCanonical(\"BeforeTool\", \"gemini-cli\"); // \"PreToolUse\"\n * toCanonical(\"stop\", \"cursor\"); // \"ResponseComplete\"\n * toCanonical(\"UserPromptSubmit\", \"claude-code\"); // \"PromptSubmit\"\n * ```\n *\n * @public\n */\nexport function toCanonical(\n nativeName: string,\n providerId: string,\n): CanonicalHookEvent | null {\n const profile = getProviderHookProfile(providerId);\n if (!profile) return null;\n\n for (const [canonical, mapping] of Object.entries(profile.mappings)) {\n if (mapping.supported && mapping.nativeName === nativeName) {\n return canonical as CanonicalHookEvent;\n }\n }\n return null;\n}\n\n/**\n * Batch-translate multiple canonical events to native names for a provider.\n *\n * @remarks\n * Translates an array of canonical events in a single call, returning\n * only the events that the provider actually supports. Each result\n * includes category and blocking metadata. Unsupported events are\n * silently excluded from the output.\n *\n * @param canonicals - Array of canonical event names to translate.\n * @param providerId - The target provider identifier.\n * @returns Array of normalized events (only supported ones included).\n *\n * @example\n * ```typescript\n * import { toNativeBatch } from \"./normalizer.js\";\n *\n * const events = toNativeBatch(\n * [\"PreToolUse\", \"PostToolUse\", \"ConfigChange\"],\n * \"claude-code\",\n * );\n * // Returns NormalizedHookEvent[] for supported events only\n * ```\n *\n * @public\n */\nexport function toNativeBatch(\n canonicals: CanonicalHookEvent[],\n providerId: string,\n): NormalizedHookEvent[] {\n const data = loadMappings();\n const profile = data.providerMappings[providerId];\n if (!profile) return [];\n\n const results: NormalizedHookEvent[] = [];\n for (const canonical of canonicals) {\n const mapping = profile.mappings[canonical];\n if (mapping?.supported && mapping.nativeName) {\n results.push({\n canonical,\n native: mapping.nativeName,\n providerId,\n category: data.canonicalEvents[canonical].category,\n canBlock: data.canonicalEvents[canonical].canBlock,\n });\n }\n }\n return results;\n}\n\n// ── Support Queries ─────────────────────────────────────────────────\n\n/**\n * Check if a provider supports a specific canonical hook event.\n *\n * @remarks\n * A quick boolean check that avoids returning the full mapping details.\n * Returns `false` if the provider is unknown or the event is not supported.\n *\n * @param canonical - The canonical event name to check.\n * @param providerId - The provider identifier to check against.\n * @returns `true` if the provider supports this canonical event, `false` otherwise.\n *\n * @example\n * ```typescript\n * import { supportsHook } from \"./normalizer.js\";\n *\n * supportsHook(\"PreToolUse\", \"claude-code\"); // true\n * supportsHook(\"PreToolUse\", \"kimi\"); // false\n * ```\n *\n * @public\n */\nexport function supportsHook(\n canonical: CanonicalHookEvent,\n providerId: string,\n): boolean {\n const profile = getProviderHookProfile(providerId);\n if (!profile) return false;\n return profile.mappings[canonical]?.supported ?? false;\n}\n\n/**\n * Get full hook support details for a canonical event on a provider.\n *\n * @remarks\n * Returns a structured result with the native name translation and any\n * notes about support limitations. Unlike `supportsHook()`, this always\n * returns a result object even when the provider is unknown (with\n * `supported: false`).\n *\n * @param canonical - The canonical event name to query.\n * @param providerId - The provider identifier to query against.\n * @returns Support result including native name and optional notes.\n *\n * @example\n * ```typescript\n * import { getHookSupport } from \"./normalizer.js\";\n *\n * const result = getHookSupport(\"PreToolUse\", \"claude-code\");\n * console.log(result.supported); // true\n * console.log(result.native); // \"PreToolUse\"\n * ```\n *\n * @public\n */\nexport function getHookSupport(\n canonical: CanonicalHookEvent,\n providerId: string,\n): HookSupportResult {\n const profile = getProviderHookProfile(providerId);\n if (!profile) {\n return { canonical, supported: false, native: null };\n }\n const mapping = profile.mappings[canonical];\n return {\n canonical,\n supported: mapping?.supported ?? false,\n native: mapping?.nativeName ?? null,\n notes: mapping?.notes,\n };\n}\n\n/**\n * Get all supported canonical events for a provider.\n *\n * @remarks\n * Filters the full canonical event list to only those that the provider\n * supports. Returns an empty array if the provider is unknown.\n *\n * @param providerId - The provider identifier to query.\n * @returns Array of canonical event names the provider supports.\n *\n * @example\n * ```typescript\n * import { getSupportedEvents } from \"./normalizer.js\";\n *\n * const events = getSupportedEvents(\"claude-code\");\n * // [\"SessionStart\", \"SessionEnd\", \"PreToolUse\", ...]\n * ```\n *\n * @public\n */\nexport function getSupportedEvents(providerId: string): CanonicalHookEvent[] {\n const profile = getProviderHookProfile(providerId);\n if (!profile) return [];\n return CANONICAL_HOOK_EVENTS.filter(\n (event) => profile.mappings[event]?.supported,\n );\n}\n\n/**\n * Get all unsupported canonical events for a provider.\n *\n * @remarks\n * Returns the complement of `getSupportedEvents()`. If the provider is\n * unknown, all canonical events are returned since none are supported.\n *\n * @param providerId - The provider identifier to query.\n * @returns Array of canonical event names the provider does not support.\n *\n * @example\n * ```typescript\n * import { getUnsupportedEvents } from \"./normalizer.js\";\n *\n * const missing = getUnsupportedEvents(\"kimi\");\n * // Returns all canonical events (kimi has no hook support)\n * ```\n *\n * @public\n */\nexport function getUnsupportedEvents(providerId: string): CanonicalHookEvent[] {\n const profile = getProviderHookProfile(providerId);\n if (!profile) return [...CANONICAL_HOOK_EVENTS];\n return CANONICAL_HOOK_EVENTS.filter(\n (event) => !profile.mappings[event]?.supported,\n );\n}\n\n/**\n * Get providers that support a specific canonical event.\n *\n * @remarks\n * Scans all provider mappings and returns the IDs of those that support\n * the given canonical event. Useful for determining which providers can\n * be targeted when configuring a specific hook.\n *\n * @param canonical - The canonical event name to search for.\n * @returns Array of provider IDs that support this event.\n *\n * @example\n * ```typescript\n * import { getProvidersForEvent } from \"./normalizer.js\";\n *\n * const providers = getProvidersForEvent(\"PreToolUse\");\n * // [\"claude-code\", \"gemini-cli\", \"cursor\"]\n * ```\n *\n * @public\n */\nexport function getProvidersForEvent(canonical: CanonicalHookEvent): string[] {\n const data = loadMappings();\n return Object.entries(data.providerMappings)\n .filter(([, profile]) => profile.mappings[canonical]?.supported)\n .map(([id]) => id);\n}\n\n/**\n * Get canonical events common to all specified providers.\n *\n * @remarks\n * Computes the intersection of supported events across multiple providers.\n * Returns only events that every listed provider supports. Useful for\n * determining which hooks can be configured uniformly across a set of\n * target providers.\n *\n * @param providerIds - Array of provider IDs to intersect.\n * @returns Array of canonical events supported by all specified providers.\n *\n * @example\n * ```typescript\n * import { getCommonEvents } from \"./normalizer.js\";\n *\n * const common = getCommonEvents([\"claude-code\", \"gemini-cli\"]);\n * // Returns only events both providers support\n * ```\n *\n * @public\n */\nexport function getCommonEvents(providerIds: string[]): CanonicalHookEvent[] {\n if (providerIds.length === 0) return [];\n return CANONICAL_HOOK_EVENTS.filter(\n (event) => providerIds.every((id) => supportsHook(event, id)),\n );\n}\n\n// ── Summary & Matrix Functions ──────────────────────────────────────\n\n/**\n * Get a summary of hook support for a provider.\n *\n * @remarks\n * Builds an aggregated view of a provider's hook capabilities including\n * counts, coverage percentage, and categorized event lists. Returns\n * `undefined` if the provider has no hook mappings. Used by the CLI\n * `hooks show` command for provider overviews.\n *\n * @param providerId - The provider identifier to summarize.\n * @returns The hook support summary, or `undefined` if the provider is not found.\n *\n * @example\n * ```typescript\n * import { getProviderSummary } from \"./normalizer.js\";\n *\n * const summary = getProviderSummary(\"claude-code\");\n * if (summary) {\n * console.log(`${summary.coverage}% coverage`);\n * console.log(`${summary.supportedCount}/${summary.totalCanonical} events`);\n * }\n * ```\n *\n * @public\n */\nexport function getProviderSummary(providerId: string): ProviderHookSummary | undefined {\n const profile = getProviderHookProfile(providerId);\n if (!profile) return undefined;\n\n const supported = getSupportedEvents(providerId);\n const unsupported = getUnsupportedEvents(providerId);\n\n return {\n providerId,\n hookSystem: profile.hookSystem,\n experimental: profile.experimental,\n supportedCount: supported.length,\n totalCanonical: CANONICAL_HOOK_EVENTS.length,\n supported,\n unsupported,\n providerOnly: profile.providerOnlyEvents,\n coverage: Math.round((supported.length / CANONICAL_HOOK_EVENTS.length) * 100),\n };\n}\n\n/**\n * Build a cross-provider hook support matrix.\n *\n * @remarks\n * Constructs a two-dimensional matrix showing which canonical events are\n * supported by which providers, with native name translations. When no\n * provider IDs are specified, all mapped providers are included. Used by\n * the CLI `hooks matrix` command for comparison tables.\n *\n * @param providerIds - Optional array of provider IDs to include. Defaults to all mapped providers.\n * @returns The cross-provider matrix with events, providers, and mapping data.\n *\n * @example\n * ```typescript\n * import { buildHookMatrix } from \"./normalizer.js\";\n *\n * const matrix = buildHookMatrix([\"claude-code\", \"gemini-cli\"]);\n * for (const event of matrix.events) {\n * for (const provider of matrix.providers) {\n * console.log(`${event} @ ${provider}: ${matrix.matrix[event][provider].supported}`);\n * }\n * }\n * ```\n *\n * @public\n */\nexport function buildHookMatrix(providerIds?: string[]): CrossProviderMatrix {\n const data = loadMappings();\n const ids = providerIds ?? Object.keys(data.providerMappings);\n\n const matrix: Record<string, Record<string, HookMapping>> = {};\n for (const event of CANONICAL_HOOK_EVENTS) {\n matrix[event] = {};\n for (const id of ids) {\n const profile = data.providerMappings[id];\n matrix[event][id] = profile?.mappings[event] ?? {\n nativeName: null,\n supported: false,\n };\n }\n }\n\n return {\n events: [...CANONICAL_HOOK_EVENTS],\n providers: ids,\n matrix: matrix as CrossProviderMatrix[\"matrix\"],\n };\n}\n\n/**\n * Get the hook system type for a provider.\n *\n * @remarks\n * Returns the provider's hook system type: `\"config\"` for file-based hooks,\n * `\"plugin\"` for extension-based hooks, or `\"none\"` if the provider does\n * not support hooks. Returns `\"none\"` for unknown providers.\n *\n * @param providerId - The provider identifier to query.\n * @returns The hook system type (`\"config\"`, `\"plugin\"`, or `\"none\"`).\n *\n * @example\n * ```typescript\n * import { getHookSystemType } from \"./normalizer.js\";\n *\n * getHookSystemType(\"claude-code\"); // \"config\"\n * getHookSystemType(\"unknown\"); // \"none\"\n * ```\n *\n * @public\n */\nexport function getHookSystemType(providerId: string): HookSystemType {\n const profile = getProviderHookProfile(providerId);\n return profile?.hookSystem ?? \"none\";\n}\n\n/**\n * Get the resolved hook config path for a provider.\n *\n * @remarks\n * Resolves the provider's hook configuration file path by expanding\n * registry template variables (e.g. `~` to the home directory). Returns\n * `null` if the provider has no hook config path defined or is unknown.\n *\n * @param providerId - The provider identifier to query.\n * @returns The resolved filesystem path, or `null` if not available.\n *\n * @example\n * ```typescript\n * import { getHookConfigPath } from \"./normalizer.js\";\n *\n * const path = getHookConfigPath(\"claude-code\");\n * // \"/home/user/.claude/settings.json\" (resolved from template)\n * ```\n *\n * @public\n */\nexport function getHookConfigPath(providerId: string): string | null {\n const profile = getProviderHookProfile(providerId);\n if (!profile?.hookConfigPath) return null;\n return resolveRegistryTemplatePath(profile.hookConfigPath);\n}\n\n/**\n * Get provider-only events (native events with no canonical mapping).\n *\n * @remarks\n * Some providers define hook events that have no equivalent in the CAAMP\n * canonical taxonomy. This function returns those provider-specific event\n * names. Returns an empty array for unknown providers.\n *\n * @param providerId - The provider identifier to query.\n * @returns Array of native event names unique to this provider.\n *\n * @example\n * ```typescript\n * import { getProviderOnlyEvents } from \"./normalizer.js\";\n *\n * const extras = getProviderOnlyEvents(\"claude-code\");\n * // Returns any events specific to Claude Code with no canonical equivalent\n * ```\n *\n * @public\n */\nexport function getProviderOnlyEvents(providerId: string): string[] {\n const profile = getProviderHookProfile(providerId);\n return profile?.providerOnlyEvents ?? [];\n}\n\n// ── Multi-Provider Translation ──────────────────────────────────────\n\n/**\n * Translate a canonical event to native names across multiple providers.\n *\n * @remarks\n * Performs a fan-out translation of a single canonical event to all\n * specified providers simultaneously. The result record only includes\n * providers that actually support the event — unsupported providers\n * are silently excluded.\n *\n * @param canonical - The canonical event name to translate.\n * @param providerIds - Array of provider IDs to translate for.\n * @returns Record mapping provider IDs to their native event names (supported only).\n *\n * @example\n * ```typescript\n * import { translateToAll } from \"./normalizer.js\";\n *\n * const result = translateToAll(\"PreToolUse\", [\"claude-code\", \"gemini-cli\", \"kimi\"]);\n * // { \"claude-code\": \"PreToolUse\", \"gemini-cli\": \"BeforeTool\" }\n * // (kimi excluded — unsupported)\n * ```\n *\n * @public\n */\nexport function translateToAll(\n canonical: CanonicalHookEvent,\n providerIds: string[],\n): Record<string, string> {\n const result: Record<string, string> = {};\n for (const id of providerIds) {\n const native = toNative(canonical, id);\n if (native) {\n result[id] = native;\n }\n }\n return result;\n}\n\n/**\n * Find the best canonical match for a native event name across all providers.\n *\n * @remarks\n * Scans every provider's mappings to find canonical events that match the\n * given native name. Useful when you have a native name but do not know\n * which provider it belongs to. Multiple results are possible if different\n * providers use the same native name for different canonical events.\n *\n * @param nativeName - The provider-native event name to resolve.\n * @returns Array of matches, each containing the provider ID and canonical event name.\n *\n * @example\n * ```typescript\n * import { resolveNativeEvent } from \"./normalizer.js\";\n *\n * const matches = resolveNativeEvent(\"BeforeTool\");\n * // [{ providerId: \"gemini-cli\", canonical: \"PreToolUse\" }]\n * ```\n *\n * @public\n */\nexport function resolveNativeEvent(nativeName: string): Array<{\n providerId: string;\n canonical: CanonicalHookEvent;\n}> {\n const data = loadMappings();\n const results: Array<{ providerId: string; canonical: CanonicalHookEvent }> = [];\n\n for (const [providerId, profile] of Object.entries(data.providerMappings)) {\n for (const [canonical, mapping] of Object.entries(profile.mappings)) {\n if (mapping.supported && mapping.nativeName === nativeName) {\n results.push({ providerId, canonical: canonical as CanonicalHookEvent });\n }\n }\n }\n\n return results;\n}\n\n/**\n * Get the version of the hook mappings data.\n *\n * @remarks\n * Returns the semver version string from the hook mappings JSON file.\n * This can be used to check compatibility or display the data version\n * in diagnostic output.\n *\n * @returns The semver version string of the loaded hook mappings data.\n *\n * @example\n * ```typescript\n * import { getHookMappingsVersion } from \"./normalizer.js\";\n *\n * const version = getHookMappingsVersion();\n * console.log(`Hook mappings v${version}`);\n * ```\n *\n * @public\n */\nexport function getHookMappingsVersion(): string {\n return loadMappings().version;\n}\n"],"mappings":";;;;;AAqBO,IAAM,kBAAkB,CAAC,WAAW,UAAU,QAAQ,SAAS,SAAS;AAwBxE,IAAM,wBAAwB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,E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