cc-hooks-ts 2.1.86 → 2.1.87
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 +36 -20
- package/dist/index.d.mts +22 -1
- package/dist/index.mjs +6 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -20,6 +20,8 @@ See [examples](./examples) for more usage examples.
|
|
|
20
20
|
- [Documentation](#documentation)
|
|
21
21
|
- [Development](#development)
|
|
22
22
|
- [How to follow the upstream changes](#how-to-follow-the-upstream-changes)
|
|
23
|
+
- [If a Dependabot PR already exists](#if-a-dependabot-pr-already-exists)
|
|
24
|
+
- [If no Dependabot PR exists](#if-no-dependabot-pr-exists)
|
|
23
25
|
- [License](#license)
|
|
24
26
|
- [Contributing](#contributing)
|
|
25
27
|
|
|
@@ -277,38 +279,52 @@ pnpm typecheck
|
|
|
277
279
|
|
|
278
280
|
### How to follow the upstream changes
|
|
279
281
|
|
|
280
|
-
|
|
282
|
+
Dependabot automatically creates PRs to bump `@anthropic-ai/claude-agent-sdk`. The CI bot posts a type diff comment on each PR.
|
|
281
283
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
+
#### If a Dependabot PR already exists
|
|
285
|
+
|
|
286
|
+
1. Find the Dependabot PR that bumps `@anthropic-ai/claude-agent-sdk` and check out its branch.
|
|
287
|
+
|
|
288
|
+
2. Read the type diff posted as a PR comment, then reflect the changes.
|
|
289
|
+
- Edit `src/hooks/` for changed hook input / output types.
|
|
290
|
+
- No need for adding tests in most cases since we are testing the whole type definitions in these files:
|
|
291
|
+
- `src/hooks/input/schemas.test-d.ts`
|
|
292
|
+
- `src/hooks/output/index.test-d.ts`
|
|
293
|
+
- `src/hooks/event.test-d.ts`
|
|
294
|
+
- `src/hooks/permission.test-d.ts`
|
|
295
|
+
- Edit `src/index.ts` for changed tool input / output types.
|
|
296
|
+
- YOU SHOULD NOT MODIFY `version` in `package.json` manually.
|
|
297
|
+
|
|
298
|
+
3. Push to the Dependabot PR branch.
|
|
299
|
+
|
|
300
|
+
4. Update the PR title to:
|
|
301
|
+
|
|
302
|
+
```plaintext
|
|
303
|
+
fix: update to parity with Claude Code v$(npm info @anthropic-ai/claude-agent-sdk claudeCodeVersion)
|
|
284
304
|
```
|
|
285
305
|
|
|
286
|
-
|
|
306
|
+
#### If no Dependabot PR exists
|
|
307
|
+
|
|
308
|
+
1. Create a new branch and bump `@anthropic-ai/claude-agent-sdk` to the latest version:
|
|
287
309
|
|
|
288
310
|
```bash
|
|
289
|
-
|
|
311
|
+
git switch -c bump-claude-agent-sdk
|
|
312
|
+
pnpm add @anthropic-ai/claude-agent-sdk@latest
|
|
290
313
|
```
|
|
291
314
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
3. Get diff of the types.
|
|
315
|
+
2. Get the type diff between the old and new versions:
|
|
295
316
|
|
|
296
317
|
```bash
|
|
297
318
|
npm diff --diff=@anthropic-ai/claude-agent-sdk@<old_version> --diff=@anthropic-ai/claude-agent-sdk@<new_version> '**/*.d.ts'
|
|
298
|
-
|
|
299
|
-
# Only for humans, You can use dandavison/delta for better diff visualization
|
|
300
|
-
npm diff --diff=@anthropic-ai/claude-agent-sdk@<old_version> --diff=@anthropic-ai/claude-agent-sdk@<new_version> '**/*.d.ts' | delta --side-by-side
|
|
301
319
|
```
|
|
302
320
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
- Edit `src/index.ts` for changed tool input / output types.
|
|
311
|
-
- YOU SHOULD NOT MODIFY `version` in `package.json` manually.
|
|
321
|
+
3. Reflect the changes (same as step 2 above).
|
|
322
|
+
|
|
323
|
+
4. Commit, push, and create a PR with the title:
|
|
324
|
+
|
|
325
|
+
```plaintext
|
|
326
|
+
fix: update to parity with Claude Code v$(npm info @anthropic-ai/claude-agent-sdk claudeCodeVersion)
|
|
327
|
+
```
|
|
312
328
|
|
|
313
329
|
## License
|
|
314
330
|
|
package/dist/index.d.mts
CHANGED
|
@@ -226,6 +226,20 @@ declare const HookInputSchemas: {
|
|
|
226
226
|
tool_input: v.UnknownSchema;
|
|
227
227
|
tool_name: v.StringSchema<undefined>;
|
|
228
228
|
}, undefined>;
|
|
229
|
+
readonly PermissionDenied: v.ObjectSchema<{
|
|
230
|
+
readonly agent_id: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
231
|
+
readonly agent_type: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
232
|
+
readonly cwd: v.StringSchema<undefined>;
|
|
233
|
+
readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
234
|
+
readonly session_id: v.StringSchema<undefined>;
|
|
235
|
+
readonly transcript_path: v.StringSchema<undefined>;
|
|
236
|
+
readonly hook_event_name: v.LiteralSchema<"PermissionDenied", undefined>;
|
|
237
|
+
} & {
|
|
238
|
+
reason: v.StringSchema<undefined>;
|
|
239
|
+
tool_input: v.UnknownSchema;
|
|
240
|
+
tool_name: v.StringSchema<undefined>;
|
|
241
|
+
tool_use_id: v.StringSchema<undefined>;
|
|
242
|
+
}, undefined>;
|
|
229
243
|
readonly Setup: v.ObjectSchema<{
|
|
230
244
|
readonly agent_id: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
231
245
|
readonly agent_type: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -392,7 +406,7 @@ declare const HookInputSchemas: {
|
|
|
392
406
|
*
|
|
393
407
|
* @package
|
|
394
408
|
*/
|
|
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";
|
|
409
|
+
type SupportedHookEvent = "PreToolUse" | "PostToolUse" | "PostToolUseFailure" | "Notification" | "UserPromptSubmit" | "SessionStart" | "SessionEnd" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "PreCompact" | "PostCompact" | "PermissionRequest" | "PermissionDenied" | "Setup" | "TeammateIdle" | "TaskCreated" | "TaskCompleted" | "ConfigChange" | "WorktreeCreate" | "WorktreeRemove" | "Elicitation" | "ElicitationResult" | "InstructionsLoaded" | "CwdChanged" | "FileChanged";
|
|
396
410
|
//#endregion
|
|
397
411
|
//#region src/hooks/input/types.d.ts
|
|
398
412
|
/**
|
|
@@ -530,6 +544,7 @@ type HookOutput = {
|
|
|
530
544
|
SubagentStart: SubagentStartHookOutput;
|
|
531
545
|
SubagentStop: SubagentStopHookOutput;
|
|
532
546
|
SessionStart: SessionStartHookOutput;
|
|
547
|
+
PermissionDenied: PermissionDeniedHookOutput;
|
|
533
548
|
PermissionRequest: PermissionRequestHookOutput;
|
|
534
549
|
Setup: SetupHookOutput;
|
|
535
550
|
Notification: NotificationHookOutput;
|
|
@@ -772,6 +787,12 @@ interface PermissionRequestHookOutput extends CommonHookOutputs {
|
|
|
772
787
|
};
|
|
773
788
|
};
|
|
774
789
|
}
|
|
790
|
+
interface PermissionDeniedHookOutput extends CommonHookOutputs {
|
|
791
|
+
hookSpecificOutput?: {
|
|
792
|
+
hookEventName: "PermissionDenied";
|
|
793
|
+
retry?: boolean;
|
|
794
|
+
};
|
|
795
|
+
}
|
|
775
796
|
interface ElicitationHookOutput extends CommonHookOutputs {
|
|
776
797
|
hookSpecificOutput?: {
|
|
777
798
|
action?: "accept" | "decline" | "cancel";
|
package/dist/index.mjs
CHANGED
|
@@ -256,6 +256,12 @@ const HookInputSchemas = {
|
|
|
256
256
|
tool_input: v.unknown(),
|
|
257
257
|
tool_name: v.string()
|
|
258
258
|
}),
|
|
259
|
+
PermissionDenied: buildHookInputSchema("PermissionDenied", {
|
|
260
|
+
reason: v.string(),
|
|
261
|
+
tool_input: v.unknown(),
|
|
262
|
+
tool_name: v.string(),
|
|
263
|
+
tool_use_id: v.string()
|
|
264
|
+
}),
|
|
259
265
|
Setup: buildHookInputSchema("Setup", { trigger: v.picklist(["init", "maintenance"]) }),
|
|
260
266
|
TeammateIdle: buildHookInputSchema("TeammateIdle", {
|
|
261
267
|
team_name: v.string(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc-hooks-ts",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.87",
|
|
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.2"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@anthropic-ai/claude-agent-sdk": "0.2.
|
|
65
|
+
"@anthropic-ai/claude-agent-sdk": "0.2.88",
|
|
66
66
|
"get-stdin": "10.0.0",
|
|
67
67
|
"valibot": "^1.1.0"
|
|
68
68
|
},
|