@leitwerk-dev/gitlab-repo-change 0.0.0-bootstrap.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.
- package/README.md +73 -1
- package/dist/LICENSE +13 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +934 -0
- package/dist/index.js.map +1 -0
- package/dist/launcher.d.ts +15 -0
- package/dist/launcher.d.ts.map +1 -0
- package/dist/params.d.ts +39 -0
- package/dist/params.d.ts.map +1 -0
- package/dist/process.d.ts +10 -0
- package/dist/process.d.ts.map +1 -0
- package/package.json +50 -14
- package/src/index.ts +55 -0
- package/src/launcher.ts +240 -0
- package/src/params.ts +93 -0
- package/src/process.ts +249 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,934 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { gitlabIntegration } from "@leitwerk-dev/gitlab";
|
|
3
|
+
|
|
4
|
+
// src/launcher.ts
|
|
5
|
+
import { buildAutoWorkBranchFromSeed } from "@leitwerk-dev/coding/auto-work-branch";
|
|
6
|
+
|
|
7
|
+
// ../../node_modules/valibot/dist/index.mjs
|
|
8
|
+
var store$4;
|
|
9
|
+
// @__NO_SIDE_EFFECTS__
|
|
10
|
+
function getGlobalConfig(config$1) {
|
|
11
|
+
return {
|
|
12
|
+
lang: config$1?.lang ?? store$4?.lang,
|
|
13
|
+
message: config$1?.message,
|
|
14
|
+
abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
|
|
15
|
+
abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
var store$3;
|
|
19
|
+
// @__NO_SIDE_EFFECTS__
|
|
20
|
+
function getGlobalMessage(lang) {
|
|
21
|
+
return store$3?.get(lang);
|
|
22
|
+
}
|
|
23
|
+
var store$2;
|
|
24
|
+
// @__NO_SIDE_EFFECTS__
|
|
25
|
+
function getSchemaMessage(lang) {
|
|
26
|
+
return store$2?.get(lang);
|
|
27
|
+
}
|
|
28
|
+
var store$1;
|
|
29
|
+
// @__NO_SIDE_EFFECTS__
|
|
30
|
+
function getSpecificMessage(reference, lang) {
|
|
31
|
+
return store$1?.get(reference)?.get(lang);
|
|
32
|
+
}
|
|
33
|
+
// @__NO_SIDE_EFFECTS__
|
|
34
|
+
function _stringify(input) {
|
|
35
|
+
const type = typeof input;
|
|
36
|
+
if (type === "string") return `"${input}"`;
|
|
37
|
+
if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
|
|
38
|
+
if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
|
|
39
|
+
return type;
|
|
40
|
+
}
|
|
41
|
+
function _addIssue(context, label, dataset, config$1, other) {
|
|
42
|
+
const input = other && "input" in other ? other.input : dataset.value;
|
|
43
|
+
const expected = other?.expected ?? context.expects ?? null;
|
|
44
|
+
const received = other?.received ?? /* @__PURE__ */ _stringify(input);
|
|
45
|
+
const issue = {
|
|
46
|
+
kind: context.kind,
|
|
47
|
+
type: context.type,
|
|
48
|
+
input,
|
|
49
|
+
expected,
|
|
50
|
+
received,
|
|
51
|
+
message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
|
|
52
|
+
requirement: context.requirement,
|
|
53
|
+
path: other?.path,
|
|
54
|
+
issues: other?.issues,
|
|
55
|
+
lang: config$1.lang,
|
|
56
|
+
abortEarly: config$1.abortEarly,
|
|
57
|
+
abortPipeEarly: config$1.abortPipeEarly
|
|
58
|
+
};
|
|
59
|
+
const isSchema = context.kind === "schema";
|
|
60
|
+
const message$1 = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config$1.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
|
|
61
|
+
if (message$1 !== void 0) issue.message = typeof message$1 === "function" ? message$1(issue) : message$1;
|
|
62
|
+
if (isSchema) dataset.typed = false;
|
|
63
|
+
if (dataset.issues) dataset.issues.push(issue);
|
|
64
|
+
else dataset.issues = [issue];
|
|
65
|
+
}
|
|
66
|
+
// @__NO_SIDE_EFFECTS__
|
|
67
|
+
function _getStandardProps(context) {
|
|
68
|
+
return {
|
|
69
|
+
version: 1,
|
|
70
|
+
vendor: "valibot",
|
|
71
|
+
validate(value$1) {
|
|
72
|
+
return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
// @__NO_SIDE_EFFECTS__
|
|
77
|
+
function _isValidObjectKey(object$1, key) {
|
|
78
|
+
return Object.hasOwn(object$1, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
|
|
79
|
+
}
|
|
80
|
+
// @__NO_SIDE_EFFECTS__
|
|
81
|
+
function check(requirement, message$1) {
|
|
82
|
+
return {
|
|
83
|
+
kind: "validation",
|
|
84
|
+
type: "check",
|
|
85
|
+
reference: check,
|
|
86
|
+
async: false,
|
|
87
|
+
expects: null,
|
|
88
|
+
requirement,
|
|
89
|
+
message: message$1,
|
|
90
|
+
"~run"(dataset, config$1) {
|
|
91
|
+
if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "input", dataset, config$1);
|
|
92
|
+
return dataset;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
// @__NO_SIDE_EFFECTS__
|
|
97
|
+
function parseJson(config$1, message$1) {
|
|
98
|
+
return {
|
|
99
|
+
kind: "transformation",
|
|
100
|
+
type: "parse_json",
|
|
101
|
+
reference: parseJson,
|
|
102
|
+
config: config$1,
|
|
103
|
+
message: message$1,
|
|
104
|
+
async: false,
|
|
105
|
+
"~run"(dataset, config$2) {
|
|
106
|
+
try {
|
|
107
|
+
dataset.value = JSON.parse(dataset.value, this.config?.reviver);
|
|
108
|
+
} catch (error) {
|
|
109
|
+
if (error instanceof Error) {
|
|
110
|
+
_addIssue(this, "JSON", dataset, config$2, { received: `"${error.message}"` });
|
|
111
|
+
dataset.typed = false;
|
|
112
|
+
} else throw error;
|
|
113
|
+
}
|
|
114
|
+
return dataset;
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
// @__NO_SIDE_EFFECTS__
|
|
119
|
+
function getFallback(schema, dataset, config$1) {
|
|
120
|
+
return typeof schema.fallback === "function" ? schema.fallback(dataset, config$1) : schema.fallback;
|
|
121
|
+
}
|
|
122
|
+
// @__NO_SIDE_EFFECTS__
|
|
123
|
+
function getDefault(schema, dataset, config$1) {
|
|
124
|
+
return typeof schema.default === "function" ? schema.default(dataset, config$1) : schema.default;
|
|
125
|
+
}
|
|
126
|
+
// @__NO_SIDE_EFFECTS__
|
|
127
|
+
function custom(check$1, message$1) {
|
|
128
|
+
return {
|
|
129
|
+
kind: "schema",
|
|
130
|
+
type: "custom",
|
|
131
|
+
reference: custom,
|
|
132
|
+
expects: "unknown",
|
|
133
|
+
async: false,
|
|
134
|
+
check: check$1,
|
|
135
|
+
message: message$1,
|
|
136
|
+
get "~standard"() {
|
|
137
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
138
|
+
},
|
|
139
|
+
"~run"(dataset, config$1) {
|
|
140
|
+
if (this.check(dataset.value)) dataset.typed = true;
|
|
141
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
142
|
+
return dataset;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
// @__NO_SIDE_EFFECTS__
|
|
147
|
+
function object(entries$1, message$1) {
|
|
148
|
+
return {
|
|
149
|
+
kind: "schema",
|
|
150
|
+
type: "object",
|
|
151
|
+
reference: object,
|
|
152
|
+
expects: "Object",
|
|
153
|
+
async: false,
|
|
154
|
+
entries: entries$1,
|
|
155
|
+
message: message$1,
|
|
156
|
+
get "~standard"() {
|
|
157
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
158
|
+
},
|
|
159
|
+
"~run"(dataset, config$1) {
|
|
160
|
+
const input = dataset.value;
|
|
161
|
+
if (input && typeof input === "object") {
|
|
162
|
+
dataset.typed = true;
|
|
163
|
+
dataset.value = {};
|
|
164
|
+
for (const key in this.entries) {
|
|
165
|
+
const valueSchema = this.entries[key];
|
|
166
|
+
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
167
|
+
const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
168
|
+
const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
|
|
169
|
+
if (valueDataset.issues) {
|
|
170
|
+
const pathItem = {
|
|
171
|
+
type: "object",
|
|
172
|
+
origin: "value",
|
|
173
|
+
input,
|
|
174
|
+
key,
|
|
175
|
+
value: value$1
|
|
176
|
+
};
|
|
177
|
+
for (const issue of valueDataset.issues) {
|
|
178
|
+
if (issue.path) issue.path.unshift(pathItem);
|
|
179
|
+
else issue.path = [pathItem];
|
|
180
|
+
dataset.issues?.push(issue);
|
|
181
|
+
}
|
|
182
|
+
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
183
|
+
if (config$1.abortEarly) {
|
|
184
|
+
dataset.typed = false;
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (!valueDataset.typed) dataset.typed = false;
|
|
189
|
+
dataset.value[key] = valueDataset.value;
|
|
190
|
+
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
191
|
+
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
192
|
+
_addIssue(this, "key", dataset, config$1, {
|
|
193
|
+
input: void 0,
|
|
194
|
+
expected: `"${key}"`,
|
|
195
|
+
path: [{
|
|
196
|
+
type: "object",
|
|
197
|
+
origin: "key",
|
|
198
|
+
input,
|
|
199
|
+
key,
|
|
200
|
+
value: input[key]
|
|
201
|
+
}]
|
|
202
|
+
});
|
|
203
|
+
if (config$1.abortEarly) break;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
} else _addIssue(this, "type", dataset, config$1);
|
|
207
|
+
return dataset;
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
// @__NO_SIDE_EFFECTS__
|
|
212
|
+
function optional(wrapped, default_) {
|
|
213
|
+
return {
|
|
214
|
+
kind: "schema",
|
|
215
|
+
type: "optional",
|
|
216
|
+
reference: optional,
|
|
217
|
+
expects: `(${wrapped.expects} | undefined)`,
|
|
218
|
+
async: false,
|
|
219
|
+
wrapped,
|
|
220
|
+
default: default_,
|
|
221
|
+
get "~standard"() {
|
|
222
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
223
|
+
},
|
|
224
|
+
"~run"(dataset, config$1) {
|
|
225
|
+
if (dataset.value === void 0) {
|
|
226
|
+
if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
|
|
227
|
+
if (dataset.value === void 0) {
|
|
228
|
+
dataset.typed = true;
|
|
229
|
+
return dataset;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return this.wrapped["~run"](dataset, config$1);
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
// @__NO_SIDE_EFFECTS__
|
|
237
|
+
function record(key, value$1, message$1) {
|
|
238
|
+
return {
|
|
239
|
+
kind: "schema",
|
|
240
|
+
type: "record",
|
|
241
|
+
reference: record,
|
|
242
|
+
expects: "Object",
|
|
243
|
+
async: false,
|
|
244
|
+
key,
|
|
245
|
+
value: value$1,
|
|
246
|
+
message: message$1,
|
|
247
|
+
get "~standard"() {
|
|
248
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
249
|
+
},
|
|
250
|
+
"~run"(dataset, config$1) {
|
|
251
|
+
const input = dataset.value;
|
|
252
|
+
if (input && typeof input === "object") {
|
|
253
|
+
dataset.typed = true;
|
|
254
|
+
dataset.value = {};
|
|
255
|
+
for (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
|
|
256
|
+
const entryValue = input[entryKey];
|
|
257
|
+
const keyDataset = this.key["~run"]({ value: entryKey }, config$1);
|
|
258
|
+
if (keyDataset.issues) {
|
|
259
|
+
const pathItem = {
|
|
260
|
+
type: "object",
|
|
261
|
+
origin: "key",
|
|
262
|
+
input,
|
|
263
|
+
key: entryKey,
|
|
264
|
+
value: entryValue
|
|
265
|
+
};
|
|
266
|
+
for (const issue of keyDataset.issues) {
|
|
267
|
+
issue.path = [pathItem];
|
|
268
|
+
dataset.issues?.push(issue);
|
|
269
|
+
}
|
|
270
|
+
if (!dataset.issues) dataset.issues = keyDataset.issues;
|
|
271
|
+
if (config$1.abortEarly) {
|
|
272
|
+
dataset.typed = false;
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
const valueDataset = this.value["~run"]({ value: entryValue }, config$1);
|
|
277
|
+
if (valueDataset.issues) {
|
|
278
|
+
const pathItem = {
|
|
279
|
+
type: "object",
|
|
280
|
+
origin: "value",
|
|
281
|
+
input,
|
|
282
|
+
key: entryKey,
|
|
283
|
+
value: entryValue
|
|
284
|
+
};
|
|
285
|
+
for (const issue of valueDataset.issues) {
|
|
286
|
+
if (issue.path) issue.path.unshift(pathItem);
|
|
287
|
+
else issue.path = [pathItem];
|
|
288
|
+
dataset.issues?.push(issue);
|
|
289
|
+
}
|
|
290
|
+
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
291
|
+
if (config$1.abortEarly) {
|
|
292
|
+
dataset.typed = false;
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
if (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;
|
|
297
|
+
if (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;
|
|
298
|
+
}
|
|
299
|
+
} else _addIssue(this, "type", dataset, config$1);
|
|
300
|
+
return dataset;
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
// @__NO_SIDE_EFFECTS__
|
|
305
|
+
function string(message$1) {
|
|
306
|
+
return {
|
|
307
|
+
kind: "schema",
|
|
308
|
+
type: "string",
|
|
309
|
+
reference: string,
|
|
310
|
+
expects: "string",
|
|
311
|
+
async: false,
|
|
312
|
+
message: message$1,
|
|
313
|
+
get "~standard"() {
|
|
314
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
315
|
+
},
|
|
316
|
+
"~run"(dataset, config$1) {
|
|
317
|
+
if (typeof dataset.value === "string") dataset.typed = true;
|
|
318
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
319
|
+
return dataset;
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
// @__NO_SIDE_EFFECTS__
|
|
324
|
+
function unknown() {
|
|
325
|
+
return {
|
|
326
|
+
kind: "schema",
|
|
327
|
+
type: "unknown",
|
|
328
|
+
reference: unknown,
|
|
329
|
+
expects: "unknown",
|
|
330
|
+
async: false,
|
|
331
|
+
get "~standard"() {
|
|
332
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
333
|
+
},
|
|
334
|
+
"~run"(dataset) {
|
|
335
|
+
dataset.typed = true;
|
|
336
|
+
return dataset;
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
// @__NO_SIDE_EFFECTS__
|
|
341
|
+
function pipe(...pipe$1) {
|
|
342
|
+
return {
|
|
343
|
+
...pipe$1[0],
|
|
344
|
+
pipe: pipe$1,
|
|
345
|
+
get "~standard"() {
|
|
346
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
347
|
+
},
|
|
348
|
+
"~run"(dataset, config$1) {
|
|
349
|
+
for (const item of pipe$1) if (item.kind !== "metadata") {
|
|
350
|
+
if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
|
|
351
|
+
dataset.typed = false;
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item["~run"](dataset, config$1);
|
|
355
|
+
}
|
|
356
|
+
return dataset;
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// ../../packages/domain/dist/index.js
|
|
362
|
+
function trimString(value) {
|
|
363
|
+
return typeof value === "string" ? value.trim() : "";
|
|
364
|
+
}
|
|
365
|
+
var SYSTEM_ACTOR = { id: "system", kind: "system", provider: null };
|
|
366
|
+
function serializeActor(actor) {
|
|
367
|
+
return JSON.stringify({
|
|
368
|
+
id: actor.id,
|
|
369
|
+
kind: actor.kind,
|
|
370
|
+
provider: actor.provider,
|
|
371
|
+
...actor.displayName !== void 0 ? { displayName: actor.displayName } : {}
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
var SERIALIZED_SYSTEM_ACTOR = serializeActor(SYSTEM_ACTOR);
|
|
375
|
+
var jsonObjectSchema = custom(
|
|
376
|
+
(value) => typeof value === "object" && value !== null && !Array.isArray(value),
|
|
377
|
+
"Expected object"
|
|
378
|
+
);
|
|
379
|
+
var instanceTurnConfigSchema = pipe(
|
|
380
|
+
jsonObjectSchema,
|
|
381
|
+
object({
|
|
382
|
+
modelProfileId: optional(unknown())
|
|
383
|
+
})
|
|
384
|
+
);
|
|
385
|
+
var strictInstanceTurnConfigsJsonSchema = pipe(
|
|
386
|
+
string(),
|
|
387
|
+
parseJson(),
|
|
388
|
+
jsonObjectSchema,
|
|
389
|
+
record(string(), instanceTurnConfigSchema)
|
|
390
|
+
);
|
|
391
|
+
var copiedUnknownRecordSchema = pipe(
|
|
392
|
+
unknown(),
|
|
393
|
+
check(isUnknownRecord, "Expected object"),
|
|
394
|
+
record(string(), unknown())
|
|
395
|
+
);
|
|
396
|
+
function isUnknownRecord(value) {
|
|
397
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// src/launcher.ts
|
|
401
|
+
import {
|
|
402
|
+
gitlabIssueExternalId
|
|
403
|
+
} from "@leitwerk-dev/gitlab";
|
|
404
|
+
import {
|
|
405
|
+
SafeLaunchPreparationError
|
|
406
|
+
} from "@leitwerk-dev/process-sdk";
|
|
407
|
+
function createGitLabRepoChangeLauncher() {
|
|
408
|
+
let integration = null;
|
|
409
|
+
const requireIntegration = () => {
|
|
410
|
+
if (!integration) throw new Error("GitLab repository launcher is not configured");
|
|
411
|
+
return integration;
|
|
412
|
+
};
|
|
413
|
+
const configure = (value) => {
|
|
414
|
+
integration = value;
|
|
415
|
+
};
|
|
416
|
+
async function launch(repository, profile, prompt, issue) {
|
|
417
|
+
const service = requireIntegration();
|
|
418
|
+
if (!service.profiles().includes(profile)) throw new Error("GitLab profile is unavailable");
|
|
419
|
+
const client = service.client(profile);
|
|
420
|
+
const split = repository.path_with_namespace.lastIndexOf("/");
|
|
421
|
+
if (split < 1) throw new Error("Invalid GitLab project path");
|
|
422
|
+
const common = {
|
|
423
|
+
gitlabProfile: profile,
|
|
424
|
+
gitlabOrigin: client.baseUrl,
|
|
425
|
+
projectId: repository.id,
|
|
426
|
+
owner: repository.path_with_namespace.slice(0, split),
|
|
427
|
+
repo: repository.path_with_namespace.slice(split + 1),
|
|
428
|
+
repoLocator: repository.http_url_to_repo,
|
|
429
|
+
baseBranch: repository.default_branch,
|
|
430
|
+
workBranch: issue ? `leitwerk/issue-${issue.issue.iid}` : buildAutoWorkBranchFromSeed(
|
|
431
|
+
prompt,
|
|
432
|
+
`${repository.http_url_to_repo}:${repository.default_branch}`
|
|
433
|
+
),
|
|
434
|
+
prompt
|
|
435
|
+
};
|
|
436
|
+
const params = issue ? {
|
|
437
|
+
...common,
|
|
438
|
+
origin: "issue",
|
|
439
|
+
issueNumber: issue.issue.iid,
|
|
440
|
+
issueUrl: issue.issue.web_url,
|
|
441
|
+
triggerLabel: issue.labels.trigger,
|
|
442
|
+
doneLabel: issue.labels.done
|
|
443
|
+
} : {
|
|
444
|
+
...common,
|
|
445
|
+
origin: "ui",
|
|
446
|
+
issueNumber: null,
|
|
447
|
+
issueUrl: null,
|
|
448
|
+
triggerLabel: null,
|
|
449
|
+
doneLabel: null
|
|
450
|
+
};
|
|
451
|
+
const identity = await client.resolveGitIdentity();
|
|
452
|
+
return {
|
|
453
|
+
processId: "gitlab_repo_change_process",
|
|
454
|
+
title: issue?.issue.title ?? prompt,
|
|
455
|
+
params,
|
|
456
|
+
startTurnId: "generate_plan",
|
|
457
|
+
...issue ? {
|
|
458
|
+
externalId: gitlabIssueExternalId(client.baseUrl, repository.id, issue.issue.iid),
|
|
459
|
+
externalUrl: issue.issue.web_url
|
|
460
|
+
} : {},
|
|
461
|
+
projects: [
|
|
462
|
+
{
|
|
463
|
+
key: "repo",
|
|
464
|
+
repoLocator: params.repoLocator,
|
|
465
|
+
baseBranch: params.baseBranch,
|
|
466
|
+
workBranch: params.workBranch,
|
|
467
|
+
metadata: {
|
|
468
|
+
gitlab: {
|
|
469
|
+
profile,
|
|
470
|
+
projectId: repository.id,
|
|
471
|
+
...issue ? { issueIid: issue.issue.iid } : {}
|
|
472
|
+
},
|
|
473
|
+
"leitwerk.gitIdentity": {
|
|
474
|
+
provider: "gitlab",
|
|
475
|
+
profile,
|
|
476
|
+
login: identity.username,
|
|
477
|
+
name: identity.name,
|
|
478
|
+
email: identity.email
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
]
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
const preparationChecks = (_input, { params }) => [
|
|
486
|
+
{
|
|
487
|
+
id: "gitlab_repository_access",
|
|
488
|
+
label: "Verify GitLab repository and HTTPS read/write access",
|
|
489
|
+
async run({ signal }) {
|
|
490
|
+
const client = requireIntegration().client(params.gitlabProfile);
|
|
491
|
+
const repository = await client.getProject(params.projectId, signal);
|
|
492
|
+
if (repository.archived || repository.http_url_to_repo !== params.repoLocator || repository.default_branch !== params.baseBranch)
|
|
493
|
+
throw new SafeLaunchPreparationError(
|
|
494
|
+
"Repository changed or is archived",
|
|
495
|
+
"Select an active GitLab project and launch again."
|
|
496
|
+
);
|
|
497
|
+
await client.preflightRepository(
|
|
498
|
+
params.projectId,
|
|
499
|
+
params.baseBranch,
|
|
500
|
+
params.workBranch,
|
|
501
|
+
signal
|
|
502
|
+
);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
];
|
|
506
|
+
const launcher = {
|
|
507
|
+
id: "gitlab_repo_change_process.ui_launcher",
|
|
508
|
+
label: "GitLab Repo Change",
|
|
509
|
+
description: "Plan, implement, review, and publish a GitLab merge request",
|
|
510
|
+
visibility: "ui",
|
|
511
|
+
ui: {
|
|
512
|
+
card: {
|
|
513
|
+
title: "GitLab Repo Change",
|
|
514
|
+
description: "Start a repository change and publish a merge request."
|
|
515
|
+
},
|
|
516
|
+
launchConfigSchema: {
|
|
517
|
+
id: "gitlab_repo_change_form",
|
|
518
|
+
title: "GitLab Repo Change",
|
|
519
|
+
fields: [
|
|
520
|
+
{ id: "gitlabProfile", label: "GitLab profile", kind: "select", required: true },
|
|
521
|
+
{ id: "repository", label: "Project", kind: "select", required: true },
|
|
522
|
+
{ id: "prompt", label: "Requested change", kind: "textarea", required: true }
|
|
523
|
+
],
|
|
524
|
+
submitLabel: "Start change"
|
|
525
|
+
},
|
|
526
|
+
resolveDefaults() {
|
|
527
|
+
return {
|
|
528
|
+
gitlabProfile: requireIntegration().profiles()[0] ?? "",
|
|
529
|
+
repository: "",
|
|
530
|
+
prompt: ""
|
|
531
|
+
};
|
|
532
|
+
},
|
|
533
|
+
async resolveOptions(input) {
|
|
534
|
+
const i = requireIntegration();
|
|
535
|
+
const profile = trimString(input.gitlabProfile);
|
|
536
|
+
return {
|
|
537
|
+
gitlabProfile: i.profiles().map((value) => ({ value, label: value })),
|
|
538
|
+
repository: (i.profiles().includes(profile) ? await i.client(profile).listProjects() : []).filter((p) => !p.archived && p.default_branch).map((p) => ({
|
|
539
|
+
value: String(p.id),
|
|
540
|
+
label: p.path_with_namespace,
|
|
541
|
+
description: p.web_url
|
|
542
|
+
}))
|
|
543
|
+
};
|
|
544
|
+
},
|
|
545
|
+
preparationChecks,
|
|
546
|
+
resolveRelaunchInput(input) {
|
|
547
|
+
return {
|
|
548
|
+
gitlabProfile: trimString(input.gitlabProfile),
|
|
549
|
+
repository: trimString(input.repository),
|
|
550
|
+
prompt: trimString(input.prompt)
|
|
551
|
+
};
|
|
552
|
+
},
|
|
553
|
+
async resolveLaunchConfig(input) {
|
|
554
|
+
const profile = trimString(input.gitlabProfile);
|
|
555
|
+
const projectId = Number(input.repository);
|
|
556
|
+
const prompt = trimString(input.prompt);
|
|
557
|
+
const errors = [];
|
|
558
|
+
if (!requireIntegration().profiles().includes(profile))
|
|
559
|
+
errors.push({
|
|
560
|
+
fieldId: "gitlabProfile",
|
|
561
|
+
message: "Select an available GitLab profile",
|
|
562
|
+
code: "custom_rule"
|
|
563
|
+
});
|
|
564
|
+
if (!Number.isSafeInteger(projectId) || projectId <= 0)
|
|
565
|
+
errors.push({
|
|
566
|
+
fieldId: "repository",
|
|
567
|
+
message: "Select a project",
|
|
568
|
+
code: "required"
|
|
569
|
+
});
|
|
570
|
+
if (!prompt)
|
|
571
|
+
errors.push({
|
|
572
|
+
fieldId: "prompt",
|
|
573
|
+
message: "Describe the requested change",
|
|
574
|
+
code: "required"
|
|
575
|
+
});
|
|
576
|
+
if (errors.length) return { ok: false, errors };
|
|
577
|
+
const repository = await requireIntegration().client(profile).getProject(projectId);
|
|
578
|
+
if (repository.archived || !repository.default_branch)
|
|
579
|
+
return {
|
|
580
|
+
ok: false,
|
|
581
|
+
errors: [
|
|
582
|
+
{
|
|
583
|
+
fieldId: "repository",
|
|
584
|
+
message: "Project is archived or has no default branch",
|
|
585
|
+
code: "custom_rule"
|
|
586
|
+
}
|
|
587
|
+
]
|
|
588
|
+
};
|
|
589
|
+
return { ok: true, launchConfig: await launch(repository, profile, prompt) };
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
return {
|
|
594
|
+
/** @public */
|
|
595
|
+
configure,
|
|
596
|
+
/** @public */
|
|
597
|
+
launcher,
|
|
598
|
+
/** @public */
|
|
599
|
+
preparationChecks,
|
|
600
|
+
/** @public */
|
|
601
|
+
async fromIssue(event) {
|
|
602
|
+
return launch(
|
|
603
|
+
event.repository,
|
|
604
|
+
event.profile,
|
|
605
|
+
`${event.issue.title}${event.issue.description ? `
|
|
606
|
+
|
|
607
|
+
${event.issue.description}` : ""}`,
|
|
608
|
+
event
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
// src/process.ts
|
|
615
|
+
import { createRepositoryChangeProcess } from "@leitwerk-dev/coding";
|
|
616
|
+
import {
|
|
617
|
+
createRepositoryChangePublication,
|
|
618
|
+
publicationObject as object2,
|
|
619
|
+
readPublicationState
|
|
620
|
+
} from "@leitwerk-dev/coding/repository-change-publication";
|
|
621
|
+
import {
|
|
622
|
+
gitlabExternal,
|
|
623
|
+
gitlabIssueWatcherSource,
|
|
624
|
+
gitlabRepositoryCredentials
|
|
625
|
+
} from "@leitwerk-dev/gitlab";
|
|
626
|
+
|
|
627
|
+
// src/params.ts
|
|
628
|
+
import {
|
|
629
|
+
createRepositoryChangeParamsCodec,
|
|
630
|
+
normalizeRepositoryChangeParamsInput,
|
|
631
|
+
repositoryChangeParamsRecord
|
|
632
|
+
} from "@leitwerk-dev/coding/repository-change-launch";
|
|
633
|
+
var gitlabRepoChangeParamsCodec = createRepositoryChangeParamsCodec({
|
|
634
|
+
normalize(value) {
|
|
635
|
+
const r = repositoryChangeParamsRecord(value, "GitLab Repo Change");
|
|
636
|
+
const text = (key) => {
|
|
637
|
+
const v = trimString(r[key]);
|
|
638
|
+
if (!v) throw new Error(`GitLab Repo Change requires ${key}`);
|
|
639
|
+
return v;
|
|
640
|
+
};
|
|
641
|
+
if (typeof r.projectId !== "number" || !Number.isSafeInteger(r.projectId) || r.projectId <= 0)
|
|
642
|
+
throw new Error("GitLab Repo Change requires projectId");
|
|
643
|
+
const common = {
|
|
644
|
+
...normalizeRepositoryChangeParamsInput(value, "GitLab Repo Change"),
|
|
645
|
+
gitlabProfile: text("gitlabProfile"),
|
|
646
|
+
gitlabOrigin: text("gitlabOrigin"),
|
|
647
|
+
projectId: r.projectId,
|
|
648
|
+
owner: text("owner"),
|
|
649
|
+
repo: text("repo")
|
|
650
|
+
};
|
|
651
|
+
if (r.origin === "ui")
|
|
652
|
+
return {
|
|
653
|
+
...common,
|
|
654
|
+
origin: "ui",
|
|
655
|
+
issueNumber: null,
|
|
656
|
+
issueUrl: null,
|
|
657
|
+
triggerLabel: null,
|
|
658
|
+
doneLabel: null
|
|
659
|
+
};
|
|
660
|
+
if (r.origin !== "issue" || typeof r.issueNumber !== "number" || !Number.isSafeInteger(r.issueNumber) || r.issueNumber <= 0)
|
|
661
|
+
throw new Error("GitLab Repo Change requires a valid origin and issueNumber");
|
|
662
|
+
return {
|
|
663
|
+
...common,
|
|
664
|
+
origin: "issue",
|
|
665
|
+
issueNumber: r.issueNumber,
|
|
666
|
+
issueUrl: text("issueUrl"),
|
|
667
|
+
triggerLabel: text("triggerLabel"),
|
|
668
|
+
doneLabel: text("doneLabel")
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
// src/process.ts
|
|
674
|
+
var remote = (state) => readPublicationState(state, "gitlabRepoChange");
|
|
675
|
+
var request = (mr) => ({
|
|
676
|
+
number: mr.iid,
|
|
677
|
+
html_url: mr.web_url,
|
|
678
|
+
merged: mr.state === "merged",
|
|
679
|
+
merge_commit_sha: mr.merge_commit_sha
|
|
680
|
+
});
|
|
681
|
+
var callFor = (ctx) => (name, args = {}) => ctx.callIntegrationTool(name, { projectKey: "repo", ...args });
|
|
682
|
+
function requireRequest(state) {
|
|
683
|
+
const current = remote(state);
|
|
684
|
+
if (!current.prNumber || !current.headSha)
|
|
685
|
+
throw new Error("Merge request delivery state is incomplete");
|
|
686
|
+
return { ...current, prNumber: current.prNumber, headSha: current.headSha };
|
|
687
|
+
}
|
|
688
|
+
function gitlabPublicationEvidence(state, event) {
|
|
689
|
+
const current = requireRequest(state);
|
|
690
|
+
const key = { observationKey: event.observationKey };
|
|
691
|
+
if (event.mr.iid !== current.prNumber) throw new Error("Stale GitLab merge request evidence");
|
|
692
|
+
if (event.mr.state === "merged" || event.mr.state === "closed")
|
|
693
|
+
return { kind: "terminal", request: request(event.mr), ...key };
|
|
694
|
+
if (event.mr.sha !== current.headSha) return { kind: "observed", ...key };
|
|
695
|
+
if (event.conflict) return { kind: "conflict", conflict: event.conflict, ...key };
|
|
696
|
+
if (event.feedback?.length)
|
|
697
|
+
return {
|
|
698
|
+
kind: "feedback",
|
|
699
|
+
feedbackIds: event.feedback.map((n) => ({
|
|
700
|
+
kind: "inline",
|
|
701
|
+
id: n.id,
|
|
702
|
+
discussionId: n.discussionId
|
|
703
|
+
})),
|
|
704
|
+
conversationCursor: Math.max(current.conversationCursor, ...event.feedback.map((n) => n.id)),
|
|
705
|
+
reviewCursor: 0,
|
|
706
|
+
inlineCursor: 0
|
|
707
|
+
};
|
|
708
|
+
if (event.pipeline && ["failed", "canceled"].includes(event.pipeline.status))
|
|
709
|
+
return { kind: "failure", pipeline: { ...event.pipeline, number: event.pipeline.id }, ...key };
|
|
710
|
+
return { kind: "observed", ...key };
|
|
711
|
+
}
|
|
712
|
+
function createGitLabRepoChangeProcess(launcher, docker) {
|
|
713
|
+
const sources = [
|
|
714
|
+
{
|
|
715
|
+
id: "gitlab_merge_request",
|
|
716
|
+
kind: "observation",
|
|
717
|
+
label: "GitLab merge request evidence",
|
|
718
|
+
source: gitlabExternal.mergeRequest(({ params, state }) => {
|
|
719
|
+
const c = requireRequest(state);
|
|
720
|
+
return {
|
|
721
|
+
profile: params.gitlabProfile,
|
|
722
|
+
projectId: params.projectId,
|
|
723
|
+
iid: c.prNumber,
|
|
724
|
+
pollInterval: "30s",
|
|
725
|
+
afterKey: c.observationKey,
|
|
726
|
+
feedback: { afterId: c.conversationCursor, quietPeriodMs: 12e4 },
|
|
727
|
+
delivery: {
|
|
728
|
+
headSha: c.headSha,
|
|
729
|
+
owner: params.owner,
|
|
730
|
+
repo: params.repo,
|
|
731
|
+
headBranch: params.workBranch,
|
|
732
|
+
baseBranch: params.baseBranch,
|
|
733
|
+
lastConflictKey: c.lastConflictKey
|
|
734
|
+
}
|
|
735
|
+
};
|
|
736
|
+
}),
|
|
737
|
+
read: ({ state, event }) => gitlabPublicationEvidence(state, event)
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
id: "source_cancelled",
|
|
741
|
+
kind: "cancelled",
|
|
742
|
+
label: "GitLab source issue cancelled",
|
|
743
|
+
enabled: (p) => p.origin === "issue",
|
|
744
|
+
source: gitlabExternal.issueCancelled(({ params, state }) => {
|
|
745
|
+
if (params.origin !== "issue") throw new Error("Missing GitLab source issue");
|
|
746
|
+
return {
|
|
747
|
+
profile: params.gitlabProfile,
|
|
748
|
+
projectId: params.projectId,
|
|
749
|
+
issueIid: params.issueNumber,
|
|
750
|
+
iid: requireRequest(state).prNumber,
|
|
751
|
+
triggerLabel: params.triggerLabel,
|
|
752
|
+
pollInterval: "30s"
|
|
753
|
+
};
|
|
754
|
+
}),
|
|
755
|
+
read: () => ({ kind: "cancelled" })
|
|
756
|
+
}
|
|
757
|
+
];
|
|
758
|
+
const publication = createRepositoryChangePublication({
|
|
759
|
+
namespace: "gitlabRepoChange",
|
|
760
|
+
label: "GitLab MR",
|
|
761
|
+
ids: {
|
|
762
|
+
deliver: "deliver_change",
|
|
763
|
+
feedback: "revise_from_merge_request_feedback",
|
|
764
|
+
ciRepair: "repair_gitlab_pipeline",
|
|
765
|
+
operator: "ci_operator_action"
|
|
766
|
+
},
|
|
767
|
+
sources,
|
|
768
|
+
tools: {
|
|
769
|
+
delivery: [
|
|
770
|
+
"gitlab_ensure_merge_request",
|
|
771
|
+
"gitlab_observe_merge_request",
|
|
772
|
+
"gitlab_comment",
|
|
773
|
+
"gitlab_reply",
|
|
774
|
+
"gitlab_get_identity",
|
|
775
|
+
"gitlab_acknowledge_feedback",
|
|
776
|
+
"gitlab_add_issue_comment",
|
|
777
|
+
"gitlab_finalize_source_issue"
|
|
778
|
+
],
|
|
779
|
+
feedback: [
|
|
780
|
+
"gitlab_observe_merge_request",
|
|
781
|
+
"gitlab_get_changes",
|
|
782
|
+
"gitlab_list_merge_request_feedback"
|
|
783
|
+
],
|
|
784
|
+
ci: ["gitlab_observe_merge_request", "gitlab_list_failed_jobs", "gitlab_get_job_trace"]
|
|
785
|
+
},
|
|
786
|
+
async identity(ctx) {
|
|
787
|
+
const pinned = object2(
|
|
788
|
+
ctx.projects.find((p) => p.key === "repo")?.metadata?.["leitwerk.gitIdentity"]
|
|
789
|
+
);
|
|
790
|
+
if (pinned.provider !== "gitlab" || pinned.profile !== ctx.params.gitlabProfile || typeof pinned.name !== "string" || typeof pinned.email !== "string")
|
|
791
|
+
throw new Error("Pinned GitLab Git identity is unavailable");
|
|
792
|
+
return { name: pinned.name, email: pinned.email };
|
|
793
|
+
},
|
|
794
|
+
async ensureRequest(ctx) {
|
|
795
|
+
const mr = await callFor(ctx)("gitlab_ensure_merge_request", {
|
|
796
|
+
title: ctx.process.title ?? "Leitwerk change",
|
|
797
|
+
body: `${ctx.params.origin === "issue" ? `Implements ${ctx.params.issueUrl}
|
|
798
|
+
|
|
799
|
+
` : ""}Leitwerk process: ${ctx.process.id}`
|
|
800
|
+
});
|
|
801
|
+
return request(mr);
|
|
802
|
+
},
|
|
803
|
+
async reconcileTerminal(ctx, _current, pr) {
|
|
804
|
+
if (ctx.params.origin !== "issue") return;
|
|
805
|
+
const call = callFor(ctx);
|
|
806
|
+
await call("gitlab_finalize_source_issue", {
|
|
807
|
+
issueNumber: ctx.params.issueNumber,
|
|
808
|
+
merged: pr.merged,
|
|
809
|
+
triggerLabel: ctx.params.triggerLabel,
|
|
810
|
+
doneLabel: ctx.params.doneLabel,
|
|
811
|
+
writeKey: `gitlab:${ctx.process.id}:${pr.merged ? "complete-source-issue" : "remove-source-trigger"}`
|
|
812
|
+
});
|
|
813
|
+
await call("gitlab_add_issue_comment", {
|
|
814
|
+
issueNumber: ctx.params.issueNumber,
|
|
815
|
+
body: pr.merged ? `Merged ${pr.html_url}${pr.merge_commit_sha ? ` at ${pr.merge_commit_sha}` : ""}.` : `Leitwerk stopped because ${pr.html_url} was closed without merge.`,
|
|
816
|
+
writeKey: `gitlab:${ctx.process.id}:${pr.merged ? "merged" : "closed"}-mr-comment`
|
|
817
|
+
});
|
|
818
|
+
},
|
|
819
|
+
async linkIssue(ctx, current) {
|
|
820
|
+
if (ctx.params.origin === "issue")
|
|
821
|
+
await callFor(ctx)("gitlab_add_issue_comment", {
|
|
822
|
+
issueNumber: ctx.params.issueNumber,
|
|
823
|
+
body: `Leitwerk opened merge request ${current.prUrl}.`,
|
|
824
|
+
writeKey: `gitlab:${ctx.process.id}:source-mr-link:${current.prNumber}`
|
|
825
|
+
});
|
|
826
|
+
},
|
|
827
|
+
async acknowledge(ctx, current) {
|
|
828
|
+
for (const feedback of current.feedbackIds)
|
|
829
|
+
await callFor(ctx)("gitlab_acknowledge_feedback", { noteId: feedback.id });
|
|
830
|
+
},
|
|
831
|
+
async reply(ctx, current) {
|
|
832
|
+
for (const feedback of current.feedbackIds) {
|
|
833
|
+
if (!feedback.discussionId) throw new Error("GitLab feedback discussion is missing");
|
|
834
|
+
await callFor(ctx)("gitlab_reply", {
|
|
835
|
+
discussionId: feedback.discussionId,
|
|
836
|
+
body: `Addressed in ${current.headSha?.slice(0, 8) ?? "the current revision"}.`,
|
|
837
|
+
writeKey: `gitlab:${ctx.process.id}:feedback-reply:${feedback.id}:${current.headSha}`
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
},
|
|
841
|
+
async head(ctx) {
|
|
842
|
+
return (await callFor(ctx)("gitlab_observe_merge_request")).mr.sha;
|
|
843
|
+
},
|
|
844
|
+
async afterRebase(ctx, current) {
|
|
845
|
+
await callFor(ctx)("gitlab_comment", {
|
|
846
|
+
body: `Merge conflict repair completed at ${current.headSha}; base ${current.conflict?.baseSha}.`,
|
|
847
|
+
writeKey: `rebase:${ctx.process.id}:${current.lastConflictKey}:${current.headSha}`
|
|
848
|
+
});
|
|
849
|
+
},
|
|
850
|
+
commitMessage: (kind) => kind === "feedback" ? "fix: address GitLab review feedback" : "fix: repair GitLab pipeline",
|
|
851
|
+
prompt(kind, current) {
|
|
852
|
+
return kind === "feedback" ? `Address the unseen GitLab feedback for MR !${current.prNumber}: ${JSON.stringify(current.feedbackIds)}. Read the full discussions with gitlab_list_merge_request_feedback, inspect the checkout, and make only justified changes. Call changes_ready when ready to publish, no_changes with an explicit diagnosis when no change is needed, or cannot_repair for operator action.` : `Diagnose GitLab pipeline ${current.pipeline?.number} for head ${current.headSha}. Read gitlab_list_failed_jobs with pipelineId and bounded gitlab_get_job_trace before making repository repairs. Call changes_ready to publish, no_changes with a justified diagnosis, or cannot_repair when operator action is needed.`;
|
|
853
|
+
}
|
|
854
|
+
});
|
|
855
|
+
publication.fragment.watcher({
|
|
856
|
+
id: "use_leitwerk",
|
|
857
|
+
label: "GitLab use-leitwerk issues",
|
|
858
|
+
description: "Launch repository changes from labeled GitLab issues",
|
|
859
|
+
source: gitlabIssueWatcherSource,
|
|
860
|
+
preparationChecks: launcher.preparationChecks,
|
|
861
|
+
resolveLaunchConfig: launcher.fromIssue
|
|
862
|
+
});
|
|
863
|
+
const definition = createRepositoryChangeProcess({
|
|
864
|
+
processId: "gitlab_repo_change_process",
|
|
865
|
+
displayName: "GitLab Repo Change",
|
|
866
|
+
paramsCodec: gitlabRepoChangeParamsCodec,
|
|
867
|
+
launcher: launcher.launcher,
|
|
868
|
+
finalizeLabel: "Publish merge request",
|
|
869
|
+
finalizeForm: {
|
|
870
|
+
id: "gitlab_publish",
|
|
871
|
+
title: "Publish merge request",
|
|
872
|
+
fields: [],
|
|
873
|
+
submitLabel: "Publish"
|
|
874
|
+
},
|
|
875
|
+
repositoryCredentials: ({ params, projects }) => gitlabRepositoryCredentials(params.gitlabProfile, projects),
|
|
876
|
+
publication
|
|
877
|
+
});
|
|
878
|
+
definition.process.runtime = { ...definition.process.runtime, docker };
|
|
879
|
+
return definition.process;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
// src/index.ts
|
|
883
|
+
var manifest = {
|
|
884
|
+
/** @public */
|
|
885
|
+
id: "gitlab-repo-change",
|
|
886
|
+
/** @public */
|
|
887
|
+
version: "0.1.9",
|
|
888
|
+
/** @public */
|
|
889
|
+
requires: ["gitlab", "coding"]
|
|
890
|
+
};
|
|
891
|
+
function createGitLabRepoChange(options) {
|
|
892
|
+
if (typeof options.docker !== "boolean") throw new Error("docker must be a boolean");
|
|
893
|
+
const launcher = createGitLabRepoChangeLauncher();
|
|
894
|
+
const process = createGitLabRepoChangeProcess(launcher, options.docker);
|
|
895
|
+
const extension = {
|
|
896
|
+
manifest,
|
|
897
|
+
setupCatalog(api) {
|
|
898
|
+
api.registerProcess(process);
|
|
899
|
+
},
|
|
900
|
+
setupServer(api) {
|
|
901
|
+
const integration = api.require(gitlabIntegration);
|
|
902
|
+
if (Array.isArray(integration)) throw new Error("GitLab integration must be singular");
|
|
903
|
+
launcher.configure(integration);
|
|
904
|
+
api.onStop(() => launcher.configure(null));
|
|
905
|
+
}
|
|
906
|
+
};
|
|
907
|
+
return {
|
|
908
|
+
/** @public */
|
|
909
|
+
extension,
|
|
910
|
+
/** @public */
|
|
911
|
+
process,
|
|
912
|
+
/** @public */
|
|
913
|
+
launcher
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
var {
|
|
917
|
+
extension: defaultExtension,
|
|
918
|
+
process: gitlabRepoChangeProcess,
|
|
919
|
+
launcher: defaultGitLabRepoChangeLauncher
|
|
920
|
+
} = createGitLabRepoChange({ docker: true });
|
|
921
|
+
var index_default = defaultExtension;
|
|
922
|
+
export {
|
|
923
|
+
createGitLabRepoChange,
|
|
924
|
+
createGitLabRepoChangeLauncher,
|
|
925
|
+
createGitLabRepoChangeProcess,
|
|
926
|
+
index_default as default,
|
|
927
|
+
defaultExtension,
|
|
928
|
+
defaultGitLabRepoChangeLauncher,
|
|
929
|
+
gitlabPublicationEvidence,
|
|
930
|
+
gitlabRepoChangeParamsCodec,
|
|
931
|
+
gitlabRepoChangeProcess,
|
|
932
|
+
manifest
|
|
933
|
+
};
|
|
934
|
+
//# sourceMappingURL=index.js.map
|