@leitwerk-dev/coding 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/README.md +120 -2
  2. package/dist/auto-work-branch.js +3 -24
  3. package/dist/auto-work-branch.js.map +1 -1
  4. package/dist/chunk-6E5VQPC4.js +28 -0
  5. package/dist/chunk-6E5VQPC4.js.map +1 -0
  6. package/dist/chunk-ABQH2WZT.js +36 -0
  7. package/dist/chunk-ABQH2WZT.js.map +1 -0
  8. package/dist/{chunk-YSC5GEQJ.js → chunk-BI45R2FH.js} +7 -3
  9. package/dist/chunk-BI45R2FH.js.map +1 -0
  10. package/dist/chunk-DNG7D77K.js +65 -0
  11. package/dist/chunk-DNG7D77K.js.map +1 -0
  12. package/dist/chunk-KFELB7ZC.js +70 -0
  13. package/dist/chunk-KFELB7ZC.js.map +1 -0
  14. package/dist/chunk-L2TFD72B.js +16320 -0
  15. package/dist/chunk-L2TFD72B.js.map +1 -0
  16. package/dist/chunk-M2VTUPFO.js +265 -0
  17. package/dist/chunk-M2VTUPFO.js.map +1 -0
  18. package/dist/chunk-OM2AMDTJ.js +347 -0
  19. package/dist/chunk-OM2AMDTJ.js.map +1 -0
  20. package/dist/chunk-Q24RPXOA.js +159 -0
  21. package/dist/chunk-Q24RPXOA.js.map +1 -0
  22. package/dist/chunk-SKGB4CZS.js +14 -0
  23. package/dist/chunk-SKGB4CZS.js.map +1 -0
  24. package/dist/chunk-SZ4WOGV2.js +120 -0
  25. package/dist/chunk-SZ4WOGV2.js.map +1 -0
  26. package/dist/finalization-git-internal.d.ts +3 -0
  27. package/dist/finalization-git-internal.d.ts.map +1 -1
  28. package/dist/finalization-git.d.ts +1 -1
  29. package/dist/finalization-git.d.ts.map +1 -1
  30. package/dist/finalization-git.js +5 -3
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +17 -591
  34. package/dist/index.js.map +1 -1
  35. package/dist/profile-bindings-internal.d.ts +3 -0
  36. package/dist/profile-bindings-internal.d.ts.map +1 -0
  37. package/dist/pull-request-publication-internal.d.ts +75 -0
  38. package/dist/pull-request-publication-internal.d.ts.map +1 -0
  39. package/dist/repository-change-launch-internal-BudnAfL7.d.ts +88 -0
  40. package/dist/repository-change-launch-internal.d.ts +62 -11
  41. package/dist/repository-change-launch-internal.d.ts.map +1 -1
  42. package/dist/repository-change-launch.d.ts +5 -2
  43. package/dist/repository-change-launch.d.ts.map +1 -1
  44. package/dist/repository-change-launch.js +363 -6
  45. package/dist/repository-change-launch.js.map +1 -1
  46. package/dist/repository-change-process-DlgF04fU.d.ts +69 -0
  47. package/dist/repository-change-process.d.ts +30 -25
  48. package/dist/repository-change-process.d.ts.map +1 -1
  49. package/dist/repository-change-publication.d.ts +63 -7
  50. package/dist/repository-change-publication.d.ts.map +1 -1
  51. package/dist/repository-change-publication.js +732 -56
  52. package/dist/repository-change-publication.js.map +1 -1
  53. package/dist/repository-change-state-internal.d.ts +18 -4
  54. package/dist/repository-change-state-internal.d.ts.map +1 -1
  55. package/dist/repository-change-ui-launcher-internal.d.ts +65 -0
  56. package/dist/repository-change-ui-launcher-internal.d.ts.map +1 -0
  57. package/dist/repository-rebase/git.d.ts +31 -0
  58. package/dist/repository-rebase/git.d.ts.map +1 -0
  59. package/dist/repository-rebase/index.d.ts +42 -0
  60. package/dist/repository-rebase/index.d.ts.map +1 -0
  61. package/dist/repository-rebase/index.js +16 -0
  62. package/dist/repository-rebase/policy.d.ts +37 -0
  63. package/dist/repository-rebase/policy.d.ts.map +1 -0
  64. package/dist/repository-rebase/prompt.d.ts +3 -0
  65. package/dist/repository-rebase/prompt.d.ts.map +1 -0
  66. package/dist/settings.d.ts +15 -0
  67. package/dist/settings.d.ts.map +1 -0
  68. package/dist/turns/commit-message-evidence.d.ts +35 -0
  69. package/dist/turns/commit-message-evidence.d.ts.map +1 -0
  70. package/dist/turns/commit-message-evidence.js +9 -0
  71. package/dist/turns/generate-commit-message.d.ts +4 -1
  72. package/dist/turns/generate-commit-message.d.ts.map +1 -1
  73. package/dist/turns/generate-commit-message.js +7 -5
  74. package/dist/turns/generate-plan.d.ts.map +1 -1
  75. package/dist/turns/generate-plan.js +1 -1
  76. package/dist/turns/git-inspection-profile.d.ts +25 -0
  77. package/dist/turns/git-inspection-profile.d.ts.map +1 -0
  78. package/dist/turns/git-inspection-profile.js +8 -0
  79. package/dist/turns/git-inspection-profile.js.map +1 -0
  80. package/dist/turns/implement.d.ts.map +1 -1
  81. package/dist/turns/implement.js +1 -1
  82. package/dist/turns/simplify-implementation.d.ts +1 -1
  83. package/dist/turns/simplify-implementation.d.ts.map +1 -1
  84. package/dist/turns/simplify-implementation.js +3 -3
  85. package/package.json +10 -10
  86. package/src/finalization-git-internal.ts +117 -114
  87. package/src/finalization-git.ts +1 -1
  88. package/src/index.ts +4 -1
  89. package/src/profile-bindings-internal.ts +39 -0
  90. package/src/pull-request-publication-internal.ts +364 -0
  91. package/src/repository-change-launch-internal.ts +194 -11
  92. package/src/repository-change-launch.ts +13 -0
  93. package/src/repository-change-process.ts +234 -523
  94. package/src/repository-change-publication.ts +535 -156
  95. package/src/repository-change-state-internal.ts +34 -20
  96. package/src/repository-change-ui-launcher-internal.ts +308 -0
  97. package/src/repository-rebase/git.ts +219 -0
  98. package/src/repository-rebase/index.ts +144 -0
  99. package/src/repository-rebase/policy.ts +75 -0
  100. package/src/repository-rebase/prompt.ts +2 -0
  101. package/src/settings.ts +79 -0
  102. package/src/turns/commit-message-evidence.ts +241 -0
  103. package/src/turns/generate-commit-message.ts +53 -23
  104. package/src/turns/generate-plan.ts +26 -12
  105. package/src/turns/git-inspection-profile.ts +134 -0
  106. package/src/turns/implement.ts +9 -2
  107. package/src/turns/simplify-implementation.ts +10 -6
  108. package/dist/chunk-34B3Q75M.js +0 -25
  109. package/dist/chunk-34B3Q75M.js.map +0 -1
  110. package/dist/chunk-F6CEEAFE.js +0 -13
  111. package/dist/chunk-F6CEEAFE.js.map +0 -1
  112. package/dist/chunk-GO44KCUS.js +0 -154
  113. package/dist/chunk-GO44KCUS.js.map +0 -1
  114. package/dist/chunk-R3UCUGY6.js +0 -31
  115. package/dist/chunk-R3UCUGY6.js.map +0 -1
  116. package/dist/chunk-W7VJT6AN.js +0 -25
  117. package/dist/chunk-W7VJT6AN.js.map +0 -1
  118. package/dist/chunk-WKHVLLKE.js +0 -45
  119. package/dist/chunk-WKHVLLKE.js.map +0 -1
  120. package/dist/chunk-YSC5GEQJ.js.map +0 -1
  121. package/dist/turns/review-implementation.d.ts +0 -4
  122. package/dist/turns/review-implementation.d.ts.map +0 -1
  123. package/dist/turns/review-implementation.js +0 -8
  124. package/dist/turns/review-plan.d.ts +0 -4
  125. package/dist/turns/review-plan.d.ts.map +0 -1
  126. package/dist/turns/review-plan.js +0 -8
  127. package/src/turns/review-implementation.ts +0 -30
  128. package/src/turns/review-plan.ts +0 -24
  129. /package/dist/{turns/review-implementation.js.map → repository-rebase/index.js.map} +0 -0
  130. /package/dist/turns/{review-plan.js.map → commit-message-evidence.js.map} +0 -0
@@ -1,7 +1,126 @@
1
+ import {
2
+ buildAutoWorkBranchFromSeed
3
+ } from "./chunk-6E5VQPC4.js";
1
4
  import "./chunk-PX6F3LHL.js";
2
5
 
6
+ // src/profile-bindings-internal.ts
7
+ function record(value, label) {
8
+ if (!value || typeof value !== "object" || Array.isArray(value))
9
+ throw new Error(`${label} must be an object`);
10
+ return value;
11
+ }
12
+ function parseRepositoryProfileBindings(raw, extensionId, fields) {
13
+ const config = raw === void 0 ? {} : record(raw, `${extensionId} configuration`);
14
+ if (config.profile_bindings === void 0) return Object.freeze({});
15
+ const mappings = record(config.profile_bindings, "profile_bindings");
16
+ return Object.freeze(
17
+ Object.fromEntries(
18
+ Object.entries(mappings).map(([profile, value]) => {
19
+ if (!profile.trim() || profile.trim() !== profile)
20
+ throw new Error(
21
+ "profile_bindings keys must be non-empty profile names without surrounding whitespace"
22
+ );
23
+ const mapping = record(value, `profile_bindings.${profile}`);
24
+ for (const key of Object.keys(mapping))
25
+ if (!Object.values(fields).includes(key))
26
+ throw new Error(`Unknown profile_bindings.${profile}.${key}`);
27
+ const binding = Object.fromEntries(
28
+ Object.entries(fields).map(([field, key]) => {
29
+ const value2 = mapping[key];
30
+ if (value2 !== void 0 && (typeof value2 !== "string" || !value2.trim()))
31
+ throw new Error(`profile_bindings.${profile}.${key} must be a non-empty string`);
32
+ return [field, value2 === void 0 ? profile : value2.trim()];
33
+ })
34
+ );
35
+ return [profile, Object.freeze(binding)];
36
+ })
37
+ )
38
+ );
39
+ }
40
+
3
41
  // src/repository-change-launch-internal.ts
4
42
  import { parseRepoLocator, trimString } from "@leitwerk-dev/domain";
43
+ var repositoryChangeOptionFields = [
44
+ {
45
+ id: "skipPlanDecision",
46
+ label: "Skip plan approval",
47
+ kind: "boolean",
48
+ description: "Generate a plan, then implement and publish automatically."
49
+ },
50
+ {
51
+ id: "skipSimplification",
52
+ label: "Skip simplification",
53
+ kind: "boolean",
54
+ description: "Publish after implementation without the simplification pass."
55
+ }
56
+ ];
57
+ function repositoryChangeOptions(input) {
58
+ return {
59
+ skipPlanDecision: input.skipPlanDecision === true,
60
+ skipSimplification: input.skipSimplification === true
61
+ };
62
+ }
63
+ function repositoryChangeWorkflow(readLabels) {
64
+ return {
65
+ async planDecision(params) {
66
+ return {
67
+ skip: params.origin === "ui" && params.skipPlanDecision === true,
68
+ reason: "Launcher option"
69
+ };
70
+ },
71
+ async simplification(params) {
72
+ return params.origin === "ui" ? { skip: params.skipSimplification === true, reason: "Launcher option" } : {
73
+ skip: (await readLabels(params)).includes("leitwerk-skip-simplification"),
74
+ reason: "Source labels"
75
+ };
76
+ }
77
+ };
78
+ }
79
+ function repositoryIssueChangeLaunchConfig(provider, params, title, repository, metadata, source) {
80
+ const issue = params.origin === "issue";
81
+ const settingsRepository = source?.id !== void 0 ? {
82
+ origin: new URL(source.html_url).origin,
83
+ repositoryId: source.id,
84
+ aliases: [source.ssh_url, ...source.clone_url ? [source.clone_url] : []]
85
+ } : void 0;
86
+ return {
87
+ processId: `${provider}_repo_change_process`,
88
+ params,
89
+ title,
90
+ startTurnId: "generate_plan",
91
+ ...issue ? {
92
+ externalId: `${provider}:${repository}#${params.issueNumber}`,
93
+ externalUrl: params.issueUrl
94
+ } : {},
95
+ projects: [
96
+ {
97
+ key: "repo",
98
+ repoLocator: params.repoLocator,
99
+ ...settingsRepository ? { settingsRepository } : {},
100
+ baseBranch: params.baseBranch,
101
+ workBranch: params.workBranch,
102
+ ...issue ? { externalId: String(params.issueNumber), externalUrl: params.issueUrl } : {},
103
+ metadata
104
+ }
105
+ ]
106
+ };
107
+ }
108
+ function normalizeRepositoryIssueOrigin(record2, displayName, text) {
109
+ const origin = trimString(record2.origin);
110
+ if (origin === "ui") {
111
+ return { origin: "ui", issueNumber: null, issueUrl: null, triggerLabel: null, doneLabel: null };
112
+ }
113
+ if (origin && origin !== "issue") throw new Error(`${displayName} requires a valid origin`);
114
+ if (typeof record2.issueNumber !== "number" || !Number.isInteger(record2.issueNumber) || record2.issueNumber <= 0)
115
+ throw new Error(`${displayName} requires issueNumber`);
116
+ return {
117
+ origin: "issue",
118
+ issueNumber: record2.issueNumber,
119
+ issueUrl: text("issueUrl"),
120
+ triggerLabel: text("triggerLabel"),
121
+ doneLabel: text("doneLabel")
122
+ };
123
+ }
5
124
  function repositoryChangeParamsRecord(value, displayName) {
6
125
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
7
126
  throw new Error(`${displayName} params must be an object`);
@@ -9,21 +128,259 @@ function repositoryChangeParamsRecord(value, displayName) {
9
128
  return value;
10
129
  }
11
130
  function normalizeRepositoryChangeParamsInput(value, displayName) {
12
- const record = repositoryChangeParamsRecord(value, displayName);
13
- const rawRepoLocator = trimString(record.repoLocator);
131
+ const record2 = repositoryChangeParamsRecord(value, displayName);
132
+ const rawRepoLocator = trimString(record2.repoLocator);
14
133
  return {
134
+ ...repositoryChangeOptions(record2),
15
135
  repoLocator: parseRepoLocator(rawRepoLocator)?.value ?? rawRepoLocator,
16
- baseBranch: trimString(record.baseBranch) || "main",
17
- workBranch: trimString(record.workBranch),
18
- prompt: trimString(record.prompt)
136
+ baseBranch: trimString(record2.baseBranch) || "main",
137
+ workBranch: trimString(record2.workBranch),
138
+ prompt: trimString(record2.prompt)
139
+ };
140
+ }
141
+ function normalizeRepositoryIssueChangeParams(value, displayName, fields) {
142
+ const shared = normalizeRepositoryChangeParamsInput(value, displayName);
143
+ const record2 = repositoryChangeParamsRecord(value, displayName);
144
+ const text = (name) => {
145
+ const value2 = trimString(record2[name]);
146
+ if (!value2) throw new Error(`${displayName} requires ${name}`);
147
+ return value2;
148
+ };
149
+ return {
150
+ ...shared,
151
+ ...Object.fromEntries(fields.map((name) => [name, text(name)])),
152
+ ...normalizeRepositoryIssueOrigin(record2, displayName, text)
19
153
  };
20
154
  }
21
155
  function createRepositoryChangeParamsCodec(input) {
22
156
  return { parse: input.normalize, serialize: (value) => value };
23
157
  }
158
+
159
+ // src/repository-change-ui-launcher-internal.ts
160
+ import { trimString as trimString2 } from "@leitwerk-dev/domain";
161
+ import {
162
+ SafeLaunchPreparationError
163
+ } from "@leitwerk-dev/process-sdk";
164
+ function createRepositoryChangeLauncher(options) {
165
+ const { provider, providerId } = options;
166
+ const profileField = `${providerId}Profile`;
167
+ let dependencies = null;
168
+ function requireDependencies() {
169
+ if (!dependencies) throw new Error(`${provider} repository launcher is not configured`);
170
+ return dependencies;
171
+ }
172
+ const integration = () => options.integration(requireDependencies());
173
+ const profiles = () => integration().profiles?.() ?? [];
174
+ async function repositories(profile) {
175
+ return profile && profiles().includes(profile) ? integration().client(profile).listRepositories() : [];
176
+ }
177
+ function resolveProfiles(profile) {
178
+ if (!profiles().includes(profile)) throw new Error(`${provider} profile is not available`);
179
+ return options.resolveProfiles(profile, requireDependencies());
180
+ }
181
+ async function resolveGitIdentity(profile) {
182
+ if (!profile) throw new Error(`A ${provider} profile is required to resolve Git identity`);
183
+ return integration().client(profile).resolveGitIdentity(profile);
184
+ }
185
+ function preparationChecks(_input, { params }) {
186
+ return [
187
+ {
188
+ id: "repository_visibility",
189
+ label: "Check repository visibility",
190
+ async run({ signal }) {
191
+ signal.throwIfAborted();
192
+ const visible = (await repositories(options.profile(params))).some(
193
+ (candidate) => candidate.full_name === `${params.owner}/${params.repo}`
194
+ );
195
+ signal.throwIfAborted();
196
+ if (!visible)
197
+ throw new SafeLaunchPreparationError(
198
+ "Repository is not visible",
199
+ `Grant the selected ${provider} profile access to the repository, then try again.`
200
+ );
201
+ }
202
+ },
203
+ ...options.preparationChecks(params, requireDependencies)
204
+ ];
205
+ }
206
+ function validationError(fieldId, message, code = "required") {
207
+ return { code, fieldId, message };
208
+ }
209
+ const launcher = {
210
+ async resolveIssueLaunchConfig({ profile, repository, issue, labels }) {
211
+ const title = issue.title.trim();
212
+ const body = issue.body?.trim() ?? "";
213
+ const binding = resolveProfiles(profile);
214
+ const identity = await resolveGitIdentity(profile);
215
+ return options.launchConfig(
216
+ {
217
+ ...options.params(repository, {
218
+ ...binding,
219
+ profile,
220
+ workBranch: `leitwerk/issue-${issue.number}`,
221
+ prompt: `${title}${body ? `
222
+
223
+ ${body}` : ""}`
224
+ }),
225
+ origin: "issue",
226
+ issueNumber: issue.number,
227
+ issueUrl: issue.html_url,
228
+ triggerLabel: labels.trigger,
229
+ doneLabel: labels.done
230
+ },
231
+ title,
232
+ identity,
233
+ repository
234
+ );
235
+ },
236
+ id: options.id,
237
+ label: `${provider} Repo Change`,
238
+ description: `Plan, implement, review, and publish a ${provider} change without a source issue`,
239
+ visibility: "ui",
240
+ ui: {
241
+ card: {
242
+ title: `${provider} Repo Change`,
243
+ description: `Start a repository change and publish it as a ${provider} pull request.`
244
+ },
245
+ launchConfigSchema: {
246
+ id: `${providerId}_repo_change_form`,
247
+ title: `${provider} Repo Change`,
248
+ fields: [
249
+ ...repositoryChangeOptionFields,
250
+ {
251
+ id: profileField,
252
+ label: `${provider} profile`,
253
+ kind: "select",
254
+ required: true,
255
+ description: `${provider} profile with server-configured CI and Git SSH access.`
256
+ },
257
+ {
258
+ id: "repository",
259
+ label: "Repository",
260
+ kind: "select",
261
+ required: true,
262
+ description: `Repository visible to the selected ${provider} profile.`
263
+ },
264
+ {
265
+ id: "prompt",
266
+ label: "Requested change",
267
+ kind: "textarea",
268
+ required: true,
269
+ placeholder: "Describe the change to plan, implement, review, and publish."
270
+ }
271
+ ],
272
+ submitLabel: "Start change"
273
+ },
274
+ resolveDefaults() {
275
+ return {
276
+ [profileField]: profiles()[0] ?? "",
277
+ repository: "",
278
+ prompt: "",
279
+ ...repositoryChangeOptions({})
280
+ };
281
+ },
282
+ async resolveOptions(input) {
283
+ const profile = trimString2(input[profileField]);
284
+ return {
285
+ [profileField]: profiles().map((value) => ({ value, label: value })),
286
+ repository: (await repositories(profile)).map((repository) => ({
287
+ value: repository.full_name,
288
+ label: repository.full_name,
289
+ description: repository.html_url
290
+ }))
291
+ };
292
+ },
293
+ preparationChecks,
294
+ resolveRelaunchInput(input) {
295
+ return {
296
+ ...repositoryChangeOptions(input),
297
+ [profileField]: trimString2(input[profileField]),
298
+ repository: trimString2(input.repository),
299
+ prompt: trimString2(input.prompt)
300
+ };
301
+ },
302
+ async resolveLaunchConfig(input) {
303
+ const profile = trimString2(input[profileField]);
304
+ const repositoryName = trimString2(input.repository);
305
+ const prompt = trimString2(input.prompt);
306
+ const errors = [];
307
+ const invalid = (fieldId, message) => ({
308
+ ok: false,
309
+ errors: [validationError(fieldId, message, "custom_rule")]
310
+ });
311
+ requireDependencies();
312
+ if (!profile) errors.push(validationError(profileField, `${provider} profile is required`));
313
+ else if (!profiles().includes(profile))
314
+ errors.push(
315
+ validationError(profileField, `${provider} profile is not available`, "custom_rule")
316
+ );
317
+ if (!repositoryName) errors.push(validationError("repository", "Repository is required"));
318
+ if (!prompt) errors.push(validationError("prompt", "Requested change is required"));
319
+ if (errors.length > 0) return { ok: false, errors };
320
+ const repository = (await repositories(profile)).find(
321
+ (candidate) => candidate.full_name === repositoryName
322
+ );
323
+ if (!repository)
324
+ return invalid(
325
+ "repository",
326
+ `Repository is not available to the selected ${provider} profile`
327
+ );
328
+ let binding;
329
+ try {
330
+ binding = resolveProfiles(profile);
331
+ } catch (error) {
332
+ return invalid(profileField, error.message);
333
+ }
334
+ const identity = await resolveGitIdentity(profile);
335
+ const workBranch = buildAutoWorkBranchFromSeed(
336
+ prompt,
337
+ `${repository.ssh_url}:${repository.default_branch}`
338
+ );
339
+ const params = {
340
+ ...options.params(repository, { ...binding, profile, prompt, workBranch }),
341
+ ...repositoryChangeOptions(input)
342
+ };
343
+ return {
344
+ ok: true,
345
+ launchConfig: options.launchConfig(params, prompt, identity, repository)
346
+ };
347
+ }
348
+ }
349
+ };
350
+ return {
351
+ /** @internal */
352
+ configure(value) {
353
+ dependencies = value;
354
+ },
355
+ /** @internal */
356
+ preparationChecks,
357
+ /** @internal */
358
+ resolveProfiles,
359
+ /** @internal */
360
+ resolveGitIdentity,
361
+ /** @internal */
362
+ launcher,
363
+ /** @internal */
364
+ workflow: repositoryChangeWorkflow(async (params) => {
365
+ if (params.origin !== "issue") throw new Error(`Missing ${provider} source issue`);
366
+ const issue = await integration().client(options.profile(params)).getIssue(params.owner, params.repo, params.issueNumber);
367
+ if (issue.html_url !== params.issueUrl)
368
+ throw new Error(`${provider} source issue installation changed`);
369
+ return issue.labels.map((label) => label.name);
370
+ })
371
+ };
372
+ }
24
373
  export {
374
+ createRepositoryChangeLauncher,
25
375
  createRepositoryChangeParamsCodec,
26
376
  normalizeRepositoryChangeParamsInput,
27
- repositoryChangeParamsRecord
377
+ normalizeRepositoryIssueChangeParams,
378
+ normalizeRepositoryIssueOrigin,
379
+ parseRepositoryProfileBindings,
380
+ repositoryChangeOptionFields,
381
+ repositoryChangeOptions,
382
+ repositoryChangeParamsRecord,
383
+ repositoryChangeWorkflow,
384
+ repositoryIssueChangeLaunchConfig
28
385
  };
29
386
  //# sourceMappingURL=repository-change-launch.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/repository-change-launch-internal.ts"],"sourcesContent":["import { parseRepoLocator, trimString } from \"@leitwerk-dev/domain\";\nimport type { Codec } from \"@leitwerk-dev/process-sdk\";\n\n/** @public */\nexport interface RepositoryChangeParamsBase {\n\t/** @public */\n\trepoLocator: string;\n\t/** @public */\n\tbaseBranch: string;\n\t/** @public */\n\tworkBranch: string;\n\t/** @public */\n\tprompt: string;\n}\n\n/** @public */\nexport type RepositoryChangeLaunchParams<TExtra extends object = Record<never, never>> = TExtra &\n\tRepositoryChangeParamsBase;\n\n/** @public */\nexport interface NormalizedRepositoryChangeParamsInput {\n\t/** @internal */\n\trepoLocator: string;\n\t/** @internal */\n\tbaseBranch: string;\n\t/** @internal */\n\tworkBranch: string;\n\t/** @internal */\n\tprompt: string;\n}\n\n/** @public */\nexport function repositoryChangeParamsRecord(\n\tvalue: unknown,\n\tdisplayName: string,\n): Record<string, unknown> {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n\t\tthrow new Error(`${displayName} params must be an object`);\n\t}\n\treturn value as Record<string, unknown>;\n}\n\n/** @public */\nexport function normalizeRepositoryChangeParamsInput(\n\tvalue: unknown,\n\tdisplayName: string,\n): NormalizedRepositoryChangeParamsInput {\n\tconst record = repositoryChangeParamsRecord(value, displayName);\n\tconst rawRepoLocator = trimString(record.repoLocator);\n\treturn {\n\t\trepoLocator: parseRepoLocator(rawRepoLocator)?.value ?? rawRepoLocator,\n\t\tbaseBranch: trimString(record.baseBranch) || \"main\",\n\t\tworkBranch: trimString(record.workBranch),\n\t\tprompt: trimString(record.prompt),\n\t};\n}\n\n/** @public */\nexport function createRepositoryChangeParamsCodec<T extends RepositoryChangeParamsBase>(input: {\n\t/** @public */\n\tnormalize(value: unknown): T;\n}): Codec<T> {\n\treturn { parse: input.normalize, serialize: (value) => value };\n}\n"],"mappings":";;;AAAA,SAAS,kBAAkB,kBAAkB;AAgCtC,SAAS,6BACf,OACA,aAC0B;AAC1B,MAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GAAG;AACxE,UAAM,IAAI,MAAM,GAAG,WAAW,2BAA2B;AAAA,EAC1D;AACA,SAAO;AACR;AAGO,SAAS,qCACf,OACA,aACwC;AACxC,QAAM,SAAS,6BAA6B,OAAO,WAAW;AAC9D,QAAM,iBAAiB,WAAW,OAAO,WAAW;AACpD,SAAO;AAAA,IACN,aAAa,iBAAiB,cAAc,GAAG,SAAS;AAAA,IACxD,YAAY,WAAW,OAAO,UAAU,KAAK;AAAA,IAC7C,YAAY,WAAW,OAAO,UAAU;AAAA,IACxC,QAAQ,WAAW,OAAO,MAAM;AAAA,EACjC;AACD;AAGO,SAAS,kCAAwE,OAG3E;AACZ,SAAO,EAAE,OAAO,MAAM,WAAW,WAAW,CAAC,UAAU,MAAM;AAC9D;","names":[]}
1
+ {"version":3,"sources":["../src/profile-bindings-internal.ts","../src/repository-change-launch-internal.ts","../src/repository-change-ui-launcher-internal.ts"],"sourcesContent":["function record(value: unknown, label: string): Record<string, unknown> {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value))\n\t\tthrow new Error(`${label} must be an object`);\n\treturn value as Record<string, unknown>;\n}\n\n/** Strict profile wiring shared by repository-change extensions. @internal */\nexport function parseRepositoryProfileBindings<K extends string>(\n\traw: unknown,\n\textensionId: string,\n\tfields: Record<K, string>,\n): Readonly<Record<string, Readonly<Record<K, string>>>> {\n\tconst config = raw === undefined ? {} : record(raw, `${extensionId} configuration`);\n\tif (config.profile_bindings === undefined) return Object.freeze({});\n\tconst mappings = record(config.profile_bindings, \"profile_bindings\");\n\treturn Object.freeze(\n\t\tObject.fromEntries(\n\t\t\tObject.entries(mappings).map(([profile, value]) => {\n\t\t\t\tif (!profile.trim() || profile.trim() !== profile)\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\"profile_bindings keys must be non-empty profile names without surrounding whitespace\",\n\t\t\t\t\t);\n\t\t\t\tconst mapping = record(value, `profile_bindings.${profile}`);\n\t\t\t\tfor (const key of Object.keys(mapping))\n\t\t\t\t\tif (!Object.values(fields).includes(key))\n\t\t\t\t\t\tthrow new Error(`Unknown profile_bindings.${profile}.${key}`);\n\t\t\t\tconst binding = Object.fromEntries(\n\t\t\t\t\tObject.entries<string>(fields).map(([field, key]) => {\n\t\t\t\t\t\tconst value = mapping[key];\n\t\t\t\t\t\tif (value !== undefined && (typeof value !== \"string\" || !value.trim()))\n\t\t\t\t\t\t\tthrow new Error(`profile_bindings.${profile}.${key} must be a non-empty string`);\n\t\t\t\t\t\treturn [field, value === undefined ? profile : (value as string).trim()];\n\t\t\t\t\t}),\n\t\t\t\t) as Record<K, string>;\n\t\t\t\treturn [profile, Object.freeze(binding)];\n\t\t\t}),\n\t\t),\n\t);\n}\n","import { parseRepoLocator, trimString } from \"@leitwerk-dev/domain\";\nimport type { Codec, FormDefinition, ProcessLaunchConfig } from \"@leitwerk-dev/process-sdk\";\nimport type { RepositoryChangeWorkflow } from \"./repository-change-process.js\";\n\n/** @public */\nexport interface RepositoryChangeOptions {\n\t/** @public */\n\tskipPlanDecision?: boolean;\n\t/** @public */\n\tskipSimplification?: boolean;\n}\n\n/** @internal */\nexport const repositoryChangeOptionFields: FormDefinition[\"fields\"] = [\n\t{\n\t\tid: \"skipPlanDecision\",\n\t\tlabel: \"Skip plan approval\",\n\t\tkind: \"boolean\",\n\t\tdescription: \"Generate a plan, then implement and publish automatically.\",\n\t},\n\t{\n\t\tid: \"skipSimplification\",\n\t\tlabel: \"Skip simplification\",\n\t\tkind: \"boolean\",\n\t\tdescription: \"Publish after implementation without the simplification pass.\",\n\t},\n];\n\n/** @internal */\nexport function repositoryChangeOptions(input: RepositoryChangeOptions): RepositoryChangeOptions {\n\treturn {\n\t\tskipPlanDecision: input.skipPlanDecision === true,\n\t\tskipSimplification: input.skipSimplification === true,\n\t};\n}\n\n/** Provider label reads happen only at the implementation route boundary. @internal */\nexport function repositoryChangeWorkflow<\n\tP extends RepositoryChangeOptions & {\n\t\t/** @internal */\n\t\torigin: string;\n\t},\n>(readLabels: (params: P) => Promise<readonly string[]>): RepositoryChangeWorkflow<P> {\n\treturn {\n\t\tasync planDecision(params) {\n\t\t\treturn {\n\t\t\t\tskip: params.origin === \"ui\" && params.skipPlanDecision === true,\n\t\t\t\treason: \"Launcher option\",\n\t\t\t};\n\t\t},\n\t\tasync simplification(params) {\n\t\t\treturn params.origin === \"ui\"\n\t\t\t\t? { skip: params.skipSimplification === true, reason: \"Launcher option\" }\n\t\t\t\t: {\n\t\t\t\t\t\tskip: (await readLabels(params)).includes(\"leitwerk-skip-simplification\"),\n\t\t\t\t\t\treason: \"Source labels\",\n\t\t\t\t\t};\n\t\t},\n\t};\n}\n\n/** @public */\nexport interface RepositoryChangeParamsBase extends RepositoryChangeOptions {\n\t/** @public */\n\trepoLocator: string;\n\t/** @public */\n\tbaseBranch: string;\n\t/** @public */\n\tworkBranch: string;\n\t/** @public */\n\tprompt: string;\n}\n\n/** @public */\nexport type RepositoryChangeLaunchParams<TExtra extends object = Record<never, never>> = TExtra &\n\tRepositoryChangeParamsBase;\n\n/** Shared source metadata; provider-specific interfaces retain their exported names. @public */\nexport interface RepositoryIssueOriginParams {\n\t/** @public */\n\torigin: \"issue\";\n\t/** @public */\n\tissueNumber: number;\n\t/** @public */\n\tissueUrl: string;\n\t/** @public */\n\ttriggerLabel: string;\n\t/** @public */\n\tdoneLabel: string;\n}\n\n/** @public */\nexport interface RepositoryUiOriginParams {\n\t/** @public */\n\torigin: \"ui\";\n\t/** @public */\n\tissueNumber: null;\n\t/** @public */\n\tissueUrl: null;\n\t/** @public */\n\ttriggerLabel: null;\n\t/** @public */\n\tdoneLabel: null;\n}\n\n/** Input shared by SSH-backed pull-request launchers. @public */\nexport interface PullRequestChangeLaunchInput\n\textends Pick<RepositoryChangeParamsBase, \"prompt\" | \"workBranch\"> {\n\t/** @public */ profile: string;\n\t/** @public */ sshCredentialRef: string;\n}\n\n/** Shared launch envelope; providers retain ownership of project metadata. @internal */\nexport function repositoryIssueChangeLaunchConfig<\n\tP extends RepositoryChangeParamsBase & (RepositoryIssueOriginParams | RepositoryUiOriginParams),\n>(\n\tprovider: string,\n\tparams: P,\n\ttitle: string,\n\trepository: string,\n\tmetadata: Record<string, unknown>,\n\tsource?: {\n\t\t/** @internal */ id?: number;\n\t\t/** @internal */ html_url: string;\n\t\t/** @internal */ ssh_url: string;\n\t\t/** @internal */ clone_url?: string;\n\t},\n): ProcessLaunchConfig<P> {\n\tconst issue = params.origin === \"issue\";\n\tconst settingsRepository =\n\t\tsource?.id !== undefined\n\t\t\t? {\n\t\t\t\t\torigin: new URL(source.html_url).origin,\n\t\t\t\t\trepositoryId: source.id,\n\t\t\t\t\taliases: [source.ssh_url, ...(source.clone_url ? [source.clone_url] : [])],\n\t\t\t\t}\n\t\t\t: undefined;\n\treturn {\n\t\tprocessId: `${provider}_repo_change_process`,\n\t\tparams,\n\t\ttitle,\n\t\tstartTurnId: \"generate_plan\",\n\t\t...(issue\n\t\t\t? {\n\t\t\t\t\texternalId: `${provider}:${repository}#${params.issueNumber}`,\n\t\t\t\t\texternalUrl: params.issueUrl,\n\t\t\t\t}\n\t\t\t: {}),\n\t\tprojects: [\n\t\t\t{\n\t\t\t\tkey: \"repo\",\n\t\t\t\trepoLocator: params.repoLocator,\n\t\t\t\t...(settingsRepository ? { settingsRepository } : {}),\n\t\t\t\tbaseBranch: params.baseBranch,\n\t\t\t\tworkBranch: params.workBranch,\n\t\t\t\t...(issue ? { externalId: String(params.issueNumber), externalUrl: params.issueUrl } : {}),\n\t\t\t\tmetadata,\n\t\t\t},\n\t\t],\n\t};\n}\n\n/** GitHub/Forgejo legacy origins default to issue; other providers may be stricter. @internal */\nexport function normalizeRepositoryIssueOrigin(\n\trecord: Record<string, unknown>,\n\tdisplayName: string,\n\ttext: (name: string) => string,\n): RepositoryIssueOriginParams | RepositoryUiOriginParams {\n\tconst origin = trimString(record.origin);\n\tif (origin === \"ui\") {\n\t\treturn { origin: \"ui\", issueNumber: null, issueUrl: null, triggerLabel: null, doneLabel: null };\n\t}\n\tif (origin && origin !== \"issue\") throw new Error(`${displayName} requires a valid origin`);\n\tif (\n\t\ttypeof record.issueNumber !== \"number\" ||\n\t\t!Number.isInteger(record.issueNumber) ||\n\t\trecord.issueNumber <= 0\n\t)\n\t\tthrow new Error(`${displayName} requires issueNumber`);\n\treturn {\n\t\torigin: \"issue\",\n\t\tissueNumber: record.issueNumber,\n\t\tissueUrl: text(\"issueUrl\"),\n\t\ttriggerLabel: text(\"triggerLabel\"),\n\t\tdoneLabel: text(\"doneLabel\"),\n\t};\n}\n\n/** @public */\nexport interface NormalizedRepositoryChangeParamsInput extends RepositoryChangeParamsBase {}\n\n/** @public */\nexport function repositoryChangeParamsRecord(\n\tvalue: unknown,\n\tdisplayName: string,\n): Record<string, unknown> {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n\t\tthrow new Error(`${displayName} params must be an object`);\n\t}\n\treturn value as Record<string, unknown>;\n}\n\n/** @public */\nexport function normalizeRepositoryChangeParamsInput(\n\tvalue: unknown,\n\tdisplayName: string,\n): NormalizedRepositoryChangeParamsInput {\n\tconst record = repositoryChangeParamsRecord(value, displayName);\n\tconst rawRepoLocator = trimString(record.repoLocator);\n\treturn {\n\t\t...repositoryChangeOptions(record),\n\t\trepoLocator: parseRepoLocator(rawRepoLocator)?.value ?? rawRepoLocator,\n\t\tbaseBranch: trimString(record.baseBranch) || \"main\",\n\t\tworkBranch: trimString(record.workBranch),\n\t\tprompt: trimString(record.prompt),\n\t};\n}\n\n/** Normalize issue-capable repository params with provider-owned required text fields. @internal */\nexport function normalizeRepositoryIssueChangeParams<K extends string>(\n\tvalue: unknown,\n\tdisplayName: string,\n\tfields: readonly K[],\n): NormalizedRepositoryChangeParamsInput &\n\tRecord<K, string> &\n\t(RepositoryIssueOriginParams | RepositoryUiOriginParams) {\n\tconst shared = normalizeRepositoryChangeParamsInput(value, displayName);\n\tconst record = repositoryChangeParamsRecord(value, displayName);\n\tconst text = (name: string) => {\n\t\tconst value = trimString(record[name]);\n\t\tif (!value) throw new Error(`${displayName} requires ${name}`);\n\t\treturn value;\n\t};\n\treturn {\n\t\t...shared,\n\t\t...(Object.fromEntries(fields.map((name) => [name, text(name)])) as Record<K, string>),\n\t\t...normalizeRepositoryIssueOrigin(record, displayName, text),\n\t};\n}\n\n/** @public */\nexport function createRepositoryChangeParamsCodec<T extends RepositoryChangeParamsBase>(input: {\n\t/** @public */\n\tnormalize(value: unknown): T;\n}): Codec<T> {\n\treturn { parse: input.normalize, serialize: (value) => value };\n}\n","import { trimString } from \"@leitwerk-dev/domain\";\nimport {\n\ttype LauncherValidationError,\n\ttype LaunchPreparationCheck,\n\ttype ProcessLaunchConfig,\n\ttype ProcessLauncherDefinition,\n\ttype RepositoryIssue,\n\ttype RepositoryIssueWatcherConfig,\n\tSafeLaunchPreparationError,\n} from \"@leitwerk-dev/process-sdk\";\nimport { buildAutoWorkBranchFromSeed } from \"./auto-work-branch.js\";\nimport {\n\ttype RepositoryChangeLaunchParams,\n\ttype RepositoryIssueOriginParams,\n\ttype RepositoryUiOriginParams,\n\trepositoryChangeOptionFields,\n\trepositoryChangeOptions,\n\trepositoryChangeWorkflow,\n} from \"./repository-change-launch-internal.js\";\n\n/** Shared launch mechanics; providers retain credentials, preparation and launch metadata. @internal */\nexport function createRepositoryChangeLauncher<\n\tP extends RepositoryChangeLaunchParams<{\n\t\t/** @internal */ owner: string;\n\t\t/** @internal */ repo: string;\n\t}> &\n\t\t(RepositoryIssueOriginParams | RepositoryUiOriginParams),\n\tD,\n\tR extends {\n\t\t/** @internal */\n\t\tfull_name: string;\n\t\t/** @internal */\n\t\thtml_url: string;\n\t\t/** @internal */\n\t\tssh_url: string;\n\t\t/** @internal */\n\t\tdefault_branch: string;\n\t},\n\tB,\n\tI,\n>(options: {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tprovider: string;\n\t/** @internal */\n\tproviderId: string;\n\t/** @internal */\n\tintegration(dependencies: D): {\n\t\t/** @internal */ profiles?(): readonly string[];\n\t\t/** @internal */ client(profile: string): {\n\t\t\t/** @internal */ listRepositories(): Promise<readonly R[]>;\n\t\t\t/** @internal */ resolveGitIdentity(profile: string): Promise<I>;\n\t\t\t/** @internal */ getIssue(\n\t\t\t\towner: string,\n\t\t\t\trepo: string,\n\t\t\t\tnumber: number,\n\t\t\t): Promise<Pick<RepositoryIssue, \"html_url\" | \"labels\">>;\n\t\t};\n\t};\n\t/** @internal */\n\tprofile(params: P): string;\n\t/** @internal */\n\tresolveProfiles(profile: string, dependencies: D): B;\n\t/** @internal */\n\tparams(\n\t\trepository: R,\n\t\tinput: B & {\n\t\t\t/** @internal */\n\t\t\tprofile: string;\n\t\t\t/** @internal */\n\t\t\tprompt: string;\n\t\t\t/** @internal */\n\t\t\tworkBranch: string;\n\t\t},\n\t): P;\n\t/** @internal */\n\tlaunchConfig(\n\t\tparams: P,\n\t\ttitle: string,\n\t\tidentity: I,\n\t\trepository: NoInfer<R>,\n\t): ProcessLaunchConfig<P>;\n\t/** @internal */\n\tpreparationChecks(params: P, dependencies: () => D): readonly LaunchPreparationCheck<P>[];\n}) {\n\tconst { provider, providerId } = options;\n\tconst profileField = `${providerId}Profile`;\n\tlet dependencies: D | null = null;\n\tfunction requireDependencies(): D {\n\t\tif (!dependencies) throw new Error(`${provider} repository launcher is not configured`);\n\t\treturn dependencies;\n\t}\n\tconst integration = () => options.integration(requireDependencies());\n\tconst profiles = () => integration().profiles?.() ?? [];\n\tasync function repositories(profile: string): Promise<readonly R[]> {\n\t\treturn profile && profiles().includes(profile)\n\t\t\t? integration().client(profile).listRepositories()\n\t\t\t: [];\n\t}\n\t/** @internal */\n\tfunction resolveProfiles(profile: string) {\n\t\tif (!profiles().includes(profile)) throw new Error(`${provider} profile is not available`);\n\t\treturn options.resolveProfiles(profile, requireDependencies());\n\t}\n\t/** @internal */\n\tasync function resolveGitIdentity(profile: string): Promise<I> {\n\t\tif (!profile) throw new Error(`A ${provider} profile is required to resolve Git identity`);\n\t\treturn integration().client(profile).resolveGitIdentity(profile);\n\t}\n\t/** @internal */\n\tfunction preparationChecks(\n\t\t_input: unknown,\n\t\t{ params }: ProcessLaunchConfig<P>,\n\t): LaunchPreparationCheck<P>[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tid: \"repository_visibility\",\n\t\t\t\tlabel: \"Check repository visibility\",\n\t\t\t\tasync run({ signal }) {\n\t\t\t\t\tsignal.throwIfAborted();\n\t\t\t\t\tconst visible = (await repositories(options.profile(params))).some(\n\t\t\t\t\t\t(candidate) => candidate.full_name === `${params.owner}/${params.repo}`,\n\t\t\t\t\t);\n\t\t\t\t\tsignal.throwIfAborted();\n\t\t\t\t\tif (!visible)\n\t\t\t\t\t\tthrow new SafeLaunchPreparationError(\n\t\t\t\t\t\t\t\"Repository is not visible\",\n\t\t\t\t\t\t\t`Grant the selected ${provider} profile access to the repository, then try again.`,\n\t\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t},\n\t\t\t...options.preparationChecks(params, requireDependencies),\n\t\t];\n\t}\n\tfunction validationError(\n\t\tfieldId: string,\n\t\tmessage: string,\n\t\tcode: LauncherValidationError[\"code\"] = \"required\",\n\t): LauncherValidationError {\n\t\treturn { code, fieldId, message };\n\t}\n\tconst launcher: ProcessLauncherDefinition<P> & {\n\t\t/** @internal */\n\t\tresolveIssueLaunchConfig(event: {\n\t\t\t/** @internal */ profile: string;\n\t\t\t/** @internal */ repository: R;\n\t\t\t/** @internal */ issue: Pick<RepositoryIssue, \"number\" | \"title\" | \"body\" | \"html_url\">;\n\t\t\t/** @internal */ labels: RepositoryIssueWatcherConfig[\"labels\"];\n\t\t}): Promise<ProcessLaunchConfig<P>>;\n\t} = {\n\t\tasync resolveIssueLaunchConfig({ profile, repository, issue, labels }) {\n\t\t\tconst title = issue.title.trim();\n\t\t\tconst body = issue.body?.trim() ?? \"\";\n\t\t\tconst binding = resolveProfiles(profile);\n\t\t\tconst identity = await resolveGitIdentity(profile);\n\t\t\treturn options.launchConfig(\n\t\t\t\t{\n\t\t\t\t\t...options.params(repository, {\n\t\t\t\t\t\t...binding,\n\t\t\t\t\t\tprofile,\n\t\t\t\t\t\tworkBranch: `leitwerk/issue-${issue.number}`,\n\t\t\t\t\t\tprompt: `${title}${body ? `\\n\\n${body}` : \"\"}`,\n\t\t\t\t\t}),\n\t\t\t\t\torigin: \"issue\",\n\t\t\t\t\tissueNumber: issue.number,\n\t\t\t\t\tissueUrl: issue.html_url,\n\t\t\t\t\ttriggerLabel: labels.trigger,\n\t\t\t\t\tdoneLabel: labels.done,\n\t\t\t\t},\n\t\t\t\ttitle,\n\t\t\t\tidentity,\n\t\t\t\trepository,\n\t\t\t);\n\t\t},\n\t\tid: options.id,\n\t\tlabel: `${provider} Repo Change`,\n\t\tdescription: `Plan, implement, review, and publish a ${provider} change without a source issue`,\n\t\tvisibility: \"ui\",\n\t\tui: {\n\t\t\tcard: {\n\t\t\t\ttitle: `${provider} Repo Change`,\n\t\t\t\tdescription: `Start a repository change and publish it as a ${provider} pull request.`,\n\t\t\t},\n\t\t\tlaunchConfigSchema: {\n\t\t\t\tid: `${providerId}_repo_change_form`,\n\t\t\t\ttitle: `${provider} Repo Change`,\n\t\t\t\tfields: [\n\t\t\t\t\t...repositoryChangeOptionFields,\n\t\t\t\t\t{\n\t\t\t\t\t\tid: profileField,\n\t\t\t\t\t\tlabel: `${provider} profile`,\n\t\t\t\t\t\tkind: \"select\",\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tdescription: `${provider} profile with server-configured CI and Git SSH access.`,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"repository\",\n\t\t\t\t\t\tlabel: \"Repository\",\n\t\t\t\t\t\tkind: \"select\",\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tdescription: `Repository visible to the selected ${provider} profile.`,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"prompt\",\n\t\t\t\t\t\tlabel: \"Requested change\",\n\t\t\t\t\t\tkind: \"textarea\",\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tplaceholder: \"Describe the change to plan, implement, review, and publish.\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tsubmitLabel: \"Start change\",\n\t\t\t},\n\t\t\tresolveDefaults() {\n\t\t\t\treturn {\n\t\t\t\t\t[profileField]: profiles()[0] ?? \"\",\n\t\t\t\t\trepository: \"\",\n\t\t\t\t\tprompt: \"\",\n\t\t\t\t\t...repositoryChangeOptions({}),\n\t\t\t\t};\n\t\t\t},\n\t\t\tasync resolveOptions(input) {\n\t\t\t\tconst profile = trimString(input[profileField]);\n\t\t\t\treturn {\n\t\t\t\t\t[profileField]: profiles().map((value) => ({ value, label: value })),\n\t\t\t\t\trepository: (await repositories(profile)).map((repository) => ({\n\t\t\t\t\t\tvalue: repository.full_name,\n\t\t\t\t\t\tlabel: repository.full_name,\n\t\t\t\t\t\tdescription: repository.html_url,\n\t\t\t\t\t})),\n\t\t\t\t};\n\t\t\t},\n\t\t\tpreparationChecks,\n\t\t\tresolveRelaunchInput(input) {\n\t\t\t\treturn {\n\t\t\t\t\t...repositoryChangeOptions(input),\n\t\t\t\t\t[profileField]: trimString(input[profileField]),\n\t\t\t\t\trepository: trimString(input.repository),\n\t\t\t\t\tprompt: trimString(input.prompt),\n\t\t\t\t};\n\t\t\t},\n\t\t\tasync resolveLaunchConfig(input) {\n\t\t\t\tconst profile = trimString(input[profileField]);\n\t\t\t\tconst repositoryName = trimString(input.repository);\n\t\t\t\tconst prompt = trimString(input.prompt);\n\t\t\t\tconst errors: LauncherValidationError[] = [];\n\t\t\t\tconst invalid = (fieldId: string, message: string) => ({\n\t\t\t\t\tok: false as const,\n\t\t\t\t\terrors: [validationError(fieldId, message, \"custom_rule\")],\n\t\t\t\t});\n\t\t\t\trequireDependencies();\n\t\t\t\tif (!profile) errors.push(validationError(profileField, `${provider} profile is required`));\n\t\t\t\telse if (!profiles().includes(profile))\n\t\t\t\t\terrors.push(\n\t\t\t\t\t\tvalidationError(profileField, `${provider} profile is not available`, \"custom_rule\"),\n\t\t\t\t\t);\n\t\t\t\tif (!repositoryName) errors.push(validationError(\"repository\", \"Repository is required\"));\n\t\t\t\tif (!prompt) errors.push(validationError(\"prompt\", \"Requested change is required\"));\n\t\t\t\tif (errors.length > 0) return { ok: false, errors };\n\t\t\t\tconst repository = (await repositories(profile)).find(\n\t\t\t\t\t(candidate) => candidate.full_name === repositoryName,\n\t\t\t\t);\n\t\t\t\tif (!repository)\n\t\t\t\t\treturn invalid(\n\t\t\t\t\t\t\"repository\",\n\t\t\t\t\t\t`Repository is not available to the selected ${provider} profile`,\n\t\t\t\t\t);\n\t\t\t\tlet binding: B;\n\t\t\t\ttry {\n\t\t\t\t\tbinding = resolveProfiles(profile);\n\t\t\t\t} catch (error) {\n\t\t\t\t\treturn invalid(profileField, (error as Error).message);\n\t\t\t\t}\n\t\t\t\tconst identity = await resolveGitIdentity(profile);\n\t\t\t\tconst workBranch = buildAutoWorkBranchFromSeed(\n\t\t\t\t\tprompt,\n\t\t\t\t\t`${repository.ssh_url}:${repository.default_branch}`,\n\t\t\t\t);\n\t\t\t\tconst params = {\n\t\t\t\t\t...options.params(repository, { ...binding, profile, prompt, workBranch }),\n\t\t\t\t\t...repositoryChangeOptions(input),\n\t\t\t\t};\n\t\t\t\treturn {\n\t\t\t\t\tok: true,\n\t\t\t\t\tlaunchConfig: options.launchConfig(params, prompt, identity, repository),\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t};\n\treturn {\n\t\t/** @internal */ configure(value: D | null) {\n\t\t\tdependencies = value;\n\t\t},\n\t\t/** @internal */ preparationChecks,\n\t\t/** @internal */ resolveProfiles,\n\t\t/** @internal */ resolveGitIdentity,\n\t\t/** @internal */ launcher,\n\t\t/** @internal */ workflow: repositoryChangeWorkflow(async (params: P) => {\n\t\t\tif (params.origin !== \"issue\") throw new Error(`Missing ${provider} source issue`);\n\t\t\tconst issue = await integration()\n\t\t\t\t.client(options.profile(params))\n\t\t\t\t.getIssue(params.owner, params.repo, params.issueNumber);\n\t\t\tif (issue.html_url !== params.issueUrl)\n\t\t\t\tthrow new Error(`${provider} source issue installation changed`);\n\t\t\treturn issue.labels.map((label) => label.name);\n\t\t}),\n\t};\n}\n"],"mappings":";;;;;;AAAA,SAAS,OAAO,OAAgB,OAAwC;AACvE,MAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK;AAC7D,UAAM,IAAI,MAAM,GAAG,KAAK,oBAAoB;AAC7C,SAAO;AACR;AAGO,SAAS,+BACf,KACA,aACA,QACwD;AACxD,QAAM,SAAS,QAAQ,SAAY,CAAC,IAAI,OAAO,KAAK,GAAG,WAAW,gBAAgB;AAClF,MAAI,OAAO,qBAAqB,OAAW,QAAO,OAAO,OAAO,CAAC,CAAC;AAClE,QAAM,WAAW,OAAO,OAAO,kBAAkB,kBAAkB;AACnE,SAAO,OAAO;AAAA,IACb,OAAO;AAAA,MACN,OAAO,QAAQ,QAAQ,EAAE,IAAI,CAAC,CAAC,SAAS,KAAK,MAAM;AAClD,YAAI,CAAC,QAAQ,KAAK,KAAK,QAAQ,KAAK,MAAM;AACzC,gBAAM,IAAI;AAAA,YACT;AAAA,UACD;AACD,cAAM,UAAU,OAAO,OAAO,oBAAoB,OAAO,EAAE;AAC3D,mBAAW,OAAO,OAAO,KAAK,OAAO;AACpC,cAAI,CAAC,OAAO,OAAO,MAAM,EAAE,SAAS,GAAG;AACtC,kBAAM,IAAI,MAAM,4BAA4B,OAAO,IAAI,GAAG,EAAE;AAC9D,cAAM,UAAU,OAAO;AAAA,UACtB,OAAO,QAAgB,MAAM,EAAE,IAAI,CAAC,CAAC,OAAO,GAAG,MAAM;AACpD,kBAAMA,SAAQ,QAAQ,GAAG;AACzB,gBAAIA,WAAU,WAAc,OAAOA,WAAU,YAAY,CAACA,OAAM,KAAK;AACpE,oBAAM,IAAI,MAA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U,yBAAyB,OAAO,WAAc;AACxE,UAAI,OAAO,WAAW,QAAS,OAAM,IAAI,MAAM,WAAW,QAAQ,eAAe;AACjF,YAAM,QAAQ,MAAM,YAAY,EAC9B,OAAO,QAAQ,QAAQ,MAAM,CAAC,EAC9B,SAAS,OAAO,OAAO,OAAO,MAAM,OAAO,WAAW;AACxD,UAAI,MAAM,aAAa,OAAO;AAC7B,cAAM,IAAI,MAAM,GAAG,QAAQ,oCAAoC;AAChE,aAAO,MAAM,OAAO,IAAI,CAAC,UAAU,MAAM,IAAI;AAAA,IAC9C,CAAC;AAAA,EACF;AACD;","names":["value","record","value","trimString","trimString"]}
@@ -0,0 +1,69 @@
1
+ import * as _leitwerk_dev_process_sdk from '@leitwerk-dev/process-sdk';
2
+ import { ExternalActionSource, Codec, ProcessLauncherDefinition, FormDefinition, RepositoryCredentialProject, RepositoryCredentialRequirement, FlowFragmentBuilder } from '@leitwerk-dev/process-sdk';
3
+ import { RepositoryChangeState } from './repository-change-state.js';
4
+
5
+ /** @public */
6
+ type RepositoryChangeParams = object;
7
+ /** Server-side policies evaluated at the route boundary. @public */
8
+ interface RepositoryChangeWorkflow<TParams> {
9
+ /** @deprecated All repository changes use the streamlined graph. @public */
10
+ variant?: "streamlined";
11
+ /** @public */
12
+ multiRepository?: boolean;
13
+ /** @public */
14
+ planDecision?(params: TParams): Promise<{
15
+ /** @internal */
16
+ skip: boolean;
17
+ /** @internal */
18
+ reason: string;
19
+ }>;
20
+ /** @public */
21
+ simplification?(params: TParams): Promise<{
22
+ /** @internal */
23
+ skip: boolean;
24
+ /** @internal */
25
+ reason: string;
26
+ }>;
27
+ /** Must recheck the current revision and source before firing. @public */
28
+ planBypassSource?: ExternalActionSource<TParams, RepositoryChangeState, unknown>;
29
+ }
30
+ /** @public */
31
+ interface RepositoryChangeProcessConfig<TParams extends RepositoryChangeParams> {
32
+ /** @public */
33
+ processId: string;
34
+ /** @public */
35
+ displayName: string;
36
+ /** @public */
37
+ workflow?: RepositoryChangeWorkflow<TParams>;
38
+ /** @public */
39
+ paramsCodec: Codec<TParams>;
40
+ /** @public */
41
+ launcher?: ProcessLauncherDefinition<TParams>;
42
+ /** @deprecated Publication follows implementation automatically. @public */
43
+ finalizeLabel?: string;
44
+ /** @deprecated Publication follows implementation automatically. @public */
45
+ finalizeForm?: FormDefinition;
46
+ /** @public */
47
+ repositoryCredentials?(input: {
48
+ /** @public */
49
+ params: TParams;
50
+ /** @internal */
51
+ projects: readonly RepositoryCredentialProject[];
52
+ }): readonly RepositoryCredentialRequirement[];
53
+ /** @public */
54
+ publication: {
55
+ /** @public */
56
+ entryTurnId: string;
57
+ /** @public */
58
+ fragment: FlowFragmentBuilder<TParams, RepositoryChangeState>;
59
+ /** @public */
60
+ happyPath?: readonly string[];
61
+ };
62
+ }
63
+ /** @public */
64
+ declare function createRepositoryChangeProcess<TParams extends RepositoryChangeParams>(config: RepositoryChangeProcessConfig<TParams>): {
65
+ /** @public */
66
+ process: _leitwerk_dev_process_sdk.ExtensionProcessDefinition<TParams, RepositoryChangeState>;
67
+ };
68
+
69
+ export { type RepositoryChangeWorkflow as R, type RepositoryChangeProcessConfig as a, createRepositoryChangeProcess as c };
@@ -1,7 +1,30 @@
1
- import { type Codec, type FlowFragmentBuilder, type FormDefinition, type HumanTurnDefinition, type ProcessLauncherDefinition, type RepositoryCredentialProject, type RepositoryCredentialRequirement } from "@leitwerk-dev/process-sdk";
1
+ import { type Codec, type ExternalActionSource, type FlowFragmentBuilder, type FormDefinition, type ProcessLauncherDefinition, type RepositoryCredentialProject, type RepositoryCredentialRequirement } from "@leitwerk-dev/process-sdk";
2
2
  import { type RepositoryChangeState } from "./repository-change-state-internal.js";
3
3
  /** @public */
4
4
  export type RepositoryChangeParams = object;
5
+ /** Server-side policies evaluated at the route boundary. @public */
6
+ export interface RepositoryChangeWorkflow<TParams> {
7
+ /** @deprecated All repository changes use the streamlined graph. @public */
8
+ variant?: "streamlined";
9
+ /** @public */
10
+ multiRepository?: boolean;
11
+ /** @public */
12
+ planDecision?(params: TParams): Promise<{
13
+ /** @internal */
14
+ skip: boolean;
15
+ /** @internal */
16
+ reason: string;
17
+ }>;
18
+ /** @public */
19
+ simplification?(params: TParams): Promise<{
20
+ /** @internal */
21
+ skip: boolean;
22
+ /** @internal */
23
+ reason: string;
24
+ }>;
25
+ /** Must recheck the current revision and source before firing. @public */
26
+ planBypassSource?: ExternalActionSource<TParams, RepositoryChangeState, unknown>;
27
+ }
5
28
  /** @public */
6
29
  export interface RepositoryChangeProcessConfig<TParams extends RepositoryChangeParams> {
7
30
  /** @public */
@@ -9,13 +32,15 @@ export interface RepositoryChangeProcessConfig<TParams extends RepositoryChangeP
9
32
  /** @public */
10
33
  displayName: string;
11
34
  /** @public */
35
+ workflow?: RepositoryChangeWorkflow<TParams>;
36
+ /** @public */
12
37
  paramsCodec: Codec<TParams>;
13
38
  /** @public */
14
39
  launcher?: ProcessLauncherDefinition<TParams>;
15
- /** @public */
16
- finalizeLabel: string;
17
- /** @public */
18
- finalizeForm: FormDefinition;
40
+ /** @deprecated Publication follows implementation automatically. @public */
41
+ finalizeLabel?: string;
42
+ /** @deprecated Publication follows implementation automatically. @public */
43
+ finalizeForm?: FormDefinition;
19
44
  /** @public */
20
45
  repositoryCredentials?(input: {
21
46
  /** @public */
@@ -37,25 +62,5 @@ export interface RepositoryChangeProcessConfig<TParams extends RepositoryChangeP
37
62
  export declare function createRepositoryChangeProcess<TParams extends RepositoryChangeParams>(config: RepositoryChangeProcessConfig<TParams>): {
38
63
  /** @public */
39
64
  process: import("@leitwerk-dev/process-sdk").ExtensionProcessDefinition<TParams, RepositoryChangeState>;
40
- /** @internal */
41
- planDecision: HumanTurnDefinition<unknown, unknown> & {
42
- /** @public */ id: string;
43
- };
44
- /** @internal */
45
- planReviewFeedback: HumanTurnDefinition<unknown, unknown> & {
46
- /** @public */ id: string;
47
- };
48
- /** @internal */
49
- implementationDecision: HumanTurnDefinition<unknown, unknown> & {
50
- /** @public */ id: string;
51
- };
52
- /** @internal */
53
- implementationReviewFeedback: HumanTurnDefinition<unknown, unknown> & {
54
- /** @public */ id: string;
55
- };
56
- /** @internal */
57
- simplificationDecision: HumanTurnDefinition<unknown, unknown> & {
58
- /** @public */ id: string;
59
- };
60
65
  };
61
66
  //# sourceMappingURL=repository-change-process.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"repository-change-process.d.ts","sourceRoot":"","sources":["../src/repository-change-process.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,KAAK,KAAK,EAEV,KAAK,mBAAmB,EACxB,KAAK,cAAc,EAEnB,KAAK,mBAAmB,EAExB,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,KAAK,+BAA+B,EAEpC,MAAM,2BAA2B,CAAC;AAOnC,OAAO,EAGN,KAAK,qBAAqB,EAE1B,MAAM,uCAAuC,CAAC;AAW/C,cAAc;AACd,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC;AAE5C,cAAc;AACd,MAAM,WAAW,6BAA6B,CAAC,OAAO,SAAS,sBAAsB;IACpF,cAAc;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc;IACd,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5B,cAAc;IACd,QAAQ,CAAC,EAAE,yBAAyB,CAAC,OAAO,CAAC,CAAC;IAC9C,cAAc;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc;IACd,YAAY,EAAE,cAAc,CAAC;IAC7B,cAAc;IACd,qBAAqB,CAAC,CAAC,KAAK,EAAE;QAC7B,cAAc;QACd,MAAM,EAAE,OAAO,CAAC;QAChB,gBAAgB;QAChB,QAAQ,EAAE,SAAS,2BAA2B,EAAE,CAAC;KACjD,GAAG,SAAS,+BAA+B,EAAE,CAAC;IAC/C,cAAc;IACd,WAAW,EAAE;QACZ,cAAc;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,cAAc;QACd,QAAQ,EAAE,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;QAC9D,cAAc;QACd,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;KAC9B,CAAC;CACF;AAED,cAAc;AACd,wBAAgB,6BAA6B,CAAC,OAAO,SAAS,sBAAsB,EACnF,MAAM,EAAE,6BAA6B,CAAC,OAAO,CAAC;IAylB7C,cAAc;;IAEd,gBAAgB;;QALf,cAAc,KAAK,MAAM;;IAO1B,gBAAgB;;QAPf,cAAc,KAAK,MAAM;;IAS1B,gBAAgB;;QATf,cAAc,KAAK,MAAM;;IAW1B,gBAAgB;;QAXf,cAAc,KAAK,MAAM;;IAa1B,gBAAgB;;QAbf,cAAc,KAAK,MAAM;;EAgB3B"}
1
+ {"version":3,"file":"repository-change-process.d.ts","sourceRoot":"","sources":["../src/repository-change-process.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,KAAK,EACV,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EAGnB,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,KAAK,+BAA+B,EAEpC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACN,KAAK,qBAAqB,EAE1B,MAAM,uCAAuC,CAAC;AAW/C,cAAc;AACd,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC;AAE5C,oEAAoE;AACpE,MAAM,WAAW,wBAAwB,CAAC,OAAO;IAChD,4EAA4E;IAC5E,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,cAAc;IACd,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc;IACd,YAAY,CAAC,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC;QACvC,gBAAgB;QAChB,IAAI,EAAE,OAAO,CAAC;QACd,gBAAgB;QAChB,MAAM,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;IACH,cAAc;IACd,cAAc,CAAC,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,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