cc-hooks-ts 0.0.5 → 0.0.6

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.
Files changed (2) hide show
  1. package/dist/index.d.mts +249 -6
  2. package/package.json +1 -1
package/dist/index.d.mts CHANGED
@@ -1,5 +1,16 @@
1
1
  import * as v from "valibot";
2
2
 
3
+ //#region src/hook-types/index.d.ts
4
+ type ClaudeCodeTodo = {
5
+ activeForm: string;
6
+ content: string;
7
+ status: "completed" | "in_progress" | "pending";
8
+ };
9
+ //#endregion
10
+ //#region src/utils/types.d.ts
11
+ type Awaitable<T> = Promise<T> | T;
12
+ type AutoComplete<T extends string> = Record<string, never> & T;
13
+ //#endregion
3
14
  //#region src/event.d.ts
4
15
  declare const SUPPORTED_HOOK_EVENTS: readonly ["PreToolUse", "PostToolUse", "Notification", "UserPromptSubmit", "Stop", "SubagentStop", "PreCompact", "SessionStart", "SessionEnd"];
5
16
  /**
@@ -143,10 +154,6 @@ interface SessionStartHookOutput extends CommonHookOutputs {
143
154
  };
144
155
  }
145
156
  //#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
150
157
  //#region src/input/schemas.d.ts
151
158
  /**
152
159
  * @package
@@ -542,18 +549,254 @@ declare function runHook<THookTrigger extends HookTrigger = HookTrigger>(def: Ho
542
549
  * ```
543
550
  */
544
551
  interface ToolSchema {
552
+ Bash: {
553
+ input: {
554
+ command: string;
555
+ description?: string;
556
+ run_in_background?: boolean;
557
+ /**
558
+ * Timeout in milliseconds for the process (ignored if run_in_background is true).
559
+ */
560
+ timeout?: number;
561
+ };
562
+ response: {
563
+ interrupted: boolean;
564
+ isImage: boolean;
565
+ stderr: string;
566
+ stdout: string;
567
+ };
568
+ };
569
+ Edit: {
570
+ input: {
571
+ file_path: string;
572
+ new_string: string;
573
+ old_string: string;
574
+ /**
575
+ * @default false
576
+ */
577
+ replace_all?: boolean;
578
+ };
579
+ response: {
580
+ filePath: string;
581
+ newString: string;
582
+ oldString: string;
583
+ originalFile: string;
584
+ replaceAll: boolean;
585
+ structuredPatch: Array<{
586
+ lines: string[];
587
+ newLines: number;
588
+ newStart: number;
589
+ oldLines: number;
590
+ oldStart: number;
591
+ }>;
592
+ userModified: boolean;
593
+ };
594
+ };
595
+ Glob: {
596
+ input: {
597
+ /**
598
+ * @default process.cwd()
599
+ */
600
+ path?: string;
601
+ pattern: string;
602
+ };
603
+ response: {
604
+ durationMs: number;
605
+ filenames: string[];
606
+ numFiles: number;
607
+ truncated: boolean;
608
+ };
609
+ };
610
+ Grep: {
611
+ input: {
612
+ "-A"?: number;
613
+ "-B"?: number;
614
+ "-C"?: number;
615
+ "-i"?: boolean;
616
+ "-n"?: boolean;
617
+ glob?: string;
618
+ head_limit?: number;
619
+ multiline?: boolean;
620
+ /**
621
+ * @default "files_with_matches"
622
+ */
623
+ output_mode?: "content" | "count" | "files_with_matches";
624
+ path?: string;
625
+ pattern: string;
626
+ type?: string;
627
+ };
628
+ response: {
629
+ content: string;
630
+ mode: "content" | "count" | "files_with_matches";
631
+ numFiles: number;
632
+ numLines: number;
633
+ };
634
+ };
635
+ LS: {
636
+ input: {
637
+ path: string;
638
+ };
639
+ response: string;
640
+ };
641
+ MultiEdit: {
642
+ input: {
643
+ edits: Array<{
644
+ new_string: string;
645
+ old_string: string;
646
+ /**
647
+ * @default false
648
+ */
649
+ replace_all?: boolean;
650
+ }>;
651
+ file_path: string;
652
+ };
653
+ response: {
654
+ edits: Array<{
655
+ new_string: string;
656
+ old_string: string;
657
+ /**
658
+ * @default false
659
+ */
660
+ replace_all?: boolean;
661
+ }>;
662
+ filePath: string;
663
+ originalFileContents: string;
664
+ structuredPatch: Array<{
665
+ lines: string[];
666
+ newLines: number;
667
+ newStart: number;
668
+ oldLines: number;
669
+ oldStart: number;
670
+ }>;
671
+ userModified: boolean;
672
+ };
673
+ };
674
+ NotebookEdit: {
675
+ /**
676
+ * @default edit_mode: "replace"
677
+ */
678
+ input: {
679
+ cell_id: string;
680
+ edit_mode: "delete";
681
+ new_source: string;
682
+ notebook_path: string;
683
+ } | {
684
+ cell_id: string;
685
+ cell_type?: "code" | "markdown";
686
+ edit_mode: "replace";
687
+ new_source: string;
688
+ notebook_path: string;
689
+ } | {
690
+ cell_id?: string;
691
+ cell_type: "code" | "markdown";
692
+ edit_mode: "insert";
693
+ new_source: string;
694
+ notebook_path: string;
695
+ };
696
+ response: {
697
+ cell_type: "code" | "markdown";
698
+ edit_mode: "delete" | "insert" | "replace";
699
+ error: string;
700
+ language: string;
701
+ new_source: string;
702
+ };
703
+ };
545
704
  Read: {
546
705
  input: {
547
706
  file_path: string;
707
+ limit?: number;
708
+ offset?: number;
709
+ };
710
+ response: {
711
+ file: {
712
+ cells: Array<{
713
+ cell_id: string;
714
+ cellType: "code";
715
+ language: string;
716
+ source: string;
717
+ } | {
718
+ cell_id: string;
719
+ cellType: "markdown";
720
+ source: string;
721
+ }>;
722
+ filePath: string;
723
+ };
724
+ type: "notebook";
725
+ } | {
726
+ file: {
727
+ content: string;
728
+ filePath: string;
729
+ numLines: number;
730
+ startLine: number;
731
+ totalLines: number;
732
+ };
733
+ type: "text";
734
+ };
735
+ };
736
+ Task: {
737
+ input: {
738
+ description: string;
739
+ prompt: string;
740
+ subagent_type: AutoComplete<"general-purpose" | "output-style-setup" | "statusline-setup">;
741
+ };
742
+ response: {
743
+ content: Array<{
744
+ text: string;
745
+ type: "text";
746
+ }>;
747
+ totalDurationMs: number;
748
+ totalTokens: number;
749
+ totalToolUseCount: number;
750
+ usage: {
751
+ cache_creation: {
752
+ ephemeral_1h_input_tokens: number;
753
+ ephemeral_5m_input_tokens: number;
754
+ };
755
+ cache_creation_input_tokens: number;
756
+ cache_read_input_tokens: number;
757
+ input_tokens: number;
758
+ output_tokens: number;
759
+ };
760
+ };
761
+ };
762
+ TodoWrite: {
763
+ input: {
764
+ todos: ClaudeCodeTodo[];
765
+ };
766
+ response: {
767
+ newTodos: ClaudeCodeTodo[];
768
+ oldTodos: ClaudeCodeTodo[];
548
769
  };
549
- response: unknown;
550
770
  };
551
771
  WebFetch: {
552
772
  input: {
773
+ /**
774
+ * @default 100
775
+ */
776
+ charThreshold?: number;
553
777
  prompt: string;
554
778
  url: string;
555
779
  };
556
- response: unknown;
780
+ response: {
781
+ bytes: number;
782
+ code: number;
783
+ codeText: string;
784
+ durationMs: number;
785
+ result: string;
786
+ url: string;
787
+ };
788
+ };
789
+ Write: {
790
+ input: {
791
+ content: string;
792
+ file_path: string;
793
+ };
794
+ response: {
795
+ content: string;
796
+ filePath: string;
797
+ structuredPatch: unknown[];
798
+ type: "create";
799
+ };
557
800
  };
558
801
  }
559
802
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-hooks-ts",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "type": "module",
5
5
  "description": "Write claude code hooks with type safety",
6
6
  "sideEffects": false,