MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / readHooks

Function readHooks

packages/agent-core/src/plugin/manifest.ts:293–315  ·  view source on GitHub ↗
(
  raw: unknown,
  diagnostics: PluginDiagnostic[],
)

Source from the content-addressed store, hash-verified

291}
292
293function readHooks(
294 raw: unknown,
295 diagnostics: PluginDiagnostic[],
296): readonly HookDefConfig[] | undefined {
297 if (raw === undefined) return undefined;
298 if (!Array.isArray(raw)) {
299 diagnostics.push({ severity: 'warn', message: '"hooks" must be an array' });
300 return undefined;
301 }
302 const out: HookDefConfig[] = [];
303 raw.forEach((entry, i) => {
304 const parsed = HookDefSchema.safeParse(entry);
305 if (!parsed.success) {
306 diagnostics.push({
307 severity: 'warn',
308 message: `Invalid hook at index ${i}: ${parsed.error.message}`,
309 });
310 } else {
311 out.push(parsed.data);
312 }
313 });
314 return out.length === 0 ? undefined : out;
315}
316
317async function readCommands(
318 pluginRoot: string,

Callers 1

parseManifestFunction · 0.85

Calls 2

forEachMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected