opencode-gitlab-plugin 2.3.0 → 2.5.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/CHANGELOG.md +25 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +452 -27
- package/dist/index.js.map +1 -1
- package/dist/mcp-server.cjs +118 -36
- package/dist/mcp-server.cjs.map +1 -1
- package/package.json +1 -1
package/dist/mcp-server.cjs
CHANGED
|
@@ -3945,7 +3945,7 @@ var require_core = __commonJS({
|
|
|
3945
3945
|
constructor(opts = {}) {
|
|
3946
3946
|
this.schemas = {};
|
|
3947
3947
|
this.refs = {};
|
|
3948
|
-
this.formats =
|
|
3948
|
+
this.formats = /* @__PURE__ */ Object.create(null);
|
|
3949
3949
|
this._compilations = /* @__PURE__ */ new Set();
|
|
3950
3950
|
this._loading = {};
|
|
3951
3951
|
this._cache = /* @__PURE__ */ new Map();
|
|
@@ -10507,7 +10507,6 @@ ZodNaN.create = (params) => {
|
|
|
10507
10507
|
...processCreateParams(params)
|
|
10508
10508
|
});
|
|
10509
10509
|
};
|
|
10510
|
-
var BRAND = Symbol("zod_brand");
|
|
10511
10510
|
var ZodBranded = class extends ZodType {
|
|
10512
10511
|
_parse(input) {
|
|
10513
10512
|
const { ctx } = this._processInputParams(input);
|
|
@@ -10987,7 +10986,7 @@ function $constructor(name, initializer3, params) {
|
|
|
10987
10986
|
Object.defineProperty(_, "name", { value: name });
|
|
10988
10987
|
return _;
|
|
10989
10988
|
}
|
|
10990
|
-
var $brand = Symbol("zod_brand");
|
|
10989
|
+
var $brand = /* @__PURE__ */ Symbol("zod_brand");
|
|
10991
10990
|
var $ZodAsyncError = class extends Error {
|
|
10992
10991
|
constructor() {
|
|
10993
10992
|
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
@@ -11132,7 +11131,7 @@ function floatSafeRemainder2(val, step) {
|
|
|
11132
11131
|
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
11133
11132
|
return valInt % stepInt / 10 ** decCount;
|
|
11134
11133
|
}
|
|
11135
|
-
var EVALUATING = Symbol("evaluating");
|
|
11134
|
+
var EVALUATING = /* @__PURE__ */ Symbol("evaluating");
|
|
11136
11135
|
function defineLazy(object3, key, getter) {
|
|
11137
11136
|
let value = void 0;
|
|
11138
11137
|
Object.defineProperty(object3, key, {
|
|
@@ -19977,8 +19976,8 @@ function yo_default() {
|
|
|
19977
19976
|
}
|
|
19978
19977
|
|
|
19979
19978
|
// node_modules/zod/v4/core/registries.js
|
|
19980
|
-
var $output = Symbol("ZodOutput");
|
|
19981
|
-
var $input = Symbol("ZodInput");
|
|
19979
|
+
var $output = /* @__PURE__ */ Symbol("ZodOutput");
|
|
19980
|
+
var $input = /* @__PURE__ */ Symbol("ZodInput");
|
|
19982
19981
|
var $ZodRegistry = class {
|
|
19983
19982
|
constructor() {
|
|
19984
19983
|
this._map = /* @__PURE__ */ new WeakMap();
|
|
@@ -24820,7 +24819,7 @@ function isTerminal(status) {
|
|
|
24820
24819
|
}
|
|
24821
24820
|
|
|
24822
24821
|
// node_modules/zod-to-json-schema/dist/esm/Options.js
|
|
24823
|
-
var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
24822
|
+
var ignoreOverride = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
24824
24823
|
var defaultOptions = {
|
|
24825
24824
|
name: void 0,
|
|
24826
24825
|
$refStrategy: "root",
|
|
@@ -27796,7 +27795,7 @@ var Server = class extends Protocol {
|
|
|
27796
27795
|
};
|
|
27797
27796
|
|
|
27798
27797
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
|
|
27799
|
-
var COMPLETABLE_SYMBOL = Symbol.for("mcp.completable");
|
|
27798
|
+
var COMPLETABLE_SYMBOL = /* @__PURE__ */ Symbol.for("mcp.completable");
|
|
27800
27799
|
function isCompletable(schema) {
|
|
27801
27800
|
return !!schema && typeof schema === "object" && COMPLETABLE_SYMBOL in schema;
|
|
27802
27801
|
}
|
|
@@ -29203,6 +29202,14 @@ var MergeRequestsClient = class extends GitLabApiClient {
|
|
|
29203
29202
|
{ body }
|
|
29204
29203
|
);
|
|
29205
29204
|
}
|
|
29205
|
+
async updateMrNote(projectId, mrIid, noteId, body) {
|
|
29206
|
+
const encodedProject = this.encodeProjectId(projectId);
|
|
29207
|
+
return this.fetch(
|
|
29208
|
+
"PUT",
|
|
29209
|
+
`/projects/${encodedProject}/merge_requests/${mrIid}/notes/${noteId}`,
|
|
29210
|
+
{ body }
|
|
29211
|
+
);
|
|
29212
|
+
}
|
|
29206
29213
|
async createMergeRequest(projectId, options) {
|
|
29207
29214
|
const encodedProject = this.encodeProjectId(projectId);
|
|
29208
29215
|
return this.fetch(
|
|
@@ -29581,6 +29588,14 @@ var IssuesClient = class extends GitLabApiClient {
|
|
|
29581
29588
|
`/projects/${encodedProject}/issues/${issueIid}/notes/${noteId}`
|
|
29582
29589
|
);
|
|
29583
29590
|
}
|
|
29591
|
+
async updateIssueNote(projectId, issueIid, noteId, body) {
|
|
29592
|
+
const encodedProject = this.encodeProjectId(projectId);
|
|
29593
|
+
return this.fetch(
|
|
29594
|
+
"PUT",
|
|
29595
|
+
`/projects/${encodedProject}/issues/${issueIid}/notes/${noteId}`,
|
|
29596
|
+
{ body }
|
|
29597
|
+
);
|
|
29598
|
+
}
|
|
29584
29599
|
};
|
|
29585
29600
|
|
|
29586
29601
|
// src/client/work-items.ts
|
|
@@ -30915,6 +30930,14 @@ var EpicsClient = class extends GitLabApiClient {
|
|
|
30915
30930
|
`/groups/${encodedGroup}/epics/${epicIid}/notes/${noteId}`
|
|
30916
30931
|
);
|
|
30917
30932
|
}
|
|
30933
|
+
async updateEpicNote(groupId, epicIid, noteId, body) {
|
|
30934
|
+
const encodedGroup = encodeURIComponent(groupId);
|
|
30935
|
+
return this.fetch(
|
|
30936
|
+
"PUT",
|
|
30937
|
+
`/groups/${encodedGroup}/epics/${epicIid}/notes/${noteId}`,
|
|
30938
|
+
{ body }
|
|
30939
|
+
);
|
|
30940
|
+
}
|
|
30918
30941
|
};
|
|
30919
30942
|
|
|
30920
30943
|
// src/client/snippets.ts
|
|
@@ -31043,6 +31066,14 @@ var SnippetsClient = class extends GitLabApiClient {
|
|
|
31043
31066
|
{ body }
|
|
31044
31067
|
);
|
|
31045
31068
|
}
|
|
31069
|
+
async updateSnippetNote(projectId, snippetId, noteId, body) {
|
|
31070
|
+
const encodedProject = this.encodeProjectId(projectId);
|
|
31071
|
+
return this.fetch(
|
|
31072
|
+
"PUT",
|
|
31073
|
+
`/projects/${encodedProject}/snippets/${snippetId}/notes/${noteId}`,
|
|
31074
|
+
{ body }
|
|
31075
|
+
);
|
|
31076
|
+
}
|
|
31046
31077
|
};
|
|
31047
31078
|
|
|
31048
31079
|
// src/client/discussions.ts
|
|
@@ -33247,19 +33278,22 @@ function filterNotesByResolved(result, resolved) {
|
|
|
33247
33278
|
}
|
|
33248
33279
|
};
|
|
33249
33280
|
}
|
|
33250
|
-
var
|
|
33251
|
-
var
|
|
33281
|
+
var NOTE_RESOURCE_TYPES = ["merge_request", "issue", "epic", "snippet"];
|
|
33282
|
+
var GET_NOTE_RESOURCE_TYPES = ["issue", "epic"];
|
|
33252
33283
|
function validationError3(param, resourceType) {
|
|
33253
33284
|
return new Error(
|
|
33254
33285
|
`Missing required parameter: '${param}' is required for resource_type '${resourceType}'`
|
|
33255
33286
|
);
|
|
33256
33287
|
}
|
|
33257
|
-
function
|
|
33258
|
-
if (!
|
|
33288
|
+
function validateNoteParams(resourceType, args, opts) {
|
|
33289
|
+
if (!opts.allowedTypes.includes(resourceType)) {
|
|
33259
33290
|
throw new Error(
|
|
33260
|
-
`Invalid resource_type '${resourceType}'. Must be one of: ${
|
|
33291
|
+
`Invalid resource_type '${resourceType}'. Must be one of: ${opts.allowedTypes.join(", ")}`
|
|
33261
33292
|
);
|
|
33262
33293
|
}
|
|
33294
|
+
if (opts.requireNoteId && args.note_id == null) {
|
|
33295
|
+
throw validationError3("note_id", resourceType);
|
|
33296
|
+
}
|
|
33263
33297
|
switch (resourceType) {
|
|
33264
33298
|
case "merge_request":
|
|
33265
33299
|
case "issue":
|
|
@@ -33276,24 +33310,6 @@ function validateListCreateParams(resourceType, args) {
|
|
|
33276
33310
|
break;
|
|
33277
33311
|
}
|
|
33278
33312
|
}
|
|
33279
|
-
function validateGetNoteParams(resourceType, args) {
|
|
33280
|
-
if (!VALID_GET_NOTE_TYPES.includes(resourceType)) {
|
|
33281
|
-
throw new Error(
|
|
33282
|
-
`Invalid resource_type '${resourceType}'. Must be one of: ${VALID_GET_NOTE_TYPES.join(", ")}`
|
|
33283
|
-
);
|
|
33284
|
-
}
|
|
33285
|
-
if (args.note_id == null) throw validationError3("note_id", resourceType);
|
|
33286
|
-
switch (resourceType) {
|
|
33287
|
-
case "issue":
|
|
33288
|
-
if (!args.project_id) throw validationError3("project_id", resourceType);
|
|
33289
|
-
if (args.iid == null) throw validationError3("iid", resourceType);
|
|
33290
|
-
break;
|
|
33291
|
-
case "epic":
|
|
33292
|
-
if (!args.group_id) throw validationError3("group_id", resourceType);
|
|
33293
|
-
if (args.iid == null) throw validationError3("iid", resourceType);
|
|
33294
|
-
break;
|
|
33295
|
-
}
|
|
33296
|
-
}
|
|
33297
33313
|
var notesUnifiedTools = {
|
|
33298
33314
|
/**
|
|
33299
33315
|
* List notes/comments for any GitLab resource type
|
|
@@ -33329,7 +33345,7 @@ Examples:
|
|
|
33329
33345
|
before: z14.string().optional().describe("Cursor for backward pagination - use startCursor from previous response")
|
|
33330
33346
|
},
|
|
33331
33347
|
execute: async (args, _ctx) => {
|
|
33332
|
-
|
|
33348
|
+
validateNoteParams(args.resource_type, args, { allowedTypes: NOTE_RESOURCE_TYPES });
|
|
33333
33349
|
const client = getGitLabClient();
|
|
33334
33350
|
const paginationOptions = {
|
|
33335
33351
|
first: args.first,
|
|
@@ -33383,7 +33399,10 @@ Examples:
|
|
|
33383
33399
|
iid: z14.number().describe("Internal ID of the issue or epic")
|
|
33384
33400
|
},
|
|
33385
33401
|
execute: async (args, _ctx) => {
|
|
33386
|
-
|
|
33402
|
+
validateNoteParams(args.resource_type, args, {
|
|
33403
|
+
allowedTypes: GET_NOTE_RESOURCE_TYPES,
|
|
33404
|
+
requireNoteId: true
|
|
33405
|
+
});
|
|
33387
33406
|
const client = getGitLabClient();
|
|
33388
33407
|
switch (args.resource_type) {
|
|
33389
33408
|
case "issue":
|
|
@@ -33427,7 +33446,7 @@ Examples:
|
|
|
33427
33446
|
snippet_id: z14.number().optional().describe("Snippet ID (required for snippet)")
|
|
33428
33447
|
},
|
|
33429
33448
|
execute: async (args, _ctx) => {
|
|
33430
|
-
|
|
33449
|
+
validateNoteParams(args.resource_type, args, { allowedTypes: NOTE_RESOURCE_TYPES });
|
|
33431
33450
|
const client = getGitLabClient();
|
|
33432
33451
|
switch (args.resource_type) {
|
|
33433
33452
|
case "merge_request":
|
|
@@ -33458,6 +33477,68 @@ Examples:
|
|
|
33458
33477
|
throw new Error(`Unsupported resource type: ${args.resource_type}`);
|
|
33459
33478
|
}
|
|
33460
33479
|
}
|
|
33480
|
+
}),
|
|
33481
|
+
/**
|
|
33482
|
+
* Update an existing note/comment on any GitLab resource
|
|
33483
|
+
*/
|
|
33484
|
+
gitlab_update_note: tool({
|
|
33485
|
+
description: `Update an existing note/comment on any GitLab resource.
|
|
33486
|
+
Modifies the body content of an existing note. You can only update notes you authored.
|
|
33487
|
+
|
|
33488
|
+
Examples:
|
|
33489
|
+
- MR note: resource_type="merge_request", project_id="group/project", iid=123, note_id=456, body="Updated comment"
|
|
33490
|
+
- Issue note: resource_type="issue", project_id="group/project", iid=456, note_id=789, body="Updated comment"
|
|
33491
|
+
- Epic note: resource_type="epic", group_id="my-group", iid=1, note_id=456, body="Updated comment"
|
|
33492
|
+
- Snippet note: resource_type="snippet", project_id="group/project", snippet_id=789, note_id=123, body="Updated comment"`,
|
|
33493
|
+
args: {
|
|
33494
|
+
resource_type: z14.enum(["merge_request", "issue", "epic", "snippet"]).describe("Type of GitLab resource"),
|
|
33495
|
+
note_id: z14.number().describe("The ID of the note to update"),
|
|
33496
|
+
body: z14.string().describe("The new content for the note (supports Markdown)"),
|
|
33497
|
+
project_id: z14.string().optional().describe("Project ID or path. Required for merge_request, issue, snippet"),
|
|
33498
|
+
group_id: z14.string().optional().describe("Group ID or path. Required for epic"),
|
|
33499
|
+
iid: z14.number().optional().describe("Internal ID of the resource (for merge_request, issue, epic)"),
|
|
33500
|
+
snippet_id: z14.number().optional().describe("Snippet ID (required for snippet)")
|
|
33501
|
+
},
|
|
33502
|
+
execute: async (args, _ctx) => {
|
|
33503
|
+
validateNoteParams(args.resource_type, args, {
|
|
33504
|
+
allowedTypes: NOTE_RESOURCE_TYPES,
|
|
33505
|
+
requireNoteId: true
|
|
33506
|
+
});
|
|
33507
|
+
const client = getGitLabClient();
|
|
33508
|
+
switch (args.resource_type) {
|
|
33509
|
+
case "merge_request":
|
|
33510
|
+
return JSON.stringify(
|
|
33511
|
+
await client.updateMrNote(args.project_id, args.iid, args.note_id, args.body),
|
|
33512
|
+
null,
|
|
33513
|
+
2
|
|
33514
|
+
);
|
|
33515
|
+
case "issue":
|
|
33516
|
+
return JSON.stringify(
|
|
33517
|
+
await client.updateIssueNote(args.project_id, args.iid, args.note_id, args.body),
|
|
33518
|
+
null,
|
|
33519
|
+
2
|
|
33520
|
+
);
|
|
33521
|
+
case "epic":
|
|
33522
|
+
return JSON.stringify(
|
|
33523
|
+
await client.updateEpicNote(args.group_id, args.iid, args.note_id, args.body),
|
|
33524
|
+
null,
|
|
33525
|
+
2
|
|
33526
|
+
);
|
|
33527
|
+
case "snippet":
|
|
33528
|
+
return JSON.stringify(
|
|
33529
|
+
await client.updateSnippetNote(
|
|
33530
|
+
args.project_id,
|
|
33531
|
+
args.snippet_id,
|
|
33532
|
+
args.note_id,
|
|
33533
|
+
args.body
|
|
33534
|
+
),
|
|
33535
|
+
null,
|
|
33536
|
+
2
|
|
33537
|
+
);
|
|
33538
|
+
default:
|
|
33539
|
+
throw new Error(`Unsupported resource type: ${args.resource_type}`);
|
|
33540
|
+
}
|
|
33541
|
+
}
|
|
33461
33542
|
})
|
|
33462
33543
|
};
|
|
33463
33544
|
|
|
@@ -33897,7 +33978,8 @@ function adaptToolsToMcp(server, tools) {
|
|
|
33897
33978
|
server.tool(name, def.description, def.args, async (args) => {
|
|
33898
33979
|
try {
|
|
33899
33980
|
const result = await def.execute(args, {});
|
|
33900
|
-
|
|
33981
|
+
const text = typeof result === "string" ? result : result.output;
|
|
33982
|
+
return { content: [{ type: "text", text }] };
|
|
33901
33983
|
} catch (err) {
|
|
33902
33984
|
const message = err instanceof Error ? err.message : String(err);
|
|
33903
33985
|
return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
|
|
@@ -33934,7 +34016,7 @@ async function main() {
|
|
|
33934
34016
|
...auditTools,
|
|
33935
34017
|
...awardEmojiTools
|
|
33936
34018
|
};
|
|
33937
|
-
const version2 = true ? "2.
|
|
34019
|
+
const version2 = true ? "2.5.0" : "0.0.0";
|
|
33938
34020
|
const server = new McpServer({ name: "gitlab", version: version2 });
|
|
33939
34021
|
adaptToolsToMcp(server, allTools);
|
|
33940
34022
|
const transport = new StdioServerTransport();
|