@structured-world/gitlab-mcp 6.2.2 → 6.2.3

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 (47) hide show
  1. package/dist/src/entities/core/registry.js +51 -47
  2. package/dist/src/entities/core/registry.js.map +1 -1
  3. package/dist/src/entities/core/schema-readonly.d.ts +38 -93
  4. package/dist/src/entities/core/schema-readonly.js +69 -70
  5. package/dist/src/entities/core/schema-readonly.js.map +1 -1
  6. package/dist/src/entities/core/schema.d.ts +17 -27
  7. package/dist/src/entities/core/schema.js +44 -31
  8. package/dist/src/entities/core/schema.js.map +1 -1
  9. package/dist/src/entities/files/registry.js +25 -15
  10. package/dist/src/entities/files/registry.js.map +1 -1
  11. package/dist/src/entities/files/schema-readonly.d.ts +7 -23
  12. package/dist/src/entities/files/schema-readonly.js +24 -30
  13. package/dist/src/entities/files/schema-readonly.js.map +1 -1
  14. package/dist/src/entities/files/schema.d.ts +14 -62
  15. package/dist/src/entities/files/schema.js +73 -63
  16. package/dist/src/entities/files/schema.js.map +1 -1
  17. package/dist/src/entities/mrs/registry.js +58 -32
  18. package/dist/src/entities/mrs/registry.js.map +1 -1
  19. package/dist/src/entities/mrs/schema-readonly.d.ts +21 -160
  20. package/dist/src/entities/mrs/schema-readonly.js +306 -197
  21. package/dist/src/entities/mrs/schema-readonly.js.map +1 -1
  22. package/dist/src/entities/mrs/schema.d.ts +34 -394
  23. package/dist/src/entities/mrs/schema.js +234 -227
  24. package/dist/src/entities/mrs/schema.js.map +1 -1
  25. package/dist/src/entities/pipelines/registry.js +30 -14
  26. package/dist/src/entities/pipelines/registry.js.map +1 -1
  27. package/dist/src/entities/pipelines/schema-readonly.d.ts +16 -32
  28. package/dist/src/entities/pipelines/schema-readonly.js +54 -52
  29. package/dist/src/entities/pipelines/schema-readonly.js.map +1 -1
  30. package/dist/src/entities/pipelines/schema.d.ts +16 -23
  31. package/dist/src/entities/pipelines/schema.js +24 -37
  32. package/dist/src/entities/pipelines/schema.js.map +1 -1
  33. package/dist/src/entities/utils.d.ts +1 -0
  34. package/dist/src/entities/utils.js +6 -0
  35. package/dist/src/entities/utils.js.map +1 -1
  36. package/dist/src/entities/workitems/registry.js +30 -21
  37. package/dist/src/entities/workitems/registry.js.map +1 -1
  38. package/dist/src/entities/workitems/schema-readonly.d.ts +7 -35
  39. package/dist/src/entities/workitems/schema-readonly.js +15 -41
  40. package/dist/src/entities/workitems/schema-readonly.js.map +1 -1
  41. package/dist/src/entities/workitems/schema.d.ts +10 -52
  42. package/dist/src/entities/workitems/schema.js +26 -48
  43. package/dist/src/entities/workitems/schema.js.map +1 -1
  44. package/dist/structured-world-gitlab-mcp-6.2.3.tgz +0 -0
  45. package/dist/tsconfig.build.tsbuildinfo +1 -1
  46. package/package.json +1 -1
  47. package/dist/structured-world-gitlab-mcp-6.2.2.tgz +0 -0
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BrowseFilesSchema = exports.GetFileContentsSchema = exports.GetRepositoryTreeSchema = exports.GitLabTreeSchema = exports.GitLabCreateUpdateFileResponseSchema = exports.GitLabContentSchema = exports.GitLabDirectoryContentSchema = exports.GitLabFileContentSchema = void 0;
3
+ exports.BrowseFilesSchema = exports.GitLabTreeSchema = exports.GitLabCreateUpdateFileResponseSchema = exports.GitLabContentSchema = exports.GitLabDirectoryContentSchema = exports.GitLabFileContentSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const utils_1 = require("../utils");
6
- const shared_1 = require("../shared");
7
6
  exports.GitLabFileContentSchema = zod_1.z.object({
8
7
  file_name: zod_1.z.string(),
9
8
  file_path: zod_1.z.string(),
@@ -35,35 +34,30 @@ exports.GitLabTreeSchema = zod_1.z.object({
35
34
  path: zod_1.z.string(),
36
35
  mode: zod_1.z.string(),
37
36
  });
38
- exports.GetRepositoryTreeSchema = zod_1.z.object({
39
- project_id: utils_1.requiredId.describe("Project ID or URL-encoded path"),
40
- path: zod_1.z.string().optional().describe("The path inside repository"),
41
- ref: zod_1.z.string().optional().describe("The name of a repository branch or tag"),
42
- recursive: utils_1.flexibleBoolean.optional().describe("Boolean value used to get a recursive tree"),
43
- per_page: zod_1.z.number().int().min(1).max(100).optional().describe("Number of results per page"),
44
- page: zod_1.z.number().int().min(1).optional().describe("Page number"),
45
- });
46
- exports.GetFileContentsSchema = shared_1.ProjectParamsSchema.extend({
47
- file_path: zod_1.z.string().describe("URL-encoded full path to the file"),
48
- ref: zod_1.z.string().optional().describe("The name of branch, tag or commit"),
49
- });
50
- const BrowseFilesBaseSchema = zod_1.z.object({
37
+ exports.BrowseFilesSchema = zod_1.z
38
+ .object({
39
+ action: zod_1.z.enum(["tree", "content"]).describe("Action to perform: tree or content"),
51
40
  project_id: utils_1.requiredId.describe("Project ID or URL-encoded path"),
52
41
  ref: zod_1.z.string().optional().describe("Branch, tag, or commit SHA"),
42
+ path: zod_1.z.string().optional().describe("Directory path to list. For 'tree' action."),
43
+ recursive: utils_1.flexibleBoolean
44
+ .optional()
45
+ .describe("Include nested directories. For 'tree' action."),
46
+ per_page: zod_1.z
47
+ .number()
48
+ .int()
49
+ .min(1)
50
+ .max(100)
51
+ .optional()
52
+ .describe("Results per page (max 100). For 'tree' action."),
53
+ page: zod_1.z.number().int().min(1).optional().describe("Page number. For 'tree' action."),
54
+ file_path: zod_1.z
55
+ .string()
56
+ .optional()
57
+ .describe("Path to the file to read. Required for 'content' action."),
58
+ })
59
+ .refine(data => data.action !== "content" || data.file_path !== undefined, {
60
+ message: "file_path is required for 'content' action",
61
+ path: ["file_path"],
53
62
  });
54
- const BrowseFilesTreeSchema = BrowseFilesBaseSchema.extend({
55
- action: zod_1.z.literal("tree"),
56
- path: zod_1.z.string().optional().describe("Directory path to list"),
57
- recursive: utils_1.flexibleBoolean.optional().describe("Include nested directories"),
58
- per_page: zod_1.z.number().int().min(1).max(100).optional().describe("Results per page (max 100)"),
59
- page: zod_1.z.number().int().min(1).optional().describe("Page number"),
60
- });
61
- const BrowseFilesContentSchema = BrowseFilesBaseSchema.extend({
62
- action: zod_1.z.literal("content"),
63
- file_path: zod_1.z.string().describe("Path to the file to read"),
64
- });
65
- exports.BrowseFilesSchema = zod_1.z.discriminatedUnion("action", [
66
- BrowseFilesTreeSchema,
67
- BrowseFilesContentSchema,
68
- ]);
69
63
  //# sourceMappingURL=schema-readonly.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema-readonly.js","sourceRoot":"","sources":["../../../../src/entities/files/schema-readonly.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,oCAAuD;AACvD,sCAAgD;AAKnC,QAAA,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9C,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;IACpB,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IACnB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE;IAC1B,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC;AAEU,QAAA,4BAA4B,GAAG,OAAC,CAAC,MAAM,CAAC;IACnD,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,OAAC,CAAC,MA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7D,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;IAEpF,SAAS,EAAE,OAAC;SACT,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,0DAA0D,CAAC;CACxE,CAAC;KACD,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE;IACzE,OAAO,EAAE,4CAA4C;IACrD,IAAI,EAAE,CAAC,WAAW,CAAC;CACpB,CAAC,CAAC"}
@@ -1,8 +1,15 @@
1
1
  import { z } from "zod";
2
- export declare const CreateOrUpdateFileSchema: z.ZodObject<{
2
+ export declare const ManageFilesSchema: z.ZodObject<{
3
+ action: z.ZodEnum<{
4
+ single: "single";
5
+ batch: "batch";
6
+ upload: "upload";
7
+ }>;
3
8
  project_id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
4
- file_path: z.ZodString;
5
- branch: z.ZodString;
9
+ file_path: z.ZodOptional<z.ZodString>;
10
+ content: z.ZodOptional<z.ZodString>;
11
+ commit_message: z.ZodOptional<z.ZodString>;
12
+ branch: z.ZodOptional<z.ZodString>;
6
13
  start_branch: z.ZodOptional<z.ZodString>;
7
14
  encoding: z.ZodOptional<z.ZodEnum<{
8
15
  base64: "base64";
@@ -10,16 +17,9 @@ export declare const CreateOrUpdateFileSchema: z.ZodObject<{
10
17
  }>>;
11
18
  author_email: z.ZodOptional<z.ZodString>;
12
19
  author_name: z.ZodOptional<z.ZodString>;
13
- content: z.ZodString;
14
- commit_message: z.ZodString;
15
20
  last_commit_id: z.ZodOptional<z.ZodString>;
16
21
  execute_filemode: z.ZodOptional<z.ZodPipe<z.ZodTransform<boolean, unknown>, z.ZodBoolean>>;
17
- }, z.core.$strip>;
18
- export declare const PushFilesSchema: z.ZodObject<{
19
- project_id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
20
- branch: z.ZodString;
21
- commit_message: z.ZodString;
22
- files: z.ZodArray<z.ZodObject<{
22
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
23
23
  file_path: z.ZodString;
24
24
  content: z.ZodString;
25
25
  encoding: z.ZodOptional<z.ZodEnum<{
@@ -27,56 +27,8 @@ export declare const PushFilesSchema: z.ZodObject<{
27
27
  text: "text";
28
28
  }>>;
29
29
  execute_filemode: z.ZodOptional<z.ZodPipe<z.ZodTransform<boolean, unknown>, z.ZodBoolean>>;
30
- }, z.core.$strip>>;
31
- start_branch: z.ZodOptional<z.ZodString>;
32
- author_email: z.ZodOptional<z.ZodString>;
33
- author_name: z.ZodOptional<z.ZodString>;
34
- }, z.core.$strip>;
35
- export declare const MarkdownUploadSchema: z.ZodObject<{
36
- project_id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
37
- file: z.ZodString;
38
- filename: z.ZodString;
30
+ }, z.core.$strip>>>;
31
+ file: z.ZodOptional<z.ZodString>;
32
+ filename: z.ZodOptional<z.ZodString>;
39
33
  }, z.core.$strip>;
40
- export declare const ManageFilesSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
41
- project_id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
42
- action: z.ZodLiteral<"single">;
43
- file_path: z.ZodString;
44
- content: z.ZodString;
45
- commit_message: z.ZodString;
46
- branch: z.ZodString;
47
- start_branch: z.ZodOptional<z.ZodString>;
48
- encoding: z.ZodOptional<z.ZodEnum<{
49
- base64: "base64";
50
- text: "text";
51
- }>>;
52
- author_email: z.ZodOptional<z.ZodString>;
53
- author_name: z.ZodOptional<z.ZodString>;
54
- last_commit_id: z.ZodOptional<z.ZodString>;
55
- execute_filemode: z.ZodOptional<z.ZodPipe<z.ZodTransform<boolean, unknown>, z.ZodBoolean>>;
56
- }, z.core.$strip>, z.ZodObject<{
57
- project_id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
58
- action: z.ZodLiteral<"batch">;
59
- branch: z.ZodString;
60
- commit_message: z.ZodString;
61
- files: z.ZodArray<z.ZodObject<{
62
- file_path: z.ZodString;
63
- content: z.ZodString;
64
- encoding: z.ZodOptional<z.ZodEnum<{
65
- base64: "base64";
66
- text: "text";
67
- }>>;
68
- execute_filemode: z.ZodOptional<z.ZodPipe<z.ZodTransform<boolean, unknown>, z.ZodBoolean>>;
69
- }, z.core.$strip>>;
70
- start_branch: z.ZodOptional<z.ZodString>;
71
- author_email: z.ZodOptional<z.ZodString>;
72
- author_name: z.ZodOptional<z.ZodString>;
73
- }, z.core.$strip>, z.ZodObject<{
74
- project_id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
75
- action: z.ZodLiteral<"upload">;
76
- file: z.ZodString;
77
- filename: z.ZodString;
78
- }, z.core.$strip>], "action">;
79
- export type CreateOrUpdateFileOptions = z.infer<typeof CreateOrUpdateFileSchema>;
80
- export type PushFilesOptions = z.infer<typeof PushFilesSchema>;
81
- export type MarkdownUploadOptions = z.infer<typeof MarkdownUploadSchema>;
82
34
  export type ManageFilesInput = z.infer<typeof ManageFilesSchema>;
@@ -1,79 +1,89 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ManageFilesSchema = exports.MarkdownUploadSchema = exports.PushFilesSchema = exports.CreateOrUpdateFileSchema = void 0;
3
+ exports.ManageFilesSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const utils_1 = require("../utils");
6
- const shared_1 = require("../shared");
7
- exports.CreateOrUpdateFileSchema = shared_1.ProjectParamsSchema.extend({
8
- file_path: zod_1.z.string().describe("URL-encoded full path to the file"),
9
- branch: zod_1.z.string().describe("Name of the new branch to create"),
10
- start_branch: zod_1.z.string().optional().describe("Name of the base branch to start from"),
11
- encoding: zod_1.z.enum(["text", "base64"]).optional().describe("Change encoding"),
12
- author_email: zod_1.z.string().optional().describe("Author email for the commit"),
13
- author_name: zod_1.z.string().optional().describe("Author name for the commit"),
14
- content: zod_1.z.string().describe("File content"),
15
- commit_message: zod_1.z.string().describe("Commit message"),
16
- last_commit_id: zod_1.z.string().optional().describe("Last known file commit id"),
17
- execute_filemode: utils_1.flexibleBoolean.optional().describe("Execute file mode"),
18
- });
19
- exports.PushFilesSchema = shared_1.ProjectParamsSchema.extend({
20
- branch: zod_1.z.string().describe("Target branch name"),
21
- commit_message: zod_1.z.string().describe("Commit message"),
22
- files: zod_1.z
23
- .array(zod_1.z.object({
24
- file_path: zod_1.z.string(),
25
- content: zod_1.z.string(),
26
- encoding: zod_1.z.enum(["text", "base64"]).optional(),
27
- execute_filemode: utils_1.flexibleBoolean.optional(),
28
- }))
29
- .describe("Array of files to push"),
30
- start_branch: zod_1.z.string().optional().describe("Start branch name"),
31
- author_email: zod_1.z.string().optional().describe("Author email"),
32
- author_name: zod_1.z.string().optional().describe("Author name"),
33
- });
34
- exports.MarkdownUploadSchema = shared_1.ProjectParamsSchema.extend({
35
- file: zod_1.z.string().describe("Base64 encoded file content or file path"),
36
- filename: zod_1.z.string().describe("Name of the file"),
37
- });
38
- const ManageFilesSingleSchema = zod_1.z.object({
39
- project_id: utils_1.requiredId.describe("Project ID or URL-encoded path"),
40
- action: zod_1.z.literal("single"),
41
- file_path: zod_1.z.string().describe("Path to the file"),
42
- content: zod_1.z.string().describe("File content (text or base64 encoded)"),
43
- commit_message: zod_1.z.string().describe("Commit message"),
44
- branch: zod_1.z.string().describe("Target branch name"),
45
- start_branch: zod_1.z.string().optional().describe("Base branch to start from"),
46
- encoding: zod_1.z.enum(["text", "base64"]).optional().describe("Content encoding (default: text)"),
47
- author_email: zod_1.z.string().optional().describe("Commit author email"),
48
- author_name: zod_1.z.string().optional().describe("Commit author name"),
49
- last_commit_id: zod_1.z.string().optional().describe("Last known commit ID for conflict detection"),
50
- execute_filemode: utils_1.flexibleBoolean.optional().describe("Set executable permission"),
51
- });
52
6
  const BatchFileActionSchema = zod_1.z.object({
53
7
  file_path: zod_1.z.string().describe("Path to the file"),
54
8
  content: zod_1.z.string().describe("File content"),
55
9
  encoding: zod_1.z.enum(["text", "base64"]).optional().describe("Content encoding"),
56
10
  execute_filemode: utils_1.flexibleBoolean.optional().describe("Set executable permission"),
57
11
  });
58
- const ManageFilesBatchSchema = zod_1.z.object({
12
+ exports.ManageFilesSchema = zod_1.z
13
+ .object({
14
+ action: zod_1.z.enum(["single", "batch", "upload"]).describe("Action to perform"),
59
15
  project_id: utils_1.requiredId.describe("Project ID or URL-encoded path"),
60
- action: zod_1.z.literal("batch"),
61
- branch: zod_1.z.string().describe("Target branch name"),
62
- commit_message: zod_1.z.string().describe("Commit message"),
63
- files: zod_1.z.array(BatchFileActionSchema).min(1).describe("Files to commit"),
16
+ file_path: zod_1.z.string().optional().describe("Path to the file. Required for 'single' action."),
17
+ content: zod_1.z
18
+ .string()
19
+ .optional()
20
+ .describe("File content (text or base64 encoded). Required for 'single' action."),
21
+ commit_message: zod_1.z
22
+ .string()
23
+ .optional()
24
+ .describe("Commit message. Required for 'single' and 'batch' actions."),
25
+ branch: zod_1.z
26
+ .string()
27
+ .optional()
28
+ .describe("Target branch name. Required for 'single' and 'batch' actions."),
64
29
  start_branch: zod_1.z.string().optional().describe("Base branch to start from"),
30
+ encoding: zod_1.z
31
+ .enum(["text", "base64"])
32
+ .optional()
33
+ .describe("Content encoding (default: text). For 'single' action."),
65
34
  author_email: zod_1.z.string().optional().describe("Commit author email"),
66
35
  author_name: zod_1.z.string().optional().describe("Commit author name"),
36
+ last_commit_id: zod_1.z
37
+ .string()
38
+ .optional()
39
+ .describe("Last known commit ID for conflict detection. For 'single' action."),
40
+ execute_filemode: utils_1.flexibleBoolean
41
+ .optional()
42
+ .describe("Set executable permission. For 'single' action."),
43
+ files: zod_1.z
44
+ .array(BatchFileActionSchema)
45
+ .optional()
46
+ .describe("Files to commit. Required for 'batch' action."),
47
+ file: zod_1.z
48
+ .string()
49
+ .optional()
50
+ .describe("Base64 encoded file content. Required for 'upload' action."),
51
+ filename: zod_1.z.string().optional().describe("Name of the file. Required for 'upload' action."),
52
+ })
53
+ .refine(data => data.action !== "single" || data.file_path !== undefined, {
54
+ message: "file_path is required for 'single' action",
55
+ path: ["file_path"],
56
+ })
57
+ .refine(data => data.action !== "single" || data.content !== undefined, {
58
+ message: "content is required for 'single' action",
59
+ path: ["content"],
60
+ })
61
+ .refine(data => data.action !== "single" || data.commit_message !== undefined, {
62
+ message: "commit_message is required for 'single' action",
63
+ path: ["commit_message"],
64
+ })
65
+ .refine(data => data.action !== "single" || data.branch !== undefined, {
66
+ message: "branch is required for 'single' action",
67
+ path: ["branch"],
68
+ })
69
+ .refine(data => data.action !== "batch" || data.branch !== undefined, {
70
+ message: "branch is required for 'batch' action",
71
+ path: ["branch"],
72
+ })
73
+ .refine(data => data.action !== "batch" || data.commit_message !== undefined, {
74
+ message: "commit_message is required for 'batch' action",
75
+ path: ["commit_message"],
76
+ })
77
+ .refine(data => data.action !== "batch" || (data.files && data.files.length > 0), {
78
+ message: "files array with at least one file is required for 'batch' action",
79
+ path: ["files"],
80
+ })
81
+ .refine(data => data.action !== "upload" || data.file !== undefined, {
82
+ message: "file is required for 'upload' action",
83
+ path: ["file"],
84
+ })
85
+ .refine(data => data.action !== "upload" || data.filename !== undefined, {
86
+ message: "filename is required for 'upload' action",
87
+ path: ["filename"],
67
88
  });
68
- const ManageFilesUploadSchema = zod_1.z.object({
69
- project_id: utils_1.requiredId.describe("Project ID or URL-encoded path"),
70
- action: zod_1.z.literal("upload"),
71
- file: zod_1.z.string().describe("Base64 encoded file content"),
72
- filename: zod_1.z.string().describe("Name of the file"),
73
- });
74
- exports.ManageFilesSchema = zod_1.z.discriminatedUnion("action", [
75
- ManageFilesSingleSchema,
76
- ManageFilesBatchSchema,
77
- ManageFilesUploadSchema,
78
- ]);
79
89
  //# source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,CAAC,QAAQ,KAAK,SAAS,EAAE;IACvE,OAAO,EAAE,0CAA0C;IACnD,IAAI,EAAE,CAAC,UAAU,CAAC;CACnB,CAAC,CAAC"}
@@ -42,6 +42,7 @@ const schema_readonly_1 = require("./schema-readonly");
42
42
  const schema_1 = require("./schema");
43
43
  const gitlab_api_1 = require("../../utils/gitlab-api");
44
44
  const projectIdentifier_1 = require("../../utils/projectIdentifier");
45
+ const utils_1 = require("../utils");
45
46
  exports.mrsToolRegistry = new Map([
46
47
  [
47
48
  "browse_merge_requests",
@@ -61,16 +62,18 @@ exports.mrsToolRegistry = new Map([
61
62
  return gitlab_api_1.gitlab.get(path, { query });
62
63
  }
63
64
  case "get": {
65
+ (0, utils_1.assertDefined)(input.project_id, "project_id");
66
+ const projectId = input.project_id;
64
67
  const query = {};
65
68
  if (input.include_diverged_commits_count !== undefined)
66
69
  query.include_diverged_commits_count = input.include_diverged_commits_count;
67
70
  if (input.include_rebase_in_progress !== undefined)
68
71
  query.include_rebase_in_progress = input.include_rebase_in_progress;
69
72
  if (input.merge_request_iid) {
70
- return gitlab_api_1.gitlab.get(`projects/${(0, projectIdentifier_1.normalizeProjectId)(input.project_id)}/merge_requests/${input.merge_request_iid}`, Object.keys(query).length > 0 ? { query } : undefined);
73
+ return gitlab_api_1.gitlab.get(`projects/${(0, projectIdentifier_1.normalizeProjectId)(projectId)}/merge_requests/${input.merge_request_iid}`, Object.keys(query).length > 0 ? { query } : undefined);
71
74
  }
72
75
  else if (input.branch_name) {
73
- const result = await gitlab_api_1.gitlab.get(`projects/${(0, projectIdentifier_1.normalizeProjectId)(input.project_id)}/merge_requests`, { query: { source_branch: input.branch_name, ...query } });
76
+ const result = await gitlab_api_1.gitlab.get(`projects/${(0, projectIdentifier_1.normalizeProjectId)(projectId)}/merge_requests`, { query: { source_branch: input.branch_name, ...query } });
74
77
  if (Array.isArray(result) && result.length > 0) {
75
78
  return result[0];
76
79
  }
@@ -79,6 +82,10 @@ exports.mrsToolRegistry = new Map([
79
82
  throw new Error("Either merge_request_iid or branch_name must be provided");
80
83
  }
81
84
  case "diffs": {
85
+ (0, utils_1.assertDefined)(input.project_id, "project_id");
86
+ (0, utils_1.assertDefined)(input.merge_request_iid, "merge_request_iid");
87
+ const projectId = input.project_id;
88
+ const mrIid = input.merge_request_iid;
82
89
  const query = {};
83
90
  if (input.page !== undefined)
84
91
  query.page = input.page;
@@ -88,21 +95,25 @@ exports.mrsToolRegistry = new Map([
88
95
  query.include_diverged_commits_count = input.include_diverged_commits_count;
89
96
  if (input.include_rebase_in_progress !== undefined)
90
97
  query.include_rebase_in_progress = input.include_rebase_in_progress;
91
- return gitlab_api_1.gitlab.get(`projects/${(0, projectIdentifier_1.normalizeProjectId)(input.project_id)}/merge_requests/${input.merge_request_iid}/changes`, { query });
98
+ return gitlab_api_1.gitlab.get(`projects/${(0, projectIdentifier_1.normalizeProjectId)(projectId)}/merge_requests/${mrIid}/changes`, { query });
92
99
  }
93
100
  case "compare": {
101
+ (0, utils_1.assertDefined)(input.project_id, "project_id");
102
+ (0, utils_1.assertDefined)(input.from, "from");
103
+ (0, utils_1.assertDefined)(input.to, "to");
104
+ const projectId = input.project_id;
94
105
  const query = {
95
106
  from: input.from,
96
107
  to: input.to,
97
108
  };
98
109
  if (input.straight !== undefined)
99
110
  query.straight = input.straight;
100
- return gitlab_api_1.gitlab.get(`projects/${(0, projectIdentifier_1.normalizeProjectId)(input.project_id)}/repository/compare`, { query });
101
- }
102
- default: {
103
- const _exhaustive = input;
104
- throw new Error(`Unknown action: ${_exhaustive.action}`);
111
+ return gitlab_api_1.gitlab.get(`projects/${(0, projectIdentifier_1.normalizeProjectId)(projectId)}/repository/compare`, {
112
+ query,
113
+ });
105
114
  }
115
+ default:
116
+ throw new Error(`Unknown action: ${input.action}`);
106
117
  }
107
118
  },
108
119
  },
@@ -125,12 +136,11 @@ exports.mrsToolRegistry = new Map([
125
136
  return gitlab_api_1.gitlab.get(`projects/${(0, projectIdentifier_1.normalizeProjectId)(input.project_id)}/merge_requests/${input.merge_request_iid}/draft_notes`);
126
137
  }
127
138
  case "draft": {
139
+ (0, utils_1.assertDefined)(input.draft_note_id, "draft_note_id");
128
140
  return gitlab_api_1.gitlab.get(`projects/${(0, projectIdentifier_1.normalizeProjectId)(input.project_id)}/merge_requests/${input.merge_request_iid}/draft_notes/${input.draft_note_id}`);
129
141
  }
130
- default: {
131
- const _exhaustive = input;
132
- throw new Error(`Unknown action: ${_exhaustive.action}`);
133
- }
142
+ default:
143
+ throw new Error(`Unknown action: ${input.action}`);
134
144
  }
135
145
  },
136
146
  },
@@ -161,6 +171,7 @@ exports.mrsToolRegistry = new Map([
161
171
  });
162
172
  }
163
173
  case "update": {
174
+ (0, utils_1.assertDefined)(input.merge_request_iid, "merge_request_iid");
164
175
  const { action: _action, project_id, merge_request_iid, ...body } = input;
165
176
  const processedBody = {};
166
177
  for (const [key, value] of Object.entries(body)) {
@@ -174,13 +185,12 @@ exports.mrsToolRegistry = new Map([
174
185
  return gitlab_api_1.gitlab.put(`projects/${(0, projectIdentifier_1.normalizeProjectId)(project_id)}/merge_requests/${merge_request_iid}`, { body: processedBody, contentType: "form" });
175
186
  }
176
187
  case "merge": {
188
+ (0, utils_1.assertDefined)(input.merge_request_iid, "merge_request_iid");
177
189
  const { action: _action, project_id, merge_request_iid, ...body } = input;
178
190
  return gitlab_api_1.gitlab.put(`projects/${(0, projectIdentifier_1.normalizeProjectId)(project_id)}/merge_requests/${merge_request_iid}/merge`, { body, contentType: "form" });
179
191
  }
180
- default: {
181
- const _exhaustive = input;
182
- throw new Error(`Unknown action: ${_exhaustive.action}`);
183
- }
192
+ default:
193
+ throw new Error(`Unknown action: ${input.action}`);
184
194
  }
185
195
  },
186
196
  },
@@ -195,35 +205,47 @@ exports.mrsToolRegistry = new Map([
195
205
  const input = schema_1.ManageMrDiscussionSchema.parse(args);
196
206
  switch (input.action) {
197
207
  case "comment": {
208
+ (0, utils_1.assertDefined)(input.noteable_type, "noteable_type");
209
+ (0, utils_1.assertDefined)(input.noteable_id, "noteable_id");
210
+ const noteableType = input.noteable_type;
211
+ const noteableId = input.noteable_id;
198
212
  const body = { body: input.body };
199
213
  if (input.created_at)
200
214
  body.created_at = input.created_at;
201
215
  if (input.confidential !== undefined)
202
216
  body.confidential = input.confidential;
203
- const resourceType = input.noteable_type === "merge_request" ? "merge_requests" : "issues";
204
- return gitlab_api_1.gitlab.post(`projects/${(0, projectIdentifier_1.normalizeProjectId)(input.project_id)}/${resourceType}/${input.noteable_id}/notes`, { body, contentType: "form" });
217
+ const resourceType = noteableType === "merge_request" ? "merge_requests" : "issues";
218
+ return gitlab_api_1.gitlab.post(`projects/${(0, projectIdentifier_1.normalizeProjectId)(input.project_id)}/${resourceType}/${noteableId}/notes`, { body, contentType: "form" });
205
219
  }
206
220
  case "thread": {
221
+ (0, utils_1.assertDefined)(input.merge_request_iid, "merge_request_iid");
222
+ const mrIid = input.merge_request_iid;
207
223
  const body = { body: input.body };
208
224
  if (input.position)
209
225
  body.position = JSON.stringify(input.position);
210
226
  if (input.commit_id)
211
227
  body.commit_id = input.commit_id;
212
- return gitlab_api_1.gitlab.post(`projects/${(0, projectIdentifier_1.normalizeProjectId)(input.project_id)}/merge_requests/${input.merge_request_iid}/discussions`, { body, contentType: "form" });
228
+ return gitlab_api_1.gitlab.post(`projects/${(0, projectIdentifier_1.normalizeProjectId)(input.project_id)}/merge_requests/${mrIid}/discussions`, { body, contentType: "form" });
213
229
  }
214
230
  case "reply": {
231
+ (0, utils_1.assertDefined)(input.merge_request_iid, "merge_request_iid");
232
+ (0, utils_1.assertDefined)(input.discussion_id, "discussion_id");
233
+ const mrIid = input.merge_request_iid;
234
+ const discussionId = input.discussion_id;
215
235
  const body = { body: input.body };
216
236
  if (input.created_at)
217
237
  body.created_at = input.created_at;
218
- return gitlab_api_1.gitlab.post(`projects/${(0, projectIdentifier_1.normalizeProjectId)(input.project_id)}/merge_requests/${input.merge_request_iid}/discussions/${input.discussion_id}/notes`, { body, contentType: "form" });
238
+ return gitlab_api_1.gitlab.post(`projects/${(0, projectIdentifier_1.normalizeProjectId)(input.project_id)}/merge_requests/${mrIid}/discussions/${discussionId}/notes`, { body, contentType: "form" });
219
239
  }
220
240
  case "update": {
221
- return gitlab_api_1.gitlab.put(`projects/${(0, projectIdentifier_1.normalizeProjectId)(input.project_id)}/merge_requests/${input.merge_request_iid}/notes/${input.note_id}`, { body: { body: input.body }, contentType: "form" });
222
- }
223
- default: {
224
- const _exhaustive = input;
225
- throw new Error(`Unknown action: ${_exhaustive.action}`);
241
+ (0, utils_1.assertDefined)(input.merge_request_iid, "merge_request_iid");
242
+ (0, utils_1.assertDefined)(input.note_id, "note_id");
243
+ const mrIid = input.merge_request_iid;
244
+ const noteId = input.note_id;
245
+ return gitlab_api_1.gitlab.put(`projects/${(0, projectIdentifier_1.normalizeProjectId)(input.project_id)}/merge_requests/${mrIid}/notes/${noteId}`, { body: { body: input.body }, contentType: "form" });
226
246
  }
247
+ default:
248
+ throw new Error(`Unknown action: ${input.action}`);
227
249
  }
228
250
  },
229
251
  },
@@ -248,13 +270,17 @@ exports.mrsToolRegistry = new Map([
248
270
  return gitlab_api_1.gitlab.post(`projects/${(0, projectIdentifier_1.normalizeProjectId)(input.project_id)}/merge_requests/${input.merge_request_iid}/draft_notes`, { body, contentType: "form" });
249
271
  }
250
272
  case "update": {
273
+ (0, utils_1.assertDefined)(input.draft_note_id, "draft_note_id");
274
+ const draftNoteId = input.draft_note_id;
251
275
  const body = { note: input.note };
252
276
  if (input.position)
253
277
  body.position = JSON.stringify(input.position);
254
- return gitlab_api_1.gitlab.put(`projects/${(0, projectIdentifier_1.normalizeProjectId)(input.project_id)}/merge_requests/${input.merge_request_iid}/draft_notes/${input.draft_note_id}`, { body, contentType: "form" });
278
+ return gitlab_api_1.gitlab.put(`projects/${(0, projectIdentifier_1.normalizeProjectId)(input.project_id)}/merge_requests/${input.merge_request_iid}/draft_notes/${draftNoteId}`, { body, contentType: "form" });
255
279
  }
256
280
  case "publish": {
257
- const result = await gitlab_api_1.gitlab.put(`projects/${(0, projectIdentifier_1.normalizeProjectId)(input.project_id)}/merge_requests/${input.merge_request_iid}/draft_notes/${input.draft_note_id}/publish`);
281
+ (0, utils_1.assertDefined)(input.draft_note_id, "draft_note_id");
282
+ const draftNoteId = input.draft_note_id;
283
+ const result = await gitlab_api_1.gitlab.put(`projects/${(0, projectIdentifier_1.normalizeProjectId)(input.project_id)}/merge_requests/${input.merge_request_iid}/draft_notes/${draftNoteId}/publish`);
258
284
  return result ?? { published: true };
259
285
  }
260
286
  case "publish_all": {
@@ -262,13 +288,13 @@ exports.mrsToolRegistry = new Map([
262
288
  return result ?? { published: true };
263
289
  }
264
290
  case "delete": {
265
- await gitlab_api_1.gitlab.delete(`projects/${(0, projectIdentifier_1.normalizeProjectId)(input.project_id)}/merge_requests/${input.merge_request_iid}/draft_notes/${input.draft_note_id}`);
291
+ (0, utils_1.assertDefined)(input.draft_note_id, "draft_note_id");
292
+ const draftNoteId = input.draft_note_id;
293
+ await gitlab_api_1.gitlab.delete(`projects/${(0, projectIdentifier_1.normalizeProjectId)(input.project_id)}/merge_requests/${input.merge_request_iid}/draft_notes/${draftNoteId}`);
266
294
  return { success: true, message: "Draft note deleted successfully" };
267
295
  }
268
- default: {
269
- const _exhaustive = input;
270
- throw new Error(`Unknown action: ${_exhaustive.action}`);
271
- }
296
+ default:
297
+ throw new Error(`Unknown action: ${input.action}`);
272
298
  }
273
299
  },
274
300
  },