1212
};
1213
}
1215
>
const hooks = new Map<HookType, IParsedHookCommand[]>();
1216
>
for (const [hookType, { hooks: commands }] of parsedHooks) {
1217
>
for (const command of commands) {
1218
>
let bucket = hooks.get(hookType);
1219
>
if (!bucket) {
1220
>
bucket = [];
1221
>
hooks.set(hookType, bucket);
1222
>
}
1223
>
bucket.push(command);
1224
>
this.logger.trace(`[PromptsService] Collected ${hookType} hook from ${hookFile.uri} (format: ${format})`);
1225
>
}
1226
>
}
1227
>
1228
>
return {
1229
>
file: { status: 'loaded', promptPath: this.withPromptPathMetadata(hookFile, name, hookFile.description) },
1230
>
hooks,
1231
>
sourceUri: hookFile.uri,
1232
>
};
1233
>
} catch (error) {
1234
const msg = error instanceof Error ? error.message : String(error);
1235
this.logger.warn(`[PromptsService] Failed to parse hook file: ${hookFile.uri}`, error);