cc-hooks-ts 2.1.27 → 2.1.47

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
@@ -98,25 +98,6 @@ Then, load defined hooks in your Claude Code settings at `~/.claude/settings.jso
98
98
  }
99
99
  ```
100
100
 
101
- If you are using native install, you can run hooks with Bun via `BUN_BE_BUN=1 claude`.
102
-
103
- ```json
104
- {
105
- "hooks": {
106
- "SessionStart": [
107
- {
108
- "hooks": [
109
- {
110
- "type": "command",
111
- "command": "BUN_BE_BUN=1 claude run -i --silent path/to/your/sessionHook.ts"
112
- }
113
- ]
114
- }
115
- ]
116
- }
117
- }
118
- ```
119
-
120
101
  ## Tool Specific Hooks
121
102
 
122
103
  In `PreToolUse`, `PostToolUse`, and `PostToolUseFailure` events, you can define hooks specific to tools by specifying tool names in the trigger configuration.
package/dist/index.d.mts CHANGED
@@ -73,6 +73,7 @@ declare const HookInputSchemas: {
73
73
  readonly transcript_path: v.StringSchema<undefined>;
74
74
  readonly hook_event_name: v.LiteralSchema<"Stop", undefined>;
75
75
  } & {
76
+ last_assistant_message: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
76
77
  stop_hook_active: v.BooleanSchema<undefined>;
77
78
  }, undefined>;
78
79
  readonly SubagentStart: v.ObjectSchema<{
@@ -95,6 +96,7 @@ declare const HookInputSchemas: {
95
96
  agent_id: v.StringSchema<undefined>;
96
97
  agent_transcript_path: v.StringSchema<undefined>;
97
98
  agent_type: v.StringSchema<undefined>;
99
+ last_assistant_message: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
98
100
  stop_hook_active: v.BooleanSchema<undefined>;
99
101
  }, undefined>;
100
102
  readonly PreCompact: v.ObjectSchema<{
@@ -160,7 +162,7 @@ declare const HookInputSchemas: {
160
162
  readonly type: v.LiteralSchema<"removeRules", undefined>;
161
163
  }, undefined>, v.ObjectSchema<{
162
164
  readonly destination: v.PicklistSchema<["userSettings", "projectSettings", "localSettings", "session", "cliArg"], undefined>;
163
- readonly mode: v.PicklistSchema<["acceptEdits", "bypassPermissions", "default", "dontAsk", "delegate", "plan"], undefined>;
165
+ readonly mode: v.PicklistSchema<["acceptEdits", "bypassPermissions", "default", "dontAsk", "plan"], undefined>;
164
166
  readonly type: v.LiteralSchema<"setMode", undefined>;
165
167
  }, undefined>, v.ObjectSchema<{
166
168
  readonly destination: v.PicklistSchema<["userSettings", "projectSettings", "localSettings", "session", "cliArg"], undefined>;
@@ -183,6 +185,29 @@ declare const HookInputSchemas: {
183
185
  } & {
184
186
  trigger: v.PicklistSchema<["init", "maintenance"], undefined>;
185
187
  }, undefined>;
188
+ readonly TeammateIdle: v.ObjectSchema<{
189
+ readonly cwd: v.StringSchema<undefined>;
190
+ readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
191
+ readonly session_id: v.StringSchema<undefined>;
192
+ readonly transcript_path: v.StringSchema<undefined>;
193
+ readonly hook_event_name: v.LiteralSchema<"TeammateIdle", undefined>;
194
+ } & {
195
+ team_name: v.StringSchema<undefined>;
196
+ teammate_name: v.StringSchema<undefined>;
197
+ }, undefined>;
198
+ readonly TaskCompleted: v.ObjectSchema<{
199
+ readonly cwd: v.StringSchema<undefined>;
200
+ readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
201
+ readonly session_id: v.StringSchema<undefined>;
202
+ readonly transcript_path: v.StringSchema<undefined>;
203
+ readonly hook_event_name: v.LiteralSchema<"TaskCompleted", undefined>;
204
+ } & {
205
+ task_description: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
206
+ task_id: v.StringSchema<undefined>;
207
+ task_subject: v.StringSchema<undefined>;
208
+ team_name: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
209
+ teammate_name: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
210
+ }, undefined>;
186
211
  };
187
212
  //#endregion
188
213
  //#region src/hooks/event.d.ts
@@ -191,7 +216,7 @@ declare const HookInputSchemas: {
191
216
  *
192
217
  * @package
193
218
  */
194
- type SupportedHookEvent = "PreToolUse" | "PostToolUse" | "PostToolUseFailure" | "Notification" | "UserPromptSubmit" | "SessionStart" | "SessionEnd" | "Stop" | "SubagentStart" | "SubagentStop" | "PreCompact" | "PermissionRequest" | "Setup";
219
+ type SupportedHookEvent = "PreToolUse" | "PostToolUse" | "PostToolUseFailure" | "Notification" | "UserPromptSubmit" | "SessionStart" | "SessionEnd" | "Stop" | "SubagentStart" | "SubagentStop" | "PreCompact" | "PermissionRequest" | "Setup" | "TeammateIdle" | "TaskCompleted";
195
220
  //#endregion
196
221
  //#region src/hooks/input/types.d.ts
197
222
  /**
@@ -302,7 +327,7 @@ declare const permissionUpdateSchema: v.VariantSchema<"type", [v.ObjectSchema<{
302
327
  readonly type: v.LiteralSchema<"removeRules", undefined>;
303
328
  }, undefined>, v.ObjectSchema<{
304
329
  readonly destination: v.PicklistSchema<["userSettings", "projectSettings", "localSettings", "session", "cliArg"], undefined>;
305
- readonly mode: v.PicklistSchema<["acceptEdits", "bypassPermissions", "default", "dontAsk", "delegate", "plan"], undefined>;
330
+ readonly mode: v.PicklistSchema<["acceptEdits", "bypassPermissions", "default", "dontAsk", "plan"], undefined>;
306
331
  readonly type: v.LiteralSchema<"setMode", undefined>;
307
332
  }, undefined>, v.ObjectSchema<{
308
333
  readonly destination: v.PicklistSchema<["userSettings", "projectSettings", "localSettings", "session", "cliArg"], undefined>;
@@ -333,6 +358,8 @@ type HookOutput = {
333
358
  Notification: NotificationHookOutput;
334
359
  PreCompact: CommonHookOutputs;
335
360
  SessionEnd: CommonHookOutputs;
361
+ TaskCompleted: CommonHookOutputs;
362
+ TeammateIdle: CommonHookOutputs;
336
363
  };
337
364
  /**
338
365
  * @package
package/dist/index.mjs CHANGED
@@ -75,7 +75,6 @@ const permissionUpdateSchema = v.variant("type", [
75
75
  "bypassPermissions",
76
76
  "default",
77
77
  "dontAsk",
78
- "delegate",
79
78
  "plan"
80
79
  ]),
81
80
  type: v.literal("setMode")
@@ -129,7 +128,10 @@ const HookInputSchemas = {
129
128
  title: v.exactOptional(v.string())
130
129
  }),
131
130
  UserPromptSubmit: buildHookInputSchema("UserPromptSubmit", { prompt: v.string() }),
132
- Stop: buildHookInputSchema("Stop", { stop_hook_active: v.boolean() }),
131
+ Stop: buildHookInputSchema("Stop", {
132
+ last_assistant_message: v.exactOptional(v.string()),
133
+ stop_hook_active: v.boolean()
134
+ }),
133
135
  SubagentStart: buildHookInputSchema("SubagentStart", {
134
136
  agent_id: v.string(),
135
137
  agent_type: v.string()
@@ -138,6 +140,7 @@ const HookInputSchemas = {
138
140
  agent_id: v.string(),
139
141
  agent_transcript_path: v.string(),
140
142
  agent_type: v.string(),
143
+ last_assistant_message: v.exactOptional(v.string()),
141
144
  stop_hook_active: v.boolean()
142
145
  }),
143
146
  PreCompact: buildHookInputSchema("PreCompact", {
@@ -166,7 +169,18 @@ const HookInputSchemas = {
166
169
  tool_input: v.unknown(),
167
170
  tool_name: v.string()
168
171
  }),
169
- Setup: buildHookInputSchema("Setup", { trigger: v.picklist(["init", "maintenance"]) })
172
+ Setup: buildHookInputSchema("Setup", { trigger: v.picklist(["init", "maintenance"]) }),
173
+ TeammateIdle: buildHookInputSchema("TeammateIdle", {
174
+ team_name: v.string(),
175
+ teammate_name: v.string()
176
+ }),
177
+ TaskCompleted: buildHookInputSchema("TaskCompleted", {
178
+ task_description: v.exactOptional(v.string()),
179
+ task_id: v.string(),
180
+ task_subject: v.string(),
181
+ team_name: v.exactOptional(v.string()),
182
+ teammate_name: v.exactOptional(v.string())
183
+ })
170
184
  };
171
185
  function isNonEmptyString(value) {
172
186
  return typeof value === "string" && value.length > 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-hooks-ts",
3
- "version": "2.1.27",
3
+ "version": "2.1.47",
4
4
  "type": "module",
5
5
  "description": "Write claude code hooks with type safety",
6
6
  "sideEffects": false,
@@ -43,26 +43,26 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@arethetypeswrong/core": "0.18.2",
46
- "@types/node": "25.0.10",
46
+ "@types/node": "25.2.1",
47
47
  "@typescript/native-preview": "^7.0.0-dev.20251108.1",
48
48
  "@virtual-live-lab/eslint-config": "2.3.1",
49
49
  "@virtual-live-lab/tsconfig": "2.1.21",
50
50
  "eslint": "9.39.2",
51
51
  "eslint-plugin-import-access": "3.1.0",
52
- "oxfmt": "0.27.0",
53
- "pkg-pr-new": "0.0.62",
52
+ "oxfmt": "0.28.0",
53
+ "pkg-pr-new": "0.0.63",
54
54
  "publint": "0.3.17",
55
55
  "release-it": "19.2.4",
56
56
  "release-it-pnpm": "4.6.6",
57
- "tsdown": "0.20.1",
58
- "type-fest": "5.4.2",
57
+ "tsdown": "0.20.3",
58
+ "type-fest": "5.4.3",
59
59
  "typescript": "5.9.3",
60
60
  "typescript-eslint": "8.54.0",
61
61
  "unplugin-unused": "0.5.7",
62
62
  "vitest": "4.0.18"
63
63
  },
64
64
  "dependencies": {
65
- "@anthropic-ai/claude-agent-sdk": "0.2.27",
65
+ "@anthropic-ai/claude-agent-sdk": "0.2.47",
66
66
  "valibot": "^1.1.0"
67
67
  },
68
68
  "scripts": {