jiradc-cli 1.0.12 → 1.0.13
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 +323 -56
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -80,35 +80,13 @@ function getClient() {
|
|
|
80
80
|
return new JiraClient({ baseUrl, token });
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
// src/utils/strip-response.ts
|
|
84
|
-
function stripResponse(obj) {
|
|
85
|
-
if (Array.isArray(obj)) {
|
|
86
|
-
return obj.map(stripResponse);
|
|
87
|
-
}
|
|
88
|
-
if (obj === null || typeof obj !== "object") {
|
|
89
|
-
return obj;
|
|
90
|
-
}
|
|
91
|
-
const record = obj;
|
|
92
|
-
const result = {};
|
|
93
|
-
for (const [key, value] of Object.entries(record)) {
|
|
94
|
-
if (key === "self" || key === "_links" || key === "_expandable" || key === "expand" || key === "avatarUrls" || key === "avatarId" || key === "iconUrl") {
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
if (value === null || value === void 0) {
|
|
98
|
-
continue;
|
|
99
|
-
}
|
|
100
|
-
result[key] = stripResponse(value);
|
|
101
|
-
}
|
|
102
|
-
return result;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
83
|
// src/utils/output.ts
|
|
106
84
|
var prettyPrint = false;
|
|
107
85
|
function setPretty(value) {
|
|
108
86
|
prettyPrint = value;
|
|
109
87
|
}
|
|
110
88
|
function output(data) {
|
|
111
|
-
process.stdout.write(`${JSON.stringify(
|
|
89
|
+
process.stdout.write(`${JSON.stringify(data, null, prettyPrint ? 2 : void 0)}
|
|
112
90
|
`);
|
|
113
91
|
}
|
|
114
92
|
function handleError(err) {
|
|
@@ -174,6 +152,282 @@ function handleError(err) {
|
|
|
174
152
|
process.exit(1);
|
|
175
153
|
}
|
|
176
154
|
|
|
155
|
+
// src/utils/transformers/base.ts
|
|
156
|
+
function jiraBaseUrl() {
|
|
157
|
+
return (process.env.JIRA_URL ?? "").replace(/\/+$/, "");
|
|
158
|
+
}
|
|
159
|
+
function transformPaged(response, fn) {
|
|
160
|
+
const { startAt, maxResults, total } = response;
|
|
161
|
+
if ("issues" in response) {
|
|
162
|
+
const mapped2 = response.issues.map(fn);
|
|
163
|
+
return { startAt, maxResults, total, isLast: startAt + mapped2.length >= total, issues: mapped2 };
|
|
164
|
+
}
|
|
165
|
+
if ("values" in response) {
|
|
166
|
+
const mapped2 = response.values.map(fn);
|
|
167
|
+
return { startAt, maxResults, total, isLast: startAt + mapped2.length >= total, values: mapped2 };
|
|
168
|
+
}
|
|
169
|
+
const mapped = response.worklogs.map(fn);
|
|
170
|
+
return { startAt, maxResults, total, isLast: startAt + mapped.length >= total, worklogs: mapped };
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// src/utils/transformers/user.ts
|
|
174
|
+
function transformUser(user) {
|
|
175
|
+
const { self: _self, avatarUrls: _avatarUrls, expand: _expand, ...rest } = user;
|
|
176
|
+
return rest;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// src/utils/transformers/field.ts
|
|
180
|
+
function transformField(field) {
|
|
181
|
+
return field;
|
|
182
|
+
}
|
|
183
|
+
function transformCustomFieldOption(option) {
|
|
184
|
+
const { self: _self, ...rest } = option;
|
|
185
|
+
return rest;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// src/utils/transformers/project.ts
|
|
189
|
+
function projectBrowseUrl(key) {
|
|
190
|
+
return `${jiraBaseUrl()}/projects/${key}`;
|
|
191
|
+
}
|
|
192
|
+
function transformProject(p) {
|
|
193
|
+
const { self: _self, avatarUrls: _avatarUrls, expand: _expand, lead, ...rest } = p;
|
|
194
|
+
return {
|
|
195
|
+
...rest,
|
|
196
|
+
url: projectBrowseUrl(p.key),
|
|
197
|
+
...lead ? { lead: transformUser(lead) } : {}
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// src/utils/transformers/component.ts
|
|
202
|
+
function componentBrowseUrl(projectKey) {
|
|
203
|
+
return `${jiraBaseUrl()}/projects/${projectKey}/components`;
|
|
204
|
+
}
|
|
205
|
+
function transformComponent(c) {
|
|
206
|
+
const { self: _self, lead, assignee, realAssignee, ...rest } = c;
|
|
207
|
+
return {
|
|
208
|
+
...rest,
|
|
209
|
+
...c.project ? { url: componentBrowseUrl(c.project) } : {},
|
|
210
|
+
...lead ? { lead: transformUser(lead) } : {},
|
|
211
|
+
...assignee ? { assignee: transformUser(assignee) } : {},
|
|
212
|
+
...realAssignee ? { realAssignee: transformUser(realAssignee) } : {}
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
function transformComponentIssueCounts(c) {
|
|
216
|
+
const { self: _self, ...rest } = c;
|
|
217
|
+
return rest;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// src/utils/transformers/board.ts
|
|
221
|
+
function boardBrowseUrl(boardId) {
|
|
222
|
+
return `${jiraBaseUrl()}/secure/RapidBoard.jspa?rapidView=${boardId}`;
|
|
223
|
+
}
|
|
224
|
+
function transformBoard(b) {
|
|
225
|
+
const { self: _self, ...rest } = b;
|
|
226
|
+
return { ...rest, url: boardBrowseUrl(b.id) };
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// src/utils/transformers/sprint.ts
|
|
230
|
+
function sprintBrowseUrl(boardId, sprintId) {
|
|
231
|
+
return `${jiraBaseUrl()}/secure/RapidBoard.jspa?rapidView=${boardId}&view=planning&sprint=${sprintId}`;
|
|
232
|
+
}
|
|
233
|
+
function transformSprint(s) {
|
|
234
|
+
const { self: _self, ...rest } = s;
|
|
235
|
+
return {
|
|
236
|
+
...rest,
|
|
237
|
+
...s.originBoardId !== void 0 ? { url: sprintBrowseUrl(s.originBoardId, s.id) } : {}
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// src/utils/transformers/issue.ts
|
|
242
|
+
function issueBrowseUrl(key) {
|
|
243
|
+
return `${jiraBaseUrl()}/browse/${key}`;
|
|
244
|
+
}
|
|
245
|
+
function transformIssueRef(key) {
|
|
246
|
+
return { key, url: issueBrowseUrl(key) };
|
|
247
|
+
}
|
|
248
|
+
function transformCreatedIssue(r) {
|
|
249
|
+
return { id: r.id, key: r.key, url: issueBrowseUrl(r.key) };
|
|
250
|
+
}
|
|
251
|
+
function transformIssueType(t) {
|
|
252
|
+
const { self: _self, iconUrl: _iconUrl, avatarId: _avatarId, description: _description, ...rest } = t;
|
|
253
|
+
return rest;
|
|
254
|
+
}
|
|
255
|
+
function transformStatus(s) {
|
|
256
|
+
const { self: _self, iconUrl: _iconUrl, description: _description, statusCategory, ...rest } = s;
|
|
257
|
+
return {
|
|
258
|
+
...rest,
|
|
259
|
+
// statusCategory carries `self` and `colorName` we don't want; keep only id/key/name.
|
|
260
|
+
...statusCategory ? { statusCategory: { id: statusCategory.id, key: statusCategory.key, name: statusCategory.name } } : {}
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
function transformPriority(p) {
|
|
264
|
+
const { self: _self, iconUrl: _iconUrl, ...rest } = p;
|
|
265
|
+
return rest;
|
|
266
|
+
}
|
|
267
|
+
function transformResolution(r) {
|
|
268
|
+
const { self: _self, description: _description, ...rest } = r;
|
|
269
|
+
return rest;
|
|
270
|
+
}
|
|
271
|
+
function transformVersion(v) {
|
|
272
|
+
const { self: _self, ...rest } = v;
|
|
273
|
+
return rest;
|
|
274
|
+
}
|
|
275
|
+
function transformIssueLinkType(t) {
|
|
276
|
+
const { self: _self, ...rest } = t;
|
|
277
|
+
return rest;
|
|
278
|
+
}
|
|
279
|
+
function transformComment(c) {
|
|
280
|
+
const { self: _self, author, updateAuthor, ...rest } = c;
|
|
281
|
+
return {
|
|
282
|
+
...rest,
|
|
283
|
+
...author ? { author: transformUser(author) } : {},
|
|
284
|
+
...updateAuthor ? { updateAuthor: transformUser(updateAuthor) } : {}
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
function transformWorklog(w) {
|
|
288
|
+
const { self: _self, author, updateAuthor, ...rest } = w;
|
|
289
|
+
return {
|
|
290
|
+
...rest,
|
|
291
|
+
...author ? { author: transformUser(author) } : {},
|
|
292
|
+
...updateAuthor ? { updateAuthor: transformUser(updateAuthor) } : {}
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
function transformAttachment(a) {
|
|
296
|
+
const { self: _self, author, ...rest } = a;
|
|
297
|
+
return {
|
|
298
|
+
...rest,
|
|
299
|
+
...author ? { author: transformUser(author) } : {}
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
function transformIssueBasic(b) {
|
|
303
|
+
const { self: _self, fields, ...rest } = b;
|
|
304
|
+
return {
|
|
305
|
+
...rest,
|
|
306
|
+
url: issueBrowseUrl(b.key),
|
|
307
|
+
...fields ? {
|
|
308
|
+
fields: {
|
|
309
|
+
...fields.summary !== void 0 ? { summary: fields.summary } : {},
|
|
310
|
+
...fields.status ? { status: transformStatus(fields.status) } : {},
|
|
311
|
+
...fields.priority ? { priority: transformPriority(fields.priority) } : {},
|
|
312
|
+
...fields.issuetype ? { issuetype: transformIssueType(fields.issuetype) } : {}
|
|
313
|
+
}
|
|
314
|
+
} : {}
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
function transformIssueLink(l) {
|
|
318
|
+
const { self: _self, type, inwardIssue, outwardIssue, ...rest } = l;
|
|
319
|
+
return {
|
|
320
|
+
...rest,
|
|
321
|
+
type: transformIssueLinkType(type),
|
|
322
|
+
...inwardIssue ? { inwardIssue: transformIssueBasic(inwardIssue) } : {},
|
|
323
|
+
...outwardIssue ? { outwardIssue: transformIssueBasic(outwardIssue) } : {}
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
function transformIssue(issue) {
|
|
327
|
+
const { self: _self, expand: _expand, names: _names, schema: _schema, fields, ...rest } = issue;
|
|
328
|
+
return {
|
|
329
|
+
...rest,
|
|
330
|
+
url: issueBrowseUrl(issue.key),
|
|
331
|
+
fields: transformIssueFields(fields)
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
function isEmpty(v) {
|
|
335
|
+
if (v === null || v === void 0 || v === "") return true;
|
|
336
|
+
if (Array.isArray(v)) return v.length === 0;
|
|
337
|
+
if (typeof v === "object") return Object.keys(v).length === 0;
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
function compactRecord(obj) {
|
|
341
|
+
const out = {};
|
|
342
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
343
|
+
if (!isEmpty(v)) out[k] = v;
|
|
344
|
+
}
|
|
345
|
+
return out;
|
|
346
|
+
}
|
|
347
|
+
function pruneSentinels(fields) {
|
|
348
|
+
const out = { ...fields };
|
|
349
|
+
delete out.aggregatetimespent;
|
|
350
|
+
delete out.aggregatetimeestimate;
|
|
351
|
+
delete out.aggregatetimeoriginalestimate;
|
|
352
|
+
if (out.workratio === -1) delete out.workratio;
|
|
353
|
+
for (const k of ["progress", "aggregateprogress"]) {
|
|
354
|
+
const v = out[k];
|
|
355
|
+
if (v && v.progress === 0 && v.total === 0) delete out[k];
|
|
356
|
+
}
|
|
357
|
+
const votes = out.votes;
|
|
358
|
+
if (votes && votes.votes === 0) delete out.votes;
|
|
359
|
+
const watches = out.watches;
|
|
360
|
+
if (watches && watches.watchCount === 0) delete out.watches;
|
|
361
|
+
return out;
|
|
362
|
+
}
|
|
363
|
+
function transformIssueFields(fields) {
|
|
364
|
+
const {
|
|
365
|
+
// shaped sub-entities (recursed individually)
|
|
366
|
+
issuetype,
|
|
367
|
+
status,
|
|
368
|
+
priority,
|
|
369
|
+
resolution,
|
|
370
|
+
assignee,
|
|
371
|
+
reporter,
|
|
372
|
+
creator,
|
|
373
|
+
fixVersions,
|
|
374
|
+
versions: versions2,
|
|
375
|
+
issuelinks,
|
|
376
|
+
subtasks,
|
|
377
|
+
parent,
|
|
378
|
+
comment: comment2,
|
|
379
|
+
worklog: worklog2,
|
|
380
|
+
attachment,
|
|
381
|
+
// required scalars / structured fields we always keep verbatim
|
|
382
|
+
summary,
|
|
383
|
+
project,
|
|
384
|
+
created,
|
|
385
|
+
updated,
|
|
386
|
+
// everything else: optional scalars, customfield_*, etc. — gets compacted
|
|
387
|
+
...rest
|
|
388
|
+
} = fields;
|
|
389
|
+
const compacted = pruneSentinels(compactRecord(rest));
|
|
390
|
+
return {
|
|
391
|
+
...compacted,
|
|
392
|
+
summary,
|
|
393
|
+
project,
|
|
394
|
+
created,
|
|
395
|
+
updated,
|
|
396
|
+
issuetype: transformIssueType(issuetype),
|
|
397
|
+
status: transformStatus(status),
|
|
398
|
+
...priority ? { priority: transformPriority(priority) } : {},
|
|
399
|
+
...resolution ? { resolution: transformResolution(resolution) } : {},
|
|
400
|
+
...assignee ? { assignee: transformUser(assignee) } : {},
|
|
401
|
+
...reporter ? { reporter: transformUser(reporter) } : {},
|
|
402
|
+
...creator ? { creator: transformUser(creator) } : {},
|
|
403
|
+
...fixVersions && fixVersions.length > 0 ? { fixVersions: fixVersions.map(transformVersion) } : {},
|
|
404
|
+
...versions2 && versions2.length > 0 ? { versions: versions2.map(transformVersion) } : {},
|
|
405
|
+
...issuelinks && issuelinks.length > 0 ? { issuelinks: issuelinks.map(transformIssueLink) } : {},
|
|
406
|
+
...subtasks && subtasks.length > 0 ? { subtasks: subtasks.map(transformIssueBasic) } : {},
|
|
407
|
+
...parent ? { parent: transformIssueBasic(parent) } : {},
|
|
408
|
+
// Drop empty comment / worklog containers entirely. The default Jira
|
|
409
|
+
// search response includes both wrappers on every issue regardless of
|
|
410
|
+
// count; on a 25-issue page that's 25 × 2 empty objects of pure noise.
|
|
411
|
+
...comment2 && comment2.comments.length > 0 ? {
|
|
412
|
+
comment: {
|
|
413
|
+
comments: comment2.comments.map(transformComment),
|
|
414
|
+
maxResults: comment2.maxResults,
|
|
415
|
+
total: comment2.total,
|
|
416
|
+
startAt: comment2.startAt
|
|
417
|
+
}
|
|
418
|
+
} : {},
|
|
419
|
+
...worklog2 && worklog2.worklogs.length > 0 ? {
|
|
420
|
+
worklog: {
|
|
421
|
+
worklogs: worklog2.worklogs.map(transformWorklog),
|
|
422
|
+
maxResults: worklog2.maxResults,
|
|
423
|
+
total: worklog2.total,
|
|
424
|
+
startAt: worklog2.startAt
|
|
425
|
+
}
|
|
426
|
+
} : {},
|
|
427
|
+
...attachment && attachment.length > 0 ? { attachment: attachment.map(transformAttachment) } : {}
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
|
|
177
431
|
// src/commands/board/issues.ts
|
|
178
432
|
function issues(parent) {
|
|
179
433
|
parent.command("issues").description("Get issues for a board").addArgument(new Argument("<id>", "Board ID").argParser(positiveInt)).option("--max <number>", "Max results (1-50, Jira DC caps at 50)", intInRange(1, 50), 25).option("--start-at <number>", "Starting index for pagination", nonNegativeInt).option("--fields <fields>", "Comma-separated field names to return").option("--jql <jql>", "Additional JQL filter within the board").addHelpText(
|
|
@@ -188,7 +442,7 @@ function issues(parent) {
|
|
|
188
442
|
fields: opts.fields?.split(",").map((f) => f.trim()),
|
|
189
443
|
jql: opts.jql
|
|
190
444
|
});
|
|
191
|
-
output(result);
|
|
445
|
+
output(transformPaged(result, transformIssue));
|
|
192
446
|
});
|
|
193
447
|
}
|
|
194
448
|
|
|
@@ -207,7 +461,7 @@ function list(parent) {
|
|
|
207
461
|
type: opts.type,
|
|
208
462
|
name: opts.name
|
|
209
463
|
});
|
|
210
|
-
output(result);
|
|
464
|
+
output(result.map(transformBoard));
|
|
211
465
|
});
|
|
212
466
|
}
|
|
213
467
|
|
|
@@ -252,7 +506,7 @@ Examples:
|
|
|
252
506
|
leadUserName: opts.lead,
|
|
253
507
|
assigneeType: opts.assigneeType
|
|
254
508
|
});
|
|
255
|
-
output(result);
|
|
509
|
+
output(transformComponent(result));
|
|
256
510
|
}
|
|
257
511
|
);
|
|
258
512
|
}
|
|
@@ -277,7 +531,7 @@ function get(parent) {
|
|
|
277
531
|
parent.command("get <id>").description("Get a component by ID").addHelpText("after", "\nExamples:\n jiradc component get 11289").action(async (id) => {
|
|
278
532
|
const client = getClient();
|
|
279
533
|
const result = await client.components.get({ id });
|
|
280
|
-
output(result);
|
|
534
|
+
output(transformComponent(result));
|
|
281
535
|
});
|
|
282
536
|
}
|
|
283
537
|
|
|
@@ -286,7 +540,7 @@ function issueCount(parent) {
|
|
|
286
540
|
parent.command("issue-count <id>").description("Get the number of issues currently using this component").addHelpText("after", "\nExamples:\n jiradc component issue-count 11289").action(async (id) => {
|
|
287
541
|
const client = getClient();
|
|
288
542
|
const result = await client.components.getRelatedIssueCounts({ id });
|
|
289
|
-
output(result);
|
|
543
|
+
output(transformComponentIssueCounts(result));
|
|
290
544
|
});
|
|
291
545
|
}
|
|
292
546
|
|
|
@@ -295,7 +549,7 @@ function list2(parent) {
|
|
|
295
549
|
parent.command("list <projectKey>").description("List all components for a project").addHelpText("after", "\nExamples:\n jiradc component list AI").action(async (projectKey) => {
|
|
296
550
|
const client = getClient();
|
|
297
551
|
const result = await client.components.list({ projectKeyOrId: projectKey });
|
|
298
|
-
output(result);
|
|
552
|
+
output(result.map(transformComponent));
|
|
299
553
|
});
|
|
300
554
|
}
|
|
301
555
|
|
|
@@ -328,7 +582,7 @@ Examples:
|
|
|
328
582
|
leadUserName: opts.lead,
|
|
329
583
|
assigneeType: opts.assigneeType
|
|
330
584
|
});
|
|
331
|
-
output(result);
|
|
585
|
+
output(transformComponent(result));
|
|
332
586
|
}
|
|
333
587
|
);
|
|
334
588
|
}
|
|
@@ -368,7 +622,7 @@ function options(parent) {
|
|
|
368
622
|
maxResults: opts.max,
|
|
369
623
|
page: opts.page
|
|
370
624
|
});
|
|
371
|
-
output(result);
|
|
625
|
+
output(transformPaged({ ...result, startAt: result.startAt ?? 0 }, transformCustomFieldOption));
|
|
372
626
|
});
|
|
373
627
|
}
|
|
374
628
|
|
|
@@ -380,7 +634,7 @@ function search(parent) {
|
|
|
380
634
|
).action(async (keyword, opts) => {
|
|
381
635
|
const client = getClient();
|
|
382
636
|
const result = await client.fields.search(keyword, opts.limit);
|
|
383
|
-
output(result);
|
|
637
|
+
output(result.map(transformField));
|
|
384
638
|
});
|
|
385
639
|
}
|
|
386
640
|
|
|
@@ -618,7 +872,7 @@ Examples:
|
|
|
618
872
|
for (const issue of parsed) {
|
|
619
873
|
try {
|
|
620
874
|
const result = await client.issues.create(issue);
|
|
621
|
-
results.push(
|
|
875
|
+
results.push(transformCreatedIssue(result));
|
|
622
876
|
} catch (error) {
|
|
623
877
|
results.push({ error: error instanceof Error ? error.message : "Unknown error" });
|
|
624
878
|
}
|
|
@@ -679,12 +933,12 @@ Examples:
|
|
|
679
933
|
dueDate: f.duedate ?? void 0,
|
|
680
934
|
assignee: opts.assignee ?? f.assignee?.name
|
|
681
935
|
};
|
|
682
|
-
const
|
|
683
|
-
const newKey =
|
|
936
|
+
const created = transformCreatedIssue(await client.issues.create(createParams));
|
|
937
|
+
const newKey = created.key;
|
|
684
938
|
const cloneResult = {
|
|
685
939
|
cloned: true,
|
|
686
940
|
source: key,
|
|
687
|
-
newIssue:
|
|
941
|
+
newIssue: created
|
|
688
942
|
};
|
|
689
943
|
if (opts.includeAttachments && f.attachment?.length) {
|
|
690
944
|
const tmpFiles = [];
|
|
@@ -721,9 +975,9 @@ Examples:
|
|
|
721
975
|
return Promise.resolve();
|
|
722
976
|
})
|
|
723
977
|
);
|
|
724
|
-
const
|
|
978
|
+
const created2 = outcomes.filter((o) => o.status === "fulfilled").length;
|
|
725
979
|
const skipped = outcomes.filter((o) => o.status === "rejected").length;
|
|
726
|
-
cloneResult.linksCopied =
|
|
980
|
+
cloneResult.linksCopied = created2;
|
|
727
981
|
if (skipped > 0) cloneResult.linksSkipped = skipped;
|
|
728
982
|
}
|
|
729
983
|
output(cloneResult);
|
|
@@ -736,7 +990,7 @@ function commentEdit(parent) {
|
|
|
736
990
|
parent.command("comment-edit <key>").description("Edit an existing comment").requiredOption("--id <commentId>", "Comment ID to edit").requiredOption("--body <text>", "Updated comment body in wiki markup").addHelpText("after", '\nExamples:\n jiradc issue comment-edit PROJ-123 --id 12345 --body "Updated comment text"').action(async (key, opts) => {
|
|
737
991
|
const client = getClient();
|
|
738
992
|
const result = await client.issues.editComment({ issueKeyOrId: key, commentId: opts.id, body: opts.body });
|
|
739
|
-
output(result);
|
|
993
|
+
output(transformComment(result));
|
|
740
994
|
});
|
|
741
995
|
}
|
|
742
996
|
|
|
@@ -745,7 +999,7 @@ function comment(parent) {
|
|
|
745
999
|
parent.command("comment <key>").description("Add a comment to an issue").requiredOption("--body <text>", "Comment body in wiki markup").addHelpText("after", '\nExamples:\n jiradc issue comment PROJ-123 --body "Fixed in latest build"').action(async (key, opts) => {
|
|
746
1000
|
const client = getClient();
|
|
747
1001
|
const result = await client.issues.addComment({ issueKeyOrId: key, body: opts.body });
|
|
748
|
-
output(result);
|
|
1002
|
+
output(transformComment(result));
|
|
749
1003
|
});
|
|
750
1004
|
}
|
|
751
1005
|
|
|
@@ -777,7 +1031,7 @@ Examples:
|
|
|
777
1031
|
parent: opts.parent,
|
|
778
1032
|
customFields: opts.customFields ? JSON.parse(opts.customFields) : void 0
|
|
779
1033
|
});
|
|
780
|
-
output(result);
|
|
1034
|
+
output(transformCreatedIssue(result));
|
|
781
1035
|
}
|
|
782
1036
|
);
|
|
783
1037
|
}
|
|
@@ -885,7 +1139,7 @@ function getWorklog(parent) {
|
|
|
885
1139
|
startAt: opts.startAt,
|
|
886
1140
|
maxResults: opts.max
|
|
887
1141
|
});
|
|
888
|
-
output(result);
|
|
1142
|
+
output(transformPaged(result, transformWorklog));
|
|
889
1143
|
});
|
|
890
1144
|
}
|
|
891
1145
|
|
|
@@ -918,7 +1172,7 @@ function get2(parent) {
|
|
|
918
1172
|
fields,
|
|
919
1173
|
expand: opts.expand
|
|
920
1174
|
});
|
|
921
|
-
output(result);
|
|
1175
|
+
output(transformIssue(result));
|
|
922
1176
|
});
|
|
923
1177
|
}
|
|
924
1178
|
|
|
@@ -930,7 +1184,11 @@ function linkEpic(parent) {
|
|
|
930
1184
|
issueKeyOrId: key,
|
|
931
1185
|
fields: { customfield_10100: opts.epic }
|
|
932
1186
|
});
|
|
933
|
-
output({
|
|
1187
|
+
output({
|
|
1188
|
+
linked: true,
|
|
1189
|
+
issue: transformIssueRef(key),
|
|
1190
|
+
epic: transformIssueRef(opts.epic)
|
|
1191
|
+
});
|
|
934
1192
|
});
|
|
935
1193
|
}
|
|
936
1194
|
|
|
@@ -939,7 +1197,7 @@ function linkTypes(parent) {
|
|
|
939
1197
|
parent.command("link-types").description("List all issue link types").addHelpText("after", "\nExamples:\n jiradc issue link-types").action(async () => {
|
|
940
1198
|
const client = getClient();
|
|
941
1199
|
const result = await client.links.getTypes();
|
|
942
|
-
output(result);
|
|
1200
|
+
output(result.map(transformIssueLinkType));
|
|
943
1201
|
});
|
|
944
1202
|
}
|
|
945
1203
|
|
|
@@ -956,7 +1214,12 @@ function link(parent) {
|
|
|
956
1214
|
outwardIssueKey: opts.to,
|
|
957
1215
|
comment: opts.comment
|
|
958
1216
|
});
|
|
959
|
-
output({
|
|
1217
|
+
output({
|
|
1218
|
+
created: true,
|
|
1219
|
+
type: opts.type,
|
|
1220
|
+
inward: transformIssueRef(opts.from),
|
|
1221
|
+
outward: transformIssueRef(opts.to)
|
|
1222
|
+
});
|
|
960
1223
|
});
|
|
961
1224
|
}
|
|
962
1225
|
|
|
@@ -974,7 +1237,7 @@ function search2(parent) {
|
|
|
974
1237
|
maxResults: opts.max,
|
|
975
1238
|
fields
|
|
976
1239
|
});
|
|
977
|
-
output(result);
|
|
1240
|
+
output(transformPaged(result, transformIssue));
|
|
978
1241
|
});
|
|
979
1242
|
}
|
|
980
1243
|
|
|
@@ -986,7 +1249,7 @@ function transition(parent) {
|
|
|
986
1249
|
).action(async (key, opts) => {
|
|
987
1250
|
const client = getClient();
|
|
988
1251
|
await client.issues.transition({ issueKeyOrId: key, transitionId: opts.to, comment: opts.comment });
|
|
989
|
-
output({ transitioned: true,
|
|
1252
|
+
output({ transitioned: true, issue: transformIssueRef(key) });
|
|
990
1253
|
});
|
|
991
1254
|
}
|
|
992
1255
|
|
|
@@ -1037,7 +1300,11 @@ Examples:
|
|
|
1037
1300
|
}
|
|
1038
1301
|
}
|
|
1039
1302
|
}
|
|
1040
|
-
output({
|
|
1303
|
+
output({
|
|
1304
|
+
updated: true,
|
|
1305
|
+
issue: transformIssueRef(key),
|
|
1306
|
+
...uploaded.length > 0 && { attachments: uploaded }
|
|
1307
|
+
});
|
|
1041
1308
|
});
|
|
1042
1309
|
}
|
|
1043
1310
|
|
|
@@ -1054,7 +1321,7 @@ function worklog(parent) {
|
|
|
1054
1321
|
comment: opts.comment,
|
|
1055
1322
|
started: opts.started
|
|
1056
1323
|
});
|
|
1057
|
-
output(result);
|
|
1324
|
+
output(transformWorklog(result));
|
|
1058
1325
|
});
|
|
1059
1326
|
}
|
|
1060
1327
|
|
|
@@ -1104,7 +1371,7 @@ function list4(parent) {
|
|
|
1104
1371
|
).action(async (opts) => {
|
|
1105
1372
|
const client = getClient();
|
|
1106
1373
|
const result = await client.projects.getAll({ expand: opts.expand, includeArchived: opts.includeArchived });
|
|
1107
|
-
output(result);
|
|
1374
|
+
output(result.map(transformProject));
|
|
1108
1375
|
});
|
|
1109
1376
|
}
|
|
1110
1377
|
|
|
@@ -1116,7 +1383,7 @@ function versions(parent) {
|
|
|
1116
1383
|
).action(async (key, opts) => {
|
|
1117
1384
|
const client = getClient();
|
|
1118
1385
|
const result = await client.projects.getVersions({ projectKeyOrId: key, expand: opts.expand });
|
|
1119
|
-
output(result);
|
|
1386
|
+
output(result.map(transformVersion));
|
|
1120
1387
|
});
|
|
1121
1388
|
}
|
|
1122
1389
|
|
|
@@ -1148,7 +1415,7 @@ function create3(parent) {
|
|
|
1148
1415
|
endDate: opts.endDate,
|
|
1149
1416
|
goal: opts.goal
|
|
1150
1417
|
});
|
|
1151
|
-
output(result);
|
|
1418
|
+
output(transformSprint(result));
|
|
1152
1419
|
});
|
|
1153
1420
|
}
|
|
1154
1421
|
|
|
@@ -1167,7 +1434,7 @@ function issues2(parent) {
|
|
|
1167
1434
|
fields: opts.fields?.split(",").map((f) => f.trim()),
|
|
1168
1435
|
jql: opts.jql
|
|
1169
1436
|
});
|
|
1170
|
-
output(result);
|
|
1437
|
+
output(transformPaged(result, transformIssue));
|
|
1171
1438
|
});
|
|
1172
1439
|
}
|
|
1173
1440
|
|
|
@@ -1184,7 +1451,7 @@ function list5(parent) {
|
|
|
1184
1451
|
boardId: opts.board,
|
|
1185
1452
|
state: opts.state
|
|
1186
1453
|
});
|
|
1187
|
-
output(result);
|
|
1454
|
+
output(result.map(transformSprint));
|
|
1188
1455
|
});
|
|
1189
1456
|
}
|
|
1190
1457
|
|
|
@@ -1206,7 +1473,7 @@ function update3(parent) {
|
|
|
1206
1473
|
endDate: opts.endDate,
|
|
1207
1474
|
goal: opts.goal
|
|
1208
1475
|
});
|
|
1209
|
-
output(result);
|
|
1476
|
+
output(transformSprint(result));
|
|
1210
1477
|
}
|
|
1211
1478
|
);
|
|
1212
1479
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jiradc-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"publish": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"commander": "^13.1.0",
|
|
15
|
-
"jira-data-center-client": "1.0.
|
|
15
|
+
"jira-data-center-client": "1.0.32"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/node": "24.10.4",
|