@leitwerk-dev/jira 0.0.0-stage → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +122 -2
- package/dist/LICENSE +13 -0
- package/dist/chunk-VUXLYUPG.js +818 -0
- package/dist/chunk-VUXLYUPG.js.map +1 -0
- package/dist/client.d.ts +224 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/index.d.ts +84 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +559 -0
- package/dist/index.js.map +1 -0
- package/dist/markdown.d.ts +5 -0
- package/dist/markdown.d.ts.map +1 -0
- package/dist/testing.d.ts +69 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +389 -0
- package/dist/testing.js.map +1 -0
- package/dist/ticket-creation.d.ts +5 -0
- package/dist/ticket-creation.d.ts.map +1 -0
- package/dist/ticket-text.d.ts +18 -0
- package/dist/ticket-text.d.ts.map +1 -0
- package/dist/tools.d.ts +5 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/wiki.d.ts +11 -0
- package/dist/wiki.d.ts.map +1 -0
- package/dist/workflow-tools.d.ts +11 -0
- package/dist/workflow-tools.d.ts.map +1 -0
- package/package.json +57 -5
- package/src/client.ts +590 -0
- package/src/index.ts +389 -0
- package/src/markdown.ts +327 -0
- package/src/testing.ts +419 -0
- package/src/ticket-creation.ts +219 -0
- package/src/ticket-text.ts +40 -0
- package/src/tools.ts +81 -0
- package/src/wiki.ts +87 -0
- package/src/workflow-tools.ts +161 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
import {
|
|
2
|
+
JiraClient,
|
|
3
|
+
JiraRequestError,
|
|
4
|
+
jiraBaseUrl,
|
|
5
|
+
jiraEligible,
|
|
6
|
+
jiraIsEpic,
|
|
7
|
+
jiraIssueExternalId,
|
|
8
|
+
jiraSplitChildMatches,
|
|
9
|
+
jiraSplitEligible,
|
|
10
|
+
jiraToMarkdown,
|
|
11
|
+
jiraTriggerLabel,
|
|
12
|
+
markdownToJira,
|
|
13
|
+
parseJiraProfiles,
|
|
14
|
+
registerJiraTools
|
|
15
|
+
} from "./chunk-VUXLYUPG.js";
|
|
16
|
+
|
|
17
|
+
// src/index.ts
|
|
18
|
+
import { asUnknownRecord } from "@leitwerk-dev/domain";
|
|
19
|
+
import {
|
|
20
|
+
coreHostCapabilities,
|
|
21
|
+
createCapabilityToken,
|
|
22
|
+
createExternalSourcePollReporter,
|
|
23
|
+
defineProcessWatcherSource,
|
|
24
|
+
parseProcessWatcherLaunchModelConfig,
|
|
25
|
+
parseTicketCreationConfig,
|
|
26
|
+
scopedSettingsCapability
|
|
27
|
+
} from "@leitwerk-dev/process-sdk";
|
|
28
|
+
import { createPollSchedule, emptyPollResult, parseDurationMs } from "@leitwerk-dev/watcher-utils";
|
|
29
|
+
|
|
30
|
+
// src/ticket-creation.ts
|
|
31
|
+
import { createHash } from "crypto";
|
|
32
|
+
import {
|
|
33
|
+
listTicketDestinations,
|
|
34
|
+
objectArg,
|
|
35
|
+
parseTicketDestinationId,
|
|
36
|
+
stringArg,
|
|
37
|
+
ticketDestinationId,
|
|
38
|
+
ticketLabelNames
|
|
39
|
+
} from "@leitwerk-dev/process-sdk";
|
|
40
|
+
var reservedFields = ["project", "issuetype", "summary", "description", "labels"];
|
|
41
|
+
function destinationData(snapshot) {
|
|
42
|
+
const data = objectArg(snapshot.data);
|
|
43
|
+
return {
|
|
44
|
+
profile: stringArg(data, "profile"),
|
|
45
|
+
baseUrl: stringArg(data, "baseUrl"),
|
|
46
|
+
projectId: stringArg(data, "projectId"),
|
|
47
|
+
projectKey: stringArg(data, "projectKey"),
|
|
48
|
+
issueTypeId: stringArg(data, "issueTypeId"),
|
|
49
|
+
defaultLabels: ticketLabelNames(data.defaultLabels)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function validateLabels(issueType, labels) {
|
|
53
|
+
if (labels.length && !Object.hasOwn(issueType.fields, "labels"))
|
|
54
|
+
throw new Error(
|
|
55
|
+
"The selected Jira issue type does not support labels on its create screen; omit labels and set ticket_creation.default_labels to []"
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
function registerJiraTicketCreation(api, integration, config) {
|
|
59
|
+
if (!config.enabled) return;
|
|
60
|
+
const summary = (profile, project, issueType) => ({
|
|
61
|
+
id: `${ticketDestinationId(profile, project.id)}.${issueType.id}`,
|
|
62
|
+
displayName: `${project.key} \xB7 ${project.name} / ${issueType.name}`,
|
|
63
|
+
group: `${profile} \xB7 ${new URL(integration.client(profile).baseUrl).host}`,
|
|
64
|
+
description: `Issue type: ${issueType.name}. Default labels: ${config.defaultLabels.join(", ") || "none"}. Additional fields: ${JSON.stringify(Object.fromEntries(Object.entries(issueType.fields).filter(([key]) => !reservedFields.includes(key))))}`
|
|
65
|
+
});
|
|
66
|
+
const currentDestination = async (data, signal) => {
|
|
67
|
+
const client = integration.client(data.profile);
|
|
68
|
+
if (client.baseUrl !== data.baseUrl) throw new Error("Jira profile installation changed");
|
|
69
|
+
const project = (await client.listCreateProjects(data.projectId, signal)).find(
|
|
70
|
+
(project2) => project2.id === data.projectId
|
|
71
|
+
);
|
|
72
|
+
const issueType = project?.issuetypes.find(
|
|
73
|
+
(type) => type.id === data.issueTypeId && !type.subtask
|
|
74
|
+
);
|
|
75
|
+
if (!project || data.projectKey !== void 0 && project.key !== data.projectKey || !issueType)
|
|
76
|
+
throw new Error(
|
|
77
|
+
"The selected Jira project or issue type is no longer available for creation"
|
|
78
|
+
);
|
|
79
|
+
validateLabels(issueType, data.defaultLabels);
|
|
80
|
+
return { client, project, issueType };
|
|
81
|
+
};
|
|
82
|
+
const destinations = {
|
|
83
|
+
list() {
|
|
84
|
+
return listTicketDestinations(
|
|
85
|
+
"Jira",
|
|
86
|
+
integration.profiles(),
|
|
87
|
+
async (profile) => (await integration.client(profile).listCreateProjects()).flatMap(
|
|
88
|
+
(project) => project.issuetypes.filter((type) => !type.subtask).map((type) => summary(profile, project, type))
|
|
89
|
+
)
|
|
90
|
+
);
|
|
91
|
+
},
|
|
92
|
+
async resolve({ destinationId }) {
|
|
93
|
+
const separator = destinationId.lastIndexOf(".");
|
|
94
|
+
const { profile, resourceId: projectId } = parseTicketDestinationId(
|
|
95
|
+
destinationId.slice(0, separator)
|
|
96
|
+
);
|
|
97
|
+
const issueTypeId = destinationId.slice(separator + 1);
|
|
98
|
+
if (!/^[1-9]\d*$/.test(issueTypeId)) throw new Error("Unknown Jira issue type");
|
|
99
|
+
const client = integration.client(profile);
|
|
100
|
+
const data = {
|
|
101
|
+
profile,
|
|
102
|
+
baseUrl: client.baseUrl,
|
|
103
|
+
projectId,
|
|
104
|
+
issueTypeId,
|
|
105
|
+
defaultLabels: config.defaultLabels
|
|
106
|
+
};
|
|
107
|
+
const { project, issueType } = await currentDestination(data);
|
|
108
|
+
const destination = summary(profile, project, issueType);
|
|
109
|
+
return {
|
|
110
|
+
summary: {
|
|
111
|
+
...destination,
|
|
112
|
+
description: `Default labels: ${config.defaultLabels.join(", ") || "none"}`
|
|
113
|
+
},
|
|
114
|
+
data: { ...data, projectKey: project.key },
|
|
115
|
+
agentContext: destination.description
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
async validate(snapshot) {
|
|
119
|
+
await currentDestination(destinationData(snapshot));
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
api.tool({
|
|
123
|
+
name: "jira_create_issue",
|
|
124
|
+
description: "Create one Jira issue with the selected project's issue type. Write the description in Markdown; the publisher converts it to Jira wiki markup. Supply any required additional fields from its destination metadata; ask the operator when a value is unknown.",
|
|
125
|
+
parameters: {
|
|
126
|
+
type: "object",
|
|
127
|
+
properties: {
|
|
128
|
+
summary: { type: "string", description: "Concise issue title" },
|
|
129
|
+
description: {
|
|
130
|
+
type: "string",
|
|
131
|
+
description: "Complete issue description in Markdown"
|
|
132
|
+
},
|
|
133
|
+
labels: { type: "array", items: { type: "string" } },
|
|
134
|
+
fields: {
|
|
135
|
+
type: "object",
|
|
136
|
+
description: "Additional Jira create fields, keyed by metadata field ID, such as components or customfield_10001. Do not include project, issuetype, summary, description or labels."
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
required: ["summary", "description"]
|
|
140
|
+
},
|
|
141
|
+
capability: {
|
|
142
|
+
kind: "ticket_creation",
|
|
143
|
+
displayName: "Jira",
|
|
144
|
+
processId: "ticket_creation_process",
|
|
145
|
+
startTurnId: "create_ticket",
|
|
146
|
+
titlePath: "/summary",
|
|
147
|
+
descriptionPath: "/description",
|
|
148
|
+
descriptionFormat: "markdown",
|
|
149
|
+
destinations
|
|
150
|
+
},
|
|
151
|
+
async execute(ctx, args) {
|
|
152
|
+
if (!ctx.ticketDestination) throw new Error("A Jira ticket destination is required");
|
|
153
|
+
ctx.signal.throwIfAborted();
|
|
154
|
+
const target = destinationData(ctx.ticketDestination);
|
|
155
|
+
const { client, issueType } = await currentDestination(target, ctx.signal);
|
|
156
|
+
ctx.signal.throwIfAborted();
|
|
157
|
+
const summary2 = stringArg(args, "summary");
|
|
158
|
+
const description = stringArg(args, "description");
|
|
159
|
+
const labels = [.../* @__PURE__ */ new Set([...target.defaultLabels, ...ticketLabelNames(args.labels)])];
|
|
160
|
+
validateLabels(issueType, labels);
|
|
161
|
+
if (labels.some((label) => /\s/.test(label)))
|
|
162
|
+
throw new Error("Jira labels cannot contain spaces");
|
|
163
|
+
const fields = args.fields === void 0 ? {} : objectArg(args.fields);
|
|
164
|
+
for (const key of Object.keys(fields)) {
|
|
165
|
+
if (reservedFields.includes(key) || !Object.hasOwn(issueType.fields, key))
|
|
166
|
+
throw new Error(
|
|
167
|
+
`Jira field '${key}' is not an additional create field for this issue type`
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
for (const [key, field] of Object.entries(issueType.fields)) {
|
|
171
|
+
if (field.required && !field.hasDefaultValue && !reservedFields.includes(key) && (fields[key] == null || fields[key] === "" || Array.isArray(fields[key]) && fields[key].length === 0))
|
|
172
|
+
throw new Error(
|
|
173
|
+
`Jira requires ${field.name} (${key}); request this value before creating the issue`
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
const digest = createHash("sha256").update(ctx.idempotencyKey).digest("hex");
|
|
177
|
+
const marker = `leitwerk-ticket-write:${digest}`;
|
|
178
|
+
const issue = await ctx.externalWrites.ensure(
|
|
179
|
+
{ writeType: "jira.create_issue", dedupKey: ctx.idempotencyKey },
|
|
180
|
+
{
|
|
181
|
+
reconcile: async () => (await client.listProjectIssues(target.projectId, ctx.signal)).find(
|
|
182
|
+
(issue2) => issue2.fields.description?.includes(marker)
|
|
183
|
+
) ?? null,
|
|
184
|
+
execute: () => {
|
|
185
|
+
ctx.signal.throwIfAborted();
|
|
186
|
+
return client.createIssue(
|
|
187
|
+
{
|
|
188
|
+
...fields,
|
|
189
|
+
project: { id: target.projectId },
|
|
190
|
+
issuetype: { id: target.issueTypeId },
|
|
191
|
+
summary: summary2,
|
|
192
|
+
description: `${markdownToJira(description)}
|
|
193
|
+
|
|
194
|
+
{noformat}${marker}{noformat}`,
|
|
195
|
+
...labels.length ? { labels } : {}
|
|
196
|
+
},
|
|
197
|
+
ctx.signal
|
|
198
|
+
);
|
|
199
|
+
},
|
|
200
|
+
toMetadata: (issue2) => ({
|
|
201
|
+
id: issue2.id,
|
|
202
|
+
key: issue2.key,
|
|
203
|
+
url: `${target.baseUrl}/browse/${encodeURIComponent(issue2.key)}`
|
|
204
|
+
})
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
return {
|
|
208
|
+
externalId: issue.key,
|
|
209
|
+
url: `${target.baseUrl}/browse/${encodeURIComponent(issue.key)}`,
|
|
210
|
+
result: issue
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// src/ticket-text.ts
|
|
217
|
+
import { SafeOutcomePlanningError } from "@leitwerk-dev/process-sdk";
|
|
218
|
+
var jiraTicketWritingInstructions = "Use plain English following ASD-STE100. Use at most three headings and at most 120 words under each heading; code snippets do not count toward the word limit. Choose headings that fit the work and include only supported details. Link to internal data instead of copying it. Write summary and description as a normal standalone Jira task for its assignee, using Markdown for the description. Explain the work and acceptance criteria in plain language; retain concrete file paths, prerequisites, and validation steps when needed. Keep evidence, inspected revisions, repository keys, and other tracking data in the separate evidence fields. Do not put raw commit hashes, internal IDs, split identities, solution-wiki references, or model citation tokens in the summary or description. Refer to repositories by their readable names and Jira issues by their issue keys. The publisher adds repository and source-issue links. When revising an existing ticket, preserve useful task details and human notes, and omit any previous generated tracking footer.";
|
|
219
|
+
var internalReference = /\bleitwerk-split-[\w-]+\b|\brepo_\d+\b|\bagt_[a-z0-9]+\b|\b[a-f0-9]{40,64}\b|\bturn\d+(?:file|search|view|fetch)\d+\b|[\uE200-\uE202]|【[^】]*(?:†|turn\d+|repo_\d+)[^】]*】|Leitwerk split identity\s*:|(?:Source issue )?solution wiki\s*:/i;
|
|
220
|
+
function jiraTicketTextProblem(summary, description) {
|
|
221
|
+
return internalReference.test(`${summary}
|
|
222
|
+
${description}`) ? "Revise the ticket summary and description to remove internal references; keep evidence and tracking IDs in the separate evidence fields, then review the revised ticket." : null;
|
|
223
|
+
}
|
|
224
|
+
function assertJiraTicketText(summary, description) {
|
|
225
|
+
const problem = jiraTicketTextProblem(summary, description);
|
|
226
|
+
if (problem) throw new SafeOutcomePlanningError("jira_ticket_internal_reference", problem);
|
|
227
|
+
}
|
|
228
|
+
function ticketDescriptionMarkdown(description, links) {
|
|
229
|
+
const label = (value) => value.replace(/[\\[\]]/g, "\\$&");
|
|
230
|
+
return `${description.trim()}
|
|
231
|
+
|
|
232
|
+
Repository: [${label(links.repositoryName)}](${links.repositoryUrl})
|
|
233
|
+
|
|
234
|
+
Source issue: [${label(links.sourceKey)}](${links.sourceUrl})`;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// src/wiki.ts
|
|
238
|
+
import { createHash as createHash2 } from "crypto";
|
|
239
|
+
function jiraEpicRevision(epic) {
|
|
240
|
+
return createHash2("sha256").update(
|
|
241
|
+
JSON.stringify([
|
|
242
|
+
epic.id,
|
|
243
|
+
epic.fields.project.id,
|
|
244
|
+
epic.fields.summary,
|
|
245
|
+
epic.fields.description,
|
|
246
|
+
epic.fields.components,
|
|
247
|
+
epic.fields.status
|
|
248
|
+
])
|
|
249
|
+
).digest("hex");
|
|
250
|
+
}
|
|
251
|
+
function ensureIssueWiki(store, client, issue, retainedTopicId) {
|
|
252
|
+
let key = JSON.stringify([
|
|
253
|
+
jiraIsEpic(issue) ? "jira.epic" : "jira.issue",
|
|
254
|
+
client.baseUrl,
|
|
255
|
+
issue.id
|
|
256
|
+
]);
|
|
257
|
+
if (retainedTopicId !== void 0) {
|
|
258
|
+
const topic = store.getTopic(retainedTopicId);
|
|
259
|
+
let identity;
|
|
260
|
+
try {
|
|
261
|
+
identity = topic && JSON.parse(topic.key);
|
|
262
|
+
} catch {
|
|
263
|
+
identity = null;
|
|
264
|
+
}
|
|
265
|
+
if (!topic || !Array.isArray(identity) || identity.length !== 3 || typeof identity[0] !== "string" || !identity[0] || identity[1] !== client.baseUrl || identity[2] !== issue.id)
|
|
266
|
+
throw new Error("Source issue wiki binding mismatch");
|
|
267
|
+
key = topic.key;
|
|
268
|
+
}
|
|
269
|
+
return store.ensureTopic({
|
|
270
|
+
key,
|
|
271
|
+
title: `${issue.key}: ${issue.fields.summary}`,
|
|
272
|
+
url: `${client.baseUrl}/browse/${encodeURIComponent(issue.key)}`,
|
|
273
|
+
sourceRevision: jiraEpicRevision(issue)
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
function jiraWikiSource(store, integration) {
|
|
277
|
+
return async (_ctx, binding) => {
|
|
278
|
+
const issueId = binding.issueId ?? binding.epicId;
|
|
279
|
+
if (typeof binding.topicId !== "string" || typeof binding.profile !== "string" || typeof issueId !== "string")
|
|
280
|
+
throw new Error("This process has no source issue wiki binding");
|
|
281
|
+
const client = integration.client(binding.profile);
|
|
282
|
+
if (client.baseUrl !== binding.baseUrl) throw new Error("Jira wiki installation changed");
|
|
283
|
+
const issue = await client.getIssue(issueId);
|
|
284
|
+
if (issue.id !== issueId) throw new Error("Source issue wiki binding mismatch");
|
|
285
|
+
return {
|
|
286
|
+
topic: ensureIssueWiki(store, client, issue, binding.topicId),
|
|
287
|
+
sourceDescription: issue.fields.description ?? ""
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// src/index.ts
|
|
293
|
+
var jiraIntegration = createCapabilityToken(
|
|
294
|
+
"@leitwerk-dev/jira.integration"
|
|
295
|
+
);
|
|
296
|
+
var jiraProjectDiscovery = createCapabilityToken("@leitwerk-dev/jira.project-discovery");
|
|
297
|
+
var jiraSubjectIdentity = (baseUrl, id) => JSON.stringify([baseUrl, id]);
|
|
298
|
+
var jiraIssueWatcherSource = defineProcessWatcherSource({
|
|
299
|
+
id: "@leitwerk-dev/jira.issue",
|
|
300
|
+
label: "Jira issue",
|
|
301
|
+
parseConfig(raw) {
|
|
302
|
+
const c = asUnknownRecord(raw);
|
|
303
|
+
if (typeof c?.enabled !== "boolean" || typeof c.profile !== "string" || !c.profile.trim() || !Array.isArray(c.projects) || !c.projects.length || c.projects.some((id) => typeof id !== "string" || !/^\d+$/.test(id)))
|
|
304
|
+
throw new Error("Jira watcher requires enabled, profile, and explicit project IDs");
|
|
305
|
+
const pollInterval = c.poll_interval ?? "30s";
|
|
306
|
+
if (typeof pollInterval !== "string" || parseDurationMs(pollInterval, -1) <= 0)
|
|
307
|
+
throw new Error("Invalid Jira poll_interval");
|
|
308
|
+
return {
|
|
309
|
+
enabled: c.enabled,
|
|
310
|
+
config: {
|
|
311
|
+
profile: c.profile,
|
|
312
|
+
projects: c.projects,
|
|
313
|
+
pollInterval,
|
|
314
|
+
label: jiraTriggerLabel(c.label)
|
|
315
|
+
},
|
|
316
|
+
launchModelConfig: parseProcessWatcherLaunchModelConfig(c.launch)
|
|
317
|
+
};
|
|
318
|
+
},
|
|
319
|
+
presentConfig: (c) => ({
|
|
320
|
+
targetSummary: `Jira ${c.profile} \xB7 ${c.projects.join(", ")}`,
|
|
321
|
+
details: [{ label: "Trigger", value: jiraTriggerLabel(c.label) }]
|
|
322
|
+
})
|
|
323
|
+
});
|
|
324
|
+
var ISSUE_POLICY = "@leitwerk-dev/jira.issue-policy";
|
|
325
|
+
function jiraIssuePolicy(resolve) {
|
|
326
|
+
return {
|
|
327
|
+
kind: ISSUE_POLICY,
|
|
328
|
+
label: "Jira source policy",
|
|
329
|
+
config: {},
|
|
330
|
+
inputMode: "none",
|
|
331
|
+
resolve
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
function setupJiraIntegration(api, integration, options = {}) {
|
|
335
|
+
const now = options.now ?? Date.now;
|
|
336
|
+
api.provide(jiraIntegration, integration);
|
|
337
|
+
registerJiraTools(api, integration);
|
|
338
|
+
registerJiraTicketCreation(
|
|
339
|
+
api,
|
|
340
|
+
integration,
|
|
341
|
+
options.ticketCreation ?? { enabled: false, defaultLabels: [] }
|
|
342
|
+
);
|
|
343
|
+
const settings = api.get(scopedSettingsCapability);
|
|
344
|
+
const deps = api.get(coreHostCapabilities.serverSetup);
|
|
345
|
+
const configuredProjects = (profile) => /* @__PURE__ */ new Set([
|
|
346
|
+
...options.projects?.get(profile) ?? [],
|
|
347
|
+
...!deps || Array.isArray(deps) ? [] : (deps.processWatchers?.listBySource(jiraIssueWatcherSource) ?? []).filter((watcher) => watcher.config.profile === profile).flatMap((watcher) => watcher.config.projects)
|
|
348
|
+
]);
|
|
349
|
+
const projectsFor = async (profile) => {
|
|
350
|
+
const selected = configuredProjects(profile);
|
|
351
|
+
if (!selected.size) return [];
|
|
352
|
+
const client = integration.client(profile);
|
|
353
|
+
const projects = (await client.listProjects()).filter(
|
|
354
|
+
(project) => selected.has(project.id) || selected.has(project.key)
|
|
355
|
+
);
|
|
356
|
+
return projects;
|
|
357
|
+
};
|
|
358
|
+
const includesProject = (subject) => {
|
|
359
|
+
if (!subject) return false;
|
|
360
|
+
let identity;
|
|
361
|
+
try {
|
|
362
|
+
identity = JSON.parse(subject.identity);
|
|
363
|
+
} catch {
|
|
364
|
+
return false;
|
|
365
|
+
}
|
|
366
|
+
if (!Array.isArray(identity) || identity.length !== 2) return false;
|
|
367
|
+
const [origin, id] = identity;
|
|
368
|
+
return integration.profiles().some((profile) => {
|
|
369
|
+
if (integration.client(profile).baseUrl !== origin) return false;
|
|
370
|
+
const configured = configuredProjects(profile);
|
|
371
|
+
return configured.has(id) || configured.has(subject.label.split(" \xB7 ")[0]);
|
|
372
|
+
});
|
|
373
|
+
};
|
|
374
|
+
api.provide(jiraProjectDiscovery, { projects: projectsFor, includesProject });
|
|
375
|
+
if (settings && !Array.isArray(settings)) {
|
|
376
|
+
settings.registerDiscovery(
|
|
377
|
+
"jira.project",
|
|
378
|
+
async () => {
|
|
379
|
+
const subjects = [];
|
|
380
|
+
for (const profile of integration.profiles()) {
|
|
381
|
+
const client = integration.client(profile);
|
|
382
|
+
for (const project of await projectsFor(profile))
|
|
383
|
+
subjects.push({
|
|
384
|
+
scopeType: "jira.project",
|
|
385
|
+
identity: jiraSubjectIdentity(client.baseUrl, project.id),
|
|
386
|
+
label: `${project.key} \xB7 ${project.name}`
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
return subjects;
|
|
390
|
+
},
|
|
391
|
+
{ includesSubject: (subject) => includesProject(subject) }
|
|
392
|
+
);
|
|
393
|
+
settings.registerDiscovery(
|
|
394
|
+
"jira.component",
|
|
395
|
+
async () => {
|
|
396
|
+
const subjects = [];
|
|
397
|
+
for (const profile of integration.profiles()) {
|
|
398
|
+
const client = integration.client(profile);
|
|
399
|
+
for (const project of await projectsFor(profile)) {
|
|
400
|
+
const parent = settings.discover({
|
|
401
|
+
scopeType: "jira.project",
|
|
402
|
+
identity: jiraSubjectIdentity(client.baseUrl, project.id),
|
|
403
|
+
label: `${project.key} \xB7 ${project.name}`
|
|
404
|
+
});
|
|
405
|
+
for (const component of await client.listComponents(project.id))
|
|
406
|
+
subjects.push({
|
|
407
|
+
scopeType: "jira.component",
|
|
408
|
+
identity: jiraSubjectIdentity(client.baseUrl, component.id),
|
|
409
|
+
label: `${project.key} / ${component.name}`,
|
|
410
|
+
context: { "jira.project": parent.id }
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
return subjects;
|
|
415
|
+
},
|
|
416
|
+
{ includesSubject: (_subject, context) => includesProject(context["jira.project"]) }
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
if (!deps || Array.isArray(deps)) return;
|
|
420
|
+
const shouldPoll = createPollSchedule(now);
|
|
421
|
+
return deps.polling.create({
|
|
422
|
+
id: "jira",
|
|
423
|
+
pollInterval: () => "5s",
|
|
424
|
+
defaultIntervalMs: 5e3,
|
|
425
|
+
isEnabled: () => true,
|
|
426
|
+
async pollOnce() {
|
|
427
|
+
const result = emptyPollResult();
|
|
428
|
+
for (const watcher of deps.processWatchers?.listBySource(jiraIssueWatcherSource) ?? []) {
|
|
429
|
+
const key = `${watcher.processId}:${watcher.watcherId}`;
|
|
430
|
+
if (!watcher.enabled || !shouldPoll(key, watcher.config.pollInterval)) continue;
|
|
431
|
+
try {
|
|
432
|
+
const client = integration.client(watcher.config.profile);
|
|
433
|
+
for (const issue of await client.searchIssues(
|
|
434
|
+
watcher.config.projects,
|
|
435
|
+
watcher.config.label
|
|
436
|
+
)) {
|
|
437
|
+
if (!jiraEligible(issue, watcher.config.label) || !watcher.config.projects.includes(issue.fields.project.id))
|
|
438
|
+
continue;
|
|
439
|
+
const id = jiraIssueExternalId(client.baseUrl, issue.id);
|
|
440
|
+
const launch = await deps.launchRuns.startWatcher(
|
|
441
|
+
watcher,
|
|
442
|
+
{
|
|
443
|
+
profile: watcher.config.profile,
|
|
444
|
+
issue,
|
|
445
|
+
projects: watcher.config.projects,
|
|
446
|
+
triggerLabel: jiraTriggerLabel(watcher.config.label)
|
|
447
|
+
},
|
|
448
|
+
{ idempotencyKey: id }
|
|
449
|
+
);
|
|
450
|
+
if (launch.error)
|
|
451
|
+
result.errors.push(
|
|
452
|
+
`${issue.key}: admission failed; inspect launch diagnostics and component mappings`
|
|
453
|
+
);
|
|
454
|
+
else if (launch.process) result.created.push(id);
|
|
455
|
+
else result.skipped.push(id);
|
|
456
|
+
}
|
|
457
|
+
} catch (error) {
|
|
458
|
+
result.errors.push(error instanceof Error ? error.message : "Jira discovery unavailable");
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
const report = createExternalSourcePollReporter(deps.externalSources, result, {
|
|
462
|
+
forwardGeneration: true,
|
|
463
|
+
currentKinds: [ISSUE_POLICY]
|
|
464
|
+
});
|
|
465
|
+
await report.poll(ISSUE_POLICY, async (armed) => {
|
|
466
|
+
const key = `${armed.instanceId}:${armed.id}:${armed.generation}`;
|
|
467
|
+
if (!shouldPoll(key)) return;
|
|
468
|
+
const c = armed.resolved;
|
|
469
|
+
try {
|
|
470
|
+
const client = integration.client(c.profile);
|
|
471
|
+
if (client.baseUrl !== c.baseUrl) throw new Error("Jira profile installation changed");
|
|
472
|
+
const issue = await client.getIssue(c.issueId);
|
|
473
|
+
if (issue.id !== c.issueId) throw new Error("Uncorrelated Jira issue evidence");
|
|
474
|
+
const fire = c.mode === "plan_bypass" ? jiraEligible(issue, c.triggerLabel) && issue.fields.labels.includes("leitwerk-skip-plan-decision") : !jiraEligible(issue, c.triggerLabel);
|
|
475
|
+
if (fire)
|
|
476
|
+
await report.fire(
|
|
477
|
+
armed,
|
|
478
|
+
{ issueId: issue.id, planRevision: c.planRevision },
|
|
479
|
+
`${issue.id}:${c.mode}:${c.planRevision ?? ""}`
|
|
480
|
+
);
|
|
481
|
+
} catch (error) {
|
|
482
|
+
await report.observe(armed, { refreshError: "Jira issue unavailable; policy unchanged" });
|
|
483
|
+
throw error;
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
return result;
|
|
487
|
+
}
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
var extension = {
|
|
491
|
+
manifest: { id: "jira", version: "0.3.0" },
|
|
492
|
+
scopedSettings: {
|
|
493
|
+
scopes: [
|
|
494
|
+
{ id: "jira.project", label: "Jira projects" },
|
|
495
|
+
{
|
|
496
|
+
id: "jira.component",
|
|
497
|
+
label: "Jira components",
|
|
498
|
+
overview: {
|
|
499
|
+
itemLabel: "Component",
|
|
500
|
+
itemLabelPlural: "Components",
|
|
501
|
+
parentLabel: "Project",
|
|
502
|
+
labelSeparator: " / "
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
],
|
|
506
|
+
settings: []
|
|
507
|
+
},
|
|
508
|
+
setupServer(api, config) {
|
|
509
|
+
const profiles = parseJiraProfiles(config);
|
|
510
|
+
const clients = new Map([...profiles].map(([id, profile]) => [id, new JiraClient(profile)]));
|
|
511
|
+
setupJiraIntegration(
|
|
512
|
+
api,
|
|
513
|
+
{
|
|
514
|
+
profiles: () => [...clients.keys()],
|
|
515
|
+
client: (profile) => {
|
|
516
|
+
const client = clients.get(profile);
|
|
517
|
+
if (!client) throw new Error(`Jira profile '${profile}' is unavailable`);
|
|
518
|
+
return client;
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
ticketCreation: parseTicketCreationConfig(config, "Jira"),
|
|
523
|
+
projects: new Map(
|
|
524
|
+
[...profiles].map(([id, profile]) => [id, profile.project ? [profile.project] : []])
|
|
525
|
+
)
|
|
526
|
+
}
|
|
527
|
+
);
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
var index_default = extension;
|
|
531
|
+
export {
|
|
532
|
+
JiraClient,
|
|
533
|
+
JiraRequestError,
|
|
534
|
+
assertJiraTicketText,
|
|
535
|
+
index_default as default,
|
|
536
|
+
ensureIssueWiki,
|
|
537
|
+
jiraBaseUrl,
|
|
538
|
+
jiraEligible,
|
|
539
|
+
jiraEpicRevision,
|
|
540
|
+
jiraIntegration,
|
|
541
|
+
jiraIsEpic,
|
|
542
|
+
jiraIssueExternalId,
|
|
543
|
+
jiraIssuePolicy,
|
|
544
|
+
jiraIssueWatcherSource,
|
|
545
|
+
jiraProjectDiscovery,
|
|
546
|
+
jiraSplitChildMatches,
|
|
547
|
+
jiraSplitEligible,
|
|
548
|
+
jiraSubjectIdentity,
|
|
549
|
+
jiraTicketTextProblem,
|
|
550
|
+
jiraTicketWritingInstructions,
|
|
551
|
+
jiraToMarkdown,
|
|
552
|
+
jiraTriggerLabel,
|
|
553
|
+
jiraWikiSource,
|
|
554
|
+
markdownToJira,
|
|
555
|
+
parseJiraProfiles,
|
|
556
|
+
setupJiraIntegration,
|
|
557
|
+
ticketDescriptionMarkdown
|
|
558
|
+
};
|
|
559
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/ticket-creation.ts","../src/ticket-text.ts","../src/wiki.ts"],"sourcesContent":["import { asUnknownRecord } from \"@leitwerk-dev/domain\";\nimport {\n\tcoreHostCapabilities,\n\tcreateCapabilityToken,\n\tcreateExternalSourcePollReporter,\n\tdefineProcessWatcherSource,\n\ttype ExternalActionSource,\n\ttype LeitwerkExtensionModule,\n\tparseProcessWatcherLaunchModelConfig,\n\tparseTicketCreationConfig,\n\ttype ServerExtensionAPI,\n\tscopedSettingsCapability,\n\ttype TicketCreationConfig,\n} from \"@leitwerk-dev/process-sdk\";\nimport { createPollSchedule, emptyPollResult, parseDurationMs } from \"@leitwerk-dev/watcher-utils\";\nimport {\n\tJiraClient,\n\ttype JiraClientLike,\n\ttype JiraIssue,\n\tjiraEligible,\n\tjiraIssueExternalId,\n\tjiraTriggerLabel,\n\tparseJiraProfiles,\n} from \"./client.js\";\nimport { registerJiraTicketCreation } from \"./ticket-creation.js\";\nimport { registerJiraTools } from \"./tools.js\";\n\nexport * from \"./client.js\";\nexport { jiraToMarkdown, markdownToJira } from \"./markdown.js\";\nexport {\n\tassertJiraTicketText,\n\tjiraTicketTextProblem,\n\tjiraTicketWritingInstructions,\n\tticketDescriptionMarkdown,\n} from \"./ticket-text.js\";\nexport { ensureIssueWiki, jiraEpicRevision, jiraWikiSource } from \"./wiki.js\";\n\n/** @public */\nexport interface JiraIntegration {\n\t/** @internal */\n\tprofiles(): readonly string[];\n\n\t/** @internal */\n\tclient(profile: string): JiraClientLike;\n}\n\n/** @public */\nexport const jiraIntegration = createCapabilityToken<JiraIntegration>(\n\t\"@leitwerk-dev/jira.integration\",\n);\n\n/** Configured project discovery shared by Jira-backed Settings and launchers. @public */\nexport const jiraProjectDiscovery = createCapabilityToken<{\n\t/** @public */ projects(profile: string): Promise<readonly import(\"./client.js\").JiraProject[]>;\n\t/** @public */ includesProject(\n\t\tsubject: import(\"@leitwerk-dev/domain\").SettingsSubject | undefined,\n\t): boolean;\n}>(\"@leitwerk-dev/jira.project-discovery\");\n\n/** @public */\nexport const jiraSubjectIdentity = (baseUrl: string, id: string) => JSON.stringify([baseUrl, id]);\n\n/** @public */\nexport interface JiraWatcherConfig {\n\t/** @internal */\n\tlabel?: string;\n\t/** @internal */\n\tprofile: string;\n\n\t/** @internal */\n\tprojects: string[];\n\n\t/** @internal */\n\tpollInterval: string;\n}\n\n/** @public */\nexport interface JiraWatcherEvent {\n\t/** @internal */\n\ttriggerLabel?: string;\n\t/** @internal */\n\tprofile: string;\n\n\t/** @internal */\n\tissue: JiraIssue;\n\n\t/** @internal */\n\tprojects: string[];\n}\n\n/** @public */\nexport const jiraIssueWatcherSource = defineProcessWatcherSource<\n\tJiraWatcherConfig,\n\tJiraWatcherEvent\n>({\n\tid: \"@leitwerk-dev/jira.issue\",\n\tlabel: \"Jira issue\",\n\tparseConfig(raw) {\n\t\tconst c = asUnknownRecord(raw);\n\t\tif (\n\t\t\ttypeof c?.enabled !== \"boolean\" ||\n\t\t\ttypeof c.profile !== \"string\" ||\n\t\t\t!c.profile.trim() ||\n\t\t\t!Array.isArray(c.projects) ||\n\t\t\t!c.projects.length ||\n\t\t\tc.projects.some((id) => typeof id !== \"string\" || !/^\\d+$/.test(id))\n\t\t)\n\t\t\tthrow new Error(\"Jira watcher requires enabled, profile, and explicit project IDs\");\n\t\tconst pollInterval = c.poll_interval ?? \"30s\";\n\t\tif (typeof pollInterval !== \"string\" || parseDurationMs(pollInterval, -1) <= 0)\n\t\t\tthrow new Error(\"Invalid Jira poll_interval\");\n\t\treturn {\n\t\t\tenabled: c.enabled,\n\t\t\tconfig: {\n\t\t\t\tprofile: c.profile,\n\t\t\t\tprojects: c.projects as string[],\n\t\t\t\tpollInterval,\n\t\t\t\tlabel: jiraTriggerLabel(c.label),\n\t\t\t},\n\t\t\tlaunchModelConfig: parseProcessWatcherLaunchModelConfig(c.launch),\n\t\t};\n\t},\n\tpresentConfig: (c) => ({\n\t\ttargetSummary: `Jira ${c.profile} · ${c.projects.join(\", \")}`,\n\t\tdetails: [{ label: \"Trigger\", value: jiraTriggerLabel(c.label) }],\n\t}),\n});\n\n/** @public */\nexport interface JiraSourceConfig {\n\t/** @internal */\n\ttriggerLabel?: string;\n\t/** @internal */\n\tprofile: string;\n\t/** @internal */\n\tbaseUrl: string;\n\n\t/** @internal */\n\tissueId: string;\n\n\t/** @internal */\n\tplanRevision?: number;\n\n\t/** @internal */\n\tmode: \"plan_bypass\" | \"cancelled\";\n}\nconst ISSUE_POLICY = \"@leitwerk-dev/jira.issue-policy\";\n\n/** @public */\nexport function jiraIssuePolicy<P, S>(\n\tresolve: (ctx: {\n\t\t/** @internal */\n\t\tparams: P;\n\t\t/** @internal */\n\t\tstate: S;\n\t}) => JiraSourceConfig,\n): ExternalActionSource<P, S, unknown> {\n\treturn {\n\t\tkind: ISSUE_POLICY,\n\t\tlabel: \"Jira source policy\",\n\t\tconfig: {},\n\t\tinputMode: \"none\",\n\t\tresolve,\n\t};\n}\n\n/** @public */\nexport function setupJiraIntegration(\n\tapi: ServerExtensionAPI,\n\tintegration: JiraIntegration,\n\toptions: {\n\t\t/** @public */\n\t\tnow?: () => number;\n\t\t/** @internal */\n\t\tticketCreation?: TicketCreationConfig;\n\t\t/** Project IDs or keys explicitly selected by integration profiles. @internal */\n\t\tprojects?: ReadonlyMap<string, readonly string[]>;\n\t} = {},\n) {\n\tconst now = options.now ?? Date.now;\n\tapi.provide(jiraIntegration, integration);\n\tregisterJiraTools(api, integration);\n\tregisterJiraTicketCreation(\n\t\tapi,\n\t\tintegration,\n\t\toptions.ticketCreation ?? { enabled: false, defaultLabels: [] },\n\t);\n\tconst settings = api.get(scopedSettingsCapability);\n\tconst deps = api.get(coreHostCapabilities.serverSetup);\n\tconst configuredProjects = (profile: string) =>\n\t\tnew Set([\n\t\t\t...(options.projects?.get(profile) ?? []),\n\t\t\t...(!deps || Array.isArray(deps)\n\t\t\t\t? []\n\t\t\t\t: (deps.processWatchers?.listBySource(jiraIssueWatcherSource) ?? [])\n\t\t\t\t\t\t.filter((watcher) => watcher.config.profile === profile)\n\t\t\t\t\t\t.flatMap((watcher) => watcher.config.projects)),\n\t\t]);\n\tconst projectsFor = async (profile: string) => {\n\t\tconst selected = configuredProjects(profile);\n\t\tif (!selected.size) return [];\n\t\tconst client = integration.client(profile);\n\t\tconst projects = (await client.listProjects()).filter(\n\t\t\t(project) => selected.has(project.id) || selected.has(project.key),\n\t\t);\n\t\treturn projects;\n\t};\n\tconst includesProject = (subject: import(\"@leitwerk-dev/domain\").SettingsSubject | undefined) => {\n\t\tif (!subject) return false;\n\t\tlet identity: unknown;\n\t\ttry {\n\t\t\tidentity = JSON.parse(subject.identity);\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t\tif (!Array.isArray(identity) || identity.length !== 2) return false;\n\t\tconst [origin, id] = identity;\n\t\treturn integration.profiles().some((profile) => {\n\t\t\tif (integration.client(profile).baseUrl !== origin) return false;\n\t\t\tconst configured = configuredProjects(profile);\n\t\t\treturn configured.has(id) || configured.has(subject.label.split(\" · \")[0]);\n\t\t});\n\t};\n\tapi.provide(jiraProjectDiscovery, { projects: projectsFor, includesProject });\n\tif (settings && !Array.isArray(settings)) {\n\t\tsettings.registerDiscovery(\n\t\t\t\"jira.project\",\n\t\t\tasync () => {\n\t\t\t\tconst subjects = [];\n\t\t\t\tfor (const profile of integration.profiles()) {\n\t\t\t\t\tconst client = integration.client(profile);\n\t\t\t\t\tfor (const project of await projectsFor(profile))\n\t\t\t\t\t\tsubjects.push({\n\t\t\t\t\t\t\tscopeType: \"jira.project\",\n\t\t\t\t\t\t\tidentity: jiraSubjectIdentity(client.baseUrl, project.id),\n\t\t\t\t\t\t\tlabel: `${project.key} · ${project.name}`,\n\t\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn subjects;\n\t\t\t},\n\t\t\t{ includesSubject: (subject) => includesProject(subject) },\n\t\t);\n\t\tsettings.registerDiscovery(\n\t\t\t\"jira.component\",\n\t\t\tasync () => {\n\t\t\t\tconst subjects = [];\n\t\t\t\tfor (const profile of integration.profiles()) {\n\t\t\t\t\tconst client = integration.client(profile);\n\t\t\t\t\tfor (const project of await projectsFor(profile)) {\n\t\t\t\t\t\tconst parent = settings.discover({\n\t\t\t\t\t\t\tscopeType: \"jira.project\",\n\t\t\t\t\t\t\tidentity: jiraSubjectIdentity(client.baseUrl, project.id),\n\t\t\t\t\t\t\tlabel: `${project.key} · ${project.name}`,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tfor (const component of await client.listComponents(project.id))\n\t\t\t\t\t\t\tsubjects.push({\n\t\t\t\t\t\t\t\tscopeType: \"jira.component\",\n\t\t\t\t\t\t\t\tidentity: jiraSubjectIdentity(client.baseUrl, component.id),\n\t\t\t\t\t\t\t\tlabel: `${project.key} / ${component.name}`,\n\t\t\t\t\t\t\t\tcontext: { \"jira.project\": parent.id },\n\t\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn subjects;\n\t\t\t},\n\t\t\t{ includesSubject: (_subject, context) => includesProject(context[\"jira.project\"]) },\n\t\t);\n\t}\n\tif (!deps || Array.isArray(deps)) return;\n\tconst shouldPoll = createPollSchedule(now);\n\treturn deps.polling.create({\n\t\tid: \"jira\",\n\t\tpollInterval: () => \"5s\",\n\t\tdefaultIntervalMs: 5000,\n\t\tisEnabled: () => true,\n\t\tasync pollOnce() {\n\t\t\tconst result = emptyPollResult();\n\t\t\tfor (const watcher of deps.processWatchers?.listBySource(jiraIssueWatcherSource) ?? []) {\n\t\t\t\tconst key = `${watcher.processId}:${watcher.watcherId}`;\n\t\t\t\tif (!watcher.enabled || !shouldPoll(key, watcher.config.pollInterval)) continue;\n\t\t\t\ttry {\n\t\t\t\t\tconst client = integration.client(watcher.config.profile);\n\t\t\t\t\tfor (const issue of await client.searchIssues(\n\t\t\t\t\t\twatcher.config.projects,\n\t\t\t\t\t\twatcher.config.label,\n\t\t\t\t\t)) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t!jiraEligible(issue, watcher.config.label) ||\n\t\t\t\t\t\t\t!watcher.config.projects.includes(issue.fields.project.id)\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\tconst id = jiraIssueExternalId(client.baseUrl, issue.id);\n\t\t\t\t\t\tconst launch = await deps.launchRuns.startWatcher(\n\t\t\t\t\t\t\twatcher,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tprofile: watcher.config.profile,\n\t\t\t\t\t\t\t\tissue,\n\t\t\t\t\t\t\t\tprojects: watcher.config.projects,\n\t\t\t\t\t\t\t\ttriggerLabel: jiraTriggerLabel(watcher.config.label),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{ idempotencyKey: id },\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (launch.error)\n\t\t\t\t\t\t\tresult.errors.push(\n\t\t\t\t\t\t\t\t`${issue.key}: admission failed; inspect launch diagnostics and component mappings`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\telse if (launch.process) result.created.push(id);\n\t\t\t\t\t\telse result.skipped.push(id);\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tresult.errors.push(error instanceof Error ? error.message : \"Jira discovery unavailable\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst report = createExternalSourcePollReporter(deps.externalSources, result, {\n\t\t\t\tforwardGeneration: true,\n\t\t\t\tcurrentKinds: [ISSUE_POLICY],\n\t\t\t});\n\t\t\tawait report.poll(ISSUE_POLICY, async (armed) => {\n\t\t\t\tconst key = `${armed.instanceId}:${armed.id}:${armed.generation}`;\n\t\t\t\tif (!shouldPoll(key)) return;\n\t\t\t\tconst c = armed.resolved as unknown as JiraSourceConfig;\n\t\t\t\ttry {\n\t\t\t\t\tconst client = integration.client(c.profile);\n\t\t\t\t\tif (client.baseUrl !== c.baseUrl) throw new Error(\"Jira profile installation changed\");\n\t\t\t\t\tconst issue = await client.getIssue(c.issueId);\n\t\t\t\t\tif (issue.id !== c.issueId) throw new Error(\"Uncorrelated Jira issue evidence\");\n\t\t\t\t\tconst fire =\n\t\t\t\t\t\tc.mode === \"plan_bypass\"\n\t\t\t\t\t\t\t? jiraEligible(issue, c.triggerLabel) &&\n\t\t\t\t\t\t\t\tissue.fields.labels.includes(\"leitwerk-skip-plan-decision\")\n\t\t\t\t\t\t\t: !jiraEligible(issue, c.triggerLabel);\n\t\t\t\t\tif (fire)\n\t\t\t\t\t\tawait report.fire(\n\t\t\t\t\t\t\tarmed,\n\t\t\t\t\t\t\t{ issueId: issue.id, planRevision: c.planRevision },\n\t\t\t\t\t\t\t`${issue.id}:${c.mode}:${c.planRevision ?? \"\"}`,\n\t\t\t\t\t\t);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tawait report.observe(armed, { refreshError: \"Jira issue unavailable; policy unchanged\" });\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn result;\n\t\t},\n\t});\n}\n\n/** @public */\nconst extension: LeitwerkExtensionModule = {\n\tmanifest: { id: \"jira\", version: \"0.3.0\" },\n\tscopedSettings: {\n\t\tscopes: [\n\t\t\t{ id: \"jira.project\", label: \"Jira projects\" },\n\t\t\t{\n\t\t\t\tid: \"jira.component\",\n\t\t\t\tlabel: \"Jira components\",\n\t\t\t\toverview: {\n\t\t\t\t\titemLabel: \"Component\",\n\t\t\t\t\titemLabelPlural: \"Components\",\n\t\t\t\t\tparentLabel: \"Project\",\n\t\t\t\t\tlabelSeparator: \" / \",\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tsettings: [],\n\t},\n\tsetupServer(api, config) {\n\t\tconst profiles = parseJiraProfiles(config);\n\t\tconst clients = new Map([...profiles].map(([id, profile]) => [id, new JiraClient(profile)]));\n\t\tsetupJiraIntegration(\n\t\t\tapi,\n\t\t\t{\n\t\t\t\tprofiles: () => [...clients.keys()],\n\t\t\t\tclient: (profile) => {\n\t\t\t\t\tconst client = clients.get(profile);\n\t\t\t\t\tif (!client) throw new Error(`Jira profile '${profile}' is unavailable`);\n\t\t\t\t\treturn client;\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tticketCreation: parseTicketCreationConfig(config, \"Jira\"),\n\t\t\t\tprojects: new Map(\n\t\t\t\t\t[...profiles].map(([id, profile]) => [id, profile.project ? [profile.project] : []]),\n\t\t\t\t),\n\t\t\t},\n\t\t);\n\t},\n};\nexport default extension;\n","import { createHash } from \"node:crypto\";\nimport {\n\tlistTicketDestinations,\n\tobjectArg,\n\tparseTicketDestinationId,\n\ttype ServerExtensionAPI,\n\tstringArg,\n\ttype TicketCreationConfig,\n\ttype TicketCreationDestinationProvider,\n\ttype TicketCreationDestinationSnapshot,\n\tticketDestinationId,\n\tticketLabelNames,\n} from \"@leitwerk-dev/process-sdk\";\nimport type { JiraCreateProject } from \"./client.js\";\nimport type { JiraIntegration } from \"./index.js\";\nimport { markdownToJira } from \"./markdown.js\";\n\nconst reservedFields = [\"project\", \"issuetype\", \"summary\", \"description\", \"labels\"];\n\nfunction destinationData(snapshot: TicketCreationDestinationSnapshot) {\n\tconst data = objectArg(snapshot.data);\n\treturn {\n\t\tprofile: stringArg(data, \"profile\"),\n\t\tbaseUrl: stringArg(data, \"baseUrl\"),\n\t\tprojectId: stringArg(data, \"projectId\"),\n\t\tprojectKey: stringArg(data, \"projectKey\"),\n\t\tissueTypeId: stringArg(data, \"issueTypeId\"),\n\t\tdefaultLabels: ticketLabelNames(data.defaultLabels),\n\t};\n}\n\nfunction validateLabels(issueType: JiraCreateProject[\"issuetypes\"][number], labels: string[]) {\n\tif (labels.length && !Object.hasOwn(issueType.fields, \"labels\"))\n\t\tthrow new Error(\n\t\t\t\"The selected Jira issue type does not support labels on its create screen; omit labels and set ticket_creation.default_labels to []\",\n\t\t);\n}\n\n/** @internal */\nexport function registerJiraTicketCreation(\n\tapi: ServerExtensionAPI,\n\tintegration: JiraIntegration,\n\tconfig: TicketCreationConfig,\n): void {\n\tif (!config.enabled) return;\n\tconst summary = (\n\t\tprofile: string,\n\t\tproject: JiraCreateProject,\n\t\tissueType: JiraCreateProject[\"issuetypes\"][number],\n\t) => ({\n\t\tid: `${ticketDestinationId(profile, project.id)}.${issueType.id}`,\n\t\tdisplayName: `${project.key} · ${project.name} / ${issueType.name}`,\n\t\tgroup: `${profile} · ${new URL(integration.client(profile).baseUrl).host}`,\n\t\tdescription: `Issue type: ${issueType.name}. Default labels: ${config.defaultLabels.join(\", \") || \"none\"}. Additional fields: ${JSON.stringify(Object.fromEntries(Object.entries(issueType.fields).filter(([key]) => !reservedFields.includes(key))))}`,\n\t});\n\tconst currentDestination = async (\n\t\tdata: Omit<ReturnType<typeof destinationData>, \"projectKey\"> & { projectKey?: string },\n\t\tsignal?: AbortSignal,\n\t) => {\n\t\tconst client = integration.client(data.profile);\n\t\tif (client.baseUrl !== data.baseUrl) throw new Error(\"Jira profile installation changed\");\n\t\tconst project = (await client.listCreateProjects(data.projectId, signal)).find(\n\t\t\t(project) => project.id === data.projectId,\n\t\t);\n\t\tconst issueType = project?.issuetypes.find(\n\t\t\t(type) => type.id === data.issueTypeId && !type.subtask,\n\t\t);\n\t\tif (\n\t\t\t!project ||\n\t\t\t(data.projectKey !== undefined && project.key !== data.projectKey) ||\n\t\t\t!issueType\n\t\t)\n\t\t\tthrow new Error(\n\t\t\t\t\"The selected Jira project or issue type is no longer available for creation\",\n\t\t\t);\n\t\tvalidateLabels(issueType, data.defaultLabels);\n\t\treturn { client, project, issueType };\n\t};\n\tconst destinations: TicketCreationDestinationProvider = {\n\t\tlist() {\n\t\t\treturn listTicketDestinations(\"Jira\", integration.profiles(), async (profile) =>\n\t\t\t\t(await integration.client(profile).listCreateProjects()).flatMap((project) =>\n\t\t\t\t\tproject.issuetypes\n\t\t\t\t\t\t.filter((type) => !type.subtask)\n\t\t\t\t\t\t.map((type) => summary(profile, project, type)),\n\t\t\t\t),\n\t\t\t);\n\t\t},\n\t\tasync resolve({ destinationId }) {\n\t\t\tconst separator = destinationId.lastIndexOf(\".\");\n\t\t\tconst { profile, resourceId: projectId } = parseTicketDestinationId(\n\t\t\t\tdestinationId.slice(0, separator),\n\t\t\t);\n\t\t\tconst issueTypeId = destinationId.slice(separator + 1);\n\t\t\tif (!/^[1-9]\\d*$/.test(issueTypeId)) throw new Error(\"Unknown Jira issue type\");\n\t\t\tconst client = integration.client(profile);\n\t\t\tconst data = {\n\t\t\t\tprofile,\n\t\t\t\tbaseUrl: client.baseUrl,\n\t\t\t\tprojectId,\n\t\t\t\tissueTypeId,\n\t\t\t\tdefaultLabels: config.defaultLabels,\n\t\t\t};\n\t\t\tconst { project, issueType } = await currentDestination(data);\n\t\t\tconst destination = summary(profile, project, issueType);\n\t\t\treturn {\n\t\t\t\tsummary: {\n\t\t\t\t\t...destination,\n\t\t\t\t\tdescription: `Default labels: ${config.defaultLabels.join(\", \") || \"none\"}`,\n\t\t\t\t},\n\t\t\t\tdata: { ...data, projectKey: project.key },\n\t\t\t\tagentContext: destination.description,\n\t\t\t};\n\t\t},\n\t\tasync validate(snapshot) {\n\t\t\tawait currentDestination(destinationData(snapshot));\n\t\t},\n\t};\n\tapi.tool<Record<string, unknown>>({\n\t\tname: \"jira_create_issue\",\n\t\tdescription:\n\t\t\t\"Create one Jira issue with the selected project's issue type. Write the description in Markdown; the publisher converts it to Jira wiki markup. Supply any required additional fields from its destination metadata; ask the operator when a value is unknown.\",\n\t\tparameters: {\n\t\t\ttype: \"object\",\n\t\t\tproperties: {\n\t\t\t\tsummary: { type: \"string\", description: \"Concise issue title\" },\n\t\t\t\tdescription: {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tdescription: \"Complete issue description in Markdown\",\n\t\t\t\t},\n\t\t\t\tlabels: { type: \"array\", items: { type: \"string\" } },\n\t\t\t\tfields: {\n\t\t\t\t\ttype: \"object\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Additional Jira create fields, keyed by metadata field ID, such as components or customfield_10001. Do not include project, issuetype, summary, description or labels.\",\n\t\t\t\t},\n\t\t\t},\n\t\t\trequired: [\"summary\", \"description\"],\n\t\t},\n\t\tcapability: {\n\t\t\tkind: \"ticket_creation\",\n\t\t\tdisplayName: \"Jira\",\n\t\t\tprocessId: \"ticket_creation_process\",\n\t\t\tstartTurnId: \"create_ticket\",\n\t\t\ttitlePath: \"/summary\",\n\t\t\tdescriptionPath: \"/description\",\n\t\t\tdescriptionFormat: \"markdown\",\n\t\t\tdestinations,\n\t\t},\n\t\tasync execute(ctx, args) {\n\t\t\tif (!ctx.ticketDestination) throw new Error(\"A Jira ticket destination is required\");\n\t\t\tctx.signal.throwIfAborted();\n\t\t\tconst target = destinationData(ctx.ticketDestination);\n\t\t\tconst { client, issueType } = await currentDestination(target, ctx.signal);\n\t\t\tctx.signal.throwIfAborted();\n\t\t\tconst summary = stringArg(args, \"summary\");\n\t\t\tconst description = stringArg(args, \"description\");\n\t\t\tconst labels = [...new Set([...target.defaultLabels, ...ticketLabelNames(args.labels)])];\n\t\t\tvalidateLabels(issueType, labels);\n\t\t\tif (labels.some((label) => /\\s/.test(label)))\n\t\t\t\tthrow new Error(\"Jira labels cannot contain spaces\");\n\t\t\tconst fields = args.fields === undefined ? {} : objectArg(args.fields);\n\t\t\tfor (const key of Object.keys(fields)) {\n\t\t\t\tif (reservedFields.includes(key) || !Object.hasOwn(issueType.fields, key))\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Jira field '${key}' is not an additional create field for this issue type`,\n\t\t\t\t\t);\n\t\t\t}\n\t\t\tfor (const [key, field] of Object.entries(issueType.fields)) {\n\t\t\t\tif (\n\t\t\t\t\tfield.required &&\n\t\t\t\t\t!field.hasDefaultValue &&\n\t\t\t\t\t!reservedFields.includes(key) &&\n\t\t\t\t\t(fields[key] == null ||\n\t\t\t\t\t\tfields[key] === \"\" ||\n\t\t\t\t\t\t(Array.isArray(fields[key]) && fields[key].length === 0))\n\t\t\t\t)\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Jira requires ${field.name} (${key}); request this value before creating the issue`,\n\t\t\t\t\t);\n\t\t\t}\n\t\t\tconst digest = createHash(\"sha256\").update(ctx.idempotencyKey).digest(\"hex\");\n\t\t\tconst marker = `leitwerk-ticket-write:${digest}`;\n\t\t\tconst issue = await ctx.externalWrites.ensure(\n\t\t\t\t{ writeType: \"jira.create_issue\", dedupKey: ctx.idempotencyKey },\n\t\t\t\t{\n\t\t\t\t\treconcile: async () =>\n\t\t\t\t\t\t(await client.listProjectIssues(target.projectId, ctx.signal)).find((issue) =>\n\t\t\t\t\t\t\tissue.fields.description?.includes(marker),\n\t\t\t\t\t\t) ?? null,\n\t\t\t\t\texecute: () => {\n\t\t\t\t\t\tctx.signal.throwIfAborted();\n\t\t\t\t\t\treturn client.createIssue(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t...fields,\n\t\t\t\t\t\t\t\tproject: { id: target.projectId },\n\t\t\t\t\t\t\t\tissuetype: { id: target.issueTypeId },\n\t\t\t\t\t\t\t\tsummary,\n\t\t\t\t\t\t\t\tdescription: `${markdownToJira(description)}\\n\\n{noformat}${marker}{noformat}`,\n\t\t\t\t\t\t\t\t...(labels.length ? { labels } : {}),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tctx.signal,\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t\ttoMetadata: (issue) => ({\n\t\t\t\t\t\tid: issue.id,\n\t\t\t\t\t\tkey: issue.key,\n\t\t\t\t\t\turl: `${target.baseUrl}/browse/${encodeURIComponent(issue.key)}`,\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn {\n\t\t\t\texternalId: issue.key,\n\t\t\t\turl: `${target.baseUrl}/browse/${encodeURIComponent(issue.key)}`,\n\t\t\t\tresult: issue,\n\t\t\t};\n\t\t},\n\t});\n}\n","import { SafeOutcomePlanningError } from \"@leitwerk-dev/process-sdk\";\n\n/** @internal */\nexport const jiraTicketWritingInstructions =\n\t\"Use plain English following ASD-STE100. Use at most three headings and at most 120 words under each heading; code snippets do not count toward the word limit. Choose headings that fit the work and include only supported details. Link to internal data instead of copying it. Write summary and description as a normal standalone Jira task for its assignee, using Markdown for the description. Explain the work and acceptance criteria in plain language; retain concrete file paths, prerequisites, and validation steps when needed. Keep evidence, inspected revisions, repository keys, and other tracking data in the separate evidence fields. Do not put raw commit hashes, internal IDs, split identities, solution-wiki references, or model citation tokens in the summary or description. Refer to repositories by their readable names and Jira issues by their issue keys. The publisher adds repository and source-issue links. When revising an existing ticket, preserve useful task details and human notes, and omit any previous generated tracking footer.\";\n\n// These are references produced by the tools and publisher, not task requirements.\nconst internalReference =\n\t/\\bleitwerk-split-[\\w-]+\\b|\\brepo_\\d+\\b|\\bagt_[a-z0-9]+\\b|\\b[a-f0-9]{40,64}\\b|\\bturn\\d+(?:file|search|view|fetch)\\d+\\b|[\\uE200-\\uE202]|【[^】]*(?:†|turn\\d+|repo_\\d+)[^】]*】|Leitwerk split identity\\s*:|(?:Source issue )?solution wiki\\s*:/i;\n\n/** @internal */\nexport function jiraTicketTextProblem(summary: string, description: string): string | null {\n\treturn internalReference.test(`${summary}\\n${description}`)\n\t\t? \"Revise the ticket summary and description to remove internal references; keep evidence and tracking IDs in the separate evidence fields, then review the revised ticket.\"\n\t\t: null;\n}\n\n/** @internal */\nexport function assertJiraTicketText(summary: string, description: string): void {\n\tconst problem = jiraTicketTextProblem(summary, description);\n\tif (problem) throw new SafeOutcomePlanningError(\"jira_ticket_internal_reference\", problem);\n}\n\n/** @internal */\nexport function ticketDescriptionMarkdown(\n\tdescription: string,\n\tlinks: {\n\t\t/** @internal */\n\t\trepositoryName: string;\n\t\t/** @internal */\n\t\trepositoryUrl: string;\n\t\t/** @internal */\n\t\tsourceKey: string;\n\t\t/** @internal */\n\t\tsourceUrl: string;\n\t},\n): string {\n\tconst label = (value: string) => value.replace(/[\\\\[\\]]/g, \"\\\\$&\");\n\treturn `${description.trim()}\\n\\nRepository: [${label(links.repositoryName)}](${links.repositoryUrl})\\n\\nSource issue: [${label(links.sourceKey)}](${links.sourceUrl})`;\n}\n","import { createHash } from \"node:crypto\";\nimport type { TopicWikiStore } from \"@leitwerk-dev/wiki\";\nimport type { WikiSourceResolver } from \"@leitwerk-dev/wiki/integration\";\nimport { type JiraClientLike, type JiraIssue, jiraIsEpic } from \"./client.js\";\nimport type { JiraIntegration } from \"./index.js\";\n\n/** @internal */\nexport function jiraEpicRevision(epic: JiraIssue): string {\n\treturn createHash(\"sha256\")\n\t\t.update(\n\t\t\tJSON.stringify([\n\t\t\t\tepic.id,\n\t\t\t\tepic.fields.project.id,\n\t\t\t\tepic.fields.summary,\n\t\t\t\tepic.fields.description,\n\t\t\t\tepic.fields.components,\n\t\t\t\tepic.fields.status,\n\t\t\t]),\n\t\t)\n\t\t.digest(\"hex\");\n}\n\n/** @internal */\nexport function ensureIssueWiki(\n\tstore: TopicWikiStore,\n\tclient: JiraClientLike,\n\tissue: JiraIssue,\n\tretainedTopicId?: string,\n) {\n\tlet key = JSON.stringify([\n\t\tjiraIsEpic(issue) ? \"jira.epic\" : \"jira.issue\",\n\t\tclient.baseUrl,\n\t\tissue.id,\n\t]);\n\tif (retainedTopicId !== undefined) {\n\t\t// Only callers with a durable publication receipt or process binding may supply an ID.\n\t\t// Older publishers used their own namespace for the same installation / issue identity.\n\t\tconst topic = store.getTopic(retainedTopicId);\n\t\tlet identity: unknown;\n\t\ttry {\n\t\t\tidentity = topic && JSON.parse(topic.key);\n\t\t} catch {\n\t\t\tidentity = null;\n\t\t}\n\t\tif (\n\t\t\t!topic ||\n\t\t\t!Array.isArray(identity) ||\n\t\t\tidentity.length !== 3 ||\n\t\t\ttypeof identity[0] !== \"string\" ||\n\t\t\t!identity[0] ||\n\t\t\tidentity[1] !== client.baseUrl ||\n\t\t\tidentity[2] !== issue.id\n\t\t)\n\t\t\tthrow new Error(\"Source issue wiki binding mismatch\");\n\t\tkey = topic.key;\n\t}\n\treturn store.ensureTopic({\n\t\tkey,\n\t\ttitle: `${issue.key}: ${issue.fields.summary}`,\n\t\turl: `${client.baseUrl}/browse/${encodeURIComponent(issue.key)}`,\n\t\tsourceRevision: jiraEpicRevision(issue),\n\t});\n}\n\n/** Refreshes retained current and legacy issue bindings; credentials stay in the integration. @internal */\nexport function jiraWikiSource(\n\tstore: TopicWikiStore,\n\tintegration: JiraIntegration,\n): WikiSourceResolver {\n\treturn async (_ctx, binding) => {\n\t\tconst issueId = binding.issueId ?? binding.epicId;\n\t\tif (\n\t\t\ttypeof binding.topicId !== \"string\" ||\n\t\t\ttypeof binding.profile !== \"string\" ||\n\t\t\ttypeof issueId !== \"string\"\n\t\t)\n\t\t\tthrow new Error(\"This process has no source issue wiki binding\");\n\t\tconst client = integration.client(binding.profile);\n\t\tif (client.baseUrl !== binding.baseUrl) throw new Error(\"Jira wiki installation changed\");\n\t\tconst issue = await client.getIssue(issueId);\n\t\tif (issue.id !== issueId) throw new Error(\"Source issue wiki binding mismatch\");\n\t\treturn {\n\t\t\ttopic: ensureIssueWiki(store, client, issue, binding.topicId),\n\t\t\tsourceDescription: issue.fields.description ?? \"\",\n\t\t};\n\t};\n}\n"],"mappings":";;;;;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,IACA,UAAU,CAAC;AAAA,EACZ;AAAA,EACA,YAAY,KAAK,QAAQ;AACxB,UAAM,WAAW,kBAAkB,MAAM;AACzC,UAAM,UAAU,IAAI,IAAI,CAAC,GAAG,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,OAAO,MAAM,CAAC,IAAI,IAAI,WAAW,OAAO,CAAC,CAAC,CAAC;AAC3F;AAAA,MACC;AAAA,MACA;AAAA,QACC,UAAU,MAAM,CAAC,GAAG,QAAQ,KAAK,CAAC;AAAA,QAClC,QAAQ,CAAC,YAAY;AACpB,gBAAM,SAAS,QAAQ,IAAI,OAAO;AAClC,cAAI,CAAC,OAAQ,OAAM,IAAI,MAAM,iBAAiB,OAAO,kBAAkB;AACvE,iBAAO;AAAA,QACR;AAAA,MACD;AAAA,MACA;AAAA,QACC,gBAAgB,0BAA0B,QAAQ,MAAM;AAAA,QACxD,UAAU,IAAI;AAAA,UACb,CAAC,GAAG,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,OAAO,MAAM,CAAC,IAAI,QAAQ,UAAU,CAAC,QAAQ,OAAO,IAAI,CAAC,CAAC,CAAC;AAAA,QACpF;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;AACA,IAAO,gBAAQ;","names":["project","summary","issue","createHash","createHash"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Converts ticket Markdown to Jira Server/Data Center wiki markup. @internal */
|
|
2
|
+
export declare function markdownToJira(markdown: string): string;
|
|
3
|
+
/** Converts Jira wiki markup to Markdown while retaining unsupported macros as text. @internal */
|
|
4
|
+
export declare function jiraToMarkdown(markup: string | null | undefined): string;
|
|
5
|
+
//# sourceMappingURL=markdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../src/markdown.ts"],"names":[],"mappings":"AAoGA,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIvD;AAiLD,kGAAkG;AAClG,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CA2CxE"}
|