cc-hooks-ts 0.1.0 → 0.1.3
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/dist/index.d.mts +15 -11
- package/package.json +4 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
import { BashInput, FileEditInput, FileReadInput, FileWriteInput, GlobInput, GrepInput, NotebookEditInput, TodoWriteInput, WebFetchInput, WebSearchInput } from "@anthropic-ai/claude-code/sdk-tools.js";
|
|
2
|
+
import { BashInput, ExitPlanModeInput, FileEditInput, FileReadInput, FileWriteInput, GlobInput, GrepInput, NotebookEditInput, TodoWriteInput, WebFetchInput, WebSearchInput } from "@anthropic-ai/claude-code/sdk-tools.js";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/types.d.ts
|
|
5
5
|
type Awaitable<T> = Promise<T> | T;
|
|
@@ -162,88 +162,88 @@ interface SessionStartHookOutput extends CommonHookOutputs {
|
|
|
162
162
|
*/
|
|
163
163
|
declare const HookInputSchemas: {
|
|
164
164
|
readonly PreToolUse: v.ObjectSchema<{
|
|
165
|
-
readonly hook_event_name: v.LiteralSchema<"PreToolUse", undefined>;
|
|
166
165
|
readonly cwd: v.StringSchema<undefined>;
|
|
167
166
|
readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
168
167
|
readonly session_id: v.StringSchema<undefined>;
|
|
169
168
|
readonly transcript_path: v.StringSchema<undefined>;
|
|
169
|
+
readonly hook_event_name: v.LiteralSchema<"PreToolUse", undefined>;
|
|
170
170
|
} & {
|
|
171
171
|
tool_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, AutoComplete<string>>]>;
|
|
172
172
|
tool_input: v.UnknownSchema;
|
|
173
173
|
}, undefined>;
|
|
174
174
|
readonly PostToolUse: v.ObjectSchema<{
|
|
175
|
-
readonly hook_event_name: v.LiteralSchema<"PostToolUse", undefined>;
|
|
176
175
|
readonly cwd: v.StringSchema<undefined>;
|
|
177
176
|
readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
178
177
|
readonly session_id: v.StringSchema<undefined>;
|
|
179
178
|
readonly transcript_path: v.StringSchema<undefined>;
|
|
179
|
+
readonly hook_event_name: v.LiteralSchema<"PostToolUse", undefined>;
|
|
180
180
|
} & {
|
|
181
181
|
tool_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, AutoComplete<string>>]>;
|
|
182
182
|
tool_input: v.UnknownSchema;
|
|
183
183
|
tool_response: v.UnknownSchema;
|
|
184
184
|
}, undefined>;
|
|
185
185
|
readonly Notification: v.ObjectSchema<{
|
|
186
|
-
readonly hook_event_name: v.LiteralSchema<"Notification", undefined>;
|
|
187
186
|
readonly cwd: v.StringSchema<undefined>;
|
|
188
187
|
readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
189
188
|
readonly session_id: v.StringSchema<undefined>;
|
|
190
189
|
readonly transcript_path: v.StringSchema<undefined>;
|
|
190
|
+
readonly hook_event_name: v.LiteralSchema<"Notification", undefined>;
|
|
191
191
|
} & {
|
|
192
192
|
message: v.StringSchema<undefined>;
|
|
193
193
|
title: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
194
194
|
}, undefined>;
|
|
195
195
|
readonly UserPromptSubmit: v.ObjectSchema<{
|
|
196
|
-
readonly hook_event_name: v.LiteralSchema<"UserPromptSubmit", undefined>;
|
|
197
196
|
readonly cwd: v.StringSchema<undefined>;
|
|
198
197
|
readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
199
198
|
readonly session_id: v.StringSchema<undefined>;
|
|
200
199
|
readonly transcript_path: v.StringSchema<undefined>;
|
|
200
|
+
readonly hook_event_name: v.LiteralSchema<"UserPromptSubmit", undefined>;
|
|
201
201
|
} & {
|
|
202
202
|
prompt: v.StringSchema<undefined>;
|
|
203
203
|
}, undefined>;
|
|
204
204
|
readonly Stop: v.ObjectSchema<{
|
|
205
|
-
readonly hook_event_name: v.LiteralSchema<"Stop", undefined>;
|
|
206
205
|
readonly cwd: v.StringSchema<undefined>;
|
|
207
206
|
readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
208
207
|
readonly session_id: v.StringSchema<undefined>;
|
|
209
208
|
readonly transcript_path: v.StringSchema<undefined>;
|
|
209
|
+
readonly hook_event_name: v.LiteralSchema<"Stop", undefined>;
|
|
210
210
|
} & {
|
|
211
211
|
stop_hook_active: v.BooleanSchema<undefined>;
|
|
212
212
|
}, undefined>;
|
|
213
213
|
readonly SubagentStop: v.ObjectSchema<{
|
|
214
|
-
readonly hook_event_name: v.LiteralSchema<"SubagentStop", undefined>;
|
|
215
214
|
readonly cwd: v.StringSchema<undefined>;
|
|
216
215
|
readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
217
216
|
readonly session_id: v.StringSchema<undefined>;
|
|
218
217
|
readonly transcript_path: v.StringSchema<undefined>;
|
|
218
|
+
readonly hook_event_name: v.LiteralSchema<"SubagentStop", undefined>;
|
|
219
219
|
} & {
|
|
220
220
|
stop_hook_active: v.BooleanSchema<undefined>;
|
|
221
221
|
}, undefined>;
|
|
222
222
|
readonly PreCompact: v.ObjectSchema<{
|
|
223
|
-
readonly hook_event_name: v.LiteralSchema<"PreCompact", undefined>;
|
|
224
223
|
readonly cwd: v.StringSchema<undefined>;
|
|
225
224
|
readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
226
225
|
readonly session_id: v.StringSchema<undefined>;
|
|
227
226
|
readonly transcript_path: v.StringSchema<undefined>;
|
|
227
|
+
readonly hook_event_name: v.LiteralSchema<"PreCompact", undefined>;
|
|
228
228
|
} & {
|
|
229
229
|
custom_instructions: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
230
230
|
trigger: v.UnionSchema<[v.LiteralSchema<"manual", undefined>, v.LiteralSchema<"auto", undefined>], undefined>;
|
|
231
231
|
}, undefined>;
|
|
232
232
|
readonly SessionStart: v.ObjectSchema<{
|
|
233
|
-
readonly hook_event_name: v.LiteralSchema<"SessionStart", undefined>;
|
|
234
233
|
readonly cwd: v.StringSchema<undefined>;
|
|
235
234
|
readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
236
235
|
readonly session_id: v.StringSchema<undefined>;
|
|
237
236
|
readonly transcript_path: v.StringSchema<undefined>;
|
|
237
|
+
readonly hook_event_name: v.LiteralSchema<"SessionStart", undefined>;
|
|
238
238
|
} & {
|
|
239
239
|
source: v.UnionSchema<[v.LiteralSchema<"startup", undefined>, v.LiteralSchema<"resume", undefined>, v.LiteralSchema<"clear", undefined>, v.LiteralSchema<"compact", undefined>], undefined>;
|
|
240
240
|
}, undefined>;
|
|
241
241
|
readonly SessionEnd: v.ObjectSchema<{
|
|
242
|
-
readonly hook_event_name: v.LiteralSchema<"SessionEnd", undefined>;
|
|
243
242
|
readonly cwd: v.StringSchema<undefined>;
|
|
244
243
|
readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
245
244
|
readonly session_id: v.StringSchema<undefined>;
|
|
246
245
|
readonly transcript_path: v.StringSchema<undefined>;
|
|
246
|
+
readonly hook_event_name: v.LiteralSchema<"SessionEnd", undefined>;
|
|
247
247
|
} & {
|
|
248
248
|
reason: v.StringSchema<undefined>;
|
|
249
249
|
}, undefined>;
|
|
@@ -306,7 +306,7 @@ type ExtractAllHookInputsForEvent<TEvent$1 extends SupportedHookEvent> = { [K in
|
|
|
306
306
|
* ```
|
|
307
307
|
* @package
|
|
308
308
|
*/
|
|
309
|
-
type ExtractSpecificHookInputForEvent<TEvent$1 extends SupportedHookEvent, TSpecificKey extends ExtractExtendedSpecificKeys<TEvent$1>> =
|
|
309
|
+
type ExtractSpecificHookInputForEvent<TEvent$1 extends SupportedHookEvent, TSpecificKey extends ExtractExtendedSpecificKeys<TEvent$1>> = TSpecificKey extends keyof HookInputs[TEvent$1] ? HookInputs[TEvent$1][TSpecificKey] : never;
|
|
310
310
|
/**
|
|
311
311
|
* @package
|
|
312
312
|
*/
|
|
@@ -588,6 +588,10 @@ interface ToolSchema {
|
|
|
588
588
|
userModified: boolean;
|
|
589
589
|
};
|
|
590
590
|
};
|
|
591
|
+
ExitPlanMode: {
|
|
592
|
+
input: ExitPlanModeInput;
|
|
593
|
+
response: unknown;
|
|
594
|
+
};
|
|
591
595
|
Glob: {
|
|
592
596
|
input: GlobInput;
|
|
593
597
|
response: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc-hooks-ts",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Write claude code hooks with type safety",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@anthropic-ai/claude-code": "2.0.0",
|
|
46
45
|
"@arethetypeswrong/core": "0.18.2",
|
|
47
46
|
"@biomejs/biome": "2.3.4",
|
|
48
47
|
"@types/node": "24.10.0",
|
|
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",
|
|
@@ -62,13 +62,14 @@
|
|
|
62
62
|
"vitest": "4.0.7"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
+
"@anthropic-ai/claude-code": "2.0.0",
|
|
65
66
|
"valibot": "^1.1.0"
|
|
66
67
|
},
|
|
67
68
|
"scripts": {
|
|
68
69
|
"lint": "eslint --max-warnings 0 --fix .",
|
|
69
70
|
"format": "biome format --write .",
|
|
70
71
|
"format:check": "biome format . --reporter=github",
|
|
71
|
-
"typecheck": "
|
|
72
|
+
"typecheck": "tsgo --noEmit",
|
|
72
73
|
"test": "vitest --run",
|
|
73
74
|
"build": "tsdown",
|
|
74
75
|
"pkg-pr-new": "pkg-pr-new publish --compact --comment=update --pnpm"
|