jiradc-cli 1.0.12 → 1.0.13-ge64eee0.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/dist/index.js +327 -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,286 @@ 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
|
+
for (const [agg, leaf] of [
|
|
350
|
+
["aggregatetimespent", "timespent"],
|
|
351
|
+
["aggregatetimeestimate", "timeestimate"],
|
|
352
|
+
["aggregatetimeoriginalestimate", "timeoriginalestimate"]
|
|
353
|
+
]) {
|
|
354
|
+
if (out[agg] === out[leaf]) delete out[agg];
|
|
355
|
+
}
|
|
356
|
+
if (out.workratio === -1) delete out.workratio;
|
|
357
|
+
for (const k of ["progress", "aggregateprogress"]) {
|
|
358
|
+
const v = out[k];
|
|
359
|
+
if (v && v.progress === 0 && v.total === 0) delete out[k];
|
|
360
|
+
}
|
|
361
|
+
const votes = out.votes;
|
|
362
|
+
if (votes && votes.votes === 0) delete out.votes;
|
|
363
|
+
const watches = out.watches;
|
|
364
|
+
if (watches && watches.watchCount === 0) delete out.watches;
|
|
365
|
+
return out;
|
|
366
|
+
}
|
|
367
|
+
function transformIssueFields(fields) {
|
|
368
|
+
const {
|
|
369
|
+
// shaped sub-entities (recursed individually)
|
|
370
|
+
issuetype,
|
|
371
|
+
status,
|
|
372
|
+
priority,
|
|
373
|
+
resolution,
|
|
374
|
+
assignee,
|
|
375
|
+
reporter,
|
|
376
|
+
creator,
|
|
377
|
+
fixVersions,
|
|
378
|
+
versions: versions2,
|
|
379
|
+
issuelinks,
|
|
380
|
+
subtasks,
|
|
381
|
+
parent,
|
|
382
|
+
comment: comment2,
|
|
383
|
+
worklog: worklog2,
|
|
384
|
+
attachment,
|
|
385
|
+
// required scalars / structured fields we always keep verbatim
|
|
386
|
+
summary,
|
|
387
|
+
project,
|
|
388
|
+
created,
|
|
389
|
+
updated,
|
|
390
|
+
// everything else: optional scalars, customfield_*, etc. — gets compacted
|
|
391
|
+
...rest
|
|
392
|
+
} = fields;
|
|
393
|
+
const compacted = pruneSentinels(compactRecord(rest));
|
|
394
|
+
return {
|
|
395
|
+
...compacted,
|
|
396
|
+
summary,
|
|
397
|
+
project,
|
|
398
|
+
created,
|
|
399
|
+
updated,
|
|
400
|
+
issuetype: transformIssueType(issuetype),
|
|
401
|
+
status: transformStatus(status),
|
|
402
|
+
...priority ? { priority: transformPriority(priority) } : {},
|
|
403
|
+
...resolution ? { resolution: transformResolution(resolution) } : {},
|
|
404
|
+
...assignee ? { assignee: transformUser(assignee) } : {},
|
|
405
|
+
...reporter ? { reporter: transformUser(reporter) } : {},
|
|
406
|
+
...creator ? { creator: transformUser(creator) } : {},
|
|
407
|
+
...fixVersions && fixVersions.length > 0 ? { fixVersions: fixVersions.map(transformVersion) } : {},
|
|
408
|
+
...versions2 && versions2.length > 0 ? { versions: versions2.map(transformVersion) } : {},
|
|
409
|
+
...issuelinks && issuelinks.length > 0 ? { issuelinks: issuelinks.map(transformIssueLink) } : {},
|
|
410
|
+
...subtasks && subtasks.length > 0 ? { subtasks: subtasks.map(transformIssueBasic) } : {},
|
|
411
|
+
...parent ? { parent: transformIssueBasic(parent) } : {},
|
|
412
|
+
// Drop empty comment / worklog containers entirely. The default Jira
|
|
413
|
+
// search response includes both wrappers on every issue regardless of
|
|
414
|
+
// count; on a 25-issue page that's 25 × 2 empty objects of pure noise.
|
|
415
|
+
...comment2 && comment2.comments.length > 0 ? {
|
|
416
|
+
comment: {
|
|
417
|
+
comments: comment2.comments.map(transformComment),
|
|
418
|
+
maxResults: comment2.maxResults,
|
|
419
|
+
total: comment2.total,
|
|
420
|
+
startAt: comment2.startAt
|
|
421
|
+
}
|
|
422
|
+
} : {},
|
|
423
|
+
...worklog2 && worklog2.worklogs.length > 0 ? {
|
|
424
|
+
worklog: {
|
|
425
|
+
worklogs: worklog2.worklogs.map(transformWorklog),
|
|
426
|
+
maxResults: worklog2.maxResults,
|
|
427
|
+
total: worklog2.total,
|
|
428
|
+
startAt: worklog2.startAt
|
|
429
|
+
}
|
|
430
|
+
} : {},
|
|
431
|
+
...attachment && attachment.length > 0 ? { attachment: attachment.map(transformAttachment) } : {}
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
|
|
177
435
|
// src/commands/board/issues.ts
|
|
178
436
|
function issues(parent) {
|
|
179
437
|
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 +446,7 @@ function issues(parent) {
|
|
|
188
446
|
fields: opts.fields?.split(",").map((f) => f.trim()),
|
|
189
447
|
jql: opts.jql
|
|
190
448
|
});
|
|
191
|
-
output(result);
|
|
449
|
+
output(transformPaged(result, transformIssue));
|
|
192
450
|
});
|
|
193
451
|
}
|
|
194
452
|
|
|
@@ -207,7 +465,7 @@ function list(parent) {
|
|
|
207
465
|
type: opts.type,
|
|
208
466
|
name: opts.name
|
|
209
467
|
});
|
|
210
|
-
output(result);
|
|
468
|
+
output(result.map(transformBoard));
|
|
211
469
|
});
|
|
212
470
|
}
|
|
213
471
|
|
|
@@ -252,7 +510,7 @@ Examples:
|
|
|
252
510
|
leadUserName: opts.lead,
|
|
253
511
|
assigneeType: opts.assigneeType
|
|
254
512
|
});
|
|
255
|
-
output(result);
|
|
513
|
+
output(transformComponent(result));
|
|
256
514
|
}
|
|
257
515
|
);
|
|
258
516
|
}
|
|
@@ -277,7 +535,7 @@ function get(parent) {
|
|
|
277
535
|
parent.command("get <id>").description("Get a component by ID").addHelpText("after", "\nExamples:\n jiradc component get 11289").action(async (id) => {
|
|
278
536
|
const client = getClient();
|
|
279
537
|
const result = await client.components.get({ id });
|
|
280
|
-
output(result);
|
|
538
|
+
output(transformComponent(result));
|
|
281
539
|
});
|
|
282
540
|
}
|
|
283
541
|
|
|
@@ -286,7 +544,7 @@ function issueCount(parent) {
|
|
|
286
544
|
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
545
|
const client = getClient();
|
|
288
546
|
const result = await client.components.getRelatedIssueCounts({ id });
|
|
289
|
-
output(result);
|
|
547
|
+
output(transformComponentIssueCounts(result));
|
|
290
548
|
});
|
|
291
549
|
}
|
|
292
550
|
|
|
@@ -295,7 +553,7 @@ function list2(parent) {
|
|
|
295
553
|
parent.command("list <projectKey>").description("List all components for a project").addHelpText("after", "\nExamples:\n jiradc component list AI").action(async (projectKey) => {
|
|
296
554
|
const client = getClient();
|
|
297
555
|
const result = await client.components.list({ projectKeyOrId: projectKey });
|
|
298
|
-
output(result);
|
|
556
|
+
output(result.map(transformComponent));
|
|
299
557
|
});
|
|
300
558
|
}
|
|
301
559
|
|
|
@@ -328,7 +586,7 @@ Examples:
|
|
|
328
586
|
leadUserName: opts.lead,
|
|
329
587
|
assigneeType: opts.assigneeType
|
|
330
588
|
});
|
|
331
|
-
output(result);
|
|
589
|
+
output(transformComponent(result));
|
|
332
590
|
}
|
|
333
591
|
);
|
|
334
592
|
}
|
|
@@ -368,7 +626,7 @@ function options(parent) {
|
|
|
368
626
|
maxResults: opts.max,
|
|
369
627
|
page: opts.page
|
|
370
628
|
});
|
|
371
|
-
output(result);
|
|
629
|
+
output(transformPaged({ ...result, startAt: result.startAt ?? 0 }, transformCustomFieldOption));
|
|
372
630
|
});
|
|
373
631
|
}
|
|
374
632
|
|
|
@@ -380,7 +638,7 @@ function search(parent) {
|
|
|
380
638
|
).action(async (keyword, opts) => {
|
|
381
639
|
const client = getClient();
|
|
382
640
|
const result = await client.fields.search(keyword, opts.limit);
|
|
383
|
-
output(result);
|
|
641
|
+
output(result.map(transformField));
|
|
384
642
|
});
|
|
385
643
|
}
|
|
386
644
|
|
|
@@ -618,7 +876,7 @@ Examples:
|
|
|
618
876
|
for (const issue of parsed) {
|
|
619
877
|
try {
|
|
620
878
|
const result = await client.issues.create(issue);
|
|
621
|
-
results.push(
|
|
879
|
+
results.push(transformCreatedIssue(result));
|
|
622
880
|
} catch (error) {
|
|
623
881
|
results.push({ error: error instanceof Error ? error.message : "Unknown error" });
|
|
624
882
|
}
|
|
@@ -679,12 +937,12 @@ Examples:
|
|
|
679
937
|
dueDate: f.duedate ?? void 0,
|
|
680
938
|
assignee: opts.assignee ?? f.assignee?.name
|
|
681
939
|
};
|
|
682
|
-
const
|
|
683
|
-
const newKey =
|
|
940
|
+
const created = transformCreatedIssue(await client.issues.create(createParams));
|
|
941
|
+
const newKey = created.key;
|
|
684
942
|
const cloneResult = {
|
|
685
943
|
cloned: true,
|
|
686
944
|
source: key,
|
|
687
|
-
newIssue:
|
|
945
|
+
newIssue: created
|
|
688
946
|
};
|
|
689
947
|
if (opts.includeAttachments && f.attachment?.length) {
|
|
690
948
|
const tmpFiles = [];
|
|
@@ -721,9 +979,9 @@ Examples:
|
|
|
721
979
|
return Promise.resolve();
|
|
722
980
|
})
|
|
723
981
|
);
|
|
724
|
-
const
|
|
982
|
+
const created2 = outcomes.filter((o) => o.status === "fulfilled").length;
|
|
725
983
|
const skipped = outcomes.filter((o) => o.status === "rejected").length;
|
|
726
|
-
cloneResult.linksCopied =
|
|
984
|
+
cloneResult.linksCopied = created2;
|
|
727
985
|
if (skipped > 0) cloneResult.linksSkipped = skipped;
|
|
728
986
|
}
|
|
729
987
|
output(cloneResult);
|
|
@@ -736,7 +994,7 @@ function commentEdit(parent) {
|
|
|
736
994
|
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
995
|
const client = getClient();
|
|
738
996
|
const result = await client.issues.editComment({ issueKeyOrId: key, commentId: opts.id, body: opts.body });
|
|
739
|
-
output(result);
|
|
997
|
+
output(transformComment(result));
|
|
740
998
|
});
|
|
741
999
|
}
|
|
742
1000
|
|
|
@@ -745,7 +1003,7 @@ function comment(parent) {
|
|
|
745
1003
|
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
1004
|
const client = getClient();
|
|
747
1005
|
const result = await client.issues.addComment({ issueKeyOrId: key, body: opts.body });
|
|
748
|
-
output(result);
|
|
1006
|
+
output(transformComment(result));
|
|
749
1007
|
});
|
|
750
1008
|
}
|
|
751
1009
|
|
|
@@ -777,7 +1035,7 @@ Examples:
|
|
|
777
1035
|
parent: opts.parent,
|
|
778
1036
|
customFields: opts.customFields ? JSON.parse(opts.customFields) : void 0
|
|
779
1037
|
});
|
|
780
|
-
output(result);
|
|
1038
|
+
output(transformCreatedIssue(result));
|
|
781
1039
|
}
|
|
782
1040
|
);
|
|
783
1041
|
}
|
|
@@ -885,7 +1143,7 @@ function getWorklog(parent) {
|
|
|
885
1143
|
startAt: opts.startAt,
|
|
886
1144
|
maxResults: opts.max
|
|
887
1145
|
});
|
|
888
|
-
output(result);
|
|
1146
|
+
output(transformPaged(result, transformWorklog));
|
|
889
1147
|
});
|
|
890
1148
|
}
|
|
891
1149
|
|
|
@@ -918,7 +1176,7 @@ function get2(parent) {
|
|
|
918
1176
|
fields,
|
|
919
1177
|
expand: opts.expand
|
|
920
1178
|
});
|
|
921
|
-
output(result);
|
|
1179
|
+
output(transformIssue(result));
|
|
922
1180
|
});
|
|
923
1181
|
}
|
|
924
1182
|
|
|
@@ -930,7 +1188,11 @@ function linkEpic(parent) {
|
|
|
930
1188
|
issueKeyOrId: key,
|
|
931
1189
|
fields: { customfield_10100: opts.epic }
|
|
932
1190
|
});
|
|
933
|
-
output({
|
|
1191
|
+
output({
|
|
1192
|
+
linked: true,
|
|
1193
|
+
issue: transformIssueRef(key),
|
|
1194
|
+
epic: transformIssueRef(opts.epic)
|
|
1195
|
+
});
|
|
934
1196
|
});
|
|
935
1197
|
}
|
|
936
1198
|
|
|
@@ -939,7 +1201,7 @@ function linkTypes(parent) {
|
|
|
939
1201
|
parent.command("link-types").description("List all issue link types").addHelpText("after", "\nExamples:\n jiradc issue link-types").action(async () => {
|
|
940
1202
|
const client = getClient();
|
|
941
1203
|
const result = await client.links.getTypes();
|
|
942
|
-
output(result);
|
|
1204
|
+
output(result.map(transformIssueLinkType));
|
|
943
1205
|
});
|
|
944
1206
|
}
|
|
945
1207
|
|
|
@@ -956,7 +1218,12 @@ function link(parent) {
|
|
|
956
1218
|
outwardIssueKey: opts.to,
|
|
957
1219
|
comment: opts.comment
|
|
958
1220
|
});
|
|
959
|
-
output({
|
|
1221
|
+
output({
|
|
1222
|
+
created: true,
|
|
1223
|
+
type: opts.type,
|
|
1224
|
+
inward: transformIssueRef(opts.from),
|
|
1225
|
+
outward: transformIssueRef(opts.to)
|
|
1226
|
+
});
|
|
960
1227
|
});
|
|
961
1228
|
}
|
|
962
1229
|
|
|
@@ -974,7 +1241,7 @@ function search2(parent) {
|
|
|
974
1241
|
maxResults: opts.max,
|
|
975
1242
|
fields
|
|
976
1243
|
});
|
|
977
|
-
output(result);
|
|
1244
|
+
output(transformPaged(result, transformIssue));
|
|
978
1245
|
});
|
|
979
1246
|
}
|
|
980
1247
|
|
|
@@ -986,7 +1253,7 @@ function transition(parent) {
|
|
|
986
1253
|
).action(async (key, opts) => {
|
|
987
1254
|
const client = getClient();
|
|
988
1255
|
await client.issues.transition({ issueKeyOrId: key, transitionId: opts.to, comment: opts.comment });
|
|
989
|
-
output({ transitioned: true,
|
|
1256
|
+
output({ transitioned: true, issue: transformIssueRef(key) });
|
|
990
1257
|
});
|
|
991
1258
|
}
|
|
992
1259
|
|
|
@@ -1037,7 +1304,11 @@ Examples:
|
|
|
1037
1304
|
}
|
|
1038
1305
|
}
|
|
1039
1306
|
}
|
|
1040
|
-
output({
|
|
1307
|
+
output({
|
|
1308
|
+
updated: true,
|
|
1309
|
+
issue: transformIssueRef(key),
|
|
1310
|
+
...uploaded.length > 0 && { attachments: uploaded }
|
|
1311
|
+
});
|
|
1041
1312
|
});
|
|
1042
1313
|
}
|
|
1043
1314
|
|
|
@@ -1054,7 +1325,7 @@ function worklog(parent) {
|
|
|
1054
1325
|
comment: opts.comment,
|
|
1055
1326
|
started: opts.started
|
|
1056
1327
|
});
|
|
1057
|
-
output(result);
|
|
1328
|
+
output(transformWorklog(result));
|
|
1058
1329
|
});
|
|
1059
1330
|
}
|
|
1060
1331
|
|
|
@@ -1104,7 +1375,7 @@ function list4(parent) {
|
|
|
1104
1375
|
).action(async (opts) => {
|
|
1105
1376
|
const client = getClient();
|
|
1106
1377
|
const result = await client.projects.getAll({ expand: opts.expand, includeArchived: opts.includeArchived });
|
|
1107
|
-
output(result);
|
|
1378
|
+
output(result.map(transformProject));
|
|
1108
1379
|
});
|
|
1109
1380
|
}
|
|
1110
1381
|
|
|
@@ -1116,7 +1387,7 @@ function versions(parent) {
|
|
|
1116
1387
|
).action(async (key, opts) => {
|
|
1117
1388
|
const client = getClient();
|
|
1118
1389
|
const result = await client.projects.getVersions({ projectKeyOrId: key, expand: opts.expand });
|
|
1119
|
-
output(result);
|
|
1390
|
+
output(result.map(transformVersion));
|
|
1120
1391
|
});
|
|
1121
1392
|
}
|
|
1122
1393
|
|
|
@@ -1148,7 +1419,7 @@ function create3(parent) {
|
|
|
1148
1419
|
endDate: opts.endDate,
|
|
1149
1420
|
goal: opts.goal
|
|
1150
1421
|
});
|
|
1151
|
-
output(result);
|
|
1422
|
+
output(transformSprint(result));
|
|
1152
1423
|
});
|
|
1153
1424
|
}
|
|
1154
1425
|
|
|
@@ -1167,7 +1438,7 @@ function issues2(parent) {
|
|
|
1167
1438
|
fields: opts.fields?.split(",").map((f) => f.trim()),
|
|
1168
1439
|
jql: opts.jql
|
|
1169
1440
|
});
|
|
1170
|
-
output(result);
|
|
1441
|
+
output(transformPaged(result, transformIssue));
|
|
1171
1442
|
});
|
|
1172
1443
|
}
|
|
1173
1444
|
|
|
@@ -1184,7 +1455,7 @@ function list5(parent) {
|
|
|
1184
1455
|
boardId: opts.board,
|
|
1185
1456
|
state: opts.state
|
|
1186
1457
|
});
|
|
1187
|
-
output(result);
|
|
1458
|
+
output(result.map(transformSprint));
|
|
1188
1459
|
});
|
|
1189
1460
|
}
|
|
1190
1461
|
|
|
@@ -1206,7 +1477,7 @@ function update3(parent) {
|
|
|
1206
1477
|
endDate: opts.endDate,
|
|
1207
1478
|
goal: opts.goal
|
|
1208
1479
|
});
|
|
1209
|
-
output(result);
|
|
1480
|
+
output(transformSprint(result));
|
|
1210
1481
|
}
|
|
1211
1482
|
);
|
|
1212
1483
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jiradc-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13-ge64eee0.1",
|
|
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-ge64eee0.1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/node": "24.10.4",
|