@leitwerk-dev/jira-gitlab-change 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,7 +27,8 @@ Optional model labels select an instance default at admission:
27
27
  ```yaml
28
28
  extensions:
29
29
  jira-gitlab-change:
30
- verification_on_merge: false # opt in if the Jira workflow has In Verification
30
+ verification_on_merge: false # opt in to the completion transition
31
+ verification_status: In Verification # or Ready for Verification
31
32
  model_labels:
32
33
  leitwerk-model-astra: astra-high
33
34
  leitwerk-model-sol: sol-medium
@@ -164,8 +165,11 @@ Analysis uses this instruction for each checkout, labelling findings by reposito
164
165
  Application consumes the durable findings and accepted plan, applies justified
165
166
  changes, preserves behavior, and reruns checks. Empty findings proceed normally.
166
167
  Changes stay uncommitted until delivery. Later feedback, conflict, and CI repairs
167
- return to delivery when they change work. No-change outcomes acknowledge feedback
168
- and resume observation without executing Deliver.
168
+ return to delivery. No-change outcomes also pass through Deliver to recheck the
169
+ remote source branch and retained unpublished work before acknowledging feedback.
170
+ Developer pushes and rebases are reconciled without discarding local changes; the
171
+ combined result is validated before publication. See the
172
+ [shared reconciliation contract](../coding/README.md#source-branch-reconciliation).
169
173
 
170
174
  ## Delivery and recovery
171
175
 
@@ -209,7 +213,8 @@ merging, and Jira-comment-driven plan revisions are outside
209
213
  this extension.
210
214
 
211
215
  Set `extensions.jira-gitlab-change.verification_on_merge: true` to transition the
212
- source issue to **In Verification** after all changed MRs merge. This is disabled
216
+ source issue to **In Verification** after all changed MRs merge. Set
217
+ `verification_status: Ready for Verification` to use that destination instead. This is disabled
213
218
  by default. The Jira workflow must expose exactly one matching transition;
214
219
  failed reconciliation retries safely and does not rewind later human status edits.
215
220
 
package/dist/index.d.ts CHANGED
@@ -9,6 +9,8 @@ export declare function createJiraGitLabChange(options: {
9
9
  docker: boolean;
10
10
  /** Opt into the supported Jira verification transition after all changed MRs merge. @internal */
11
11
  verificationOnMerge?: boolean;
12
+ /** Destination for enabled completion transitions. @internal */
13
+ verificationStatus?: "In Verification" | "Ready for Verification";
12
14
  }): {
13
15
  /** @internal */
14
16
  extension: LeitwerkExtensionModule;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAU1F,OAAO,EACN,KAAK,SAAS,EAMd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEN,KAAK,uBAAuB,EAE5B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAEN,KAAK,gBAAgB,EAGrB,MAAM,aAAa,CAAC;AAGrB,cAAc,aAAa,CAAC;AAM5B,cAAc;AACd,wBAAgB,sBAAsB,CAAC,OAAO,EAAE;IAC/C,gBAAgB;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,iGAAiG;IACjG,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC9B;IA8NC,gBAAgB;;IAEhB,gBAAgB;;IAEhB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGjB;AAED,cAAc;AACd,eAAO,MAAmB,gBAAgB,2BAAW,uBAAuB,yGACnC,CAAC;AAC1C,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAU1F,OAAO,EACN,KAAK,SAAS,EAMd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEN,KAAK,uBAAuB,EAE5B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAEN,KAAK,gBAAgB,EAGrB,MAAM,aAAa,CAAC;AAGrB,cAAc,aAAa,CAAC;AAM5B,cAAc;AACd,wBAAgB,sBAAsB,CAAC,OAAO,EAAE;IAC/C,gBAAgB;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,iGAAiG;IACjG,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,gEAAgE;IAChE,kBAAkB,CAAC,EAAE,iBAAiB,GAAG,wBAAwB,CAAC;CAClE;IAyOC,gBAAgB;;IAEhB,gBAAgB;;IAEhB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGjB;AAED,cAAc;AACd,eAAO,MAAmB,gBAAgB,2BAAW,uBAAuB,yGACnC,CAAC;AAC1C,eAAe,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  coreHostCapabilities,
24
24
  scopedSettingsCapability
25
25
  } from "@leitwerk-dev/process-sdk";
26
- import { wikiInstructions } from "@leitwerk-dev/wiki";
26
+ import { wikiInstructions, wikiToolNames } from "@leitwerk-dev/wiki";
27
27
  import { topicWikiCapability } from "@leitwerk-dev/wiki/integration";
28
28
 
29
29
  // src/launch.ts
@@ -584,6 +584,7 @@ var namespace = "jiraGitLabChange";
584
584
  var remote = (state, key) => readPublicationState(state, `${namespace}:${key}`);
585
585
  function createJiraGitLabChange(options) {
586
586
  let verificationOnMerge = options.verificationOnMerge ?? false;
587
+ let verificationStatus = options.verificationStatus ?? "In Verification";
587
588
  const launcher = createJiraGitLabLauncher();
588
589
  const adapter = createGitLabPublicationAdapter([], namespace);
589
590
  adapter.ensureRequest = async (ctx) => {
@@ -633,7 +634,7 @@ function createJiraGitLabChange(options) {
633
634
  if (done && verificationOnMerge)
634
635
  await ctx.callIntegrationTool("jira_transition_source_issue", {
635
636
  projectKey,
636
- targetStatus: "In Verification"
637
+ targetStatus: verificationStatus
637
638
  });
638
639
  if (!cancelled)
639
640
  await ctx.callIntegrationTool("jira_finalize_source_issue", {
@@ -681,9 +682,12 @@ function createJiraGitLabChange(options) {
681
682
  mode: "plan_bypass"
682
683
  }))
683
684
  },
684
- repositoryCredentials: ({ params }) => params.repositories.flatMap(
685
- (repo) => repo.sshProfile ? [{ projectKey: repo.key, kind: "git_ssh", credentialRef: repo.sshProfile }] : gitlabRepositoryCredentials(repo.gitlabProfile, [repo])
686
- )
685
+ repositoryCredentials: ({ params }) => {
686
+ if (params.startup) throw new Error("Jira repository bindings are not resolved");
687
+ return params.repositories.flatMap(
688
+ (repo) => repo.sshProfile ? [{ projectKey: repo.key, kind: "git_ssh", credentialRef: repo.sshProfile }] : gitlabRepositoryCredentials(repo.gitlabProfile, [repo])
689
+ );
690
+ }
687
691
  });
688
692
  process.runtime = { ...process.runtime, developmentTools: true, docker: options.docker };
689
693
  const plan = process.turns.get("generate_plan")?.definition;
@@ -747,7 +751,7 @@ function createJiraGitLabChange(options) {
747
751
  ...originalTools?.(params, state) ?? turn.integrationTools ?? [],
748
752
  "jira_get_source_issue",
749
753
  "jira_get_issue",
750
- ...params.wikiTopicId ? ["wiki_index", "wiki_read", "wiki_share", "wiki_edit", "wiki_delete", "wiki_delete_group"] : []
754
+ ...params.wikiTopicId ? wikiToolNames : []
751
755
  ];
752
756
  turn.prompt = async (ctx) => `${await originalPrompt({ ...ctx, params: { ...ctx.params, prompt: jiraChangePrompt(ctx.params.issue) } })}${ctx.params.wikiTopicId ? `
753
757
 
@@ -769,6 +773,12 @@ Wiki: /wiki/${ctx.params.wikiTopicId}` : ""}`;
769
773
  if (verification !== void 0 && typeof verification !== "boolean")
770
774
  throw new Error("Jira verification_on_merge must be a boolean");
771
775
  verificationOnMerge = verification ?? options.verificationOnMerge ?? false;
776
+ const status = asUnknownRecord3(config)?.verification_status;
777
+ if (status !== void 0 && status !== "In Verification" && status !== "Ready for Verification")
778
+ throw new Error(
779
+ "Jira verification_status must be In Verification or Ready for Verification"
780
+ );
781
+ verificationStatus = status ?? options.verificationStatus ?? "In Verification";
772
782
  adapter.maintenance?.register(api, process);
773
783
  const jira = api.require(jiraIntegration), gitlab = api.require(gitlabIntegration), settings = api.require(scopedSettingsCapability);
774
784
  if (Array.isArray(jira) || Array.isArray(gitlab) || Array.isArray(settings))
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/launch.ts","../src/models.ts"],"sourcesContent":["import { createRepositoryChangeProcess } from \"@leitwerk-dev/coding\";\nimport {\n\tcreateRepositoryChangePublication,\n\treadPublicationState,\n} from \"@leitwerk-dev/coding/repository-change-publication\";\nimport type { RepositoryChangeState } from \"@leitwerk-dev/coding/repository-change-state\";\nimport { asUnknownRecord } from \"@leitwerk-dev/domain\";\nimport { gitSshIntegration } from \"@leitwerk-dev/git-ssh\";\nimport {\n\tcreateGitLabPublicationAdapter,\n\ttype GitLabMergeRequest,\n\tgitlabIntegration,\n\tgitlabPublicationRequest,\n\tgitlabRepositoryCredentials,\n} from \"@leitwerk-dev/gitlab\";\nimport {\n\ttype JiraIssue,\n\tjiraEligible,\n\tjiraIntegration,\n\tjiraIssuePolicy,\n\tjiraIssueWatcherSource,\n\tjiraWikiSource,\n} from \"@leitwerk-dev/jira\";\nimport {\n\tcoreHostCapabilities,\n\ttype LeitwerkExtensionModule,\n\tscopedSettingsCapability,\n} from \"@leitwerk-dev/process-sdk\";\nimport { wikiInstructions } from \"@leitwerk-dev/wiki\";\nimport { topicWikiCapability } from \"@leitwerk-dev/wiki/integration\";\nimport {\n\tcreateJiraGitLabLauncher,\n\ttype JiraGitLabParams,\n\tjiraChangePrompt,\n\tjiraGitLabParamsCodec,\n} from \"./launch.js\";\nimport { parseJiraModelLabels } from \"./models.js\";\n\nexport * from \"./launch.js\";\n\nconst namespace = \"jiraGitLabChange\";\nconst remote = (state: RepositoryChangeState, key: string) =>\n\treadPublicationState(state, `${namespace}:${key}`);\n\n/** @public */\nexport function createJiraGitLabChange(options: {\n\t/** @internal */\n\tdocker: boolean;\n\t/** Opt into the supported Jira verification transition after all changed MRs merge. @internal */\n\tverificationOnMerge?: boolean;\n}) {\n\tlet verificationOnMerge = options.verificationOnMerge ?? false;\n\tconst launcher = createJiraGitLabLauncher();\n\tconst adapter = createGitLabPublicationAdapter<JiraGitLabParams>([], namespace);\n\tadapter.ensureRequest = async (ctx) => {\n\t\tconst { url } = (await ctx.callIntegrationTool(\"jira_ensure_remote_link\", {\n\t\t\tprojectKey: \"repo\",\n\t\t\tkind: \"process\",\n\t\t})) as { url: string };\n\t\tconst mr = (await ctx.callIntegrationTool(\"gitlab_ensure_merge_request\", {\n\t\t\tprojectKey: \"repo\",\n\t\t\ttitle: `${ctx.params.issueKey}: ${ctx.params.issue.fields.summary}`,\n\t\t\tbody: `Implements [${ctx.params.issueKey}](${ctx.params.issueUrl})\\n\\n[Leitwerk process](${url})`,\n\t\t})) as GitLabMergeRequest;\n\t\treturn gitlabPublicationRequest(mr);\n\t};\n\tadapter.repositories = (params) =>\n\t\tparams.repositories.map((repo) => ({\n\t\t\tkey: repo.key,\n\t\t\tparams: { ...params, ...repo, issueUrl: params.issueUrl },\n\t\t}));\n\tadapter.tools.delivery = [\n\t\t...adapter.tools.delivery,\n\t\t\"jira_get_source_issue\",\n\t\t\"jira_ensure_remote_link\",\n\t\t\"jira_transition_source_issue\",\n\t\t\"jira_finalize_source_issue\",\n\t];\n\tadapter.sourceCancelled = async (ctx) =>\n\t\t!jiraEligible(\n\t\t\t(await ctx.callIntegrationTool(\"jira_get_source_issue\", {\n\t\t\t\tprojectKey: ctx.params.repositories[0].key,\n\t\t\t})) as JiraIssue,\n\t\t\tctx.params.jiraTriggerLabel,\n\t\t);\n\tadapter.linkIssue = async (ctx) => {\n\t\tawait ctx.callIntegrationTool(\"jira_ensure_remote_link\", {\n\t\t\tprojectKey: \"repo\",\n\t\t\tkind: \"merge_request\",\n\t\t});\n\t};\n\tadapter.reconcileTerminal = async () => {};\n\tadapter.reconcileAll = async (ctx, results, cancelled) => {\n\t\tconst created = results.filter(({ current }) => !current.noChanges);\n\t\tconst merged = created.filter(({ current }) => current.delivery.terminalPullRequest?.merged);\n\t\tconst done = !cancelled && created.length > 0 && merged.length === created.length;\n\t\tconst projectKey = ctx.params.repositories[0].key;\n\t\tif (done && verificationOnMerge)\n\t\t\tawait ctx.callIntegrationTool(\"jira_transition_source_issue\", {\n\t\t\t\tprojectKey,\n\t\t\t\ttargetStatus: \"In Verification\",\n\t\t\t});\n\t\tif (!cancelled)\n\t\t\tawait ctx.callIntegrationTool(\"jira_finalize_source_issue\", {\n\t\t\t\tprojectKey,\n\t\t\t\tdone,\n\t\t\t\twriteKey: \"delivery-labels\",\n\t\t\t});\n\t};\n\tconst publication = createRepositoryChangePublication(adapter);\n\tpublication.fragment.watcher({\n\t\tid: \"use_leitwerk\",\n\t\tlabel: \"Jira use-leitwerk issues\",\n\t\tdescription: \"Coordinate changes across component-mapped GitLab repositories\",\n\t\tsource: jiraIssueWatcherSource,\n\t\tresolveLaunchConfig: launcher.resolve,\n\t\tpreparationChecks: launcher.checks,\n\t});\n\tconst { process } = createRepositoryChangeProcess<JiraGitLabParams>({\n\t\tprocessId: \"jira_gitlab_change_process\",\n\t\tdisplayName: \"Jira GitLab Change\",\n\t\tparamsCodec: jiraGitLabParamsCodec,\n\t\tpublication,\n\t\tworkflow: {\n\t\t\tmultiRepository: true,\n\t\t\tasync planDecision(params) {\n\t\t\t\tconst issue = await launcher.readIssue(params);\n\t\t\t\treturn {\n\t\t\t\t\tskip:\n\t\t\t\t\t\tjiraEligible(issue, params.jiraTriggerLabel) &&\n\t\t\t\t\t\tissue.fields.labels.includes(\"leitwerk-skip-plan-decision\"),\n\t\t\t\t\treason: \"Jira label\",\n\t\t\t\t};\n\t\t\t},\n\t\t\tasync simplification(params) {\n\t\t\t\tconst issue = await launcher.readIssue(params);\n\t\t\t\treturn {\n\t\t\t\t\tskip: issue.fields.labels.includes(\"leitwerk-skip-simplification\"),\n\t\t\t\t\treason: \"Jira source labels\",\n\t\t\t\t};\n\t\t\t},\n\t\t\tplanBypassSource: jiraIssuePolicy(({ params, state }) => ({\n\t\t\t\tprofile: params.jiraProfile,\n\t\t\t\tbaseUrl: params.jiraBaseUrl,\n\t\t\t\tissueId: params.issueId,\n\t\t\t\ttriggerLabel: params.jiraTriggerLabel,\n\t\t\t\tplanRevision: state.routing?.plan?.planRevision,\n\t\t\t\tmode: \"plan_bypass\",\n\t\t\t})),\n\t\t},\n\t\trepositoryCredentials: ({ params }) =>\n\t\t\tparams.repositories.flatMap((repo) =>\n\t\t\t\trepo.sshProfile\n\t\t\t\t\t? [{ projectKey: repo.key, kind: \"git_ssh\" as const, credentialRef: repo.sshProfile }]\n\t\t\t\t\t: gitlabRepositoryCredentials(repo.gitlabProfile, [repo]),\n\t\t\t),\n\t});\n\tprocess.runtime = { ...process.runtime, developmentTools: true, docker: options.docker };\n\tconst plan = process.turns.get(\"generate_plan\")?.definition;\n\tconst delivery = process.turns.get(\"deliver_change\")?.definition;\n\tif (plan?.kind !== \"llm\" || delivery?.kind !== \"automatic\")\n\t\tthrow new Error(\"Jira change requires planning and delivery turns\");\n\tplan.waitFor = launcher.ready;\n\tplan.resolveAskQuestions = ({ prepared }) => asUnknownRecord(prepared)?.skipPlanDecision !== true;\n\tplan.integrationTools = [\n\t\t...(plan.integrationTools ?? []),\n\t\t\"jira_get_source_issue\",\n\t\t\"jira_ensure_remote_link\",\n\t\t\"jira_transition_source_issue\",\n\t];\n\tconst originalPrepare = plan.prepare;\n\tplan.prepare = async (ctx) => {\n\t\tconst projectKey = ctx.params.repositories[0].key;\n\t\tconst issue = (await ctx\n\t\t\t.callIntegrationTool(\"jira_get_source_issue\", { projectKey })\n\t\t\t.catch(() => null)) as JiraIssue | null;\n\t\tawait ctx.callIntegrationTool(\"jira_ensure_remote_link\", { projectKey, kind: \"process\" });\n\t\tawait ctx.callIntegrationTool(\"jira_transition_source_issue\", {\n\t\t\tprojectKey,\n\t\t\ttargetStatus: \"In Progress\",\n\t\t});\n\t\treturn {\n\t\t\t...(asUnknownRecord(await originalPrepare?.(ctx)) ?? {}),\n\t\t\tskipPlanDecision: issue?.fields.labels.includes(\"leitwerk-skip-plan-decision\") ?? false,\n\t\t};\n\t};\n\tconst originalDelivery = delivery.run;\n\tdelivery.run = async (ctx) => {\n\t\tconst result = await originalDelivery(ctx);\n\t\tif (result.outcome === \"aborted\") return result;\n\t\tconst state = process.stateCodec.parse(result.params?.nextState);\n\t\tconst published = ctx.params.repositories.map((repo) => remote(state, repo.key));\n\t\tif (published.some((current) => current.prNumber)) {\n\t\t\tif (!ctx.callIntegrationTool) throw new Error(\"Jira integration tools are unavailable\");\n\t\t\t// Resumed runs may have marked issueLinked while delivery still used Jira comments.\n\t\t\tawait ctx.callIntegrationTool(\"jira_ensure_remote_link\", {\n\t\t\t\tprojectKey: ctx.params.repositories[0].key,\n\t\t\t\tkind: \"process\",\n\t\t\t});\n\t\t\tfor (const [index, current] of published.entries())\n\t\t\t\tif (current.prNumber && current.prUrl)\n\t\t\t\t\tawait ctx.callIntegrationTool(\"jira_ensure_remote_link\", {\n\t\t\t\t\t\tprojectKey: ctx.params.repositories[index].key,\n\t\t\t\t\t\tkind: \"merge_request\",\n\t\t\t\t\t});\n\t\t\tif (published.every((current) => current.noChanges || (current.prNumber && current.prUrl)))\n\t\t\t\tawait ctx.callIntegrationTool(\"jira_transition_source_issue\", {\n\t\t\t\t\tprojectKey: ctx.params.repositories[0].key,\n\t\t\t\t\ttargetStatus: \"In Review\",\n\t\t\t\t});\n\t\t}\n\t\treturn result;\n\t};\n\tfor (const binding of process.turns.values()) {\n\t\tconst turn = binding.definition;\n\t\tif (turn.kind !== \"llm\") continue;\n\t\tconst originalPrompt = turn.prompt;\n\t\tconst originalTools = turn.resolveIntegrationTools;\n\t\tturn.resolveIntegrationTools = (params, state) => [\n\t\t\t...(originalTools?.(params, state) ?? turn.integrationTools ?? []),\n\t\t\t\"jira_get_source_issue\",\n\t\t\t\"jira_get_issue\",\n\t\t\t...(params.wikiTopicId\n\t\t\t\t? [\"wiki_index\", \"wiki_read\", \"wiki_share\", \"wiki_edit\", \"wiki_delete\", \"wiki_delete_group\"]\n\t\t\t\t: []),\n\t\t];\n\t\tturn.prompt = async (ctx) =>\n\t\t\t`${await originalPrompt({ ...ctx, params: { ...ctx.params, prompt: jiraChangePrompt(ctx.params.issue) } })}${ctx.params.wikiTopicId ? `\\n\\n${wikiInstructions}\\nWiki: /wiki/${ctx.params.wikiTopicId}` : \"\"}`;\n\t}\n\tconst extension: LeitwerkExtensionModule = {\n\t\tmanifest: {\n\t\t\tid: \"jira-gitlab-change\",\n\t\t\tversion: \"0.3.0\",\n\t\t\trequires: [\"jira\", \"gitlab\", \"coding\"],\n\t\t},\n\t\tscopedSettings: { settings: [launcher.mapping] },\n\t\tsetupCatalog(api) {\n\t\t\tapi.registerProcess(process);\n\t\t},\n\t\tsetupServer(api, config) {\n\t\t\tconst verification = asUnknownRecord(config)?.verification_on_merge;\n\t\t\tif (verification !== undefined && typeof verification !== \"boolean\")\n\t\t\t\tthrow new Error(\"Jira verification_on_merge must be a boolean\");\n\t\t\tverificationOnMerge = verification ?? options.verificationOnMerge ?? false;\n\t\t\tadapter.maintenance?.register(api, process);\n\t\t\tconst jira = api.require(jiraIntegration),\n\t\t\t\tgitlab = api.require(gitlabIntegration),\n\t\t\t\tsettings = api.require(scopedSettingsCapability);\n\t\t\tif (Array.isArray(jira) || Array.isArray(gitlab) || Array.isArray(settings))\n\t\t\t\tthrow new Error(\"Integration capabilities must be singular\");\n\t\t\tconst wiki = api.require(topicWikiCapability);\n\t\t\tconst host = api.require(coreHostCapabilities.serverSetup);\n\t\t\tif (Array.isArray(wiki) || Array.isArray(host))\n\t\t\t\tthrow new Error(\"Integration capabilities must be singular\");\n\t\t\twiki.registerProcessSource(process.id, jiraWikiSource(wiki, jira));\n\t\t\tlauncher.configure({\n\t\t\t\tmodelLabels: parseJiraModelLabels(config),\n\t\t\t\tjira,\n\t\t\t\tgitlab,\n\t\t\t\tget ssh() {\n\t\t\t\t\tconst ssh = api.get(gitSshIntegration);\n\t\t\t\t\tif (Array.isArray(ssh)) throw new Error(\"Integration capabilities must be singular\");\n\t\t\t\t\treturn ssh;\n\t\t\t\t},\n\t\t\t\tsettings,\n\t\t\t\twiki,\n\t\t\t\tpublications: host.publications,\n\t\t\t});\n\t\t\tapi.onStop(() => launcher.configure(null));\n\t\t},\n\t};\n\treturn {\n\t\t/** @internal */\n\t\textension,\n\t\t/** @internal */\n\t\tprocess,\n\t\t/** @internal */\n\t\tlauncher,\n\t};\n}\n\n/** @public */\nexport const { extension: defaultExtension, process: jiraGitLabChangeProcess } =\n\tcreateJiraGitLabChange({ docker: true });\nexport default defaultExtension;\n","import { createHash } from \"node:crypto\";\nimport { isDeepStrictEqual } from \"node:util\";\nimport { asUnknownRecord, type SettingsSource } from \"@leitwerk-dev/domain\";\nimport type { PublicationStore } from \"@leitwerk-dev/external-writes\";\nimport { createGitSshPreparationCheck, type GitSshIntegration } from \"@leitwerk-dev/git-ssh\";\nimport {\n\tcreateGitLabRepositoryCatalog,\n\tGitLabError,\n\ttype GitLabIntegration,\n\ttype GitLabPublicationParams,\n\ttype GitLabRepositoryCatalog,\n\tresolveGitLabLaunchProject,\n} from \"@leitwerk-dev/gitlab\";\nimport {\n\tensureIssueWiki,\n\ttype JiraIntegration,\n\ttype JiraIssue,\n\tJiraRequestError,\n\ttype JiraWatcherEvent,\n\tjiraEligible,\n\tjiraIsEpic,\n\tjiraIssueExternalId,\n\tjiraSplitChildMatches,\n\tjiraSubjectIdentity,\n\tjiraToMarkdown,\n\tjiraTriggerLabel,\n} from \"@leitwerk-dev/jira\";\nimport {\n\ttype Codec,\n\ttype LauncherContext,\n\ttype LaunchPreparationCheck,\n\ttype ProcessLaunchConfig,\n\tRetryableWaitError,\n\trepositorySettingsIdentity,\n\tSafeLaunchPreparationError,\n\ttype ScopedSettingsResolver,\n\ttype SettingDefinition,\n\ttype TurnWaitContext,\n} from \"@leitwerk-dev/process-sdk\";\nimport type { TopicWikiStore } from \"@leitwerk-dev/wiki\";\n\nimport { selectJiraModel } from \"./models.js\";\n\nclass JiraSourceIneligibleError extends Error {\n\tconstructor() {\n\t\tsuper(\"Jira source issue is no longer eligible\");\n\t}\n}\n\nfunction eligibleSource(issue: JiraIssue, event: JiraWatcherEvent): boolean {\n\treturn (\n\t\tissue.id === event.issue.id &&\n\t\tjiraEligible(issue, event.triggerLabel) &&\n\t\tevent.projects.includes(issue.fields.project.id)\n\t);\n}\n\n/** @public */\nexport interface RepositoryMapping {\n\t/** @public */\n\torigin: string;\n\n\t/** @public */\n\tprojectId: number;\n\n\t/** @public */\n\tgitlabProfile: string;\n\n\t/** @public */\n\tsshProfile?: string;\n}\n\n/** @public */\nexport interface RepositoryBinding extends GitLabPublicationParams {\n\t/** @internal */\n\tkey: string;\n\n\t/** @internal */\n\torigin: \"jira\";\n\n\t/** @internal */\n\tgitlabOrigin: string;\n\n\t/** @internal */\n\tsshProfile?: string;\n\n\t/** @internal */\n\trepoLocator: string;\n}\n\n/** @public */\nexport interface JiraGitLabParams extends Partial<GitLabPublicationParams> {\n\t/** Present only until initial repository bindings are resolved. @internal */\n\tstartup?: {\n\t\t/** Captured watcher scope; later watcher edits do not retarget this process. @internal */\n\t\tprojectIds: string[];\n\t};\n\t/** @internal */\n\tjiraTriggerLabel?: string;\n\t/** @internal */\n\tmodelSelection?: {\n\t\t/** @internal */\n\t\tlabel: string;\n\t\t/** @internal */\n\t\tprofileId: string;\n\t};\n\t/** @internal */\n\twikiTopicId?: string;\n\t/** @internal */\n\torigin: \"jira\";\n\n\t/** @internal */\n\tjiraProfile: string;\n\n\t/** @internal */\n\tjiraBaseUrl: string;\n\n\t/** @internal */\n\tissueId: string;\n\n\t/** @internal */\n\tissueKey: string;\n\n\t/** @internal */\n\tissueUrl: string;\n\n\t/** @internal */\n\tprompt: string;\n\n\t/** @internal */\n\tissue: JiraIssue;\n\n\t/** @internal */\n\trepositories: RepositoryBinding[];\n\n\t/** @internal */\n\tmappings: {\n\t\t/** @internal */\n\t\tcomponentId: string;\n\t\t/** @internal */ values: string[];\n\t\t/** @internal */ sources: SettingsSource[];\n\t}[];\n}\n\n/** Builds Markdown from captured Jira evidence. @internal */\nexport function jiraChangePrompt(issue: JiraIssue): string {\n\treturn `${issue.key}: ${issue.fields.summary}\\n\\n${jiraToMarkdown(issue.fields.description)}`;\n}\n\nfunction admissionParams(params: JiraGitLabParams) {\n\tconst { id, key, fields } = params.issue;\n\t// Jira plugin fields can change on every read without an issue revision.\n\t// Keep the raw issue as evidence, but compare only the launch contract.\n\treturn {\n\t\t...params,\n\t\tissue: {\n\t\t\tid,\n\t\t\tkey,\n\t\t\tfields: {\n\t\t\t\tupdated: fields.updated,\n\t\t\t\tsummary: fields.summary,\n\t\t\t\tdescription: fields.description,\n\t\t\t\tlabels: [...fields.labels].sort(),\n\t\t\t\tproject: { id: fields.project.id, key: fields.project.key, name: fields.project.name },\n\t\t\t\tcomponents: fields.components.map(({ id, name }) => ({ id, name })),\n\t\t\t\tstatusCategory: fields.status.statusCategory.key,\n\t\t\t\tissuetype: fields.issuetype && {\n\t\t\t\t\tid: fields.issuetype.id,\n\t\t\t\t\tname: fields.issuetype.name,\n\t\t\t\t\tsubtask: fields.issuetype.subtask,\n\t\t\t\t},\n\t\t\t\tparent: fields.parent && { id: fields.parent.id, key: fields.parent.key },\n\t\t\t},\n\t\t},\n\t};\n}\n\n/** Decode a retained repository selection without remote discovery. @public */\nexport function decodeJiraGitLabRepositoryMapping(value: unknown): RepositoryMapping {\n\tif (typeof value !== \"string\") throw new Error(\"Select a repository and its GitLab profile\");\n\tlet r: Record<string, unknown> | null;\n\ttry {\n\t\tr = asUnknownRecord(JSON.parse(value));\n\t} catch {\n\t\tthrow new Error(\"Invalid repository mapping; reselect it in Settings\");\n\t}\n\treturn validateMapping(r);\n}\n\nfunction validateMapping(r: Record<string, unknown> | null): RepositoryMapping {\n\tif (\n\t\t!r ||\n\t\ttypeof r.origin !== \"string\" ||\n\t\tnew URL(r.origin).origin !== r.origin ||\n\t\ttypeof r.projectId !== \"number\" ||\n\t\t!Number.isSafeInteger(r.projectId) ||\n\t\tr.projectId <= 0 ||\n\t\ttypeof r.gitlabProfile !== \"string\" ||\n\t\t!r.gitlabProfile ||\n\t\t(r.sshProfile !== undefined && (typeof r.sshProfile !== \"string\" || !r.sshProfile))\n\t)\n\t\tthrow new Error(\"Invalid repository mapping; reselect it in Settings\");\n\treturn r as unknown as RepositoryMapping;\n}\n\n/** @public */\nexport const jiraGitLabParamsCodec: Codec<JiraGitLabParams> = {\n\tparse(value) {\n\t\tconst r = asUnknownRecord(value);\n\t\tjiraTriggerLabel(r?.jiraTriggerLabel);\n\t\tif (\n\t\t\tr?.origin !== \"jira\" ||\n\t\t\t!Array.isArray(r.repositories) ||\n\t\t\t(!r.repositories.length && !asUnknownRecord(r.startup)) ||\n\t\t\t!Array.isArray(r.mappings) ||\n\t\t\t!asUnknownRecord(r.issue)\n\t\t)\n\t\t\tthrow new Error(\"Invalid Jira GitLab launch snapshot\");\n\t\tfor (const key of [\"jiraProfile\", \"jiraBaseUrl\", \"issueId\", \"issueKey\", \"issueUrl\", \"prompt\"])\n\t\t\tif (typeof r[key] !== \"string\" || !r[key]) throw new Error(`Missing ${key}`);\n\t\tif (r.startup !== undefined) {\n\t\t\tconst startup = asUnknownRecord(r.startup);\n\t\t\tif (\n\t\t\t\tr.repositories.length ||\n\t\t\t\t!Array.isArray(startup?.projectIds) ||\n\t\t\t\t!startup.projectIds.length ||\n\t\t\t\tstartup.projectIds.some((id) => typeof id !== \"string\" || !id) ||\n\t\t\t\t[\n\t\t\t\t\t\"owner\",\n\t\t\t\t\t\"repo\",\n\t\t\t\t\t\"gitlabProfile\",\n\t\t\t\t\t\"projectId\",\n\t\t\t\t\t\"repoLocator\",\n\t\t\t\t\t\"baseBranch\",\n\t\t\t\t\t\"workBranch\",\n\t\t\t\t].some((key) => r[key] !== undefined)\n\t\t\t)\n\t\t\t\tthrow new Error(\"Invalid pending Jira repository binding\");\n\t\t}\n\t\tfor (const item of r.repositories) {\n\t\t\tconst repo = asUnknownRecord(item);\n\t\t\tif (!repo || typeof repo.key !== \"string\" || !/^[a-zA-Z0-9_-]+$/.test(repo.key))\n\t\t\t\tthrow new Error(\"Invalid repository key\");\n\t\t\tvalidateMapping({ ...repo, origin: repo.gitlabOrigin });\n\t\t\tfor (const key of [\"repoLocator\", \"owner\", \"repo\", \"baseBranch\", \"workBranch\"])\n\t\t\t\tif (typeof repo[key] !== \"string\" || !repo[key])\n\t\t\t\t\tthrow new Error(`Missing repository ${key}`);\n\t\t}\n\t\tif (new Set(r.repositories.map((repo) => repo.key)).size !== r.repositories.length)\n\t\t\tthrow new Error(\"Duplicate repository key\");\n\t\treturn r as unknown as JiraGitLabParams;\n\t},\n\tserialize: (value) => value,\n};\n\n/** Component-to-repository Settings contract. Register it only through this extension. @public */\nexport const jiraGitLabRepositories: SettingDefinition<string[]> = {\n\tkey: \"jira-gitlab-change.repositories\",\n\tschemaVersion: 1,\n\tscopes: [\"jira.component\"],\n\tmerge: \"replace\",\n\tdefaultValue: [],\n\tform: {\n\t\tlabel: \"GitLab repositories\",\n\t\tgroup: \"Repository mapping\",\n\t\tcontrol: \"multiselect\",\n\t\toverview: \"repository-mapping\",\n\t\tsearch: { minimumLength: 2, placeholder: \"Search GitLab repositories\" },\n\t\tdescription: \"Use the GitLab profile's token over HTTPS, or select a configured SSH profile.\",\n\t},\n\tschema: {\n\t\tparse(value) {\n\t\t\tif (!Array.isArray(value)) throw new Error(\"Choose repositories\");\n\t\t\tfor (const entry of value) decodeJiraGitLabRepositoryMapping(entry);\n\t\t\treturn [...new Set(value)] as string[];\n\t\t},\n\t},\n};\n\n/** @public */\nexport function createJiraGitLabLauncher() {\n\t/** @internal */\n\tlet services: {\n\t\t/** @internal */\n\t\tjira: JiraIntegration;\n\n\t\t/** @internal */\n\t\tgitlab: GitLabIntegration;\n\n\t\t/** @internal */\n\t\tssh?: GitSshIntegration;\n\n\t\t/** @internal */\n\t\tsettings: ScopedSettingsResolver;\n\t\t/** @internal */\n\t\twiki?: TopicWikiStore;\n\t\t/** @internal */\n\t\tpublications?: PublicationStore;\n\t\t/** @internal */\n\t\tmodelLabels?: Readonly<Record<string, string>>;\n\t} | null = null;\n\tlet repositoryCatalog: GitLabRepositoryCatalog | null = null;\n\tconst requireServices = () => {\n\t\tif (!services) throw new Error(\"Jira GitLab integration is not configured\");\n\t\treturn services;\n\t};\n\tconst mapping: SettingDefinition<string[]> = {\n\t\t...jiraGitLabRepositories,\n\t\tchoiceLabel(value) {\n\t\t\tconst mapping = decodeJiraGitLabRepositoryMapping(value);\n\t\t\tconst { gitlab, settings } = requireServices();\n\t\t\tconst retained = settings.findSubject(\n\t\t\t\t\"repository\",\n\t\t\t\trepositorySettingsIdentity(mapping.origin, mapping.projectId),\n\t\t\t);\n\t\t\tlet path = retained?.label;\n\t\t\tif (!path) {\n\t\t\t\tconst known = gitlab.profiles().includes(mapping.gitlabProfile)\n\t\t\t\t\t? repositoryCatalog?.peek(mapping.gitlabProfile, mapping.projectId)\n\t\t\t\t\t: undefined;\n\t\t\t\tpath =\n\t\t\t\t\tknown && gitlab.client(mapping.gitlabProfile).baseUrl === mapping.origin\n\t\t\t\t\t\t? known.path_with_namespace\n\t\t\t\t\t\t: `Repository ${mapping.projectId}`;\n\t\t\t}\n\t\t\treturn `${path} · ${mapping.gitlabProfile} / ${mapping.sshProfile ?? \"HTTPS\"}`;\n\t\t},\n\t\tasync choices(_context, request = {}) {\n\t\t\tconst { gitlab, ssh, settings } = requireServices();\n\t\t\tif (!repositoryCatalog) throw new Error(\"GitLab repository catalog is not configured\");\n\t\t\tconst query = (request.search ?? \"\").trim();\n\t\t\tif (query.length < 2) return [];\n\t\t\tconst choices = [];\n\t\t\tfor (const gitlabProfile of gitlab.profiles()) {\n\t\t\t\tconst client = gitlab.client(gitlabProfile);\n\t\t\t\tconst projects = [...(await repositoryCatalog.search(gitlabProfile, query))];\n\t\t\t\tfor (const value of request.values ?? []) {\n\t\t\t\t\tconst selected = decodeJiraGitLabRepositoryMapping(value);\n\t\t\t\t\tif (\n\t\t\t\t\t\tselected.gitlabProfile !== gitlabProfile ||\n\t\t\t\t\t\tselected.origin !== client.baseUrl ||\n\t\t\t\t\t\tprojects.some((repo) => repo.id === selected.projectId)\n\t\t\t\t\t)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tconst project = repositoryCatalog.peek(gitlabProfile, selected.projectId);\n\t\t\t\t\tif (project) projects.push(project);\n\t\t\t\t}\n\t\t\t\tfor (const repo of projects) {\n\t\t\t\t\tif (repo.archived || !repo.default_branch) continue;\n\t\t\t\t\tsettings.discover({\n\t\t\t\t\t\tscopeType: \"repository\",\n\t\t\t\t\t\tidentity: repositorySettingsIdentity(client.baseUrl, repo.id),\n\t\t\t\t\t\tlabel: repo.path_with_namespace,\n\t\t\t\t\t});\n\t\t\t\t\tif (repo.http_url_to_repo)\n\t\t\t\t\t\tchoices.push({\n\t\t\t\t\t\t\tvalue: JSON.stringify({ origin: client.baseUrl, projectId: repo.id, gitlabProfile }),\n\t\t\t\t\t\t\tlabel: `${repo.path_with_namespace} · ${gitlabProfile} / HTTPS`,\n\t\t\t\t\t\t});\n\t\t\t\t\tif (!repo.ssh_url_to_repo) continue;\n\t\t\t\t\tfor (const sshProfile of ssh?.profiles() ?? [])\n\t\t\t\t\t\tchoices.push({\n\t\t\t\t\t\t\tvalue: JSON.stringify({\n\t\t\t\t\t\t\t\torigin: client.baseUrl,\n\t\t\t\t\t\t\t\tprojectId: repo.id,\n\t\t\t\t\t\t\t\tgitlabProfile,\n\t\t\t\t\t\t\t\tsshProfile,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tlabel: `${repo.path_with_namespace} · ${gitlabProfile} / ${sshProfile}`,\n\t\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const value of request.values ?? [])\n\t\t\t\tif (!choices.some((choice) => choice.value === value))\n\t\t\t\t\tchoices.push({ value, label: mapping.choiceLabel?.(value) ?? value });\n\t\t\treturn choices;\n\t\t},\n\t};\n\n\t/** @internal */\n\tasync function resolve(\n\t\tevent: JiraWatcherEvent,\n\t\tctx: LauncherContext = {},\n\t\tretained?: JiraGitLabParams,\n\t\tsignal?: AbortSignal,\n\t): Promise<ProcessLaunchConfig<JiraGitLabParams>> {\n\t\tconst { jira, gitlab, ssh, settings, wiki, publications } = requireServices();\n\t\tconst client = jira.client(event.profile);\n\t\tconst issue = await client.getIssue(event.issue.id, signal);\n\t\tif (!eligibleSource(issue, event)) throw new JiraSourceIneligibleError();\n\t\tconst triggerLabel = jiraTriggerLabel(event.triggerLabel);\n\t\tconst modelSelection = retained\n\t\t\t? retained.modelSelection\n\t\t\t: selectJiraModel(issue.fields.labels, requireServices().modelLabels ?? {});\n\t\tif (\n\t\t\tmodelSelection &&\n\t\t\tctx.modelProfiles &&\n\t\t\t!ctx.modelProfiles.some((p) => p.id === modelSelection.profileId)\n\t\t)\n\t\t\tthrow new Error(\n\t\t\t\t`Jira model profile ${modelSelection.profileId} is unavailable for this process`,\n\t\t\t);\n\t\tconst project = settings.discover({\n\t\t\tscopeType: \"jira.project\",\n\t\t\tidentity: jiraSubjectIdentity(client.baseUrl, issue.fields.project.id),\n\t\t\tlabel: issue.fields.project.key,\n\t\t});\n\t\tconst source = {\n\t\t\torigin: \"jira\" as const,\n\t\t\tjiraTriggerLabel: triggerLabel,\n\t\t\t...(modelSelection ? { modelSelection } : {}),\n\t\t\tjiraProfile: event.profile,\n\t\t\tjiraBaseUrl: client.baseUrl,\n\t\t\tissueId: issue.id,\n\t\t\tissueKey: issue.key,\n\t\t\tissueUrl: `${client.baseUrl}/browse/${encodeURIComponent(issue.key)}`,\n\t\t\tprompt: jiraChangePrompt(issue),\n\t\t\tissue,\n\t\t};\n\t\tconst launch = {\n\t\t\tprocessId: \"jira_gitlab_change_process\",\n\t\t\tdefaultModelProfileId: modelSelection?.profileId,\n\t\t\ttitle: `${issue.key}: ${issue.fields.summary}`,\n\t\t\tstartTurnId: \"generate_plan\",\n\t\t\texternalId: jiraIssueExternalId(client.baseUrl, issue.id),\n\t\t\texternalUrl: source.issueUrl,\n\t\t\tsettingsContext: { \"jira.project\": project.id },\n\t\t};\n\t\tconst mappings: JiraGitLabParams[\"mappings\"] = [];\n\t\tconst selected = new Map<string, RepositoryMapping>();\n\t\tconst publication = publications?.publicationByExternalId(\n\t\t\tjiraIssueExternalId(client.baseUrl, issue.id),\n\t\t);\n\t\tconst componentPublication = publication && typeof publication.binding.componentId === \"string\";\n\t\tif (\n\t\t\tcomponentPublication &&\n\t\t\t(issue.fields.components.length !== 1 ||\n\t\t\t\tissue.fields.components[0].id !== publication.binding.componentId)\n\t\t)\n\t\t\tthrow new Error(\"Generated ticket's component identity changed\");\n\t\tfor (const component of issue.fields.components) {\n\t\t\tconst subject = settings.discover({\n\t\t\t\tscopeType: \"jira.component\",\n\t\t\t\tidentity: jiraSubjectIdentity(client.baseUrl, component.id),\n\t\t\t\tlabel: `${issue.fields.project.key} / ${component.name}`,\n\t\t\t\tcontext: { \"jira.project\": project.id },\n\t\t\t});\n\t\t\tconst resolved = settings.resolve(mapping, {\n\t\t\t\t\"jira.project\": project.id,\n\t\t\t\t\"jira.component\": subject.id,\n\t\t\t});\n\t\t\tmappings.push({\n\t\t\t\tcomponentId: component.id,\n\t\t\t\tvalues: resolved.value,\n\t\t\t\tsources: resolved.sources,\n\t\t\t});\n\t\t}\n\t\tif (!mappings.length || mappings.some((mapping) => !mapping.values.length)) {\n\t\t\treturn {\n\t\t\t\t...launch,\n\t\t\t\tprojects: [],\n\t\t\t\tparams: {\n\t\t\t\t\t...source,\n\t\t\t\t\tmappings,\n\t\t\t\t\trepositories: [],\n\t\t\t\t\tstartup: { projectIds: [...event.projects] },\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tfor (const mapping of mappings) {\n\t\t\tfor (const value of mapping.values) {\n\t\t\t\tconst entry = decodeJiraGitLabRepositoryMapping(value);\n\t\t\t\tif (\n\t\t\t\t\tpublication &&\n\t\t\t\t\t!componentPublication &&\n\t\t\t\t\t(entry.origin !== publication.binding.origin ||\n\t\t\t\t\t\tentry.projectId !== publication.binding.projectId)\n\t\t\t\t)\n\t\t\t\t\tcontinue;\n\t\t\t\tconst key = repositorySettingsIdentity(entry.origin, entry.projectId);\n\t\t\t\tconst prior = selected.get(key);\n\t\t\t\tif (\n\t\t\t\t\tprior &&\n\t\t\t\t\t(prior.gitlabProfile !== entry.gitlabProfile || prior.sshProfile !== entry.sshProfile)\n\t\t\t\t)\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Conflicting profiles for project ${entry.projectId}; correct the component mappings in Settings`,\n\t\t\t\t\t);\n\t\t\t\tselected.set(key, entry);\n\t\t\t}\n\t\t}\n\t\tif (publication && !componentPublication) {\n\t\t\tconst binding = publication.binding;\n\t\t\tconst exact = [...selected.entries()].find(\n\t\t\t\t([, entry]) =>\n\t\t\t\t\tentry.origin === binding.origin &&\n\t\t\t\t\tentry.projectId === binding.projectId &&\n\t\t\t\t\tentry.gitlabProfile === binding.gitlabProfile &&\n\t\t\t\t\t(binding.sshProfile === undefined || entry.sshProfile === binding.sshProfile),\n\t\t\t);\n\t\t\tif (!exact)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Generated ticket's repository binding no longer matches its component mappings\",\n\t\t\t\t);\n\t\t\tselected.clear();\n\t\t\tselected.set(...exact);\n\t\t}\n\t\tif (!selected.size)\n\t\t\tthrow new Error(\n\t\t\t\t`No repositories mapped for ${issue.key}. Map at least one component in Settings → Jira components.`,\n\t\t\t);\n\t\tconst repositories: RepositoryBinding[] = [];\n\t\tconst projects: import(\"@leitwerk-dev/process-sdk\").ProcessLaunchProjectConfig[] = [];\n\t\tfor (const entry of selected.values()) {\n\t\t\tconst provider = gitlab.client(entry.gitlabProfile);\n\t\t\tif (\n\t\t\t\tprovider.baseUrl !== entry.origin ||\n\t\t\t\t(entry.sshProfile !== undefined && !ssh?.profiles().includes(entry.sshProfile))\n\t\t\t)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Unavailable mapping for GitLab project ${entry.projectId}; update its profiles in Settings`,\n\t\t\t\t);\n\t\t\tconst repo = await provider.getProject(entry.projectId, signal);\n\t\t\tif (repo.id !== entry.projectId) throw new Error(\"GitLab repository identity changed\");\n\t\t\tconst repoLocator = entry.sshProfile ? repo.ssh_url_to_repo : repo.http_url_to_repo;\n\t\t\tif (repo.archived || !repo.default_branch || !repoLocator)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`GitLab project ${entry.projectId} must be active and provide the selected clone URL`,\n\t\t\t\t);\n\t\t\tif (\n\t\t\t\tpublication &&\n\t\t\t\t!componentPublication &&\n\t\t\t\t((publication.binding.repoLocator !== undefined &&\n\t\t\t\t\trepoLocator !== publication.binding.repoLocator) ||\n\t\t\t\t\t(publication.binding.repository !== undefined &&\n\t\t\t\t\t\trepo.path_with_namespace !== publication.binding.repository) ||\n\t\t\t\t\trepo.default_branch !== publication.binding.baseBranch)\n\t\t\t)\n\t\t\t\tthrow new Error(\"Generated ticket's repository checkout binding changed\");\n\t\t\tconst key = `repo_${repositories.length + 1}`;\n\t\t\tconst { params: binding, project } = await resolveGitLabLaunchProject(\n\t\t\t\tprovider,\n\t\t\t\tentry.gitlabProfile,\n\t\t\t\t{ ...repo, id: entry.projectId },\n\t\t\t\t`leitwerk/jira-${createHash(\"sha256\").update(client.baseUrl).digest(\"hex\").slice(0, 10)}-${issue.id}`,\n\t\t\t\tkey,\n\t\t\t\tentry.sshProfile ? \"ssh\" : \"https\",\n\t\t\t);\n\t\t\tif (\n\t\t\t\tpublication?.binding.workBranch !== undefined &&\n\t\t\t\tpublication.binding.workBranch !== binding.workBranch\n\t\t\t)\n\t\t\t\tthrow new Error(\"Generated ticket's repository work branch binding changed\");\n\t\t\trepositories.push({ ...binding, key, origin: \"jira\", sshProfile: entry.sshProfile });\n\t\t\tprojects.push({\n\t\t\t\t...project,\n\t\t\t\tmetadata: {\n\t\t\t\t\t...project.metadata,\n\t\t\t\t\tjira: {\n\t\t\t\t\t\tprofile: event.profile,\n\t\t\t\t\t\tbaseUrl: client.baseUrl,\n\t\t\t\t\t\tissueId: issue.id,\n\t\t\t\t\t\ttriggerLabel,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t\tconst first = repositories[0];\n\t\tlet sourceIssue: JiraIssue | null = null;\n\t\tif (publication) {\n\t\t\tconst sourceIssueId = publication.binding.sourceIssueId ?? publication.binding.epicId;\n\t\t\tconst relationship = publication.binding.relationship ?? \"epic\";\n\t\t\tif (\n\t\t\t\ttypeof sourceIssueId !== \"string\" ||\n\t\t\t\t(relationship !== \"epic\" && relationship !== \"subtask\") ||\n\t\t\t\t!(await jiraSplitChildMatches(client, issue, sourceIssueId, relationship))\n\t\t\t)\n\t\t\t\tthrow new Error(\"Generated ticket's source issue binding changed\");\n\t\t\tsourceIssue = await client.getIssue(sourceIssueId);\n\t\t\tif (\n\t\t\t\tsourceIssue.id !== sourceIssueId ||\n\t\t\t\tsourceIssue.fields.project.id !== issue.fields.project.id ||\n\t\t\t\tsourceIssue.fields.issuetype?.subtask === true ||\n\t\t\t\tjiraIsEpic(sourceIssue) !== (relationship === \"epic\")\n\t\t\t)\n\t\t\t\tthrow new Error(\"Generated ticket's source issue binding changed\");\n\t\t} else if (wiki && issue.fields.issuetype?.subtask === true) {\n\t\t\tif (!issue.fields.parent?.id) throw new Error(\"Jira subtask parent is unavailable\");\n\t\t\tsourceIssue = await client.getIssue(issue.fields.parent.id);\n\t\t} else if (wiki && client.getEpic) {\n\t\t\tsourceIssue = await client.getEpic(issue);\n\t\t}\n\t\tconst topic =\n\t\t\twiki && sourceIssue ? ensureIssueWiki(wiki, client, sourceIssue, publication?.topicId) : null;\n\t\tif (publication && topic?.id !== publication.topicId)\n\t\t\tthrow new Error(\"Generated ticket's source issue wiki binding changed\");\n\t\tconst params: JiraGitLabParams = {\n\t\t\t...(topic ? { wikiTopicId: topic.id } : {}),\n\t\t\t...first,\n\t\t\t...source,\n\t\t\tmappings,\n\t\t\trepositories,\n\t\t};\n\t\treturn {\n\t\t\t...launch,\n\t\t\t...(topic && sourceIssue\n\t\t\t\t? {\n\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\twiki: {\n\t\t\t\t\t\t\t\ttopicId: topic.id,\n\t\t\t\t\t\t\t\tprofile: event.profile,\n\t\t\t\t\t\t\t\tbaseUrl: client.baseUrl,\n\t\t\t\t\t\t\t\tissueId: sourceIssue.id,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\tparams,\n\t\t\tprojects,\n\t\t};\n\t}\n\tconst checks = (\n\t\tevent: JiraWatcherEvent,\n\t\tlaunch: ProcessLaunchConfig<JiraGitLabParams>,\n\t\tretained?: JiraGitLabParams,\n\t): readonly LaunchPreparationCheck<JiraGitLabParams>[] => [\n\t\t...launch.params.repositories.map<LaunchPreparationCheck<JiraGitLabParams>>((repo) => ({\n\t\t\tid: `${repo.sshProfile ? \"ssh\" : \"https\"}_${repo.key}`,\n\t\t\tlabel: `Verify ${repo.owner}/${repo.repo} ${repo.sshProfile ? \"SSH\" : \"HTTPS\"} read/write access`,\n\t\t\tasync run(ctx) {\n\t\t\t\tconst { gitlab, ssh } = requireServices();\n\t\t\t\tconst client = gitlab.client(repo.gitlabProfile);\n\t\t\t\tconst fresh = await client.getProject(repo.projectId, ctx.signal);\n\t\t\t\tif (\n\t\t\t\t\tclient.baseUrl !== repo.gitlabOrigin ||\n\t\t\t\t\tfresh.id !== repo.projectId ||\n\t\t\t\t\tfresh.archived ||\n\t\t\t\t\t(repo.sshProfile ? fresh.ssh_url_to_repo : fresh.http_url_to_repo) !== repo.repoLocator ||\n\t\t\t\t\tfresh.default_branch !== repo.baseBranch\n\t\t\t\t)\n\t\t\t\t\tthrow new SafeLaunchPreparationError(\n\t\t\t\t\t\t\"Repository changed\",\n\t\t\t\t\t\t\"Refresh the component mapping and retry launch.\",\n\t\t\t\t\t);\n\t\t\t\tif (!repo.sshProfile) {\n\t\t\t\t\tawait client.preflightRepository(\n\t\t\t\t\t\trepo.projectId,\n\t\t\t\t\t\trepo.baseBranch,\n\t\t\t\t\t\trepo.workBranch,\n\t\t\t\t\t\tctx.signal,\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (!ssh) throw new Error(\"Git SSH profile is unavailable\");\n\t\t\t\tawait createGitSshPreparationCheck(\n\t\t\t\t\t\"write\",\n\t\t\t\t\t{ ...repo, sshCredentialRef: repo.sshProfile },\n\t\t\t\t\t() => ssh,\n\t\t\t\t).run(ctx);\n\t\t\t},\n\t\t})),\n\t\t{\n\t\t\tid: \"jira_eligibility\",\n\t\t\tlabel: \"Recheck Jira issue and component mappings\",\n\t\t\tasync run({ signal }) {\n\t\t\t\tif (launch.params.startup) {\n\t\t\t\t\tconst issue = await requireServices()\n\t\t\t\t\t\t.jira.client(event.profile)\n\t\t\t\t\t\t.getIssue(event.issue.id, signal);\n\t\t\t\t\tif (!eligibleSource(issue, event))\n\t\t\t\t\t\tthrow new SafeLaunchPreparationError(\n\t\t\t\t\t\t\t\"Jira source issue is no longer eligible\",\n\t\t\t\t\t\t\t\"Restore the watcher label and project eligibility before launching.\",\n\t\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst fresh = await resolve(event, {}, retained, signal);\n\t\t\t\tif (!isDeepStrictEqual(admissionParams(fresh.params), admissionParams(launch.params)))\n\t\t\t\t\tthrow new SafeLaunchPreparationError(\n\t\t\t\t\t\t\"Jira issue or mappings changed before admission\",\n\t\t\t\t\t\t\"Retry launch to capture the latest issue and mappings.\",\n\t\t\t\t\t);\n\t\t\t},\n\t\t},\n\t];\n\t/** Check startup readiness against the current source and mappings. @internal */\n\tasync function ready(\n\t\tcontext: Pick<\n\t\t\tTurnWaitContext<JiraGitLabParams>,\n\t\t\t\"params\" | \"signal\" | \"waiting\" | \"abort\" | \"bindInitialProjects\"\n\t\t>,\n\t) {\n\t\tconst { params, signal } = context;\n\t\tif (!params.startup) return true;\n\t\ttry {\n\t\t\tconst client = requireServices().jira.client(params.jiraProfile);\n\t\t\tif (client.baseUrl !== params.jiraBaseUrl) throw new Error(\"Jira installation changed\");\n\t\t\tconst issue = await client.getIssue(params.issueId, signal);\n\t\t\tif (issue.id !== params.issueId) throw new Error(\"Jira issue identity changed\");\n\t\t\tconst event: JiraWatcherEvent = {\n\t\t\t\tprofile: params.jiraProfile,\n\t\t\t\ttriggerLabel: params.jiraTriggerLabel,\n\t\t\t\tprojects: params.startup.projectIds,\n\t\t\t\tissue,\n\t\t\t};\n\t\t\tif (!eligibleSource(issue, event))\n\t\t\t\treturn context.abort(\"Jira source is no longer eligible; startup cancelled\");\n\t\t\tconst launch = await resolve(event, {}, params, signal);\n\t\t\tif (launch.params.startup) {\n\t\t\t\tconst missing = launch.params.issue.fields.components.filter(\n\t\t\t\t\t(component) =>\n\t\t\t\t\t\t!launch.params.mappings.find((mapping) => mapping.componentId === component.id)?.values\n\t\t\t\t\t\t\t.length,\n\t\t\t\t);\n\t\t\t\tconst reason = missing.length\n\t\t\t\t\t? `no GitLab repository mapping for ${missing.map((component) => component.name).join(\", \")}. Configure GitLab repositories in Settings → Jira components.`\n\t\t\t\t\t: \"no Jira components. Assign at least one component to the issue and configure its GitLab repositories in Settings → Jira components.\";\n\t\t\t\treturn context.waiting(\n\t\t\t\t\t`Startup blocked: ${launch.params.issueKey} has ${reason} Startup will resume automatically.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tfor (const check of checks(event, launch, params)) {\n\t\t\t\tsignal.throwIfAborted();\n\t\t\t\tawait check.run({ signal, launchConfig: launch, logger: { info() {}, warn() {} } });\n\t\t\t}\n\t\t\treturn context.bindInitialProjects({\n\t\t\t\tparams: launch.params,\n\t\t\t\tprojects: launch.projects ?? [],\n\t\t\t\tmetadata: launch.metadata,\n\t\t\t\tsettingsContext: launch.settingsContext,\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tif (error instanceof JiraSourceIneligibleError)\n\t\t\t\treturn context.abort(\"Jira source is no longer eligible; startup cancelled\");\n\t\t\tif (\n\t\t\t\t(error instanceof GitLabError && error.retryable) ||\n\t\t\t\t(error instanceof JiraRequestError &&\n\t\t\t\t\t(error.status === 408 || error.status === 429 || error.status >= 500)) ||\n\t\t\t\t(error instanceof TypeError && /fetch|network/i.test(error.message))\n\t\t\t)\n\t\t\t\tthrow new RetryableWaitError(\n\t\t\t\t\t\"Jira or GitLab is temporarily unavailable; startup will be checked again.\",\n\t\t\t\t);\n\t\t\tif (\n\t\t\t\terror instanceof SafeLaunchPreparationError &&\n\t\t\t\terror.message.includes(\"changed before admission\")\n\t\t\t)\n\t\t\t\treturn context.waiting(\n\t\t\t\t\t\"Jira issue or mappings changed during startup checks. Checking the latest configuration again.\",\n\t\t\t\t);\n\t\t\tif (error instanceof SafeLaunchPreparationError)\n\t\t\t\tthrow new Error(`${error.message}. ${error.safeSummary}`);\n\t\t\tthrow error;\n\t\t}\n\t}\n\treturn {\n\t\t/** @internal */\n\t\tready,\n\t\t/** @internal */\n\t\tmapping,\n\n\t\t/** @internal */\n\t\tresolve,\n\n\t\t/** @internal */\n\t\tchecks,\n\n\t\t/** @internal */\n\t\tconfigure(value: typeof services) {\n\t\t\tif (value?.gitlab !== services?.gitlab)\n\t\t\t\trepositoryCatalog = value\n\t\t\t\t\t? (value.gitlab.repositoryCatalog ?? createGitLabRepositoryCatalog(value.gitlab))\n\t\t\t\t\t: null;\n\t\t\tservices = value;\n\t\t},\n\n\t\t/** @internal */\n\t\tasync readIssue(params: JiraGitLabParams) {\n\t\t\tconst client = requireServices().jira.client(params.jiraProfile);\n\t\t\tif (client.baseUrl !== params.jiraBaseUrl) throw new Error(\"Jira installation changed\");\n\t\t\treturn client.getIssue(params.issueId);\n\t\t},\n\t};\n}\n","import { asUnknownRecord } from \"@leitwerk-dev/domain\";\n\n/** @internal */\nexport function parseJiraModelLabels(config: unknown): Readonly<Record<string, string>> {\n\tconst raw = asUnknownRecord(config)?.model_labels;\n\tif (raw === undefined) return {};\n\tconst labels = asUnknownRecord(raw);\n\tif (!labels) throw new Error(\"Jira model_labels must map labels to model profile IDs\");\n\tconst result: Record<string, string> = {};\n\tfor (const [label, profile] of Object.entries(labels)) {\n\t\tif (\n\t\t\t!/^leitwerk-model-[a-z0-9]+(?:-[a-z0-9]+)*$/.test(label) ||\n\t\t\ttypeof profile !== \"string\" ||\n\t\t\t!profile.trim()\n\t\t)\n\t\t\tthrow new Error(\"Jira model_labels requires leitwerk-model-* labels and model profile IDs\");\n\t\tresult[label] = profile.trim();\n\t}\n\treturn result;\n}\n\n/** @internal */\nexport function selectJiraModel(\n\tlabels: readonly string[],\n\tprofiles: Readonly<Record<string, string>>,\n) {\n\tconst selected = [...new Set(labels.filter((label) => label.startsWith(\"leitwerk-model-\")))];\n\tif (selected.length > 1)\n\t\tthrow new Error(\"Select only one leitwerk-model-* label before starting the change\");\n\tconst label = selected[0];\n\tif (!label) return undefined;\n\tconst profileId = profiles[label];\n\tif (!profileId) throw new Error(`Unknown Jira model label ${label}; correct the label and retry`);\n\treturn { label, profileId };\n}\n"],"mappings":";AAAA,SAAS,qCAAqC;AAC9C;AAAA,EACC;AAAA,EACA;AAAA,OACM;AAEP,SAAS,mBAAAA,wBAAuB;AAChC,SAAS,yBAAyB;AAClC;AAAA,EACC;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EAEC,gBAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACC;AAAA,EAEA;AAAA,OACM;AACP,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;;;AC7BpC,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;AAClC,SAAS,mBAAAC,wBAA4C;AAErD,SAAS,oCAA4D;AACrE;AAAA,EACC;AAAA,EACA;AAAA,EAIA;AAAA,OACM;AACP;AAAA,EACC;AAAA,EAGA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EAKC;AAAA,EACA;AAA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MAAM,KAAK,MAAM,QAAQ,QAAQ;AACzE,cAAM,IAAI,MAAM,2CAA2C;AAC5D,YAAM,OAAO,IAAI,QAAQ,mBAAmB;AAC5C,YAAM,OAAO,IAAI,QAAQ,qBAAqB,WAAW;AACzD,UAAI,MAAM,QAAQ,IAAI,KAAK,MAAM,QAAQ,IAAI;AAC5C,cAAM,IAAI,MAAM,2CAA2C;AAC5D,WAAK,sBAAsB,QAAQ,IAAI,eAAe,MAAM,IAAI,CAAC;AACjE,eAAS,UAAU;AAAA,QAClB,aAAa,qBAAqB,MAAM;AAAA,QACxC;AAAA,QACA;AAAA,QACA,IAAI,MAAM;AACT,gBAAM,MAAM,IAAI,IAAI,iBAAiB;AACrC,cAAI,MAAM,QAAQ,GAAG,EAAG,OAAM,IAAI,MAAM,2CAA2C;AACnF,iBAAO;AAAA,QACR;AAAA,QACA;AAAA,QACA;AAAA,QACA,cAAc,KAAK;AAAA,MACpB,CAAC;AACD,UAAI,OAAO,MAAM,SAAS,UAAU,IAAI,CAAC;AAAA,IAC1C;AAAA,EACD;AACA,SAAO;AAAA;AAAA,IAEN;AAAA;AAAA,IAEA;AAAA;AAAA,IAEA;AAAA,EACD;AACD;AAGO,IAAM,EAAE,WAAW,kBAAkB,SAAS,wBAAwB,IAC5E,uBAAuB,EAAE,QAAQ,KAAK,CAAC;AACxC,IAAO,gBAAQ;","names":["asUnknownRecord","jiraEligible","asUnknownRecord","label","id","asUnknownRecord","mapping","project","jiraEligible","asUnknownRecord"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/launch.ts","../src/models.ts"],"sourcesContent":["import { createRepositoryChangeProcess } from \"@leitwerk-dev/coding\";\nimport {\n\tcreateRepositoryChangePublication,\n\treadPublicationState,\n} from \"@leitwerk-dev/coding/repository-change-publication\";\nimport type { RepositoryChangeState } from \"@leitwerk-dev/coding/repository-change-state\";\nimport { asUnknownRecord } from \"@leitwerk-dev/domain\";\nimport { gitSshIntegration } from \"@leitwerk-dev/git-ssh\";\nimport {\n\tcreateGitLabPublicationAdapter,\n\ttype GitLabMergeRequest,\n\tgitlabIntegration,\n\tgitlabPublicationRequest,\n\tgitlabRepositoryCredentials,\n} from \"@leitwerk-dev/gitlab\";\nimport {\n\ttype JiraIssue,\n\tjiraEligible,\n\tjiraIntegration,\n\tjiraIssuePolicy,\n\tjiraIssueWatcherSource,\n\tjiraWikiSource,\n} from \"@leitwerk-dev/jira\";\nimport {\n\tcoreHostCapabilities,\n\ttype LeitwerkExtensionModule,\n\tscopedSettingsCapability,\n} from \"@leitwerk-dev/process-sdk\";\nimport { wikiInstructions, wikiToolNames } from \"@leitwerk-dev/wiki\";\nimport { topicWikiCapability } from \"@leitwerk-dev/wiki/integration\";\nimport {\n\tcreateJiraGitLabLauncher,\n\ttype JiraGitLabParams,\n\tjiraChangePrompt,\n\tjiraGitLabParamsCodec,\n} from \"./launch.js\";\nimport { parseJiraModelLabels } from \"./models.js\";\n\nexport * from \"./launch.js\";\n\nconst namespace = \"jiraGitLabChange\";\nconst remote = (state: RepositoryChangeState, key: string) =>\n\treadPublicationState(state, `${namespace}:${key}`);\n\n/** @public */\nexport function createJiraGitLabChange(options: {\n\t/** @internal */\n\tdocker: boolean;\n\t/** Opt into the supported Jira verification transition after all changed MRs merge. @internal */\n\tverificationOnMerge?: boolean;\n\t/** Destination for enabled completion transitions. @internal */\n\tverificationStatus?: \"In Verification\" | \"Ready for Verification\";\n}) {\n\tlet verificationOnMerge = options.verificationOnMerge ?? false;\n\tlet verificationStatus = options.verificationStatus ?? \"In Verification\";\n\tconst launcher = createJiraGitLabLauncher();\n\tconst adapter = createGitLabPublicationAdapter<JiraGitLabParams>([], namespace);\n\tadapter.ensureRequest = async (ctx) => {\n\t\tconst { url } = (await ctx.callIntegrationTool(\"jira_ensure_remote_link\", {\n\t\t\tprojectKey: \"repo\",\n\t\t\tkind: \"process\",\n\t\t})) as { url: string };\n\t\tconst mr = (await ctx.callIntegrationTool(\"gitlab_ensure_merge_request\", {\n\t\t\tprojectKey: \"repo\",\n\t\t\ttitle: `${ctx.params.issueKey}: ${ctx.params.issue.fields.summary}`,\n\t\t\tbody: `Implements [${ctx.params.issueKey}](${ctx.params.issueUrl})\\n\\n[Leitwerk process](${url})`,\n\t\t})) as GitLabMergeRequest;\n\t\treturn gitlabPublicationRequest(mr);\n\t};\n\tadapter.repositories = (params) =>\n\t\tparams.repositories.map((repo) => ({\n\t\t\tkey: repo.key,\n\t\t\tparams: { ...params, ...repo, issueUrl: params.issueUrl },\n\t\t}));\n\tadapter.tools.delivery = [\n\t\t...adapter.tools.delivery,\n\t\t\"jira_get_source_issue\",\n\t\t\"jira_ensure_remote_link\",\n\t\t\"jira_transition_source_issue\",\n\t\t\"jira_finalize_source_issue\",\n\t];\n\tadapter.sourceCancelled = async (ctx) =>\n\t\t!jiraEligible(\n\t\t\t(await ctx.callIntegrationTool(\"jira_get_source_issue\", {\n\t\t\t\tprojectKey: ctx.params.repositories[0].key,\n\t\t\t})) as JiraIssue,\n\t\t\tctx.params.jiraTriggerLabel,\n\t\t);\n\tadapter.linkIssue = async (ctx) => {\n\t\tawait ctx.callIntegrationTool(\"jira_ensure_remote_link\", {\n\t\t\tprojectKey: \"repo\",\n\t\t\tkind: \"merge_request\",\n\t\t});\n\t};\n\tadapter.reconcileTerminal = async () => {};\n\tadapter.reconcileAll = async (ctx, results, cancelled) => {\n\t\tconst created = results.filter(({ current }) => !current.noChanges);\n\t\tconst merged = created.filter(({ current }) => current.delivery.terminalPullRequest?.merged);\n\t\tconst done = !cancelled && created.length > 0 && merged.length === created.length;\n\t\tconst projectKey = ctx.params.repositories[0].key;\n\t\tif (done && verificationOnMerge)\n\t\t\tawait ctx.callIntegrationTool(\"jira_transition_source_issue\", {\n\t\t\t\tprojectKey,\n\t\t\t\ttargetStatus: verificationStatus,\n\t\t\t});\n\t\tif (!cancelled)\n\t\t\tawait ctx.callIntegrationTool(\"jira_finalize_source_issue\", {\n\t\t\t\tprojectKey,\n\t\t\t\tdone,\n\t\t\t\twriteKey: \"delivery-labels\",\n\t\t\t});\n\t};\n\tconst publication = createRepositoryChangePublication(adapter);\n\tpublication.fragment.watcher({\n\t\tid: \"use_leitwerk\",\n\t\tlabel: \"Jira use-leitwerk issues\",\n\t\tdescription: \"Coordinate changes across component-mapped GitLab repositories\",\n\t\tsource: jiraIssueWatcherSource,\n\t\tresolveLaunchConfig: launcher.resolve,\n\t\tpreparationChecks: launcher.checks,\n\t});\n\tconst { process } = createRepositoryChangeProcess<JiraGitLabParams>({\n\t\tprocessId: \"jira_gitlab_change_process\",\n\t\tdisplayName: \"Jira GitLab Change\",\n\t\tparamsCodec: jiraGitLabParamsCodec,\n\t\tpublication,\n\t\tworkflow: {\n\t\t\tmultiRepository: true,\n\t\t\tasync planDecision(params) {\n\t\t\t\tconst issue = await launcher.readIssue(params);\n\t\t\t\treturn {\n\t\t\t\t\tskip:\n\t\t\t\t\t\tjiraEligible(issue, params.jiraTriggerLabel) &&\n\t\t\t\t\t\tissue.fields.labels.includes(\"leitwerk-skip-plan-decision\"),\n\t\t\t\t\treason: \"Jira label\",\n\t\t\t\t};\n\t\t\t},\n\t\t\tasync simplification(params) {\n\t\t\t\tconst issue = await launcher.readIssue(params);\n\t\t\t\treturn {\n\t\t\t\t\tskip: issue.fields.labels.includes(\"leitwerk-skip-simplification\"),\n\t\t\t\t\treason: \"Jira source labels\",\n\t\t\t\t};\n\t\t\t},\n\t\t\tplanBypassSource: jiraIssuePolicy(({ params, state }) => ({\n\t\t\t\tprofile: params.jiraProfile,\n\t\t\t\tbaseUrl: params.jiraBaseUrl,\n\t\t\t\tissueId: params.issueId,\n\t\t\t\ttriggerLabel: params.jiraTriggerLabel,\n\t\t\t\tplanRevision: state.routing?.plan?.planRevision,\n\t\t\t\tmode: \"plan_bypass\",\n\t\t\t})),\n\t\t},\n\t\trepositoryCredentials: ({ params }) => {\n\t\t\tif (params.startup) throw new Error(\"Jira repository bindings are not resolved\");\n\t\t\treturn params.repositories.flatMap((repo) =>\n\t\t\t\trepo.sshProfile\n\t\t\t\t\t? [{ projectKey: repo.key, kind: \"git_ssh\" as const, credentialRef: repo.sshProfile }]\n\t\t\t\t\t: gitlabRepositoryCredentials(repo.gitlabProfile, [repo]),\n\t\t\t);\n\t\t},\n\t});\n\tprocess.runtime = { ...process.runtime, developmentTools: true, docker: options.docker };\n\tconst plan = process.turns.get(\"generate_plan\")?.definition;\n\tconst delivery = process.turns.get(\"deliver_change\")?.definition;\n\tif (plan?.kind !== \"llm\" || delivery?.kind !== \"automatic\")\n\t\tthrow new Error(\"Jira change requires planning and delivery turns\");\n\tplan.waitFor = launcher.ready;\n\tplan.resolveAskQuestions = ({ prepared }) => asUnknownRecord(prepared)?.skipPlanDecision !== true;\n\tplan.integrationTools = [\n\t\t...(plan.integrationTools ?? []),\n\t\t\"jira_get_source_issue\",\n\t\t\"jira_ensure_remote_link\",\n\t\t\"jira_transition_source_issue\",\n\t];\n\tconst originalPrepare = plan.prepare;\n\tplan.prepare = async (ctx) => {\n\t\tconst projectKey = ctx.params.repositories[0].key;\n\t\tconst issue = (await ctx\n\t\t\t.callIntegrationTool(\"jira_get_source_issue\", { projectKey })\n\t\t\t.catch(() => null)) as JiraIssue | null;\n\t\tawait ctx.callIntegrationTool(\"jira_ensure_remote_link\", { projectKey, kind: \"process\" });\n\t\tawait ctx.callIntegrationTool(\"jira_transition_source_issue\", {\n\t\t\tprojectKey,\n\t\t\ttargetStatus: \"In Progress\",\n\t\t});\n\t\treturn {\n\t\t\t...(asUnknownRecord(await originalPrepare?.(ctx)) ?? {}),\n\t\t\tskipPlanDecision: issue?.fields.labels.includes(\"leitwerk-skip-plan-decision\") ?? false,\n\t\t};\n\t};\n\tconst originalDelivery = delivery.run;\n\tdelivery.run = async (ctx) => {\n\t\tconst result = await originalDelivery(ctx);\n\t\tif (result.outcome === \"aborted\") return result;\n\t\tconst state = process.stateCodec.parse(result.params?.nextState);\n\t\tconst published = ctx.params.repositories.map((repo) => remote(state, repo.key));\n\t\tif (published.some((current) => current.prNumber)) {\n\t\t\tif (!ctx.callIntegrationTool) throw new Error(\"Jira integration tools are unavailable\");\n\t\t\t// Resumed runs may have marked issueLinked while delivery still used Jira comments.\n\t\t\tawait ctx.callIntegrationTool(\"jira_ensure_remote_link\", {\n\t\t\t\tprojectKey: ctx.params.repositories[0].key,\n\t\t\t\tkind: \"process\",\n\t\t\t});\n\t\t\tfor (const [index, current] of published.entries())\n\t\t\t\tif (current.prNumber && current.prUrl)\n\t\t\t\t\tawait ctx.callIntegrationTool(\"jira_ensure_remote_link\", {\n\t\t\t\t\t\tprojectKey: ctx.params.repositories[index].key,\n\t\t\t\t\t\tkind: \"merge_request\",\n\t\t\t\t\t});\n\t\t\tif (published.every((current) => current.noChanges || (current.prNumber && current.prUrl)))\n\t\t\t\tawait ctx.callIntegrationTool(\"jira_transition_source_issue\", {\n\t\t\t\t\tprojectKey: ctx.params.repositories[0].key,\n\t\t\t\t\ttargetStatus: \"In Review\",\n\t\t\t\t});\n\t\t}\n\t\treturn result;\n\t};\n\tfor (const binding of process.turns.values()) {\n\t\tconst turn = binding.definition;\n\t\tif (turn.kind !== \"llm\") continue;\n\t\tconst originalPrompt = turn.prompt;\n\t\tconst originalTools = turn.resolveIntegrationTools;\n\t\tturn.resolveIntegrationTools = (params, state) => [\n\t\t\t...(originalTools?.(params, state) ?? turn.integrationTools ?? []),\n\t\t\t\"jira_get_source_issue\",\n\t\t\t\"jira_get_issue\",\n\t\t\t...(params.wikiTopicId ? wikiToolNames : []),\n\t\t];\n\t\tturn.prompt = async (ctx) =>\n\t\t\t`${await originalPrompt({ ...ctx, params: { ...ctx.params, prompt: jiraChangePrompt(ctx.params.issue) } })}${ctx.params.wikiTopicId ? `\\n\\n${wikiInstructions}\\nWiki: /wiki/${ctx.params.wikiTopicId}` : \"\"}`;\n\t}\n\tconst extension: LeitwerkExtensionModule = {\n\t\tmanifest: {\n\t\t\tid: \"jira-gitlab-change\",\n\t\t\tversion: \"0.3.0\",\n\t\t\trequires: [\"jira\", \"gitlab\", \"coding\"],\n\t\t},\n\t\tscopedSettings: { settings: [launcher.mapping] },\n\t\tsetupCatalog(api) {\n\t\t\tapi.registerProcess(process);\n\t\t},\n\t\tsetupServer(api, config) {\n\t\t\tconst verification = asUnknownRecord(config)?.verification_on_merge;\n\t\t\tif (verification !== undefined && typeof verification !== \"boolean\")\n\t\t\t\tthrow new Error(\"Jira verification_on_merge must be a boolean\");\n\t\t\tverificationOnMerge = verification ?? options.verificationOnMerge ?? false;\n\t\t\tconst status = asUnknownRecord(config)?.verification_status;\n\t\t\tif (\n\t\t\t\tstatus !== undefined &&\n\t\t\t\tstatus !== \"In Verification\" &&\n\t\t\t\tstatus !== \"Ready for Verification\"\n\t\t\t)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Jira verification_status must be In Verification or Ready for Verification\",\n\t\t\t\t);\n\t\t\tverificationStatus = status ?? options.verificationStatus ?? \"In Verification\";\n\t\t\tadapter.maintenance?.register(api, process);\n\t\t\tconst jira = api.require(jiraIntegration),\n\t\t\t\tgitlab = api.require(gitlabIntegration),\n\t\t\t\tsettings = api.require(scopedSettingsCapability);\n\t\t\tif (Array.isArray(jira) || Array.isArray(gitlab) || Array.isArray(settings))\n\t\t\t\tthrow new Error(\"Integration capabilities must be singular\");\n\t\t\tconst wiki = api.require(topicWikiCapability);\n\t\t\tconst host = api.require(coreHostCapabilities.serverSetup);\n\t\t\tif (Array.isArray(wiki) || Array.isArray(host))\n\t\t\t\tthrow new Error(\"Integration capabilities must be singular\");\n\t\t\twiki.registerProcessSource(process.id, jiraWikiSource(wiki, jira));\n\t\t\tlauncher.configure({\n\t\t\t\tmodelLabels: parseJiraModelLabels(config),\n\t\t\t\tjira,\n\t\t\t\tgitlab,\n\t\t\t\tget ssh() {\n\t\t\t\t\tconst ssh = api.get(gitSshIntegration);\n\t\t\t\t\tif (Array.isArray(ssh)) throw new Error(\"Integration capabilities must be singular\");\n\t\t\t\t\treturn ssh;\n\t\t\t\t},\n\t\t\t\tsettings,\n\t\t\t\twiki,\n\t\t\t\tpublications: host.publications,\n\t\t\t});\n\t\t\tapi.onStop(() => launcher.configure(null));\n\t\t},\n\t};\n\treturn {\n\t\t/** @internal */\n\t\textension,\n\t\t/** @internal */\n\t\tprocess,\n\t\t/** @internal */\n\t\tlauncher,\n\t};\n}\n\n/** @public */\nexport const { extension: defaultExtension, process: jiraGitLabChangeProcess } =\n\tcreateJiraGitLabChange({ docker: true });\nexport default defaultExtension;\n","import { createHash } from \"node:crypto\";\nimport { isDeepStrictEqual } from \"node:util\";\nimport { asUnknownRecord, type SettingsSource } from \"@leitwerk-dev/domain\";\nimport type { PublicationStore } from \"@leitwerk-dev/external-writes\";\nimport { createGitSshPreparationCheck, type GitSshIntegration } from \"@leitwerk-dev/git-ssh\";\nimport {\n\tcreateGitLabRepositoryCatalog,\n\tGitLabError,\n\ttype GitLabIntegration,\n\ttype GitLabPublicationParams,\n\ttype GitLabRepositoryCatalog,\n\tresolveGitLabLaunchProject,\n} from \"@leitwerk-dev/gitlab\";\nimport {\n\tensureIssueWiki,\n\ttype JiraIntegration,\n\ttype JiraIssue,\n\tJiraRequestError,\n\ttype JiraWatcherEvent,\n\tjiraEligible,\n\tjiraIsEpic,\n\tjiraIssueExternalId,\n\tjiraSplitChildMatches,\n\tjiraSubjectIdentity,\n\tjiraToMarkdown,\n\tjiraTriggerLabel,\n} from \"@leitwerk-dev/jira\";\nimport {\n\ttype Codec,\n\ttype LauncherContext,\n\ttype LaunchPreparationCheck,\n\ttype ProcessLaunchConfig,\n\tRetryableWaitError,\n\trepositorySettingsIdentity,\n\tSafeLaunchPreparationError,\n\ttype ScopedSettingsResolver,\n\ttype SettingDefinition,\n\ttype TurnWaitContext,\n} from \"@leitwerk-dev/process-sdk\";\nimport type { TopicWikiStore } from \"@leitwerk-dev/wiki\";\n\nimport { selectJiraModel } from \"./models.js\";\n\nclass JiraSourceIneligibleError extends Error {\n\tconstructor() {\n\t\tsuper(\"Jira source issue is no longer eligible\");\n\t}\n}\n\nfunction eligibleSource(issue: JiraIssue, event: JiraWatcherEvent): boolean {\n\treturn (\n\t\tissue.id === event.issue.id &&\n\t\tjiraEligible(issue, event.triggerLabel) &&\n\t\tevent.projects.includes(issue.fields.project.id)\n\t);\n}\n\n/** @public */\nexport interface RepositoryMapping {\n\t/** @public */\n\torigin: string;\n\n\t/** @public */\n\tprojectId: number;\n\n\t/** @public */\n\tgitlabProfile: string;\n\n\t/** @public */\n\tsshProfile?: string;\n}\n\n/** @public */\nexport interface RepositoryBinding extends GitLabPublicationParams {\n\t/** @internal */\n\tkey: string;\n\n\t/** @internal */\n\torigin: \"jira\";\n\n\t/** @internal */\n\tgitlabOrigin: string;\n\n\t/** @internal */\n\tsshProfile?: string;\n\n\t/** @internal */\n\trepoLocator: string;\n}\n\n/** @public */\nexport interface JiraGitLabParams extends Partial<GitLabPublicationParams> {\n\t/** Present only until initial repository bindings are resolved. @internal */\n\tstartup?: {\n\t\t/** Captured watcher scope; later watcher edits do not retarget this process. @internal */\n\t\tprojectIds: string[];\n\t};\n\t/** @internal */\n\tjiraTriggerLabel?: string;\n\t/** @internal */\n\tmodelSelection?: {\n\t\t/** @internal */\n\t\tlabel: string;\n\t\t/** @internal */\n\t\tprofileId: string;\n\t};\n\t/** @internal */\n\twikiTopicId?: string;\n\t/** @internal */\n\torigin: \"jira\";\n\n\t/** @internal */\n\tjiraProfile: string;\n\n\t/** @internal */\n\tjiraBaseUrl: string;\n\n\t/** @internal */\n\tissueId: string;\n\n\t/** @internal */\n\tissueKey: string;\n\n\t/** @internal */\n\tissueUrl: string;\n\n\t/** @internal */\n\tprompt: string;\n\n\t/** @internal */\n\tissue: JiraIssue;\n\n\t/** @internal */\n\trepositories: RepositoryBinding[];\n\n\t/** @internal */\n\tmappings: {\n\t\t/** @internal */\n\t\tcomponentId: string;\n\t\t/** @internal */ values: string[];\n\t\t/** @internal */ sources: SettingsSource[];\n\t}[];\n}\n\n/** Builds Markdown from captured Jira evidence. @internal */\nexport function jiraChangePrompt(issue: JiraIssue): string {\n\treturn `${issue.key}: ${issue.fields.summary}\\n\\n${jiraToMarkdown(issue.fields.description)}`;\n}\n\nfunction admissionParams(params: JiraGitLabParams) {\n\tconst { id, key, fields } = params.issue;\n\t// Jira plugin fields can change on every read without an issue revision.\n\t// Keep the raw issue as evidence, but compare only the launch contract.\n\treturn {\n\t\t...params,\n\t\tissue: {\n\t\t\tid,\n\t\t\tkey,\n\t\t\tfields: {\n\t\t\t\tupdated: fields.updated,\n\t\t\t\tsummary: fields.summary,\n\t\t\t\tdescription: fields.description,\n\t\t\t\tlabels: [...fields.labels].sort(),\n\t\t\t\tproject: { id: fields.project.id, key: fields.project.key, name: fields.project.name },\n\t\t\t\tcomponents: fields.components.map(({ id, name }) => ({ id, name })),\n\t\t\t\tstatusCategory: fields.status.statusCategory.key,\n\t\t\t\tissuetype: fields.issuetype && {\n\t\t\t\t\tid: fields.issuetype.id,\n\t\t\t\t\tname: fields.issuetype.name,\n\t\t\t\t\tsubtask: fields.issuetype.subtask,\n\t\t\t\t},\n\t\t\t\tparent: fields.parent && { id: fields.parent.id, key: fields.parent.key },\n\t\t\t},\n\t\t},\n\t};\n}\n\n/** Decode a retained repository selection without remote discovery. @public */\nexport function decodeJiraGitLabRepositoryMapping(value: unknown): RepositoryMapping {\n\tif (typeof value !== \"string\") throw new Error(\"Select a repository and its GitLab profile\");\n\tlet r: Record<string, unknown> | null;\n\ttry {\n\t\tr = asUnknownRecord(JSON.parse(value));\n\t} catch {\n\t\tthrow new Error(\"Invalid repository mapping; reselect it in Settings\");\n\t}\n\treturn validateMapping(r);\n}\n\nfunction validateMapping(r: Record<string, unknown> | null): RepositoryMapping {\n\tif (\n\t\t!r ||\n\t\ttypeof r.origin !== \"string\" ||\n\t\tnew URL(r.origin).origin !== r.origin ||\n\t\ttypeof r.projectId !== \"number\" ||\n\t\t!Number.isSafeInteger(r.projectId) ||\n\t\tr.projectId <= 0 ||\n\t\ttypeof r.gitlabProfile !== \"string\" ||\n\t\t!r.gitlabProfile ||\n\t\t(r.sshProfile !== undefined && (typeof r.sshProfile !== \"string\" || !r.sshProfile))\n\t)\n\t\tthrow new Error(\"Invalid repository mapping; reselect it in Settings\");\n\treturn r as unknown as RepositoryMapping;\n}\n\n/** @public */\nexport const jiraGitLabParamsCodec: Codec<JiraGitLabParams> = {\n\tparse(value) {\n\t\tconst r = asUnknownRecord(value);\n\t\tjiraTriggerLabel(r?.jiraTriggerLabel);\n\t\tif (\n\t\t\tr?.origin !== \"jira\" ||\n\t\t\t!Array.isArray(r.repositories) ||\n\t\t\t(!r.repositories.length && !asUnknownRecord(r.startup)) ||\n\t\t\t!Array.isArray(r.mappings) ||\n\t\t\t!asUnknownRecord(r.issue)\n\t\t)\n\t\t\tthrow new Error(\"Invalid Jira GitLab launch snapshot\");\n\t\tfor (const key of [\"jiraProfile\", \"jiraBaseUrl\", \"issueId\", \"issueKey\", \"issueUrl\", \"prompt\"])\n\t\t\tif (typeof r[key] !== \"string\" || !r[key]) throw new Error(`Missing ${key}`);\n\t\tif (r.startup !== undefined) {\n\t\t\tconst startup = asUnknownRecord(r.startup);\n\t\t\tif (\n\t\t\t\tr.repositories.length ||\n\t\t\t\t!Array.isArray(startup?.projectIds) ||\n\t\t\t\t!startup.projectIds.length ||\n\t\t\t\tstartup.projectIds.some((id) => typeof id !== \"string\" || !id) ||\n\t\t\t\t[\n\t\t\t\t\t\"owner\",\n\t\t\t\t\t\"repo\",\n\t\t\t\t\t\"gitlabProfile\",\n\t\t\t\t\t\"projectId\",\n\t\t\t\t\t\"repoLocator\",\n\t\t\t\t\t\"baseBranch\",\n\t\t\t\t\t\"workBranch\",\n\t\t\t\t].some((key) => r[key] !== undefined)\n\t\t\t)\n\t\t\t\tthrow new Error(\"Invalid pending Jira repository binding\");\n\t\t}\n\t\tfor (const item of r.repositories) {\n\t\t\tconst repo = asUnknownRecord(item);\n\t\t\tif (!repo || typeof repo.key !== \"string\" || !/^[a-zA-Z0-9_-]+$/.test(repo.key))\n\t\t\t\tthrow new Error(\"Invalid repository key\");\n\t\t\tvalidateMapping({ ...repo, origin: repo.gitlabOrigin });\n\t\t\tfor (const key of [\"repoLocator\", \"owner\", \"repo\", \"baseBranch\", \"workBranch\"])\n\t\t\t\tif (typeof repo[key] !== \"string\" || !repo[key])\n\t\t\t\t\tthrow new Error(`Missing repository ${key}`);\n\t\t}\n\t\tif (new Set(r.repositories.map((repo) => repo.key)).size !== r.repositories.length)\n\t\t\tthrow new Error(\"Duplicate repository key\");\n\t\treturn r as unknown as JiraGitLabParams;\n\t},\n\tserialize: (value) => value,\n};\n\n/** Component-to-repository Settings contract. Register it only through this extension. @public */\nexport const jiraGitLabRepositories: SettingDefinition<string[]> = {\n\tkey: \"jira-gitlab-change.repositories\",\n\tschemaVersion: 1,\n\tscopes: [\"jira.component\"],\n\tmerge: \"replace\",\n\tdefaultValue: [],\n\tform: {\n\t\tlabel: \"GitLab repositories\",\n\t\tgroup: \"Repository mapping\",\n\t\tcontrol: \"multiselect\",\n\t\toverview: \"repository-mapping\",\n\t\tsearch: { minimumLength: 2, placeholder: \"Search GitLab repositories\" },\n\t\tdescription: \"Use the GitLab profile's token over HTTPS, or select a configured SSH profile.\",\n\t},\n\tschema: {\n\t\tparse(value) {\n\t\t\tif (!Array.isArray(value)) throw new Error(\"Choose repositories\");\n\t\t\tfor (const entry of value) decodeJiraGitLabRepositoryMapping(entry);\n\t\t\treturn [...new Set(value)] as string[];\n\t\t},\n\t},\n};\n\n/** @public */\nexport function createJiraGitLabLauncher() {\n\t/** @internal */\n\tlet services: {\n\t\t/** @internal */\n\t\tjira: JiraIntegration;\n\n\t\t/** @internal */\n\t\tgitlab: GitLabIntegration;\n\n\t\t/** @internal */\n\t\tssh?: GitSshIntegration;\n\n\t\t/** @internal */\n\t\tsettings: ScopedSettingsResolver;\n\t\t/** @internal */\n\t\twiki?: TopicWikiStore;\n\t\t/** @internal */\n\t\tpublications?: PublicationStore;\n\t\t/** @internal */\n\t\tmodelLabels?: Readonly<Record<string, string>>;\n\t} | null = null;\n\tlet repositoryCatalog: GitLabRepositoryCatalog | null = null;\n\tconst requireServices = () => {\n\t\tif (!services) throw new Error(\"Jira GitLab integration is not configured\");\n\t\treturn services;\n\t};\n\tconst mapping: SettingDefinition<string[]> = {\n\t\t...jiraGitLabRepositories,\n\t\tchoiceLabel(value) {\n\t\t\tconst mapping = decodeJiraGitLabRepositoryMapping(value);\n\t\t\tconst { gitlab, settings } = requireServices();\n\t\t\tconst retained = settings.findSubject(\n\t\t\t\t\"repository\",\n\t\t\t\trepositorySettingsIdentity(mapping.origin, mapping.projectId),\n\t\t\t);\n\t\t\tlet path = retained?.label;\n\t\t\tif (!path) {\n\t\t\t\tconst known = gitlab.profiles().includes(mapping.gitlabProfile)\n\t\t\t\t\t? repositoryCatalog?.peek(mapping.gitlabProfile, mapping.projectId)\n\t\t\t\t\t: undefined;\n\t\t\t\tpath =\n\t\t\t\t\tknown && gitlab.client(mapping.gitlabProfile).baseUrl === mapping.origin\n\t\t\t\t\t\t? known.path_with_namespace\n\t\t\t\t\t\t: `Repository ${mapping.projectId}`;\n\t\t\t}\n\t\t\treturn `${path} · ${mapping.gitlabProfile} / ${mapping.sshProfile ?? \"HTTPS\"}`;\n\t\t},\n\t\tasync choices(_context, request = {}) {\n\t\t\tconst { gitlab, ssh, settings } = requireServices();\n\t\t\tif (!repositoryCatalog) throw new Error(\"GitLab repository catalog is not configured\");\n\t\t\tconst query = (request.search ?? \"\").trim();\n\t\t\tif (query.length < 2) return [];\n\t\t\tconst choices = [];\n\t\t\tfor (const gitlabProfile of gitlab.profiles()) {\n\t\t\t\tconst client = gitlab.client(gitlabProfile);\n\t\t\t\tconst projects = [...(await repositoryCatalog.search(gitlabProfile, query))];\n\t\t\t\tfor (const value of request.values ?? []) {\n\t\t\t\t\tconst selected = decodeJiraGitLabRepositoryMapping(value);\n\t\t\t\t\tif (\n\t\t\t\t\t\tselected.gitlabProfile !== gitlabProfile ||\n\t\t\t\t\t\tselected.origin !== client.baseUrl ||\n\t\t\t\t\t\tprojects.some((repo) => repo.id === selected.projectId)\n\t\t\t\t\t)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tconst project = repositoryCatalog.peek(gitlabProfile, selected.projectId);\n\t\t\t\t\tif (project) projects.push(project);\n\t\t\t\t}\n\t\t\t\tfor (const repo of projects) {\n\t\t\t\t\tif (repo.archived || !repo.default_branch) continue;\n\t\t\t\t\tsettings.discover({\n\t\t\t\t\t\tscopeType: \"repository\",\n\t\t\t\t\t\tidentity: repositorySettingsIdentity(client.baseUrl, repo.id),\n\t\t\t\t\t\tlabel: repo.path_with_namespace,\n\t\t\t\t\t});\n\t\t\t\t\tif (repo.http_url_to_repo)\n\t\t\t\t\t\tchoices.push({\n\t\t\t\t\t\t\tvalue: JSON.stringify({ origin: client.baseUrl, projectId: repo.id, gitlabProfile }),\n\t\t\t\t\t\t\tlabel: `${repo.path_with_namespace} · ${gitlabProfile} / HTTPS`,\n\t\t\t\t\t\t});\n\t\t\t\t\tif (!repo.ssh_url_to_repo) continue;\n\t\t\t\t\tfor (const sshProfile of ssh?.profiles() ?? [])\n\t\t\t\t\t\tchoices.push({\n\t\t\t\t\t\t\tvalue: JSON.stringify({\n\t\t\t\t\t\t\t\torigin: client.baseUrl,\n\t\t\t\t\t\t\t\tprojectId: repo.id,\n\t\t\t\t\t\t\t\tgitlabProfile,\n\t\t\t\t\t\t\t\tsshProfile,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tlabel: `${repo.path_with_namespace} · ${gitlabProfile} / ${sshProfile}`,\n\t\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const value of request.values ?? [])\n\t\t\t\tif (!choices.some((choice) => choice.value === value))\n\t\t\t\t\tchoices.push({ value, label: mapping.choiceLabel?.(value) ?? value });\n\t\t\treturn choices;\n\t\t},\n\t};\n\n\t/** @internal */\n\tasync function resolve(\n\t\tevent: JiraWatcherEvent,\n\t\tctx: LauncherContext = {},\n\t\tretained?: JiraGitLabParams,\n\t\tsignal?: AbortSignal,\n\t): Promise<ProcessLaunchConfig<JiraGitLabParams>> {\n\t\tconst { jira, gitlab, ssh, settings, wiki, publications } = requireServices();\n\t\tconst client = jira.client(event.profile);\n\t\tconst issue = await client.getIssue(event.issue.id, signal);\n\t\tif (!eligibleSource(issue, event)) throw new JiraSourceIneligibleError();\n\t\tconst triggerLabel = jiraTriggerLabel(event.triggerLabel);\n\t\tconst modelSelection = retained\n\t\t\t? retained.modelSelection\n\t\t\t: selectJiraModel(issue.fields.labels, requireServices().modelLabels ?? {});\n\t\tif (\n\t\t\tmodelSelection &&\n\t\t\tctx.modelProfiles &&\n\t\t\t!ctx.modelProfiles.some((p) => p.id === modelSelection.profileId)\n\t\t)\n\t\t\tthrow new Error(\n\t\t\t\t`Jira model profile ${modelSelection.profileId} is unavailable for this process`,\n\t\t\t);\n\t\tconst project = settings.discover({\n\t\t\tscopeType: \"jira.project\",\n\t\t\tidentity: jiraSubjectIdentity(client.baseUrl, issue.fields.project.id),\n\t\t\tlabel: issue.fields.project.key,\n\t\t});\n\t\tconst source = {\n\t\t\torigin: \"jira\" as const,\n\t\t\tjiraTriggerLabel: triggerLabel,\n\t\t\t...(modelSelection ? { modelSelection } : {}),\n\t\t\tjiraProfile: event.profile,\n\t\t\tjiraBaseUrl: client.baseUrl,\n\t\t\tissueId: issue.id,\n\t\t\tissueKey: issue.key,\n\t\t\tissueUrl: `${client.baseUrl}/browse/${encodeURIComponent(issue.key)}`,\n\t\t\tprompt: jiraChangePrompt(issue),\n\t\t\tissue,\n\t\t};\n\t\tconst launch = {\n\t\t\tprocessId: \"jira_gitlab_change_process\",\n\t\t\tdefaultModelProfileId: modelSelection?.profileId,\n\t\t\ttitle: `${issue.key}: ${issue.fields.summary}`,\n\t\t\tstartTurnId: \"generate_plan\",\n\t\t\texternalId: jiraIssueExternalId(client.baseUrl, issue.id),\n\t\t\texternalUrl: source.issueUrl,\n\t\t\tsettingsContext: { \"jira.project\": project.id },\n\t\t};\n\t\tconst mappings: JiraGitLabParams[\"mappings\"] = [];\n\t\tconst selected = new Map<string, RepositoryMapping>();\n\t\tconst publication = publications?.publicationByExternalId(\n\t\t\tjiraIssueExternalId(client.baseUrl, issue.id),\n\t\t);\n\t\tconst componentPublication = publication && typeof publication.binding.componentId === \"string\";\n\t\tif (\n\t\t\tcomponentPublication &&\n\t\t\t(issue.fields.components.length !== 1 ||\n\t\t\t\tissue.fields.components[0].id !== publication.binding.componentId)\n\t\t)\n\t\t\tthrow new Error(\"Generated ticket's component identity changed\");\n\t\tfor (const component of issue.fields.components) {\n\t\t\tconst subject = settings.discover({\n\t\t\t\tscopeType: \"jira.component\",\n\t\t\t\tidentity: jiraSubjectIdentity(client.baseUrl, component.id),\n\t\t\t\tlabel: `${issue.fields.project.key} / ${component.name}`,\n\t\t\t\tcontext: { \"jira.project\": project.id },\n\t\t\t});\n\t\t\tconst resolved = settings.resolve(mapping, {\n\t\t\t\t\"jira.project\": project.id,\n\t\t\t\t\"jira.component\": subject.id,\n\t\t\t});\n\t\t\tmappings.push({\n\t\t\t\tcomponentId: component.id,\n\t\t\t\tvalues: resolved.value,\n\t\t\t\tsources: resolved.sources,\n\t\t\t});\n\t\t}\n\t\tif (!mappings.length || mappings.some((mapping) => !mapping.values.length)) {\n\t\t\treturn {\n\t\t\t\t...launch,\n\t\t\t\tprojects: [],\n\t\t\t\tparams: {\n\t\t\t\t\t...source,\n\t\t\t\t\tmappings,\n\t\t\t\t\trepositories: [],\n\t\t\t\t\tstartup: { projectIds: [...event.projects] },\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tfor (const mapping of mappings) {\n\t\t\tfor (const value of mapping.values) {\n\t\t\t\tconst entry = decodeJiraGitLabRepositoryMapping(value);\n\t\t\t\tif (\n\t\t\t\t\tpublication &&\n\t\t\t\t\t!componentPublication &&\n\t\t\t\t\t(entry.origin !== publication.binding.origin ||\n\t\t\t\t\t\tentry.projectId !== publication.binding.projectId)\n\t\t\t\t)\n\t\t\t\t\tcontinue;\n\t\t\t\tconst key = repositorySettingsIdentity(entry.origin, entry.projectId);\n\t\t\t\tconst prior = selected.get(key);\n\t\t\t\tif (\n\t\t\t\t\tprior &&\n\t\t\t\t\t(prior.gitlabProfile !== entry.gitlabProfile || prior.sshProfile !== entry.sshProfile)\n\t\t\t\t)\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Conflicting profiles for project ${entry.projectId}; correct the component mappings in Settings`,\n\t\t\t\t\t);\n\t\t\t\tselected.set(key, entry);\n\t\t\t}\n\t\t}\n\t\tif (publication && !componentPublication) {\n\t\t\tconst binding = publication.binding;\n\t\t\tconst exact = [...selected.entries()].find(\n\t\t\t\t([, entry]) =>\n\t\t\t\t\tentry.origin === binding.origin &&\n\t\t\t\t\tentry.projectId === binding.projectId &&\n\t\t\t\t\tentry.gitlabProfile === binding.gitlabProfile &&\n\t\t\t\t\t(binding.sshProfile === undefined || entry.sshProfile === binding.sshProfile),\n\t\t\t);\n\t\t\tif (!exact)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Generated ticket's repository binding no longer matches its component mappings\",\n\t\t\t\t);\n\t\t\tselected.clear();\n\t\t\tselected.set(...exact);\n\t\t}\n\t\tif (!selected.size)\n\t\t\tthrow new Error(\n\t\t\t\t`No repositories mapped for ${issue.key}. Map at least one component in Settings → Jira components.`,\n\t\t\t);\n\t\tconst repositories: RepositoryBinding[] = [];\n\t\tconst projects: import(\"@leitwerk-dev/process-sdk\").ProcessLaunchProjectConfig[] = [];\n\t\tfor (const entry of selected.values()) {\n\t\t\tconst provider = gitlab.client(entry.gitlabProfile);\n\t\t\tif (\n\t\t\t\tprovider.baseUrl !== entry.origin ||\n\t\t\t\t(entry.sshProfile !== undefined && !ssh?.profiles().includes(entry.sshProfile))\n\t\t\t)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Unavailable mapping for GitLab project ${entry.projectId}; update its profiles in Settings`,\n\t\t\t\t);\n\t\t\tconst repo = await provider.getProject(entry.projectId, signal);\n\t\t\tif (repo.id !== entry.projectId) throw new Error(\"GitLab repository identity changed\");\n\t\t\tconst repoLocator = entry.sshProfile ? repo.ssh_url_to_repo : repo.http_url_to_repo;\n\t\t\tif (repo.archived || !repo.default_branch || !repoLocator)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`GitLab project ${entry.projectId} must be active and provide the selected clone URL`,\n\t\t\t\t);\n\t\t\tif (\n\t\t\t\tpublication &&\n\t\t\t\t!componentPublication &&\n\t\t\t\t((publication.binding.repoLocator !== undefined &&\n\t\t\t\t\trepoLocator !== publication.binding.repoLocator) ||\n\t\t\t\t\t(publication.binding.repository !== undefined &&\n\t\t\t\t\t\trepo.path_with_namespace !== publication.binding.repository) ||\n\t\t\t\t\trepo.default_branch !== publication.binding.baseBranch)\n\t\t\t)\n\t\t\t\tthrow new Error(\"Generated ticket's repository checkout binding changed\");\n\t\t\tconst key = `repo_${repositories.length + 1}`;\n\t\t\tconst { params: binding, project } = await resolveGitLabLaunchProject(\n\t\t\t\tprovider,\n\t\t\t\tentry.gitlabProfile,\n\t\t\t\t{ ...repo, id: entry.projectId },\n\t\t\t\t`leitwerk/jira-${createHash(\"sha256\").update(client.baseUrl).digest(\"hex\").slice(0, 10)}-${issue.id}`,\n\t\t\t\tkey,\n\t\t\t\tentry.sshProfile ? \"ssh\" : \"https\",\n\t\t\t);\n\t\t\tif (\n\t\t\t\tpublication?.binding.workBranch !== undefined &&\n\t\t\t\tpublication.binding.workBranch !== binding.workBranch\n\t\t\t)\n\t\t\t\tthrow new Error(\"Generated ticket's repository work branch binding changed\");\n\t\t\trepositories.push({ ...binding, key, origin: \"jira\", sshProfile: entry.sshProfile });\n\t\t\tprojects.push({\n\t\t\t\t...project,\n\t\t\t\tmetadata: {\n\t\t\t\t\t...project.metadata,\n\t\t\t\t\tjira: {\n\t\t\t\t\t\tprofile: event.profile,\n\t\t\t\t\t\tbaseUrl: client.baseUrl,\n\t\t\t\t\t\tissueId: issue.id,\n\t\t\t\t\t\ttriggerLabel,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t\tconst first = repositories[0];\n\t\tlet sourceIssue: JiraIssue | null = null;\n\t\tif (publication) {\n\t\t\tconst sourceIssueId = publication.binding.sourceIssueId ?? publication.binding.epicId;\n\t\t\tconst relationship = publication.binding.relationship ?? \"epic\";\n\t\t\tif (\n\t\t\t\ttypeof sourceIssueId !== \"string\" ||\n\t\t\t\t(relationship !== \"epic\" && relationship !== \"subtask\") ||\n\t\t\t\t!(await jiraSplitChildMatches(client, issue, sourceIssueId, relationship))\n\t\t\t)\n\t\t\t\tthrow new Error(\"Generated ticket's source issue binding changed\");\n\t\t\tsourceIssue = await client.getIssue(sourceIssueId);\n\t\t\tif (\n\t\t\t\tsourceIssue.id !== sourceIssueId ||\n\t\t\t\tsourceIssue.fields.project.id !== issue.fields.project.id ||\n\t\t\t\tsourceIssue.fields.issuetype?.subtask === true ||\n\t\t\t\tjiraIsEpic(sourceIssue) !== (relationship === \"epic\")\n\t\t\t)\n\t\t\t\tthrow new Error(\"Generated ticket's source issue binding changed\");\n\t\t} else if (wiki && issue.fields.issuetype?.subtask === true) {\n\t\t\tif (!issue.fields.parent?.id) throw new Error(\"Jira subtask parent is unavailable\");\n\t\t\tsourceIssue = await client.getIssue(issue.fields.parent.id);\n\t\t} else if (wiki && client.getEpic) {\n\t\t\tsourceIssue = await client.getEpic(issue);\n\t\t}\n\t\tconst topic =\n\t\t\twiki && sourceIssue ? ensureIssueWiki(wiki, client, sourceIssue, publication?.topicId) : null;\n\t\tif (publication && topic?.id !== publication.topicId)\n\t\t\tthrow new Error(\"Generated ticket's source issue wiki binding changed\");\n\t\tconst params: JiraGitLabParams = {\n\t\t\t...(topic ? { wikiTopicId: topic.id } : {}),\n\t\t\t...first,\n\t\t\t...source,\n\t\t\tmappings,\n\t\t\trepositories,\n\t\t};\n\t\treturn {\n\t\t\t...launch,\n\t\t\t...(topic && sourceIssue\n\t\t\t\t? {\n\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\twiki: {\n\t\t\t\t\t\t\t\ttopicId: topic.id,\n\t\t\t\t\t\t\t\tprofile: event.profile,\n\t\t\t\t\t\t\t\tbaseUrl: client.baseUrl,\n\t\t\t\t\t\t\t\tissueId: sourceIssue.id,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\tparams,\n\t\t\tprojects,\n\t\t};\n\t}\n\tconst checks = (\n\t\tevent: JiraWatcherEvent,\n\t\tlaunch: ProcessLaunchConfig<JiraGitLabParams>,\n\t\tretained?: JiraGitLabParams,\n\t): readonly LaunchPreparationCheck<JiraGitLabParams>[] => [\n\t\t...launch.params.repositories.map<LaunchPreparationCheck<JiraGitLabParams>>((repo) => ({\n\t\t\tid: `${repo.sshProfile ? \"ssh\" : \"https\"}_${repo.key}`,\n\t\t\tlabel: `Verify ${repo.owner}/${repo.repo} ${repo.sshProfile ? \"SSH\" : \"HTTPS\"} read/write access`,\n\t\t\tasync run(ctx) {\n\t\t\t\tconst { gitlab, ssh } = requireServices();\n\t\t\t\tconst client = gitlab.client(repo.gitlabProfile);\n\t\t\t\tconst fresh = await client.getProject(repo.projectId, ctx.signal);\n\t\t\t\tif (\n\t\t\t\t\tclient.baseUrl !== repo.gitlabOrigin ||\n\t\t\t\t\tfresh.id !== repo.projectId ||\n\t\t\t\t\tfresh.archived ||\n\t\t\t\t\t(repo.sshProfile ? fresh.ssh_url_to_repo : fresh.http_url_to_repo) !== repo.repoLocator ||\n\t\t\t\t\tfresh.default_branch !== repo.baseBranch\n\t\t\t\t)\n\t\t\t\t\tthrow new SafeLaunchPreparationError(\n\t\t\t\t\t\t\"Repository changed\",\n\t\t\t\t\t\t\"Refresh the component mapping and retry launch.\",\n\t\t\t\t\t);\n\t\t\t\tif (!repo.sshProfile) {\n\t\t\t\t\tawait client.preflightRepository(\n\t\t\t\t\t\trepo.projectId,\n\t\t\t\t\t\trepo.baseBranch,\n\t\t\t\t\t\trepo.workBranch,\n\t\t\t\t\t\tctx.signal,\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (!ssh) throw new Error(\"Git SSH profile is unavailable\");\n\t\t\t\tawait createGitSshPreparationCheck(\n\t\t\t\t\t\"write\",\n\t\t\t\t\t{ ...repo, sshCredentialRef: repo.sshProfile },\n\t\t\t\t\t() => ssh,\n\t\t\t\t).run(ctx);\n\t\t\t},\n\t\t})),\n\t\t{\n\t\t\tid: \"jira_eligibility\",\n\t\t\tlabel: \"Recheck Jira issue and component mappings\",\n\t\t\tasync run({ signal }) {\n\t\t\t\tif (launch.params.startup) {\n\t\t\t\t\tconst issue = await requireServices()\n\t\t\t\t\t\t.jira.client(event.profile)\n\t\t\t\t\t\t.getIssue(event.issue.id, signal);\n\t\t\t\t\tif (!eligibleSource(issue, event))\n\t\t\t\t\t\tthrow new SafeLaunchPreparationError(\n\t\t\t\t\t\t\t\"Jira source issue is no longer eligible\",\n\t\t\t\t\t\t\t\"Restore the watcher label and project eligibility before launching.\",\n\t\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst fresh = await resolve(event, {}, retained, signal);\n\t\t\t\tif (!isDeepStrictEqual(admissionParams(fresh.params), admissionParams(launch.params)))\n\t\t\t\t\tthrow new SafeLaunchPreparationError(\n\t\t\t\t\t\t\"Jira issue or mappings changed before admission\",\n\t\t\t\t\t\t\"Retry launch to capture the latest issue and mappings.\",\n\t\t\t\t\t);\n\t\t\t},\n\t\t},\n\t];\n\t/** Check startup readiness against the current source and mappings. @internal */\n\tasync function ready(\n\t\tcontext: Pick<\n\t\t\tTurnWaitContext<JiraGitLabParams>,\n\t\t\t\"params\" | \"signal\" | \"waiting\" | \"abort\" | \"bindInitialProjects\"\n\t\t>,\n\t) {\n\t\tconst { params, signal } = context;\n\t\tif (!params.startup) return true;\n\t\ttry {\n\t\t\tconst client = requireServices().jira.client(params.jiraProfile);\n\t\t\tif (client.baseUrl !== params.jiraBaseUrl) throw new Error(\"Jira installation changed\");\n\t\t\tconst issue = await client.getIssue(params.issueId, signal);\n\t\t\tif (issue.id !== params.issueId) throw new Error(\"Jira issue identity changed\");\n\t\t\tconst event: JiraWatcherEvent = {\n\t\t\t\tprofile: params.jiraProfile,\n\t\t\t\ttriggerLabel: params.jiraTriggerLabel,\n\t\t\t\tprojects: params.startup.projectIds,\n\t\t\t\tissue,\n\t\t\t};\n\t\t\tif (!eligibleSource(issue, event))\n\t\t\t\treturn context.abort(\"Jira source is no longer eligible; startup cancelled\");\n\t\t\tconst launch = await resolve(event, {}, params, signal);\n\t\t\tif (launch.params.startup) {\n\t\t\t\tconst missing = launch.params.issue.fields.components.filter(\n\t\t\t\t\t(component) =>\n\t\t\t\t\t\t!launch.params.mappings.find((mapping) => mapping.componentId === component.id)?.values\n\t\t\t\t\t\t\t.length,\n\t\t\t\t);\n\t\t\t\tconst reason = missing.length\n\t\t\t\t\t? `no GitLab repository mapping for ${missing.map((component) => component.name).join(\", \")}. Configure GitLab repositories in Settings → Jira components.`\n\t\t\t\t\t: \"no Jira components. Assign at least one component to the issue and configure its GitLab repositories in Settings → Jira components.\";\n\t\t\t\treturn context.waiting(\n\t\t\t\t\t`Startup blocked: ${launch.params.issueKey} has ${reason} Startup will resume automatically.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tfor (const check of checks(event, launch, params)) {\n\t\t\t\tsignal.throwIfAborted();\n\t\t\t\tawait check.run({ signal, launchConfig: launch, logger: { info() {}, warn() {} } });\n\t\t\t}\n\t\t\treturn context.bindInitialProjects({\n\t\t\t\tparams: launch.params,\n\t\t\t\tprojects: launch.projects ?? [],\n\t\t\t\tmetadata: launch.metadata,\n\t\t\t\tsettingsContext: launch.settingsContext,\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tif (error instanceof JiraSourceIneligibleError)\n\t\t\t\treturn context.abort(\"Jira source is no longer eligible; startup cancelled\");\n\t\t\tif (\n\t\t\t\t(error instanceof GitLabError && error.retryable) ||\n\t\t\t\t(error instanceof JiraRequestError &&\n\t\t\t\t\t(error.status === 408 || error.status === 429 || error.status >= 500)) ||\n\t\t\t\t(error instanceof TypeError && /fetch|network/i.test(error.message))\n\t\t\t)\n\t\t\t\tthrow new RetryableWaitError(\n\t\t\t\t\t\"Jira or GitLab is temporarily unavailable; startup will be checked again.\",\n\t\t\t\t);\n\t\t\tif (\n\t\t\t\terror instanceof SafeLaunchPreparationError &&\n\t\t\t\terror.message.includes(\"changed before admission\")\n\t\t\t)\n\t\t\t\treturn context.waiting(\n\t\t\t\t\t\"Jira issue or mappings changed during startup checks. Checking the latest configuration again.\",\n\t\t\t\t);\n\t\t\tif (error instanceof SafeLaunchPreparationError)\n\t\t\t\tthrow new Error(`${error.message}. ${error.safeSummary}`);\n\t\t\tthrow error;\n\t\t}\n\t}\n\treturn {\n\t\t/** @internal */\n\t\tready,\n\t\t/** @internal */\n\t\tmapping,\n\n\t\t/** @internal */\n\t\tresolve,\n\n\t\t/** @internal */\n\t\tchecks,\n\n\t\t/** @internal */\n\t\tconfigure(value: typeof services) {\n\t\t\tif (value?.gitlab !== services?.gitlab)\n\t\t\t\trepositoryCatalog = value\n\t\t\t\t\t? (value.gitlab.repositoryCatalog ?? createGitLabRepositoryCatalog(value.gitlab))\n\t\t\t\t\t: null;\n\t\t\tservices = value;\n\t\t},\n\n\t\t/** @internal */\n\t\tasync readIssue(params: JiraGitLabParams) {\n\t\t\tconst client = requireServices().jira.client(params.jiraProfile);\n\t\t\tif (client.baseUrl !== params.jiraBaseUrl) throw new Error(\"Jira installation changed\");\n\t\t\treturn client.getIssue(params.issueId);\n\t\t},\n\t};\n}\n","import { asUnknownRecord } from \"@leitwerk-dev/domain\";\n\n/** @internal */\nexport function parseJiraModelLabels(config: unknown): Readonly<Record<string, string>> {\n\tconst raw = asUnknownRecord(config)?.model_labels;\n\tif (raw === undefined) return {};\n\tconst labels = asUnknownRecord(raw);\n\tif (!labels) throw new Error(\"Jira model_labels must map labels to model profile IDs\");\n\tconst result: Record<string, string> = {};\n\tfor (const [label, profile] of Object.entries(labels)) {\n\t\tif (\n\t\t\t!/^leitwerk-model-[a-z0-9]+(?:-[a-z0-9]+)*$/.test(label) ||\n\t\t\ttypeof profile !== \"string\" ||\n\t\t\t!profile.trim()\n\t\t)\n\t\t\tthrow new Error(\"Jira model_labels requires leitwerk-model-* labels and model profile IDs\");\n\t\tresult[label] = profile.trim();\n\t}\n\treturn result;\n}\n\n/** @internal */\nexport function selectJiraModel(\n\tlabels: readonly string[],\n\tprofiles: Readonly<Record<string, string>>,\n) {\n\tconst selected = [...new Set(labels.filter((label) => label.startsWith(\"leitwerk-model-\")))];\n\tif (selected.length > 1)\n\t\tthrow new Error(\"Select only one leitwerk-model-* label before starting the change\");\n\tconst label = selected[0];\n\tif (!label) return undefined;\n\tconst profileId = profiles[label];\n\tif (!profileId) throw new Error(`Unknown Jira model label ${label}; correct the label and retry`);\n\treturn { label, profileId };\n}\n"],"mappings":";AAAA,SAAS,qCAAqC;AAC9C;AAAA,EACC;AAAA,EACA;AAAA,OACM;AAEP,SAAS,mBAAAA,wBAAuB;AAChC,SAAS,yBAAyB;AAClC;AAAA,EACC;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EAEC,gBAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACC;AAAA,EAEA;AAAA,OACM;AACP,SAAS,kBAAkB,qBAAqB;AAChD,SAAS,2BAA2B;;;AC7BpC,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;AAClC,SAAS,mBAAAC,wBAA4C;AAErD,SAAS,oCAA4D;AACrE;AAAA,EACC;AAAA,EACA;AAAA,EAIA;AAAA,OACM;AACP;AAAA,EACC;AAAA,EAGA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;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EX,cAAM,IAAI;AAAA,UACT;AAAA,QACD;AACD,2BAAqB,UAAU,QAAQ,sBAAsB;AAC7D,cAAQ,aAAa,SAAS,KAAK,OAAO;AAC1C,YAAM,OAAO,IAAI,QAAQ,eAAe,GACvC,SAAS,IAAI,QAAQ,iBAAiB,GACtC,WAAW,IAAI,QAAQ,wBAAwB;AAChD,UAAI,MAAM,QAAQ,IAAI,KAAK,MAAM,QAAQ,MAAM,KAAK,MAAM,QAAQ,QAAQ;AACzE,cAAM,IAAI,MAAM,2CAA2C;AAC5D,YAAM,OAAO,IAAI,QAAQ,mBAAmB;AAC5C,YAAM,OAAO,IAAI,QAAQ,qBAAqB,WAAW;AACzD,UAAI,MAAM,QAAQ,IAAI,KAAK,MAAM,QAAQ,IAAI;AAC5C,cAAM,IAAI,MAAM,2CAA2C;AAC5D,WAAK,sBAAsB,QAAQ,IAAI,eAAe,MAAM,IAAI,CAAC;AACjE,eAAS,UAAU;AAAA,QAClB,aAAa,qBAAqB,MAAM;AAAA,QACxC;AAAA,QACA;AAAA,QACA,IAAI,MAAM;AACT,gBAAM,MAAM,IAAI,IAAI,iBAAiB;AACrC,cAAI,MAAM,QAAQ,GAAG,EAAG,OAAM,IAAI,MAAM,2CAA2C;AACnF,iBAAO;AAAA,QACR;AAAA,QACA;AAAA,QACA;AAAA,QACA,cAAc,KAAK;AAAA,MACpB,CAAC;AACD,UAAI,OAAO,MAAM,SAAS,UAAU,IAAI,CAAC;AAAA,IAC1C;AAAA,EACD;AACA,SAAO;AAAA;AAAA,IAEN;AAAA;AAAA,IAEA;AAAA;AAAA,IAEA;AAAA,EACD;AACD;AAGO,IAAM,EAAE,WAAW,kBAAkB,SAAS,wBAAwB,IAC5E,uBAAuB,EAAE,QAAQ,KAAK,CAAC;AACxC,IAAO,gBAAQ;","names":["asUnknownRecord","jiraEligible","asUnknownRecord","label","id","asUnknownRecord","mapping","project","jiraEligible","asUnknownRecord"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leitwerk-dev/jira-gitlab-change",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
5
  "leitwerk": {
6
6
  "extension": {
@@ -20,19 +20,19 @@
20
20
  "build": "tsup && tsc -p tsconfig.tsup.json --emitDeclarationOnly"
21
21
  },
22
22
  "dependencies": {
23
- "@leitwerk-dev/domain": "0.4.0",
24
- "@leitwerk-dev/process-sdk": "0.4.0",
25
- "@leitwerk-dev/coding": "0.4.0",
26
- "@leitwerk-dev/gitlab": "0.4.0",
27
- "@leitwerk-dev/git-ssh": "0.4.0",
28
- "@leitwerk-dev/jira": "0.4.0",
29
- "@leitwerk-dev/wiki": "0.4.0",
30
- "@leitwerk-dev/external-writes": "0.4.0"
23
+ "@leitwerk-dev/domain": "0.4.2",
24
+ "@leitwerk-dev/process-sdk": "0.4.2",
25
+ "@leitwerk-dev/coding": "0.4.2",
26
+ "@leitwerk-dev/gitlab": "0.4.2",
27
+ "@leitwerk-dev/git-ssh": "0.4.2",
28
+ "@leitwerk-dev/jira": "0.4.2",
29
+ "@leitwerk-dev/wiki": "0.4.2",
30
+ "@leitwerk-dev/external-writes": "0.4.2"
31
31
  },
32
32
  "devDependencies": {
33
33
  "tsup": "^8.5.1",
34
34
  "@types/node": "^26.2.0",
35
- "@leitwerk-dev/test-support": "0.4.0"
35
+ "@leitwerk-dev/test-support": "0.4.2"
36
36
  },
37
37
  "license": "Apache-2.0",
38
38
  "publishConfig": {
package/src/index.ts CHANGED
@@ -26,7 +26,7 @@ import {
26
26
  type LeitwerkExtensionModule,
27
27
  scopedSettingsCapability,
28
28
  } from "@leitwerk-dev/process-sdk";
29
- import { wikiInstructions } from "@leitwerk-dev/wiki";
29
+ import { wikiInstructions, wikiToolNames } from "@leitwerk-dev/wiki";
30
30
  import { topicWikiCapability } from "@leitwerk-dev/wiki/integration";
31
31
  import {
32
32
  createJiraGitLabLauncher,
@@ -48,8 +48,11 @@ export function createJiraGitLabChange(options: {
48
48
  docker: boolean;
49
49
  /** Opt into the supported Jira verification transition after all changed MRs merge. @internal */
50
50
  verificationOnMerge?: boolean;
51
+ /** Destination for enabled completion transitions. @internal */
52
+ verificationStatus?: "In Verification" | "Ready for Verification";
51
53
  }) {
52
54
  let verificationOnMerge = options.verificationOnMerge ?? false;
55
+ let verificationStatus = options.verificationStatus ?? "In Verification";
53
56
  const launcher = createJiraGitLabLauncher();
54
57
  const adapter = createGitLabPublicationAdapter<JiraGitLabParams>([], namespace);
55
58
  adapter.ensureRequest = async (ctx) => {
@@ -98,7 +101,7 @@ export function createJiraGitLabChange(options: {
98
101
  if (done && verificationOnMerge)
99
102
  await ctx.callIntegrationTool("jira_transition_source_issue", {
100
103
  projectKey,
101
- targetStatus: "In Verification",
104
+ targetStatus: verificationStatus,
102
105
  });
103
106
  if (!cancelled)
104
107
  await ctx.callIntegrationTool("jira_finalize_source_issue", {
@@ -148,12 +151,14 @@ export function createJiraGitLabChange(options: {
148
151
  mode: "plan_bypass",
149
152
  })),
150
153
  },
151
- repositoryCredentials: ({ params }) =>
152
- params.repositories.flatMap((repo) =>
154
+ repositoryCredentials: ({ params }) => {
155
+ if (params.startup) throw new Error("Jira repository bindings are not resolved");
156
+ return params.repositories.flatMap((repo) =>
153
157
  repo.sshProfile
154
158
  ? [{ projectKey: repo.key, kind: "git_ssh" as const, credentialRef: repo.sshProfile }]
155
159
  : gitlabRepositoryCredentials(repo.gitlabProfile, [repo]),
156
- ),
160
+ );
161
+ },
157
162
  });
158
163
  process.runtime = { ...process.runtime, developmentTools: true, docker: options.docker };
159
164
  const plan = process.turns.get("generate_plan")?.definition;
@@ -220,9 +225,7 @@ export function createJiraGitLabChange(options: {
220
225
  ...(originalTools?.(params, state) ?? turn.integrationTools ?? []),
221
226
  "jira_get_source_issue",
222
227
  "jira_get_issue",
223
- ...(params.wikiTopicId
224
- ? ["wiki_index", "wiki_read", "wiki_share", "wiki_edit", "wiki_delete", "wiki_delete_group"]
225
- : []),
228
+ ...(params.wikiTopicId ? wikiToolNames : []),
226
229
  ];
227
230
  turn.prompt = async (ctx) =>
228
231
  `${await originalPrompt({ ...ctx, params: { ...ctx.params, prompt: jiraChangePrompt(ctx.params.issue) } })}${ctx.params.wikiTopicId ? `\n\n${wikiInstructions}\nWiki: /wiki/${ctx.params.wikiTopicId}` : ""}`;
@@ -242,6 +245,16 @@ export function createJiraGitLabChange(options: {
242
245
  if (verification !== undefined && typeof verification !== "boolean")
243
246
  throw new Error("Jira verification_on_merge must be a boolean");
244
247
  verificationOnMerge = verification ?? options.verificationOnMerge ?? false;
248
+ const status = asUnknownRecord(config)?.verification_status;
249
+ if (
250
+ status !== undefined &&
251
+ status !== "In Verification" &&
252
+ status !== "Ready for Verification"
253
+ )
254
+ throw new Error(
255
+ "Jira verification_status must be In Verification or Ready for Verification",
256
+ );
257
+ verificationStatus = status ?? options.verificationStatus ?? "In Verification";
245
258
  adapter.maintenance?.register(api, process);
246
259
  const jira = api.require(jiraIntegration),
247
260
  gitlab = api.require(gitlabIntegration),