@leitwerk-dev/coding 0.3.1 → 0.4.1

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 (123) hide show
  1. package/README.md +154 -13
  2. package/dist/chunk-3WJRJ3Q7.js +220 -0
  3. package/dist/chunk-3WJRJ3Q7.js.map +1 -0
  4. package/dist/chunk-ABQH2WZT.js +36 -0
  5. package/dist/chunk-ABQH2WZT.js.map +1 -0
  6. package/dist/chunk-B3PE6DPF.js +820 -0
  7. package/dist/chunk-B3PE6DPF.js.map +1 -0
  8. package/dist/chunk-DNG7D77K.js +65 -0
  9. package/dist/chunk-DNG7D77K.js.map +1 -0
  10. package/dist/chunk-E3DB4TIZ.js +49 -0
  11. package/dist/chunk-E3DB4TIZ.js.map +1 -0
  12. package/dist/chunk-L2TFD72B.js +16320 -0
  13. package/dist/chunk-L2TFD72B.js.map +1 -0
  14. package/dist/chunk-M2VTUPFO.js +265 -0
  15. package/dist/chunk-M2VTUPFO.js.map +1 -0
  16. package/dist/{chunk-YSC5GEQJ.js → chunk-QD6FI4HR.js} +7 -3
  17. package/dist/chunk-QD6FI4HR.js.map +1 -0
  18. package/dist/chunk-SKGB4CZS.js +14 -0
  19. package/dist/chunk-SKGB4CZS.js.map +1 -0
  20. package/dist/chunk-SZ4WOGV2.js +120 -0
  21. package/dist/chunk-SZ4WOGV2.js.map +1 -0
  22. package/dist/finalization-git-internal.d.ts +9 -0
  23. package/dist/finalization-git-internal.d.ts.map +1 -1
  24. package/dist/finalization-git.d.ts +1 -1
  25. package/dist/finalization-git.d.ts.map +1 -1
  26. package/dist/finalization-git.js +6 -3
  27. package/dist/index.d.ts +1 -0
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +18 -591
  30. package/dist/index.js.map +1 -1
  31. package/dist/pull-request-publication-internal.d.ts +34 -24
  32. package/dist/pull-request-publication-internal.d.ts.map +1 -1
  33. package/dist/repository-change-launch-internal-BudnAfL7.d.ts +88 -0
  34. package/dist/repository-change-launch-internal.d.ts +32 -11
  35. package/dist/repository-change-launch-internal.d.ts.map +1 -1
  36. package/dist/repository-change-launch.d.ts +4 -3
  37. package/dist/repository-change-launch.d.ts.map +1 -1
  38. package/dist/repository-change-launch.js +162 -34
  39. package/dist/repository-change-launch.js.map +1 -1
  40. package/dist/repository-change-process-DlgF04fU.d.ts +69 -0
  41. package/dist/repository-change-process.d.ts +30 -25
  42. package/dist/repository-change-process.d.ts.map +1 -1
  43. package/dist/repository-change-publication.d.ts +76 -7
  44. package/dist/repository-change-publication.d.ts.map +1 -1
  45. package/dist/repository-change-publication.js +624 -136
  46. package/dist/repository-change-publication.js.map +1 -1
  47. package/dist/repository-change-state-internal.d.ts +18 -4
  48. package/dist/repository-change-state-internal.d.ts.map +1 -1
  49. package/dist/repository-change-ui-launcher-internal.d.ts +34 -22
  50. package/dist/repository-change-ui-launcher-internal.d.ts.map +1 -1
  51. package/dist/repository-publication-receipt.d.ts +23 -0
  52. package/dist/repository-publication-receipt.d.ts.map +1 -0
  53. package/dist/repository-rebase/git.d.ts +8 -0
  54. package/dist/repository-rebase/git.d.ts.map +1 -1
  55. package/dist/repository-reconciliation.d.ts +47 -0
  56. package/dist/repository-reconciliation.d.ts.map +1 -0
  57. package/dist/repository-record.d.ts +6 -0
  58. package/dist/repository-record.d.ts.map +1 -0
  59. package/dist/settings.d.ts +15 -0
  60. package/dist/settings.d.ts.map +1 -0
  61. package/dist/turns/commit-message-evidence.d.ts +35 -0
  62. package/dist/turns/commit-message-evidence.d.ts.map +1 -0
  63. package/dist/turns/commit-message-evidence.js +9 -0
  64. package/dist/turns/generate-commit-message.d.ts +4 -1
  65. package/dist/turns/generate-commit-message.d.ts.map +1 -1
  66. package/dist/turns/generate-commit-message.js +7 -5
  67. package/dist/turns/generate-plan.d.ts.map +1 -1
  68. package/dist/turns/generate-plan.js +1 -1
  69. package/dist/turns/git-inspection-profile.d.ts +25 -0
  70. package/dist/turns/git-inspection-profile.d.ts.map +1 -0
  71. package/dist/turns/git-inspection-profile.js +8 -0
  72. package/dist/turns/implement.d.ts +1 -1
  73. package/dist/turns/implement.d.ts.map +1 -1
  74. package/dist/turns/implement.js +1 -1
  75. package/dist/turns/simplify-implementation.d.ts +1 -1
  76. package/dist/turns/simplify-implementation.d.ts.map +1 -1
  77. package/dist/turns/simplify-implementation.js +3 -3
  78. package/package.json +5 -9
  79. package/src/finalization-git-internal.ts +186 -114
  80. package/src/finalization-git.ts +1 -1
  81. package/src/index.ts +4 -1
  82. package/src/pull-request-publication-internal.ts +158 -79
  83. package/src/repository-change-launch-internal.ts +119 -12
  84. package/src/repository-change-launch.ts +8 -4
  85. package/src/repository-change-process.ts +252 -524
  86. package/src/repository-change-publication.ts +702 -121
  87. package/src/repository-change-state-internal.ts +34 -20
  88. package/src/repository-change-ui-launcher-internal.ts +139 -56
  89. package/src/repository-publication-receipt.ts +71 -0
  90. package/src/repository-rebase/git.ts +108 -29
  91. package/src/repository-reconciliation.ts +600 -0
  92. package/src/repository-record.ts +14 -0
  93. package/src/settings.ts +79 -0
  94. package/src/turns/commit-message-evidence.ts +241 -0
  95. package/src/turns/generate-commit-message.ts +53 -23
  96. package/src/turns/generate-plan.ts +26 -12
  97. package/src/turns/git-inspection-profile.ts +134 -0
  98. package/src/turns/implement.ts +13 -3
  99. package/src/turns/simplify-implementation.ts +10 -6
  100. package/dist/chunk-34B3Q75M.js +0 -25
  101. package/dist/chunk-34B3Q75M.js.map +0 -1
  102. package/dist/chunk-F6CEEAFE.js +0 -13
  103. package/dist/chunk-F6CEEAFE.js.map +0 -1
  104. package/dist/chunk-GO44KCUS.js +0 -154
  105. package/dist/chunk-GO44KCUS.js.map +0 -1
  106. package/dist/chunk-R3UCUGY6.js +0 -31
  107. package/dist/chunk-R3UCUGY6.js.map +0 -1
  108. package/dist/chunk-W7VJT6AN.js +0 -25
  109. package/dist/chunk-W7VJT6AN.js.map +0 -1
  110. package/dist/chunk-WKHVLLKE.js +0 -45
  111. package/dist/chunk-WKHVLLKE.js.map +0 -1
  112. package/dist/chunk-YSC5GEQJ.js.map +0 -1
  113. package/dist/repository-change-launch-internal-Dd-AONUs.d.ts +0 -67
  114. package/dist/turns/review-implementation.d.ts +0 -4
  115. package/dist/turns/review-implementation.d.ts.map +0 -1
  116. package/dist/turns/review-implementation.js +0 -8
  117. package/dist/turns/review-plan.d.ts +0 -4
  118. package/dist/turns/review-plan.d.ts.map +0 -1
  119. package/dist/turns/review-plan.js +0 -8
  120. package/src/turns/review-implementation.ts +0 -30
  121. package/src/turns/review-plan.ts +0 -24
  122. /package/dist/turns/{review-implementation.js.map → commit-message-evidence.js.map} +0 -0
  123. /package/dist/turns/{review-plan.js.map → git-inspection-profile.js.map} +0 -0
@@ -40,6 +40,71 @@ function parseRepositoryProfileBindings(raw, extensionId, fields) {
40
40
 
41
41
  // src/repository-change-launch-internal.ts
42
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
+ }
43
108
  function normalizeRepositoryIssueOrigin(record2, displayName, text) {
44
109
  const origin = trimString(record2.origin);
45
110
  if (origin === "ui") {
@@ -66,6 +131,7 @@ function normalizeRepositoryChangeParamsInput(value, displayName) {
66
131
  const record2 = repositoryChangeParamsRecord(value, displayName);
67
132
  const rawRepoLocator = trimString(record2.repoLocator);
68
133
  return {
134
+ ...repositoryChangeOptions(record2),
69
135
  repoLocator: parseRepoLocator(rawRepoLocator)?.value ?? rawRepoLocator,
70
136
  baseBranch: trimString(record2.baseBranch) || "main",
71
137
  workBranch: trimString(record2.workBranch),
@@ -95,34 +161,57 @@ import { trimString as trimString2 } from "@leitwerk-dev/domain";
95
161
  import {
96
162
  SafeLaunchPreparationError
97
163
  } from "@leitwerk-dev/process-sdk";
98
- function repositoryVisibilityCheck(provider, isVisible) {
99
- return {
100
- id: "repository_visibility",
101
- label: "Check repository visibility",
102
- async run({ signal }) {
103
- signal.throwIfAborted();
104
- const visible = await isVisible();
105
- signal.throwIfAborted();
106
- if (!visible)
107
- throw new SafeLaunchPreparationError(
108
- "Repository is not visible",
109
- `Grant the selected ${provider} profile access to the repository, then try again.`
110
- );
111
- }
112
- };
113
- }
114
- function createRepositoryChangeUiLauncher(options) {
164
+ function createRepositoryChangeLauncher(options) {
115
165
  const { provider, providerId } = options;
116
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
+ }
117
206
  function validationError(fieldId, message, code = "required") {
118
207
  return { code, fieldId, message };
119
208
  }
120
- return {
209
+ const launcher = {
121
210
  async resolveIssueLaunchConfig({ profile, repository, issue, labels }) {
122
211
  const title = issue.title.trim();
123
212
  const body = issue.body?.trim() ?? "";
124
- const binding = options.resolveProfiles(profile);
125
- const identity = await options.resolveGitIdentity(profile);
213
+ const binding = resolveProfiles(profile);
214
+ const identity = await resolveGitIdentity(profile);
126
215
  return options.launchConfig(
127
216
  {
128
217
  ...options.params(repository, {
@@ -140,7 +229,8 @@ ${body}` : ""}`
140
229
  doneLabel: labels.done
141
230
  },
142
231
  title,
143
- identity
232
+ identity,
233
+ repository
144
234
  );
145
235
  },
146
236
  id: options.id,
@@ -156,6 +246,7 @@ ${body}` : ""}`
156
246
  id: `${providerId}_repo_change_form`,
157
247
  title: `${provider} Repo Change`,
158
248
  fields: [
249
+ ...repositoryChangeOptionFields,
159
250
  {
160
251
  id: profileField,
161
252
  label: `${provider} profile`,
@@ -181,22 +272,28 @@ ${body}` : ""}`
181
272
  submitLabel: "Start change"
182
273
  },
183
274
  resolveDefaults() {
184
- return { [profileField]: options.profiles()[0] ?? "", repository: "", prompt: "" };
275
+ return {
276
+ [profileField]: profiles()[0] ?? "",
277
+ repository: "",
278
+ prompt: "",
279
+ ...repositoryChangeOptions({})
280
+ };
185
281
  },
186
282
  async resolveOptions(input) {
187
283
  const profile = trimString2(input[profileField]);
188
284
  return {
189
- [profileField]: options.profiles().map((value) => ({ value, label: value })),
190
- repository: (await options.repositories(profile)).map((repository) => ({
285
+ [profileField]: profiles().map((value) => ({ value, label: value })),
286
+ repository: (await repositories(profile)).map((repository) => ({
191
287
  value: repository.full_name,
192
288
  label: repository.full_name,
193
289
  description: repository.html_url
194
290
  }))
195
291
  };
196
292
  },
197
- preparationChecks: options.preparationChecks,
293
+ preparationChecks,
198
294
  resolveRelaunchInput(input) {
199
295
  return {
296
+ ...repositoryChangeOptions(input),
200
297
  [profileField]: trimString2(input[profileField]),
201
298
  repository: trimString2(input.repository),
202
299
  prompt: trimString2(input.prompt)
@@ -211,16 +308,16 @@ ${body}` : ""}`
211
308
  ok: false,
212
309
  errors: [validationError(fieldId, message, "custom_rule")]
213
310
  });
214
- options.assertConfigured();
311
+ requireDependencies();
215
312
  if (!profile) errors.push(validationError(profileField, `${provider} profile is required`));
216
- else if (!options.profiles().includes(profile))
313
+ else if (!profiles().includes(profile))
217
314
  errors.push(
218
315
  validationError(profileField, `${provider} profile is not available`, "custom_rule")
219
316
  );
220
317
  if (!repositoryName) errors.push(validationError("repository", "Repository is required"));
221
318
  if (!prompt) errors.push(validationError("prompt", "Requested change is required"));
222
319
  if (errors.length > 0) return { ok: false, errors };
223
- const repository = (await options.repositories(profile)).find(
320
+ const repository = (await repositories(profile)).find(
224
321
  (candidate) => candidate.full_name === repositoryName
225
322
  );
226
323
  if (!repository)
@@ -230,29 +327,60 @@ ${body}` : ""}`
230
327
  );
231
328
  let binding;
232
329
  try {
233
- binding = options.resolveProfiles(profile);
330
+ binding = resolveProfiles(profile);
234
331
  } catch (error) {
235
332
  return invalid(profileField, error.message);
236
333
  }
237
- const identity = await options.resolveGitIdentity(profile);
334
+ const identity = await resolveGitIdentity(profile);
238
335
  const workBranch = buildAutoWorkBranchFromSeed(
239
336
  prompt,
240
337
  `${repository.ssh_url}:${repository.default_branch}`
241
338
  );
242
- const params = options.params(repository, { ...binding, profile, prompt, workBranch });
243
- return { ok: true, launchConfig: options.launchConfig(params, prompt, identity) };
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
+ };
244
347
  }
245
348
  }
246
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
+ };
247
372
  }
248
373
  export {
374
+ createRepositoryChangeLauncher,
249
375
  createRepositoryChangeParamsCodec,
250
- createRepositoryChangeUiLauncher,
251
376
  normalizeRepositoryChangeParamsInput,
252
377
  normalizeRepositoryIssueChangeParams,
253
378
  normalizeRepositoryIssueOrigin,
254
379
  parseRepositoryProfileBindings,
380
+ repositoryChangeOptionFields,
381
+ repositoryChangeOptions,
255
382
  repositoryChangeParamsRecord,
256
- repositoryVisibilityCheck
383
+ repositoryChangeWorkflow,
384
+ repositoryIssueChangeLaunchConfig
257
385
  };
258
386
  //# sourceMappingURL=repository-change-launch.js.map
@@ -1 +1 @@
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 } 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/** 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/** 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 {\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/** 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\";\n\n/** Recheck provider-owned repository visibility before launch. @internal */\nexport function repositoryVisibilityCheck(\n\tprovider: string,\n\tisVisible: () => Promise<boolean>,\n): LaunchPreparationCheck {\n\treturn {\n\t\tid: \"repository_visibility\",\n\t\tlabel: \"Check repository visibility\",\n\t\tasync run({ signal }) {\n\t\t\tsignal.throwIfAborted();\n\t\t\tconst visible = await isVisible();\n\t\t\tsignal.throwIfAborted();\n\t\t\tif (!visible)\n\t\t\t\tthrow new SafeLaunchPreparationError(\n\t\t\t\t\t\"Repository is not visible\",\n\t\t\t\t\t`Grant the selected ${provider} profile access to the repository, then try again.`,\n\t\t\t\t);\n\t\t},\n\t};\n}\n\n/** Shared UI mechanics; providers retain credentials, preparation and launch metadata. @internal */\nexport function createRepositoryChangeUiLauncher<\n\tP,\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\tassertConfigured(): void;\n\t/** @internal */\n\tprofiles(): readonly string[];\n\t/** @internal */\n\trepositories(profile: string): Promise<readonly R[]>;\n\t/** @internal */\n\tresolveProfiles(profile: string): B;\n\t/** @internal */\n\tresolveGitIdentity(profile: string): Promise<I>;\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(params: P, title: string, identity: I): ProcessLaunchConfig<P>;\n\t/** @internal */\n\tpreparationChecks: NonNullable<ProcessLauncherDefinition<P>[\"ui\"]>[\"preparationChecks\"];\n}): ProcessLauncherDefinition<P> & {\n\t/** Resolve issue launches using the same provider wiring as UI launches. @internal */\n\tresolveIssueLaunchConfig(event: {\n\t\t/** @internal */ profile: string;\n\t\t/** @internal */ repository: R;\n\t\t/** @internal */ issue: Pick<RepositoryIssue, \"number\" | \"title\" | \"body\" | \"html_url\">;\n\t\t/** @internal */ labels: RepositoryIssueWatcherConfig[\"labels\"];\n\t}): Promise<ProcessLaunchConfig<P>>;\n} {\n\tconst { provider, providerId } = options;\n\tconst profileField = `${providerId}Profile`;\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\treturn {\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 = options.resolveProfiles(profile);\n\t\t\tconst identity = await options.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);\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{\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 { [profileField]: options.profiles()[0] ?? \"\", repository: \"\", prompt: \"\" };\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]: options.profiles().map((value) => ({ value, label: value })),\n\t\t\t\t\trepository: (await options.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: options.preparationChecks,\n\t\t\tresolveRelaunchInput(input) {\n\t\t\t\treturn {\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\toptions.assertConfigured();\n\t\t\t\tif (!profile) errors.push(validationError(profileField, `${provider} profile is required`));\n\t\t\t\telse if (!options.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 options.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 = options.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 options.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 = options.params(repository, { ...binding, profile, prompt, workBranch });\n\t\t\t\treturn { ok: true, launchConfig: options.launchConfig(params, prompt, identity) };\n\t\t\t},\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,OA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AAAA,UAClB;AAAA,UACA,GAAG,WAAW,OAAO,IAAI,WAAW,cAAc;AAAA,QACnD;AACA,cAAM,SAAS,QAAQ,OAAO,YAAY,EAAE,GAAG,SAAS,SAAS,QAAQ,WAAW,CAAC;AACrF,eAAO,EAAE,IAAI,MAAM,cAAc,QAAQ,aAAa,QAAQ,QAAQ,QAAQ,EAAE;AAAA,MACjF;AAAA,IACD;AAAA,EACD;AACD;","names":["value","record","value","trimString","trimString"]}
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,OAAw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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":["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AgB;;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;AAY/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,CAAC;QACzC,gBAAgB;QAChB,IAAI,EAAE,OAAO,CAAC;QACd,gBAAgB;QAChB,MAAM,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;IACH,0EAA0E;IAC1E,gBAAgB,CAAC,EAAE,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,EAAE,OAAO,CAAC,CAAC;CACjF;AAED,cAAc;AACd,MAAM,WAAW,6BAA6B,CAAC,O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