cc-hooks-ts 2.1.81 → 2.1.84

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
@@ -308,6 +308,7 @@ pnpm typecheck
308
308
  - `src/hooks/event.test-d.ts`
309
309
  - `src/hooks/permission.test-d.ts`
310
310
  - Edit `src/index.ts` for changed tool input / output types.
311
+ - YOU SHOULD NOT MODIFY `version` in `package.json` manually.
311
312
 
312
313
  ## License
313
314
 
package/dist/index.d.mts CHANGED
@@ -249,6 +249,21 @@ declare const HookInputSchemas: {
249
249
  team_name: v.StringSchema<undefined>;
250
250
  teammate_name: v.StringSchema<undefined>;
251
251
  }, undefined>;
252
+ readonly TaskCreated: v.ObjectSchema<{
253
+ readonly agent_id: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
254
+ readonly agent_type: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
255
+ readonly cwd: v.StringSchema<undefined>;
256
+ readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
257
+ readonly session_id: v.StringSchema<undefined>;
258
+ readonly transcript_path: v.StringSchema<undefined>;
259
+ readonly hook_event_name: v.LiteralSchema<"TaskCreated", undefined>;
260
+ } & {
261
+ task_description: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
262
+ task_id: v.StringSchema<undefined>;
263
+ task_subject: v.StringSchema<undefined>;
264
+ team_name: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
265
+ teammate_name: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
266
+ }, undefined>;
252
267
  readonly TaskCompleted: v.ObjectSchema<{
253
268
  readonly agent_id: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
254
269
  readonly agent_type: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -345,6 +360,30 @@ declare const HookInputSchemas: {
345
360
  parent_file_path: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
346
361
  trigger_file_path: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
347
362
  }, undefined>;
363
+ readonly CwdChanged: v.ObjectSchema<{
364
+ readonly agent_id: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
365
+ readonly agent_type: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
366
+ readonly cwd: v.StringSchema<undefined>;
367
+ readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
368
+ readonly session_id: v.StringSchema<undefined>;
369
+ readonly transcript_path: v.StringSchema<undefined>;
370
+ readonly hook_event_name: v.LiteralSchema<"CwdChanged", undefined>;
371
+ } & {
372
+ new_cwd: v.StringSchema<undefined>;
373
+ old_cwd: v.StringSchema<undefined>;
374
+ }, undefined>;
375
+ readonly FileChanged: v.ObjectSchema<{
376
+ readonly agent_id: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
377
+ readonly agent_type: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
378
+ readonly cwd: v.StringSchema<undefined>;
379
+ readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
380
+ readonly session_id: v.StringSchema<undefined>;
381
+ readonly transcript_path: v.StringSchema<undefined>;
382
+ readonly hook_event_name: v.LiteralSchema<"FileChanged", undefined>;
383
+ } & {
384
+ event: v.PicklistSchema<["change", "add", "unlink"], undefined>;
385
+ file_path: v.StringSchema<undefined>;
386
+ }, undefined>;
348
387
  };
349
388
  //#endregion
350
389
  //#region src/hooks/event.d.ts
@@ -353,7 +392,7 @@ declare const HookInputSchemas: {
353
392
  *
354
393
  * @package
355
394
  */
356
- type SupportedHookEvent = "PreToolUse" | "PostToolUse" | "PostToolUseFailure" | "Notification" | "UserPromptSubmit" | "SessionStart" | "SessionEnd" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "PreCompact" | "PostCompact" | "PermissionRequest" | "Setup" | "TeammateIdle" | "TaskCompleted" | "ConfigChange" | "WorktreeCreate" | "WorktreeRemove" | "Elicitation" | "ElicitationResult" | "InstructionsLoaded";
395
+ type SupportedHookEvent = "PreToolUse" | "PostToolUse" | "PostToolUseFailure" | "Notification" | "UserPromptSubmit" | "SessionStart" | "SessionEnd" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "PreCompact" | "PostCompact" | "PermissionRequest" | "Setup" | "TeammateIdle" | "TaskCreated" | "TaskCompleted" | "ConfigChange" | "WorktreeCreate" | "WorktreeRemove" | "Elicitation" | "ElicitationResult" | "InstructionsLoaded" | "CwdChanged" | "FileChanged";
357
396
  //#endregion
358
397
  //#region src/hooks/input/types.d.ts
359
398
  /**
@@ -496,14 +535,17 @@ type HookOutput = {
496
535
  Notification: NotificationHookOutput;
497
536
  Elicitation: ElicitationHookOutput;
498
537
  ElicitationResult: ElicitationResultHookOutput;
538
+ CwdChanged: CwdChangedHookOutput;
539
+ FileChanged: FileChangedHookOutput;
499
540
  ConfigChange: CommonHookOutputs;
500
541
  InstructionsLoaded: CommonHookOutputs;
501
542
  PostCompact: CommonHookOutputs;
502
543
  PreCompact: CommonHookOutputs;
503
544
  SessionEnd: CommonHookOutputs;
504
545
  TaskCompleted: CommonHookOutputs;
546
+ TaskCreated: CommonHookOutputs;
505
547
  TeammateIdle: CommonHookOutputs;
506
- WorktreeCreate: CommonHookOutputs;
548
+ WorktreeCreate: WorktreeCreateHookOutput;
507
549
  WorktreeRemove: CommonHookOutputs;
508
550
  };
509
551
  /**
@@ -646,6 +688,12 @@ interface NotificationHookOutput extends CommonHookOutputs {
646
688
  additionalContext?: string;
647
689
  };
648
690
  }
691
+ interface WorktreeCreateHookOutput extends CommonHookOutputs {
692
+ hookSpecificOutput?: {
693
+ hookEventName: "WorktreeCreate";
694
+ worktreePath: string;
695
+ };
696
+ }
649
697
  /**
650
698
  * @see {@link https://docs.anthropic.com/en/docs/claude-code/hooks#stop%2Fsubagentstop-decision-control}
651
699
  */
@@ -690,6 +738,7 @@ interface SessionStartHookOutput extends CommonHookOutputs {
690
738
  */
691
739
  additionalContext?: string;
692
740
  initialUserMessage?: string;
741
+ watchPaths?: string[];
693
742
  };
694
743
  }
695
744
  interface SetupHookOutput extends CommonHookOutputs {
@@ -737,6 +786,18 @@ interface ElicitationResultHookOutput extends CommonHookOutputs {
737
786
  hookEventName: "ElicitationResult";
738
787
  };
739
788
  }
789
+ interface CwdChangedHookOutput extends CommonHookOutputs {
790
+ hookSpecificOutput?: {
791
+ hookEventName: "CwdChanged";
792
+ watchPaths?: string[];
793
+ };
794
+ }
795
+ interface FileChangedHookOutput extends CommonHookOutputs {
796
+ hookSpecificOutput?: {
797
+ hookEventName: "FileChanged";
798
+ watchPaths?: string[];
799
+ };
800
+ }
740
801
  //#endregion
741
802
  //#region src/types.d.ts
742
803
  type HookTrigger = Partial<{ [TEvent in SupportedHookEvent]: true | Partial<{ [SchemaKey in ExtractExtendedSpecificKeys<TEvent>]?: true }> }>;
@@ -1164,6 +1225,13 @@ interface ToolSchema {
1164
1225
  input: ReadMcpResourceInput;
1165
1226
  response: ReadMcpResourceOutput;
1166
1227
  };
1228
+ Skill: {
1229
+ input: {
1230
+ args?: string;
1231
+ skill: string;
1232
+ };
1233
+ response: unknown;
1234
+ };
1167
1235
  SubscribeMcpResource: {
1168
1236
  input: SubscribeMcpResourceInput;
1169
1237
  response: SubscribeMcpResourceOutput;
@@ -1188,6 +1256,16 @@ interface ToolSchema {
1188
1256
  input: TodoWriteInput;
1189
1257
  response: TodoWriteOutput;
1190
1258
  };
1259
+ ToolSearch: {
1260
+ input: {
1261
+ /**
1262
+ * @default 5
1263
+ */
1264
+ max_results?: number;
1265
+ query: string;
1266
+ };
1267
+ response: unknown;
1268
+ };
1191
1269
  UnsubscribeMcpResource: {
1192
1270
  input: UnsubscribeMcpResourceInput;
1193
1271
  response: UnsubscribeMcpResourceOutput;
package/dist/index.mjs CHANGED
@@ -261,6 +261,13 @@ const HookInputSchemas = {
261
261
  team_name: v.string(),
262
262
  teammate_name: v.string()
263
263
  }),
264
+ TaskCreated: buildHookInputSchema("TaskCreated", {
265
+ task_description: v.exactOptional(v.string()),
266
+ task_id: v.string(),
267
+ task_subject: v.string(),
268
+ team_name: v.exactOptional(v.string()),
269
+ teammate_name: v.exactOptional(v.string())
270
+ }),
264
271
  TaskCompleted: buildHookInputSchema("TaskCompleted", {
265
272
  task_description: v.exactOptional(v.string()),
266
273
  task_id: v.string(),
@@ -317,6 +324,18 @@ const HookInputSchemas = {
317
324
  ]),
318
325
  parent_file_path: v.exactOptional(v.string()),
319
326
  trigger_file_path: v.exactOptional(v.string())
327
+ }),
328
+ CwdChanged: buildHookInputSchema("CwdChanged", {
329
+ new_cwd: v.string(),
330
+ old_cwd: v.string()
331
+ }),
332
+ FileChanged: buildHookInputSchema("FileChanged", {
333
+ event: v.picklist([
334
+ "change",
335
+ "add",
336
+ "unlink"
337
+ ]),
338
+ file_path: v.string()
320
339
  })
321
340
  };
322
341
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-hooks-ts",
3
- "version": "2.1.81",
3
+ "version": "2.1.84",
4
4
  "type": "module",
5
5
  "description": "Write claude code hooks with type safety",
6
6
  "sideEffects": false,
@@ -62,7 +62,7 @@
62
62
  "vitest": "4.1.0"
63
63
  },
64
64
  "dependencies": {
65
- "@anthropic-ai/claude-agent-sdk": "0.2.81",
65
+ "@anthropic-ai/claude-agent-sdk": "0.2.84",
66
66
  "get-stdin": "10.0.0",
67
67
  "valibot": "^1.1.0"
68
68
  },