@sentry/junior-linear 0.232.0 → 0.233.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +49 -18
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -169,21 +169,51 @@ var short = (value) => {
|
|
|
169
169
|
return text ? text.length > 64 ? `${text.slice(0, 63)}\u2026` : text : void 0;
|
|
170
170
|
};
|
|
171
171
|
var factName = (value) => short(typeof value === "string" ? value : value?.name);
|
|
172
|
-
var
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}).
|
|
172
|
+
var issueIdentifier = z2.string().trim().regex(/^[a-z][a-z0-9]*-\d+$/i);
|
|
173
|
+
var savedIssueSchema = z2.object({
|
|
174
|
+
identifier: issueIdentifier.optional(),
|
|
175
|
+
id: z2.string().optional(),
|
|
176
|
+
url: z2.url(),
|
|
177
|
+
title: z2.string().optional(),
|
|
178
|
+
description: z2.string().nullish(),
|
|
179
|
+
status: z2.string().optional(),
|
|
180
|
+
assignee: namedFact,
|
|
181
|
+
priority: z2.union([z2.string(), z2.number(), z2.object({ name: z2.string() })]).nullish(),
|
|
182
|
+
project: namedFact,
|
|
183
|
+
cycle: namedFact,
|
|
184
|
+
labels: z2.array(namedFact).nullish(),
|
|
185
|
+
dueDate: z2.iso.date().nullish(),
|
|
186
|
+
updatedAt: z2.iso.datetime({ offset: true }).nullish()
|
|
187
|
+
}).transform((issue, ctx) => {
|
|
188
|
+
const identifier = issueIdentifier.safeParse(issue.identifier ?? issue.id);
|
|
189
|
+
if (!identifier.success) {
|
|
190
|
+
ctx.addIssue({ code: "custom", message: "Missing issue identifier" });
|
|
191
|
+
return z2.NEVER;
|
|
192
|
+
}
|
|
193
|
+
return { ...issue, identifier: identifier.data.toUpperCase() };
|
|
194
|
+
});
|
|
195
|
+
var saveIssueResultSchema = z2.union([
|
|
196
|
+
savedIssueSchema,
|
|
197
|
+
z2.object({ issue: savedIssueSchema }).transform(({ issue }) => issue)
|
|
198
|
+
]);
|
|
199
|
+
function readSavedIssue(result) {
|
|
200
|
+
if (result.structuredContent !== void 0) {
|
|
201
|
+
return saveIssueResultSchema.safeParse(result.structuredContent);
|
|
202
|
+
}
|
|
203
|
+
for (const part of result.content ?? []) {
|
|
204
|
+
if (part.type !== "text") continue;
|
|
205
|
+
let value;
|
|
206
|
+
try {
|
|
207
|
+
value = JSON.parse(part.text);
|
|
208
|
+
} catch (error) {
|
|
209
|
+
if (error instanceof SyntaxError) continue;
|
|
210
|
+
throw error;
|
|
211
|
+
}
|
|
212
|
+
const parsed = saveIssueResultSchema.safeParse(value);
|
|
213
|
+
if (parsed.success) return parsed;
|
|
214
|
+
}
|
|
215
|
+
return saveIssueResultSchema.safeParse(void 0);
|
|
216
|
+
}
|
|
187
217
|
async function annotateSavedIssue(ctx) {
|
|
188
218
|
if (ctx.tool.name !== "save_issue") {
|
|
189
219
|
return;
|
|
@@ -191,15 +221,15 @@ async function annotateSavedIssue(ctx) {
|
|
|
191
221
|
if (!ctx.annotations) {
|
|
192
222
|
return;
|
|
193
223
|
}
|
|
194
|
-
const result =
|
|
224
|
+
const result = readSavedIssue(ctx.result);
|
|
195
225
|
if (!result.success) {
|
|
196
226
|
ctx.log.warn("linear.issue_annotation.skipped", {
|
|
197
227
|
"app.reason": "unexpected_save_response"
|
|
198
228
|
});
|
|
199
229
|
return;
|
|
200
230
|
}
|
|
201
|
-
const
|
|
202
|
-
const
|
|
231
|
+
const issue = result.data;
|
|
232
|
+
const identifier = issue.identifier;
|
|
203
233
|
return {
|
|
204
234
|
objectAnnotations: [
|
|
205
235
|
{
|
|
@@ -208,6 +238,7 @@ async function annotateSavedIssue(ctx) {
|
|
|
208
238
|
key: identifier,
|
|
209
239
|
label: identifier,
|
|
210
240
|
title: (issue.title || identifier).slice(0, 512),
|
|
241
|
+
description: issue.description?.slice(0, 4e3),
|
|
211
242
|
url: issue.url,
|
|
212
243
|
status: issue.status,
|
|
213
244
|
displayType: "Issue",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior-linear",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.233.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"zod": "^4.5.4",
|
|
26
|
-
"@sentry/junior-plugin-api": "0.
|
|
26
|
+
"@sentry/junior-plugin-api": "0.233.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@oxlint/plugins": "1.79.0",
|