@leitwerk-dev/gitlab 0.2.0 → 0.3.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 (43) hide show
  1. package/README.md +45 -5
  2. package/dist/capability.d.ts +5 -1
  3. package/dist/capability.d.ts.map +1 -1
  4. package/dist/chunk-H4JCQNDY.js +1162 -0
  5. package/dist/chunk-H4JCQNDY.js.map +1 -0
  6. package/dist/client.d.ts +230 -3
  7. package/dist/client.d.ts.map +1 -1
  8. package/dist/delivery-tools.d.ts +4 -0
  9. package/dist/delivery-tools.d.ts.map +1 -0
  10. package/dist/external.d.ts +80 -5
  11. package/dist/external.d.ts.map +1 -1
  12. package/dist/index.d.ts +13 -14
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +40 -20
  15. package/dist/index.js.map +1 -1
  16. package/dist/issue-watcher.d.ts +42 -0
  17. package/dist/issue-watcher.d.ts.map +1 -0
  18. package/dist/preflight.d.ts +10 -0
  19. package/dist/preflight.d.ts.map +1 -0
  20. package/dist/selection.d.ts +11 -1
  21. package/dist/selection.d.ts.map +1 -1
  22. package/dist/setup.d.ts +11 -0
  23. package/dist/setup.d.ts.map +1 -0
  24. package/dist/testing.d.ts +43 -4
  25. package/dist/testing.d.ts.map +1 -1
  26. package/dist/testing.js +139 -1
  27. package/dist/testing.js.map +1 -1
  28. package/dist/tools.d.ts +35 -4
  29. package/dist/tools.d.ts.map +1 -1
  30. package/package.json +7 -6
  31. package/src/capability.ts +5 -1
  32. package/src/client.ts +392 -20
  33. package/src/delivery-tools.ts +226 -0
  34. package/src/external.ts +200 -8
  35. package/src/index.ts +42 -26
  36. package/src/issue-watcher.ts +152 -0
  37. package/src/preflight.ts +70 -0
  38. package/src/selection.ts +19 -3
  39. package/src/setup.ts +22 -0
  40. package/src/testing.ts +161 -7
  41. package/src/tools.ts +106 -54
  42. package/dist/chunk-5GBBPAG5.js +0 -656
  43. package/dist/chunk-5GBBPAG5.js.map +0 -1
@@ -0,0 +1,152 @@
1
+ import { asUnknownRecord } from "@leitwerk-dev/domain";
2
+ import {
3
+ type CoreServerSetupDeps,
4
+ defineProcessWatcherSource,
5
+ parseProcessWatcherLaunchModelConfig,
6
+ } from "@leitwerk-dev/process-sdk";
7
+ import { type emptyPollResult, parseDurationMs } from "@leitwerk-dev/watcher-utils";
8
+ import type { GitLabIntegration } from "./capability.js";
9
+ import type { GitLabIssue, GitLabProject } from "./client.js";
10
+ import { type GitLabSelection, parseGitLabSelection, selectGitLabProjects } from "./selection.js";
11
+ /** @public */
12
+ export interface GitLabIssueWatcherConfig extends GitLabSelection {
13
+ /** @public */
14
+ profile: string;
15
+ /** @public */
16
+ pollInterval: string;
17
+ /** @public */
18
+ /** @public */
19
+ labels: {
20
+ /** @public */ trigger: string /** @public */;
21
+ /** @public */
22
+ done: string;
23
+ };
24
+ }
25
+ /** @public */
26
+ export interface GitLabIssueWatcherEvent {
27
+ /** @public */
28
+ profile: string;
29
+ /** @public */
30
+ repository: GitLabProject;
31
+ /** @public */
32
+ issue: GitLabIssue;
33
+ /** @public */
34
+ /** @public */
35
+ labels: {
36
+ /** @public */ trigger: string /** @public */;
37
+ /** @public */
38
+ done: string;
39
+ };
40
+ }
41
+ /** @public */
42
+ export const gitlabIssueExternalId = (origin: string, projectId: number, iid: number) =>
43
+ `gitlab:${origin}:${projectId}#${iid}`;
44
+ /** @public */
45
+ export const gitlabIssueWatcherSource = defineProcessWatcherSource<
46
+ GitLabIssueWatcherConfig,
47
+ GitLabIssueWatcherEvent
48
+ >({
49
+ id: "@leitwerk-dev/gitlab.issue",
50
+ label: "GitLab issue",
51
+ parseConfig(raw) {
52
+ const c = asUnknownRecord(raw);
53
+ if (!c || typeof c.enabled !== "boolean") throw new Error("GitLab watcher requires enabled");
54
+ const text = (value: unknown, name: string) => {
55
+ if (typeof value !== "string" || !value.trim())
56
+ throw new Error(`GitLab watcher requires ${name}`);
57
+ return value.trim();
58
+ };
59
+ const labels = asUnknownRecord(c.labels) ?? {};
60
+ const trigger = text(labels.trigger, "labels.trigger");
61
+ const done = text(labels.done, "labels.done");
62
+ if (trigger === done || trigger.includes(",") || done.includes(","))
63
+ throw new Error("GitLab trigger/done labels must be distinct and contain no comma");
64
+ const pollInterval = text(c.poll_interval ?? "30s", "poll_interval");
65
+ if (parseDurationMs(pollInterval, -1) <= 0) throw new Error("Invalid GitLab polling interval");
66
+ return {
67
+ enabled: c.enabled,
68
+ config: {
69
+ ...parseGitLabSelection(c),
70
+ profile: text(c.profile, "profile"),
71
+ pollInterval,
72
+ labels: { trigger, done },
73
+ },
74
+ launchModelConfig: parseProcessWatcherLaunchModelConfig(c.launch),
75
+ };
76
+ },
77
+ presentConfig(c) {
78
+ return {
79
+ targetSummary: `Profile ${c.profile} · trigger ${c.labels.trigger}`,
80
+ details: [
81
+ { label: "Projects", value: c.projects.include.join(", ") || "selected groups" },
82
+ { label: "Groups", value: c.groups.include.join(", ") || "none" },
83
+ ],
84
+ };
85
+ },
86
+ });
87
+ /** @public */
88
+ export function createGitLabIssueDiscovery(
89
+ deps: CoreServerSetupDeps,
90
+ integration: GitLabIntegration,
91
+ now: () => number,
92
+ ) {
93
+ const due = new Map<string, number>();
94
+ return async (result: ReturnType<typeof emptyPollResult>) => {
95
+ for (const watcher of deps.processWatchers?.listBySource(gitlabIssueWatcherSource) ?? []) {
96
+ if (!watcher.enabled) continue;
97
+ const key = `${watcher.processId}:${watcher.watcherId}`;
98
+ const c = watcher.config;
99
+ if ((due.get(key) ?? 0) > now()) continue;
100
+ due.set(key, now() + parseDurationMs(c.pollInterval, 30000));
101
+ const client = integration.client(c.profile);
102
+ for (const repository of await selectGitLabProjects(client, c))
103
+ for (const issue of await client.listIssues(repository.id)) {
104
+ if (
105
+ issue.state !== "opened" ||
106
+ !issue.labels.includes(c.labels.trigger) ||
107
+ issue.labels.includes(c.labels.done)
108
+ )
109
+ continue;
110
+ const id = gitlabIssueExternalId(client.baseUrl, repository.id, issue.iid);
111
+ if (deps.processes.listAll().some((p) => p.externalId === id)) {
112
+ result.skipped.push(id);
113
+ continue;
114
+ }
115
+ const guarded = {
116
+ ...watcher,
117
+ async resolveLaunchAttempt(...args: Parameters<typeof watcher.resolveLaunchAttempt>) {
118
+ const attempt = await watcher.resolveLaunchAttempt(...args);
119
+ if (!attempt) return null;
120
+ return {
121
+ ...attempt,
122
+ preparationChecks: [
123
+ ...attempt.preparationChecks,
124
+ {
125
+ id: "gitlab-issue-eligibility",
126
+ label: "Recheck GitLab source issue",
127
+ async run() {
128
+ const fresh = await client.getIssue(repository.id, issue.iid);
129
+ if (
130
+ fresh.state !== "opened" ||
131
+ !fresh.labels.includes(c.labels.trigger) ||
132
+ fresh.labels.includes(c.labels.done)
133
+ )
134
+ throw new Error("GitLab source issue eligibility changed before launch");
135
+ },
136
+ },
137
+ ],
138
+ };
139
+ },
140
+ };
141
+ const launched = await deps.launchRuns.startWatcher(
142
+ guarded,
143
+ { profile: c.profile, repository, issue, labels: c.labels },
144
+ { idempotencyKey: id },
145
+ );
146
+ if (launched.error) result.errors.push(`${id}:launch_failed`);
147
+ else if (launched.process) result.created.push(id);
148
+ else result.skipped.push(id);
149
+ }
150
+ }
151
+ };
152
+ }
@@ -0,0 +1,70 @@
1
+ import { execFile } from "node:child_process";
2
+ import { mkdtemp, rm, writeFile } from "node:fs/promises";
3
+ import { tmpdir } from "node:os";
4
+ import { join } from "node:path";
5
+ import { promisify } from "node:util";
6
+ import { repositoryHttpsUrl } from "@leitwerk-dev/process-sdk";
7
+
8
+ const exec = promisify(execFile);
9
+ /** Credentials stay in the child environment and never appear in URLs or error output. */
10
+ export async function preflightGitLabRepository(input: {
11
+ url: string;
12
+ origin: string;
13
+ token: string;
14
+ baseBranch: string;
15
+ workBranch: string;
16
+ signal?: AbortSignal;
17
+ }) {
18
+ const url = repositoryHttpsUrl(input.url);
19
+ if (url.origin !== input.origin)
20
+ throw new Error("GitLab repository origin does not match its profile");
21
+ const directory = await mkdtemp(join(tmpdir(), "leitwerk-gitlab-preflight-"));
22
+ try {
23
+ const askpass = join(directory, "askpass");
24
+ await writeFile(
25
+ askpass,
26
+ '#!/bin/sh\ncase "$1" in *Username*) printf "%s\\n" oauth2;; *) printf "%s\\n" "$LEITWERK_GITLAB_PREFLIGHT_TOKEN";; esac\n',
27
+ { mode: 0o700 },
28
+ );
29
+ const env = {
30
+ ...process.env,
31
+ GIT_CONFIG_NOSYSTEM: "1",
32
+ GIT_CONFIG_GLOBAL: "/dev/null",
33
+ GIT_TERMINAL_PROMPT: "0",
34
+ GIT_ASKPASS: askpass,
35
+ LEITWERK_GITLAB_PREFLIGHT_TOKEN: input.token,
36
+ };
37
+ const git = (args: string[]) =>
38
+ exec("git", ["-c", "credential.helper=", "-c", "http.followRedirects=false", ...args], {
39
+ env,
40
+ signal: input.signal,
41
+ });
42
+ await git(["check-ref-format", `refs/heads/${input.baseBranch}`]);
43
+ await git(["check-ref-format", `refs/heads/${input.workBranch}`]);
44
+ await git(["ls-remote", "--exit-code", input.url, `refs/heads/${input.baseBranch}`]);
45
+ await git(["init", "--quiet", directory]);
46
+ await git([
47
+ "-C",
48
+ directory,
49
+ "fetch",
50
+ "--quiet",
51
+ "--depth=1",
52
+ input.url,
53
+ `refs/heads/${input.baseBranch}`,
54
+ ]);
55
+ await git([
56
+ "-C",
57
+ directory,
58
+ "push",
59
+ "--dry-run",
60
+ input.url,
61
+ `FETCH_HEAD:refs/heads/${input.workBranch}`,
62
+ ]);
63
+ } catch {
64
+ throw new Error(
65
+ "GitLab HTTPS read/write admission failed; check repository access and write_repository scope",
66
+ );
67
+ } finally {
68
+ await rm(directory, { recursive: true, force: true });
69
+ }
70
+ }
package/src/selection.ts CHANGED
@@ -1,9 +1,24 @@
1
1
  import type { GitLabClientLike, GitLabProject } from "./client.js";
2
+ /** @public */
2
3
  export interface GitLabSelection {
3
- projects: { include: readonly string[]; exclude: readonly string[] };
4
- groups: { include: readonly string[]; exclude: readonly string[] };
4
+ /** @public */
5
+ projects: {
6
+ /** @public */
7
+ include: readonly string[];
8
+ /** @internal */
9
+ exclude: readonly string[];
10
+ };
11
+ /** @public */
12
+ groups: {
13
+ /** @public */
14
+ include: readonly string[];
15
+ /** @internal */
16
+ exclude: readonly string[];
17
+ };
18
+ /** @internal */
5
19
  allAccessible: boolean;
6
20
  }
21
+ /** @public */
7
22
  export function parseGitLabSelection(raw: Record<string, unknown>): GitLabSelection {
8
23
  const list = (value: unknown): string[] => {
9
24
  if (value === undefined) return [];
@@ -36,13 +51,14 @@ export function parseGitLabSelection(raw: Record<string, unknown>): GitLabSelect
36
51
  throw new Error("GitLab requires explicit project/group includes or all_accessible: true");
37
52
  return parsed;
38
53
  }
54
+ /** @internal */
39
55
  export function projectExcluded(selection: GitLabSelection, name: string): boolean {
40
56
  return (
41
57
  selection.projects.exclude.includes(name) ||
42
58
  selection.groups.exclude.some((group) => name.startsWith(`${group}/`))
43
59
  );
44
60
  }
45
- /** Include union, subgroup expansion, exclusion precedence, stable-ID deduplication. */
61
+ /** Include union, subgroup expansion, exclusion precedence, stable-ID deduplication. @public */
46
62
  export async function selectGitLabProjects(
47
63
  client: GitLabClientLike,
48
64
  selection: GitLabSelection,
package/src/setup.ts ADDED
@@ -0,0 +1,22 @@
1
+ import { coreHostCapabilities, type ServerExtensionAPI } from "@leitwerk-dev/process-sdk";
2
+ import { type GitLabIntegration, gitlabIntegration } from "./capability.js";
3
+ import { registerGitLabDeliveryTools } from "./delivery-tools.js";
4
+ import { createGitLabProvider } from "./external.js";
5
+ import { registerGitLabTools } from "./tools.js";
6
+
7
+ /** Register shared tools and polling with an explicit integration. @public */
8
+ export function setupGitLabIntegration(
9
+ api: ServerExtensionAPI,
10
+ integration: GitLabIntegration,
11
+ options: {
12
+ /** @public */
13
+ now?: () => number;
14
+ } = {},
15
+ ) {
16
+ api.provide(gitlabIntegration, integration);
17
+ const deps = api.get(coreHostCapabilities.serverSetup);
18
+ if (!deps || Array.isArray(deps)) return;
19
+ registerGitLabTools(api, integration);
20
+ registerGitLabDeliveryTools(api, integration, deps.projects);
21
+ return createGitLabProvider(deps, integration, options);
22
+ }
package/src/testing.ts CHANGED
@@ -5,6 +5,7 @@ import type {
5
5
  GitLabClientLike,
6
6
  GitLabDiff,
7
7
  GitLabFeedback,
8
+ GitLabIssue,
8
9
  GitLabMergeRequest,
9
10
  GitLabNote,
10
11
  GitLabNoteReaction,
@@ -12,32 +13,52 @@ import type {
12
13
  GitLabProject,
13
14
  } from "./client.js";
14
15
 
15
- export type {
16
- GitLabClientLike,
17
- GitLabMergeRequest,
18
- GitLabPipeline,
19
- GitLabProject,
20
- } from "./client.js";
21
- export { setupGitLabIntegration } from "./index.js";
16
+ export { GITLAB_MR_KIND } from "./external.js";
17
+ export { setupGitLabIntegration } from "./setup.js";
22
18
 
19
+ /** @public */
23
20
  interface LocalState {
21
+ /** @public */
22
+ issues?: GitLabIssue[];
23
+ /** @public */
24
+ issueNotes?: Record<string, GitLabNote[]>;
25
+ /** @public */
26
+ labels?: Record<string, string[]>;
27
+ /** @internal */
24
28
  projects: GitLabProject[];
29
+ /** @internal */
25
30
  mrs: GitLabMergeRequest[];
31
+ /** @internal */
26
32
  pipelines: GitLabPipeline[];
33
+ /** @public */
27
34
  notes: Record<string, GitLabNote[]>;
35
+ /** @internal */
28
36
  diffs: Record<string, GitLabDiff[]>;
37
+ /** @public */
29
38
  feedback?: Record<string, GitLabFeedback[]>;
39
+ /** @public */
30
40
  discussionNotes?: Record<string, GitLabNote[]>;
41
+ /** @public */
31
42
  reactions?: Record<string, GitLabNoteReaction[]>;
32
43
  }
33
44
  /** Persistent GitLab test boundary. Repository URLs use local Git's file transport. */
45
+ /** @public */
34
46
  export class LocalGitLabAdapter {
47
+ /** @public */
35
48
  state: LocalState;
49
+ /** @public */
36
50
  loseNextCommentResponse = false;
51
+ /** @public */
52
+ loseNextMergeRequestResponse = false;
53
+ /** @public */
37
54
  loseNextReplyResponse = false;
55
+ /** @public */
38
56
  loseNextReactionResponse = false;
57
+ /** @public */
39
58
  constructor(
59
+ /** @internal */
40
60
  readonly root: string,
61
+ /** @internal */
41
62
  readonly baseUrl = "https://gitlab.test",
42
63
  ) {
43
64
  mkdirSync(root, { recursive: true });
@@ -46,6 +67,7 @@ export class LocalGitLabAdapter {
46
67
  ? JSON.parse(readFileSync(file, "utf8"))
47
68
  : { projects: [], mrs: [], pipelines: [], notes: {}, diffs: {} };
48
69
  }
70
+ /** @public */
49
71
  save() {
50
72
  writeFileSync(path.join(this.root, "gitlab.json"), JSON.stringify(this.state), { mode: 0o600 });
51
73
  }
@@ -76,6 +98,7 @@ export class LocalGitLabAdapter {
76
98
  { encoding: "utf8" },
77
99
  ).trim();
78
100
  }
101
+ /** @public */
79
102
  addProject(name: string, bare: string): GitLabProject {
80
103
  const project: GitLabProject = {
81
104
  id: this.state.projects.length + 1,
@@ -88,6 +111,7 @@ export class LocalGitLabAdapter {
88
111
  this.save();
89
112
  return project;
90
113
  }
114
+ /** @public */
91
115
  openMr(project: GitLabProject, branch: string): GitLabMergeRequest {
92
116
  const mr: GitLabMergeRequest = {
93
117
  iid: this.state.mrs.length + 1,
@@ -107,6 +131,7 @@ export class LocalGitLabAdapter {
107
131
  this.save();
108
132
  return mr;
109
133
  }
134
+ /** @public */
110
135
  pipeline(mr: GitLabMergeRequest, status: string): GitLabPipeline {
111
136
  const value: GitLabPipeline = {
112
137
  id: this.state.pipelines.length + 1,
@@ -121,6 +146,68 @@ export class LocalGitLabAdapter {
121
146
  this.save();
122
147
  return value;
123
148
  }
149
+ /** @public */
150
+ createIssue(projectId: number, title: string, labels: string[] = ["use-leitwerk"]): GitLabIssue {
151
+ this.state.issues ??= [];
152
+ const project = this.project(projectId);
153
+ const iid = this.state.issues.filter((i) => i.project_id === projectId).length + 1;
154
+ const issue: GitLabIssue = {
155
+ id: this.state.issues.length + 1,
156
+ iid,
157
+ project_id: projectId,
158
+ title,
159
+ description: "",
160
+ web_url: `${project.web_url}/-/issues/${iid}`,
161
+ state: "opened",
162
+ labels,
163
+ };
164
+ this.state.issues.push(issue);
165
+ this.save();
166
+ return issue;
167
+ }
168
+ /** @public */
169
+ merge(request: GitLabMergeRequest) {
170
+ const base = this.git(request.project_id, ["rev-parse", request.target_branch]);
171
+ const head = this.git(request.project_id, ["rev-parse", request.source_branch]);
172
+ const tree = this.git(request.project_id, ["merge-tree", "--write-tree", base, head]);
173
+ const commit = this.git(request.project_id, [
174
+ "-c",
175
+ "user.name=Leitwerk Bot",
176
+ "-c",
177
+ "user.email=bot@gitlab.test",
178
+ "commit-tree",
179
+ tree,
180
+ "-p",
181
+ base,
182
+ "-p",
183
+ head,
184
+ "-m",
185
+ request.title,
186
+ ]);
187
+ this.git(request.project_id, [
188
+ "update-ref",
189
+ `refs/heads/${request.target_branch}`,
190
+ commit,
191
+ base,
192
+ ]);
193
+ request.state = "merged";
194
+ request.merge_commit_sha = commit;
195
+ this.save();
196
+ }
197
+ private conflicts(request: GitLabMergeRequest): boolean {
198
+ try {
199
+ this.git(request.project_id, [
200
+ "merge-tree",
201
+ "--write-tree",
202
+ request.target_branch,
203
+ request.source_branch,
204
+ ]);
205
+ return false;
206
+ } catch {
207
+ return true;
208
+ }
209
+ }
210
+ /** @public */
124
211
  client(): GitLabClientLike {
125
212
  const mr = (id: number, iid: number) => {
126
213
  const m = this.state.mrs.find((m) => m.project_id === id && m.iid === iid);
@@ -134,6 +221,72 @@ export class LocalGitLabAdapter {
134
221
  });
135
222
  return {
136
223
  baseUrl: this.baseUrl,
224
+ listIssues: async (id) =>
225
+ structuredClone(
226
+ (this.state.issues ?? []).filter((i) => i.project_id === id && i.state === "opened"),
227
+ ),
228
+ getIssue: async (id, iid) => {
229
+ const issue = (this.state.issues ?? []).find((i) => i.project_id === id && i.iid === iid);
230
+ if (!issue) throw new Error("Unknown local GitLab issue");
231
+ return structuredClone(issue);
232
+ },
233
+ updateIssue: async (id, iid, patch) => {
234
+ const issue = (this.state.issues ?? []).find((i) => i.project_id === id && i.iid === iid);
235
+ if (!issue) throw new Error("Unknown local GitLab issue");
236
+ if (patch.labels !== undefined) issue.labels = patch.labels ? patch.labels.split(",") : [];
237
+ if (patch.state_event === "close") issue.state = "closed";
238
+ this.save();
239
+ return structuredClone(issue);
240
+ },
241
+ listIssueNotes: async (id, iid) =>
242
+ structuredClone(this.state.issueNotes?.[`${id}:${iid}`] ?? []),
243
+ addIssueNote: async (id, iid, body) => {
244
+ this.state.issueNotes ??= {};
245
+ this.state.issueNotes[`${id}:${iid}`] ??= [];
246
+ const notes = this.state.issueNotes[`${id}:${iid}`];
247
+ return this.append(notes, { id: notes.length + 1, body }, "Comment");
248
+ },
249
+ listLabels: async (id) => (this.state.labels?.[id] ?? []).map((name) => ({ name })),
250
+ createLabel: async (id, name) => {
251
+ this.state.labels ??= {};
252
+ this.state.labels[id] ??= [];
253
+ const labels = this.state.labels[id];
254
+ if (!labels.includes(name)) labels.push(name);
255
+ this.save();
256
+ return { name };
257
+ },
258
+ listBranchMergeRequests: async (id, source, target) =>
259
+ structuredClone(
260
+ this.state.mrs.filter(
261
+ (m) => m.project_id === id && m.source_branch === source && m.target_branch === target,
262
+ ),
263
+ ),
264
+ createMergeRequest: async (id, input) => {
265
+ const request = this.openMr(this.project(id), input.source_branch);
266
+ Object.assign(request, {
267
+ title: input.title,
268
+ description: input.description,
269
+ target_branch: input.target_branch,
270
+ labels: [],
271
+ });
272
+ this.save();
273
+ if (this.loseNextMergeRequestResponse) {
274
+ this.loseNextMergeRequestResponse = false;
275
+ throw new Error("Response lost after merge request creation");
276
+ }
277
+ return structuredClone(request);
278
+ },
279
+ preflightRepository: async (id, baseBranch, workBranch) => {
280
+ this.git(id, ["rev-parse", `refs/heads/${baseBranch}`]);
281
+ this.git(id, ["check-ref-format", `refs/heads/${workBranch}`]);
282
+ this.git(id, [
283
+ "push",
284
+ "--dry-run",
285
+ this.project(id).http_url_to_repo,
286
+ `${baseBranch}:refs/heads/${workBranch}`,
287
+ ]);
288
+ },
289
+
137
290
  getProject: async (id) => structuredClone(this.project(id)),
138
291
  listProjects: async () => structuredClone(this.state.projects),
139
292
  getGroup: async (id) => ({ id: 1, full_path: String(id) }),
@@ -143,6 +296,7 @@ export class LocalGitLabAdapter {
143
296
  ),
144
297
  getMergeRequest: async (id, iid) => ({
145
298
  ...structuredClone(mr(id, iid)),
299
+ has_conflicts: this.conflicts(mr(id, iid)),
146
300
  sha: commit(mr(id, iid).source_project_id, mr(id, iid).source_branch).id,
147
301
  }),
148
302
  listMergeRequests: async (id, label) =>