cc-hooks-ts 2.0.42 → 2.0.43

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.
package/README.md CHANGED
@@ -14,43 +14,22 @@ npx nypm add cc-hooks-ts
14
14
 
15
15
  ## Basic Usage
16
16
 
17
- > [!NOTE]
18
- > We highly recommend using Bun or Deno for automatic dependency downloading at runtime.
19
- >
20
- > - Bun: <https://bun.com/docs/runtime/autoimport>
21
- > - Deno: <https://docs.deno.com/runtime/fundamentals/modules/#managing-third-party-modules-and-libraries>
22
-
23
17
  ### Define a Hook
24
18
 
25
- With Bun:
26
-
27
- ```typescript
28
- #!/usr/bin/env -S bun run --silent
29
- import { defineHook, runHook } from "cc-hooks-ts";
30
-
31
- // Session start hook
32
- const sessionHook = defineHook({
33
- trigger: { SessionStart: true },
34
- run: (context) => {
35
- // do something great
36
- return context.success({
37
- messageForUser: "Welcome to your coding session!"
38
- });
39
- }
40
- });
41
-
42
- await runHook(sessionHook);
43
- ```
44
-
45
- Or with Deno:
19
+ Example of running a simple SessionStart hook on Bun:
46
20
 
47
21
  ```typescript
48
- #!/usr/bin/env -S deno run --quiet --allow-env --allow-read
49
- import { defineHook, runHook } from "npm:cc-hooks-ts";
22
+ import { defineHook } from "cc-hooks-ts";
50
23
 
51
- // Session start hook
52
24
  const sessionHook = defineHook({
53
- trigger: { SessionStart: true },
25
+ trigger: {
26
+ // Specify the hook event to listen for
27
+ SessionStart: true,
28
+ PreToolUse: {
29
+ // PreToolUser and PostToolUse can be tool-specific. (affects type of context)
30
+ Read: true
31
+ }
32
+ },
54
33
  run: (context) => {
55
34
  // do something great
56
35
  return context.success({
@@ -59,7 +38,11 @@ const sessionHook = defineHook({
59
38
  }
60
39
  });
61
40
 
62
- await runHook(sessionHook);
41
+ // import.meta.main is available in Node.js 24.2+ and Bun and Deno
42
+ if (import.meta.main) {
43
+ const { runHook } = await import("cc-hooks-ts");
44
+ await runHook(sessionHook);
45
+ }
63
46
  ```
64
47
 
65
48
  ### Call from Claude Code
@@ -74,7 +57,7 @@ Then, load defined hooks in your Claude Code settings at `~/.claude/settings.jso
74
57
  "hooks": [
75
58
  {
76
59
  "type": "command",
77
- "command": "$HOME/.claude/<name-of-your-hooks>.ts"
60
+ "command": "bun run --silent path/to/your/sessionHook.ts"
78
61
  }
79
62
  ]
80
63
  }
@@ -149,6 +132,7 @@ const multiEventHook = defineHook({
149
132
  PreToolUse: { Read: true, WebFetch: true },
150
133
  PostToolUse: { Read: true }
151
134
  },
135
+ // Optional: Define when the hook should run.
152
136
  shouldRun: () => process.env.NODE_ENV === 'development',
153
137
  run: (context) => {
154
138
  // Handle different events and tools based on context.input
package/dist/index.d.mts CHANGED
@@ -1,164 +1,11 @@
1
1
  import * as v from "valibot";
2
2
  import { AgentInput, BashInput, BashOutputInput, ExitPlanModeInput, FileEditInput, FileReadInput, FileWriteInput, GlobInput, GrepInput, KillShellInput, ListMcpResourcesInput, NotebookEditInput, ReadMcpResourceInput, TodoWriteInput, WebFetchInput, WebSearchInput } from "@anthropic-ai/claude-agent-sdk/sdk-tools";
3
3
 
4
- //#region src/event.d.ts
5
- declare const SUPPORTED_HOOK_EVENTS: readonly ["PreToolUse", "PostToolUse", "Notification", "UserPromptSubmit", "SessionStart", "SessionEnd", "Stop", "SubagentStop", "PreCompact"];
6
- /**
7
- * @see {@link https://docs.anthropic.com/en/docs/claude-code/hooks#hook-events}
8
- */
9
- type SupportedHookEvent = (typeof SUPPORTED_HOOK_EVENTS)[number];
10
- //#endregion
11
- //#region src/output.d.ts
12
- type HookOutput = {
13
- PreToolUse: PreToolUseHookOutput;
14
- PostToolUse: PostToolUseHookOutput;
15
- UserPromptSubmit: UserPromptSubmitHookOutput;
16
- Stop: StopHookOutput;
17
- SubagentStop: SubagentStopHookOutput;
18
- SessionStart: SessionStartHookOutput;
19
- Notification: CommonHookOutputs;
20
- PreCompact: CommonHookOutputs;
21
- SessionEnd: CommonHookOutputs;
22
- };
23
- type ExtractHookOutput<TEvent$1 extends SupportedHookEvent> = HookOutput extends Record<SupportedHookEvent, unknown> ? HookOutput[TEvent$1] : never;
24
- /**
25
- * Common fields of hook outputs
26
- *
27
- * @see {@link https://docs.anthropic.com/en/docs/claude-code/hooks#common-json-fields}
28
- */
29
- type CommonHookOutputs = {
30
- /**
31
- * Whether Claude should continue after hook execution
32
- *
33
- * If `continue` is false, Claude stops processing after the hooks run.
34
- * @default true
35
- */
36
- continue?: boolean;
37
- /**
38
- * Accompanies `continue` with a `reason` shown to the user, not shown to Claude.
39
- *
40
- * NOT FOR CLAUDE
41
- */
42
- stopReason?: string;
43
- /**
44
- * If `true`, user cannot see the stdout of this hook.
45
- *
46
- * @default false
47
- */
48
- suppressOutput?: boolean;
49
- /**
50
- * Optional warning message shown to the user
51
- */
52
- systemMessage?: string;
53
- /**
54
- * Use `hookSpecificOutput` in appropriate hook events instead.
55
- *
56
- * @deprecated
57
- */
58
- reason?: string;
59
- /**
60
- * Use `hookSpecificOutput` in appropriate hook events instead.
61
- *
62
- * @deprecated
63
- */
64
- decision?: "approve" | "block";
65
- };
66
- /**
67
- * @see {@link https://docs.anthropic.com/en/docs/claude-code/hooks#pretooluse-decision-control}
68
- */
69
- interface PreToolUseHookOutput extends CommonHookOutputs {
70
- hookSpecificOutput?: {
71
- hookEventName: "PreToolUse";
72
- /**
73
- * - `allow` bypasses the permission system. `permissionDecisionReason` is shown to the user but not to Claude.
74
- * - `deny` prevents the tool call from executing. `permissionDecisionReason` is shown to Claude.
75
- * - `ask` asks the user to confirm the tool call in the UI. `permissionDecisionReason` is shown to the user but not to Claude.
76
- */
77
- permissionDecision?: "allow" | "ask" | "deny";
78
- permissionDecisionReason?: string;
79
- updatedInput?: Record<string, unknown>;
80
- };
81
- }
82
- /**
83
- * @see {@link https://docs.anthropic.com/en/docs/claude-code/hooks#posttooluse-decision-control}
84
- */
85
- interface PostToolUseHookOutput extends CommonHookOutputs {
86
- /**
87
- * - `approve` has no effect; the tool response is processed normally.
88
- * - `block` automatically prompts Claude with `reason`.
89
- */
90
- decision?: "approve" | "block";
91
- hookSpecificOutput?: {
92
- hookEventName: "PostToolUse";
93
- /**
94
- * Adds context for Claude to consider.
95
- */
96
- additionalContext?: string;
97
- updatedMCPToolOutput?: unknown;
98
- };
99
- reason?: string;
100
- }
101
- /**
102
- * @see {@link https://docs.anthropic.com/en/docs/claude-code/hooks#userpromptsubmit-decision-control}
103
- */
104
- interface UserPromptSubmitHookOutput extends CommonHookOutputs {
105
- /**
106
- * - `approve` has no effect; the tool response is processed normally.
107
- * - `block` prevents the prompt from being processed.
108
- * The submitted prompt is erased from context. `reason` is shown to the user but not added to context.
109
- */
110
- decision?: "approve" | "block";
111
- hookSpecificOutput?: {
112
- hookEventName: "UserPromptSubmit";
113
- /**
114
- * Adds the string to the context if not blocked.
115
- */
116
- additionalContext?: string;
117
- };
118
- reason?: string;
119
- }
120
- /**
121
- * @see {@link https://docs.anthropic.com/en/docs/claude-code/hooks#stop%2Fsubagentstop-decision-control}
122
- */
123
- interface StopHookOutput extends CommonHookOutputs {
124
- /**
125
- * - `approve` has no effect; the tool response is processed normally.
126
- * - `block` prevents Claude from stopping. You must populate `reason` for Claude to know how to proceed.
127
- */
128
- decision?: "approve" | "block";
129
- /**
130
- * Reason for the decision.
131
- */
132
- reason?: string;
133
- }
134
- /**
135
- * @see {@link https://docs.anthropic.com/en/docs/claude-code/hooks#stop%2Fsubagentstop-decision-control}
136
- */
137
- interface SubagentStopHookOutput extends CommonHookOutputs {
138
- /**
139
- * - `approve` has no effect; the tool response is processed normally.
140
- * - `block` prevents Claude from stopping. You must populate `reason` for Claude to know how to proceed.
141
- */
142
- /**
143
- * Reason for the decision.
144
- */
145
- reason?: string;
146
- }
147
- interface SessionStartHookOutput extends CommonHookOutputs {
148
- hookSpecificOutput?: {
149
- hookEventName: "SessionStart";
150
- /**
151
- * Adds the string to the context.
152
- */
153
- additionalContext?: string;
154
- };
155
- }
156
- //#endregion
157
4
  //#region src/utils/types.d.ts
158
5
  type Awaitable<T> = Promise<T> | T;
159
6
  type AutoComplete<T extends string> = Record<string, never> & T;
160
7
  //#endregion
161
- //#region src/input/schemas.d.ts
8
+ //#region src/hooks/input/schemas.d.ts
162
9
  /**
163
10
  * @package
164
11
  */
@@ -172,6 +19,7 @@ declare const HookInputSchemas: {
172
19
  } & {
173
20
  tool_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, AutoComplete<string>>]>;
174
21
  tool_input: v.UnknownSchema;
22
+ tool_use_id: v.StringSchema<undefined>;
175
23
  }, undefined>;
176
24
  readonly PostToolUse: v.ObjectSchema<{
177
25
  readonly cwd: v.StringSchema<undefined>;
@@ -183,6 +31,7 @@ declare const HookInputSchemas: {
183
31
  tool_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, AutoComplete<string>>]>;
184
32
  tool_input: v.UnknownSchema;
185
33
  tool_response: v.UnknownSchema;
34
+ tool_use_id: v.StringSchema<undefined>;
186
35
  }, undefined>;
187
36
  readonly Notification: v.ObjectSchema<{
188
37
  readonly cwd: v.StringSchema<undefined>;
@@ -213,6 +62,16 @@ declare const HookInputSchemas: {
213
62
  } & {
214
63
  stop_hook_active: v.BooleanSchema<undefined>;
215
64
  }, undefined>;
65
+ readonly SubagentStart: v.ObjectSchema<{
66
+ readonly cwd: v.StringSchema<undefined>;
67
+ readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
68
+ readonly session_id: v.StringSchema<undefined>;
69
+ readonly transcript_path: v.StringSchema<undefined>;
70
+ readonly hook_event_name: v.LiteralSchema<"SubagentStart", undefined>;
71
+ } & {
72
+ agent_id: v.StringSchema<undefined>;
73
+ agent_type: v.StringSchema<undefined>;
74
+ }, undefined>;
216
75
  readonly SubagentStop: v.ObjectSchema<{
217
76
  readonly cwd: v.StringSchema<undefined>;
218
77
  readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -254,7 +113,15 @@ declare const HookInputSchemas: {
254
113
  }, undefined>;
255
114
  };
256
115
  //#endregion
257
- //#region src/input/types.d.ts
116
+ //#region src/hooks/event.d.ts
117
+ /**
118
+ * @see {@link https://docs.anthropic.com/en/docs/claude-code/hooks#hook-events}
119
+ *
120
+ * @package
121
+ */
122
+ type SupportedHookEvent = "PreToolUse" | "PostToolUse" | "Notification" | "UserPromptSubmit" | "SessionStart" | "SessionEnd" | "Stop" | "SubagentStop" | "PreCompact" | "SubagentStart";
123
+ //#endregion
124
+ //#region src/hooks/input/types.d.ts
258
125
  /**
259
126
  * Internal type that combines base hook inputs with tool-specific inputs for PreToolUse events.
260
127
  * For non-PreToolUse events, this is equivalent to BaseHookInputs.
@@ -266,7 +133,7 @@ declare const HookInputSchemas: {
266
133
  * ```
267
134
  * @package
268
135
  */
269
- type HookInputs = { [EventKey in SupportedHookEvent]: EventKey extends "PreToolUse" ? ToolSpecificPreToolUseInput & {
136
+ type HookInput = { [EventKey in SupportedHookEvent]: EventKey extends "PreToolUse" ? ToolSpecificPreToolUseInput & {
270
137
  default: BaseHookInputs["PreToolUse"];
271
138
  } : EventKey extends "PostToolUse" ? ToolSpecificPostToolUseInput & {
272
139
  default: BaseHookInputs["PostToolUse"];
@@ -290,7 +157,7 @@ type HookInputs = { [EventKey in SupportedHookEvent]: EventKey extends "PreToolU
290
157
  * ```
291
158
  * @package
292
159
  */
293
- type ExtractAllHookInputsForEvent<TEvent$1 extends SupportedHookEvent> = { [K in keyof HookInputs[TEvent$1]]: HookInputs[TEvent$1][K] }[keyof HookInputs[TEvent$1]];
160
+ type ExtractAllHookInputsForEvent<TEvent$1 extends SupportedHookEvent> = { [K in keyof HookInput[TEvent$1]]: HookInput[TEvent$1][K] }[keyof HookInput[TEvent$1]];
294
161
  /**
295
162
  * Extracts the hook input type for a specific tool within a given event type.
296
163
  * This type utility is used to get strongly-typed inputs for tool-specific hook handlers.
@@ -311,11 +178,11 @@ type ExtractAllHookInputsForEvent<TEvent$1 extends SupportedHookEvent> = { [K in
311
178
  * ```
312
179
  * @package
313
180
  */
314
- type ExtractSpecificHookInputForEvent<TEvent$1 extends SupportedHookEvent, TSpecificKey extends ExtractExtendedSpecificKeys<TEvent$1>> = TSpecificKey extends keyof HookInputs[TEvent$1] ? HookInputs[TEvent$1][TSpecificKey] : never;
181
+ type ExtractSpecificHookInputForEvent<TEvent$1 extends SupportedHookEvent, TSpecificKey extends ExtractExtendedSpecificKeys<TEvent$1>> = TSpecificKey extends keyof HookInput[TEvent$1] ? HookInput[TEvent$1][TSpecificKey] : never;
315
182
  /**
316
183
  * @package
317
184
  */
318
- type ExtractExtendedSpecificKeys<TEvent$1 extends SupportedHookEvent> = Exclude<keyof HookInputs[TEvent$1], "default">;
185
+ type ExtractExtendedSpecificKeys<TEvent$1 extends SupportedHookEvent> = Exclude<keyof HookInput[TEvent$1], "default">;
319
186
  type BaseHookInputs = { [EventKey in SupportedHookEvent]: v.InferOutput<(typeof HookInputSchemas)[EventKey]> };
320
187
  type ToolSpecificPreToolUseInput = { [K in keyof ToolSchema]: Omit<BaseHookInputs["PreToolUse"], "tool_input" | "tool_name"> & {
321
188
  tool_input: ToolSchema[K]["input"];
@@ -327,6 +194,168 @@ type ToolSpecificPostToolUseInput = { [K in keyof ToolSchema]: Omit<BaseHookInpu
327
194
  tool_response: ToolSchema[K]["response"];
328
195
  } };
329
196
  //#endregion
197
+ //#region src/hooks/output/index.d.ts
198
+ /**
199
+ * @package
200
+ */
201
+ type HookOutput = {
202
+ PreToolUse: PreToolUseHookOutput;
203
+ PostToolUse: PostToolUseHookOutput;
204
+ UserPromptSubmit: UserPromptSubmitHookOutput;
205
+ Stop: StopHookOutput;
206
+ SubagentStart: SubagentStartHookOutput;
207
+ SubagentStop: SubagentStopHookOutput;
208
+ SessionStart: SessionStartHookOutput;
209
+ Notification: CommonHookOutputs;
210
+ PreCompact: CommonHookOutputs;
211
+ SessionEnd: CommonHookOutputs;
212
+ };
213
+ /**
214
+ * @package
215
+ */
216
+ type ExtractHookOutput<TEvent$1 extends SupportedHookEvent> = HookOutput extends Record<SupportedHookEvent, unknown> ? HookOutput[TEvent$1] : never;
217
+ /**
218
+ * Common fields of hook outputs
219
+ *
220
+ * @see {@link https://docs.anthropic.com/en/docs/claude-code/hooks#common-json-fields}
221
+ */
222
+ type CommonHookOutputs = {
223
+ /**
224
+ * Whether Claude should continue after hook execution
225
+ *
226
+ * If `continue` is false, Claude stops processing after the hooks run.
227
+ * @default true
228
+ */
229
+ continue?: boolean;
230
+ /**
231
+ * Accompanies `continue` with a `reason` shown to the user, not shown to Claude.
232
+ *
233
+ * NOT FOR CLAUDE
234
+ */
235
+ stopReason?: string;
236
+ /**
237
+ * If `true`, user cannot see the stdout of this hook.
238
+ *
239
+ * @default false
240
+ */
241
+ suppressOutput?: boolean;
242
+ /**
243
+ * Optional warning message shown to the user
244
+ */
245
+ systemMessage?: string;
246
+ /**
247
+ * Use `hookSpecificOutput` in appropriate hook events instead.
248
+ *
249
+ * @deprecated
250
+ */
251
+ reason?: string;
252
+ /**
253
+ * Use `hookSpecificOutput` in appropriate hook events instead.
254
+ *
255
+ * @deprecated
256
+ */
257
+ decision?: "approve" | "block";
258
+ };
259
+ /**
260
+ * @see {@link https://docs.anthropic.com/en/docs/claude-code/hooks#pretooluse-decision-control}
261
+ */
262
+ interface PreToolUseHookOutput extends CommonHookOutputs {
263
+ hookSpecificOutput?: {
264
+ hookEventName: "PreToolUse";
265
+ /**
266
+ * - `allow` bypasses the permission system. `permissionDecisionReason` is shown to the user but not to Claude.
267
+ * - `deny` prevents the tool call from executing. `permissionDecisionReason` is shown to Claude.
268
+ * - `ask` asks the user to confirm the tool call in the UI. `permissionDecisionReason` is shown to the user but not to Claude.
269
+ */
270
+ permissionDecision?: "allow" | "ask" | "deny";
271
+ permissionDecisionReason?: string;
272
+ updatedInput?: Record<string, unknown>;
273
+ };
274
+ }
275
+ /**
276
+ * @see {@link https://docs.anthropic.com/en/docs/claude-code/hooks#posttooluse-decision-control}
277
+ */
278
+ interface PostToolUseHookOutput extends CommonHookOutputs {
279
+ /**
280
+ * - `approve` has no effect; the tool response is processed normally.
281
+ * - `block` automatically prompts Claude with `reason`.
282
+ */
283
+ decision?: "approve" | "block";
284
+ hookSpecificOutput?: {
285
+ hookEventName: "PostToolUse";
286
+ /**
287
+ * Adds context for Claude to consider.
288
+ */
289
+ additionalContext?: string;
290
+ updatedMCPToolOutput?: unknown;
291
+ };
292
+ reason?: string;
293
+ }
294
+ /**
295
+ * @see {@link https://docs.anthropic.com/en/docs/claude-code/hooks#userpromptsubmit-decision-control}
296
+ */
297
+ interface UserPromptSubmitHookOutput extends CommonHookOutputs {
298
+ /**
299
+ * - `approve` has no effect; the tool response is processed normally.
300
+ * - `block` prevents the prompt from being processed.
301
+ * The submitted prompt is erased from context. `reason` is shown to the user but not added to context.
302
+ */
303
+ decision?: "approve" | "block";
304
+ hookSpecificOutput?: {
305
+ hookEventName: "UserPromptSubmit";
306
+ /**
307
+ * Adds the string to the context if not blocked.
308
+ */
309
+ additionalContext?: string;
310
+ };
311
+ reason?: string;
312
+ }
313
+ /**
314
+ * @see {@link https://docs.anthropic.com/en/docs/claude-code/hooks#stop%2Fsubagentstop-decision-control}
315
+ */
316
+ interface StopHookOutput extends CommonHookOutputs {
317
+ /**
318
+ * - `approve` has no effect; the tool response is processed normally.
319
+ * - `block` prevents Claude from stopping. You must populate `reason` for Claude to know how to proceed.
320
+ */
321
+ decision?: "approve" | "block";
322
+ /**
323
+ * Reason for the decision.
324
+ */
325
+ reason?: string;
326
+ }
327
+ interface SubagentStartHookOutput extends CommonHookOutputs {
328
+ hookSpecificOutput?: {
329
+ hookEventName: "SubagentStart";
330
+ /**
331
+ * Adds the string to the context.
332
+ */
333
+ additionalContext?: string;
334
+ };
335
+ }
336
+ /**
337
+ * @see {@link https://docs.anthropic.com/en/docs/claude-code/hooks#stop%2Fsubagentstop-decision-control}
338
+ */
339
+ interface SubagentStopHookOutput extends CommonHookOutputs {
340
+ /**
341
+ * - `approve` has no effect; the tool response is processed normally.
342
+ * - `block` prevents Claude from stopping. You must populate `reason` for Claude to know how to proceed.
343
+ */
344
+ /**
345
+ * Reason for the decision.
346
+ */
347
+ reason?: string;
348
+ }
349
+ interface SessionStartHookOutput extends CommonHookOutputs {
350
+ hookSpecificOutput?: {
351
+ hookEventName: "SessionStart";
352
+ /**
353
+ * Adds the string to the context.
354
+ */
355
+ additionalContext?: string;
356
+ };
357
+ }
358
+ //#endregion
330
359
  //#region src/types.d.ts
331
360
  type HookTrigger = Partial<{ [TEvent in SupportedHookEvent]: true | Partial<{ [SchemaKey in ExtractExtendedSpecificKeys<TEvent>]?: true }> }>;
332
361
  type ExtractTriggeredHookInput<TTrigger extends HookTrigger> = { [EventKey in keyof TTrigger]: EventKey extends SupportedHookEvent ? TTrigger[EventKey] extends true ? ExtractAllHookInputsForEvent<EventKey> : TTrigger[EventKey] extends Record<PropertyKey, true> ? { [SpecificKey in keyof TTrigger[EventKey]]: SpecificKey extends ExtractExtendedSpecificKeys<EventKey> ? ExtractSpecificHookInputForEvent<EventKey, SpecificKey> : never }[keyof TTrigger[EventKey]] : never : never }[keyof TTrigger];
package/dist/index.mjs CHANGED
@@ -44,12 +44,14 @@ function buildHookInputSchema(hook_event_name, entries) {
44
44
  const HookInputSchemas = {
45
45
  PreToolUse: buildHookInputSchema("PreToolUse", {
46
46
  tool_name: v.pipe(v.string(), v.transform((s) => s)),
47
- tool_input: v.unknown()
47
+ tool_input: v.unknown(),
48
+ tool_use_id: v.string()
48
49
  }),
49
50
  PostToolUse: buildHookInputSchema("PostToolUse", {
50
51
  tool_name: v.pipe(v.string(), v.transform((s) => s)),
51
52
  tool_input: v.unknown(),
52
- tool_response: v.unknown()
53
+ tool_response: v.unknown(),
54
+ tool_use_id: v.string()
53
55
  }),
54
56
  Notification: buildHookInputSchema("Notification", {
55
57
  message: v.string(),
@@ -58,6 +60,10 @@ const HookInputSchemas = {
58
60
  }),
59
61
  UserPromptSubmit: buildHookInputSchema("UserPromptSubmit", { prompt: v.string() }),
60
62
  Stop: buildHookInputSchema("Stop", { stop_hook_active: v.boolean() }),
63
+ SubagentStart: buildHookInputSchema("SubagentStart", {
64
+ agent_id: v.string(),
65
+ agent_type: v.string()
66
+ }),
61
67
  SubagentStop: buildHookInputSchema("SubagentStop", {
62
68
  agent_id: v.string(),
63
69
  agent_transcript_path: v.string(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-hooks-ts",
3
- "version": "2.0.42",
3
+ "version": "2.0.43",
4
4
  "type": "module",
5
5
  "description": "Write claude code hooks with type safety",
6
6
  "sideEffects": false,
@@ -43,32 +43,33 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@arethetypeswrong/core": "0.18.2",
46
- "@biomejs/biome": "2.3.4",
47
- "@types/node": "24.10.0",
46
+ "@biomejs/biome": "2.3.5",
47
+ "@types/node": "24.10.1",
48
48
  "@typescript/native-preview": "^7.0.0-dev.20251108.1",
49
49
  "@virtual-live-lab/eslint-config": "2.3.1",
50
50
  "@virtual-live-lab/tsconfig": "2.1.21",
51
51
  "eslint": "9.39.1",
52
- "eslint-plugin-import-access": "3.0.0",
52
+ "eslint-plugin-import-access": "3.1.0",
53
53
  "pkg-pr-new": "0.0.60",
54
54
  "publint": "0.3.15",
55
55
  "release-it": "19.0.6",
56
56
  "release-it-pnpm": "4.6.6",
57
- "tsdown": "0.16.0",
57
+ "tsdown": "0.16.4",
58
58
  "type-fest": "5.2.0",
59
59
  "typescript": "5.9.3",
60
- "typescript-eslint": "8.46.3",
61
- "unplugin-unused": "0.5.5",
62
- "vitest": "4.0.7"
60
+ "typescript-eslint": "8.46.4",
61
+ "unplugin-unused": "0.5.6",
62
+ "vitest": "4.0.9"
63
63
  },
64
64
  "dependencies": {
65
- "@anthropic-ai/claude-agent-sdk": "0.1.42",
65
+ "@anthropic-ai/claude-agent-sdk": "0.1.43",
66
66
  "valibot": "^1.1.0"
67
67
  },
68
68
  "scripts": {
69
- "lint": "eslint --max-warnings 0 --fix .",
70
- "format": "biome format --write .",
71
- "format:check": "biome format . --reporter=github",
69
+ "check": "pnpm run format:check && pnpm run lint && pnpm run typecheck && pnpm run test && pnpm run build",
70
+ "lint": "eslint --max-warnings 0",
71
+ "format": "biome format --write",
72
+ "format:check": "biome format --reporter=github",
72
73
  "typecheck": "tsgo --noEmit",
73
74
  "test": "vitest --run",
74
75
  "build": "tsdown",