@goodfoot/claude-code-hooks 1.0.1
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/LICENSE +21 -0
- package/README.md +317 -0
- package/dist/cli.js +914 -0
- package/dist/constants.js +21 -0
- package/dist/env.js +188 -0
- package/dist/hooks.js +391 -0
- package/dist/index.js +77 -0
- package/dist/inputs.js +35 -0
- package/dist/logger.js +494 -0
- package/dist/outputs.js +282 -0
- package/dist/runtime.js +222 -0
- package/dist/scaffold.js +466 -0
- package/dist/tool-helpers.js +366 -0
- package/dist/tool-inputs.js +21 -0
- package/package.json +68 -0
- package/types/cli.d.ts +281 -0
- package/types/constants.d.ts +9 -0
- package/types/env.d.ts +150 -0
- package/types/hooks.d.ts +851 -0
- package/types/index.d.ts +137 -0
- package/types/inputs.d.ts +601 -0
- package/types/logger.d.ts +471 -0
- package/types/outputs.d.ts +643 -0
- package/types/runtime.d.ts +75 -0
- package/types/scaffold.d.ts +46 -0
- package/types/tool-helpers.d.ts +336 -0
- package/types/tool-inputs.d.ts +228 -0
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type-safe Claude Code hooks library.
|
|
3
|
+
*
|
|
4
|
+
* Provides typed input/output handling, output builders, and logging system
|
|
5
|
+
* for building Claude Code hooks with full type safety.
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
export type {
|
|
9
|
+
BaseHookInput,
|
|
10
|
+
PreToolUseInput,
|
|
11
|
+
PostToolUseInput,
|
|
12
|
+
PostToolUseFailureInput,
|
|
13
|
+
NotificationInput,
|
|
14
|
+
UserPromptSubmitInput,
|
|
15
|
+
SessionStartInput,
|
|
16
|
+
SessionEndInput,
|
|
17
|
+
StopInput,
|
|
18
|
+
SubagentStartInput,
|
|
19
|
+
SubagentStopInput,
|
|
20
|
+
PreCompactInput,
|
|
21
|
+
PermissionRequestInput,
|
|
22
|
+
HookInput,
|
|
23
|
+
HookEventName,
|
|
24
|
+
PermissionMode,
|
|
25
|
+
SessionStartSource,
|
|
26
|
+
SessionEndReason,
|
|
27
|
+
PreCompactTrigger,
|
|
28
|
+
PermissionUpdate
|
|
29
|
+
} from './inputs.js';
|
|
30
|
+
export { HOOK_EVENT_NAMES } from './inputs.js';
|
|
31
|
+
export type {
|
|
32
|
+
HookOutput,
|
|
33
|
+
SyncHookJSONOutput,
|
|
34
|
+
ExitCode,
|
|
35
|
+
HookSpecificOutput,
|
|
36
|
+
PreToolUseHookSpecificOutput,
|
|
37
|
+
PostToolUseHookSpecificOutput,
|
|
38
|
+
PostToolUseFailureHookSpecificOutput,
|
|
39
|
+
UserPromptSubmitHookSpecificOutput,
|
|
40
|
+
SessionStartHookSpecificOutput,
|
|
41
|
+
SubagentStartHookSpecificOutput,
|
|
42
|
+
PermissionRequestHookSpecificOutput,
|
|
43
|
+
PermissionRequestDecision,
|
|
44
|
+
PermissionRequestAllowDecision,
|
|
45
|
+
PermissionRequestDenyDecision,
|
|
46
|
+
CommonOptions,
|
|
47
|
+
/** @deprecated Use CommonOptions instead */
|
|
48
|
+
BaseOptions,
|
|
49
|
+
PreToolUseOptions,
|
|
50
|
+
PostToolUseOptions,
|
|
51
|
+
PostToolUseFailureOptions,
|
|
52
|
+
UserPromptSubmitOptions,
|
|
53
|
+
SessionStartOptions,
|
|
54
|
+
SessionEndOptions,
|
|
55
|
+
StopOptions,
|
|
56
|
+
SubagentStartOptions,
|
|
57
|
+
SubagentStopOptions,
|
|
58
|
+
NotificationOptions,
|
|
59
|
+
PreCompactOptions,
|
|
60
|
+
PermissionRequestOptions
|
|
61
|
+
} from './outputs.js';
|
|
62
|
+
export {
|
|
63
|
+
EXIT_CODES,
|
|
64
|
+
preToolUseOutput,
|
|
65
|
+
postToolUseOutput,
|
|
66
|
+
postToolUseFailureOutput,
|
|
67
|
+
userPromptSubmitOutput,
|
|
68
|
+
sessionStartOutput,
|
|
69
|
+
sessionEndOutput,
|
|
70
|
+
stopOutput,
|
|
71
|
+
subagentStartOutput,
|
|
72
|
+
subagentStopOutput,
|
|
73
|
+
notificationOutput,
|
|
74
|
+
preCompactOutput,
|
|
75
|
+
permissionRequestOutput
|
|
76
|
+
} from './outputs.js';
|
|
77
|
+
export type { LogLevel, LogEvent, LogEventError, LogEventHandler, Unsubscribe, LoggerConfig } from './logger.js';
|
|
78
|
+
export { LOG_LEVELS, Logger, logger } from './logger.js';
|
|
79
|
+
export type {
|
|
80
|
+
HookConfig,
|
|
81
|
+
HookContext,
|
|
82
|
+
HookHandler,
|
|
83
|
+
HookFunction,
|
|
84
|
+
SessionStartContext,
|
|
85
|
+
TypedHookConfig,
|
|
86
|
+
TypedPreToolUseInput,
|
|
87
|
+
TypedPostToolUseInput,
|
|
88
|
+
TypedPostToolUseFailureInput,
|
|
89
|
+
TypedPermissionRequestInput
|
|
90
|
+
} from './hooks.js';
|
|
91
|
+
export {
|
|
92
|
+
preToolUseHook,
|
|
93
|
+
postToolUseHook,
|
|
94
|
+
postToolUseFailureHook,
|
|
95
|
+
notificationHook,
|
|
96
|
+
userPromptSubmitHook,
|
|
97
|
+
sessionStartHook,
|
|
98
|
+
sessionEndHook,
|
|
99
|
+
stopHook,
|
|
100
|
+
subagentStartHook,
|
|
101
|
+
subagentStopHook,
|
|
102
|
+
preCompactHook,
|
|
103
|
+
permissionRequestHook
|
|
104
|
+
} from './hooks.js';
|
|
105
|
+
export { execute } from './runtime.js';
|
|
106
|
+
export { CLAUDE_ENV_VARS, getProjectDir, getEnvFilePath, isRemoteEnvironment } from './env.js';
|
|
107
|
+
export type {
|
|
108
|
+
WriteToolInput,
|
|
109
|
+
EditToolInput,
|
|
110
|
+
MultiEditEntry,
|
|
111
|
+
MultiEditToolInput,
|
|
112
|
+
ReadToolInput,
|
|
113
|
+
BashToolInput,
|
|
114
|
+
GlobToolInput,
|
|
115
|
+
GrepToolInput,
|
|
116
|
+
FileModifyingToolInput,
|
|
117
|
+
FileModifyingToolName,
|
|
118
|
+
KnownToolInput,
|
|
119
|
+
KnownToolName,
|
|
120
|
+
ToolInputMap
|
|
121
|
+
} from './tool-inputs.js';
|
|
122
|
+
export type { ToolUseInput, PatternCheckResult, ContentContext } from './tool-helpers.js';
|
|
123
|
+
export {
|
|
124
|
+
isWriteTool,
|
|
125
|
+
isEditTool,
|
|
126
|
+
isMultiEditTool,
|
|
127
|
+
isFileModifyingTool,
|
|
128
|
+
isReadTool,
|
|
129
|
+
isBashTool,
|
|
130
|
+
isGlobTool,
|
|
131
|
+
isGrepTool,
|
|
132
|
+
getFilePath,
|
|
133
|
+
isJsTsFile,
|
|
134
|
+
isTsFile,
|
|
135
|
+
checkContentForPattern,
|
|
136
|
+
forEachContent
|
|
137
|
+
} from './tool-helpers.js';
|