opencode-gitlab-plugin 2.4.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 CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
4
4
 
5
+ ## [2.5.0](https://gitlab.com/vglafirov/opencode-gitlab-plugin/compare/v2.4.0...v2.5.0) (2026-05-20)
6
+
7
+
8
+ ### ✨ Features
9
+
10
+ * **notes:** add gitlab_update_note tool for editing comments ([54a87e7](https://gitlab.com/vglafirov/opencode-gitlab-plugin/commit/54a87e70d4d276c077ab25619e1d910d6d709575))
11
+
12
+
13
+ ### 🐛 Bug Fixes
14
+
15
+ * handle ToolResult union type in mcp-adapter and tests ([a91d5dd](https://gitlab.com/vglafirov/opencode-gitlab-plugin/commit/a91d5ddc5574d1cf9b7dab2d9624cdddeefd158f))
16
+ * **tests:** update orbit.test.ts for ToolResult type ([29fecec](https://gitlab.com/vglafirov/opencode-gitlab-plugin/commit/29fecec6a8ba436b3d95b720cf67f162c8c62104))
17
+
18
+
19
+ ### ♻️ Code Refactoring
20
+
21
+ * **notes:** address review feedback on !28 ([11e13ba](https://gitlab.com/vglafirov/opencode-gitlab-plugin/commit/11e13ba5a6dafeb77dfb256bde3e9b7b1f5ddd32))
22
+
5
23
  ## [2.4.0](https://gitlab.com/vglafirov/opencode-gitlab-plugin/compare/v2.3.0...v2.4.0) (2026-05-19)
6
24
 
7
25
 
package/dist/index.js CHANGED
@@ -438,6 +438,14 @@ var MergeRequestsClient = class extends GitLabApiClient {
438
438
  { body }
439
439
  );
440
440
  }
441
+ async updateMrNote(projectId, mrIid, noteId, body) {
442
+ const encodedProject = this.encodeProjectId(projectId);
443
+ return this.fetch(
444
+ "PUT",
445
+ `/projects/${encodedProject}/merge_requests/${mrIid}/notes/${noteId}`,
446
+ { body }
447
+ );
448
+ }
441
449
  async createMergeRequest(projectId, options) {
442
450
  const encodedProject = this.encodeProjectId(projectId);
443
451
  return this.fetch(
@@ -816,6 +824,14 @@ var IssuesClient = class extends GitLabApiClient {
816
824
  `/projects/${encodedProject}/issues/${issueIid}/notes/${noteId}`
817
825
  );
818
826
  }
827
+ async updateIssueNote(projectId, issueIid, noteId, body) {
828
+ const encodedProject = this.encodeProjectId(projectId);
829
+ return this.fetch(
830
+ "PUT",
831
+ `/projects/${encodedProject}/issues/${issueIid}/notes/${noteId}`,
832
+ { body }
833
+ );
834
+ }
819
835
  };
820
836
 
821
837
  // src/client/work-items.ts
@@ -2150,6 +2166,14 @@ var EpicsClient = class extends GitLabApiClient {
2150
2166
  `/groups/${encodedGroup}/epics/${epicIid}/notes/${noteId}`
2151
2167
  );
2152
2168
  }
2169
+ async updateEpicNote(groupId, epicIid, noteId, body) {
2170
+ const encodedGroup = encodeURIComponent(groupId);
2171
+ return this.fetch(
2172
+ "PUT",
2173
+ `/groups/${encodedGroup}/epics/${epicIid}/notes/${noteId}`,
2174
+ { body }
2175
+ );
2176
+ }
2153
2177
  };
2154
2178
 
2155
2179
  // src/client/snippets.ts
@@ -2278,6 +2302,14 @@ var SnippetsClient = class extends GitLabApiClient {
2278
2302
  { body }
2279
2303
  );
2280
2304
  }
2305
+ async updateSnippetNote(projectId, snippetId, noteId, body) {
2306
+ const encodedProject = this.encodeProjectId(projectId);
2307
+ return this.fetch(
2308
+ "PUT",
2309
+ `/projects/${encodedProject}/snippets/${snippetId}/notes/${noteId}`,
2310
+ { body }
2311
+ );
2312
+ }
2281
2313
  };
2282
2314
 
2283
2315
  // src/client/discussions.ts
@@ -4489,19 +4521,22 @@ function filterNotesByResolved(result, resolved) {
4489
4521
  }
4490
4522
  };
4491
4523
  }
4492
- var VALID_LIST_CREATE_TYPES = ["merge_request", "issue", "epic", "snippet"];
4493
- var VALID_GET_NOTE_TYPES = ["issue", "epic"];
4524
+ var NOTE_RESOURCE_TYPES = ["merge_request", "issue", "epic", "snippet"];
4525
+ var GET_NOTE_RESOURCE_TYPES = ["issue", "epic"];
4494
4526
  function validationError3(param, resourceType) {
4495
4527
  return new Error(
4496
4528
  `Missing required parameter: '${param}' is required for resource_type '${resourceType}'`
4497
4529
  );
4498
4530
  }
4499
- function validateListCreateParams(resourceType, args) {
4500
- if (!VALID_LIST_CREATE_TYPES.includes(resourceType)) {
4531
+ function validateNoteParams(resourceType, args, opts) {
4532
+ if (!opts.allowedTypes.includes(resourceType)) {
4501
4533
  throw new Error(
4502
- `Invalid resource_type '${resourceType}'. Must be one of: ${VALID_LIST_CREATE_TYPES.join(", ")}`
4534
+ `Invalid resource_type '${resourceType}'. Must be one of: ${opts.allowedTypes.join(", ")}`
4503
4535
  );
4504
4536
  }
4537
+ if (opts.requireNoteId && args.note_id == null) {
4538
+ throw validationError3("note_id", resourceType);
4539
+ }
4505
4540
  switch (resourceType) {
4506
4541
  case "merge_request":
4507
4542
  case "issue":
@@ -4518,24 +4553,6 @@ function validateListCreateParams(resourceType, args) {
4518
4553
  break;
4519
4554
  }
4520
4555
  }
4521
- function validateGetNoteParams(resourceType, args) {
4522
- if (!VALID_GET_NOTE_TYPES.includes(resourceType)) {
4523
- throw new Error(
4524
- `Invalid resource_type '${resourceType}'. Must be one of: ${VALID_GET_NOTE_TYPES.join(", ")}`
4525
- );
4526
- }
4527
- if (args.note_id == null) throw validationError3("note_id", resourceType);
4528
- switch (resourceType) {
4529
- case "issue":
4530
- if (!args.project_id) throw validationError3("project_id", resourceType);
4531
- if (args.iid == null) throw validationError3("iid", resourceType);
4532
- break;
4533
- case "epic":
4534
- if (!args.group_id) throw validationError3("group_id", resourceType);
4535
- if (args.iid == null) throw validationError3("iid", resourceType);
4536
- break;
4537
- }
4538
- }
4539
4556
  var notesUnifiedTools = {
4540
4557
  /**
4541
4558
  * List notes/comments for any GitLab resource type
@@ -4571,7 +4588,7 @@ Examples:
4571
4588
  before: z14.string().optional().describe("Cursor for backward pagination - use startCursor from previous response")
4572
4589
  },
4573
4590
  execute: async (args, _ctx) => {
4574
- validateListCreateParams(args.resource_type, args);
4591
+ validateNoteParams(args.resource_type, args, { allowedTypes: NOTE_RESOURCE_TYPES });
4575
4592
  const client = getGitLabClient();
4576
4593
  const paginationOptions = {
4577
4594
  first: args.first,
@@ -4625,7 +4642,10 @@ Examples:
4625
4642
  iid: z14.number().describe("Internal ID of the issue or epic")
4626
4643
  },
4627
4644
  execute: async (args, _ctx) => {
4628
- validateGetNoteParams(args.resource_type, args);
4645
+ validateNoteParams(args.resource_type, args, {
4646
+ allowedTypes: GET_NOTE_RESOURCE_TYPES,
4647
+ requireNoteId: true
4648
+ });
4629
4649
  const client = getGitLabClient();
4630
4650
  switch (args.resource_type) {
4631
4651
  case "issue":
@@ -4669,7 +4689,7 @@ Examples:
4669
4689
  snippet_id: z14.number().optional().describe("Snippet ID (required for snippet)")
4670
4690
  },
4671
4691
  execute: async (args, _ctx) => {
4672
- validateListCreateParams(args.resource_type, args);
4692
+ validateNoteParams(args.resource_type, args, { allowedTypes: NOTE_RESOURCE_TYPES });
4673
4693
  const client = getGitLabClient();
4674
4694
  switch (args.resource_type) {
4675
4695
  case "merge_request":
@@ -4700,6 +4720,68 @@ Examples:
4700
4720
  throw new Error(`Unsupported resource type: ${args.resource_type}`);
4701
4721
  }
4702
4722
  }
4723
+ }),
4724
+ /**
4725
+ * Update an existing note/comment on any GitLab resource
4726
+ */
4727
+ gitlab_update_note: tool14({
4728
+ description: `Update an existing note/comment on any GitLab resource.
4729
+ Modifies the body content of an existing note. You can only update notes you authored.
4730
+
4731
+ Examples:
4732
+ - MR note: resource_type="merge_request", project_id="group/project", iid=123, note_id=456, body="Updated comment"
4733
+ - Issue note: resource_type="issue", project_id="group/project", iid=456, note_id=789, body="Updated comment"
4734
+ - Epic note: resource_type="epic", group_id="my-group", iid=1, note_id=456, body="Updated comment"
4735
+ - Snippet note: resource_type="snippet", project_id="group/project", snippet_id=789, note_id=123, body="Updated comment"`,
4736
+ args: {
4737
+ resource_type: z14.enum(["merge_request", "issue", "epic", "snippet"]).describe("Type of GitLab resource"),
4738
+ note_id: z14.number().describe("The ID of the note to update"),
4739
+ body: z14.string().describe("The new content for the note (supports Markdown)"),
4740
+ project_id: z14.string().optional().describe("Project ID or path. Required for merge_request, issue, snippet"),
4741
+ group_id: z14.string().optional().describe("Group ID or path. Required for epic"),
4742
+ iid: z14.number().optional().describe("Internal ID of the resource (for merge_request, issue, epic)"),
4743
+ snippet_id: z14.number().optional().describe("Snippet ID (required for snippet)")
4744
+ },
4745
+ execute: async (args, _ctx) => {
4746
+ validateNoteParams(args.resource_type, args, {
4747
+ allowedTypes: NOTE_RESOURCE_TYPES,
4748
+ requireNoteId: true
4749
+ });
4750
+ const client = getGitLabClient();
4751
+ switch (args.resource_type) {
4752
+ case "merge_request":
4753
+ return JSON.stringify(
4754
+ await client.updateMrNote(args.project_id, args.iid, args.note_id, args.body),
4755
+ null,
4756
+ 2
4757
+ );
4758
+ case "issue":
4759
+ return JSON.stringify(
4760
+ await client.updateIssueNote(args.project_id, args.iid, args.note_id, args.body),
4761
+ null,
4762
+ 2
4763
+ );
4764
+ case "epic":
4765
+ return JSON.stringify(
4766
+ await client.updateEpicNote(args.group_id, args.iid, args.note_id, args.body),
4767
+ null,
4768
+ 2
4769
+ );
4770
+ case "snippet":
4771
+ return JSON.stringify(
4772
+ await client.updateSnippetNote(
4773
+ args.project_id,
4774
+ args.snippet_id,
4775
+ args.note_id,
4776
+ args.body
4777
+ ),
4778
+ null,
4779
+ 2
4780
+ );
4781
+ default:
4782
+ throw new Error(`Unsupported resource type: ${args.resource_type}`);
4783
+ }
4784
+ }
4703
4785
  })
4704
4786
  };
4705
4787