@leitwerk-dev/gitlab 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +154 -1
  2. package/dist/capability.d.ts +3 -0
  3. package/dist/capability.d.ts.map +1 -1
  4. package/dist/chunk-YPCOVBQS.js +2343 -0
  5. package/dist/chunk-YPCOVBQS.js.map +1 -0
  6. package/dist/client.d.ts +99 -7
  7. package/dist/client.d.ts.map +1 -1
  8. package/dist/external.d.ts +24 -4
  9. package/dist/external.d.ts.map +1 -1
  10. package/dist/index.d.ts +8 -3
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +512 -10
  13. package/dist/index.js.map +1 -1
  14. package/dist/issue-watcher.d.ts +2 -2
  15. package/dist/issue-watcher.d.ts.map +1 -1
  16. package/dist/launch.d.ts +40 -0
  17. package/dist/launch.d.ts.map +1 -0
  18. package/dist/maintenance-labels.d.ts +30 -0
  19. package/dist/maintenance-labels.d.ts.map +1 -0
  20. package/dist/maintenance.d.ts +132 -0
  21. package/dist/maintenance.d.ts.map +1 -0
  22. package/dist/publication-maintenance.d.ts +7 -0
  23. package/dist/publication-maintenance.d.ts.map +1 -0
  24. package/dist/publication.d.ts +37 -0
  25. package/dist/publication.d.ts.map +1 -0
  26. package/dist/repository-catalog.d.ts +16 -0
  27. package/dist/repository-catalog.d.ts.map +1 -0
  28. package/dist/setup.d.ts +8 -2
  29. package/dist/setup.d.ts.map +1 -1
  30. package/dist/testing.d.ts +10 -1
  31. package/dist/testing.d.ts.map +1 -1
  32. package/dist/testing.js +125 -5
  33. package/dist/testing.js.map +1 -1
  34. package/dist/ticket-creation.d.ts +5 -0
  35. package/dist/ticket-creation.d.ts.map +1 -0
  36. package/dist/tools.d.ts +100 -3
  37. package/dist/tools.d.ts.map +1 -1
  38. package/package.json +7 -7
  39. package/src/capability.ts +3 -0
  40. package/src/client.ts +275 -12
  41. package/src/delivery-tools.ts +4 -4
  42. package/src/external.ts +91 -24
  43. package/src/index.ts +58 -10
  44. package/src/issue-watcher.ts +16 -14
  45. package/src/launch.ts +63 -0
  46. package/src/maintenance-labels.ts +129 -0
  47. package/src/maintenance.ts +759 -0
  48. package/src/publication-maintenance.ts +288 -0
  49. package/src/publication.ts +234 -0
  50. package/src/repository-catalog.ts +94 -0
  51. package/src/setup.ts +115 -6
  52. package/src/testing.ts +143 -4
  53. package/src/ticket-creation.ts +145 -0
  54. package/src/tools.ts +382 -26
  55. package/dist/chunk-H4JCQNDY.js +0 -1162
  56. package/dist/chunk-H4JCQNDY.js.map +0 -1
package/src/client.ts CHANGED
@@ -9,6 +9,8 @@ export interface GitLabProfile {
9
9
  /** @internal */
10
10
  token: string;
11
11
  /** @internal */
12
+ ignoredCommentUsers?: readonly string[];
13
+ /** @internal */
12
14
  gitIdentity?: {
13
15
  /** @internal */
14
16
  name: string;
@@ -24,6 +26,8 @@ export interface GitLabProject {
24
26
  path_with_namespace: string;
25
27
  /** @public */
26
28
  http_url_to_repo: string;
29
+ /** SSH clone URL supplied by GitLab. @public */
30
+ ssh_url_to_repo?: string;
27
31
  /** @public */
28
32
  web_url: string;
29
33
  /** @internal */
@@ -31,6 +35,10 @@ export interface GitLabProject {
31
35
  /** @public */
32
36
  archived?: boolean;
33
37
  /** @internal */
38
+ issues_enabled?: boolean;
39
+ /** @internal */
40
+ issues_access_level?: string;
41
+ /** @internal */
34
42
  permissions?: {
35
43
  /** @internal */
36
44
  project_access?: {
@@ -249,6 +257,25 @@ export interface GitLabDiscussion {
249
257
  };
250
258
  })[];
251
259
  }
260
+ /** @internal */
261
+ export interface GitLabDiscussionPosition {
262
+ /** @internal */
263
+ position_type: "text";
264
+ /** @internal */
265
+ base_sha: string;
266
+ /** @internal */
267
+ start_sha: string;
268
+ /** @internal */
269
+ head_sha: string;
270
+ /** @internal */
271
+ old_path: string;
272
+ /** @internal */
273
+ new_path: string;
274
+ /** @internal */
275
+ old_line?: number;
276
+ /** @internal */
277
+ new_line?: number;
278
+ }
252
279
  /** @public */
253
280
  export interface GitLabIdentity {
254
281
  /** @public */
@@ -324,6 +351,7 @@ export function parseGitLabProfiles(raw: unknown): Map<string, GitLabProfile> {
324
351
  profiles.set(name, {
325
352
  baseUrl,
326
353
  token,
354
+ ignoredCommentUsers: parseIgnoredCommentUsers(item.ignored_comment_users),
327
355
  ...(identity
328
356
  ? { gitIdentity: { name: String(identity.name), email: String(identity.email) } }
329
357
  : {}),
@@ -331,22 +359,38 @@ export function parseGitLabProfiles(raw: unknown): Map<string, GitLabProfile> {
331
359
  }
332
360
  return profiles;
333
361
  }
362
+
363
+ function parseIgnoredCommentUsers(raw: unknown): string[] {
364
+ if (raw === undefined) return [];
365
+ if (!Array.isArray(raw) || raw.some((user) => typeof user !== "string"))
366
+ throw new Error("GitLab ignored_comment_users must be a list of usernames");
367
+ const users = raw.map((user: string) => user.trim().replace(/^@/, "").toLowerCase());
368
+ if (users.some((user) => !/^[a-z0-9_.-]+$/.test(user)))
369
+ throw new Error("GitLab ignored_comment_users requires nonempty GitLab usernames");
370
+ return [...new Set(users)];
371
+ }
334
372
  const projectPath = (id: number | string) => `/projects/${encodeURIComponent(id)}`;
335
373
  const mrPath = (id: number, iid: number) => `${projectPath(id)}/merge_requests/${iid}`;
336
374
 
375
+ function nextGitLabPage(response: Response, page: number, count: number, perPage = 100) {
376
+ const next = response.headers.get("x-next-page");
377
+ if (next === "" || (next === null && count < perPage)) return null;
378
+ return next === null ? page + 1 : Number(next);
379
+ }
380
+
337
381
  /** GitLab v4 API. Errors deliberately omit response bodies, headers and tokens. */
338
382
  /** @public */
339
383
  export class GitLabClient {
340
384
  /** @public */
341
385
  readonly baseUrl: string;
342
386
  readonly #profile: GitLabProfile;
387
+ readonly #ignoredCommentUsers: ReadonlySet<string>;
343
388
  readonly #fetch: typeof fetch;
344
389
  readonly #sleep: (ms: number) => Promise<unknown>;
345
390
  /** @internal */
346
391
  constructor(
347
392
  profile: GitLabProfile,
348
393
  /** @public */
349
- /** @public */
350
394
  options: {
351
395
  /** @internal */
352
396
  fetch?: typeof fetch;
@@ -359,6 +403,7 @@ export class GitLabClient {
359
403
  if (!profile.token || /[\r\n\0]/.test(profile.token))
360
404
  throw new Error("GitLab requires a valid token");
361
405
  this.#profile = profile;
406
+ this.#ignoredCommentUsers = new Set(parseIgnoredCommentUsers(profile.ignoredCommentUsers));
362
407
  this.baseUrl = profile.baseUrl;
363
408
  this.#fetch = options.fetch ?? fetch;
364
409
  this.#sleep = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
@@ -427,9 +472,8 @@ export class GitLabClient {
427
472
  const batch = await this.json<T[]>(response);
428
473
  if (!Array.isArray(batch)) throw new Error("Invalid GitLab list response");
429
474
  rows.push(...batch);
430
- const next = response.headers.get("x-next-page");
431
- if (next === "" || (next === null && batch.length < 100)) return rows;
432
- const nextPage = next === null ? page + 1 : Number(next);
475
+ const nextPage = nextGitLabPage(response, page, batch.length);
476
+ if (nextPage === null) return rows;
433
477
  if (!Number.isInteger(nextPage) || nextPage <= page)
434
478
  throw new Error("Invalid GitLab pagination");
435
479
  page = nextPage;
@@ -437,8 +481,24 @@ export class GitLabClient {
437
481
  throw new Error("GitLab pagination limit exceeded; discovery incomplete");
438
482
  }
439
483
  /** @public */
440
- listIssues(id: number, signal?: AbortSignal): Promise<GitLabIssue[]> {
441
- return this.pages(`${projectPath(id)}/issues?state=opened&scope=all`, signal);
484
+ listIssues(
485
+ id: number,
486
+ signal?: AbortSignal,
487
+ state: "opened" | "all" = "opened",
488
+ ): Promise<GitLabIssue[]> {
489
+ return this.pages(`${projectPath(id)}/issues?state=${state}&scope=all`, signal);
490
+ }
491
+ /** @internal */
492
+ createIssue(
493
+ id: number,
494
+ input: {
495
+ /** @internal */ title: string;
496
+ /** @internal */ description: string;
497
+ /** @internal */ labels: string;
498
+ },
499
+ signal?: AbortSignal,
500
+ ): Promise<GitLabIssue> {
501
+ return this.request(`${projectPath(id)}/issues`, signal, input);
442
502
  }
443
503
  /** @public */
444
504
  getIssue(id: number, iid: number, signal?: AbortSignal): Promise<GitLabIssue> {
@@ -449,7 +509,6 @@ export class GitLabClient {
449
509
  id: number,
450
510
  iid: number,
451
511
  /** @public */
452
- /** @public */
453
512
  patch: {
454
513
  /** @public */
455
514
  labels?: string;
@@ -469,7 +528,6 @@ export class GitLabClient {
469
528
  return this.request(`${projectPath(id)}/issues/${iid}/notes`, signal, { body });
470
529
  }
471
530
  /** @public */
472
- /** @public */
473
531
  listLabels(
474
532
  id: number,
475
533
  signal?: AbortSignal,
@@ -481,7 +539,6 @@ export class GitLabClient {
481
539
  return this.pages(`${projectPath(id)}/labels`, signal);
482
540
  }
483
541
  /** @public */
484
- /** @public */
485
542
  createLabel(
486
543
  id: number,
487
544
  name: string,
@@ -507,7 +564,6 @@ export class GitLabClient {
507
564
  createMergeRequest(
508
565
  id: number,
509
566
  /** @public */
510
- /** @public */
511
567
  input: {
512
568
  /** @public */
513
569
  title: string;
@@ -551,6 +607,120 @@ export class GitLabClient {
551
607
  listProjects(signal?: AbortSignal): Promise<GitLabProject[]> {
552
608
  return this.pages("/projects?archived=false", signal);
553
609
  }
610
+ /** Read at most one page of matching repositories. @internal */
611
+ searchProjects(search: string, signal?: AbortSignal): Promise<GitLabProject[]> {
612
+ const query = new URLSearchParams({
613
+ archived: "false",
614
+ search,
615
+ search_namespaces: "true",
616
+ per_page: "100",
617
+ page: "1",
618
+ order_by: "path",
619
+ sort: "asc",
620
+ });
621
+ return this.request(`/projects?${query}`, signal);
622
+ }
623
+ /** @internal */
624
+ listRepositoryTree(
625
+ id: number,
626
+ ref: string,
627
+ path = "",
628
+ signal?: AbortSignal,
629
+ ): Promise<
630
+ {
631
+ /** @internal */
632
+ path: string;
633
+ /** @internal */
634
+ type: string;
635
+ /** @internal */
636
+ id: string;
637
+ }[]
638
+ > {
639
+ return this.pages(
640
+ `${projectPath(id)}/repository/tree?ref=${encodeURIComponent(ref)}&path=${encodeURIComponent(path)}`,
641
+ signal,
642
+ );
643
+ }
644
+ /** @internal */
645
+ getRepositoryFile(
646
+ id: number,
647
+ ref: string,
648
+ path: string,
649
+ signal?: AbortSignal,
650
+ ): Promise<{
651
+ /** @internal */
652
+ file_path: string;
653
+ /** @internal */
654
+ content: string;
655
+ /** @internal */
656
+ encoding: string;
657
+ /** @internal */
658
+ last_commit_id: string;
659
+ }> {
660
+ return this.request(
661
+ `${projectPath(id)}/repository/files/${encodeURIComponent(path)}?ref=${encodeURIComponent(ref)}`,
662
+ signal,
663
+ );
664
+ }
665
+ /** Project-scoped basic blob search at a full commit, one page per request. @internal */
666
+ async searchRepositoryCode(
667
+ id: number,
668
+ ref: string,
669
+ search: string,
670
+ page = 1,
671
+ perPage = 20,
672
+ signal?: AbortSignal,
673
+ ): Promise<{
674
+ /** @internal */ revision: string;
675
+ /** @internal */ results: {
676
+ /** @internal */ path: string;
677
+ /** @internal */ snippet: string;
678
+ /** @internal */ startLine: number;
679
+ }[];
680
+ /** @internal */ page: number;
681
+ /** @internal */ nextPage: number | null;
682
+ }> {
683
+ if (!/^[a-f0-9]{40,64}$/i.test(ref)) throw new Error("Code search requires a full commit ID");
684
+ if (!search.trim()) throw new Error("Code search requires a search term");
685
+ if (
686
+ !Number.isSafeInteger(page) ||
687
+ page < 1 ||
688
+ !Number.isSafeInteger(perPage) ||
689
+ perPage < 1 ||
690
+ perPage > 100
691
+ )
692
+ throw new Error("Invalid GitLab search pagination");
693
+ const query = new URLSearchParams({
694
+ scope: "blobs",
695
+ search_type: "basic",
696
+ ref,
697
+ search,
698
+ page: String(page),
699
+ per_page: String(perPage),
700
+ });
701
+ const response = await this.response(`${projectPath(id)}/search?${query}`, signal);
702
+ const rows = await this.json<{ path: string; data: string; startline: number }[]>(response);
703
+ if (
704
+ !Array.isArray(rows) ||
705
+ rows.some(
706
+ (row) =>
707
+ !row ||
708
+ typeof row.path !== "string" ||
709
+ typeof row.data !== "string" ||
710
+ !Number.isSafeInteger(row.startline),
711
+ )
712
+ )
713
+ throw new Error("Invalid GitLab code search response");
714
+ const nextPage = nextGitLabPage(response, page, rows.length, perPage);
715
+ if (nextPage !== null && (!Number.isSafeInteger(nextPage) || nextPage <= page))
716
+ throw new Error("Invalid GitLab pagination");
717
+ return {
718
+ revision: ref,
719
+ results: rows.map((row) => ({ path: row.path, snippet: row.data, startLine: row.startline })),
720
+ page,
721
+ nextPage,
722
+ };
723
+ }
554
724
  /** @internal */
555
725
  getGroup(id: number | string, signal?: AbortSignal): Promise<GitLabGroup> {
556
726
  return this.request(`/groups/${encodeURIComponent(id)}`, signal);
@@ -577,6 +747,26 @@ export class GitLabClient {
577
747
  getMergeRequest(id: number, iid: number, signal?: AbortSignal): Promise<GitLabMergeRequest> {
578
748
  return this.request(mrPath(id, iid), signal);
579
749
  }
750
+ /** Read every label transition, including changes between watcher polls. @public */
751
+ listMergeRequestLabelEvents(
752
+ id: number,
753
+ iid: number,
754
+ signal?: AbortSignal,
755
+ ): Promise<GitLabLabelEvent[]> {
756
+ return this.pages(`${mrPath(id, iid)}/resource_label_events`, signal);
757
+ }
758
+ /** Apply label deltas without replacing unrelated labels. @public */
759
+ updateMergeRequestLabels(
760
+ id: number,
761
+ iid: number,
762
+ patch: {
763
+ /** @public */ add_labels?: string;
764
+ /** @public */ remove_labels?: string;
765
+ },
766
+ signal?: AbortSignal,
767
+ ): Promise<GitLabMergeRequest> {
768
+ return this.request(mrPath(id, iid), signal, patch, "PUT");
769
+ }
580
770
  /** @public */
581
771
  getChanges(id: number, iid: number, signal?: AbortSignal): Promise<GitLabDiff[]> {
582
772
  return this.pages(`${mrPath(id, iid)}/diffs`, signal);
@@ -592,6 +782,12 @@ export class GitLabClient {
592
782
  getCommit(id: number, sha: string, signal?: AbortSignal): Promise<GitLabCommit> {
593
783
  return this.request(`${projectPath(id)}/repository/commits/${encodeURIComponent(sha)}`, signal);
594
784
  }
785
+ /** Find shared ancestry without cloning a repository. @public */
786
+ getMergeBase(id: number, refs: readonly string[], signal?: AbortSignal): Promise<GitLabCommit> {
787
+ const query = new URLSearchParams();
788
+ for (const ref of refs) query.append("refs[]", ref);
789
+ return this.request(`${projectPath(id)}/repository/merge_base?${query}`, signal);
790
+ }
595
791
  /** @internal */
596
792
  listMergeRequestPipelines(
597
793
  id: number,
@@ -640,6 +836,20 @@ export class GitLabClient {
640
836
  );
641
837
  }
642
838
  /** @internal */
839
+ listDiscussions(id: number, iid: number, signal?: AbortSignal): Promise<GitLabDiscussion[]> {
840
+ return this.pages(`${mrPath(id, iid)}/discussions`, signal);
841
+ }
842
+ /** @internal */
843
+ addDiscussion(
844
+ id: number,
845
+ iid: number,
846
+ body: string,
847
+ position: GitLabDiscussionPosition,
848
+ signal?: AbortSignal,
849
+ ): Promise<GitLabDiscussion> {
850
+ return this.request(`${mrPath(id, iid)}/discussions`, signal, { body, position });
851
+ }
852
+ /** @internal */
643
853
  replyToDiscussion(
644
854
  id: number,
645
855
  iid: number,
@@ -654,6 +864,21 @@ export class GitLabClient {
654
864
  );
655
865
  }
656
866
  /** @internal */
867
+ resolveDiscussion(
868
+ id: number,
869
+ iid: number,
870
+ discussionId: string,
871
+ resolved: boolean,
872
+ signal?: AbortSignal,
873
+ ): Promise<GitLabDiscussion> {
874
+ return this.request(
875
+ `${mrPath(id, iid)}/discussions/${encodeURIComponent(discussionId)}`,
876
+ signal,
877
+ { resolved },
878
+ "PUT",
879
+ );
880
+ }
881
+ /** @internal */
657
882
  listNoteReactions(
658
883
  id: number,
659
884
  iid: number,
@@ -689,6 +914,7 @@ export class GitLabClient {
689
914
  note.system ||
690
915
  note.resolved ||
691
916
  note.author.bot ||
917
+ this.#ignoredCommentUsers.has(note.author.username.toLowerCase()) ||
692
918
  /<!-- leitwerk:gitlab:[a-f0-9]{64} -->/.test(note.body) ||
693
919
  !note.body.trim() ||
694
920
  !Number.isFinite(Date.parse(note.created_at))
@@ -716,6 +942,16 @@ export class GitLabClient {
716
942
  addNote(id: number, iid: number, body: string, signal?: AbortSignal): Promise<GitLabNote> {
717
943
  return this.request(`${mrPath(id, iid)}/notes`, signal, { body });
718
944
  }
945
+ /** @internal */
946
+ updateNote(
947
+ id: number,
948
+ iid: number,
949
+ noteId: number,
950
+ body: string,
951
+ signal?: AbortSignal,
952
+ ): Promise<GitLabNote> {
953
+ return this.request(`${mrPath(id, iid)}/notes/${noteId}`, signal, { body }, "PUT");
954
+ }
719
955
  /** @public */
720
956
  async resolveGitIdentity(signal?: AbortSignal): Promise<GitLabIdentity> {
721
957
  const user = await this.request<{
@@ -739,7 +975,6 @@ export class GitLabClient {
739
975
  maxBytes = 65_536,
740
976
  signal?: AbortSignal,
741
977
  /** @public */
742
- /** @public */
743
978
  ): Promise<{
744
979
  /** @public */
745
980
  text: string;
@@ -772,9 +1007,24 @@ export class GitLabClient {
772
1007
  }
773
1008
  }
774
1009
  /** @public */
1010
+ export interface GitLabLabelEvent {
1011
+ /** Monotonically increasing GitLab resource-label event identity. @public */
1012
+ id: number;
1013
+ /** @public */
1014
+ action: "add" | "remove";
1015
+ /** @public */
1016
+ created_at: string;
1017
+ /** Deleted labels may have no name. @public */
1018
+ label: {
1019
+ /** @public */
1020
+ name: string;
1021
+ } | null;
1022
+ }
1023
+ /** @public */
775
1024
  export type GitLabClientLike = Pick<
776
1025
  GitLabClient,
777
1026
  | "listIssues"
1027
+ | "createIssue"
778
1028
  | "getIssue"
779
1029
  | "updateIssue"
780
1030
  | "listIssueNotes"
@@ -786,6 +1036,8 @@ export type GitLabClientLike = Pick<
786
1036
  | "preflightRepository"
787
1037
  | "addNote"
788
1038
  | "addNoteReaction"
1039
+ | "addDiscussion"
1040
+ | "updateNote"
789
1041
  | "baseUrl"
790
1042
  | "getBranch"
791
1043
  | "getChanges"
@@ -794,20 +1046,31 @@ export type GitLabClientLike = Pick<
794
1046
  | "getGroup"
795
1047
  | "getJobTrace"
796
1048
  | "getMergeRequest"
1049
+ | "listMergeRequestLabelEvents"
1050
+ | "updateMergeRequestLabels"
797
1051
  | "getPipeline"
798
1052
  | "getProject"
799
1053
  | "listBranchPipelines"
800
1054
  | "listFailedJobs"
801
1055
  | "listGroupProjects"
802
1056
  | "listMergeRequestFeedback"
1057
+ | "listDiscussions"
803
1058
  | "listMergeRequestPipelines"
804
1059
  | "listMergeRequests"
805
1060
  | "listNoteReactions"
806
1061
  | "listNotes"
807
1062
  | "listProjects"
1063
+ | "searchProjects"
808
1064
  | "replyToDiscussion"
1065
+ | "resolveDiscussion"
809
1066
  | "resolveGitIdentity"
810
- >;
1067
+ > &
1068
+ Partial<
1069
+ Pick<
1070
+ GitLabClient,
1071
+ "listRepositoryTree" | "getRepositoryFile" | "getMergeBase" | "searchRepositoryCode"
1072
+ >
1073
+ >;
811
1074
 
812
1075
  /** A pending current pipeline supersedes every older result. Synthetic merges must contain this source head. */
813
1076
  /** @public */
@@ -26,7 +26,7 @@ export function registerGitLabDeliveryTools(
26
26
  "body",
27
27
  ]),
28
28
  async execute(ctx, args) {
29
- const binding = resolveGitLabRepositoryBinding(ctx);
29
+ const binding = resolveGitLabRepositoryBinding(ctx, integration);
30
30
  const client = integration.client(binding.profile);
31
31
  const project = projects.getByInstanceAndKey(ctx.process.id, ctx.project?.key ?? "");
32
32
  if (!project?.workBranch || project.workBranch === project.baseBranch)
@@ -92,7 +92,7 @@ export function registerGitLabDeliveryTools(
92
92
  description: "Read human discussion feedback on the bound merge request",
93
93
  parameters: projectParameters(),
94
94
  async execute(ctx) {
95
- const b = resolveGitLabBinding(ctx);
95
+ const b = resolveGitLabBinding(ctx, integration);
96
96
  return integration.client(b.profile).listMergeRequestFeedback(b.projectId, b.iid, ctx.signal);
97
97
  },
98
98
  });
@@ -101,7 +101,7 @@ export function registerGitLabDeliveryTools(
101
101
  description: "Reconcile the bot's seen reaction on bound merge request feedback",
102
102
  parameters: projectParameters({ noteId: { type: "integer" } }, ["noteId"]),
103
103
  async execute(ctx, args) {
104
- const b = resolveGitLabBinding(ctx);
104
+ const b = resolveGitLabBinding(ctx, integration);
105
105
  const client = integration.client(b.profile);
106
106
  const noteId = numberArg(args, "noteId");
107
107
  if (
@@ -142,7 +142,7 @@ export function registerGitLabDeliveryTools(
142
142
  ["issueNumber"],
143
143
  ),
144
144
  async execute(ctx, args) {
145
- const b = resolveGitLabRepositoryBinding(ctx);
145
+ const b = resolveGitLabRepositoryBinding(ctx, integration);
146
146
  const client = integration.client(b.profile);
147
147
  const iid = numberArg(args, "issueNumber");
148
148
  const bound = (ctx.project?.metadata?.gitlab as { issueIid?: number })?.issueIid;