MCPcopy Index your code
hub / github.com/codeaashu/claude-code / buildHookSchemas

Function buildHookSchemas

src/schemas/hooks.ts:31–171  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29// Internal factory for individual hook schemas (shared between exported
30// discriminated union members and the HookCommandSchema factory)
31function buildHookSchemas() {
32 const BashCommandHookSchema = z.object({
33 type: z.literal('command').describe('Shell command hook type'),
34 command: z.string().describe('Shell command to execute'),
35 if: IfConditionSchema(),
36 shell: z
37 .enum(SHELL_TYPES)
38 .optional()
39 .describe(
40 "Shell interpreter. 'bash' uses your $SHELL (bash/zsh/sh); 'powershell' uses pwsh. Defaults to bash.",
41 ),
42 timeout: z
43 .number()
44 .positive()
45 .optional()
46 .describe('Timeout in seconds for this specific command'),
47 statusMessage: z
48 .string()
49 .optional()
50 .describe('Custom status message to display in spinner while hook runs'),
51 once: z
52 .boolean()
53 .optional()
54 .describe('If true, hook runs once and is removed after execution'),
55 async: z
56 .boolean()
57 .optional()
58 .describe('If true, hook runs in background without blocking'),
59 asyncRewake: z
60 .boolean()
61 .optional()
62 .describe(
63 'If true, hook runs in background and wakes the model on exit code 2 (blocking error). Implies async.',
64 ),
65 })
66
67 const PromptHookSchema = z.object({
68 type: z.literal('prompt').describe('LLM prompt hook type'),
69 prompt: z
70 .string()
71 .describe(
72 'Prompt to evaluate with LLM. Use $ARGUMENTS placeholder for hook input JSON.',
73 ),
74 if: IfConditionSchema(),
75 timeout: z
76 .number()
77 .positive()
78 .optional()
79 .describe('Timeout in seconds for this specific prompt evaluation'),
80 // @[MODEL LAUNCH]: Update the example model ID in the .describe() strings below (prompt + agent hooks).
81 model: z
82 .string()
83 .optional()
84 .describe(
85 'Model to use for this prompt hook (e.g., "claude-sonnet-4-6"). If not specified, uses the default small fast model.',
86 ),
87 statusMessage: z
88 .string()

Callers 1

hooks.tsFile · 0.85

Calls 1

recordMethod · 0.45

Tested by

no test coverage detected