cc-hooks-ts 0.0.3 → 0.0.4

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
@@ -5,7 +5,7 @@ Define Claude Code hooks with full type safety using TypeScript and Valibot vali
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npx npym add cc-hooks-ts
8
+ npx nypm add cc-hooks-ts
9
9
  ```
10
10
 
11
11
  ## Basic Usage
package/dist/index.d.mts CHANGED
@@ -143,6 +143,10 @@ interface SessionStartHookOutput extends CommonHookOutputs {
143
143
  };
144
144
  }
145
145
  //#endregion
146
+ //#region src/utils/types.d.ts
147
+ type Awaitable<T> = Promise<T> | T;
148
+ type AutoComplete<T extends string> = Record<string, never> & T;
149
+ //#endregion
146
150
  //#region src/input/schemas.d.ts
147
151
  /**
148
152
  * @package
@@ -154,8 +158,8 @@ declare const HookInputSchemas: {
154
158
  readonly session_id: v.StringSchema<undefined>;
155
159
  readonly transcript_path: v.StringSchema<undefined>;
156
160
  } & {
161
+ tool_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, AutoComplete<string>>]>;
157
162
  tool_input: v.UnknownSchema;
158
- tool_name: v.IntersectSchema<[v.StringSchema<undefined>, v.RecordSchema<v.StringSchema<undefined>, v.NeverSchema<undefined>, undefined>], undefined>;
159
163
  }, undefined>;
160
164
  readonly PostToolUse: v.ObjectSchema<{
161
165
  readonly hook_event_name: v.LiteralSchema<"PostToolUse", undefined>;
@@ -163,8 +167,8 @@ declare const HookInputSchemas: {
163
167
  readonly session_id: v.StringSchema<undefined>;
164
168
  readonly transcript_path: v.StringSchema<undefined>;
165
169
  } & {
170
+ tool_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, AutoComplete<string>>]>;
166
171
  tool_input: v.UnknownSchema;
167
- tool_name: v.StringSchema<undefined>;
168
172
  tool_response: v.UnknownSchema;
169
173
  }, undefined>;
170
174
  readonly Notification: v.ObjectSchema<{
@@ -371,9 +375,6 @@ type HookResultJSON<TTrigger extends HookTrigger> = { [EventKey in keyof TTrigge
371
375
  output: ExtractHookOutput<EventKey>;
372
376
  } : never : never }[keyof TTrigger];
373
377
  //#endregion
374
- //#region src/utils/types.d.ts
375
- type Awaitable<T> = Promise<T> | T;
376
- //#endregion
377
378
  //#region src/define.d.ts
378
379
  /**
379
380
  * Creates a type-safe Claude Code hook definition.
package/dist/index.mjs CHANGED
@@ -54,12 +54,12 @@ function buildHookInputSchema(hook_event_name, entries) {
54
54
  }
55
55
  const HookInputSchemas = {
56
56
  PreToolUse: buildHookInputSchema("PreToolUse", {
57
- tool_input: v.unknown(),
58
- tool_name: v.intersect([v.string(), v.record(v.string(), v.never())])
57
+ tool_name: v.pipe(v.string(), v.transform((s) => s)),
58
+ tool_input: v.unknown()
59
59
  }),
60
60
  PostToolUse: buildHookInputSchema("PostToolUse", {
61
+ tool_name: v.pipe(v.string(), v.transform((s) => s)),
61
62
  tool_input: v.unknown(),
62
- tool_name: v.string(),
63
63
  tool_response: v.unknown()
64
64
  }),
65
65
  Notification: buildHookInputSchema("Notification", { message: v.optional(v.string()) }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-hooks-ts",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "description": "Write claude code hooks with type safety",
6
6
  "sideEffects": false,