@structured-world/gitlab-mcp 6.20.0 → 6.22.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 (40) hide show
  1. package/dist/src/config.d.ts +2 -0
  2. package/dist/src/config.js +3 -1
  3. package/dist/src/config.js.map +1 -1
  4. package/dist/src/entities/index.d.ts +2 -0
  5. package/dist/src/entities/index.js +2 -0
  6. package/dist/src/entities/index.js.map +1 -1
  7. package/dist/src/entities/members/index.d.ts +3 -0
  8. package/dist/src/entities/members/index.js +25 -0
  9. package/dist/src/entities/members/index.js.map +1 -0
  10. package/dist/src/entities/members/registry.d.ts +5 -0
  11. package/dist/src/entities/members/registry.js +224 -0
  12. package/dist/src/entities/members/registry.js.map +1 -0
  13. package/dist/src/entities/members/schema-readonly.d.ts +53 -0
  14. package/dist/src/entities/members/schema-readonly.js +79 -0
  15. package/dist/src/entities/members/schema-readonly.js.map +1 -0
  16. package/dist/src/entities/members/schema.d.ts +40 -0
  17. package/dist/src/entities/members/schema.js +80 -0
  18. package/dist/src/entities/members/schema.js.map +1 -0
  19. package/dist/src/entities/refs/index.d.ts +3 -0
  20. package/dist/src/entities/refs/index.js +25 -0
  21. package/dist/src/entities/refs/index.js.map +1 -0
  22. package/dist/src/entities/refs/registry.d.ts +5 -0
  23. package/dist/src/entities/refs/registry.js +233 -0
  24. package/dist/src/entities/refs/registry.js.map +1 -0
  25. package/dist/src/entities/refs/schema-readonly.d.ts +48 -0
  26. package/dist/src/entities/refs/schema-readonly.js +76 -0
  27. package/dist/src/entities/refs/schema-readonly.js.map +1 -0
  28. package/dist/src/entities/refs/schema.d.ts +85 -0
  29. package/dist/src/entities/refs/schema.js +149 -0
  30. package/dist/src/entities/refs/schema.js.map +1 -0
  31. package/dist/src/logger.js +1 -0
  32. package/dist/src/logger.js.map +1 -1
  33. package/dist/src/registry-manager.js +22 -0
  34. package/dist/src/registry-manager.js.map +1 -1
  35. package/dist/src/services/ToolAvailability.js +52 -0
  36. package/dist/src/services/ToolAvailability.js.map +1 -1
  37. package/dist/structured-world-gitlab-mcp-6.22.0.tgz +0 -0
  38. package/dist/tsconfig.build.tsbuildinfo +1 -1
  39. package/package.json +1 -1
  40. package/dist/structured-world-gitlab-mcp-6.20.0.tgz +0 -0
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ManageMemberSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const utils_1 = require("../utils");
6
+ const schema_readonly_1 = require("./schema-readonly");
7
+ const AddProjectMemberSchema = zod_1.z.object({
8
+ action: zod_1.z.literal("add_to_project").describe("Add a user as member to a project"),
9
+ project_id: utils_1.requiredId.describe("Project ID or URL-encoded path"),
10
+ user_id: utils_1.requiredId.describe("User ID to add"),
11
+ access_level: schema_readonly_1.AccessLevelSchema,
12
+ expires_at: zod_1.z
13
+ .string()
14
+ .optional()
15
+ .describe("Membership expiration date in ISO 8601 format (YYYY-MM-DD)"),
16
+ });
17
+ const AddGroupMemberSchema = zod_1.z.object({
18
+ action: zod_1.z.literal("add_to_group").describe("Add a user as member to a group"),
19
+ group_id: utils_1.requiredId.describe("Group ID or URL-encoded path"),
20
+ user_id: utils_1.requiredId.describe("User ID to add"),
21
+ access_level: schema_readonly_1.AccessLevelSchema,
22
+ expires_at: zod_1.z
23
+ .string()
24
+ .optional()
25
+ .describe("Membership expiration date in ISO 8601 format (YYYY-MM-DD)"),
26
+ });
27
+ const RemoveProjectMemberSchema = zod_1.z.object({
28
+ action: zod_1.z.literal("remove_from_project").describe("Remove a member from a project"),
29
+ project_id: utils_1.requiredId.describe("Project ID or URL-encoded path"),
30
+ user_id: utils_1.requiredId.describe("User ID to remove"),
31
+ skip_subresources: zod_1.z.boolean().optional().describe("Skip removing from subprojects and forks"),
32
+ unassign_issuables: zod_1.z
33
+ .boolean()
34
+ .optional()
35
+ .describe("Unassign member from issues and merge requests"),
36
+ });
37
+ const RemoveGroupMemberSchema = zod_1.z.object({
38
+ action: zod_1.z.literal("remove_from_group").describe("Remove a member from a group"),
39
+ group_id: utils_1.requiredId.describe("Group ID or URL-encoded path"),
40
+ user_id: utils_1.requiredId.describe("User ID to remove"),
41
+ skip_subresources: zod_1.z.boolean().optional().describe("Skip removing from subgroups and projects"),
42
+ unassign_issuables: zod_1.z
43
+ .boolean()
44
+ .optional()
45
+ .describe("Unassign member from issues and merge requests"),
46
+ });
47
+ const UpdateProjectMemberSchema = zod_1.z.object({
48
+ action: zod_1.z.literal("update_project").describe("Update access level of a project member"),
49
+ project_id: utils_1.requiredId.describe("Project ID or URL-encoded path"),
50
+ user_id: utils_1.requiredId.describe("User ID to update"),
51
+ access_level: schema_readonly_1.AccessLevelSchema,
52
+ expires_at: zod_1.z
53
+ .string()
54
+ .optional()
55
+ .describe("Membership expiration date in ISO 8601 format (YYYY-MM-DD)"),
56
+ });
57
+ const UpdateGroupMemberSchema = zod_1.z.object({
58
+ action: zod_1.z.literal("update_group").describe("Update access level of a group member"),
59
+ group_id: utils_1.requiredId.describe("Group ID or URL-encoded path"),
60
+ user_id: utils_1.requiredId.describe("User ID to update"),
61
+ access_level: schema_readonly_1.AccessLevelSchema,
62
+ expires_at: zod_1.z
63
+ .string()
64
+ .optional()
65
+ .describe("Membership expiration date in ISO 8601 format (YYYY-MM-DD)"),
66
+ member_role_id: zod_1.z
67
+ .number()
68
+ .int()
69
+ .optional()
70
+ .describe("ID of a custom member role (Ultimate only)"),
71
+ });
72
+ exports.ManageMemberSchema = zod_1.z.discriminatedUnion("action", [
73
+ AddProjectMemberSchema,
74
+ AddGroupMemberSchema,
75
+ RemoveProjectMemberSchema,
76
+ RemoveGroupMemberSchema,
77
+ UpdateProjectMemberSchema,
78
+ UpdateGroupMemberSchema,
79
+ ]);
80
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/entities/members/schema.ts"],"names":[],"mappings":";;;AAAA,6BAAw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,UAAU,EAAE,OAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,4DAA4D,CAAC;IACzE,cAAc,EAAE,OAAC;SACd,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,QAAQ,CAAC,4CAA4C,CAAC;CAC1D,CAAC,CAAC;AAMU,QAAA,kBAAkB,GAAG,OAAC,CAAC,kBAAkB,CAAC,QAAQ,EAAE;IAC/D,sBAAsB;IACtB,oBAAoB;IACpB,yBAAyB;IACzB,uBAAuB;IACvB,yBAAyB;IACzB,uBAAuB;CACxB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./schema-readonly";
2
+ export * from "./schema";
3
+ export { refsToolRegistry, getRefsReadOnlyToolNames, getRefsToolDefinitions, getFilteredRefsTools, } from "./registry";
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.getFilteredRefsTools = exports.getRefsToolDefinitions = exports.getRefsReadOnlyToolNames = exports.refsToolRegistry = void 0;
18
+ __exportStar(require("./schema-readonly"), exports);
19
+ __exportStar(require("./schema"), exports);
20
+ var registry_1 = require("./registry");
21
+ Object.defineProperty(exports, "refsToolRegistry", { enumerable: true, get: function () { return registry_1.refsToolRegistry; } });
22
+ Object.defineProperty(exports, "getRefsReadOnlyToolNames", { enumerable: true, get: function () { return registry_1.getRefsReadOnlyToolNames; } });
23
+ Object.defineProperty(exports, "getRefsToolDefinitions", { enumerable: true, get: function () { return registry_1.getRefsToolDefinitions; } });
24
+ Object.defineProperty(exports, "getFilteredRefsTools", { enumerable: true, get: function () { return registry_1.getFilteredRefsTools; } });
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/entities/refs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,oDAAkC;AAClC,2CAAyB;AACzB,uCAKoB;AAJlB,4GAAA,gBAAgB,OAAA;AAChB,oHAAA,wBAAwB,OAAA;AACxB,kHAAA,sBAAsB,OAAA;AACtB,gHAAA,oBAAoB,OAAA"}
@@ -0,0 +1,5 @@
1
+ import { ToolRegistry, EnhancedToolDefinition } from "../../types";
2
+ export declare const refsToolRegistry: ToolRegistry;
3
+ export declare function getRefsReadOnlyToolNames(): string[];
4
+ export declare function getRefsToolDefinitions(): EnhancedToolDefinition[];
5
+ export declare function getFilteredRefsTools(readOnlyMode?: boolean): EnhancedToolDefinition[];
@@ -0,0 +1,233 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.refsToolRegistry = void 0;
37
+ exports.getRefsReadOnlyToolNames = getRefsReadOnlyToolNames;
38
+ exports.getRefsToolDefinitions = getRefsToolDefinitions;
39
+ exports.getFilteredRefsTools = getFilteredRefsTools;
40
+ const z = __importStar(require("zod"));
41
+ const schema_readonly_1 = require("./schema-readonly");
42
+ const schema_1 = require("./schema");
43
+ const gitlab_api_1 = require("../../utils/gitlab-api");
44
+ const config_1 = require("../../config");
45
+ exports.refsToolRegistry = new Map([
46
+ [
47
+ "browse_refs",
48
+ {
49
+ name: "browse_refs",
50
+ description: 'BROWSE Git refs (branches and tags). Actions: "list_branches" lists all branches, "get_branch" gets branch details, "list_tags" lists all tags, "get_tag" gets tag details, "list_protected_branches" shows protected branches, "get_protected_branch" gets protection rules, "list_protected_tags" shows protected tags.',
51
+ inputSchema: z.toJSONSchema(schema_readonly_1.BrowseRefsSchema),
52
+ handler: async (args) => {
53
+ const input = schema_readonly_1.BrowseRefsSchema.parse(args);
54
+ if ((0, config_1.isActionDenied)("browse_refs", input.action)) {
55
+ throw new Error(`Action '${input.action}' is not allowed for browse_refs tool`);
56
+ }
57
+ const encodedProjectId = encodeURIComponent(input.project_id);
58
+ switch (input.action) {
59
+ case "list_branches": {
60
+ const { action: _action, project_id: _projectId, ...queryOptions } = input;
61
+ return gitlab_api_1.gitlab.get(`projects/${encodedProjectId}/repository/branches`, {
62
+ query: (0, gitlab_api_1.toQuery)(queryOptions, []),
63
+ });
64
+ }
65
+ case "get_branch": {
66
+ const { branch } = input;
67
+ const encodedBranch = encodeURIComponent(branch);
68
+ return gitlab_api_1.gitlab.get(`projects/${encodedProjectId}/repository/branches/${encodedBranch}`);
69
+ }
70
+ case "list_tags": {
71
+ const { action: _action, project_id: _projectId, ...queryOptions } = input;
72
+ return gitlab_api_1.gitlab.get(`projects/${encodedProjectId}/repository/tags`, {
73
+ query: (0, gitlab_api_1.toQuery)(queryOptions, []),
74
+ });
75
+ }
76
+ case "get_tag": {
77
+ const { tag_name } = input;
78
+ const encodedTagName = encodeURIComponent(tag_name);
79
+ return gitlab_api_1.gitlab.get(`projects/${encodedProjectId}/repository/tags/${encodedTagName}`);
80
+ }
81
+ case "list_protected_branches": {
82
+ const { action: _action, project_id: _projectId, ...queryOptions } = input;
83
+ return gitlab_api_1.gitlab.get(`projects/${encodedProjectId}/protected_branches`, {
84
+ query: (0, gitlab_api_1.toQuery)(queryOptions, []),
85
+ });
86
+ }
87
+ case "get_protected_branch": {
88
+ const { name } = input;
89
+ const encodedName = encodeURIComponent(name);
90
+ return gitlab_api_1.gitlab.get(`projects/${encodedProjectId}/protected_branches/${encodedName}`);
91
+ }
92
+ case "list_protected_tags": {
93
+ const { action: _action, project_id: _projectId, ...queryOptions } = input;
94
+ return gitlab_api_1.gitlab.get(`projects/${encodedProjectId}/protected_tags`, {
95
+ query: (0, gitlab_api_1.toQuery)(queryOptions, []),
96
+ });
97
+ }
98
+ default:
99
+ throw new Error(`Unknown action: ${input.action}`);
100
+ }
101
+ },
102
+ },
103
+ ],
104
+ [
105
+ "manage_ref",
106
+ {
107
+ name: "manage_ref",
108
+ description: 'MANAGE Git refs (branches and tags). Actions: "create_branch" creates branch from ref, "delete_branch" removes branch, "protect_branch" adds protection, "unprotect_branch" removes protection, "update_branch_protection" modifies rules, "create_tag" creates tag, "delete_tag" removes tag, "protect_tag" adds tag protection (Premium), "unprotect_tag" removes tag protection.',
109
+ inputSchema: z.toJSONSchema(schema_1.ManageRefSchema),
110
+ handler: async (args) => {
111
+ const input = schema_1.ManageRefSchema.parse(args);
112
+ if ((0, config_1.isActionDenied)("manage_ref", input.action)) {
113
+ throw new Error(`Action '${input.action}' is not allowed for manage_ref tool`);
114
+ }
115
+ const encodedProjectId = encodeURIComponent(input.project_id);
116
+ switch (input.action) {
117
+ case "create_branch": {
118
+ const { branch, ref } = input;
119
+ return gitlab_api_1.gitlab.post(`projects/${encodedProjectId}/repository/branches`, {
120
+ body: { branch, ref },
121
+ contentType: "json",
122
+ });
123
+ }
124
+ case "delete_branch": {
125
+ const { branch } = input;
126
+ const encodedBranch = encodeURIComponent(branch);
127
+ await gitlab_api_1.gitlab.delete(`projects/${encodedProjectId}/repository/branches/${encodedBranch}`);
128
+ return { deleted: true, branch };
129
+ }
130
+ case "protect_branch": {
131
+ const { action: _action, project_id: _projectId, name, push_access_level, merge_access_level, unprotect_access_level, allow_force_push, allowed_to_push, allowed_to_merge, allowed_to_unprotect, code_owner_approval_required, } = input;
132
+ const body = { name };
133
+ if (push_access_level !== undefined)
134
+ body.push_access_level = push_access_level;
135
+ if (merge_access_level !== undefined)
136
+ body.merge_access_level = merge_access_level;
137
+ if (unprotect_access_level !== undefined)
138
+ body.unprotect_access_level = unprotect_access_level;
139
+ if (allow_force_push !== undefined)
140
+ body.allow_force_push = allow_force_push;
141
+ if (allowed_to_push !== undefined)
142
+ body.allowed_to_push = allowed_to_push;
143
+ if (allowed_to_merge !== undefined)
144
+ body.allowed_to_merge = allowed_to_merge;
145
+ if (allowed_to_unprotect !== undefined)
146
+ body.allowed_to_unprotect = allowed_to_unprotect;
147
+ if (code_owner_approval_required !== undefined)
148
+ body.code_owner_approval_required = code_owner_approval_required;
149
+ return gitlab_api_1.gitlab.post(`projects/${encodedProjectId}/protected_branches`, {
150
+ body,
151
+ contentType: "json",
152
+ });
153
+ }
154
+ case "unprotect_branch": {
155
+ const { name } = input;
156
+ const encodedName = encodeURIComponent(name);
157
+ await gitlab_api_1.gitlab.delete(`projects/${encodedProjectId}/protected_branches/${encodedName}`);
158
+ return { unprotected: true, name };
159
+ }
160
+ case "update_branch_protection": {
161
+ const { action: _action, project_id: _projectId, name, allow_force_push, allowed_to_push, allowed_to_merge, allowed_to_unprotect, code_owner_approval_required, } = input;
162
+ const encodedName = encodeURIComponent(name);
163
+ const body = {};
164
+ if (allow_force_push !== undefined)
165
+ body.allow_force_push = allow_force_push;
166
+ if (allowed_to_push !== undefined)
167
+ body.allowed_to_push = allowed_to_push;
168
+ if (allowed_to_merge !== undefined)
169
+ body.allowed_to_merge = allowed_to_merge;
170
+ if (allowed_to_unprotect !== undefined)
171
+ body.allowed_to_unprotect = allowed_to_unprotect;
172
+ if (code_owner_approval_required !== undefined)
173
+ body.code_owner_approval_required = code_owner_approval_required;
174
+ return gitlab_api_1.gitlab.patch(`projects/${encodedProjectId}/protected_branches/${encodedName}`, {
175
+ body,
176
+ contentType: "json",
177
+ });
178
+ }
179
+ case "create_tag": {
180
+ const { tag_name, ref, message } = input;
181
+ const body = { tag_name, ref };
182
+ if (message !== undefined)
183
+ body.message = message;
184
+ return gitlab_api_1.gitlab.post(`projects/${encodedProjectId}/repository/tags`, {
185
+ body,
186
+ contentType: "json",
187
+ });
188
+ }
189
+ case "delete_tag": {
190
+ const { tag_name } = input;
191
+ const encodedTagName = encodeURIComponent(tag_name);
192
+ await gitlab_api_1.gitlab.delete(`projects/${encodedProjectId}/repository/tags/${encodedTagName}`);
193
+ return { deleted: true, tag_name };
194
+ }
195
+ case "protect_tag": {
196
+ const { action: _action, project_id: _projectId, name, create_access_level, allowed_to_create, } = input;
197
+ const body = { name };
198
+ if (create_access_level !== undefined)
199
+ body.create_access_level = create_access_level;
200
+ if (allowed_to_create !== undefined)
201
+ body.allowed_to_create = allowed_to_create;
202
+ return gitlab_api_1.gitlab.post(`projects/${encodedProjectId}/protected_tags`, {
203
+ body,
204
+ contentType: "json",
205
+ });
206
+ }
207
+ case "unprotect_tag": {
208
+ const { name } = input;
209
+ const encodedName = encodeURIComponent(name);
210
+ await gitlab_api_1.gitlab.delete(`projects/${encodedProjectId}/protected_tags/${encodedName}`);
211
+ return { unprotected: true, name };
212
+ }
213
+ default:
214
+ throw new Error(`Unknown action: ${input.action}`);
215
+ }
216
+ },
217
+ },
218
+ ],
219
+ ]);
220
+ function getRefsReadOnlyToolNames() {
221
+ return ["browse_refs"];
222
+ }
223
+ function getRefsToolDefinitions() {
224
+ return Array.from(exports.refsToolRegistry.values());
225
+ }
226
+ function getFilteredRefsTools(readOnlyMode = false) {
227
+ if (readOnlyMode) {
228
+ const readOnlyNames = getRefsReadOnlyToolNames();
229
+ return Array.from(exports.refsToolRegistry.values()).filter(tool => readOnlyNames.includes(tool.name));
230
+ }
231
+ return getRefsToolDefinitions();
232
+ }
233
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../../src/entities/refs/registry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoQA,4DAEC;AAKD,wDAEC;AAKD,oDAMC;AAxRD,uCAAyB;AACzB,uDAAqD;AACrD,qCAA2C;AAC3C,uDAAyD;AAEzD,yCAA8C;AAUjC,QAAA,gBAAgB,GAAiB,IAAI,GAAG,CAAiC;IAKpF;QACE,aAAa;QACb;YACE,IAAI,EAAE,aAAa;YACnB,WAAW,EACT,2TAA2T;YAC7T,WAAW,EAAE,CAAC,CAAC,YAAY,CAAC,kCAAgB,CAAC;YAC7C,OAAO,EAAE,KAAK,EAAE,IAAa,EAAoB,EAAE;gBACjD,MAAM,KAAK,GAAG,kCAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAG3C,IAAI,IAAA,uBAAc,EAAC,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;oBAChD,MAAM,IAAI,KAAK,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BAAgB,CAAC,MAAM,EAAE,CAAC,CAAC;AAC/C,CAAC;AAKD,SAAgB,oBAAoB,CAAC,eAAwB,KAAK;IAChE,IAAI,YAAY,EAAE,CAAC;QACjB,MAAM,aAAa,GAAG,wBAAwB,EAAE,CAAC;QACjD,OAAO,KAAK,CAAC,IAAI,CAAC,wBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACjG,CAAC;IACD,OAAO,sBAAsB,EAAE,CAAC;AAClC,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { z } from "zod";
2
+ export declare const BrowseRefsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3
+ action: z.ZodLiteral<"list_branches">;
4
+ project_id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
5
+ search: z.ZodOptional<z.ZodString>;
6
+ regex: z.ZodOptional<z.ZodString>;
7
+ per_page: z.ZodOptional<z.ZodNumber>;
8
+ page: z.ZodOptional<z.ZodNumber>;
9
+ }, z.core.$strip>, z.ZodObject<{
10
+ action: z.ZodLiteral<"get_branch">;
11
+ project_id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
12
+ branch: z.ZodString;
13
+ }, z.core.$strip>, z.ZodObject<{
14
+ action: z.ZodLiteral<"list_tags">;
15
+ project_id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
16
+ search: z.ZodOptional<z.ZodString>;
17
+ order_by: z.ZodOptional<z.ZodEnum<{
18
+ version: "version";
19
+ name: "name";
20
+ updated: "updated";
21
+ }>>;
22
+ sort: z.ZodOptional<z.ZodEnum<{
23
+ asc: "asc";
24
+ desc: "desc";
25
+ }>>;
26
+ per_page: z.ZodOptional<z.ZodNumber>;
27
+ page: z.ZodOptional<z.ZodNumber>;
28
+ }, z.core.$strip>, z.ZodObject<{
29
+ action: z.ZodLiteral<"get_tag">;
30
+ project_id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
31
+ tag_name: z.ZodString;
32
+ }, z.core.$strip>, z.ZodObject<{
33
+ action: z.ZodLiteral<"list_protected_branches">;
34
+ project_id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
35
+ search: z.ZodOptional<z.ZodString>;
36
+ per_page: z.ZodOptional<z.ZodNumber>;
37
+ page: z.ZodOptional<z.ZodNumber>;
38
+ }, z.core.$strip>, z.ZodObject<{
39
+ action: z.ZodLiteral<"get_protected_branch">;
40
+ project_id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
41
+ name: z.ZodString;
42
+ }, z.core.$strip>, z.ZodObject<{
43
+ action: z.ZodLiteral<"list_protected_tags">;
44
+ project_id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
45
+ per_page: z.ZodOptional<z.ZodNumber>;
46
+ page: z.ZodOptional<z.ZodNumber>;
47
+ }, z.core.$strip>], "action">;
48
+ export type BrowseRefsInput = z.infer<typeof BrowseRefsSchema>;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BrowseRefsSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const utils_1 = require("../utils");
6
+ const projectIdField = utils_1.requiredId.describe("Project ID or URL-encoded path (e.g., 'my-group/my-project')");
7
+ const perPageField = zod_1.z
8
+ .number()
9
+ .int()
10
+ .min(1)
11
+ .max(100)
12
+ .optional()
13
+ .describe("Number of items per page (max 100)");
14
+ const pageField = zod_1.z.number().int().min(1).optional().describe("Page number");
15
+ const ListBranchesSchema = zod_1.z.object({
16
+ action: zod_1.z.literal("list_branches").describe("List all repository branches with optional search"),
17
+ project_id: projectIdField,
18
+ search: zod_1.z.string().optional().describe("Filter branches by name (supports wildcards)"),
19
+ regex: zod_1.z.string().optional().describe("Filter branches by regex pattern"),
20
+ per_page: perPageField,
21
+ page: pageField,
22
+ });
23
+ const GetBranchSchema = zod_1.z.object({
24
+ action: zod_1.z.literal("get_branch").describe("Get details of a specific branch"),
25
+ project_id: projectIdField,
26
+ branch: zod_1.z.string().describe("Branch name (URL-encoded if contains slashes)"),
27
+ });
28
+ const ListTagsSchema = zod_1.z.object({
29
+ action: zod_1.z.literal("list_tags").describe("List all repository tags"),
30
+ project_id: projectIdField,
31
+ search: zod_1.z.string().optional().describe("Filter tags by name (supports wildcards)"),
32
+ order_by: zod_1.z
33
+ .enum(["name", "updated", "version"])
34
+ .optional()
35
+ .describe("Sort by field (default: updated)"),
36
+ sort: zod_1.z.enum(["asc", "desc"]).optional().describe("Sort direction (default: desc)"),
37
+ per_page: perPageField,
38
+ page: pageField,
39
+ });
40
+ const GetTagSchema = zod_1.z.object({
41
+ action: zod_1.z.literal("get_tag").describe("Get details of a specific tag"),
42
+ project_id: projectIdField,
43
+ tag_name: zod_1.z.string().describe("Tag name (URL-encoded if contains special characters)"),
44
+ });
45
+ const ListProtectedBranchesSchema = zod_1.z.object({
46
+ action: zod_1.z
47
+ .literal("list_protected_branches")
48
+ .describe("List all protected branches with their protection rules"),
49
+ project_id: projectIdField,
50
+ search: zod_1.z.string().optional().describe("Filter protected branches by name"),
51
+ per_page: perPageField,
52
+ page: pageField,
53
+ });
54
+ const GetProtectedBranchSchema = zod_1.z.object({
55
+ action: zod_1.z.literal("get_protected_branch").describe("Get protection rules for a specific branch"),
56
+ project_id: projectIdField,
57
+ name: zod_1.z.string().describe("Branch name or wildcard pattern (e.g., 'main', 'release-*')"),
58
+ });
59
+ const ListProtectedTagsSchema = zod_1.z.object({
60
+ action: zod_1.z
61
+ .literal("list_protected_tags")
62
+ .describe("List all protected tags with their protection rules"),
63
+ project_id: projectIdField,
64
+ per_page: perPageField,
65
+ page: pageField,
66
+ });
67
+ exports.BrowseRefsSchema = zod_1.z.discriminatedUnion("action", [
68
+ ListBranchesSchema,
69
+ GetBranchSchema,
70
+ ListTagsSchema,
71
+ GetTagSchema,
72
+ ListProtectedBranchesSchema,
73
+ GetProtectedBranchSchema,
74
+ ListProtectedTagsSchema,
75
+ ]);
76
+ //# sourceMappingURL=schema-readonly.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-readonly.js","sourceRoot":"","sources":["../../../../src/entities/refs/schema-readonly.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,oCAAsC;AAUtC,MAAM,cAAc,GAAG,kBAAU,CAAC,QAAQ,CACxC,8DAA8D,CAC/D,CAAC;AAGF,MAAM,YAAY,GAAG,OAAC;KACnB,MAAM,EAAE;KACR,GAAG,EAAE;KACL,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,GAAG,CAAC;KACR,QAAQ,EAAE;KACV,QAAQ,CAAC,oCAAoC,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;AAG7E,MAAM,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IAClC,MAAM,EAAE,OAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,mDAAmD,CAAC;IAChG,UAAU,EAAE,cAAc;IAC1B,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,8CAA8C,CAAC;IACtF,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;IACzE,QAAQ,EAAE,YAAY;IACtB,IAAI,EAAE,SAAS;CAChB,CAAC,CAAC;AAGH,MAAM,eAAe,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/B,MAAM,EAAE,OAAC,CAAC,OAAO,CAAC,YAAY,CA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AQ,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IAC3E,QAAQ,EAAE,YAAY;IACtB,IAAI,EAAE,SAAS;CAChB,CAAC,CAAC;AAGH,MAAM,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,MAAM,EAAE,OAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,QAAQ,CAAC,4CAA4C,CAAC;IAChG,UAAU,EAAE,cAAc;IAC1B,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6DAA6D,CAAC;CACzF,CAAC,CAAC;AAGH,MAAM,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC;IACvC,MAAM,EAAE,OAAC;SACN,OAAO,CAAC,qBAAqB,CAAC;SAC9B,QAAQ,CAAC,qDAAqD,CAAC;IAClE,UAAU,EAAE,cAAc;IAC1B,QAAQ,EAAE,YAAY;IACtB,IAAI,EAAE,SAAS;CAChB,CAAC,CAAC;AAGU,QAAA,gBAAgB,GAAG,OAAC,CAAC,kBAAkB,CAAC,QAAQ,EAAE;IAC7D,kBAAkB;IAClB,eAAe;IACf,cAAc;IACd,YAAY;IACZ,2BAA2B;IAC3B,wBAAwB;IACxB,uBAAuB;CACxB,CAAC,CAAC"}
@@ -0,0 +1,85 @@
1
+ import { z } from "zod";
2
+ export declare const ManageRefSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3
+ action: z.ZodLiteral<"create_branch">;
4
+ project_id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
5
+ branch: z.ZodString;
6
+ ref: z.ZodString;
7
+ }, z.core.$strip>, z.ZodObject<{
8
+ action: z.ZodLiteral<"delete_branch">;
9
+ project_id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
10
+ branch: z.ZodString;
11
+ }, z.core.$strip>, z.ZodObject<{
12
+ action: z.ZodLiteral<"protect_branch">;
13
+ project_id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
14
+ name: z.ZodString;
15
+ push_access_level: z.ZodOptional<z.ZodNumber>;
16
+ merge_access_level: z.ZodOptional<z.ZodNumber>;
17
+ unprotect_access_level: z.ZodOptional<z.ZodNumber>;
18
+ allow_force_push: z.ZodOptional<z.ZodBoolean>;
19
+ allowed_to_push: z.ZodOptional<z.ZodArray<z.ZodObject<{
20
+ user_id: z.ZodOptional<z.ZodNumber>;
21
+ group_id: z.ZodOptional<z.ZodNumber>;
22
+ access_level: z.ZodOptional<z.ZodNumber>;
23
+ }, z.core.$strip>>>;
24
+ allowed_to_merge: z.ZodOptional<z.ZodArray<z.ZodObject<{
25
+ user_id: z.ZodOptional<z.ZodNumber>;
26
+ group_id: z.ZodOptional<z.ZodNumber>;
27
+ access_level: z.ZodOptional<z.ZodNumber>;
28
+ }, z.core.$strip>>>;
29
+ allowed_to_unprotect: z.ZodOptional<z.ZodArray<z.ZodObject<{
30
+ user_id: z.ZodOptional<z.ZodNumber>;
31
+ group_id: z.ZodOptional<z.ZodNumber>;
32
+ access_level: z.ZodOptional<z.ZodNumber>;
33
+ }, z.core.$strip>>>;
34
+ code_owner_approval_required: z.ZodOptional<z.ZodBoolean>;
35
+ }, z.core.$strip>, z.ZodObject<{
36
+ action: z.ZodLiteral<"unprotect_branch">;
37
+ project_id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
38
+ name: z.ZodString;
39
+ }, z.core.$strip>, z.ZodObject<{
40
+ action: z.ZodLiteral<"update_branch_protection">;
41
+ project_id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
42
+ name: z.ZodString;
43
+ allow_force_push: z.ZodOptional<z.ZodBoolean>;
44
+ allowed_to_push: z.ZodOptional<z.ZodArray<z.ZodObject<{
45
+ user_id: z.ZodOptional<z.ZodNumber>;
46
+ group_id: z.ZodOptional<z.ZodNumber>;
47
+ access_level: z.ZodOptional<z.ZodNumber>;
48
+ }, z.core.$strip>>>;
49
+ allowed_to_merge: z.ZodOptional<z.ZodArray<z.ZodObject<{
50
+ user_id: z.ZodOptional<z.ZodNumber>;
51
+ group_id: z.ZodOptional<z.ZodNumber>;
52
+ access_level: z.ZodOptional<z.ZodNumber>;
53
+ }, z.core.$strip>>>;
54
+ allowed_to_unprotect: z.ZodOptional<z.ZodArray<z.ZodObject<{
55
+ user_id: z.ZodOptional<z.ZodNumber>;
56
+ group_id: z.ZodOptional<z.ZodNumber>;
57
+ access_level: z.ZodOptional<z.ZodNumber>;
58
+ }, z.core.$strip>>>;
59
+ code_owner_approval_required: z.ZodOptional<z.ZodBoolean>;
60
+ }, z.core.$strip>, z.ZodObject<{
61
+ action: z.ZodLiteral<"create_tag">;
62
+ project_id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
63
+ tag_name: z.ZodString;
64
+ ref: z.ZodString;
65
+ message: z.ZodOptional<z.ZodString>;
66
+ }, z.core.$strip>, z.ZodObject<{
67
+ action: z.ZodLiteral<"delete_tag">;
68
+ project_id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
69
+ tag_name: z.ZodString;
70
+ }, z.core.$strip>, z.ZodObject<{
71
+ action: z.ZodLiteral<"protect_tag">;
72
+ project_id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
73
+ name: z.ZodString;
74
+ create_access_level: z.ZodOptional<z.ZodNumber>;
75
+ allowed_to_create: z.ZodOptional<z.ZodArray<z.ZodObject<{
76
+ user_id: z.ZodOptional<z.ZodNumber>;
77
+ group_id: z.ZodOptional<z.ZodNumber>;
78
+ access_level: z.ZodOptional<z.ZodNumber>;
79
+ }, z.core.$strip>>>;
80
+ }, z.core.$strip>, z.ZodObject<{
81
+ action: z.ZodLiteral<"unprotect_tag">;
82
+ project_id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
83
+ name: z.ZodString;
84
+ }, z.core.$strip>], "action">;
85
+ export type ManageRefInput = z.infer<typeof ManageRefSchema>;