cc-hooks-ts 2.1.11 → 2.1.19
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 +19 -0
- package/dist/index.d.mts +19 -10
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -98,6 +98,25 @@ 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
|
+
|
|
101
120
|
## Tool Specific Hooks
|
|
102
121
|
|
|
103
122
|
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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
import { AgentInput, BashInput, ExitPlanModeInput, FileEditInput, FileReadInput, FileWriteInput, GlobInput, GrepInput,
|
|
2
|
+
import { AgentInput, BashInput, ExitPlanModeInput, FileEditInput, FileReadInput, FileWriteInput, GlobInput, GrepInput, ListMcpResourcesInput, NotebookEditInput, ReadMcpResourceInput, TaskOutputInput, TaskStopInput, TodoWriteInput, WebFetchInput, WebSearchInput } from "@anthropic-ai/claude-agent-sdk/sdk-tools";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/types.d.ts
|
|
5
5
|
type Awaitable<T> = Promise<T> | T;
|
|
@@ -329,7 +329,7 @@ type HookOutput = {
|
|
|
329
329
|
SessionStart: SessionStartHookOutput;
|
|
330
330
|
PermissionRequest: PermissionRequestHookOutput;
|
|
331
331
|
Setup: SetupHookOutput;
|
|
332
|
-
Notification:
|
|
332
|
+
Notification: NotificationHookOutput;
|
|
333
333
|
PreCompact: CommonHookOutputs;
|
|
334
334
|
SessionEnd: CommonHookOutputs;
|
|
335
335
|
};
|
|
@@ -464,6 +464,15 @@ interface UserPromptSubmitHookOutput extends CommonHookOutputs {
|
|
|
464
464
|
};
|
|
465
465
|
reason?: string;
|
|
466
466
|
}
|
|
467
|
+
interface NotificationHookOutput extends CommonHookOutputs {
|
|
468
|
+
hookSpecificOutput?: {
|
|
469
|
+
hookEventName: "Notification";
|
|
470
|
+
/**
|
|
471
|
+
* Adds the string to the context.
|
|
472
|
+
*/
|
|
473
|
+
additionalContext?: string;
|
|
474
|
+
};
|
|
475
|
+
}
|
|
467
476
|
/**
|
|
468
477
|
* @see {@link https://docs.anthropic.com/en/docs/claude-code/hooks#stop%2Fsubagentstop-decision-control}
|
|
469
478
|
*/
|
|
@@ -920,10 +929,6 @@ interface ToolSchema {
|
|
|
920
929
|
stdout: string;
|
|
921
930
|
};
|
|
922
931
|
};
|
|
923
|
-
BashOutput: {
|
|
924
|
-
input: TaskOutputInput;
|
|
925
|
-
response: unknown;
|
|
926
|
-
};
|
|
927
932
|
Edit: {
|
|
928
933
|
input: FileEditInput;
|
|
929
934
|
response: {
|
|
@@ -964,10 +969,6 @@ interface ToolSchema {
|
|
|
964
969
|
numLines: number;
|
|
965
970
|
};
|
|
966
971
|
};
|
|
967
|
-
KillBash: {
|
|
968
|
-
input: KillShellInput;
|
|
969
|
-
response: unknown;
|
|
970
|
-
};
|
|
971
972
|
ListMcpResources: {
|
|
972
973
|
input: ListMcpResourcesInput;
|
|
973
974
|
response: unknown;
|
|
@@ -1036,6 +1037,14 @@ interface ToolSchema {
|
|
|
1036
1037
|
};
|
|
1037
1038
|
};
|
|
1038
1039
|
};
|
|
1040
|
+
TaskOutput: {
|
|
1041
|
+
input: TaskOutputInput;
|
|
1042
|
+
response: unknown;
|
|
1043
|
+
};
|
|
1044
|
+
TaskStop: {
|
|
1045
|
+
input: TaskStopInput;
|
|
1046
|
+
response: unknown;
|
|
1047
|
+
};
|
|
1039
1048
|
TodoWrite: {
|
|
1040
1049
|
input: TodoWriteInput;
|
|
1041
1050
|
response: unknown;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc-hooks-ts",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.19",
|
|
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.
|
|
46
|
+
"@types/node": "25.0.9",
|
|
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.
|
|
52
|
+
"oxfmt": "0.26.0",
|
|
53
53
|
"pkg-pr-new": "0.0.62",
|
|
54
54
|
"publint": "0.3.16",
|
|
55
|
-
"release-it": "19.2.
|
|
55
|
+
"release-it": "19.2.4",
|
|
56
56
|
"release-it-pnpm": "4.6.6",
|
|
57
57
|
"tsdown": "0.19.0",
|
|
58
|
-
"type-fest": "5.4.
|
|
58
|
+
"type-fest": "5.4.1",
|
|
59
59
|
"typescript": "5.9.3",
|
|
60
|
-
"typescript-eslint": "8.53.
|
|
60
|
+
"typescript-eslint": "8.53.1",
|
|
61
61
|
"unplugin-unused": "0.5.6",
|
|
62
62
|
"vitest": "4.0.17"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@anthropic-ai/claude-agent-sdk": "0.2.
|
|
65
|
+
"@anthropic-ai/claude-agent-sdk": "0.2.19",
|
|
66
66
|
"valibot": "^1.1.0"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|