@procedures/git 0.2.3 → 0.3.0

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 (141) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +77 -12
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/module.d.ts.map +1 -1
  5. package/dist/module.js +312 -2
  6. package/dist/module.js.map +1 -1
  7. package/dist/procedures/git/blame.d.ts +17 -0
  8. package/dist/procedures/git/blame.d.ts.map +1 -0
  9. package/dist/procedures/git/blame.js +69 -0
  10. package/dist/procedures/git/blame.js.map +1 -0
  11. package/dist/procedures/git/branch/add.d.ts +12 -0
  12. package/dist/procedures/git/branch/add.d.ts.map +1 -0
  13. package/dist/procedures/git/branch/add.js +21 -0
  14. package/dist/procedures/git/branch/add.js.map +1 -0
  15. package/dist/procedures/git/branch/delete.d.ts +13 -0
  16. package/dist/procedures/git/branch/delete.d.ts.map +1 -0
  17. package/dist/procedures/git/branch/delete.js +24 -0
  18. package/dist/procedures/git/branch/delete.js.map +1 -0
  19. package/dist/procedures/git/branch/list.d.ts +13 -0
  20. package/dist/procedures/git/branch/list.d.ts.map +1 -0
  21. package/dist/procedures/git/branch/list.js +37 -0
  22. package/dist/procedures/git/branch/list.js.map +1 -0
  23. package/dist/procedures/git/branch.d.ts +8 -2
  24. package/dist/procedures/git/branch.d.ts.map +1 -1
  25. package/dist/procedures/git/branch.js +18 -37
  26. package/dist/procedures/git/branch.js.map +1 -1
  27. package/dist/procedures/git/commit.d.ts.map +1 -1
  28. package/dist/procedures/git/commit.js +9 -11
  29. package/dist/procedures/git/commit.js.map +1 -1
  30. package/dist/procedures/git/index.d.ts +19 -0
  31. package/dist/procedures/git/index.d.ts.map +1 -1
  32. package/dist/procedures/git/index.js +19 -0
  33. package/dist/procedures/git/index.js.map +1 -1
  34. package/dist/procedures/git/init.d.ts +6 -2
  35. package/dist/procedures/git/init.d.ts.map +1 -1
  36. package/dist/procedures/git/init.js +8 -4
  37. package/dist/procedures/git/init.js.map +1 -1
  38. package/dist/procedures/git/merge/abort.d.ts +14 -0
  39. package/dist/procedures/git/merge/abort.d.ts.map +1 -0
  40. package/dist/procedures/git/merge/abort.js +18 -0
  41. package/dist/procedures/git/merge/abort.js.map +1 -0
  42. package/dist/procedures/git/merge.d.ts +16 -0
  43. package/dist/procedures/git/merge.d.ts.map +1 -0
  44. package/dist/procedures/git/merge.js +41 -0
  45. package/dist/procedures/git/merge.js.map +1 -0
  46. package/dist/procedures/git/push.d.ts.map +1 -1
  47. package/dist/procedures/git/push.js +4 -2
  48. package/dist/procedures/git/push.js.map +1 -1
  49. package/dist/procedures/git/rebase/abort.d.ts +13 -0
  50. package/dist/procedures/git/rebase/abort.d.ts.map +1 -0
  51. package/dist/procedures/git/rebase/abort.js +17 -0
  52. package/dist/procedures/git/rebase/abort.js.map +1 -0
  53. package/dist/procedures/git/rebase/continue.d.ts +13 -0
  54. package/dist/procedures/git/rebase/continue.d.ts.map +1 -0
  55. package/dist/procedures/git/rebase/continue.js +23 -0
  56. package/dist/procedures/git/rebase/continue.js.map +1 -0
  57. package/dist/procedures/git/rebase.d.ts +22 -0
  58. package/dist/procedures/git/rebase.d.ts.map +1 -0
  59. package/dist/procedures/git/rebase.js +46 -0
  60. package/dist/procedures/git/rebase.js.map +1 -0
  61. package/dist/procedures/git/refs.d.ts +31 -0
  62. package/dist/procedures/git/refs.d.ts.map +1 -0
  63. package/dist/procedures/git/refs.js +52 -0
  64. package/dist/procedures/git/refs.js.map +1 -0
  65. package/dist/procedures/git/reset.d.ts +13 -0
  66. package/dist/procedures/git/reset.d.ts.map +1 -0
  67. package/dist/procedures/git/reset.js +31 -0
  68. package/dist/procedures/git/reset.js.map +1 -0
  69. package/dist/procedures/git/restore.d.ts +13 -0
  70. package/dist/procedures/git/restore.d.ts.map +1 -0
  71. package/dist/procedures/git/restore.js +26 -0
  72. package/dist/procedures/git/restore.js.map +1 -0
  73. package/dist/procedures/git/revParse.d.ts +13 -0
  74. package/dist/procedures/git/revParse.d.ts.map +1 -0
  75. package/dist/procedures/git/revParse.js +23 -0
  76. package/dist/procedures/git/revParse.js.map +1 -0
  77. package/dist/procedures/git/run.d.ts +2 -0
  78. package/dist/procedures/git/run.d.ts.map +1 -1
  79. package/dist/procedures/git/run.js +1 -0
  80. package/dist/procedures/git/run.js.map +1 -1
  81. package/dist/procedures/git/show.d.ts +15 -0
  82. package/dist/procedures/git/show.d.ts.map +1 -0
  83. package/dist/procedures/git/show.js +49 -0
  84. package/dist/procedures/git/show.js.map +1 -0
  85. package/dist/procedures/git/tag/add.d.ts +12 -0
  86. package/dist/procedures/git/tag/add.d.ts.map +1 -0
  87. package/dist/procedures/git/tag/add.js +25 -0
  88. package/dist/procedures/git/tag/add.js.map +1 -0
  89. package/dist/procedures/git/tag/delete.d.ts +12 -0
  90. package/dist/procedures/git/tag/delete.d.ts.map +1 -0
  91. package/dist/procedures/git/tag/delete.js +19 -0
  92. package/dist/procedures/git/tag/delete.js.map +1 -0
  93. package/dist/procedures/git/tag/list.d.ts +12 -0
  94. package/dist/procedures/git/tag/list.d.ts.map +1 -0
  95. package/dist/procedures/git/tag/list.js +34 -0
  96. package/dist/procedures/git/tag/list.js.map +1 -0
  97. package/dist/procedures/git/worktree/add.d.ts +13 -0
  98. package/dist/procedures/git/worktree/add.d.ts.map +1 -0
  99. package/dist/procedures/git/worktree/add.js +35 -0
  100. package/dist/procedures/git/worktree/add.js.map +1 -0
  101. package/dist/procedures/git/worktree/list.d.ts +17 -0
  102. package/dist/procedures/git/worktree/list.d.ts.map +1 -0
  103. package/dist/procedures/git/worktree/list.js +52 -0
  104. package/dist/procedures/git/worktree/list.js.map +1 -0
  105. package/dist/procedures/git/worktree/remove.d.ts +13 -0
  106. package/dist/procedures/git/worktree/remove.d.ts.map +1 -0
  107. package/dist/procedures/git/worktree/remove.js +20 -0
  108. package/dist/procedures/git/worktree/remove.js.map +1 -0
  109. package/dist/types.d.ts +308 -0
  110. package/dist/types.d.ts.map +1 -1
  111. package/dist/types.js +265 -0
  112. package/dist/types.js.map +1 -1
  113. package/package.json +4 -4
  114. package/src/module.ts +411 -2
  115. package/src/procedures/git/blame.ts +68 -0
  116. package/src/procedures/git/branch/add.ts +24 -0
  117. package/src/procedures/git/branch/delete.ts +29 -0
  118. package/src/procedures/git/branch/list.ts +40 -0
  119. package/src/procedures/git/branch.ts +19 -40
  120. package/src/procedures/git/commit.ts +9 -11
  121. package/src/procedures/git/index.ts +19 -0
  122. package/src/procedures/git/init.ts +11 -10
  123. package/src/procedures/git/merge/abort.ts +20 -0
  124. package/src/procedures/git/merge.ts +42 -0
  125. package/src/procedures/git/push.ts +4 -2
  126. package/src/procedures/git/rebase/abort.ts +19 -0
  127. package/src/procedures/git/rebase/continue.ts +25 -0
  128. package/src/procedures/git/rebase.ts +48 -0
  129. package/src/procedures/git/refs.ts +55 -0
  130. package/src/procedures/git/reset.ts +34 -0
  131. package/src/procedures/git/restore.ts +27 -0
  132. package/src/procedures/git/revParse.ts +24 -0
  133. package/src/procedures/git/run.ts +3 -0
  134. package/src/procedures/git/show.ts +57 -0
  135. package/src/procedures/git/tag/add.ts +27 -0
  136. package/src/procedures/git/tag/delete.ts +22 -0
  137. package/src/procedures/git/tag/list.ts +36 -0
  138. package/src/procedures/git/worktree/add.ts +35 -0
  139. package/src/procedures/git/worktree/list.ts +48 -0
  140. package/src/procedures/git/worktree/remove.ts +21 -0
  141. package/src/types.ts +623 -0
package/src/types.ts CHANGED
@@ -813,3 +813,626 @@ export const GitStashImportOutputSchema: z.ZodType<GitStashImportOutput> = z.loo
813
813
  ref: z.string().optional().describe("The new stash reference"),
814
814
  error: z.string().optional().describe("Why the import failed"),
815
815
  });
816
+
817
+ // =============================================================================
818
+ // git.show Types - Show a commit, or a file at a commit (roadmap R40)
819
+ // =============================================================================
820
+
821
+ export const GitShowInputSchema: z.ZodObject<{
822
+ ref: z.ZodOptional<z.ZodString>;
823
+ path: z.ZodOptional<z.ZodString>;
824
+ stat: z.ZodOptional<z.ZodBoolean>;
825
+ cwd: z.ZodOptional<z.ZodString>;
826
+ }> = z.object({
827
+ ref: z.string().optional().describe("The commit, branch or tag (default: HEAD)"),
828
+ path: z.string().optional().describe("A file, relative to the root of the repository: the call gives its content at the commit"),
829
+ stat: z.boolean().optional().describe("Give the counts of the files, without the text of the diff (default: false)"),
830
+ cwd: z.string().optional().describe("Working directory"),
831
+ });
832
+
833
+ export type GitShowInput = z.infer<typeof GitShowInputSchema>;
834
+
835
+ export interface GitShowOutput {
836
+ /** The ref of the input */
837
+ ref: string;
838
+ /** The hash of the commit */
839
+ hash: string;
840
+ /** Without `path`: the short hash */
841
+ shortHash?: string | undefined;
842
+ /** Without `path`: the author name */
843
+ author?: string | undefined;
844
+ /** Without `path`: the author email */
845
+ email?: string | undefined;
846
+ /** Without `path`: the author date */
847
+ date?: string | undefined;
848
+ /** Without `path`: the subject of the commit message */
849
+ message?: string | undefined;
850
+ /** Without `path`: the commit message after the subject */
851
+ body?: string | undefined;
852
+ /** Without `path`: the changed files, against the first parent */
853
+ files?: GitDiffFile[] | undefined;
854
+ additions?: number | undefined;
855
+ deletions?: number | undefined;
856
+ /** Without `path` and `stat`: the text of the diff */
857
+ diff?: string | undefined;
858
+ /** With `path`: the file */
859
+ path?: string | undefined;
860
+ /** With `path`: the content of the file at the commit */
861
+ content?: string | undefined;
862
+ }
863
+
864
+ // =============================================================================
865
+ // git.blame Types - The commit and the author of each line of a file (roadmap R40)
866
+ // =============================================================================
867
+
868
+ export const GitBlameInputSchema: z.ZodObject<{
869
+ path: z.ZodString;
870
+ ref: z.ZodOptional<z.ZodString>;
871
+ startLine: z.ZodOptional<z.ZodNumber>;
872
+ endLine: z.ZodOptional<z.ZodNumber>;
873
+ cwd: z.ZodOptional<z.ZodString>;
874
+ }> = z.object({
875
+ path: z.string().describe("The file"),
876
+ ref: z.string().optional().describe("The commit (default: the working tree)"),
877
+ startLine: z.number().int().positive().optional().describe("The first line (default: 1)"),
878
+ endLine: z.number().int().positive().optional().describe("The last line (default: the last line of the file)"),
879
+ cwd: z.string().optional().describe("Working directory"),
880
+ });
881
+
882
+ export type GitBlameInput = z.infer<typeof GitBlameInputSchema>;
883
+
884
+ export interface GitBlameLine {
885
+ /** The line number in the file (1 is the first line) */
886
+ line: number;
887
+ /** The commit that last changed the line (zeros for a change that is not committed) */
888
+ hash: string;
889
+ author: string;
890
+ email: string;
891
+ /** The author date, as an ISO 8601 string */
892
+ date: string;
893
+ /** The subject of the commit */
894
+ summary: string;
895
+ /** The text of the line */
896
+ content: string;
897
+ }
898
+
899
+ export interface GitBlameOutput {
900
+ path: string;
901
+ lines: GitBlameLine[];
902
+ }
903
+
904
+ // =============================================================================
905
+ // git.tag.* Types - Tags (roadmap R40)
906
+ // =============================================================================
907
+
908
+ export const GitTagListInputSchema: z.ZodObject<{
909
+ pattern: z.ZodOptional<z.ZodString>;
910
+ cwd: z.ZodOptional<z.ZodString>;
911
+ }> = z.object({
912
+ pattern: z.string().optional().describe("A glob pattern for the tag names, for example v1.*"),
913
+ cwd: z.string().optional().describe("Working directory"),
914
+ });
915
+
916
+ export type GitTagListInput = z.infer<typeof GitTagListInputSchema>;
917
+
918
+ export interface GitTagInfo {
919
+ name: string;
920
+ /** The commit of the tag */
921
+ hash: string;
922
+ /** True for an annotated tag */
923
+ annotated: boolean;
924
+ /** For an annotated tag: the subject of its message */
925
+ message?: string | undefined;
926
+ }
927
+
928
+ export interface GitTagListOutput {
929
+ tags: GitTagInfo[];
930
+ }
931
+
932
+ export const GitTagAddInputSchema: z.ZodObject<{
933
+ name: z.ZodString;
934
+ ref: z.ZodOptional<z.ZodString>;
935
+ message: z.ZodOptional<z.ZodString>;
936
+ cwd: z.ZodOptional<z.ZodString>;
937
+ }> = z.object({
938
+ name: z.string().describe("The tag name"),
939
+ ref: z.string().optional().describe("The commit of the tag (default: HEAD)"),
940
+ message: z.string().optional().describe("The message: with it, the tag is an annotated tag"),
941
+ cwd: z.string().optional().describe("Working directory"),
942
+ });
943
+
944
+ export type GitTagAddInput = z.infer<typeof GitTagAddInputSchema>;
945
+
946
+ export interface GitTagAddOutput {
947
+ name: string;
948
+ /** The commit of the tag */
949
+ hash: string;
950
+ annotated: boolean;
951
+ }
952
+
953
+ export const GitTagDeleteInputSchema: z.ZodObject<{
954
+ name: z.ZodString;
955
+ cwd: z.ZodOptional<z.ZodString>;
956
+ }> = z.object({
957
+ name: z.string().describe("The tag name"),
958
+ cwd: z.string().optional().describe("Working directory"),
959
+ });
960
+
961
+ export type GitTagDeleteInput = z.infer<typeof GitTagDeleteInputSchema>;
962
+
963
+ export interface GitTagDeleteOutput {
964
+ name: string;
965
+ /** The object of the deleted tag: a tag object or a commit */
966
+ hash: string;
967
+ }
968
+
969
+ // =============================================================================
970
+ // git.revParse Types - The hash or the name of a ref (roadmap R40)
971
+ // =============================================================================
972
+
973
+ export const GitRevParseInputSchema: z.ZodObject<{
974
+ ref: z.ZodOptional<z.ZodString>;
975
+ abbrevRef: z.ZodOptional<z.ZodBoolean>;
976
+ short: z.ZodOptional<z.ZodBoolean>;
977
+ cwd: z.ZodOptional<z.ZodString>;
978
+ }> = z.object({
979
+ ref: z.string().optional().describe("The ref, for example HEAD, main, v1.0 or HEAD~2 (default: HEAD)"),
980
+ abbrevRef: z.boolean().optional().describe("Give the short name of the ref, for example main for HEAD (default: false)"),
981
+ short: z.boolean().optional().describe("Give the short hash (default: false)"),
982
+ cwd: z.string().optional().describe("Working directory"),
983
+ });
984
+
985
+ export type GitRevParseInput = z.infer<typeof GitRevParseInputSchema>;
986
+
987
+ export interface GitRevParseOutput {
988
+ ref: string;
989
+ /** The hash, the short hash or the short name */
990
+ value: string;
991
+ }
992
+
993
+ // =============================================================================
994
+ // git.reset Types - Move HEAD, and reset the index or the working tree (roadmap R40)
995
+ // =============================================================================
996
+
997
+ export const GitResetInputSchema: z.ZodObject<{
998
+ ref: z.ZodOptional<z.ZodString>;
999
+ mode: z.ZodOptional<z.ZodEnum<{ soft: "soft"; mixed: "mixed"; hard: "hard"; merge: "merge"; keep: "keep" }>>;
1000
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
1001
+ cwd: z.ZodOptional<z.ZodString>;
1002
+ }> = z.object({
1003
+ ref: z.string().optional().describe("The commit (default: HEAD)"),
1004
+ mode: z
1005
+ .enum(["soft", "mixed", "hard", "merge", "keep"])
1006
+ .optional()
1007
+ .describe("soft keeps the index, mixed resets the index, hard also resets the working tree (default: mixed)"),
1008
+ paths: z.array(z.string()).optional().describe("Reset only these paths in the index. HEAD does not move. Only the mode mixed accepts paths"),
1009
+ cwd: z.string().optional().describe("Working directory"),
1010
+ });
1011
+
1012
+ export type GitResetInput = z.infer<typeof GitResetInputSchema>;
1013
+
1014
+ export interface GitResetOutput {
1015
+ ref: string;
1016
+ mode: "soft" | "mixed" | "hard" | "merge" | "keep";
1017
+ /** HEAD after the reset */
1018
+ hash: string;
1019
+ }
1020
+
1021
+ // =============================================================================
1022
+ // git.restore Types - Restore files of the working tree or the index (roadmap R40)
1023
+ // =============================================================================
1024
+
1025
+ export const GitRestoreInputSchema: z.ZodObject<{
1026
+ paths: z.ZodArray<z.ZodString>;
1027
+ source: z.ZodOptional<z.ZodString>;
1028
+ staged: z.ZodOptional<z.ZodBoolean>;
1029
+ worktree: z.ZodOptional<z.ZodBoolean>;
1030
+ cwd: z.ZodOptional<z.ZodString>;
1031
+ }> = z.object({
1032
+ paths: z.array(z.string()).min(1).describe("The paths to restore"),
1033
+ source: z.string().optional().describe("The commit to restore from (default: the index for the working tree, HEAD for the index)"),
1034
+ staged: z.boolean().optional().describe("Restore the index: this unstages the changes (default: false)"),
1035
+ worktree: z.boolean().optional().describe("Restore the working tree (default: true without staged, false with staged)"),
1036
+ cwd: z.string().optional().describe("Working directory"),
1037
+ });
1038
+
1039
+ export type GitRestoreInput = z.infer<typeof GitRestoreInputSchema>;
1040
+
1041
+ export interface GitRestoreOutput {
1042
+ /** The paths of the input */
1043
+ restored: string[];
1044
+ }
1045
+
1046
+ // =============================================================================
1047
+ // git.merge Types - Merge into the current branch (roadmap R40)
1048
+ // =============================================================================
1049
+
1050
+ export const GitMergeInputSchema: z.ZodObject<{
1051
+ ref: z.ZodString;
1052
+ fastForward: z.ZodOptional<z.ZodEnum<{ auto: "auto"; only: "only"; never: "never" }>>;
1053
+ message: z.ZodOptional<z.ZodString>;
1054
+ cwd: z.ZodOptional<z.ZodString>;
1055
+ }> = z.object({
1056
+ ref: z.string().describe("The branch or the commit to merge"),
1057
+ fastForward: z
1058
+ .enum(["auto", "only", "never"])
1059
+ .optional()
1060
+ .describe("auto: a fast-forward when possible. only: fail without a fast-forward. never: always a merge commit (default: auto)"),
1061
+ message: z.string().optional().describe("The message of the merge commit (default: the message of git)"),
1062
+ cwd: z.string().optional().describe("Working directory"),
1063
+ });
1064
+
1065
+ export type GitMergeInput = z.infer<typeof GitMergeInputSchema>;
1066
+
1067
+ export interface GitMergeOutput {
1068
+ ref: string;
1069
+ /** HEAD after the call */
1070
+ hash: string;
1071
+ /** True when the branch moved to the ref without a merge commit */
1072
+ fastForward: boolean;
1073
+ /** True when the branch has the ref already: nothing changed */
1074
+ upToDate: boolean;
1075
+ /** True when the merge stopped on conflicts: resolve them and commit, or call git.merge.abort */
1076
+ conflict: boolean;
1077
+ /** The files with conflicts */
1078
+ conflicts?: string[] | undefined;
1079
+ }
1080
+
1081
+ export const GitMergeAbortInputSchema: z.ZodObject<{
1082
+ cwd: z.ZodOptional<z.ZodString>;
1083
+ }> = z.object({
1084
+ cwd: z.string().optional().describe("Working directory"),
1085
+ });
1086
+
1087
+ export type GitMergeAbortInput = z.infer<typeof GitMergeAbortInputSchema>;
1088
+
1089
+ export interface GitMergeAbortOutput {
1090
+ aborted: boolean;
1091
+ /** HEAD after the call */
1092
+ hash: string;
1093
+ }
1094
+
1095
+ // =============================================================================
1096
+ // git.rebase.* Types - A rebase that is not interactive (roadmap R40)
1097
+ // =============================================================================
1098
+
1099
+ export const GitRebaseInputSchema: z.ZodObject<{
1100
+ upstream: z.ZodString;
1101
+ onto: z.ZodOptional<z.ZodString>;
1102
+ branch: z.ZodOptional<z.ZodString>;
1103
+ cwd: z.ZodOptional<z.ZodString>;
1104
+ }> = z.object({
1105
+ upstream: z.string().describe("The branch or the commit to rebase on"),
1106
+ onto: z.string().optional().describe("The new base of the commits, when it is not the upstream"),
1107
+ branch: z.string().optional().describe("The branch to rebase. Git checks it out first (default: the current branch)"),
1108
+ cwd: z.string().optional().describe("Working directory"),
1109
+ });
1110
+
1111
+ export type GitRebaseInput = z.infer<typeof GitRebaseInputSchema>;
1112
+
1113
+ export interface GitRebaseOutput {
1114
+ /** HEAD after the call */
1115
+ hash: string;
1116
+ /** True when the rebase is complete */
1117
+ completed: boolean;
1118
+ /** True when the branch had nothing to rebase: nothing changed */
1119
+ upToDate: boolean;
1120
+ /** True when the rebase stopped on conflicts: resolve them, then call git.rebase.continue or git.rebase.abort */
1121
+ conflict: boolean;
1122
+ /** The files with conflicts */
1123
+ conflicts?: string[] | undefined;
1124
+ }
1125
+
1126
+ export const GitRebaseContinueInputSchema: z.ZodObject<{
1127
+ cwd: z.ZodOptional<z.ZodString>;
1128
+ }> = z.object({
1129
+ cwd: z.string().optional().describe("Working directory"),
1130
+ });
1131
+
1132
+ export type GitRebaseContinueInput = z.infer<typeof GitRebaseContinueInputSchema>;
1133
+
1134
+ /** git.rebase.continue gives the result of git.rebase. */
1135
+ export type GitRebaseContinueOutput = GitRebaseOutput;
1136
+
1137
+ export const GitRebaseAbortInputSchema: z.ZodObject<{
1138
+ cwd: z.ZodOptional<z.ZodString>;
1139
+ }> = z.object({
1140
+ cwd: z.string().optional().describe("Working directory"),
1141
+ });
1142
+
1143
+ export type GitRebaseAbortInput = z.infer<typeof GitRebaseAbortInputSchema>;
1144
+
1145
+ export interface GitRebaseAbortOutput {
1146
+ aborted: boolean;
1147
+ /** HEAD after the call: the branch as it was before the rebase */
1148
+ hash: string;
1149
+ }
1150
+
1151
+ // =============================================================================
1152
+ // git.worktree.* Types - Working trees (roadmap R40)
1153
+ // =============================================================================
1154
+
1155
+ export const GitWorktreeListInputSchema: z.ZodObject<{
1156
+ cwd: z.ZodOptional<z.ZodString>;
1157
+ }> = z.object({
1158
+ cwd: z.string().optional().describe("Working directory"),
1159
+ });
1160
+
1161
+ export type GitWorktreeListInput = z.infer<typeof GitWorktreeListInputSchema>;
1162
+
1163
+ export interface GitWorktreeInfo {
1164
+ /** The absolute path of the working tree */
1165
+ path: string;
1166
+ /** The commit that is checked out */
1167
+ head?: string | undefined;
1168
+ /** The branch that is checked out */
1169
+ branch?: string | undefined;
1170
+ detached: boolean;
1171
+ bare: boolean;
1172
+ locked: boolean;
1173
+ /** True when the folder of the working tree is gone */
1174
+ prunable: boolean;
1175
+ }
1176
+
1177
+ export interface GitWorktreeListOutput {
1178
+ worktrees: GitWorktreeInfo[];
1179
+ }
1180
+
1181
+ export const GitWorktreeAddInputSchema: z.ZodObject<{
1182
+ path: z.ZodString;
1183
+ ref: z.ZodOptional<z.ZodString>;
1184
+ branch: z.ZodOptional<z.ZodString>;
1185
+ detach: z.ZodOptional<z.ZodBoolean>;
1186
+ cwd: z.ZodOptional<z.ZodString>;
1187
+ }> = z.object({
1188
+ path: z.string().describe("The folder of the new working tree. It must not exist, or it must be empty"),
1189
+ ref: z.string().optional().describe("The branch or the commit to check out (default: HEAD)"),
1190
+ branch: z.string().optional().describe("Make this new branch at the ref, and check it out"),
1191
+ detach: z.boolean().optional().describe("Check out the commit of the ref without a branch (default: false)"),
1192
+ cwd: z.string().optional().describe("Working directory"),
1193
+ });
1194
+
1195
+ export type GitWorktreeAddInput = z.infer<typeof GitWorktreeAddInputSchema>;
1196
+
1197
+ export interface GitWorktreeAddOutput {
1198
+ /** The absolute path of the new working tree */
1199
+ path: string;
1200
+ /** The commit that is checked out */
1201
+ head: string;
1202
+ /** The branch that is checked out, if there is one */
1203
+ branch?: string | undefined;
1204
+ }
1205
+
1206
+ export const GitWorktreeRemoveInputSchema: z.ZodObject<{
1207
+ path: z.ZodString;
1208
+ force: z.ZodOptional<z.ZodBoolean>;
1209
+ cwd: z.ZodOptional<z.ZodString>;
1210
+ }> = z.object({
1211
+ path: z.string().describe("The folder of the working tree"),
1212
+ force: z.boolean().optional().describe("Remove it also with changes that are not committed. They are lost (default: false)"),
1213
+ cwd: z.string().optional().describe("Working directory"),
1214
+ });
1215
+
1216
+ export type GitWorktreeRemoveInput = z.infer<typeof GitWorktreeRemoveInputSchema>;
1217
+
1218
+ export interface GitWorktreeRemoveOutput {
1219
+ /** The path of the removed working tree */
1220
+ path: string;
1221
+ }
1222
+
1223
+ // =============================================================================
1224
+ // git.branch.* Types - Branches (roadmap R40). They replace git.branch.
1225
+ // =============================================================================
1226
+
1227
+ export const GitBranchListInputSchema: z.ZodObject<{
1228
+ remote: z.ZodOptional<z.ZodBoolean>;
1229
+ cwd: z.ZodOptional<z.ZodString>;
1230
+ }> = z.object({
1231
+ remote: z.boolean().optional().describe("Also list the remote-tracking branches (default: false)"),
1232
+ cwd: z.string().optional().describe("Working directory"),
1233
+ });
1234
+
1235
+ export type GitBranchListInput = z.infer<typeof GitBranchListInputSchema>;
1236
+
1237
+ export interface GitBranchListOutput {
1238
+ branches: GitBranchInfo[];
1239
+ /** The current branch ("HEAD" when detached). A repository without commits has it too. */
1240
+ current: string;
1241
+ }
1242
+
1243
+ export const GitBranchAddInputSchema: z.ZodObject<{
1244
+ name: z.ZodString;
1245
+ startPoint: z.ZodOptional<z.ZodString>;
1246
+ cwd: z.ZodOptional<z.ZodString>;
1247
+ }> = z.object({
1248
+ name: z.string().describe("The branch name"),
1249
+ startPoint: z.string().optional().describe("The commit of the new branch (default: HEAD)"),
1250
+ cwd: z.string().optional().describe("Working directory"),
1251
+ });
1252
+
1253
+ export type GitBranchAddInput = z.infer<typeof GitBranchAddInputSchema>;
1254
+
1255
+ export interface GitBranchAddOutput {
1256
+ name: string;
1257
+ /** The commit of the new branch */
1258
+ hash: string;
1259
+ }
1260
+
1261
+ export const GitBranchDeleteInputSchema: z.ZodObject<{
1262
+ name: z.ZodString;
1263
+ force: z.ZodOptional<z.ZodBoolean>;
1264
+ cwd: z.ZodOptional<z.ZodString>;
1265
+ }> = z.object({
1266
+ name: z.string().describe("The branch name"),
1267
+ force: z.boolean().optional().describe("Delete it also when it is not merged. Its commits can be lost (default: false)"),
1268
+ cwd: z.string().optional().describe("Working directory"),
1269
+ });
1270
+
1271
+ export type GitBranchDeleteInput = z.infer<typeof GitBranchDeleteInputSchema>;
1272
+
1273
+ export interface GitBranchDeleteOutput {
1274
+ name: string;
1275
+ /** The last commit of the deleted branch: git.branch.add with it makes the branch again */
1276
+ hash: string;
1277
+ }
1278
+
1279
+ // =============================================================================
1280
+ // Output schemas of the procedures of roadmap R40
1281
+ // =============================================================================
1282
+
1283
+ const diffFile = z.looseObject({
1284
+ path: z.string().describe("The path of the file (for a rename, the new path)"),
1285
+ from: z.string().optional().describe("For a rename, the old path"),
1286
+ additions: z.number().describe("The added lines (0 for a binary file)"),
1287
+ deletions: z.number().describe("The deleted lines (0 for a binary file)"),
1288
+ });
1289
+
1290
+ export const GitShowOutputSchema: z.ZodType<GitShowOutput> = z.looseObject({
1291
+ ref: z.string().describe("The ref of the input"),
1292
+ hash: z.string().describe("The hash of the commit"),
1293
+ shortHash: z.string().optional().describe("The short hash"),
1294
+ author: z.string().optional().describe("The author name"),
1295
+ email: z.string().optional().describe("The author email"),
1296
+ date: z.string().optional().describe("The author date"),
1297
+ message: z.string().optional().describe("The subject of the commit message"),
1298
+ body: z.string().optional().describe("The commit message after the subject"),
1299
+ files: z.array(diffFile).optional().describe("The changed files, against the first parent"),
1300
+ additions: z.number().optional().describe("The added lines of all files"),
1301
+ deletions: z.number().optional().describe("The deleted lines of all files"),
1302
+ diff: z.string().optional().describe("The text of the diff"),
1303
+ path: z.string().optional().describe("With path: the file"),
1304
+ content: z.string().optional().describe("With path: the content of the file at the commit"),
1305
+ });
1306
+
1307
+ export const GitBlameOutputSchema: z.ZodType<GitBlameOutput> = z.looseObject({
1308
+ path: z.string().describe("The file"),
1309
+ lines: z
1310
+ .array(
1311
+ z.looseObject({
1312
+ line: z.number().describe("The line number (1 is the first line)"),
1313
+ hash: z.string().describe("The commit that last changed the line (zeros when it is not committed)"),
1314
+ author: z.string().describe("The author name"),
1315
+ email: z.string().describe("The author email"),
1316
+ date: z.string().describe("The author date, as an ISO 8601 string"),
1317
+ summary: z.string().describe("The subject of the commit"),
1318
+ content: z.string().describe("The text of the line"),
1319
+ })
1320
+ )
1321
+ .describe("The lines of the file"),
1322
+ });
1323
+
1324
+ export const GitTagListOutputSchema: z.ZodType<GitTagListOutput> = z.looseObject({
1325
+ tags: z
1326
+ .array(
1327
+ z.looseObject({
1328
+ name: z.string().describe("The tag name"),
1329
+ hash: z.string().describe("The commit of the tag"),
1330
+ annotated: z.boolean().describe("True for an annotated tag"),
1331
+ message: z.string().optional().describe("For an annotated tag: the subject of its message"),
1332
+ })
1333
+ )
1334
+ .describe("The tags, sorted by name"),
1335
+ });
1336
+
1337
+ export const GitTagAddOutputSchema: z.ZodType<GitTagAddOutput> = z.looseObject({
1338
+ name: z.string().describe("The tag name"),
1339
+ hash: z.string().describe("The commit of the tag"),
1340
+ annotated: z.boolean().describe("True for an annotated tag"),
1341
+ });
1342
+
1343
+ export const GitTagDeleteOutputSchema: z.ZodType<GitTagDeleteOutput> = z.looseObject({
1344
+ name: z.string().describe("The tag name"),
1345
+ hash: z.string().describe("The object of the deleted tag"),
1346
+ });
1347
+
1348
+ export const GitRevParseOutputSchema: z.ZodType<GitRevParseOutput> = z.looseObject({
1349
+ ref: z.string().describe("The ref of the input"),
1350
+ value: z.string().describe("The hash, the short hash or the short name"),
1351
+ });
1352
+
1353
+ export const GitResetOutputSchema: z.ZodType<GitResetOutput> = z.looseObject({
1354
+ ref: z.string().describe("The commit of the reset"),
1355
+ mode: z.enum(["soft", "mixed", "hard", "merge", "keep"]).describe("The mode of the reset"),
1356
+ hash: z.string().describe("HEAD after the reset"),
1357
+ });
1358
+
1359
+ export const GitRestoreOutputSchema: z.ZodType<GitRestoreOutput> = z.looseObject({
1360
+ restored: z.array(z.string()).describe("The paths of the input"),
1361
+ });
1362
+
1363
+ export const GitMergeOutputSchema: z.ZodType<GitMergeOutput> = z.looseObject({
1364
+ ref: z.string().describe("The ref of the input"),
1365
+ hash: z.string().describe("HEAD after the call"),
1366
+ fastForward: z.boolean().describe("True for a fast-forward"),
1367
+ upToDate: z.boolean().describe("True when nothing changed"),
1368
+ conflict: z.boolean().describe("True when the merge stopped on conflicts"),
1369
+ conflicts: z.array(z.string()).optional().describe("The files with conflicts"),
1370
+ });
1371
+
1372
+ export const GitMergeAbortOutputSchema: z.ZodType<GitMergeAbortOutput> = z.looseObject({
1373
+ aborted: z.boolean().describe("True when the merge was stopped"),
1374
+ hash: z.string().describe("HEAD after the call"),
1375
+ });
1376
+
1377
+ export const GitRebaseOutputSchema: z.ZodType<GitRebaseOutput> = z.looseObject({
1378
+ hash: z.string().describe("HEAD after the call"),
1379
+ completed: z.boolean().describe("True when the rebase is complete"),
1380
+ upToDate: z.boolean().describe("True when nothing changed"),
1381
+ conflict: z.boolean().describe("True when the rebase stopped on conflicts"),
1382
+ conflicts: z.array(z.string()).optional().describe("The files with conflicts"),
1383
+ });
1384
+
1385
+ export const GitRebaseContinueOutputSchema: z.ZodType<GitRebaseContinueOutput> = GitRebaseOutputSchema;
1386
+
1387
+ export const GitRebaseAbortOutputSchema: z.ZodType<GitRebaseAbortOutput> = z.looseObject({
1388
+ aborted: z.boolean().describe("True when the rebase was stopped"),
1389
+ hash: z.string().describe("HEAD after the call"),
1390
+ });
1391
+
1392
+ export const GitWorktreeListOutputSchema: z.ZodType<GitWorktreeListOutput> = z.looseObject({
1393
+ worktrees: z
1394
+ .array(
1395
+ z.looseObject({
1396
+ path: z.string().describe("The absolute path of the working tree"),
1397
+ head: z.string().optional().describe("The commit that is checked out"),
1398
+ branch: z.string().optional().describe("The branch that is checked out"),
1399
+ detached: z.boolean().describe("True without a branch"),
1400
+ bare: z.boolean().describe("True for the bare repository"),
1401
+ locked: z.boolean().describe("True when the working tree is locked"),
1402
+ prunable: z.boolean().describe("True when the folder of the working tree is gone"),
1403
+ })
1404
+ )
1405
+ .describe("The working trees: the main one first"),
1406
+ });
1407
+
1408
+ export const GitWorktreeAddOutputSchema: z.ZodType<GitWorktreeAddOutput> = z.looseObject({
1409
+ path: z.string().describe("The absolute path of the new working tree"),
1410
+ head: z.string().describe("The commit that is checked out"),
1411
+ branch: z.string().optional().describe("The branch that is checked out"),
1412
+ });
1413
+
1414
+ export const GitWorktreeRemoveOutputSchema: z.ZodType<GitWorktreeRemoveOutput> = z.looseObject({
1415
+ path: z.string().describe("The path of the removed working tree"),
1416
+ });
1417
+
1418
+ const branchInfo = z.looseObject({
1419
+ name: z.string().describe("The branch name"),
1420
+ current: z.boolean().describe("True for the current branch"),
1421
+ remote: z.boolean().describe("True for a remote-tracking branch"),
1422
+ tracking: z.string().optional().describe("The upstream of the branch"),
1423
+ });
1424
+
1425
+ export const GitBranchListOutputSchema: z.ZodType<GitBranchListOutput> = z.looseObject({
1426
+ branches: z.array(branchInfo).describe("The branches"),
1427
+ current: z.string().describe('The current branch ("HEAD" when detached)'),
1428
+ });
1429
+
1430
+ export const GitBranchAddOutputSchema: z.ZodType<GitBranchAddOutput> = z.looseObject({
1431
+ name: z.string().describe("The branch name"),
1432
+ hash: z.string().describe("The commit of the new branch"),
1433
+ });
1434
+
1435
+ export const GitBranchDeleteOutputSchema: z.ZodType<GitBranchDeleteOutput> = z.looseObject({
1436
+ name: z.string().describe("The branch name"),
1437
+ hash: z.string().describe("The last commit of the deleted branch"),
1438
+ });