@sourcebot/mcp 1.0.12 → 1.0.13
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/CHANGELOG.md +13 -0
- package/README.md +18 -0
- package/dist/client.d.ts +124 -4
- package/dist/client.js +63 -23
- package/dist/client.js.map +1 -1
- package/dist/index.js +78 -99
- package/dist/index.js.map +1 -1
- package/dist/schemas.d.ts +128 -34
- package/dist/schemas.js +94 -15
- package/dist/schemas.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +4 -2
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +4 -0
- package/dist/utils.js +7 -0
- package/dist/utils.js.map +1 -1
- package/package.json +2 -1
package/dist/schemas.d.ts
CHANGED
|
@@ -352,7 +352,8 @@ export declare const searchResponseSchema: z.ZodObject<{
|
|
|
352
352
|
};
|
|
353
353
|
}[];
|
|
354
354
|
}>;
|
|
355
|
-
webUrl: z.
|
|
355
|
+
webUrl: z.ZodString;
|
|
356
|
+
externalWebUrl: z.ZodOptional<z.ZodString>;
|
|
356
357
|
repository: z.ZodString;
|
|
357
358
|
repositoryId: z.ZodNumber;
|
|
358
359
|
language: z.ZodString;
|
|
@@ -507,6 +508,7 @@ export declare const searchResponseSchema: z.ZodObject<{
|
|
|
507
508
|
branches: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
508
509
|
content: z.ZodOptional<z.ZodString>;
|
|
509
510
|
}, "strip", z.ZodTypeAny, {
|
|
511
|
+
webUrl: string;
|
|
510
512
|
fileName: {
|
|
511
513
|
text: string;
|
|
512
514
|
matchRanges: {
|
|
@@ -553,10 +555,11 @@ export declare const searchResponseSchema: z.ZodObject<{
|
|
|
553
555
|
} | undefined;
|
|
554
556
|
}[] | undefined;
|
|
555
557
|
}[];
|
|
556
|
-
|
|
558
|
+
externalWebUrl?: string | undefined;
|
|
557
559
|
content?: string | undefined;
|
|
558
560
|
branches?: string[] | undefined;
|
|
559
561
|
}, {
|
|
562
|
+
webUrl: string;
|
|
560
563
|
fileName: {
|
|
561
564
|
text: string;
|
|
562
565
|
matchRanges: {
|
|
@@ -603,7 +606,7 @@ export declare const searchResponseSchema: z.ZodObject<{
|
|
|
603
606
|
} | undefined;
|
|
604
607
|
}[] | undefined;
|
|
605
608
|
}[];
|
|
606
|
-
|
|
609
|
+
externalWebUrl?: string | undefined;
|
|
607
610
|
content?: string | undefined;
|
|
608
611
|
branches?: string[] | undefined;
|
|
609
612
|
}>, "many">;
|
|
@@ -652,6 +655,7 @@ export declare const searchResponseSchema: z.ZodObject<{
|
|
|
652
655
|
flushReason: string;
|
|
653
656
|
};
|
|
654
657
|
files: {
|
|
658
|
+
webUrl: string;
|
|
655
659
|
fileName: {
|
|
656
660
|
text: string;
|
|
657
661
|
matchRanges: {
|
|
@@ -698,7 +702,7 @@ export declare const searchResponseSchema: z.ZodObject<{
|
|
|
698
702
|
} | undefined;
|
|
699
703
|
}[] | undefined;
|
|
700
704
|
}[];
|
|
701
|
-
|
|
705
|
+
externalWebUrl?: string | undefined;
|
|
702
706
|
content?: string | undefined;
|
|
703
707
|
branches?: string[] | undefined;
|
|
704
708
|
}[];
|
|
@@ -735,6 +739,7 @@ export declare const searchResponseSchema: z.ZodObject<{
|
|
|
735
739
|
flushReason: string;
|
|
736
740
|
};
|
|
737
741
|
files: {
|
|
742
|
+
webUrl: string;
|
|
738
743
|
fileName: {
|
|
739
744
|
text: string;
|
|
740
745
|
matchRanges: {
|
|
@@ -781,7 +786,7 @@ export declare const searchResponseSchema: z.ZodObject<{
|
|
|
781
786
|
} | undefined;
|
|
782
787
|
}[] | undefined;
|
|
783
788
|
}[];
|
|
784
|
-
|
|
789
|
+
externalWebUrl?: string | undefined;
|
|
785
790
|
content?: string | undefined;
|
|
786
791
|
branches?: string[] | undefined;
|
|
787
792
|
}[];
|
|
@@ -799,92 +804,128 @@ export declare const repositoryQuerySchema: z.ZodObject<{
|
|
|
799
804
|
repoId: z.ZodNumber;
|
|
800
805
|
repoName: z.ZodString;
|
|
801
806
|
repoDisplayName: z.ZodOptional<z.ZodString>;
|
|
802
|
-
|
|
803
|
-
|
|
807
|
+
webUrl: z.ZodString;
|
|
808
|
+
externalWebUrl: z.ZodOptional<z.ZodString>;
|
|
804
809
|
imageUrl: z.ZodOptional<z.ZodString>;
|
|
805
810
|
indexedAt: z.ZodOptional<z.ZodDate>;
|
|
811
|
+
pushedAt: z.ZodOptional<z.ZodDate>;
|
|
806
812
|
}, "strip", z.ZodTypeAny, {
|
|
807
813
|
codeHostType: string;
|
|
814
|
+
webUrl: string;
|
|
808
815
|
repoId: number;
|
|
809
816
|
repoName: string;
|
|
810
|
-
|
|
811
|
-
webUrl?: string | undefined;
|
|
817
|
+
externalWebUrl?: string | undefined;
|
|
812
818
|
repoDisplayName?: string | undefined;
|
|
813
819
|
imageUrl?: string | undefined;
|
|
814
820
|
indexedAt?: Date | undefined;
|
|
821
|
+
pushedAt?: Date | undefined;
|
|
815
822
|
}, {
|
|
816
823
|
codeHostType: string;
|
|
824
|
+
webUrl: string;
|
|
817
825
|
repoId: number;
|
|
818
826
|
repoName: string;
|
|
819
|
-
|
|
820
|
-
webUrl?: string | undefined;
|
|
827
|
+
externalWebUrl?: string | undefined;
|
|
821
828
|
repoDisplayName?: string | undefined;
|
|
822
829
|
imageUrl?: string | undefined;
|
|
823
830
|
indexedAt?: Date | undefined;
|
|
831
|
+
pushedAt?: Date | undefined;
|
|
824
832
|
}>;
|
|
825
|
-
export declare const
|
|
833
|
+
export declare const listReposResponseSchema: z.ZodArray<z.ZodObject<{
|
|
826
834
|
codeHostType: z.ZodString;
|
|
827
835
|
repoId: z.ZodNumber;
|
|
828
836
|
repoName: z.ZodString;
|
|
829
837
|
repoDisplayName: z.ZodOptional<z.ZodString>;
|
|
830
|
-
|
|
831
|
-
|
|
838
|
+
webUrl: z.ZodString;
|
|
839
|
+
externalWebUrl: z.ZodOptional<z.ZodString>;
|
|
832
840
|
imageUrl: z.ZodOptional<z.ZodString>;
|
|
833
841
|
indexedAt: z.ZodOptional<z.ZodDate>;
|
|
842
|
+
pushedAt: z.ZodOptional<z.ZodDate>;
|
|
834
843
|
}, "strip", z.ZodTypeAny, {
|
|
835
844
|
codeHostType: string;
|
|
845
|
+
webUrl: string;
|
|
836
846
|
repoId: number;
|
|
837
847
|
repoName: string;
|
|
838
|
-
|
|
839
|
-
webUrl?: string | undefined;
|
|
848
|
+
externalWebUrl?: string | undefined;
|
|
840
849
|
repoDisplayName?: string | undefined;
|
|
841
850
|
imageUrl?: string | undefined;
|
|
842
851
|
indexedAt?: Date | undefined;
|
|
852
|
+
pushedAt?: Date | undefined;
|
|
843
853
|
}, {
|
|
844
854
|
codeHostType: string;
|
|
855
|
+
webUrl: string;
|
|
845
856
|
repoId: number;
|
|
846
857
|
repoName: string;
|
|
847
|
-
|
|
848
|
-
webUrl?: string | undefined;
|
|
858
|
+
externalWebUrl?: string | undefined;
|
|
849
859
|
repoDisplayName?: string | undefined;
|
|
850
860
|
imageUrl?: string | undefined;
|
|
851
861
|
indexedAt?: Date | undefined;
|
|
862
|
+
pushedAt?: Date | undefined;
|
|
852
863
|
}>, "many">;
|
|
853
|
-
export declare const
|
|
864
|
+
export declare const listReposQueryParamsSchema: z.ZodObject<{
|
|
854
865
|
query: z.ZodOptional<z.ZodString>;
|
|
855
|
-
|
|
856
|
-
|
|
866
|
+
page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
867
|
+
perPage: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
868
|
+
sort: z.ZodDefault<z.ZodOptional<z.ZodEnum<["name", "pushed"]>>>;
|
|
869
|
+
direction: z.ZodDefault<z.ZodOptional<z.ZodEnum<["asc", "desc"]>>>;
|
|
857
870
|
}, "strip", z.ZodTypeAny, {
|
|
858
|
-
|
|
859
|
-
|
|
871
|
+
sort: "name" | "pushed";
|
|
872
|
+
page: number;
|
|
873
|
+
perPage: number;
|
|
874
|
+
direction: "asc" | "desc";
|
|
860
875
|
query?: string | undefined;
|
|
861
876
|
}, {
|
|
877
|
+
sort?: "name" | "pushed" | undefined;
|
|
862
878
|
query?: string | undefined;
|
|
863
|
-
|
|
864
|
-
|
|
879
|
+
page?: number | undefined;
|
|
880
|
+
perPage?: number | undefined;
|
|
881
|
+
direction?: "asc" | "desc" | undefined;
|
|
865
882
|
}>;
|
|
866
883
|
export declare const fileSourceRequestSchema: z.ZodObject<{
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
884
|
+
repo: z.ZodString;
|
|
885
|
+
path: z.ZodString;
|
|
886
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
870
887
|
}, "strip", z.ZodTypeAny, {
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
888
|
+
path: string;
|
|
889
|
+
repo: string;
|
|
890
|
+
ref?: string | undefined;
|
|
874
891
|
}, {
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
892
|
+
path: string;
|
|
893
|
+
repo: string;
|
|
894
|
+
ref?: string | undefined;
|
|
878
895
|
}>;
|
|
879
896
|
export declare const fileSourceResponseSchema: z.ZodObject<{
|
|
880
897
|
source: z.ZodString;
|
|
881
898
|
language: z.ZodString;
|
|
899
|
+
path: z.ZodString;
|
|
900
|
+
repo: z.ZodString;
|
|
901
|
+
repoCodeHostType: z.ZodString;
|
|
902
|
+
repoDisplayName: z.ZodOptional<z.ZodString>;
|
|
903
|
+
repoExternalWebUrl: z.ZodOptional<z.ZodString>;
|
|
904
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
905
|
+
webUrl: z.ZodString;
|
|
906
|
+
externalWebUrl: z.ZodOptional<z.ZodString>;
|
|
882
907
|
}, "strip", z.ZodTypeAny, {
|
|
908
|
+
path: string;
|
|
883
909
|
source: string;
|
|
910
|
+
webUrl: string;
|
|
884
911
|
language: string;
|
|
912
|
+
repo: string;
|
|
913
|
+
repoCodeHostType: string;
|
|
914
|
+
externalWebUrl?: string | undefined;
|
|
915
|
+
repoDisplayName?: string | undefined;
|
|
916
|
+
repoExternalWebUrl?: string | undefined;
|
|
917
|
+
branch?: string | undefined;
|
|
885
918
|
}, {
|
|
919
|
+
path: string;
|
|
886
920
|
source: string;
|
|
921
|
+
webUrl: string;
|
|
887
922
|
language: string;
|
|
923
|
+
repo: string;
|
|
924
|
+
repoCodeHostType: string;
|
|
925
|
+
externalWebUrl?: string | undefined;
|
|
926
|
+
repoDisplayName?: string | undefined;
|
|
927
|
+
repoExternalWebUrl?: string | undefined;
|
|
928
|
+
branch?: string | undefined;
|
|
888
929
|
}>;
|
|
889
930
|
export declare const serviceErrorSchema: z.ZodObject<{
|
|
890
931
|
statusCode: z.ZodNumber;
|
|
@@ -899,3 +940,56 @@ export declare const serviceErrorSchema: z.ZodObject<{
|
|
|
899
940
|
statusCode: number;
|
|
900
941
|
errorCode: string;
|
|
901
942
|
}>;
|
|
943
|
+
export declare const listCommitsQueryParamsSchema: z.ZodObject<{
|
|
944
|
+
repo: z.ZodString;
|
|
945
|
+
query: z.ZodOptional<z.ZodString>;
|
|
946
|
+
since: z.ZodOptional<z.ZodString>;
|
|
947
|
+
until: z.ZodOptional<z.ZodString>;
|
|
948
|
+
author: z.ZodOptional<z.ZodString>;
|
|
949
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
950
|
+
page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
951
|
+
perPage: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
952
|
+
}, "strip", z.ZodTypeAny, {
|
|
953
|
+
page: number;
|
|
954
|
+
perPage: number;
|
|
955
|
+
repo: string;
|
|
956
|
+
query?: string | undefined;
|
|
957
|
+
ref?: string | undefined;
|
|
958
|
+
since?: string | undefined;
|
|
959
|
+
until?: string | undefined;
|
|
960
|
+
author?: string | undefined;
|
|
961
|
+
}, {
|
|
962
|
+
repo: string;
|
|
963
|
+
query?: string | undefined;
|
|
964
|
+
page?: number | undefined;
|
|
965
|
+
perPage?: number | undefined;
|
|
966
|
+
ref?: string | undefined;
|
|
967
|
+
since?: string | undefined;
|
|
968
|
+
until?: string | undefined;
|
|
969
|
+
author?: string | undefined;
|
|
970
|
+
}>;
|
|
971
|
+
export declare const listCommitsResponseSchema: z.ZodArray<z.ZodObject<{
|
|
972
|
+
hash: z.ZodString;
|
|
973
|
+
date: z.ZodString;
|
|
974
|
+
message: z.ZodString;
|
|
975
|
+
refs: z.ZodString;
|
|
976
|
+
body: z.ZodString;
|
|
977
|
+
author_name: z.ZodString;
|
|
978
|
+
author_email: z.ZodString;
|
|
979
|
+
}, "strip", z.ZodTypeAny, {
|
|
980
|
+
message: string;
|
|
981
|
+
date: string;
|
|
982
|
+
hash: string;
|
|
983
|
+
refs: string;
|
|
984
|
+
body: string;
|
|
985
|
+
author_name: string;
|
|
986
|
+
author_email: string;
|
|
987
|
+
}, {
|
|
988
|
+
message: string;
|
|
989
|
+
date: string;
|
|
990
|
+
hash: string;
|
|
991
|
+
refs: string;
|
|
992
|
+
body: string;
|
|
993
|
+
author_name: string;
|
|
994
|
+
author_email: string;
|
|
995
|
+
}>, "many">;
|
package/dist/schemas.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @NOTE : Please keep this file in sync with @sourcebot/web/src/features/search/
|
|
1
|
+
// @NOTE : Please keep this file in sync with @sourcebot/web/src/features/search/types.ts
|
|
2
2
|
// At some point, we should move these to a shared package...
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
export const locationSchema = z.object({
|
|
@@ -96,7 +96,8 @@ export const searchResponseSchema = z.object({
|
|
|
96
96
|
// Any matching ranges
|
|
97
97
|
matchRanges: z.array(rangeSchema),
|
|
98
98
|
}),
|
|
99
|
-
webUrl: z.string()
|
|
99
|
+
webUrl: z.string(),
|
|
100
|
+
externalWebUrl: z.string().optional(),
|
|
100
101
|
repository: z.string(),
|
|
101
102
|
repositoryId: z.number(),
|
|
102
103
|
language: z.string(),
|
|
@@ -121,42 +122,120 @@ export const repositoryQuerySchema = z.object({
|
|
|
121
122
|
repoId: z.number(),
|
|
122
123
|
repoName: z.string(),
|
|
123
124
|
repoDisplayName: z.string().optional(),
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
webUrl: z.string(),
|
|
126
|
+
externalWebUrl: z.string().optional(),
|
|
126
127
|
imageUrl: z.string().optional(),
|
|
127
128
|
indexedAt: z.coerce.date().optional(),
|
|
129
|
+
pushedAt: z.coerce.date().optional(),
|
|
128
130
|
});
|
|
129
|
-
export const
|
|
130
|
-
export const
|
|
131
|
+
export const listReposResponseSchema = repositoryQuerySchema.array();
|
|
132
|
+
export const listReposQueryParamsSchema = z.object({
|
|
131
133
|
query: z
|
|
132
134
|
.string()
|
|
133
|
-
.describe("Filter repositories by name
|
|
135
|
+
.describe("Filter repositories by name (case-insensitive)")
|
|
134
136
|
.optional(),
|
|
135
|
-
|
|
137
|
+
page: z
|
|
136
138
|
.number()
|
|
137
139
|
.int()
|
|
138
140
|
.positive()
|
|
139
|
-
.describe("Page number (1
|
|
141
|
+
.describe("Page number for pagination (min 1). Default: 1")
|
|
142
|
+
.optional()
|
|
140
143
|
.default(1),
|
|
141
|
-
|
|
144
|
+
perPage: z
|
|
142
145
|
.number()
|
|
143
146
|
.int()
|
|
144
147
|
.positive()
|
|
145
|
-
.
|
|
146
|
-
.
|
|
148
|
+
.max(100)
|
|
149
|
+
.describe("Results per page for pagination (min 1, max 100). Default: 30")
|
|
150
|
+
.optional()
|
|
151
|
+
.default(30),
|
|
152
|
+
sort: z
|
|
153
|
+
.enum(['name', 'pushed'])
|
|
154
|
+
.describe("Sort repositories by 'name' or 'pushed' (most recent commit). Default: 'name'")
|
|
155
|
+
.optional()
|
|
156
|
+
.default('name'),
|
|
157
|
+
direction: z
|
|
158
|
+
.enum(['asc', 'desc'])
|
|
159
|
+
.describe("Sort direction: 'asc' or 'desc'. Default: 'asc'")
|
|
160
|
+
.optional()
|
|
161
|
+
.default('asc'),
|
|
147
162
|
});
|
|
148
163
|
export const fileSourceRequestSchema = z.object({
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
164
|
+
repo: z
|
|
165
|
+
.string()
|
|
166
|
+
.describe("The repository name."),
|
|
167
|
+
path: z
|
|
168
|
+
.string()
|
|
169
|
+
.describe("The path to the file."),
|
|
170
|
+
ref: z
|
|
171
|
+
.string()
|
|
172
|
+
.optional()
|
|
173
|
+
.describe("Commit SHA, branch or tag name to fetch the source code for. If not provided, uses the default branch of the repository."),
|
|
152
174
|
});
|
|
153
175
|
export const fileSourceResponseSchema = z.object({
|
|
154
176
|
source: z.string(),
|
|
155
177
|
language: z.string(),
|
|
178
|
+
path: z.string(),
|
|
179
|
+
repo: z.string(),
|
|
180
|
+
repoCodeHostType: z.string(),
|
|
181
|
+
repoDisplayName: z.string().optional(),
|
|
182
|
+
repoExternalWebUrl: z.string().optional(),
|
|
183
|
+
branch: z.string().optional(),
|
|
184
|
+
webUrl: z.string(),
|
|
185
|
+
externalWebUrl: z.string().optional(),
|
|
156
186
|
});
|
|
157
187
|
export const serviceErrorSchema = z.object({
|
|
158
188
|
statusCode: z.number(),
|
|
159
189
|
errorCode: z.string(),
|
|
160
190
|
message: z.string(),
|
|
161
191
|
});
|
|
192
|
+
export const listCommitsQueryParamsSchema = z.object({
|
|
193
|
+
repo: z
|
|
194
|
+
.string()
|
|
195
|
+
.describe("The name of the repository to list commits for."),
|
|
196
|
+
query: z
|
|
197
|
+
.string()
|
|
198
|
+
.describe("Search query to filter commits by message content (case-insensitive).")
|
|
199
|
+
.optional(),
|
|
200
|
+
since: z
|
|
201
|
+
.string()
|
|
202
|
+
.describe(`Show commits more recent than this date. Filters by actual commit time. Supports ISO 8601 (e.g., '2024-01-01') or relative formats (e.g., '30 days ago', 'last week').`)
|
|
203
|
+
.optional(),
|
|
204
|
+
until: z
|
|
205
|
+
.string()
|
|
206
|
+
.describe(`Show commits older than this date. Filters by actual commit time. Supports ISO 8601 (e.g., '2024-12-31') or relative formats (e.g., 'yesterday').`)
|
|
207
|
+
.optional(),
|
|
208
|
+
author: z
|
|
209
|
+
.string()
|
|
210
|
+
.describe(`Filter commits by author name or email (case-insensitive).`)
|
|
211
|
+
.optional(),
|
|
212
|
+
ref: z
|
|
213
|
+
.string()
|
|
214
|
+
.describe("Commit SHA, branch or tag name to list commits of. If not provided, uses the default branch of the repository.")
|
|
215
|
+
.optional(),
|
|
216
|
+
page: z
|
|
217
|
+
.number()
|
|
218
|
+
.int()
|
|
219
|
+
.positive()
|
|
220
|
+
.describe("Page number for pagination (min 1). Default: 1")
|
|
221
|
+
.optional()
|
|
222
|
+
.default(1),
|
|
223
|
+
perPage: z
|
|
224
|
+
.number()
|
|
225
|
+
.int()
|
|
226
|
+
.positive()
|
|
227
|
+
.max(100)
|
|
228
|
+
.describe("Results per page for pagination (min 1, max 100). Default: 50")
|
|
229
|
+
.optional()
|
|
230
|
+
.default(50),
|
|
231
|
+
});
|
|
232
|
+
export const listCommitsResponseSchema = z.array(z.object({
|
|
233
|
+
hash: z.string(),
|
|
234
|
+
date: z.string(),
|
|
235
|
+
message: z.string(),
|
|
236
|
+
refs: z.string(),
|
|
237
|
+
body: z.string(),
|
|
238
|
+
author_name: z.string(),
|
|
239
|
+
author_email: z.string(),
|
|
240
|
+
}));
|
|
162
241
|
//# sourceMappingURL=schemas.js.map
|
package/dist/schemas.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,6DAA6D;AAC7D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,qDAAqD;IACrD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,qDAAqD;IACrD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,8DAA8D;IAC9D,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;C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QAAQ,CAAC,+CAA+C,CAAC;SACzD,OAAO,CAAC,EAAE,CAAC;CACnB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;CACvB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC","sourcesContent":["// @NOTE : Please keep this file in sync with @sourcebot/web/src/features/search/schemas.ts\n// At some point, we should move these to a shared package...\nimport { z } from \"zod\";\n\nexport const locationSchema = z.object({\n // 0-based byte offset from the beginning of the file\n byteOffset: z.number(),\n // 1-based line number from the beginning of the file\n lineNumber: z.number(),\n // 1-based column number (in runes) from the beginning of line\n column: z.number(),\n});\n\nexport const rangeSchema = z.object({\n start: locationSchema,\n end: locationSchema,\n});\n\nexport const symbolSchema = z.object({\n symbol: z.string(),\n kind: z.string(),\n});\n\nexport const searchOptionsSchema = z.object({\n matches: z.number(), // The number of matches to return.\n contextLines: z.number().optional(), // The number of context lines to return.\n whole: z.boolean().optional(), // Whether to return the whole file as part of the response.\n isRegexEnabled: z.boolean().optional(), // Whether to enable regular expression search.\n isCaseSensitivityEnabled: z.boolean().optional(), // Whether to enable case sensitivity.\n});\n\nexport const searchRequestSchema = z.object({\n query: z.string(), // The zoekt query to execute.\n source: z.string().optional(), // The source of the search request.\n ...searchOptionsSchema.shape,\n});\n\nexport const repositoryInfoSchema = z.object({\n id: z.number(),\n codeHostType: z.string(),\n name: z.string(),\n displayName: z.string().optional(),\n webUrl: z.string().optional(),\n});\n\n// Many of these fields are defined in zoekt/api.go.\nexport const searchStatsSchema = z.object({\n // The actual number of matches returned by the search.\n // This will always be less than or equal to `totalMatchCount`.\n actualMatchCount: z.number(),\n\n // The total number of matches found during the search.\n totalMatchCount: z.number(),\n\n // The duration (in nanoseconds) of the search.\n duration: z.number(),\n\n // Number of files containing a match.\n fileCount: z.number(),\n\n // Candidate files whose contents weren't examined because we\n // gathered enough matches.\n filesSkipped: z.number(),\n\n // Amount of I/O for reading contents.\n contentBytesLoaded: z.number(),\n\n // Amount of I/O for reading from index.\n indexBytesLoaded: z.number(),\n\n // Number of search shards that had a crash.\n crashes: z.number(),\n\n // Number of files in shards that we considered.\n shardFilesConsidered: z.number(),\n\n // Files that we evaluated. Equivalent to files for which all\n // atom matches (including negations) evaluated to true.\n filesConsidered: z.number(),\n\n // Files for which we loaded file content to verify substring matches\n filesLoaded: z.number(),\n\n // Shards that we scanned to find matches.\n shardsScanned: z.number(),\n\n // Shards that we did not process because a query was canceled.\n shardsSkipped: z.number(),\n\n // Shards that we did not process because the query was rejected by the\n // ngram filter indicating it had no matches.\n shardsSkippedFilter: z.number(),\n\n // Number of candidate matches as a result of searching ngrams.\n ngramMatches: z.number(),\n\n // NgramLookups is the number of times we accessed an ngram in the index.\n ngramLookups: z.number(),\n\n // Wall clock time for queued search.\n wait: z.number(),\n\n // Aggregate wall clock time spent constructing and pruning the match tree.\n // This accounts for time such as lookups in the trigram index.\n matchTreeConstruction: z.number(),\n\n // Aggregate wall clock time spent searching the match tree. This accounts\n // for the bulk of search work done looking for matches.\n matchTreeSearch: z.number(),\n\n // Number of times regexp was called on files that we evaluated.\n regexpsConsidered: z.number(),\n\n // FlushReason explains why results were flushed.\n flushReason: z.string(),\n});\n\nexport const searchResponseSchema = z.object({\n stats: searchStatsSchema,\n files: z.array(z.object({\n fileName: z.object({\n // The name of the file\n text: z.string(),\n // Any matching ranges\n matchRanges: z.array(rangeSchema),\n }),\n webUrl: z.string().optional(),\n repository: z.string(),\n repositoryId: z.number(),\n language: z.string(),\n chunks: z.array(z.object({\n content: z.string(),\n matchRanges: z.array(rangeSchema),\n contentStart: locationSchema,\n symbols: z.array(z.object({\n ...symbolSchema.shape,\n parent: symbolSchema.optional(),\n })).optional(),\n })),\n branches: z.array(z.string()).optional(),\n // Set if `whole` is true.\n content: z.string().optional(),\n })),\n repositoryInfo: z.array(repositoryInfoSchema),\n isSearchExhaustive: z.boolean(),\n});\n\nexport const repositoryQuerySchema = z.object({\n codeHostType: z.string(),\n repoId: z.number(),\n repoName: z.string(),\n repoDisplayName: z.string().optional(),\n repoCloneUrl: z.string(),\n webUrl: z.string().optional(),\n imageUrl: z.string().optional(),\n indexedAt: z.coerce.date().optional(),\n});\n\nexport const listRepositoriesResponseSchema = repositoryQuerySchema.array();\n\nexport const listReposRequestSchema = z.object({\n query: z\n .string()\n .describe(\"Filter repositories by name or displayName (case-insensitive)\")\n .optional(),\n pageNumber: z\n .number()\n .int()\n .positive()\n .describe(\"Page number (1-indexed, default: 1)\")\n .default(1),\n limit: z\n .number()\n .int()\n .positive()\n .describe(\"Number of repositories per page (default: 50)\")\n .default(50),\n});\n\nexport const fileSourceRequestSchema = z.object({\n fileName: z.string(),\n repository: z.string(),\n branch: z.string().optional(),\n});\n\nexport const fileSourceResponseSchema = z.object({\n source: z.string(),\n language: z.string(),\n});\n\nexport const serviceErrorSchema = z.object({\n statusCode: z.number(),\n errorCode: z.string(),\n message: z.string(),\n});\n"]}
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,6DAA6D;AAC7D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC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,EAAE;SACR,QAAQ,CAAC,gHAAgH,CAAC;SAC1H,QAAQ,EAAE;IACf,IAAI,EAAE,CAAC;SACF,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,QAAQ,CAAC,gDAAgD,CAAC;SAC1D,QAAQ,EAAE;SACV,OAAO,CAAC,CAAC,CAAC;IACf,OAAO,EAAE,CAAC;SACL,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,CAAC,+DAA+D,CAAC;SACzE,QAAQ,EAAE;SACV,OAAO,CAAC,EAAE,CAAC;CACnB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;IACtD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;CAC3B,CAAC,CAAC,CAAC","sourcesContent":["// @NOTE : Please keep this file in sync with @sourcebot/web/src/features/search/types.ts\n// At some point, we should move these to a shared package...\nimport { z } from \"zod\";\n\nexport const locationSchema = z.object({\n // 0-based byte offset from the beginning of the file\n byteOffset: z.number(),\n // 1-based line number from the beginning of the file\n lineNumber: z.number(),\n // 1-based column number (in runes) from the beginning of line\n column: z.number(),\n});\n\nexport const rangeSchema = z.object({\n start: locationSchema,\n end: locationSchema,\n});\n\nexport const symbolSchema = z.object({\n symbol: z.string(),\n kind: z.string(),\n});\n\nexport const searchOptionsSchema = z.object({\n matches: z.number(), // The number of matches to return.\n contextLines: z.number().optional(), // The number of context lines to return.\n whole: z.boolean().optional(), // Whether to return the whole file as part of the response.\n isRegexEnabled: z.boolean().optional(), // Whether to enable regular expression search.\n isCaseSensitivityEnabled: z.boolean().optional(), // Whether to enable case sensitivity.\n});\n\nexport const searchRequestSchema = z.object({\n query: z.string(), // The zoekt query to execute.\n source: z.string().optional(), // The source of the search request.\n ...searchOptionsSchema.shape,\n});\n\nexport const repositoryInfoSchema = z.object({\n id: z.number(),\n codeHostType: z.string(),\n name: z.string(),\n displayName: z.string().optional(),\n webUrl: z.string().optional(),\n});\n\n// Many of these fields are defined in zoekt/api.go.\nexport const searchStatsSchema = z.object({\n // The actual number of matches returned by the search.\n // This will always be less than or equal to `totalMatchCount`.\n actualMatchCount: z.number(),\n\n // The total number of matches found during the search.\n totalMatchCount: z.number(),\n\n // The duration (in nanoseconds) of the search.\n duration: z.number(),\n\n // Number of files containing a match.\n fileCount: z.number(),\n\n // Candidate files whose contents weren't examined because we\n // gathered enough matches.\n filesSkipped: z.number(),\n\n // Amount of I/O for reading contents.\n contentBytesLoaded: z.number(),\n\n // Amount of I/O for reading from index.\n indexBytesLoaded: z.number(),\n\n // Number of search shards that had a crash.\n crashes: z.number(),\n\n // Number of files in shards that we considered.\n shardFilesConsidered: z.number(),\n\n // Files that we evaluated. Equivalent to files for which all\n // atom matches (including negations) evaluated to true.\n filesConsidered: z.number(),\n\n // Files for which we loaded file content to verify substring matches\n filesLoaded: z.number(),\n\n // Shards that we scanned to find matches.\n shardsScanned: z.number(),\n\n // Shards that we did not process because a query was canceled.\n shardsSkipped: z.number(),\n\n // Shards that we did not process because the query was rejected by the\n // ngram filter indicating it had no matches.\n shardsSkippedFilter: z.number(),\n\n // Number of candidate matches as a result of searching ngrams.\n ngramMatches: z.number(),\n\n // NgramLookups is the number of times we accessed an ngram in the index.\n ngramLookups: z.number(),\n\n // Wall clock time for queued search.\n wait: z.number(),\n\n // Aggregate wall clock time spent constructing and pruning the match tree.\n // This accounts for time such as lookups in the trigram index.\n matchTreeConstruction: z.number(),\n\n // Aggregate wall clock time spent searching the match tree. This accounts\n // for the bulk of search work done looking for matches.\n matchTreeSearch: z.number(),\n\n // Number of times regexp was called on files that we evaluated.\n regexpsConsidered: z.number(),\n\n // FlushReason explains why results were flushed.\n flushReason: z.string(),\n});\n\nexport const searchResponseSchema = z.object({\n stats: searchStatsSchema,\n files: z.array(z.object({\n fileName: z.object({\n // The name of the file\n text: z.string(),\n // Any matching ranges\n matchRanges: z.array(rangeSchema),\n }),\n webUrl: z.string(),\n externalWebUrl: z.string().optional(),\n repository: z.string(),\n repositoryId: z.number(),\n language: z.string(),\n chunks: z.array(z.object({\n content: z.string(),\n matchRanges: z.array(rangeSchema),\n contentStart: locationSchema,\n symbols: z.array(z.object({\n ...symbolSchema.shape,\n parent: symbolSchema.optional(),\n })).optional(),\n })),\n branches: z.array(z.string()).optional(),\n // Set if `whole` is true.\n content: z.string().optional(),\n })),\n repositoryInfo: z.array(repositoryInfoSchema),\n isSearchExhaustive: z.boolean(),\n});\n\nexport const repositoryQuerySchema = z.object({\n codeHostType: z.string(),\n repoId: z.number(),\n repoName: z.string(),\n repoDisplayName: z.string().optional(),\n webUrl: z.string(),\n externalWebUrl: z.string().optional(),\n imageUrl: z.string().optional(),\n indexedAt: z.coerce.date().optional(),\n pushedAt: z.coerce.date().optional(),\n});\n\nexport const listReposResponseSchema = repositoryQuerySchema.array();\n\nexport const listReposQueryParamsSchema = z.object({\n query: z\n .string()\n .describe(\"Filter repositories by name (case-insensitive)\")\n .optional(),\n page: z\n .number()\n .int()\n .positive()\n .describe(\"Page number for pagination (min 1). Default: 1\")\n .optional()\n .default(1),\n perPage: z\n .number()\n .int()\n .positive()\n .max(100)\n .describe(\"Results per page for pagination (min 1, max 100). Default: 30\")\n .optional()\n .default(30),\n sort: z\n .enum(['name', 'pushed'])\n .describe(\"Sort repositories by 'name' or 'pushed' (most recent commit). Default: 'name'\")\n .optional()\n .default('name'),\n direction: z\n .enum(['asc', 'desc'])\n .describe(\"Sort direction: 'asc' or 'desc'. Default: 'asc'\")\n .optional()\n .default('asc'),\n});\n\nexport const fileSourceRequestSchema = z.object({\n repo: z\n .string()\n .describe(\"The repository name.\"),\n path: z\n .string()\n .describe(\"The path to the file.\"),\n ref: z\n .string()\n .optional()\n .describe(\"Commit SHA, branch or tag name to fetch the source code for. If not provided, uses the default branch of the repository.\"),\n});\n\nexport const fileSourceResponseSchema = z.object({\n source: z.string(),\n language: z.string(),\n path: z.string(),\n repo: z.string(),\n repoCodeHostType: z.string(),\n repoDisplayName: z.string().optional(),\n repoExternalWebUrl: z.string().optional(),\n branch: z.string().optional(),\n webUrl: z.string(),\n externalWebUrl: z.string().optional(),\n});\n\nexport const serviceErrorSchema = z.object({\n statusCode: z.number(),\n errorCode: z.string(),\n message: z.string(),\n});\n\nexport const listCommitsQueryParamsSchema = z.object({\n repo: z\n .string()\n .describe(\"The name of the repository to list commits for.\"),\n query: z\n .string()\n .describe(\"Search query to filter commits by message content (case-insensitive).\")\n .optional(),\n since: z\n .string()\n .describe(`Show commits more recent than this date. Filters by actual commit time. Supports ISO 8601 (e.g., '2024-01-01') or relative formats (e.g., '30 days ago', 'last week').`)\n .optional(),\n until: z\n .string()\n .describe(`Show commits older than this date. Filters by actual commit time. Supports ISO 8601 (e.g., '2024-12-31') or relative formats (e.g., 'yesterday').`)\n .optional(),\n author: z\n .string()\n .describe(`Filter commits by author name or email (case-insensitive).`)\n .optional(),\n ref: z\n .string()\n .describe(\"Commit SHA, branch or tag name to list commits of. If not provided, uses the default branch of the repository.\")\n .optional(),\n page: z\n .number()\n .int()\n .positive()\n .describe(\"Page number for pagination (min 1). Default: 1\")\n .optional()\n .default(1),\n perPage: z\n .number()\n .int()\n .positive()\n .max(100)\n .describe(\"Results per page for pagination (min 1, max 100). Default: 50\")\n .optional()\n .default(50),\n});\n\nexport const listCommitsResponseSchema = z.array(z.object({\n hash: z.string(),\n date: z.string(),\n message: z.string(),\n refs: z.string(),\n body: z.string(),\n author_name: z.string(),\n author_email: z.string(),\n}));\n"]}
|