@structured-world/gitlab-mcp 4.4.0 → 5.1.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 +1 -0
- package/dist/config.js +23 -23
- package/dist/config.js.map +1 -1
- package/dist/entities/core/index.d.ts +5 -5
- package/dist/entities/core/index.js +1 -1
- package/dist/entities/core/registry.d.ts +1 -1
- package/dist/entities/core/registry.js +149 -149
- package/dist/entities/core/registry.js.map +1 -1
- package/dist/entities/core/schema-readonly.d.ts +1 -1
- package/dist/entities/core/schema-readonly.js +132 -132
- package/dist/entities/core/schema-readonly.js.map +1 -1
- package/dist/entities/core/schema.d.ts +1 -1
- package/dist/entities/core/schema.js +59 -59
- package/dist/entities/files/index.d.ts +5 -5
- package/dist/entities/files/index.js +1 -1
- package/dist/entities/files/registry.d.ts +1 -1
- package/dist/entities/files/registry.js +32 -32
- package/dist/entities/files/registry.js.map +1 -1
- package/dist/entities/files/schema-readonly.d.ts +1 -1
- package/dist/entities/files/schema-readonly.js +10 -10
- package/dist/entities/files/schema.d.ts +1 -1
- package/dist/entities/files/schema.js +19 -19
- package/dist/entities/index.d.ts +10 -10
- package/dist/entities/labels/index.d.ts +5 -5
- package/dist/entities/labels/index.js +1 -1
- package/dist/entities/labels/registry.d.ts +1 -1
- package/dist/entities/labels/registry.js +31 -31
- package/dist/entities/labels/registry.js.map +1 -1
- package/dist/entities/labels/schema-readonly.d.ts +1 -1
- package/dist/entities/labels/schema-readonly.js +7 -7
- package/dist/entities/labels/schema.d.ts +1 -1
- package/dist/entities/labels/schema.js +11 -11
- package/dist/entities/milestones/index.d.ts +5 -5
- package/dist/entities/milestones/index.js +1 -1
- package/dist/entities/milestones/registry.d.ts +1 -1
- package/dist/entities/milestones/registry.js +49 -49
- package/dist/entities/milestones/registry.js.map +1 -1
- package/dist/entities/milestones/schema-readonly.d.ts +2 -2
- package/dist/entities/milestones/schema-readonly.js +11 -11
- package/dist/entities/milestones/schema.d.ts +3 -3
- package/dist/entities/milestones/schema.js +19 -17
- package/dist/entities/milestones/schema.js.map +1 -1
- package/dist/entities/mrs/index.d.ts +5 -5
- package/dist/entities/mrs/index.js +1 -1
- package/dist/entities/mrs/registry.d.ts +1 -1
- package/dist/entities/mrs/registry.js +118 -118
- package/dist/entities/mrs/registry.js.map +1 -1
- package/dist/entities/mrs/schema-readonly.d.ts +1 -1
- package/dist/entities/mrs/schema-readonly.js +47 -47
- package/dist/entities/mrs/schema-readonly.js.map +1 -1
- package/dist/entities/mrs/schema.d.ts +5 -5
- package/dist/entities/mrs/schema.js +91 -82
- package/dist/entities/mrs/schema.js.map +1 -1
- package/dist/entities/pipelines/index.d.ts +5 -5
- package/dist/entities/pipelines/index.js +1 -1
- package/dist/entities/pipelines/registry.d.ts +1 -1
- package/dist/entities/pipelines/registry.js +58 -58
- package/dist/entities/pipelines/registry.js.map +1 -1
- package/dist/entities/pipelines/schema-readonly.d.ts +1 -1
- package/dist/entities/pipelines/schema-readonly.js +65 -65
- package/dist/entities/pipelines/schema.d.ts +1 -1
- package/dist/entities/pipelines/schema.js +15 -15
- package/dist/entities/shared.d.ts +1 -1
- package/dist/entities/shared.js +7 -7
- package/dist/entities/utils.d.ts +1 -1
- package/dist/entities/utils.js +5 -5
- package/dist/entities/utils.js.map +1 -1
- package/dist/entities/variables/index.d.ts +5 -5
- package/dist/entities/variables/index.js +1 -1
- package/dist/entities/variables/registry.d.ts +1 -1
- package/dist/entities/variables/registry.js +29 -29
- package/dist/entities/variables/registry.js.map +1 -1
- package/dist/entities/variables/schema-readonly.d.ts +1 -1
- package/dist/entities/variables/schema-readonly.js +4 -4
- package/dist/entities/variables/schema.d.ts +1 -1
- package/dist/entities/variables/schema.js +32 -32
- package/dist/entities/variables/schema.js.map +1 -1
- package/dist/entities/wiki/index.d.ts +5 -5
- package/dist/entities/wiki/index.js +1 -1
- package/dist/entities/wiki/registry.d.ts +1 -1
- package/dist/entities/wiki/registry.js +26 -26
- package/dist/entities/wiki/registry.js.map +1 -1
- package/dist/entities/wiki/schema-readonly.d.ts +1 -1
- package/dist/entities/wiki/schema-readonly.js +4 -4
- package/dist/entities/wiki/schema.d.ts +1 -1
- package/dist/entities/wiki/schema.js +11 -11
- package/dist/entities/workitems/index.d.ts +5 -5
- package/dist/entities/workitems/index.js +1 -1
- package/dist/entities/workitems/registry.d.ts +1 -1
- package/dist/entities/workitems/registry.js +55 -55
- package/dist/entities/workitems/registry.js.map +1 -1
- package/dist/entities/workitems/schema-readonly.d.ts +1 -1
- package/dist/entities/workitems/schema-readonly.js +25 -25
- package/dist/entities/workitems/schema-readonly.js.map +1 -1
- package/dist/entities/workitems/schema.d.ts +1 -1
- package/dist/entities/workitems/schema.js +11 -11
- package/dist/graphql/DynamicWorkItemsQuery.d.ts +2 -2
- package/dist/graphql/DynamicWorkItemsQuery.js +47 -47
- package/dist/graphql/DynamicWorkItemsQuery.js.map +1 -1
- package/dist/graphql/client.d.ts +1 -1
- package/dist/graphql/client.js +4 -4
- package/dist/graphql/client.js.map +1 -1
- package/dist/graphql/index.d.ts +2 -2
- package/dist/graphql/workItems.d.ts +33 -33
- package/dist/graphql/workItems.js +29 -29
- package/dist/handlers.d.ts +1 -1
- package/dist/handlers.js +20 -20
- package/dist/handlers.js.map +1 -1
- package/dist/http-client.js +3 -3
- package/dist/logger.js +4 -4
- package/dist/registry-manager.d.ts +1 -1
- package/dist/registry-manager.js +27 -27
- package/dist/server.d.ts +1 -1
- package/dist/server.js +46 -46
- package/dist/services/ConnectionManager.d.ts +4 -4
- package/dist/services/ConnectionManager.js +13 -13
- package/dist/services/GitLabVersionDetector.d.ts +2 -2
- package/dist/services/GitLabVersionDetector.js +41 -41
- package/dist/services/GitLabVersionDetector.js.map +1 -1
- package/dist/services/SchemaIntrospector.d.ts +1 -1
- package/dist/services/SchemaIntrospector.js +42 -42
- package/dist/services/SchemaIntrospector.js.map +1 -1
- package/dist/services/ToolAvailability.d.ts +2 -2
- package/dist/services/ToolAvailability.js +279 -279
- package/dist/services/ToolAvailability.js.map +1 -1
- package/dist/services/WidgetAvailability.d.ts +3 -3
- package/dist/services/WidgetAvailability.js +32 -32
- package/dist/structured-world-gitlab-mcp-5.1.0.tgz +0 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types.js +4 -4
- package/dist/utils/fetch.d.ts +4 -4
- package/dist/utils/fetch.js +15 -15
- package/dist/utils/fetch.js.map +1 -1
- package/dist/utils/idConversion.js +33 -33
- package/dist/utils/idConversion.js.map +1 -1
- package/dist/utils/namespace.d.ts +2 -2
- package/dist/utils/namespace.js +13 -13
- package/dist/utils/smart-user-search.d.ts +1 -1
- package/dist/utils/smart-user-search.js +10 -10
- package/package.json +1 -1
- package/dist/structured-world-gitlab-mcp-4.4.0.tgz +0 -0
|
@@ -12,10 +12,10 @@ const idConversion_1 = require("../../utils/idConversion");
|
|
|
12
12
|
const namespace_1 = require("../../utils/namespace");
|
|
13
13
|
exports.wikiToolRegistry = new Map([
|
|
14
14
|
[
|
|
15
|
-
|
|
15
|
+
"list_wiki_pages",
|
|
16
16
|
{
|
|
17
|
-
name:
|
|
18
|
-
description:
|
|
17
|
+
name: "list_wiki_pages",
|
|
18
|
+
description: "BROWSE: Explore all wiki pages in project or group documentation. Use when: Discovering available guides and documentation, Understanding project knowledge base structure, Finding existing pages before creating new ones. Wiki provides collaborative documentation separate from code repository. Returns page titles, slugs, content formats, and creation dates.",
|
|
19
19
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_readonly_1.ListWikiPagesSchema),
|
|
20
20
|
handler: async (args) => {
|
|
21
21
|
const options = schema_readonly_1.ListWikiPagesSchema.parse(args);
|
|
@@ -23,7 +23,7 @@ exports.wikiToolRegistry = new Map([
|
|
|
23
23
|
const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(namespacePath);
|
|
24
24
|
const queryParams = new URLSearchParams();
|
|
25
25
|
Object.entries(options).forEach(([key, value]) => {
|
|
26
|
-
if (value !== undefined && value !== null && key !==
|
|
26
|
+
if (value !== undefined && value !== null && key !== "namespacePath") {
|
|
27
27
|
queryParams.set(key, String(value));
|
|
28
28
|
}
|
|
29
29
|
});
|
|
@@ -42,10 +42,10 @@ exports.wikiToolRegistry = new Map([
|
|
|
42
42
|
},
|
|
43
43
|
],
|
|
44
44
|
[
|
|
45
|
-
|
|
45
|
+
"get_wiki_page",
|
|
46
46
|
{
|
|
47
|
-
name:
|
|
48
|
-
description:
|
|
47
|
+
name: "get_wiki_page",
|
|
48
|
+
description: "READ: Get complete wiki page content and metadata by slug. Use when: Reading technical documentation and guides, Accessing project knowledge base content, Getting full markdown with formatting. Returns complete page content, metadata, edit history, and author information. Perfect for content analysis and documentation review.",
|
|
49
49
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_readonly_1.GetWikiPageSchema),
|
|
50
50
|
handler: async (args) => {
|
|
51
51
|
const options = schema_readonly_1.GetWikiPageSchema.parse(args);
|
|
@@ -53,7 +53,7 @@ exports.wikiToolRegistry = new Map([
|
|
|
53
53
|
const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(namespacePath);
|
|
54
54
|
const queryParams = new URLSearchParams();
|
|
55
55
|
Object.entries(options).forEach(([key, value]) => {
|
|
56
|
-
if (value !== undefined && value !== null && key !==
|
|
56
|
+
if (value !== undefined && value !== null && key !== "namespacePath" && key !== "slug") {
|
|
57
57
|
queryParams.set(key, String(value));
|
|
58
58
|
}
|
|
59
59
|
});
|
|
@@ -72,10 +72,10 @@ exports.wikiToolRegistry = new Map([
|
|
|
72
72
|
},
|
|
73
73
|
],
|
|
74
74
|
[
|
|
75
|
-
|
|
75
|
+
"create_wiki_page",
|
|
76
76
|
{
|
|
77
|
-
name:
|
|
78
|
-
description:
|
|
77
|
+
name: "create_wiki_page",
|
|
78
|
+
description: "CREATE: Add new documentation page to project or group wiki. Use when: Adding technical documentation, user guides, or FAQs, Creating project knowledge base content, Establishing team documentation standards. Check list_wiki_pages FIRST to avoid duplicate topics. Supports GitLab Flavored Markdown with extensions. Creates version-controlled documentation.",
|
|
79
79
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.CreateWikiPageSchema),
|
|
80
80
|
handler: async (args) => {
|
|
81
81
|
const options = schema_1.CreateWikiPageSchema.parse(args);
|
|
@@ -83,16 +83,16 @@ exports.wikiToolRegistry = new Map([
|
|
|
83
83
|
const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(namespacePath);
|
|
84
84
|
const body = {};
|
|
85
85
|
Object.entries(options).forEach(([key, value]) => {
|
|
86
|
-
if (value !== undefined && value !== null && key !==
|
|
86
|
+
if (value !== undefined && value !== null && key !== "namespacePath") {
|
|
87
87
|
body[key] = value;
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${encodedPath}/wikis`;
|
|
91
91
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
92
|
-
method:
|
|
92
|
+
method: "POST",
|
|
93
93
|
headers: {
|
|
94
94
|
Authorization: `Bearer ${process.env.GITLAB_TOKEN}`,
|
|
95
|
-
|
|
95
|
+
"Content-Type": "application/json",
|
|
96
96
|
},
|
|
97
97
|
body: JSON.stringify(body),
|
|
98
98
|
});
|
|
@@ -105,10 +105,10 @@ exports.wikiToolRegistry = new Map([
|
|
|
105
105
|
},
|
|
106
106
|
],
|
|
107
107
|
[
|
|
108
|
-
|
|
108
|
+
"update_wiki_page",
|
|
109
109
|
{
|
|
110
|
-
name:
|
|
111
|
-
description:
|
|
110
|
+
name: "update_wiki_page",
|
|
111
|
+
description: "UPDATE: Modify existing wiki page content or properties. Use when: Updating documentation with new information, Fixing errors or improving clarity, Reorganizing content structure. Maintains complete version history with change tracking. Supports collaborative editing with author attribution and diff viewing.",
|
|
112
112
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.UpdateWikiPageSchema),
|
|
113
113
|
handler: async (args) => {
|
|
114
114
|
const options = schema_1.UpdateWikiPageSchema.parse(args);
|
|
@@ -116,16 +116,16 @@ exports.wikiToolRegistry = new Map([
|
|
|
116
116
|
const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(namespacePath);
|
|
117
117
|
const body = {};
|
|
118
118
|
Object.entries(options).forEach(([key, value]) => {
|
|
119
|
-
if (value !== undefined && value !== null && key !==
|
|
119
|
+
if (value !== undefined && value !== null && key !== "namespacePath" && key !== "slug") {
|
|
120
120
|
body[key] = value;
|
|
121
121
|
}
|
|
122
122
|
});
|
|
123
123
|
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${encodedPath}/wikis/${encodeURIComponent(slug)}`;
|
|
124
124
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
125
|
-
method:
|
|
125
|
+
method: "PUT",
|
|
126
126
|
headers: {
|
|
127
127
|
Authorization: `Bearer ${process.env.GITLAB_TOKEN}`,
|
|
128
|
-
|
|
128
|
+
"Content-Type": "application/json",
|
|
129
129
|
},
|
|
130
130
|
body: JSON.stringify(body),
|
|
131
131
|
});
|
|
@@ -138,10 +138,10 @@ exports.wikiToolRegistry = new Map([
|
|
|
138
138
|
},
|
|
139
139
|
],
|
|
140
140
|
[
|
|
141
|
-
|
|
141
|
+
"delete_wiki_page",
|
|
142
142
|
{
|
|
143
|
-
name:
|
|
144
|
-
description:
|
|
143
|
+
name: "delete_wiki_page",
|
|
144
|
+
description: "DELETE: Permanently remove wiki page from documentation. Use when: Cleaning up outdated or obsolete content, Removing duplicate or incorrect pages, Reorganizing wiki structure. WARNING: Deletes page and ALL version history permanently - cannot be undone. Consider archiving important content first.",
|
|
145
145
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.DeleteWikiPageSchema),
|
|
146
146
|
handler: async (args) => {
|
|
147
147
|
const options = schema_1.DeleteWikiPageSchema.parse(args);
|
|
@@ -149,7 +149,7 @@ exports.wikiToolRegistry = new Map([
|
|
|
149
149
|
const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(namespacePath);
|
|
150
150
|
const apiUrl = `${process.env.GITLAB_API_URL}/api/v4/${entityType}/${encodedPath}/wikis/${encodeURIComponent(slug)}`;
|
|
151
151
|
const response = await (0, fetch_1.enhancedFetch)(apiUrl, {
|
|
152
|
-
method:
|
|
152
|
+
method: "DELETE",
|
|
153
153
|
headers: {
|
|
154
154
|
Authorization: `Bearer ${process.env.GITLAB_TOKEN}`,
|
|
155
155
|
},
|
|
@@ -164,7 +164,7 @@ exports.wikiToolRegistry = new Map([
|
|
|
164
164
|
],
|
|
165
165
|
]);
|
|
166
166
|
function getWikiReadOnlyToolNames() {
|
|
167
|
-
return [
|
|
167
|
+
return ["list_wiki_pages", "get_wiki_page"];
|
|
168
168
|
}
|
|
169
169
|
function getWikiToolDefinitions() {
|
|
170
170
|
return Array.from(exports.wikiToolRegistry.values());
|
|
@@ -172,7 +172,7 @@ function getWikiToolDefinitions() {
|
|
|
172
172
|
function getFilteredWikiTools(readOnlyMode = false) {
|
|
173
173
|
if (readOnlyMode) {
|
|
174
174
|
const readOnlyNames = getWikiReadOnlyToolNames();
|
|
175
|
-
return Array.from(exports.wikiToolRegistry.values()).filter(
|
|
175
|
+
return Array.from(exports.wikiToolRegistry.values()).filter(tool => readOnlyNames.includes(tool.name));
|
|
176
176
|
}
|
|
177
177
|
return getWikiToolDefinitions();
|
|
178
178
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/entities/wiki/registry.ts"],"names":[],"mappings":";;;AA8MA,4DAEC;AAKD,wDAEC;AAKD,
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/entities/wiki/registry.ts"],"names":[],"mappings":";;;AA8MA,4DAEC;AAKD,wDAEC;AAKD,oDAMC;AAjOD,2DAAqD;AACrD,uDAA2E;AAC3E,qCAA4F;AAC5F,6CAAkD;AAClD,2DAA+D;A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ared_1 = require("../shared");
|
|
|
6
6
|
const utils_1 = require("../utils");
|
|
7
7
|
exports.ListWikiPagesSchema = zod_1.z
|
|
8
8
|
.object({
|
|
9
|
-
namespacePath: zod_1.z.string().describe(
|
|
10
|
-
with_content: utils_1.flexibleBoolean.optional().describe(
|
|
9
|
+
namespacePath: zod_1.z.string().describe("Namespace path (group or project) to list wiki pages from"),
|
|
10
|
+
with_content: utils_1.flexibleBoolean.optional().describe("Include content of the wiki pages"),
|
|
11
11
|
})
|
|
12
12
|
.merge(shared_1.PaginationOptionsSchema);
|
|
13
13
|
exports.GetWikiPageSchema = zod_1.z.object({
|
|
14
|
-
namespacePath: zod_1.z.string().describe(
|
|
15
|
-
slug: zod_1.z.string().describe(
|
|
14
|
+
namespacePath: zod_1.z.string().describe("Namespace path (group or project) containing the wiki page"),
|
|
15
|
+
slug: zod_1.z.string().describe("URL-encoded slug of the wiki page"),
|
|
16
16
|
});
|
|
17
17
|
exports.GitLabWikiPageSchema = zod_1.z.object({
|
|
18
18
|
title: zod_1.z.string(),
|
|
@@ -3,20 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DeleteWikiPageSchema = exports.UpdateWikiPageSchema = exports.CreateWikiPageSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
exports.CreateWikiPageSchema = zod_1.z.object({
|
|
6
|
-
namespacePath: zod_1.z.string().describe(
|
|
7
|
-
title: zod_1.z.string().describe(
|
|
8
|
-
content: zod_1.z.string().describe(
|
|
9
|
-
format: zod_1.z.string().optional().describe(
|
|
6
|
+
namespacePath: zod_1.z.string().describe("Namespace path (group or project) to create wiki page in"),
|
|
7
|
+
title: zod_1.z.string().describe("Title of the wiki page"),
|
|
8
|
+
content: zod_1.z.string().describe("Content of the wiki page"),
|
|
9
|
+
format: zod_1.z.string().optional().describe("Content format, e.g., markdown, rdoc"),
|
|
10
10
|
});
|
|
11
11
|
exports.UpdateWikiPageSchema = zod_1.z.object({
|
|
12
|
-
namespacePath: zod_1.z.string().describe(
|
|
13
|
-
slug: zod_1.z.string().describe(
|
|
14
|
-
title: zod_1.z.string().optional().describe(
|
|
15
|
-
content: zod_1.z.string().optional().describe(
|
|
16
|
-
format: zod_1.z.string().optional().describe(
|
|
12
|
+
namespacePath: zod_1.z.string().describe("Namespace path (group or project) containing the wiki page"),
|
|
13
|
+
slug: zod_1.z.string().describe("URL-encoded slug of the wiki page"),
|
|
14
|
+
title: zod_1.z.string().optional().describe("New title of the wiki page"),
|
|
15
|
+
content: zod_1.z.string().optional().describe("New content of the wiki page"),
|
|
16
|
+
format: zod_1.z.string().optional().describe("Content format, e.g., markdown, rdoc"),
|
|
17
17
|
});
|
|
18
18
|
exports.DeleteWikiPageSchema = zod_1.z.object({
|
|
19
|
-
namespacePath: zod_1.z.string().describe(
|
|
20
|
-
slug: zod_1.z.string().describe(
|
|
19
|
+
namespacePath: zod_1.z.string().describe("Namespace path (group or project) containing the wiki page"),
|
|
20
|
+
slug: zod_1.z.string().describe("URL-encoded slug of the wiki page"),
|
|
21
21
|
});
|
|
22
22
|
//# sourceMappingURL=schema.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
import type { ToolDefinition } from
|
|
1
|
+
export * from "../shared";
|
|
2
|
+
export * from "./schema-readonly";
|
|
3
|
+
export * from "./schema";
|
|
4
|
+
export * from "./registry";
|
|
5
|
+
import type { ToolDefinition } from "../../types";
|
|
6
6
|
export declare const workitemsTools: ToolDefinition[];
|
|
7
7
|
export declare const workitemsReadOnlyTools: string[];
|
|
@@ -20,7 +20,7 @@ __exportStar(require("./schema-readonly"), exports);
|
|
|
20
20
|
__exportStar(require("./schema"), exports);
|
|
21
21
|
__exportStar(require("./registry"), exports);
|
|
22
22
|
const registry_1 = require("./registry");
|
|
23
|
-
const isReadOnly = process.env.GITLAB_READONLY ===
|
|
23
|
+
const isReadOnly = process.env.GITLAB_READONLY === "true";
|
|
24
24
|
const workitemsToolsFromRegistry = (0, registry_1.getFilteredWorkitemsTools)(isReadOnly);
|
|
25
25
|
exports.workitemsTools = workitemsToolsFromRegistry.map((tool) => ({
|
|
26
26
|
name: tool.name,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ToolRegistry, EnhancedToolDefinition } from
|
|
1
|
+
import { ToolRegistry, EnhancedToolDefinition } from "../../types";
|
|
2
2
|
export declare const workitemsToolRegistry: ToolRegistry;
|
|
3
3
|
export declare function getWorkitemsReadOnlyToolNames(): string[];
|
|
4
4
|
export declare function getWorkitemsToolDefinitions(): EnhancedToolDefinition[];
|
|
@@ -13,16 +13,16 @@ const idConversion_1 = require("../../utils/idConversion");
|
|
|
13
13
|
const workItems_1 = require("../../graphql/workItems");
|
|
14
14
|
exports.workitemsToolRegistry = new Map([
|
|
15
15
|
[
|
|
16
|
-
|
|
16
|
+
"list_work_items",
|
|
17
17
|
{
|
|
18
|
-
name:
|
|
19
|
-
description:
|
|
18
|
+
name: "list_work_items",
|
|
19
|
+
description: "List work items from a namespace (groups or projects). Core tool for tracking issues, epics, tasks, and incidents. Shows existing label usage patterns for better labeling decisions. Supports 9 work item types including Test Cases and Requirements. Returns open items by default. Filter by type, state, with pagination. Groups contain Epics; projects contain Issues/Tasks/Incidents. Use with list_labels to understand complete taxonomy.",
|
|
20
20
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_readonly_1.ListWorkItemsSchema),
|
|
21
21
|
handler: async (args) => {
|
|
22
|
-
console.log(
|
|
22
|
+
console.log("list_work_items called with args:", JSON.stringify(args, null, 2));
|
|
23
23
|
const options = schema_readonly_1.ListWorkItemsSchema.parse(args);
|
|
24
24
|
const { namespacePath, types, state, first, after, simple, active } = options;
|
|
25
|
-
console.log(
|
|
25
|
+
console.log("Parsed options:", {
|
|
26
26
|
namespacePath,
|
|
27
27
|
types,
|
|
28
28
|
state,
|
|
@@ -39,17 +39,17 @@ exports.workitemsToolRegistry = new Map([
|
|
|
39
39
|
iid: workItem.iid,
|
|
40
40
|
title: workItem.title,
|
|
41
41
|
state: workItem.state,
|
|
42
|
-
workItemType: typeof workItem.workItemType ===
|
|
42
|
+
workItemType: typeof workItem.workItemType === "string"
|
|
43
43
|
? workItem.workItemType
|
|
44
|
-
: workItem.workItemType?.name ||
|
|
44
|
+
: workItem.workItemType?.name || "Unknown",
|
|
45
45
|
webUrl: workItem.webUrl,
|
|
46
46
|
createdAt: workItem.createdAt,
|
|
47
47
|
updatedAt: workItem.updatedAt,
|
|
48
48
|
};
|
|
49
|
-
if (workItem.description && typeof workItem.description ===
|
|
49
|
+
if (workItem.description && typeof workItem.description === "string") {
|
|
50
50
|
simplified.description =
|
|
51
51
|
workItem.description.length > 200
|
|
52
|
-
? workItem.description.substring(0, 200) +
|
|
52
|
+
? workItem.description.substring(0, 200) + "..."
|
|
53
53
|
: workItem.description;
|
|
54
54
|
}
|
|
55
55
|
if (workItem.widgets && Array.isArray(workItem.widgets)) {
|
|
@@ -57,11 +57,11 @@ exports.workitemsToolRegistry = new Map([
|
|
|
57
57
|
for (const widget of workItem.widgets) {
|
|
58
58
|
const flexWidget = widget;
|
|
59
59
|
switch (flexWidget.type) {
|
|
60
|
-
case
|
|
60
|
+
case "ASSIGNEES":
|
|
61
61
|
if (flexWidget.assignees?.nodes && flexWidget.assignees.nodes.length > 0) {
|
|
62
62
|
essentialWidgets.push({
|
|
63
|
-
type:
|
|
64
|
-
assignees: flexWidget.assignees.nodes.map(
|
|
63
|
+
type: "ASSIGNEES",
|
|
64
|
+
assignees: flexWidget.assignees.nodes.map(assignee => ({
|
|
65
65
|
id: assignee.id,
|
|
66
66
|
username: assignee.username,
|
|
67
67
|
name: assignee.name,
|
|
@@ -69,11 +69,11 @@ exports.workitemsToolRegistry = new Map([
|
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
break;
|
|
72
|
-
case
|
|
72
|
+
case "LABELS":
|
|
73
73
|
if (flexWidget.labels?.nodes && flexWidget.labels.nodes.length > 0) {
|
|
74
74
|
essentialWidgets.push({
|
|
75
|
-
type:
|
|
76
|
-
labels: flexWidget.labels.nodes.map(
|
|
75
|
+
type: "LABELS",
|
|
76
|
+
labels: flexWidget.labels.nodes.map(label => ({
|
|
77
77
|
id: label.id,
|
|
78
78
|
title: label.title,
|
|
79
79
|
color: label.color,
|
|
@@ -81,10 +81,10 @@ exports.workitemsToolRegistry = new Map([
|
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
break;
|
|
84
|
-
case
|
|
84
|
+
case "MILESTONE":
|
|
85
85
|
if (flexWidget.milestone) {
|
|
86
86
|
essentialWidgets.push({
|
|
87
|
-
type:
|
|
87
|
+
type: "MILESTONE",
|
|
88
88
|
milestone: {
|
|
89
89
|
id: flexWidget.milestone.id,
|
|
90
90
|
title: flexWidget.milestone.title,
|
|
@@ -93,10 +93,10 @@ exports.workitemsToolRegistry = new Map([
|
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
95
|
break;
|
|
96
|
-
case
|
|
96
|
+
case "HIERARCHY":
|
|
97
97
|
if (flexWidget.parent || flexWidget.hasChildren) {
|
|
98
98
|
essentialWidgets.push({
|
|
99
|
-
type:
|
|
99
|
+
type: "HIERARCHY",
|
|
100
100
|
parent: flexWidget.parent
|
|
101
101
|
? {
|
|
102
102
|
id: flexWidget.parent.id,
|
|
@@ -119,7 +119,7 @@ exports.workitemsToolRegistry = new Map([
|
|
|
119
119
|
};
|
|
120
120
|
const connectionManager = ConnectionManager_1.ConnectionManager.getInstance();
|
|
121
121
|
const client = connectionManager.getClient();
|
|
122
|
-
console.log(
|
|
122
|
+
console.log("Querying namespace:", namespacePath);
|
|
123
123
|
let resolvedTypes = types;
|
|
124
124
|
const workItemsResponse = await client.request(workItems_1.GET_NAMESPACE_WORK_ITEMS, {
|
|
125
125
|
namespacePath: namespacePath,
|
|
@@ -133,19 +133,19 @@ exports.workitemsToolRegistry = new Map([
|
|
|
133
133
|
hasNextPage: workItemsData?.pageInfo?.hasNextPage ?? false,
|
|
134
134
|
endCursor: workItemsData?.pageInfo?.endCursor ?? null,
|
|
135
135
|
};
|
|
136
|
-
const namespaceType = workItemsResponse.namespace?.__typename ??
|
|
136
|
+
const namespaceType = workItemsResponse.namespace?.__typename ?? "Unknown";
|
|
137
137
|
console.log(`Found ${allItems.length} work items from ${namespaceType} query`);
|
|
138
138
|
const filteredItems = allItems.filter((item) => {
|
|
139
139
|
return state.includes(item.state);
|
|
140
140
|
});
|
|
141
|
-
console.log(`State filtering: ${allItems.length} → ${filteredItems.length} items (keeping: ${state.join(
|
|
141
|
+
console.log(`State filtering: ${allItems.length} → ${filteredItems.length} items (keeping: ${state.join(", ")})`);
|
|
142
142
|
const finalResults = filteredItems.map((item) => {
|
|
143
143
|
const cleanedItem = (0, idConversion_1.cleanWorkItemResponse)(item);
|
|
144
144
|
return simplifyWorkItem(cleanedItem);
|
|
145
145
|
});
|
|
146
|
-
console.log(
|
|
146
|
+
console.log("Final result - total work items found:", finalResults.length);
|
|
147
147
|
if (simple) {
|
|
148
|
-
console.log(
|
|
148
|
+
console.log("Using simplified structure for agent consumption");
|
|
149
149
|
}
|
|
150
150
|
return {
|
|
151
151
|
items: finalResults,
|
|
@@ -156,17 +156,17 @@ exports.workitemsToolRegistry = new Map([
|
|
|
156
156
|
},
|
|
157
157
|
],
|
|
158
158
|
[
|
|
159
|
-
|
|
159
|
+
"get_work_item",
|
|
160
160
|
{
|
|
161
|
-
name:
|
|
162
|
-
description:
|
|
161
|
+
name: "get_work_item",
|
|
162
|
+
description: "Get complete work item details by ID. Returns full data including widgets (assignees, labels, milestones, hierarchy, time tracking, custom fields). Essential for issue/epic management and tracking project progress. Each work item type has different widget capabilities.",
|
|
163
163
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_readonly_1.GetWorkItemSchema),
|
|
164
164
|
handler: async (args) => {
|
|
165
165
|
const options = schema_readonly_1.GetWorkItemSchema.parse(args);
|
|
166
166
|
const { id } = options;
|
|
167
167
|
const connectionManager = ConnectionManager_1.ConnectionManager.getInstance();
|
|
168
168
|
const client = connectionManager.getClient();
|
|
169
|
-
const workItemGid = (0, idConversion_1.toGid)(id,
|
|
169
|
+
const workItemGid = (0, idConversion_1.toGid)(id, "WorkItem");
|
|
170
170
|
const response = await client.request(workItems_1.GET_WORK_ITEM, { id: workItemGid });
|
|
171
171
|
if (!response.workItem) {
|
|
172
172
|
throw new Error(`Work item with ID "${id}" not found`);
|
|
@@ -176,10 +176,10 @@ exports.workitemsToolRegistry = new Map([
|
|
|
176
176
|
},
|
|
177
177
|
],
|
|
178
178
|
[
|
|
179
|
-
|
|
179
|
+
"create_work_item",
|
|
180
180
|
{
|
|
181
|
-
name:
|
|
182
|
-
description:
|
|
181
|
+
name: "create_work_item",
|
|
182
|
+
description: "Create work items for issue tracking and project management. LABEL WORKFLOW: Run list_labels first to discover existing labels, then use label IDs from response. CRITICAL: Epics require GROUP namespace, Issues/Tasks/Incidents require PROJECT namespace. Supports 9 types: Epic, Issue, Task, Incident, Test Case, Requirement, Objective, Key Result, Ticket. NOTE: Test Cases and Requirements do not support labels widget. Automatically assigns widgets (assignees, labels, milestones) based on type capabilities.",
|
|
183
183
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.CreateWorkItemSchema),
|
|
184
184
|
handler: async (args) => {
|
|
185
185
|
const options = schema_1.CreateWorkItemSchema.parse(args);
|
|
@@ -187,10 +187,10 @@ exports.workitemsToolRegistry = new Map([
|
|
|
187
187
|
const connectionManager = ConnectionManager_1.ConnectionManager.getInstance();
|
|
188
188
|
const client = connectionManager.getClient();
|
|
189
189
|
const workItemTypes = await (0, workItemTypes_1.getWorkItemTypes)(namespacePath);
|
|
190
|
-
const workItemTypeObj = workItemTypes.find((t) => t.name.toUpperCase().replace(/\s+/g,
|
|
191
|
-
workItemType.toUpperCase().replace(/\s+/g,
|
|
190
|
+
const workItemTypeObj = workItemTypes.find((t) => t.name.toUpperCase().replace(/\s+/g, "_") ===
|
|
191
|
+
workItemType.toUpperCase().replace(/\s+/g, "_"));
|
|
192
192
|
if (!workItemTypeObj) {
|
|
193
|
-
throw new Error(`Work item type "${workItemType}" not found in namespace "${namespacePath}". Available types: ${workItemTypes.map(
|
|
193
|
+
throw new Error(`Work item type "${workItemType}" not found in namespace "${namespacePath}". Available types: ${workItemTypes.map(t => t.name).join(", ")}`);
|
|
194
194
|
}
|
|
195
195
|
const input = {
|
|
196
196
|
namespacePath,
|
|
@@ -201,37 +201,37 @@ exports.workitemsToolRegistry = new Map([
|
|
|
201
201
|
input.description = description;
|
|
202
202
|
}
|
|
203
203
|
if (assigneeIds !== undefined && assigneeIds.length > 0) {
|
|
204
|
-
input.assigneesWidget = { assigneeIds: (0, idConversion_1.toGids)(assigneeIds,
|
|
204
|
+
input.assigneesWidget = { assigneeIds: (0, idConversion_1.toGids)(assigneeIds, "User") };
|
|
205
205
|
}
|
|
206
206
|
if (labelIds !== undefined && labelIds.length > 0) {
|
|
207
|
-
input.labelsWidget = { labelIds: (0, idConversion_1.toGids)(labelIds,
|
|
207
|
+
input.labelsWidget = { labelIds: (0, idConversion_1.toGids)(labelIds, "Label") };
|
|
208
208
|
}
|
|
209
209
|
if (milestoneId !== undefined) {
|
|
210
|
-
input.milestoneWidget = { milestoneId: (0, idConversion_1.toGid)(milestoneId,
|
|
210
|
+
input.milestoneWidget = { milestoneId: (0, idConversion_1.toGid)(milestoneId, "Milestone") };
|
|
211
211
|
}
|
|
212
212
|
const response = await client.request(workItems_1.CREATE_WORK_ITEM_WITH_WIDGETS, { input });
|
|
213
213
|
if (response.workItemCreate?.errors?.length && response.workItemCreate.errors.length > 0) {
|
|
214
|
-
throw new Error(`GitLab GraphQL errors: ${response.workItemCreate.errors.join(
|
|
214
|
+
throw new Error(`GitLab GraphQL errors: ${response.workItemCreate.errors.join(", ")}`);
|
|
215
215
|
}
|
|
216
216
|
if (!response.workItemCreate?.workItem) {
|
|
217
|
-
throw new Error(
|
|
217
|
+
throw new Error("Work item creation failed - no work item returned");
|
|
218
218
|
}
|
|
219
219
|
return (0, idConversion_1.cleanWorkItemResponse)(response.workItemCreate.workItem);
|
|
220
220
|
},
|
|
221
221
|
},
|
|
222
222
|
],
|
|
223
223
|
[
|
|
224
|
-
|
|
224
|
+
"update_work_item",
|
|
225
225
|
{
|
|
226
|
-
name:
|
|
227
|
-
description:
|
|
226
|
+
name: "update_work_item",
|
|
227
|
+
description: "Update work item properties for issue/epic management. LABEL WORKFLOW: Run list_labels first to discover existing labels, then use label IDs from response. Modify title, description, assignees, labels, milestones, and state (open/close). Supports widget updates including clearing assignees with empty arrays. NOTE: Test Cases and Requirements do not support labels widget. Essential for project workflow and status tracking.",
|
|
228
228
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.UpdateWorkItemSchema),
|
|
229
229
|
handler: async (args) => {
|
|
230
230
|
const options = schema_1.UpdateWorkItemSchema.parse(args);
|
|
231
231
|
const { id, title, description, state, assigneeIds, labelIds, milestoneId } = options;
|
|
232
232
|
const connectionManager = ConnectionManager_1.ConnectionManager.getInstance();
|
|
233
233
|
const client = connectionManager.getClient();
|
|
234
|
-
const workItemGid = (0, idConversion_1.toGid)(id,
|
|
234
|
+
const workItemGid = (0, idConversion_1.toGid)(id, "WorkItem");
|
|
235
235
|
const input = { id: workItemGid };
|
|
236
236
|
if (title !== undefined)
|
|
237
237
|
input.title = title;
|
|
@@ -241,40 +241,40 @@ exports.workitemsToolRegistry = new Map([
|
|
|
241
241
|
input.descriptionWidget = { description };
|
|
242
242
|
}
|
|
243
243
|
if (assigneeIds !== undefined) {
|
|
244
|
-
input.assigneesWidget = { assigneeIds: (0, idConversion_1.toGids)(assigneeIds,
|
|
244
|
+
input.assigneesWidget = { assigneeIds: (0, idConversion_1.toGids)(assigneeIds, "User") };
|
|
245
245
|
}
|
|
246
246
|
if (labelIds !== undefined) {
|
|
247
|
-
input.labelsWidget = { addLabelIds: (0, idConversion_1.toGids)(labelIds,
|
|
247
|
+
input.labelsWidget = { addLabelIds: (0, idConversion_1.toGids)(labelIds, "Label") };
|
|
248
248
|
}
|
|
249
249
|
if (milestoneId !== undefined) {
|
|
250
|
-
input.milestoneWidget = { milestoneId: (0, idConversion_1.toGid)(milestoneId,
|
|
250
|
+
input.milestoneWidget = { milestoneId: (0, idConversion_1.toGid)(milestoneId, "Milestone") };
|
|
251
251
|
}
|
|
252
252
|
const response = await client.request(workItems_1.UPDATE_WORK_ITEM, { input });
|
|
253
253
|
if (response.workItemUpdate?.errors?.length && response.workItemUpdate.errors.length > 0) {
|
|
254
|
-
throw new Error(`GitLab GraphQL errors: ${response.workItemUpdate.errors.join(
|
|
254
|
+
throw new Error(`GitLab GraphQL errors: ${response.workItemUpdate.errors.join(", ")}`);
|
|
255
255
|
}
|
|
256
256
|
if (!response.workItemUpdate?.workItem) {
|
|
257
|
-
throw new Error(
|
|
257
|
+
throw new Error("Work item update failed - no work item returned");
|
|
258
258
|
}
|
|
259
259
|
return (0, idConversion_1.cleanWorkItemResponse)(response.workItemUpdate.workItem);
|
|
260
260
|
},
|
|
261
261
|
},
|
|
262
262
|
],
|
|
263
263
|
[
|
|
264
|
-
|
|
264
|
+
"delete_work_item",
|
|
265
265
|
{
|
|
266
|
-
name:
|
|
267
|
-
description:
|
|
266
|
+
name: "delete_work_item",
|
|
267
|
+
description: "Permanently delete work items. WARNING: Cannot be undone. Removes all data, comments, time tracking, and references. Use for cleanup or removing invalid issues/epics. Consider closing instead of deleting for audit trails.",
|
|
268
268
|
inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.DeleteWorkItemSchema),
|
|
269
269
|
handler: async (args) => {
|
|
270
270
|
const options = schema_1.DeleteWorkItemSchema.parse(args);
|
|
271
271
|
const { id } = options;
|
|
272
272
|
const connectionManager = ConnectionManager_1.ConnectionManager.getInstance();
|
|
273
273
|
const client = connectionManager.getClient();
|
|
274
|
-
const workItemGid = (0, idConversion_1.toGid)(id,
|
|
274
|
+
const workItemGid = (0, idConversion_1.toGid)(id, "WorkItem");
|
|
275
275
|
const response = await client.request(workItems_1.DELETE_WORK_ITEM, { id: workItemGid });
|
|
276
276
|
if (response.workItemDelete?.errors?.length && response.workItemDelete.errors.length > 0) {
|
|
277
|
-
throw new Error(`GitLab GraphQL errors: ${response.workItemDelete.errors.join(
|
|
277
|
+
throw new Error(`GitLab GraphQL errors: ${response.workItemDelete.errors.join(", ")}`);
|
|
278
278
|
}
|
|
279
279
|
return { deleted: true };
|
|
280
280
|
},
|
|
@@ -282,7 +282,7 @@ exports.workitemsToolRegistry = new Map([
|
|
|
282
282
|
],
|
|
283
283
|
]);
|
|
284
284
|
function getWorkitemsReadOnlyToolNames() {
|
|
285
|
-
return [
|
|
285
|
+
return ["list_work_items", "get_work_item"];
|
|
286
286
|
}
|
|
287
287
|
function getWorkitemsToolDefinitions() {
|
|
288
288
|
return Array.from(exports.workitemsToolRegistry.values());
|
|
@@ -290,7 +290,7 @@ function getWorkitemsToolDefinitions() {
|
|
|
290
290
|
function getFilteredWorkitemsTools(readOnlyMode = false) {
|
|
291
291
|
if (readOnlyMode) {
|
|
292
292
|
const readOnlyNames = getWorkitemsReadOnlyToolNames();
|
|
293
|
-
return Array.from(exports.workitemsToolRegistry.values()).filter(
|
|
293
|
+
return Array.from(exports.workitemsToolRegistry.values()).filter(tool => readOnlyNames.includes(tool.name));
|
|
294
294
|
}
|
|
295
295
|
return getWorkitemsToolDefinitions();
|
|
296
296
|
}
|