@structured-world/gitlab-mcp 4.1.0 → 4.2.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.
- package/README.md +44 -28
- package/dist/config.d.ts +0 -2
- package/dist/config.js +1 -3
- package/dist/config.js.map +1 -1
- package/dist/entities/core/registry.js +96 -24
- package/dist/entities/core/registry.js.map +1 -1
- package/dist/entities/core/schema-readonly.d.ts +3 -0
- package/dist/entities/core/schema-readonly.js +3 -0
- package/dist/entities/core/schema-readonly.js.map +1 -1
- package/dist/entities/core/schema.d.ts +3 -6
- package/dist/entities/core/schema.js +2 -6
- package/dist/entities/core/schema.js.map +1 -1
- package/dist/entities/labels/registry.js +18 -29
- package/dist/entities/labels/registry.js.map +1 -1
- package/dist/entities/labels/schema-readonly.d.ts +8 -36
- package/dist/entities/labels/schema-readonly.js +5 -15
- package/dist/entities/labels/schema-readonly.js.map +1 -1
- package/dist/entities/labels/schema.d.ts +12 -59
- package/dist/entities/labels/schema.js +8 -23
- package/dist/entities/labels/schema.js.map +1 -1
- package/dist/entities/milestones/registry.js +35 -52
- package/dist/entities/milestones/registry.js.map +1 -1
- package/dist/entities/milestones/schema-readonly.d.ts +20 -99
- package/dist/entities/milestones/schema-readonly.js +6 -17
- package/dist/entities/milestones/schema-readonly.js.map +1 -1
- package/dist/entities/milestones/schema.d.ts +16 -76
- package/dist/entities/milestones/schema.js +8 -28
- package/dist/entities/milestones/schema.js.map +1 -1
- package/dist/entities/pipelines/schema-readonly.d.ts +4 -4
- package/dist/entities/variables/registry.js +18 -28
- package/dist/entities/variables/registry.js.map +1 -1
- package/dist/entities/variables/schema-readonly.d.ts +8 -38
- package/dist/entities/variables/schema-readonly.js +4 -13
- package/dist/entities/variables/schema-readonly.js.map +1 -1
- package/dist/entities/variables/schema.d.ts +12 -85
- package/dist/entities/variables/schema.js +6 -21
- package/dist/entities/variables/schema.js.map +1 -1
- package/dist/entities/wiki/registry.js +20 -37
- package/dist/entities/wiki/registry.js.map +1 -1
- package/dist/entities/wiki/schema-readonly.d.ts +8 -34
- package/dist/entities/wiki/schema-readonly.js +4 -13
- package/dist/entities/wiki/schema-readonly.js.map +1 -1
- package/dist/entities/wiki/schema.d.ts +12 -55
- package/dist/entities/wiki/schema.js +6 -21
- package/dist/entities/wiki/schema.js.map +1 -1
- package/dist/entities/workitems/registry.js +87 -20
- package/dist/entities/workitems/registry.js.map +1 -1
- package/dist/entities/workitems/schema-readonly.d.ts +7 -19
- package/dist/entities/workitems/schema-readonly.js +8 -12
- package/dist/entities/workitems/schema-readonly.js.map +1 -1
- package/dist/graphql/workItems.d.ts +23 -2
- package/dist/graphql/workItems.js +36 -36
- package/dist/graphql/workItems.js.map +1 -1
- package/dist/server.js +86 -13
- package/dist/server.js.map +1 -1
- package/dist/structured-world-gitlab-mcp-4.2.0.tgz +0 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/dist/utils/namespace.d.ts +6 -0
- package/dist/utils/namespace.js +52 -0
- package/dist/utils/namespace.js.map +1 -0
- package/dist/utils/smart-user-search.d.ts +33 -0
- package/dist/utils/smart-user-search.js +146 -0
- package/dist/utils/smart-user-search.js.map +1 -0
- package/package.json +2 -1
- package/dist/structured-world-gitlab-mcp-4.1.0.tgz +0 -0
|
@@ -8,6 +8,7 @@ const zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
|
8
8
|
const schema_readonly_1 = require("./schema-readonly");
|
|
9
9
|
const schema_1 = require("./schema");
|
|
10
10
|
const fetch_1 = require("../../utils/fetch");
|
|
11
|
+
const namespace_1 = require("../../utils/namespace");
|
|
11
12
|
exports.labelsToolRegistry = new Map([
|
|
12
13
|
[
|
|
13
14
|
'list_labels',
|
|
@@ -17,17 +18,16 @@ exports.labelsToolRegistry = new Map([
|
|
|
17
18
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_readonly_1.ListLabelsSchema),
|
|
18
19
|
handler: async (args) => {
|
|
19
20
|
const options = schema_readonly_1.ListLabelsSchema.parse(args);
|
|
20
|
-
const {
|
|
21
|
-
const isProject =
|
|
21
|
+
const { namespacePath } = options;
|
|
22
|
+
const isProject = namespacePath.includes('/');
|
|
22
23
|
const entityType = isProject ? 'projects' : 'groups';
|
|
23
|
-
const entityId = (isProject ? project_id : group_id);
|
|
24
24
|
const queryParams = new URLSearchParams();
|
|
25
25
|
Object.entries(options).forEach(([key, value]) => {
|
|
26
|
-
if (value !== undefined && key !== '
|
|
26
|
+
if (value !== undefined && key !== 'namespacePath') {
|
|
27
27
|
queryParams.set(key, String(value));
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${encodeURIComponent(
|
|
30
|
+
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${encodeURIComponent(namespacePath)}/labels?${queryParams}`;
|
|
31
31
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
32
32
|
headers: {
|
|
33
33
|
Authorization: `Bearer ${process.env.GITLAB_TOKEN}`,
|
|
@@ -49,11 +49,9 @@ exports.labelsToolRegistry = new Map([
|
|
|
49
49
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_readonly_1.GetLabelSchema),
|
|
50
50
|
handler: async (args) => {
|
|
51
51
|
const options = schema_readonly_1.GetLabelSchema.parse(args);
|
|
52
|
-
const {
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
const entityId = (isProject ? project_id : group_id);
|
|
56
|
-
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${encodeURIComponent(entityId)}/labels/${encodeURIComponent(label_id)}`;
|
|
52
|
+
const { namespacePath, label_id } = options;
|
|
53
|
+
const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(namespacePath);
|
|
54
|
+
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${encodedPath}/labels/${encodeURIComponent(label_id)}`;
|
|
57
55
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
58
56
|
headers: {
|
|
59
57
|
Authorization: `Bearer ${process.env.GITLAB_TOKEN}`,
|
|
@@ -75,10 +73,8 @@ exports.labelsToolRegistry = new Map([
|
|
|
75
73
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.CreateLabelSchema),
|
|
76
74
|
handler: async (args) => {
|
|
77
75
|
const options = schema_1.CreateLabelSchema.parse(args);
|
|
78
|
-
const {
|
|
79
|
-
const
|
|
80
|
-
const entityType = isProject ? 'projects' : 'groups';
|
|
81
|
-
const entityId = (isProject ? project_id : group_id);
|
|
76
|
+
const { namespacePath } = options;
|
|
77
|
+
const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(namespacePath);
|
|
82
78
|
const body = new URLSearchParams();
|
|
83
79
|
body.set('name', options.name);
|
|
84
80
|
body.set('color', options.color);
|
|
@@ -88,7 +84,7 @@ exports.labelsToolRegistry = new Map([
|
|
|
88
84
|
if (options.priority !== undefined) {
|
|
89
85
|
body.set('priority', String(options.priority));
|
|
90
86
|
}
|
|
91
|
-
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${
|
|
87
|
+
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${encodedPath}/labels`;
|
|
92
88
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
93
89
|
method: 'POST',
|
|
94
90
|
headers: {
|
|
@@ -113,20 +109,15 @@ exports.labelsToolRegistry = new Map([
|
|
|
113
109
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.UpdateLabelSchema),
|
|
114
110
|
handler: async (args) => {
|
|
115
111
|
const options = schema_1.UpdateLabelSchema.parse(args);
|
|
116
|
-
const {
|
|
117
|
-
const
|
|
118
|
-
const entityType = isProject ? 'projects' : 'groups';
|
|
119
|
-
const entityId = (isProject ? project_id : group_id);
|
|
112
|
+
const { namespacePath, label_id } = options;
|
|
113
|
+
const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(namespacePath);
|
|
120
114
|
const body = new URLSearchParams();
|
|
121
115
|
Object.entries(options).forEach(([key, value]) => {
|
|
122
|
-
if (value !== undefined &&
|
|
123
|
-
key !== 'project_id' &&
|
|
124
|
-
key !== 'group_id' &&
|
|
125
|
-
key !== 'label_id') {
|
|
116
|
+
if (value !== undefined && key !== 'namespacePath' && key !== 'label_id') {
|
|
126
117
|
body.set(key, String(value));
|
|
127
118
|
}
|
|
128
119
|
});
|
|
129
|
-
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${
|
|
120
|
+
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${encodedPath}/labels/${encodeURIComponent(label_id)}`;
|
|
130
121
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
131
122
|
method: 'PUT',
|
|
132
123
|
headers: {
|
|
@@ -151,11 +142,9 @@ exports.labelsToolRegistry = new Map([
|
|
|
151
142
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.DeleteLabelSchema),
|
|
152
143
|
handler: async (args) => {
|
|
153
144
|
const options = schema_1.DeleteLabelSchema.parse(args);
|
|
154
|
-
const {
|
|
155
|
-
const
|
|
156
|
-
const
|
|
157
|
-
const entityId = (isProject ? project_id : group_id);
|
|
158
|
-
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${encodeURIComponent(entityId)}/labels/${encodeURIComponent(label_id)}`;
|
|
145
|
+
const { namespacePath, label_id } = options;
|
|
146
|
+
const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(namespacePath);
|
|
147
|
+
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${encodedPath}/labels/${encodeURIComponent(label_id)}`;
|
|
159
148
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
160
149
|
method: 'DELETE',
|
|
161
150
|
headers: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/entities/labels/registry.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/entities/labels/registry.ts"],"names":[],"mappings":";;;AA0MA,gEAEC;AAKD,4DAEC;AAKD,wDAQC;AA/ND,2DAAqD;AACrD,uDAAqE;AACrE,qCAAmF;AACnF,6CAAkD;AAClD,qDAA+D;AAMlD,QAAA,kBAAkB,GAAiB,IAAI,GAAG,CAAiC;IAEtF;QACE,aAAa;QACb;YACE,IAAI,EAAE,aAAa;YACnB,WAAW,EACT,+XAA+X;YACjY,WAAW,EAAE,IAAA,oCAAe,EAAC,kCAAgB,CAAC;YAC9C,OAAO,EAAE,KAAK,EAAE,IAAa,EAAoB,EAAE;gBACjD,MAAM,OAAO,GAAG,kCAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC7C,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;gBAKlC,MAAM,SAAS,GAAG,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;gBAC9C,MAAM,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC;gBAErD,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;gBAC1C,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;oBAC/C,IAAI,KAAK,KAAK,SAAS,IAAI,GAAG,KAAK,eAAe,EAAE,CAAC;wBACnD,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;oBACtC,CAAC;gBACH,CAAC,CAAC,CAAC;gBAEH,MAAM,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,cAA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: z.ZodObject<{
|
|
3
|
+
namespacePath: z.ZodString;
|
|
5
4
|
with_counts: z.ZodOptional<z.ZodEffects<z.ZodBoolean, boolean, unknown>>;
|
|
6
5
|
include_ancestor_groups: z.ZodOptional<z.ZodEffects<z.ZodBoolean, boolean, unknown>>;
|
|
7
6
|
search: z.ZodOptional<z.ZodString>;
|
|
8
7
|
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
namespacePath: string;
|
|
9
9
|
search?: string | undefined;
|
|
10
|
-
project_id?: string | undefined;
|
|
11
|
-
group_id?: string | undefined;
|
|
12
10
|
with_counts?: boolean | undefined;
|
|
13
11
|
include_ancestor_groups?: boolean | undefined;
|
|
14
12
|
}, {
|
|
13
|
+
namespacePath: string;
|
|
15
14
|
search?: string | undefined;
|
|
16
|
-
project_id?: string | undefined;
|
|
17
|
-
group_id?: string | undefined;
|
|
18
|
-
with_counts?: unknown;
|
|
19
|
-
include_ancestor_groups?: unknown;
|
|
20
|
-
}>, {
|
|
21
|
-
search?: string | undefined;
|
|
22
|
-
project_id?: string | undefined;
|
|
23
|
-
group_id?: string | undefined;
|
|
24
|
-
with_counts?: boolean | undefined;
|
|
25
|
-
include_ancestor_groups?: boolean | undefined;
|
|
26
|
-
}, {
|
|
27
|
-
search?: string | undefined;
|
|
28
|
-
project_id?: string | undefined;
|
|
29
|
-
group_id?: string | undefined;
|
|
30
15
|
with_counts?: unknown;
|
|
31
16
|
include_ancestor_groups?: unknown;
|
|
32
17
|
}>;
|
|
33
|
-
export declare const GetLabelSchema: z.
|
|
34
|
-
|
|
35
|
-
group_id: z.ZodOptional<z.ZodString>;
|
|
18
|
+
export declare const GetLabelSchema: z.ZodObject<{
|
|
19
|
+
namespacePath: z.ZodString;
|
|
36
20
|
label_id: z.ZodUnion<[z.ZodString, z.ZodString]>;
|
|
37
21
|
include_ancestor_groups: z.ZodOptional<z.ZodEffects<z.ZodBoolean, boolean, unknown>>;
|
|
38
22
|
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
namespacePath: string;
|
|
39
24
|
label_id: string;
|
|
40
|
-
project_id?: string | undefined;
|
|
41
|
-
group_id?: string | undefined;
|
|
42
|
-
include_ancestor_groups?: boolean | undefined;
|
|
43
|
-
}, {
|
|
44
|
-
label_id: string;
|
|
45
|
-
project_id?: string | undefined;
|
|
46
|
-
group_id?: string | undefined;
|
|
47
|
-
include_ancestor_groups?: unknown;
|
|
48
|
-
}>, {
|
|
49
|
-
label_id: string;
|
|
50
|
-
project_id?: string | undefined;
|
|
51
|
-
group_id?: string | undefined;
|
|
52
25
|
include_ancestor_groups?: boolean | undefined;
|
|
53
26
|
}, {
|
|
27
|
+
namespacePath: string;
|
|
54
28
|
label_id: string;
|
|
55
|
-
project_id?: string | undefined;
|
|
56
|
-
group_id?: string | undefined;
|
|
57
29
|
include_ancestor_groups?: unknown;
|
|
58
30
|
}>;
|
|
59
31
|
export type ListLabelsOptions = z.infer<typeof ListLabelsSchema>;
|
|
@@ -3,27 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GetLabelSchema = exports.ListLabelsSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
|
-
exports.ListLabelsSchema = zod_1.z
|
|
7
|
-
.
|
|
8
|
-
project_id: zod_1.z.coerce.string().optional().describe('Project ID or URL-encoded path'),
|
|
9
|
-
group_id: zod_1.z.coerce.string().optional().describe('Group ID or URL-encoded path'),
|
|
6
|
+
exports.ListLabelsSchema = zod_1.z.object({
|
|
7
|
+
namespacePath: zod_1.z.string().describe('Namespace path (group or project) to list labels from'),
|
|
10
8
|
with_counts: utils_1.flexibleBoolean
|
|
11
9
|
.optional()
|
|
12
10
|
.describe('Whether or not to include issue and merge request counts'),
|
|
13
11
|
include_ancestor_groups: utils_1.flexibleBoolean.optional().describe('Include ancestor groups'),
|
|
14
12
|
search: zod_1.z.string().optional().describe('Keyword to filter labels by'),
|
|
15
|
-
})
|
|
16
|
-
.refine((data) => Boolean(data.project_id) !== Boolean(data.group_id), {
|
|
17
|
-
message: 'Exactly one of project_id or group_id must be provided',
|
|
18
13
|
});
|
|
19
|
-
exports.GetLabelSchema = zod_1.z
|
|
20
|
-
.
|
|
21
|
-
|
|
22
|
-
group_id: zod_1.z.coerce.string().optional().describe('Group ID or URL-encoded path'),
|
|
23
|
-
label_id: zod_1.z.union([zod_1.z.coerce.string(), zod_1.z.string()]).describe('The ID or title of a group label'),
|
|
14
|
+
exports.GetLabelSchema = zod_1.z.object({
|
|
15
|
+
namespacePath: zod_1.z.string().describe('Namespace path (group or project) containing the label'),
|
|
16
|
+
label_id: zod_1.z.union([zod_1.z.coerce.string(), zod_1.z.string()]).describe('The ID or title of the label'),
|
|
24
17
|
include_ancestor_groups: utils_1.flexibleBoolean.optional().describe('Include ancestor groups'),
|
|
25
|
-
})
|
|
26
|
-
.refine((data) => Boolean(data.project_id) !== Boolean(data.group_id), {
|
|
27
|
-
message: 'Exactly one of project_id or group_id must be provided',
|
|
28
18
|
});
|
|
29
19
|
//# sourceMappingURL=schema-readonly.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-readonly.js","sourceRoot":"","sources":["../../../src/entities/labels/schema-readonly.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,oCAA2C;AAK9B,QAAA,gBAAgB,GAAG,OAAC
|
|
1
|
+
{"version":3,"file":"schema-readonly.js","sourceRoot":"","sources":["../../../src/entities/labels/schema-readonly.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,oCAA2C;AAK9B,QAAA,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IACvC,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uDAAuD,CAAC;IAC3F,WAAW,EAAE,uBAAe;SACzB,QAAQ,EAAE;SACV,QAAQ,CAAC,0DAA0D,CAAC;IACvE,uBAAuB,EAAE,uBAAe,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;IACvF,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;CACtE,CAAC,CAAC;AAEU,QAAA,cAAc,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wDAAwD,CAAC;IAC5F,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,8BAA8B,CAAC;IAC3F,uBAAuB,EAAE,uBAAe,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;CACxF,CAAC,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const CreateLabelSchema: z.
|
|
3
|
-
|
|
4
|
-
group_id: z.ZodOptional<z.ZodString>;
|
|
2
|
+
export declare const CreateLabelSchema: z.ZodObject<{
|
|
3
|
+
namespacePath: z.ZodString;
|
|
5
4
|
name: z.ZodString;
|
|
6
5
|
color: z.ZodString;
|
|
7
6
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -9,93 +8,47 @@ export declare const CreateLabelSchema: z.ZodEffects<z.ZodObject<{
|
|
|
9
8
|
}, "strip", z.ZodTypeAny, {
|
|
10
9
|
name: string;
|
|
11
10
|
color: string;
|
|
11
|
+
namespacePath: string;
|
|
12
12
|
priority?: number | undefined;
|
|
13
13
|
description?: string | undefined;
|
|
14
|
-
project_id?: string | undefined;
|
|
15
|
-
group_id?: string | undefined;
|
|
16
14
|
}, {
|
|
17
15
|
name: string;
|
|
18
16
|
color: string;
|
|
17
|
+
namespacePath: string;
|
|
19
18
|
priority?: number | undefined;
|
|
20
19
|
description?: string | undefined;
|
|
21
|
-
project_id?: string | undefined;
|
|
22
|
-
group_id?: string | undefined;
|
|
23
|
-
}>, {
|
|
24
|
-
name: string;
|
|
25
|
-
color: string;
|
|
26
|
-
priority?: number | undefined;
|
|
27
|
-
description?: string | undefined;
|
|
28
|
-
project_id?: string | undefined;
|
|
29
|
-
group_id?: string | undefined;
|
|
30
|
-
}, {
|
|
31
|
-
name: string;
|
|
32
|
-
color: string;
|
|
33
|
-
priority?: number | undefined;
|
|
34
|
-
description?: string | undefined;
|
|
35
|
-
project_id?: string | undefined;
|
|
36
|
-
group_id?: string | undefined;
|
|
37
20
|
}>;
|
|
38
|
-
export declare const UpdateLabelSchema: z.
|
|
39
|
-
|
|
40
|
-
group_id: z.ZodOptional<z.ZodString>;
|
|
21
|
+
export declare const UpdateLabelSchema: z.ZodObject<{
|
|
22
|
+
namespacePath: z.ZodString;
|
|
41
23
|
label_id: z.ZodUnion<[z.ZodString, z.ZodString]>;
|
|
42
24
|
new_name: z.ZodOptional<z.ZodString>;
|
|
43
25
|
color: z.ZodOptional<z.ZodString>;
|
|
44
26
|
description: z.ZodOptional<z.ZodString>;
|
|
45
27
|
priority: z.ZodOptional<z.ZodNumber>;
|
|
46
28
|
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
namespacePath: string;
|
|
47
30
|
label_id: string;
|
|
48
31
|
priority?: number | undefined;
|
|
49
32
|
description?: string | undefined;
|
|
50
|
-
project_id?: string | undefined;
|
|
51
33
|
color?: string | undefined;
|
|
52
|
-
group_id?: string | undefined;
|
|
53
34
|
new_name?: string | undefined;
|
|
54
35
|
}, {
|
|
36
|
+
namespacePath: string;
|
|
55
37
|
label_id: string;
|
|
56
38
|
priority?: number | undefined;
|
|
57
39
|
description?: string | undefined;
|
|
58
|
-
project_id?: string | undefined;
|
|
59
40
|
color?: string | undefined;
|
|
60
|
-
group_id?: string | undefined;
|
|
61
|
-
new_name?: string | undefined;
|
|
62
|
-
}>, {
|
|
63
|
-
label_id: string;
|
|
64
|
-
priority?: number | undefined;
|
|
65
|
-
description?: string | undefined;
|
|
66
|
-
project_id?: string | undefined;
|
|
67
|
-
color?: string | undefined;
|
|
68
|
-
group_id?: string | undefined;
|
|
69
|
-
new_name?: string | undefined;
|
|
70
|
-
}, {
|
|
71
|
-
label_id: string;
|
|
72
|
-
priority?: number | undefined;
|
|
73
|
-
description?: string | undefined;
|
|
74
|
-
project_id?: string | undefined;
|
|
75
|
-
color?: string | undefined;
|
|
76
|
-
group_id?: string | undefined;
|
|
77
41
|
new_name?: string | undefined;
|
|
78
42
|
}>;
|
|
79
|
-
export declare const DeleteLabelSchema: z.
|
|
80
|
-
|
|
81
|
-
group_id: z.ZodOptional<z.ZodString>;
|
|
43
|
+
export declare const DeleteLabelSchema: z.ZodObject<{
|
|
44
|
+
namespacePath: z.ZodString;
|
|
82
45
|
label_id: z.ZodUnion<[z.ZodString, z.ZodString]>;
|
|
83
46
|
}, "strip", z.ZodTypeAny, {
|
|
47
|
+
namespacePath: string;
|
|
84
48
|
label_id: string;
|
|
85
|
-
project_id?: string | undefined;
|
|
86
|
-
group_id?: string | undefined;
|
|
87
|
-
}, {
|
|
88
|
-
label_id: string;
|
|
89
|
-
project_id?: string | undefined;
|
|
90
|
-
group_id?: string | undefined;
|
|
91
|
-
}>, {
|
|
92
|
-
label_id: string;
|
|
93
|
-
project_id?: string | undefined;
|
|
94
|
-
group_id?: string | undefined;
|
|
95
49
|
}, {
|
|
50
|
+
namespacePath: string;
|
|
96
51
|
label_id: string;
|
|
97
|
-
project_id?: string | undefined;
|
|
98
|
-
group_id?: string | undefined;
|
|
99
52
|
}>;
|
|
100
53
|
export type CreateLabelOptions = z.infer<typeof CreateLabelSchema>;
|
|
101
54
|
export type UpdateLabelOptions = z.infer<typeof UpdateLabelSchema>;
|
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DeleteLabelSchema = exports.UpdateLabelSchema = exports.CreateLabelSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
exports.CreateLabelSchema = zod_1.z
|
|
6
|
-
.
|
|
7
|
-
project_id: zod_1.z.coerce.string().optional().describe('Project ID or URL-encoded path'),
|
|
8
|
-
group_id: zod_1.z.coerce.string().optional().describe('Group ID or URL-encoded path'),
|
|
5
|
+
exports.CreateLabelSchema = zod_1.z.object({
|
|
6
|
+
namespacePath: zod_1.z.string().describe('Namespace path (group or project) to create label in'),
|
|
9
7
|
name: zod_1.z.string().describe('The name of the label'),
|
|
10
8
|
color: zod_1.z
|
|
11
9
|
.string()
|
|
@@ -15,15 +13,10 @@ exports.CreateLabelSchema = zod_1.z
|
|
|
15
13
|
.number()
|
|
16
14
|
.optional()
|
|
17
15
|
.describe('The priority of the label. Must be greater or equal than zero or null to remove the priority'),
|
|
18
|
-
})
|
|
19
|
-
.refine((data) => Boolean(data.project_id) !== Boolean(data.group_id), {
|
|
20
|
-
message: 'Exactly one of project_id or group_id must be provided',
|
|
21
16
|
});
|
|
22
|
-
exports.UpdateLabelSchema = zod_1.z
|
|
23
|
-
.
|
|
24
|
-
|
|
25
|
-
group_id: zod_1.z.coerce.string().optional().describe('Group ID or URL-encoded path'),
|
|
26
|
-
label_id: zod_1.z.union([zod_1.z.coerce.string(), zod_1.z.string()]).describe('The ID or title of a group label'),
|
|
17
|
+
exports.UpdateLabelSchema = zod_1.z.object({
|
|
18
|
+
namespacePath: zod_1.z.string().describe('Namespace path (group or project) containing the label'),
|
|
19
|
+
label_id: zod_1.z.union([zod_1.z.coerce.string(), zod_1.z.string()]).describe('The ID or title of the label'),
|
|
27
20
|
new_name: zod_1.z.string().optional().describe('The new name of the label'),
|
|
28
21
|
color: zod_1.z
|
|
29
22
|
.string()
|
|
@@ -34,17 +27,9 @@ exports.UpdateLabelSchema = zod_1.z
|
|
|
34
27
|
.number()
|
|
35
28
|
.optional()
|
|
36
29
|
.describe('The priority of the label. Must be greater or equal than zero or null to remove the priority'),
|
|
37
|
-
})
|
|
38
|
-
.refine((data) => Boolean(data.project_id) !== Boolean(data.group_id), {
|
|
39
|
-
message: 'Exactly one of project_id or group_id must be provided',
|
|
40
30
|
});
|
|
41
|
-
exports.DeleteLabelSchema = zod_1.z
|
|
42
|
-
.
|
|
43
|
-
|
|
44
|
-
group_id: zod_1.z.coerce.string().optional().describe('Group ID or URL-encoded path'),
|
|
45
|
-
label_id: zod_1.z.union([zod_1.z.coerce.string(), zod_1.z.string()]).describe('The ID or title of a group label'),
|
|
46
|
-
})
|
|
47
|
-
.refine((data) => Boolean(data.project_id) !== Boolean(data.group_id), {
|
|
48
|
-
message: 'Exactly one of project_id or group_id must be provided',
|
|
31
|
+
exports.DeleteLabelSchema = zod_1.z.object({
|
|
32
|
+
namespacePath: zod_1.z.string().describe('Namespace path (group or project) containing the label'),
|
|
33
|
+
label_id: zod_1.z.union([zod_1.z.coerce.string(), zod_1.z.string()]).describe('The ID or title of the label'),
|
|
49
34
|
});
|
|
50
35
|
//# sourceMappingURL=schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/entities/labels/schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAKX,QAAA,iBAAiB,GAAG,OAAC
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/entities/labels/schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAKX,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sDAAsD,CAAC;IAC1F,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;IAClD,KAAK,EAAE,OAAC;SACL,MAAM,EAAE;SACR,QAAQ,CACP,yHAAyH,CAC1H;IACH,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;IAC3E,QAAQ,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etch_1 = require("../../utils/fetch");
|
|
11
|
+
const namespace_1 = require("../../utils/namespace");
|
|
11
12
|
exports.milestonesToolRegistry = new Map([
|
|
12
13
|
[
|
|
13
14
|
'list_milestones',
|
|
@@ -17,17 +18,15 @@ exports.milestonesToolRegistry = new Map([
|
|
|
17
18
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_readonly_1.ListProjectMilestonesSchema),
|
|
18
19
|
handler: async (args) => {
|
|
19
20
|
const options = schema_readonly_1.ListProjectMilestonesSchema.parse(args);
|
|
20
|
-
const {
|
|
21
|
-
const
|
|
22
|
-
const entityType = isProject ? 'projects' : 'groups';
|
|
23
|
-
const entityId = (isProject ? project_id : group_id);
|
|
21
|
+
const { namespacePath } = options;
|
|
22
|
+
const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(namespacePath);
|
|
24
23
|
const queryParams = new URLSearchParams();
|
|
25
24
|
Object.entries(options).forEach(([key, value]) => {
|
|
26
|
-
if (value !== undefined && value !== null && key !== '
|
|
25
|
+
if (value !== undefined && value !== null && key !== 'namespacePath') {
|
|
27
26
|
queryParams.set(key, String(value));
|
|
28
27
|
}
|
|
29
28
|
});
|
|
30
|
-
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${
|
|
29
|
+
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${encodedPath}/milestones?${queryParams}`;
|
|
31
30
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
32
31
|
headers: {
|
|
33
32
|
Authorization: `Bearer ${process.env.GITLAB_TOKEN}`,
|
|
@@ -49,11 +48,9 @@ exports.milestonesToolRegistry = new Map([
|
|
|
49
48
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_readonly_1.GetProjectMilestoneSchema),
|
|
50
49
|
handler: async (args) => {
|
|
51
50
|
const options = schema_readonly_1.GetProjectMilestoneSchema.parse(args);
|
|
52
|
-
const {
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
const entityId = (isProject ? project_id : group_id);
|
|
56
|
-
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${encodeURIComponent(entityId)}/milestones/${milestone_id}`;
|
|
51
|
+
const { namespacePath, milestone_id } = options;
|
|
52
|
+
const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(namespacePath);
|
|
53
|
+
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${encodedPath}/milestones/${milestone_id}`;
|
|
57
54
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
58
55
|
headers: {
|
|
59
56
|
Authorization: `Bearer ${process.env.GITLAB_TOKEN}`,
|
|
@@ -75,21 +72,18 @@ exports.milestonesToolRegistry = new Map([
|
|
|
75
72
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_readonly_1.GetMilestoneIssuesSchema),
|
|
76
73
|
handler: async (args) => {
|
|
77
74
|
const options = schema_readonly_1.GetMilestoneIssuesSchema.parse(args);
|
|
78
|
-
const {
|
|
79
|
-
const
|
|
80
|
-
const entityType = isProject ? 'projects' : 'groups';
|
|
81
|
-
const entityId = (isProject ? project_id : group_id);
|
|
75
|
+
const { namespacePath, milestone_id } = options;
|
|
76
|
+
const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(namespacePath);
|
|
82
77
|
const queryParams = new URLSearchParams();
|
|
83
78
|
Object.entries(options).forEach(([key, value]) => {
|
|
84
79
|
if (value !== undefined &&
|
|
85
80
|
value !== null &&
|
|
86
|
-
key !== '
|
|
87
|
-
key !== 'group_id' &&
|
|
81
|
+
key !== 'namespacePath' &&
|
|
88
82
|
key !== 'milestone_id') {
|
|
89
83
|
queryParams.set(key, String(value));
|
|
90
84
|
}
|
|
91
85
|
});
|
|
92
|
-
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${
|
|
86
|
+
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${encodedPath}/milestones/${milestone_id}/issues?${queryParams}`;
|
|
93
87
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
94
88
|
headers: {
|
|
95
89
|
Authorization: `Bearer ${process.env.GITLAB_TOKEN}`,
|
|
@@ -111,21 +105,18 @@ exports.milestonesToolRegistry = new Map([
|
|
|
111
105
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_readonly_1.GetMilestoneMergeRequestsSchema),
|
|
112
106
|
handler: async (args) => {
|
|
113
107
|
const options = schema_readonly_1.GetMilestoneMergeRequestsSchema.parse(args);
|
|
114
|
-
const {
|
|
115
|
-
const
|
|
116
|
-
const entityType = isProject ? 'projects' : 'groups';
|
|
117
|
-
const entityId = (isProject ? project_id : group_id);
|
|
108
|
+
const { namespacePath, milestone_id } = options;
|
|
109
|
+
const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(namespacePath);
|
|
118
110
|
const queryParams = new URLSearchParams();
|
|
119
111
|
Object.entries(options).forEach(([key, value]) => {
|
|
120
112
|
if (value !== undefined &&
|
|
121
113
|
value !== null &&
|
|
122
|
-
key !== '
|
|
123
|
-
key !== 'group_id' &&
|
|
114
|
+
key !== 'namespacePath' &&
|
|
124
115
|
key !== 'milestone_id') {
|
|
125
116
|
queryParams.set(key, String(value));
|
|
126
117
|
}
|
|
127
118
|
});
|
|
128
|
-
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${
|
|
119
|
+
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${encodedPath}/milestones/${milestone_id}/merge_requests?${queryParams}`;
|
|
129
120
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
130
121
|
headers: {
|
|
131
122
|
Authorization: `Bearer ${process.env.GITLAB_TOKEN}`,
|
|
@@ -147,11 +138,9 @@ exports.milestonesToolRegistry = new Map([
|
|
|
147
138
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_readonly_1.GetMilestoneBurndownEventsSchema),
|
|
148
139
|
handler: async (args) => {
|
|
149
140
|
const options = schema_readonly_1.GetMilestoneBurndownEventsSchema.parse(args);
|
|
150
|
-
const {
|
|
151
|
-
const
|
|
152
|
-
const
|
|
153
|
-
const entityId = (isProject ? project_id : group_id);
|
|
154
|
-
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${encodeURIComponent(entityId)}/milestones/${milestone_id}/burndown_events`;
|
|
141
|
+
const { namespacePath, milestone_id } = options;
|
|
142
|
+
const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(namespacePath);
|
|
143
|
+
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${encodedPath}/milestones/${milestone_id}/burndown_events`;
|
|
155
144
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
156
145
|
headers: {
|
|
157
146
|
Authorization: `Bearer ${process.env.GITLAB_TOKEN}`,
|
|
@@ -173,17 +162,15 @@ exports.milestonesToolRegistry = new Map([
|
|
|
173
162
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.CreateProjectMilestoneSchema),
|
|
174
163
|
handler: async (args) => {
|
|
175
164
|
const options = schema_1.CreateProjectMilestoneSchema.parse(args);
|
|
176
|
-
const {
|
|
177
|
-
const
|
|
178
|
-
const entityType = isProject ? 'projects' : 'groups';
|
|
179
|
-
const entityId = (isProject ? project_id : group_id);
|
|
165
|
+
const { namespacePath } = options;
|
|
166
|
+
const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(namespacePath);
|
|
180
167
|
const body = {};
|
|
181
168
|
Object.entries(options).forEach(([key, value]) => {
|
|
182
|
-
if (value !== undefined && value !== null && key !== '
|
|
169
|
+
if (value !== undefined && value !== null && key !== 'namespacePath') {
|
|
183
170
|
body[key] = value;
|
|
184
171
|
}
|
|
185
172
|
});
|
|
186
|
-
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${
|
|
173
|
+
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${encodedPath}/milestones`;
|
|
187
174
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
188
175
|
method: 'POST',
|
|
189
176
|
headers: {
|
|
@@ -208,21 +195,18 @@ exports.milestonesToolRegistry = new Map([
|
|
|
208
195
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.EditProjectMilestoneSchema),
|
|
209
196
|
handler: async (args) => {
|
|
210
197
|
const options = schema_1.EditProjectMilestoneSchema.parse(args);
|
|
211
|
-
const {
|
|
212
|
-
const
|
|
213
|
-
const entityType = isProject ? 'projects' : 'groups';
|
|
214
|
-
const entityId = (isProject ? project_id : group_id);
|
|
198
|
+
const { namespacePath, milestone_id } = options;
|
|
199
|
+
const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(namespacePath);
|
|
215
200
|
const body = {};
|
|
216
201
|
Object.entries(options).forEach(([key, value]) => {
|
|
217
202
|
if (value !== undefined &&
|
|
218
203
|
value !== null &&
|
|
219
|
-
key !== '
|
|
220
|
-
key !== 'group_id' &&
|
|
204
|
+
key !== 'namespacePath' &&
|
|
221
205
|
key !== 'milestone_id') {
|
|
222
206
|
body[key] = value;
|
|
223
207
|
}
|
|
224
208
|
});
|
|
225
|
-
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${
|
|
209
|
+
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${encodedPath}/milestones/${milestone_id}`;
|
|
226
210
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
227
211
|
method: 'PUT',
|
|
228
212
|
headers: {
|
|
@@ -247,11 +231,9 @@ exports.milestonesToolRegistry = new Map([
|
|
|
247
231
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.DeleteProjectMilestoneSchema),
|
|
248
232
|
handler: async (args) => {
|
|
249
233
|
const options = schema_1.DeleteProjectMilestoneSchema.parse(args);
|
|
250
|
-
const {
|
|
251
|
-
const
|
|
252
|
-
const
|
|
253
|
-
const entityId = (isProject ? project_id : group_id);
|
|
254
|
-
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${encodeURIComponent(entityId)}/milestones/${milestone_id}`;
|
|
234
|
+
const { namespacePath, milestone_id } = options;
|
|
235
|
+
const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(namespacePath);
|
|
236
|
+
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${encodedPath}/milestones/${milestone_id}`;
|
|
255
237
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
256
238
|
method: 'DELETE',
|
|
257
239
|
headers: {
|
|
@@ -274,11 +256,12 @@ exports.milestonesToolRegistry = new Map([
|
|
|
274
256
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.PromoteProjectMilestoneSchema),
|
|
275
257
|
handler: async (args) => {
|
|
276
258
|
const options = schema_1.PromoteProjectMilestoneSchema.parse(args);
|
|
277
|
-
const {
|
|
278
|
-
|
|
279
|
-
|
|
259
|
+
const { namespacePath, milestone_id } = options;
|
|
260
|
+
const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(namespacePath);
|
|
261
|
+
if (entityType !== 'projects') {
|
|
262
|
+
throw new Error('Milestone promotion is only available for projects, not groups');
|
|
280
263
|
}
|
|
281
|
-
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/projects/${
|
|
264
|
+
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/projects/${encodedPath}/milestones/${encodeURIComponent(milestone_id)}/promote`;
|
|
282
265
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
283
266
|
method: 'POST',
|
|
284
267
|
headers: {
|