@leitwerk-dev/gitlab 0.3.1 → 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 -2
  7. package/dist/client.d.ts.map +1 -1
  8. package/dist/external.d.ts +23 -1
  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 -0
  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 -6
  41. package/src/delivery-tools.ts +4 -4
  42. package/src/external.ts +90 -19
  43. package/src/index.ts +58 -10
  44. package/src/issue-watcher.ts +10 -1
  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 -23
  55. package/dist/chunk-TQIZKDAM.js +0 -1160
  56. package/dist/chunk-TQIZKDAM.js.map +0 -1
package/dist/testing.js CHANGED
@@ -1,7 +1,9 @@
1
1
  import {
2
2
  GITLAB_MR_KIND,
3
+ GitLabError,
4
+ createGitLabMaintenance,
3
5
  setupGitLabIntegration
4
- } from "./chunk-TQIZKDAM.js";
6
+ } from "./chunk-YPCOVBQS.js";
5
7
 
6
8
  // src/testing.ts
7
9
  import { execFileSync } from "child_process";
@@ -24,11 +26,15 @@ var LocalGitLabAdapter = class {
24
26
  loseNextCommentResponse = false;
25
27
  /** @public */
26
28
  loseNextMergeRequestResponse = false;
29
+ /** @internal */
30
+ loseNextIssueResponse = false;
27
31
  /** @public */
28
32
  loseNextReplyResponse = false;
29
33
  /** @public */
30
34
  loseNextReactionResponse = false;
31
35
  /** @public */
36
+ loseNextLabelResponse = false;
37
+ /** @public */
32
38
  save() {
33
39
  writeFileSync(path.join(this.root, "gitlab.json"), JSON.stringify(this.state), { mode: 384 });
34
40
  }
@@ -65,6 +71,7 @@ var LocalGitLabAdapter = class {
65
71
  id: this.state.projects.length + 1,
66
72
  path_with_namespace: name,
67
73
  http_url_to_repo: bare,
74
+ ssh_url_to_repo: bare,
68
75
  web_url: `${this.baseUrl}/${name}`,
69
76
  default_branch: "main"
70
77
  };
@@ -172,7 +179,7 @@ var LocalGitLabAdapter = class {
172
179
  client() {
173
180
  const mr = (id, iid) => {
174
181
  const m = this.state.mrs.find((m2) => m2.project_id === id && m2.iid === iid);
175
- if (!m) throw new Error("Unknown test MR");
182
+ if (!m) throw new GitLabError(404, false);
176
183
  return m;
177
184
  };
178
185
  const commit = (id, ref) => ({
@@ -182,9 +189,25 @@ var LocalGitLabAdapter = class {
182
189
  });
183
190
  return {
184
191
  baseUrl: this.baseUrl,
185
- listIssues: async (id) => structuredClone(
186
- (this.state.issues ?? []).filter((i) => i.project_id === id && i.state === "opened")
192
+ listIssues: async (id, _signal, state = "opened") => structuredClone(
193
+ (this.state.issues ?? []).filter(
194
+ (i) => i.project_id === id && (state === "all" || i.state === "opened")
195
+ )
187
196
  ),
197
+ createIssue: async (id, input) => {
198
+ const issue = this.createIssue(
199
+ id,
200
+ input.title,
201
+ input.labels ? input.labels.split(",") : []
202
+ );
203
+ issue.description = input.description;
204
+ this.save();
205
+ if (this.loseNextIssueResponse) {
206
+ this.loseNextIssueResponse = false;
207
+ throw new Error("Response lost after issue write");
208
+ }
209
+ return structuredClone(issue);
210
+ },
188
211
  getIssue: async (id, iid) => {
189
212
  const issue = (this.state.issues ?? []).find((i) => i.project_id === id && i.iid === iid);
190
213
  if (!issue) throw new Error("Unknown local GitLab issue");
@@ -245,7 +268,23 @@ var LocalGitLabAdapter = class {
245
268
  ]);
246
269
  },
247
270
  getProject: async (id) => structuredClone(this.project(id)),
271
+ listRepositoryTree: async (id, ref, directory = "") => this.git(id, ["ls-tree", ref, ...directory ? [`${directory}/`] : []]).split("\n").filter(Boolean).map((line) => {
272
+ const [details, filePath] = line.split(" ");
273
+ const [, type, objectId] = details.split(" ");
274
+ return { path: filePath, type, id: objectId };
275
+ }),
276
+ getRepositoryFile: async (id, ref, filePath) => ({
277
+ file_path: filePath,
278
+ content: Buffer.from(this.git(id, ["show", `${ref}:${filePath}`])).toString("base64"),
279
+ encoding: "base64",
280
+ last_commit_id: this.git(id, ["log", "-1", "--format=%H", ref, "--", filePath])
281
+ }),
248
282
  listProjects: async () => structuredClone(this.state.projects),
283
+ searchProjects: async (search) => structuredClone(
284
+ this.state.projects.filter(
285
+ (project) => !project.archived && project.path_with_namespace.toLowerCase().includes(search.trim().toLowerCase())
286
+ ).slice(0, 100)
287
+ ),
249
288
  getGroup: async (id) => ({ id: 1, full_path: String(id) }),
250
289
  listGroupProjects: async (group) => structuredClone(
251
290
  this.state.projects.filter((p) => p.path_with_namespace.startsWith(`${group}/`))
@@ -253,13 +292,44 @@ var LocalGitLabAdapter = class {
253
292
  getMergeRequest: async (id, iid) => ({
254
293
  ...structuredClone(mr(id, iid)),
255
294
  has_conflicts: this.conflicts(mr(id, iid)),
256
- sha: commit(mr(id, iid).source_project_id, mr(id, iid).source_branch).id
295
+ sha: this.git(mr(id, iid).source_project_id, ["rev-parse", mr(id, iid).source_branch])
257
296
  }),
258
297
  listMergeRequests: async (id, label) => structuredClone(
259
298
  this.state.mrs.filter(
260
299
  (m) => m.project_id === id && m.state === "opened" && m.labels.includes(label)
261
300
  )
262
301
  ),
302
+ listMergeRequestLabelEvents: async (id, iid) => {
303
+ mr(id, iid);
304
+ return structuredClone(this.state.labelEvents?.[`${id}:${iid}`] ?? []);
305
+ },
306
+ updateMergeRequestLabels: async (id, iid, patch) => {
307
+ const request = mr(id, iid);
308
+ this.state.labelEvents ??= {};
309
+ this.state.labelEvents[`${id}:${iid}`] ??= [];
310
+ const events = this.state.labelEvents[`${id}:${iid}`];
311
+ for (const [action, labels] of [
312
+ ["add", patch.add_labels],
313
+ ["remove", patch.remove_labels]
314
+ ]) {
315
+ for (const name of labels?.split(",").filter(Boolean) ?? []) {
316
+ if (request.labels.includes(name) === (action === "add")) continue;
317
+ request.labels = action === "add" ? [...request.labels, name] : request.labels.filter((label) => label !== name);
318
+ events.push({
319
+ id: Math.max(0, ...events.map((event) => event.id)) + 1,
320
+ action,
321
+ label: { name },
322
+ created_at: (/* @__PURE__ */ new Date()).toISOString()
323
+ });
324
+ }
325
+ }
326
+ this.save();
327
+ if (this.loseNextLabelResponse) {
328
+ this.loseNextLabelResponse = false;
329
+ throw new Error("Response lost after label write");
330
+ }
331
+ return structuredClone(request);
332
+ },
263
333
  getBranch: async (id, branch) => ({
264
334
  name: branch,
265
335
  can_push: true,
@@ -267,6 +337,7 @@ var LocalGitLabAdapter = class {
267
337
  commit: commit(id, branch)
268
338
  }),
269
339
  getCommit: async (id, ref) => commit(id, ref),
340
+ getMergeBase: async (id, refs) => commit(id, this.git(id, ["merge-base", ...refs])),
270
341
  getChanges: async (id, iid) => structuredClone(this.state.diffs[`${id}:${iid}`] ?? []),
271
342
  listMergeRequestPipelines: async (id, iid) => structuredClone(
272
343
  this.state.pipelines.filter(
@@ -308,10 +379,35 @@ var LocalGitLabAdapter = class {
308
379
  notes: (this.state.discussionNotes?.[`${id}:${iid}:${discussionId}`] ?? []).map((note) => ({
309
380
  ...structuredClone(note),
310
381
  system: false,
382
+ resolved: this.state.discussionResolved?.[`${id}:${iid}:${discussionId}`] === true,
311
383
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
312
384
  author: { username: "bot" }
313
385
  }))
314
386
  }),
387
+ listDiscussions: async (id, iid) => Object.entries(this.state.discussionNotes ?? {}).filter(([key]) => key.startsWith(`${id}:${iid}:`)).map(([key, notes]) => ({
388
+ id: key.slice(`${id}:${iid}:`.length),
389
+ notes: notes.map((note) => ({
390
+ ...structuredClone(note),
391
+ system: false,
392
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
393
+ author: { username: "bot" }
394
+ }))
395
+ })),
396
+ addDiscussion: async (id, iid, body, position) => {
397
+ this.state.discussionNotes ??= {};
398
+ const discussionId = `discussion-${Object.keys(this.state.discussionNotes).length + 1}`;
399
+ const note = {
400
+ id: 1,
401
+ body,
402
+ system: false,
403
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
404
+ author: { username: "bot" },
405
+ position
406
+ };
407
+ this.state.discussionNotes[`${id}:${iid}:${discussionId}`] = [note];
408
+ this.save();
409
+ return { id: discussionId, notes: [note] };
410
+ },
315
411
  replyToDiscussion: async (id, iid, discussionId, body) => {
316
412
  const key = `${id}:${iid}:${discussionId}`;
317
413
  this.state.discussionNotes ??= {};
@@ -319,6 +415,22 @@ var LocalGitLabAdapter = class {
319
415
  const notes = this.state.discussionNotes[key];
320
416
  return this.append(notes, { id: notes.length + 1, body }, "Reply");
321
417
  },
418
+ resolveDiscussion: async (id, iid, discussionId) => {
419
+ const key = `${id}:${iid}:${discussionId}`;
420
+ this.state.discussionResolved ??= {};
421
+ this.state.discussionResolved[key] = true;
422
+ this.save();
423
+ return {
424
+ id: discussionId,
425
+ notes: (this.state.discussionNotes?.[key] ?? []).map((note) => ({
426
+ ...structuredClone(note),
427
+ system: false,
428
+ resolved: true,
429
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
430
+ author: { username: "bot" }
431
+ }))
432
+ };
433
+ },
322
434
  listNoteReactions: async (id, iid, noteId) => structuredClone(this.state.reactions?.[`${id}:${iid}:${noteId}`] ?? []),
323
435
  addNoteReaction: async (id, iid, noteId, name) => {
324
436
  const key = `${id}:${iid}:${noteId}`;
@@ -335,6 +447,13 @@ var LocalGitLabAdapter = class {
335
447
  this.state.notes[key] ??= [];
336
448
  const notes = this.state.notes[key];
337
449
  return this.append(notes, { id: notes.length + 1, body }, "Comment");
450
+ },
451
+ updateNote: async (id, iid, noteId, body) => {
452
+ const note = (this.state.notes[`${id}:${iid}`] ?? []).find((item) => item.id === noteId);
453
+ if (!note) throw new Error("Unknown test note");
454
+ note.body = body;
455
+ this.save();
456
+ return structuredClone(note);
338
457
  }
339
458
  };
340
459
  }
@@ -342,6 +461,7 @@ var LocalGitLabAdapter = class {
342
461
  export {
343
462
  GITLAB_MR_KIND,
344
463
  LocalGitLabAdapter,
464
+ createGitLabMaintenance,
345
465
  setupGitLabIntegration
346
466
  };
347
467
  //# sourceMappingURL=testing.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/testing.ts"],"sourcesContent":["import { execFileSync } from \"node:child_process\";\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type {\n\tGitLabClientLike,\n\tGitLabDiff,\n\tGitLabFeedback,\n\tGitLabIssue,\n\tGitLabMergeRequest,\n\tGitLabNote,\n\tGitLabNoteReaction,\n\tGitLabPipeline,\n\tGitLabProject,\n} from \"./client.js\";\n\nexport { GITLAB_MR_KIND } from \"./external.js\";\nexport { setupGitLabIntegration } from \"./setup.js\";\n\n/** @public */\ninterface LocalState {\n\t/** @public */\n\tissues?: GitLabIssue[];\n\t/** @public */\n\tissueNotes?: Record<string, GitLabNote[]>;\n\t/** @public */\n\tlabels?: Record<string, string[]>;\n\t/** @internal */\n\tprojects: GitLabProject[];\n\t/** @internal */\n\tmrs: GitLabMergeRequest[];\n\t/** @internal */\n\tpipelines: GitLabPipeline[];\n\t/** @public */\n\tnotes: Record<string, GitLabNote[]>;\n\t/** @internal */\n\tdiffs: Record<string, GitLabDiff[]>;\n\t/** @public */\n\tfeedback?: Record<string, GitLabFeedback[]>;\n\t/** @public */\n\tdiscussionNotes?: Record<string, GitLabNote[]>;\n\t/** @public */\n\treactions?: Record<string, GitLabNoteReaction[]>;\n}\n/** Persistent GitLab test boundary. Repository URLs use local Git's file transport. */\n/** @public */\nexport class LocalGitLabAdapter {\n\t/** @public */\n\tstate: LocalState;\n\t/** @public */\n\tloseNextCommentResponse = false;\n\t/** @public */\n\tloseNextMergeRequestResponse = false;\n\t/** @public */\n\tloseNextReplyResponse = false;\n\t/** @public */\n\tloseNextReactionResponse = false;\n\t/** @public */\n\tconstructor(\n\t\t/** @internal */\n\t\treadonly root: string,\n\t\t/** @internal */\n\t\treadonly baseUrl = \"https://gitlab.test\",\n\t) {\n\t\tmkdirSync(root, { recursive: true });\n\t\tconst file = path.join(root, \"gitlab.json\");\n\t\tthis.state = existsSync(file)\n\t\t\t? JSON.parse(readFileSync(file, \"utf8\"))\n\t\t\t: { projects: [], mrs: [], pipelines: [], notes: {}, diffs: {} };\n\t}\n\t/** @public */\n\tsave() {\n\t\twriteFileSync(path.join(this.root, \"gitlab.json\"), JSON.stringify(this.state), { mode: 0o600 });\n\t}\n\tprivate append<T>(items: T[], item: T, kind: \"Comment\" | \"Reply\" | \"Reaction\"): T {\n\t\titems.push(item);\n\t\tthis.save();\n\t\tconst flag = `loseNext${kind}Response` as const;\n\t\tif (this[flag]) {\n\t\t\tthis[flag] = false;\n\t\t\tconst action = {\n\t\t\t\tComment: \"comment write\",\n\t\t\t\tReply: \"discussion reply\",\n\t\t\t\tReaction: \"reaction write\",\n\t\t\t};\n\t\t\tthrow new Error(`Response lost after ${action[kind]}`);\n\t\t}\n\t\treturn item;\n\t}\n\tprivate project(id: number | string) {\n\t\tconst p = this.state.projects.find((p) => p.id === id || p.path_with_namespace === id);\n\t\tif (!p) throw new Error(\"Unknown test project\");\n\t\treturn p;\n\t}\n\tprivate git(id: number, args: string[]) {\n\t\treturn execFileSync(\n\t\t\t\"git\",\n\t\t\t[\"-c\", \"core.hooksPath=/dev/null\", \"--git-dir\", this.project(id).http_url_to_repo, ...args],\n\t\t\t{ encoding: \"utf8\" },\n\t\t).trim();\n\t}\n\t/** @public */\n\taddProject(name: string, bare: string): GitLabProject {\n\t\tconst project: GitLabProject = {\n\t\t\tid: this.state.projects.length + 1,\n\t\t\tpath_with_namespace: name,\n\t\t\thttp_url_to_repo: bare,\n\t\t\tweb_url: `${this.baseUrl}/${name}`,\n\t\t\tdefault_branch: \"main\",\n\t\t};\n\t\tthis.state.projects.push(project);\n\t\tthis.save();\n\t\treturn project;\n\t}\n\t/** @public */\n\topenMr(project: GitLabProject, branch: string): GitLabMergeRequest {\n\t\tconst mr: GitLabMergeRequest = {\n\t\t\tiid: this.state.mrs.length + 1,\n\t\t\tproject_id: project.id,\n\t\t\ttarget_project_id: project.id,\n\t\t\tsource_project_id: project.id,\n\t\t\ttitle: \"Update dependency\",\n\t\t\tdescription: \"Renovate upgrade\",\n\t\t\tstate: \"opened\",\n\t\t\tlabels: [\"renovate\"],\n\t\t\tsha: this.git(project.id, [\"rev-parse\", branch]),\n\t\t\tsource_branch: branch,\n\t\t\ttarget_branch: \"main\",\n\t\t\tweb_url: `${project.web_url}/-/merge_requests/${this.state.mrs.length + 1}`,\n\t\t};\n\t\tthis.state.mrs.push(mr);\n\t\tthis.save();\n\t\treturn mr;\n\t}\n\t/** @public */\n\tpipeline(mr: GitLabMergeRequest, status: string): GitLabPipeline {\n\t\tconst value: GitLabPipeline = {\n\t\t\tid: this.state.pipelines.length + 1,\n\t\t\tproject_id: mr.source_project_id,\n\t\t\tsha: this.git(mr.source_project_id, [\"rev-parse\", mr.source_branch]),\n\t\t\tref: mr.source_branch,\n\t\t\tstatus,\n\t\t\tsource: \"merge_request_event\",\n\t\t\tweb_url: `${this.project(mr.source_project_id).web_url}/-/pipelines/${this.state.pipelines.length + 1}`,\n\t\t};\n\t\tthis.state.pipelines.push(value);\n\t\tthis.save();\n\t\treturn value;\n\t}\n\t/** @public */\n\tcreateIssue(projectId: number, title: string, labels: string[] = [\"use-leitwerk\"]): GitLabIssue {\n\t\tthis.state.issues ??= [];\n\t\tconst project = this.project(projectId);\n\t\tconst iid = this.state.issues.filter((i) => i.project_id === projectId).length + 1;\n\t\tconst issue: GitLabIssue = {\n\t\t\tid: this.state.issues.length + 1,\n\t\t\tiid,\n\t\t\tproject_id: projectId,\n\t\t\ttitle,\n\t\t\tdescription: \"\",\n\t\t\tweb_url: `${project.web_url}/-/issues/${iid}`,\n\t\t\tstate: \"opened\",\n\t\t\tlabels,\n\t\t};\n\t\tthis.state.issues.push(issue);\n\t\tthis.save();\n\t\treturn issue;\n\t}\n\t/** @public */\n\tmerge(request: GitLabMergeRequest) {\n\t\tconst base = this.git(request.project_id, [\"rev-parse\", request.target_branch]);\n\t\tconst head = this.git(request.project_id, [\"rev-parse\", request.source_branch]);\n\t\tconst tree = this.git(request.project_id, [\"merge-tree\", \"--write-tree\", base, head]);\n\t\tconst commit = this.git(request.project_id, [\n\t\t\t\"-c\",\n\t\t\t\"user.name=Leitwerk Bot\",\n\t\t\t\"-c\",\n\t\t\t\"user.email=bot@gitlab.test\",\n\t\t\t\"commit-tree\",\n\t\t\ttree,\n\t\t\t\"-p\",\n\t\t\tbase,\n\t\t\t\"-p\",\n\t\t\thead,\n\t\t\t\"-m\",\n\t\t\trequest.title,\n\t\t]);\n\t\tthis.git(request.project_id, [\n\t\t\t\"update-ref\",\n\t\t\t`refs/heads/${request.target_branch}`,\n\t\t\tcommit,\n\t\t\tbase,\n\t\t]);\n\t\trequest.state = \"merged\";\n\t\trequest.merge_commit_sha = commit;\n\t\tthis.save();\n\t}\n\tprivate conflicts(request: GitLabMergeRequest): boolean {\n\t\ttry {\n\t\t\tthis.git(request.project_id, [\n\t\t\t\t\"merge-tree\",\n\t\t\t\t\"--write-tree\",\n\t\t\t\trequest.target_branch,\n\t\t\t\trequest.source_branch,\n\t\t\t]);\n\t\t\treturn false;\n\t\t} catch {\n\t\t\treturn true;\n\t\t}\n\t}\n\t/** @public */\n\tclient(): GitLabClientLike {\n\t\tconst mr = (id: number, iid: number) => {\n\t\t\tconst m = this.state.mrs.find((m) => m.project_id === id && m.iid === iid);\n\t\t\tif (!m) throw new Error(\"Unknown test MR\");\n\t\t\treturn m;\n\t\t};\n\t\tconst commit = (id: number, ref: string) => ({\n\t\t\tid: this.git(id, [\"rev-parse\", ref]),\n\t\t\tparent_ids: this.git(id, [\"show\", \"-s\", \"--format=%P\", ref]).split(\" \").filter(Boolean),\n\t\t\tmessage: this.git(id, [\"show\", \"-s\", \"--format=%B\", ref]),\n\t\t});\n\t\treturn {\n\t\t\tbaseUrl: this.baseUrl,\n\t\t\tlistIssues: async (id) =>\n\t\t\t\tstructuredClone(\n\t\t\t\t\t(this.state.issues ?? []).filter((i) => i.project_id === id && i.state === \"opened\"),\n\t\t\t\t),\n\t\t\tgetIssue: async (id, iid) => {\n\t\t\t\tconst issue = (this.state.issues ?? []).find((i) => i.project_id === id && i.iid === iid);\n\t\t\t\tif (!issue) throw new Error(\"Unknown local GitLab issue\");\n\t\t\t\treturn structuredClone(issue);\n\t\t\t},\n\t\t\tupdateIssue: async (id, iid, patch) => {\n\t\t\t\tconst issue = (this.state.issues ?? []).find((i) => i.project_id === id && i.iid === iid);\n\t\t\t\tif (!issue) throw new Error(\"Unknown local GitLab issue\");\n\t\t\t\tif (patch.labels !== undefined) issue.labels = patch.labels ? patch.labels.split(\",\") : [];\n\t\t\t\tif (patch.state_event === \"close\") issue.state = \"closed\";\n\t\t\t\tthis.save();\n\t\t\t\treturn structuredClone(issue);\n\t\t\t},\n\t\t\tlistIssueNotes: async (id, iid) =>\n\t\t\t\tstructuredClone(this.state.issueNotes?.[`${id}:${iid}`] ?? []),\n\t\t\taddIssueNote: async (id, iid, body) => {\n\t\t\t\tthis.state.issueNotes ??= {};\n\t\t\t\tthis.state.issueNotes[`${id}:${iid}`] ??= [];\n\t\t\t\tconst notes = this.state.issueNotes[`${id}:${iid}`];\n\t\t\t\treturn this.append(notes, { id: notes.length + 1, body }, \"Comment\");\n\t\t\t},\n\t\t\tlistLabels: async (id) => (this.state.labels?.[id] ?? []).map((name) => ({ name })),\n\t\t\tcreateLabel: async (id, name) => {\n\t\t\t\tthis.state.labels ??= {};\n\t\t\t\tthis.state.labels[id] ??= [];\n\t\t\t\tconst labels = this.state.labels[id];\n\t\t\t\tif (!labels.includes(name)) labels.push(name);\n\t\t\t\tthis.save();\n\t\t\t\treturn { name };\n\t\t\t},\n\t\t\tlistBranchMergeRequests: async (id, source, target) =>\n\t\t\t\tstructuredClone(\n\t\t\t\t\tthis.state.mrs.filter(\n\t\t\t\t\t\t(m) => m.project_id === id && m.source_branch === source && m.target_branch === target,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\tcreateMergeRequest: async (id, input) => {\n\t\t\t\tconst request = this.openMr(this.project(id), input.source_branch);\n\t\t\t\tObject.assign(request, {\n\t\t\t\t\ttitle: input.title,\n\t\t\t\t\tdescription: input.description,\n\t\t\t\t\ttarget_branch: input.target_branch,\n\t\t\t\t\tlabels: [],\n\t\t\t\t});\n\t\t\t\tthis.save();\n\t\t\t\tif (this.loseNextMergeRequestResponse) {\n\t\t\t\t\tthis.loseNextMergeRequestResponse = false;\n\t\t\t\t\tthrow new Error(\"Response lost after merge request creation\");\n\t\t\t\t}\n\t\t\t\treturn structuredClone(request);\n\t\t\t},\n\t\t\tpreflightRepository: async (id, baseBranch, workBranch) => {\n\t\t\t\tthis.git(id, [\"rev-parse\", `refs/heads/${baseBranch}`]);\n\t\t\t\tthis.git(id, [\"check-ref-format\", `refs/heads/${workBranch}`]);\n\t\t\t\tthis.git(id, [\n\t\t\t\t\t\"push\",\n\t\t\t\t\t\"--dry-run\",\n\t\t\t\t\tthis.project(id).http_url_to_repo,\n\t\t\t\t\t`${baseBranch}:refs/heads/${workBranch}`,\n\t\t\t\t]);\n\t\t\t},\n\n\t\t\tgetProject: async (id) => structuredClone(this.project(id)),\n\t\t\tlistProjects: async () => structuredClone(this.state.projects),\n\t\t\tgetGroup: async (id) => ({ id: 1, full_path: String(id) }),\n\t\t\tlistGroupProjects: async (group) =>\n\t\t\t\tstructuredClone(\n\t\t\t\t\tthis.state.projects.filter((p) => p.path_with_namespace.startsWith(`${group}/`)),\n\t\t\t\t),\n\t\t\tgetMergeRequest: async (id, iid) => ({\n\t\t\t\t...structuredClone(mr(id, iid)),\n\t\t\t\thas_conflicts: this.conflicts(mr(id, iid)),\n\t\t\t\tsha: commit(mr(id, iid).source_project_id, mr(id, iid).source_branch).id,\n\t\t\t}),\n\t\t\tlistMergeRequests: async (id, label) =>\n\t\t\t\tstructuredClone(\n\t\t\t\t\tthis.state.mrs.filter(\n\t\t\t\t\t\t(m) => m.project_id === id && m.state === \"opened\" && m.labels.includes(label),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\tgetBranch: async (id, branch) => ({\n\t\t\t\tname: branch,\n\t\t\t\tcan_push: true,\n\t\t\t\tprotected: false,\n\t\t\t\tcommit: commit(id, branch),\n\t\t\t}),\n\t\t\tgetCommit: async (id, ref) => commit(id, ref),\n\t\t\tgetChanges: async (id, iid) => structuredClone(this.state.diffs[`${id}:${iid}`] ?? []),\n\t\t\tlistMergeRequestPipelines: async (id, iid) =>\n\t\t\t\tstructuredClone(\n\t\t\t\t\tthis.state.pipelines.filter(\n\t\t\t\t\t\t(p) =>\n\t\t\t\t\t\t\tp.project_id === mr(id, iid).source_project_id && p.ref === mr(id, iid).source_branch,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\tlistBranchPipelines: async (id, branch, sha) =>\n\t\t\t\tstructuredClone(\n\t\t\t\t\tthis.state.pipelines.filter(\n\t\t\t\t\t\t(p) => p.project_id === id && p.ref === branch && p.sha === sha && p.source === \"push\",\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\tgetPipeline: async (id, pipeline) => {\n\t\t\t\tconst p = this.state.pipelines.find((p) => p.project_id === id && p.id === pipeline);\n\t\t\t\tif (!p) throw new Error(\"Unknown test pipeline\");\n\t\t\t\treturn structuredClone(p);\n\t\t\t},\n\t\t\tlistFailedJobs: async (id, pipeline) => [\n\t\t\t\t{\n\t\t\t\t\tid: pipeline * 100,\n\t\t\t\t\tname: \"test\",\n\t\t\t\t\tstatus: \"failed\",\n\t\t\t\t\tweb_url: `${this.project(id).web_url}/-/jobs/${pipeline * 100}`,\n\t\t\t\t\tfailure_reason: \"script_failure\",\n\t\t\t\t},\n\t\t\t],\n\t\t\tgetJobTrace: async () => ({\n\t\t\t\ttext: \"Expected new dependency API; test failed\",\n\t\t\t\ttruncated: false,\n\t\t\t}),\n\t\t\tresolveGitIdentity: async () => ({\n\t\t\t\tname: \"Leitwerk Bot\",\n\t\t\t\temail: \"bot@gitlab.test\",\n\t\t\t\tusername: \"bot\",\n\t\t\t}),\n\t\t\tlistNotes: async (id, iid) => structuredClone(this.state.notes[`${id}:${iid}`] ?? []),\n\t\t\tlistMergeRequestFeedback: async (id, iid) =>\n\t\t\t\tstructuredClone(this.state.feedback?.[`${id}:${iid}`] ?? []),\n\t\t\tgetDiscussion: async (id, iid, discussionId) => ({\n\t\t\t\tid: discussionId,\n\t\t\t\tnotes: (this.state.discussionNotes?.[`${id}:${iid}:${discussionId}`] ?? []).map((note) => ({\n\t\t\t\t\t...structuredClone(note),\n\t\t\t\t\tsystem: false,\n\t\t\t\t\tcreated_at: new Date().toISOString(),\n\t\t\t\t\tauthor: { username: \"bot\" },\n\t\t\t\t})),\n\t\t\t}),\n\t\t\treplyToDiscussion: async (id, iid, discussionId, body) => {\n\t\t\t\tconst key = `${id}:${iid}:${discussionId}`;\n\t\t\t\tthis.state.discussionNotes ??= {};\n\t\t\t\tthis.state.discussionNotes[key] ??= [];\n\t\t\t\tconst notes = this.state.discussionNotes[key];\n\t\t\t\treturn this.append(notes, { id: notes.length + 1, body }, \"Reply\");\n\t\t\t},\n\t\t\tlistNoteReactions: async (id, iid, noteId) =>\n\t\t\t\tstructuredClone(this.state.reactions?.[`${id}:${iid}:${noteId}`] ?? []),\n\t\t\taddNoteReaction: async (id, iid, noteId, name) => {\n\t\t\t\tconst key = `${id}:${iid}:${noteId}`;\n\t\t\t\tthis.state.reactions ??= {};\n\t\t\t\tthis.state.reactions[key] ??= [];\n\t\t\t\tconst reactions = this.state.reactions[key];\n\t\t\t\tif (\n\t\t\t\t\treactions.some((reaction) => reaction.name === name && reaction.user.username === \"bot\")\n\t\t\t\t)\n\t\t\t\t\tthrow new Error(\"Reaction already exists\");\n\t\t\t\tconst reaction = { id: reactions.length + 1, name, user: { username: \"bot\" } };\n\t\t\t\treturn this.append(reactions, reaction, \"Reaction\");\n\t\t\t},\n\t\t\taddNote: async (id, iid, body) => {\n\t\t\t\tconst key = `${id}:${iid}`;\n\t\t\t\tthis.state.notes[key] ??= [];\n\t\t\t\tconst notes = this.state.notes[key];\n\t\t\t\treturn this.append(notes, { id: notes.length + 1, body }, \"Comment\");\n\t\t\t},\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;AAAA,SAAS,oBAAoB;AAC7B,SAAS,YAAY,WAAW,cAAc,qBAAqB;AACnE,OAA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,IAAI,MAAM,SAAS,GAAG,KAAK,GAAG,OAAO;AAAA,MAClE;AAAA,MACA,mBAAmB,OAAO,IAAI,KAAK,WAClC,gBAAgB,KAAK,MAAM,YAAY,GAAG,EAAE,IAAI,GAAG,IAAI,MAAM,EAAE,KAAK,CAAC,CAAC;AAAA,MACvE,iBAAiB,OAAO,IAAI,KAAK,QAAQ,SAAS;AACjD,cAAM,MAAM,GAAG,EAAE,IAAI,GAAG,IAAI,MAAM;AAClC,aAAK,MAAM,cAAc,CAAC;AAC1B,aAAK,MAAM,UAAU,GAAG,MAAM,CAAC;AAC/B,cAAM,YAAY,KAAK,MAAM,UAAU,GAAG;AAC1C,YACC,UAAU,KAAK,CAACE,cAAaA,UAAS,SAAS,QAAQA,UAAS,KAAK,aAAa,KAAK;AAEvF,gBAAM,IAAI,MAAM,yBAAyB;AAC1C,cAAM,WAAW,EAAE,IAAI,UAAU,SAAS,GAAG,MAAM,MAAM,EAAE,UAAU,MAAM,EAAE;AAC7E,eAAO,KAAK,OAAO,WAAW,UAAU,UAAU;AAAA,MACnD;AAAA,MACA,SAAS,OAAO,IAAI,KAAK,SAAS;AACjC,cAAM,MAAM,GAAG,EAAE,IAAI,GAAG;AACxB,aAAK,MAAM,MAAM,GAAG,MAAM,CAAC;AAC3B,cAAM,QAAQ,KAAK,MAAM,MAAM,GAAG;AAClC,eAAO,KAAK,OAAO,OAAO,EAAE,IAAI,MAAM,SAAS,GAAG,KAAK,GAAG,SAAS;AAAA,MACpE;AAAA,IACD;AAAA,EACD;AACD;","names":["p","m","reaction"]}
1
+ {"version":3,"sources":["../src/testing.ts"],"sourcesContent":["import { execFileSync } from \"node:child_process\";\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type {\n\tGitLabClientLike,\n\tGitLabDiff,\n\tGitLabFeedback,\n\tGitLabIssue,\n\tGitLabLabelEvent,\n\tGitLabMergeRequest,\n\tGitLabNote,\n\tGitLabNoteReaction,\n\tGitLabPipeline,\n\tGitLabProject,\n} from \"./client.js\";\nimport { GitLabError } from \"./client.js\";\n\nexport { GITLAB_MR_KIND } from \"./external.js\";\nexport { createGitLabMaintenance } from \"./maintenance.js\";\nexport { setupGitLabIntegration } from \"./setup.js\";\n\n/** @public */\ninterface LocalState {\n\t/** @public */\n\tissues?: GitLabIssue[];\n\t/** @public */\n\tissueNotes?: Record<string, GitLabNote[]>;\n\t/** @public */\n\tlabels?: Record<string, string[]>;\n\t/** @internal */\n\tlabelEvents?: Record<string, GitLabLabelEvent[]>;\n\t/** @internal */\n\tprojects: GitLabProject[];\n\t/** @internal */\n\tmrs: GitLabMergeRequest[];\n\t/** @internal */\n\tpipelines: GitLabPipeline[];\n\t/** @public */\n\tnotes: Record<string, GitLabNote[]>;\n\t/** @internal */\n\tdiffs: Record<string, GitLabDiff[]>;\n\t/** @public */\n\tfeedback?: Record<string, GitLabFeedback[]>;\n\t/** @public */\n\tdiscussionNotes?: Record<string, GitLabNote[]>;\n\t/** @internal */\n\tdiscussionResolved?: Record<string, boolean>;\n\t/** @public */\n\treactions?: Record<string, GitLabNoteReaction[]>;\n}\n/** Persistent GitLab test boundary. Repository URLs use local Git's file transport. */\n/** @public */\nexport class LocalGitLabAdapter {\n\t/** @public */\n\tstate: LocalState;\n\t/** @public */\n\tloseNextCommentResponse = false;\n\t/** @public */\n\tloseNextMergeRequestResponse = false;\n\t/** @internal */\n\tloseNextIssueResponse = false;\n\t/** @public */\n\tloseNextReplyResponse = false;\n\t/** @public */\n\tloseNextReactionResponse = false;\n\t/** @public */\n\tloseNextLabelResponse = false;\n\t/** @public */\n\tconstructor(\n\t\t/** @internal */\n\t\treadonly root: string,\n\t\t/** @internal */\n\t\treadonly baseUrl = \"https://gitlab.test\",\n\t) {\n\t\tmkdirSync(root, { recursive: true });\n\t\tconst file = path.join(root, \"gitlab.json\");\n\t\tthis.state = existsSync(file)\n\t\t\t? JSON.parse(readFileSync(file, \"utf8\"))\n\t\t\t: { projects: [], mrs: [], pipelines: [], notes: {}, diffs: {} };\n\t}\n\t/** @public */\n\tsave() {\n\t\twriteFileSync(path.join(this.root, \"gitlab.json\"), JSON.stringify(this.state), { mode: 0o600 });\n\t}\n\tprivate append<T>(items: T[], item: T, kind: \"Comment\" | \"Reply\" | \"Reaction\"): T {\n\t\titems.push(item);\n\t\tthis.save();\n\t\tconst flag = `loseNext${kind}Response` as const;\n\t\tif (this[flag]) {\n\t\t\tthis[flag] = false;\n\t\t\tconst action = {\n\t\t\t\tComment: \"comment write\",\n\t\t\t\tReply: \"discussion reply\",\n\t\t\t\tReaction: \"reaction write\",\n\t\t\t};\n\t\t\tthrow new Error(`Response lost after ${action[kind]}`);\n\t\t}\n\t\treturn item;\n\t}\n\tprivate project(id: number | string) {\n\t\tconst p = this.state.projects.find((p) => p.id === id || p.path_with_namespace === id);\n\t\tif (!p) throw new Error(\"Unknown test project\");\n\t\treturn p;\n\t}\n\tprivate git(id: number, args: string[]) {\n\t\treturn execFileSync(\n\t\t\t\"git\",\n\t\t\t[\"-c\", \"core.hooksPath=/dev/null\", \"--git-dir\", this.project(id).http_url_to_repo, ...args],\n\t\t\t{ encoding: \"utf8\" },\n\t\t).trim();\n\t}\n\t/** @public */\n\taddProject(name: string, bare: string): GitLabProject {\n\t\tconst project: GitLabProject = {\n\t\t\tid: this.state.projects.length + 1,\n\t\t\tpath_with_namespace: name,\n\t\t\thttp_url_to_repo: bare,\n\t\t\tssh_url_to_repo: bare,\n\t\t\tweb_url: `${this.baseUrl}/${name}`,\n\t\t\tdefault_branch: \"main\",\n\t\t};\n\t\tthis.state.projects.push(project);\n\t\tthis.save();\n\t\treturn project;\n\t}\n\t/** @public */\n\topenMr(project: GitLabProject, branch: string): GitLabMergeRequest {\n\t\tconst mr: GitLabMergeRequest = {\n\t\t\tiid: this.state.mrs.length + 1,\n\t\t\tproject_id: project.id,\n\t\t\ttarget_project_id: project.id,\n\t\t\tsource_project_id: project.id,\n\t\t\ttitle: \"Update dependency\",\n\t\t\tdescription: \"Renovate upgrade\",\n\t\t\tstate: \"opened\",\n\t\t\tlabels: [\"renovate\"],\n\t\t\tsha: this.git(project.id, [\"rev-parse\", branch]),\n\t\t\tsource_branch: branch,\n\t\t\ttarget_branch: \"main\",\n\t\t\tweb_url: `${project.web_url}/-/merge_requests/${this.state.mrs.length + 1}`,\n\t\t};\n\t\tthis.state.mrs.push(mr);\n\t\tthis.save();\n\t\treturn mr;\n\t}\n\t/** @public */\n\tpipeline(mr: GitLabMergeRequest, status: string): GitLabPipeline {\n\t\tconst value: GitLabPipeline = {\n\t\t\tid: this.state.pipelines.length + 1,\n\t\t\tproject_id: mr.source_project_id,\n\t\t\tsha: this.git(mr.source_project_id, [\"rev-parse\", mr.source_branch]),\n\t\t\tref: mr.source_branch,\n\t\t\tstatus,\n\t\t\tsource: \"merge_request_event\",\n\t\t\tweb_url: `${this.project(mr.source_project_id).web_url}/-/pipelines/${this.state.pipelines.length + 1}`,\n\t\t};\n\t\tthis.state.pipelines.push(value);\n\t\tthis.save();\n\t\treturn value;\n\t}\n\t/** @public */\n\tcreateIssue(projectId: number, title: string, labels: string[] = [\"use-leitwerk\"]): GitLabIssue {\n\t\tthis.state.issues ??= [];\n\t\tconst project = this.project(projectId);\n\t\tconst iid = this.state.issues.filter((i) => i.project_id === projectId).length + 1;\n\t\tconst issue: GitLabIssue = {\n\t\t\tid: this.state.issues.length + 1,\n\t\t\tiid,\n\t\t\tproject_id: projectId,\n\t\t\ttitle,\n\t\t\tdescription: \"\",\n\t\t\tweb_url: `${project.web_url}/-/issues/${iid}`,\n\t\t\tstate: \"opened\",\n\t\t\tlabels,\n\t\t};\n\t\tthis.state.issues.push(issue);\n\t\tthis.save();\n\t\treturn issue;\n\t}\n\t/** @public */\n\tmerge(request: GitLabMergeRequest) {\n\t\tconst base = this.git(request.project_id, [\"rev-parse\", request.target_branch]);\n\t\tconst head = this.git(request.project_id, [\"rev-parse\", request.source_branch]);\n\t\tconst tree = this.git(request.project_id, [\"merge-tree\", \"--write-tree\", base, head]);\n\t\tconst commit = this.git(request.project_id, [\n\t\t\t\"-c\",\n\t\t\t\"user.name=Leitwerk Bot\",\n\t\t\t\"-c\",\n\t\t\t\"user.email=bot@gitlab.test\",\n\t\t\t\"commit-tree\",\n\t\t\ttree,\n\t\t\t\"-p\",\n\t\t\tbase,\n\t\t\t\"-p\",\n\t\t\thead,\n\t\t\t\"-m\",\n\t\t\trequest.title,\n\t\t]);\n\t\tthis.git(request.project_id, [\n\t\t\t\"update-ref\",\n\t\t\t`refs/heads/${request.target_branch}`,\n\t\t\tcommit,\n\t\t\tbase,\n\t\t]);\n\t\trequest.state = \"merged\";\n\t\trequest.merge_commit_sha = commit;\n\t\tthis.save();\n\t}\n\tprivate conflicts(request: GitLabMergeRequest): boolean {\n\t\ttry {\n\t\t\tthis.git(request.project_id, [\n\t\t\t\t\"merge-tree\",\n\t\t\t\t\"--write-tree\",\n\t\t\t\trequest.target_branch,\n\t\t\t\trequest.source_branch,\n\t\t\t]);\n\t\t\treturn false;\n\t\t} catch {\n\t\t\treturn true;\n\t\t}\n\t}\n\t/** @public */\n\tclient(): GitLabClientLike {\n\t\tconst mr = (id: number, iid: number) => {\n\t\t\tconst m = this.state.mrs.find((m) => m.project_id === id && m.iid === iid);\n\t\t\tif (!m) throw new GitLabError(404, false);\n\t\t\treturn m;\n\t\t};\n\t\tconst commit = (id: number, ref: string) => ({\n\t\t\tid: this.git(id, [\"rev-parse\", ref]),\n\t\t\tparent_ids: this.git(id, [\"show\", \"-s\", \"--format=%P\", ref]).split(\" \").filter(Boolean),\n\t\t\tmessage: this.git(id, [\"show\", \"-s\", \"--format=%B\", ref]),\n\t\t});\n\t\treturn {\n\t\t\tbaseUrl: this.baseUrl,\n\t\t\tlistIssues: async (id, _signal, state = \"opened\") =>\n\t\t\t\tstructuredClone(\n\t\t\t\t\t(this.state.issues ?? []).filter(\n\t\t\t\t\t\t(i) => i.project_id === id && (state === \"all\" || i.state === \"opened\"),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\tcreateIssue: async (id, input) => {\n\t\t\t\tconst issue = this.createIssue(\n\t\t\t\t\tid,\n\t\t\t\t\tinput.title,\n\t\t\t\t\tinput.labels ? input.labels.split(\",\") : [],\n\t\t\t\t);\n\t\t\t\tissue.description = input.description;\n\t\t\t\tthis.save();\n\t\t\t\tif (this.loseNextIssueResponse) {\n\t\t\t\t\tthis.loseNextIssueResponse = false;\n\t\t\t\t\tthrow new Error(\"Response lost after issue write\");\n\t\t\t\t}\n\t\t\t\treturn structuredClone(issue);\n\t\t\t},\n\t\t\tgetIssue: async (id, iid) => {\n\t\t\t\tconst issue = (this.state.issues ?? []).find((i) => i.project_id === id && i.iid === iid);\n\t\t\t\tif (!issue) throw new Error(\"Unknown local GitLab issue\");\n\t\t\t\treturn structuredClone(issue);\n\t\t\t},\n\t\t\tupdateIssue: async (id, iid, patch) => {\n\t\t\t\tconst issue = (this.state.issues ?? []).find((i) => i.project_id === id && i.iid === iid);\n\t\t\t\tif (!issue) throw new Error(\"Unknown local GitLab issue\");\n\t\t\t\tif (patch.labels !== undefined) issue.labels = patch.labels ? patch.labels.split(\",\") : [];\n\t\t\t\tif (patch.state_event === \"close\") issue.state = \"closed\";\n\t\t\t\tthis.save();\n\t\t\t\treturn structuredClone(issue);\n\t\t\t},\n\t\t\tlistIssueNotes: async (id, iid) =>\n\t\t\t\tstructuredClone(this.state.issueNotes?.[`${id}:${iid}`] ?? []),\n\t\t\taddIssueNote: async (id, iid, body) => {\n\t\t\t\tthis.state.issueNotes ??= {};\n\t\t\t\tthis.state.issueNotes[`${id}:${iid}`] ??= [];\n\t\t\t\tconst notes = this.state.issueNotes[`${id}:${iid}`];\n\t\t\t\treturn this.append(notes, { id: notes.length + 1, body }, \"Comment\");\n\t\t\t},\n\t\t\tlistLabels: async (id) => (this.state.labels?.[id] ?? []).map((name) => ({ name })),\n\t\t\tcreateLabel: async (id, name) => {\n\t\t\t\tthis.state.labels ??= {};\n\t\t\t\tthis.state.labels[id] ??= [];\n\t\t\t\tconst labels = this.state.labels[id];\n\t\t\t\tif (!labels.includes(name)) labels.push(name);\n\t\t\t\tthis.save();\n\t\t\t\treturn { name };\n\t\t\t},\n\t\t\tlistBranchMergeRequests: async (id, source, target) =>\n\t\t\t\tstructuredClone(\n\t\t\t\t\tthis.state.mrs.filter(\n\t\t\t\t\t\t(m) => m.project_id === id && m.source_branch === source && m.target_branch === target,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\tcreateMergeRequest: async (id, input) => {\n\t\t\t\tconst request = this.openMr(this.project(id), input.source_branch);\n\t\t\t\tObject.assign(request, {\n\t\t\t\t\ttitle: input.title,\n\t\t\t\t\tdescription: input.description,\n\t\t\t\t\ttarget_branch: input.target_branch,\n\t\t\t\t\tlabels: [],\n\t\t\t\t});\n\t\t\t\tthis.save();\n\t\t\t\tif (this.loseNextMergeRequestResponse) {\n\t\t\t\t\tthis.loseNextMergeRequestResponse = false;\n\t\t\t\t\tthrow new Error(\"Response lost after merge request creation\");\n\t\t\t\t}\n\t\t\t\treturn structuredClone(request);\n\t\t\t},\n\t\t\tpreflightRepository: async (id, baseBranch, workBranch) => {\n\t\t\t\tthis.git(id, [\"rev-parse\", `refs/heads/${baseBranch}`]);\n\t\t\t\tthis.git(id, [\"check-ref-format\", `refs/heads/${workBranch}`]);\n\t\t\t\tthis.git(id, [\n\t\t\t\t\t\"push\",\n\t\t\t\t\t\"--dry-run\",\n\t\t\t\t\tthis.project(id).http_url_to_repo,\n\t\t\t\t\t`${baseBranch}:refs/heads/${workBranch}`,\n\t\t\t\t]);\n\t\t\t},\n\n\t\t\tgetProject: async (id) => structuredClone(this.project(id)),\n\t\t\tlistRepositoryTree: async (id, ref, directory = \"\") =>\n\t\t\t\tthis.git(id, [\"ls-tree\", ref, ...(directory ? [`${directory}/`] : [])])\n\t\t\t\t\t.split(\"\\n\")\n\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t.map((line) => {\n\t\t\t\t\t\tconst [details, filePath] = line.split(\"\\t\");\n\t\t\t\t\t\tconst [, type, objectId] = details.split(\" \");\n\t\t\t\t\t\treturn { path: filePath, type, id: objectId };\n\t\t\t\t\t}),\n\t\t\tgetRepositoryFile: async (id, ref, filePath) => ({\n\t\t\t\tfile_path: filePath,\n\t\t\t\tcontent: Buffer.from(this.git(id, [\"show\", `${ref}:${filePath}`])).toString(\"base64\"),\n\t\t\t\tencoding: \"base64\",\n\t\t\t\tlast_commit_id: this.git(id, [\"log\", \"-1\", \"--format=%H\", ref, \"--\", filePath]),\n\t\t\t}),\n\t\t\tlistProjects: async () => structuredClone(this.state.projects),\n\t\t\tsearchProjects: async (search) =>\n\t\t\t\tstructuredClone(\n\t\t\t\t\tthis.state.projects\n\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t(project) =>\n\t\t\t\t\t\t\t\t!project.archived &&\n\t\t\t\t\t\t\t\tproject.path_with_namespace.toLowerCase().includes(search.trim().toLowerCase()),\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.slice(0, 100),\n\t\t\t\t),\n\t\t\tgetGroup: async (id) => ({ id: 1, full_path: String(id) }),\n\t\t\tlistGroupProjects: async (group) =>\n\t\t\t\tstructuredClone(\n\t\t\t\t\tthis.state.projects.filter((p) => p.path_with_namespace.startsWith(`${group}/`)),\n\t\t\t\t),\n\t\t\tgetMergeRequest: async (id, iid) => ({\n\t\t\t\t...structuredClone(mr(id, iid)),\n\t\t\t\thas_conflicts: this.conflicts(mr(id, iid)),\n\t\t\t\tsha: this.git(mr(id, iid).source_project_id, [\"rev-parse\", mr(id, iid).source_branch]),\n\t\t\t}),\n\t\t\tlistMergeRequests: async (id, label) =>\n\t\t\t\tstructuredClone(\n\t\t\t\t\tthis.state.mrs.filter(\n\t\t\t\t\t\t(m) => m.project_id === id && m.state === \"opened\" && m.labels.includes(label),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\tlistMergeRequestLabelEvents: async (id, iid) => {\n\t\t\t\tmr(id, iid);\n\t\t\t\treturn structuredClone(this.state.labelEvents?.[`${id}:${iid}`] ?? []);\n\t\t\t},\n\t\t\tupdateMergeRequestLabels: async (id, iid, patch) => {\n\t\t\t\tconst request = mr(id, iid);\n\t\t\t\tthis.state.labelEvents ??= {};\n\t\t\t\tthis.state.labelEvents[`${id}:${iid}`] ??= [];\n\t\t\t\tconst events = this.state.labelEvents[`${id}:${iid}`];\n\t\t\t\tfor (const [action, labels] of [\n\t\t\t\t\t[\"add\", patch.add_labels],\n\t\t\t\t\t[\"remove\", patch.remove_labels],\n\t\t\t\t] as const) {\n\t\t\t\t\tfor (const name of labels?.split(\",\").filter(Boolean) ?? []) {\n\t\t\t\t\t\tif (request.labels.includes(name) === (action === \"add\")) continue;\n\t\t\t\t\t\trequest.labels =\n\t\t\t\t\t\t\taction === \"add\"\n\t\t\t\t\t\t\t\t? [...request.labels, name]\n\t\t\t\t\t\t\t\t: request.labels.filter((label) => label !== name);\n\t\t\t\t\t\tevents.push({\n\t\t\t\t\t\t\tid: Math.max(0, ...events.map((event) => event.id)) + 1,\n\t\t\t\t\t\t\taction,\n\t\t\t\t\t\t\tlabel: { name },\n\t\t\t\t\t\t\tcreated_at: new Date().toISOString(),\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.save();\n\t\t\t\tif (this.loseNextLabelResponse) {\n\t\t\t\t\tthis.loseNextLabelResponse = false;\n\t\t\t\t\tthrow new Error(\"Response lost after label write\");\n\t\t\t\t}\n\t\t\t\treturn structuredClone(request);\n\t\t\t},\n\t\t\tgetBranch: async (id, branch) => ({\n\t\t\t\tname: branch,\n\t\t\t\tcan_push: true,\n\t\t\t\tprotected: false,\n\t\t\t\tcommit: commit(id, branch),\n\t\t\t}),\n\t\t\tgetCommit: async (id, ref) => commit(id, ref),\n\t\t\tgetMergeBase: async (id, refs) => commit(id, this.git(id, [\"merge-base\", ...refs])),\n\t\t\tgetChanges: async (id, iid) => structuredClone(this.state.diffs[`${id}:${iid}`] ?? []),\n\t\t\tlistMergeRequestPipelines: async (id, iid) =>\n\t\t\t\tstructuredClone(\n\t\t\t\t\tthis.state.pipelines.filter(\n\t\t\t\t\t\t(p) =>\n\t\t\t\t\t\t\tp.project_id === mr(id, iid).source_project_id && p.ref === mr(id, iid).source_branch,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\tlistBranchPipelines: async (id, branch, sha) =>\n\t\t\t\tstructuredClone(\n\t\t\t\t\tthis.state.pipelines.filter(\n\t\t\t\t\t\t(p) => p.project_id === id && p.ref === branch && p.sha === sha && p.source === \"push\",\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\tgetPipeline: async (id, pipeline) => {\n\t\t\t\tconst p = this.state.pipelines.find((p) => p.project_id === id && p.id === pipeline);\n\t\t\t\tif (!p) throw new Error(\"Unknown test pipeline\");\n\t\t\t\treturn structuredClone(p);\n\t\t\t},\n\t\t\tlistFailedJobs: async (id, pipeline) => [\n\t\t\t\t{\n\t\t\t\t\tid: pipeline * 100,\n\t\t\t\t\tname: \"test\",\n\t\t\t\t\tstatus: \"failed\",\n\t\t\t\t\tweb_url: `${this.project(id).web_url}/-/jobs/${pipeline * 100}`,\n\t\t\t\t\tfailure_reason: \"script_failure\",\n\t\t\t\t},\n\t\t\t],\n\t\t\tgetJobTrace: async () => ({\n\t\t\t\ttext: \"Expected new dependency API; test failed\",\n\t\t\t\ttruncated: false,\n\t\t\t}),\n\t\t\tresolveGitIdentity: async () => ({\n\t\t\t\tname: \"Leitwerk Bot\",\n\t\t\t\temail: \"bot@gitlab.test\",\n\t\t\t\tusername: \"bot\",\n\t\t\t}),\n\t\t\tlistNotes: async (id, iid) => structuredClone(this.state.notes[`${id}:${iid}`] ?? []),\n\t\t\tlistMergeRequestFeedback: async (id, iid) =>\n\t\t\t\tstructuredClone(this.state.feedback?.[`${id}:${iid}`] ?? []),\n\t\t\tgetDiscussion: async (id, iid, discussionId) => ({\n\t\t\t\tid: discussionId,\n\t\t\t\tnotes: (this.state.discussionNotes?.[`${id}:${iid}:${discussionId}`] ?? []).map((note) => ({\n\t\t\t\t\t...structuredClone(note),\n\t\t\t\t\tsystem: false,\n\t\t\t\t\tresolved: this.state.discussionResolved?.[`${id}:${iid}:${discussionId}`] === true,\n\t\t\t\t\tcreated_at: new Date().toISOString(),\n\t\t\t\t\tauthor: { username: \"bot\" },\n\t\t\t\t})),\n\t\t\t}),\n\t\t\tlistDiscussions: async (id, iid) =>\n\t\t\t\tObject.entries(this.state.discussionNotes ?? {})\n\t\t\t\t\t.filter(([key]) => key.startsWith(`${id}:${iid}:`))\n\t\t\t\t\t.map(([key, notes]) => ({\n\t\t\t\t\t\tid: key.slice(`${id}:${iid}:`.length),\n\t\t\t\t\t\tnotes: notes.map((note) => ({\n\t\t\t\t\t\t\t...structuredClone(note),\n\t\t\t\t\t\t\tsystem: false,\n\t\t\t\t\t\t\tcreated_at: new Date().toISOString(),\n\t\t\t\t\t\t\tauthor: { username: \"bot\" },\n\t\t\t\t\t\t})),\n\t\t\t\t\t})),\n\t\t\taddDiscussion: async (id, iid, body, position) => {\n\t\t\t\tthis.state.discussionNotes ??= {};\n\t\t\t\tconst discussionId = `discussion-${Object.keys(this.state.discussionNotes).length + 1}`;\n\t\t\t\tconst note = {\n\t\t\t\t\tid: 1,\n\t\t\t\t\tbody,\n\t\t\t\t\tsystem: false,\n\t\t\t\t\tcreated_at: new Date().toISOString(),\n\t\t\t\t\tauthor: { username: \"bot\" },\n\t\t\t\t\tposition,\n\t\t\t\t};\n\t\t\t\tthis.state.discussionNotes[`${id}:${iid}:${discussionId}`] = [note];\n\t\t\t\tthis.save();\n\t\t\t\treturn { id: discussionId, notes: [note] };\n\t\t\t},\n\t\t\treplyToDiscussion: async (id, iid, discussionId, body) => {\n\t\t\t\tconst key = `${id}:${iid}:${discussionId}`;\n\t\t\t\tthis.state.discussionNotes ??= {};\n\t\t\t\tthis.state.discussionNotes[key] ??= [];\n\t\t\t\tconst notes = this.state.discussionNotes[key];\n\t\t\t\treturn this.append(notes, { id: notes.length + 1, body }, \"Reply\");\n\t\t\t},\n\t\t\tresolveDiscussion: async (id, iid, discussionId) => {\n\t\t\t\tconst key = `${id}:${iid}:${discussionId}`;\n\t\t\t\tthis.state.discussionResolved ??= {};\n\t\t\t\tthis.state.discussionResolved[key] = true;\n\t\t\t\tthis.save();\n\t\t\t\treturn {\n\t\t\t\t\tid: discussionId,\n\t\t\t\t\tnotes: (this.state.discussionNotes?.[key] ?? []).map((note) => ({\n\t\t\t\t\t\t...structuredClone(note),\n\t\t\t\t\t\tsystem: false,\n\t\t\t\t\t\tresolved: true,\n\t\t\t\t\t\tcreated_at: new Date().toISOString(),\n\t\t\t\t\t\tauthor: { username: \"bot\" },\n\t\t\t\t\t})),\n\t\t\t\t};\n\t\t\t},\n\t\t\tlistNoteReactions: async (id, iid, noteId) =>\n\t\t\t\tstructuredClone(this.state.reactions?.[`${id}:${iid}:${noteId}`] ?? []),\n\t\t\taddNoteReaction: async (id, iid, noteId, name) => {\n\t\t\t\tconst key = `${id}:${iid}:${noteId}`;\n\t\t\t\tthis.state.reactions ??= {};\n\t\t\t\tthis.state.reactions[key] ??= [];\n\t\t\t\tconst reactions = this.state.reactions[key];\n\t\t\t\tif (\n\t\t\t\t\treactions.some((reaction) => reaction.name === name && reaction.user.username === \"bot\")\n\t\t\t\t)\n\t\t\t\t\tthrow new Error(\"Reaction already exists\");\n\t\t\t\tconst reaction = { id: reactions.length + 1, name, user: { username: \"bot\" } };\n\t\t\t\treturn this.append(reactions, reaction, \"Reaction\");\n\t\t\t},\n\t\t\taddNote: async (id, iid, body) => {\n\t\t\t\tconst key = `${id}:${iid}`;\n\t\t\t\tthis.state.notes[key] ??= [];\n\t\t\t\tconst notes = this.state.notes[key];\n\t\t\t\treturn this.append(notes, { id: notes.length + 1, body }, \"Comment\");\n\t\t\t},\n\t\t\tupdateNote: async (id, iid, noteId, body) => {\n\t\t\t\tconst note = (this.state.notes[`${id}:${iid}`] ?? []).find((item) => item.id === noteId);\n\t\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M,yBAAyB;AAC1C,cAAM,WAAW,EAAE,IAAI,UAAU,SAAS,GAAG,MAAM,MAAM,EAAE,UAAU,MAAM,EAAE;AAC7E,eAAO,KAAK,OAAO,WAAW,UAAU,UAAU;AAAA,MACnD;AAAA,MACA,SAAS,OAAO,IAAI,KAAK,SAAS;AACjC,cAAM,MAAM,GAAG,EAAE,IAAI,GAAG;AACxB,aAAK,MAAM,MAAM,GAAG,MAAM,CAAC;AAC3B,cAAM,QAAQ,KAAK,MAAM,MAAM,GAAG;AAClC,eAAO,KAAK,OAAO,OAAO,EAAE,IAAI,MAAM,SAAS,GAAG,KAAK,GAAG,SAAS;AAAA,MACpE;AAAA,MACA,YAAY,OAAO,IAAI,KAAK,QAAQ,SAAS;AAC5C,cAAM,QAAQ,KAAK,MAAM,MAAM,GAAG,EAAE,IAAI,GAAG,EAAE,KAAK,CAAC,GAAG,KAAK,CAAC,SAAS,KAAK,OAAO,MAAM;AACvF,YAAI,CAAC,KAAM,OAAM,IAAI,MAAM,mBAAmB;AAC9C,aAAK,OAAO;AACZ,aAAK,KAAK;AACV,eAAO,gBAAgB,IAAI;AAAA,MAC5B;AAAA,IACD;AAAA,EACD;AACD;","names":["p","m","reaction"]}
@@ -0,0 +1,5 @@
1
+ import { type ServerExtensionAPI, type TicketCreationConfig } from "@leitwerk-dev/process-sdk";
2
+ import type { GitLabIntegration } from "./capability.js";
3
+ /** @internal */
4
+ export declare function registerGitLabTicketCreation(api: ServerExtensionAPI, integration: GitLabIntegration, config: TicketCreationConfig): void;
5
+ //# sourceMappingURL=ticket-creation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ticket-creation.d.ts","sourceRoot":"","sources":["../src/ticket-creation.ts"],"names":[],"mappings":"AAAA,OAAO,EAMN,KAAK,kBAAkB,EAEvB,KAAK,oBAAoB,EAKzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAsBzD,gBAAgB;AAChB,wBAAgB,4BAA4B,CAC3C,GAAG,EAAE,kBAAkB,EACvB,WAAW,EAAE,iBAAiB,EAC9B,MAAM,EAAE,oBAAoB,GAC1B,IAAI,CAuGN"}
package/dist/tools.d.ts CHANGED
@@ -3,14 +3,14 @@ import { type IntegrationToolExecutionContext, type ServerExtensionAPI } from "@
3
3
  import type { GitLabIntegration } from "./capability.js";
4
4
  import { type GitLabClientLike } from "./client.js";
5
5
  /** @public */
6
- export declare function resolveGitLabRepositoryBinding(ctx: Pick<IntegrationToolExecutionContext, "project" | "process">): {
6
+ export declare function resolveGitLabRepositoryBinding(ctx: Pick<IntegrationToolExecutionContext, "project" | "process">, integration?: GitLabIntegration): {
7
7
  /** @public */
8
8
  profile: string;
9
9
  /** @public */
10
10
  projectId: number;
11
11
  };
12
12
  /** @public */
13
- export declare function resolveGitLabBinding(ctx: Pick<IntegrationToolExecutionContext, "project" | "process">): {
13
+ export declare function resolveGitLabBinding(ctx: Pick<IntegrationToolExecutionContext, "project" | "process">, integration?: GitLabIntegration): {
14
14
  /** @public */
15
15
  profile: string;
16
16
  /** @public */
@@ -18,6 +18,21 @@ export declare function resolveGitLabBinding(ctx: Pick<IntegrationToolExecutionC
18
18
  /** @public */
19
19
  iid: number;
20
20
  };
21
+ /** Stable marker shared by retry-safe comment creation and later updates. @public */
22
+ export declare function gitLabCommentMarker(input: {
23
+ /** @public */
24
+ baseUrl: string;
25
+ /** @public */
26
+ projectId: number;
27
+ /** @public */
28
+ iid: number;
29
+ /** @public */
30
+ instanceId: string;
31
+ /** @public */
32
+ writeKey: string;
33
+ /** @public */
34
+ discussionId?: string;
35
+ }): string;
21
36
  /** @internal */
22
37
  export declare function ensureGitLabComment(input: {
23
38
  /** @internal */
@@ -38,10 +53,90 @@ export declare function ensureGitLabComment(input: {
38
53
  discussionId?: string;
39
54
  /** @internal */
40
55
  signal?: AbortSignal;
56
+ /** Revalidated inside the durable write immediately before mutation. @internal */
57
+ beforeWrite?: () => Promise<void>;
41
58
  }): Promise<{
42
59
  /** @internal */
43
60
  marker: string;
44
61
  }>;
62
+ /** Idempotently replace a retry-safe top-level comment while retaining its marker. @public */
63
+ export declare function updateGitLabComment(input: {
64
+ /** @public */
65
+ client: GitLabClientLike;
66
+ /** @public */
67
+ instanceId: string;
68
+ /** @public */
69
+ projectId: number;
70
+ /** @public */
71
+ iid: number;
72
+ /** @public */
73
+ writeKey: string;
74
+ /** @public */
75
+ body: string;
76
+ /** @public */
77
+ signal?: AbortSignal;
78
+ /** @public */
79
+ beforeWrite?: () => Promise<void>;
80
+ }): Promise<{
81
+ /** @public */
82
+ marker: string;
83
+ }>;
84
+ /** @internal */
85
+ export declare function ensureGitLabInlineComment(input: {
86
+ /** @internal */
87
+ client: GitLabClientLike;
88
+ /** @internal */
89
+ writes: ExternalWrites;
90
+ /** @internal */
91
+ instanceId: string;
92
+ /** @internal */
93
+ projectId: number;
94
+ /** @internal */
95
+ iid: number;
96
+ /** @internal */
97
+ writeKey: string;
98
+ /** @internal */
99
+ body: string;
100
+ /** @internal */
101
+ path: string;
102
+ /** @internal */
103
+ line: number;
104
+ /** @internal */
105
+ side: "new" | "old";
106
+ /** @internal */
107
+ baseSha: string;
108
+ /** @internal */
109
+ startSha: string;
110
+ /** @internal */
111
+ headSha: string;
112
+ /** @internal */
113
+ signal?: AbortSignal;
114
+ }): Promise<{
115
+ marker: string;
116
+ discussionId: string;
117
+ }>;
118
+ /** @public */
119
+ export declare function ensureGitLabResolveDiscussion(input: {
120
+ /** @public */
121
+ client: GitLabClientLike;
122
+ /** @public */
123
+ writes: ExternalWrites;
124
+ /** @public */
125
+ instanceId: string;
126
+ /** @internal */
127
+ projectId: number;
128
+ /** @internal */
129
+ iid: number;
130
+ /** @public */
131
+ writeKey: string;
132
+ /** @public */
133
+ discussionId: string;
134
+ /** @public */
135
+ signal?: AbortSignal;
136
+ }): Promise<{
137
+ discussionId: string;
138
+ resolved: boolean;
139
+ }>;
45
140
  /** @public */
46
141
  export declare function ensureGitLabSeenReaction(input: {
47
142
  /** @public */
@@ -58,7 +153,9 @@ export declare function ensureGitLabSeenReaction(input: {
58
153
  noteId: number;
59
154
  /** @public */
60
155
  signal?: AbortSignal;
156
+ /** @public */
157
+ beforeWrite?: () => Promise<void>;
61
158
  }): Promise<void>;
62
159
  /** @internal */
63
- export declare function registerGitLabTools(api: ServerExtensionAPI, integration: GitLabIntegration): void;
160
+ export declare function registerGitLabTools(api: ServerExtensionAPI, integration: GitLabIntegration, beforeWrite?: (ctx: IntegrationToolExecutionContext) => Promise<void>): void;
64
161
  //# sourceMappingURL=tools.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpE,OAAO,EACN,KAAK,+BAA+B,EAGpC,KAAK,kBAAkB,EAEvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,KAAK,gBAAgB,EAAoC,MAAM,aAAa,CAAC;AAUtF,cAAc;AACd,wBAAgB,8BAA8B,CAC7C,GAAG,EAAE,IAAI,CAAC,+BAA+B,EAAE,SAAS,GAAG,SAAS,CAAC,GAE/D;IACF,cAAc;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc;IACd,SAAS,EAAE,MAAM,CAAC;CAClB,CAgBA;AACD,cAAc;AACd,wBAAgB,oBAAoB,CACnC,GAAG,EAAE,IAAI,CAAC,+BAA+B,EAAE,SAAS,GAAG,SAAS,CAAC,GAE/D;IACF,cAAc;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc;IACd,GAAG,EAAE,MAAM,CAAC;CACZ,CAMA;AACD,gBAAgB;AAChB,wBAAsB,mBAAmB,CAAC,KAAK,EAAE;IAChD,gBAAgB;IAChB,MA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B,cAAc;IACd,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAClC,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBhB;AACD,gBAAgB;AAChB,wBAAgB,mBAAmB,CAClC,GAAG,EAAE,kBAAkB,EACvB,WAAW,EAAE,iBAAiB,EAC9B,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,+BAA+B,KAAK,OAAO,CAAC,IAAI,CAAC,QA6MrE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leitwerk-dev/gitlab",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "leitwerk": {
6
6
  "extension": {
@@ -25,12 +25,12 @@
25
25
  "build": "tsup && tsc -p tsconfig.tsup.json --emitDeclarationOnly"
26
26
  },
27
27
  "dependencies": {
28
- "@leitwerk-dev/domain": "0.3.1",
29
- "@leitwerk-dev/external-writes": "0.3.1",
30
- "@leitwerk-dev/process-sdk": "0.3.1",
31
- "@leitwerk-dev/watcher-utils": "0.3.1",
32
- "@leitwerk-dev/test-support": "0.3.1",
33
- "@leitwerk-dev/coding": "0.3.1"
28
+ "@leitwerk-dev/domain": "0.4.0",
29
+ "@leitwerk-dev/external-writes": "0.4.0",
30
+ "@leitwerk-dev/process-sdk": "0.4.0",
31
+ "@leitwerk-dev/watcher-utils": "0.4.0",
32
+ "@leitwerk-dev/test-support": "0.4.0",
33
+ "@leitwerk-dev/coding": "0.4.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "tsup": "^8.5.1",
package/src/capability.ts CHANGED
@@ -4,12 +4,15 @@ import {
4
4
  type RepositoryCredentialRequirement,
5
5
  } from "@leitwerk-dev/process-sdk";
6
6
  import type { GitLabClientLike } from "./client.js";
7
+ import type { GitLabRepositoryCatalog } from "./repository-catalog.js";
7
8
  /** @public */
8
9
  export interface GitLabIntegration {
9
10
  /** @public */
10
11
  profiles(): readonly string[];
11
12
  /** @public */
12
13
  client(profile: string): GitLabClientLike;
14
+ /** Cached repository metadata for Settings, supplied by server setup. @public */
15
+ readonly repositoryCatalog?: GitLabRepositoryCatalog;
13
16
  }
14
17
  /** @public */
15
18
  export const gitlabIntegration = createCapabilityToken<GitLabIntegration>(