jiradc-cli 1.0.11 → 1.0.12-g5c93acb.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +337 -48
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { readFileSync } from "fs";
|
|
|
5
5
|
import { dirname, join as join4 } from "path";
|
|
6
6
|
import { fileURLToPath } from "url";
|
|
7
7
|
import { styleText } from "util";
|
|
8
|
-
import { Command as
|
|
8
|
+
import { Command as Command8 } from "commander";
|
|
9
9
|
|
|
10
10
|
// src/commands/board/issues.ts
|
|
11
11
|
import { Argument } from "commander";
|
|
@@ -226,6 +226,135 @@ Examples:
|
|
|
226
226
|
issues(board);
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
+
// src/commands/component/create.ts
|
|
230
|
+
import { Option as Option2 } from "commander";
|
|
231
|
+
var ASSIGNEE_TYPES = [
|
|
232
|
+
"PROJECT_DEFAULT",
|
|
233
|
+
"COMPONENT_LEAD",
|
|
234
|
+
"PROJECT_LEAD",
|
|
235
|
+
"UNASSIGNED"
|
|
236
|
+
];
|
|
237
|
+
function create(parent) {
|
|
238
|
+
parent.command("create").description("Create a new component in a project").requiredOption("--project <key>", "Project key (e.g., AI)").requiredOption("--name <name>", "Component name").option("--description <text>", "Component description").option("--lead <username>", "Username of the component lead").addOption(new Option2("--assignee-type <type>", "Assignee strategy").choices(ASSIGNEE_TYPES)).addHelpText(
|
|
239
|
+
"after",
|
|
240
|
+
`
|
|
241
|
+
Examples:
|
|
242
|
+
jiradc component create --project AI --name Backend
|
|
243
|
+
jiradc component create --project AI --name Frontend --description "UI work" --lead jsmith
|
|
244
|
+
jiradc component create --project AI --name Infra --assignee-type COMPONENT_LEAD --lead jsmith`
|
|
245
|
+
).action(
|
|
246
|
+
async (opts) => {
|
|
247
|
+
const client = getClient();
|
|
248
|
+
const result = await client.components.create({
|
|
249
|
+
project: opts.project,
|
|
250
|
+
name: opts.name,
|
|
251
|
+
description: opts.description,
|
|
252
|
+
leadUserName: opts.lead,
|
|
253
|
+
assigneeType: opts.assigneeType
|
|
254
|
+
});
|
|
255
|
+
output(result);
|
|
256
|
+
}
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// src/commands/component/delete.ts
|
|
261
|
+
function deleteComponent(parent) {
|
|
262
|
+
parent.command("delete <id>").description("Delete a component, optionally reassigning its issues to another component").option("--move-issues-to <id>", "Reassign existing issues to this component ID before deletion").addHelpText(
|
|
263
|
+
"after",
|
|
264
|
+
`
|
|
265
|
+
Examples:
|
|
266
|
+
jiradc component delete 11289
|
|
267
|
+
jiradc component delete 11289 --move-issues-to 11290`
|
|
268
|
+
).action(async (id, opts) => {
|
|
269
|
+
const client = getClient();
|
|
270
|
+
await client.components.delete({ id, moveIssuesTo: opts.moveIssuesTo });
|
|
271
|
+
output({ deleted: true, componentId: id, ...opts.moveIssuesTo && { movedIssuesTo: opts.moveIssuesTo } });
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// src/commands/component/get.ts
|
|
276
|
+
function get(parent) {
|
|
277
|
+
parent.command("get <id>").description("Get a component by ID").addHelpText("after", "\nExamples:\n jiradc component get 11289").action(async (id) => {
|
|
278
|
+
const client = getClient();
|
|
279
|
+
const result = await client.components.get({ id });
|
|
280
|
+
output(result);
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// src/commands/component/issue-count.ts
|
|
285
|
+
function issueCount(parent) {
|
|
286
|
+
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
|
+
const client = getClient();
|
|
288
|
+
const result = await client.components.getRelatedIssueCounts({ id });
|
|
289
|
+
output(result);
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// src/commands/component/list.ts
|
|
294
|
+
function list2(parent) {
|
|
295
|
+
parent.command("list <projectKey>").description("List all components for a project").addHelpText("after", "\nExamples:\n jiradc component list AI").action(async (projectKey) => {
|
|
296
|
+
const client = getClient();
|
|
297
|
+
const result = await client.components.list({ projectKeyOrId: projectKey });
|
|
298
|
+
output(result);
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// src/commands/component/update.ts
|
|
303
|
+
import { Option as Option3 } from "commander";
|
|
304
|
+
var ASSIGNEE_TYPES2 = [
|
|
305
|
+
"PROJECT_DEFAULT",
|
|
306
|
+
"COMPONENT_LEAD",
|
|
307
|
+
"PROJECT_LEAD",
|
|
308
|
+
"UNASSIGNED"
|
|
309
|
+
];
|
|
310
|
+
function update(parent) {
|
|
311
|
+
parent.command("update <id>").description("Update an existing component (only provided fields are changed)").option("--name <name>", "New component name").option("--description <text>", "New component description").option("--lead <username>", "Username of the component lead (empty string clears it)").addOption(new Option3("--assignee-type <type>", "New assignee strategy").choices(ASSIGNEE_TYPES2)).addHelpText(
|
|
312
|
+
"after",
|
|
313
|
+
`
|
|
314
|
+
Examples:
|
|
315
|
+
jiradc component update 11289 --name Backend
|
|
316
|
+
jiradc component update 11289 --description "Server-side code"
|
|
317
|
+
jiradc component update 11289 --lead jsmith --assignee-type COMPONENT_LEAD`
|
|
318
|
+
).action(
|
|
319
|
+
async (id, opts) => {
|
|
320
|
+
if (opts.name === void 0 && opts.description === void 0 && opts.lead === void 0 && opts.assigneeType === void 0) {
|
|
321
|
+
throw new Error("Provide at least one of --name, --description, --lead, --assignee-type");
|
|
322
|
+
}
|
|
323
|
+
const client = getClient();
|
|
324
|
+
const result = await client.components.update({
|
|
325
|
+
id,
|
|
326
|
+
name: opts.name,
|
|
327
|
+
description: opts.description,
|
|
328
|
+
leadUserName: opts.lead,
|
|
329
|
+
assigneeType: opts.assigneeType
|
|
330
|
+
});
|
|
331
|
+
output(result);
|
|
332
|
+
}
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// src/commands/component/index.ts
|
|
337
|
+
function registerComponentCommands(program2) {
|
|
338
|
+
const component = program2.command("component").description("Project component operations").addHelpText(
|
|
339
|
+
"after",
|
|
340
|
+
`
|
|
341
|
+
Examples:
|
|
342
|
+
$ jiradc component list AI
|
|
343
|
+
$ jiradc component get 11289
|
|
344
|
+
$ jiradc component create --project AI --name Backend
|
|
345
|
+
$ jiradc component update 11289 --name Backend
|
|
346
|
+
$ jiradc component delete 11289 --move-issues-to 11290
|
|
347
|
+
$ jiradc component issue-count 11289
|
|
348
|
+
`
|
|
349
|
+
);
|
|
350
|
+
list2(component);
|
|
351
|
+
get(component);
|
|
352
|
+
create(component);
|
|
353
|
+
update(component);
|
|
354
|
+
deleteComponent(component);
|
|
355
|
+
issueCount(component);
|
|
356
|
+
}
|
|
357
|
+
|
|
229
358
|
// src/commands/field/options.ts
|
|
230
359
|
function options(parent) {
|
|
231
360
|
parent.command("options <id>").description("Get available options for a custom field").option("--query <text>", "Filter options by text").option("--max <number>", "Max results to return (1-1000)", intInRange(1, 1e3), 25).option("--page <number>", "Page number (1-indexed)", positiveInt).addHelpText(
|
|
@@ -343,7 +472,7 @@ function download(parent) {
|
|
|
343
472
|
}
|
|
344
473
|
|
|
345
474
|
// src/commands/issue/attachment/list.ts
|
|
346
|
-
function
|
|
475
|
+
function list3(parent) {
|
|
347
476
|
parent.command("list <key>").description("List attachments on an issue").addHelpText("after", "\nExamples:\n jiradc issue attachment list PROJ-123").action(async (key) => {
|
|
348
477
|
const client = getClient();
|
|
349
478
|
const issue = await client.issues.get({
|
|
@@ -406,7 +535,7 @@ Examples:
|
|
|
406
535
|
`
|
|
407
536
|
);
|
|
408
537
|
upload(attachment);
|
|
409
|
-
|
|
538
|
+
list3(attachment);
|
|
410
539
|
download(attachment);
|
|
411
540
|
downloadAll(attachment);
|
|
412
541
|
deleteAttachment(attachment);
|
|
@@ -475,6 +604,165 @@ function batchChangelog(parent) {
|
|
|
475
604
|
});
|
|
476
605
|
}
|
|
477
606
|
|
|
607
|
+
// src/utils/transformers.ts
|
|
608
|
+
function jiraBaseUrl() {
|
|
609
|
+
return (process.env.JIRA_URL ?? "").replace(/\/+$/, "");
|
|
610
|
+
}
|
|
611
|
+
function transformPaged(response, fn) {
|
|
612
|
+
const { startAt, maxResults, total } = response;
|
|
613
|
+
if ("issues" in response) {
|
|
614
|
+
const mapped2 = response.issues.map(fn);
|
|
615
|
+
return { startAt, maxResults, total, isLast: startAt + mapped2.length >= total, issues: mapped2 };
|
|
616
|
+
}
|
|
617
|
+
if ("values" in response) {
|
|
618
|
+
const mapped2 = response.values.map(fn);
|
|
619
|
+
return { startAt, maxResults, total, isLast: startAt + mapped2.length >= total, values: mapped2 };
|
|
620
|
+
}
|
|
621
|
+
const mapped = response.worklogs.map(fn);
|
|
622
|
+
return { startAt, maxResults, total, isLast: startAt + mapped.length >= total, worklogs: mapped };
|
|
623
|
+
}
|
|
624
|
+
function issueBrowseUrl(key) {
|
|
625
|
+
return `${jiraBaseUrl()}/browse/${key}`;
|
|
626
|
+
}
|
|
627
|
+
function transformCreatedIssue(r) {
|
|
628
|
+
return { id: r.id, key: r.key, url: issueBrowseUrl(r.key) };
|
|
629
|
+
}
|
|
630
|
+
function transformUser(user) {
|
|
631
|
+
const { self: _self, avatarUrls: _avatarUrls, expand: _expand, ...rest } = user;
|
|
632
|
+
return rest;
|
|
633
|
+
}
|
|
634
|
+
function transformIssueType(t) {
|
|
635
|
+
const { self: _self, iconUrl: _iconUrl, avatarId: _avatarId, ...rest } = t;
|
|
636
|
+
return rest;
|
|
637
|
+
}
|
|
638
|
+
function transformStatus(s) {
|
|
639
|
+
const { self: _self, iconUrl: _iconUrl, ...rest } = s;
|
|
640
|
+
return rest;
|
|
641
|
+
}
|
|
642
|
+
function transformPriority(p) {
|
|
643
|
+
const { self: _self, iconUrl: _iconUrl, ...rest } = p;
|
|
644
|
+
return rest;
|
|
645
|
+
}
|
|
646
|
+
function transformResolution(r) {
|
|
647
|
+
const { self: _self, ...rest } = r;
|
|
648
|
+
return rest;
|
|
649
|
+
}
|
|
650
|
+
function transformVersion(v) {
|
|
651
|
+
const { self: _self, ...rest } = v;
|
|
652
|
+
return rest;
|
|
653
|
+
}
|
|
654
|
+
function transformIssueLinkType(t) {
|
|
655
|
+
const { self: _self, ...rest } = t;
|
|
656
|
+
return rest;
|
|
657
|
+
}
|
|
658
|
+
function transformComment(c) {
|
|
659
|
+
const { self: _self, author, updateAuthor, ...rest } = c;
|
|
660
|
+
return {
|
|
661
|
+
...rest,
|
|
662
|
+
...author ? { author: transformUser(author) } : {},
|
|
663
|
+
...updateAuthor ? { updateAuthor: transformUser(updateAuthor) } : {}
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
function transformWorklog(w) {
|
|
667
|
+
const { self: _self, author, updateAuthor, ...rest } = w;
|
|
668
|
+
return {
|
|
669
|
+
...rest,
|
|
670
|
+
...author ? { author: transformUser(author) } : {},
|
|
671
|
+
...updateAuthor ? { updateAuthor: transformUser(updateAuthor) } : {}
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
function transformAttachment(a) {
|
|
675
|
+
const { self: _self, author, ...rest } = a;
|
|
676
|
+
return {
|
|
677
|
+
...rest,
|
|
678
|
+
...author ? { author: transformUser(author) } : {}
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
function transformIssueBasic(b) {
|
|
682
|
+
const { self: _self, fields, ...rest } = b;
|
|
683
|
+
return {
|
|
684
|
+
...rest,
|
|
685
|
+
url: issueBrowseUrl(b.key),
|
|
686
|
+
...fields ? {
|
|
687
|
+
fields: {
|
|
688
|
+
...fields.summary !== void 0 ? { summary: fields.summary } : {},
|
|
689
|
+
...fields.status ? { status: transformStatus(fields.status) } : {},
|
|
690
|
+
...fields.priority ? { priority: transformPriority(fields.priority) } : {},
|
|
691
|
+
...fields.issuetype ? { issuetype: transformIssueType(fields.issuetype) } : {}
|
|
692
|
+
}
|
|
693
|
+
} : {}
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
function transformIssueLink(l) {
|
|
697
|
+
const { self: _self, type, inwardIssue, outwardIssue, ...rest } = l;
|
|
698
|
+
return {
|
|
699
|
+
...rest,
|
|
700
|
+
type: transformIssueLinkType(type),
|
|
701
|
+
...inwardIssue ? { inwardIssue: transformIssueBasic(inwardIssue) } : {},
|
|
702
|
+
...outwardIssue ? { outwardIssue: transformIssueBasic(outwardIssue) } : {}
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
function transformIssue(issue) {
|
|
706
|
+
const { self: _self, expand: _expand, fields, ...rest } = issue;
|
|
707
|
+
return {
|
|
708
|
+
...rest,
|
|
709
|
+
url: issueBrowseUrl(issue.key),
|
|
710
|
+
fields: transformIssueFields(fields)
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
function transformIssueFields(fields) {
|
|
714
|
+
const {
|
|
715
|
+
issuetype,
|
|
716
|
+
status,
|
|
717
|
+
priority,
|
|
718
|
+
resolution,
|
|
719
|
+
assignee,
|
|
720
|
+
reporter,
|
|
721
|
+
creator,
|
|
722
|
+
fixVersions,
|
|
723
|
+
versions: versions2,
|
|
724
|
+
issuelinks,
|
|
725
|
+
subtasks,
|
|
726
|
+
parent,
|
|
727
|
+
comment: comment2,
|
|
728
|
+
worklog: worklog2,
|
|
729
|
+
attachment,
|
|
730
|
+
...rest
|
|
731
|
+
} = fields;
|
|
732
|
+
return {
|
|
733
|
+
...rest,
|
|
734
|
+
issuetype: transformIssueType(issuetype),
|
|
735
|
+
status: transformStatus(status),
|
|
736
|
+
...priority ? { priority: transformPriority(priority) } : {},
|
|
737
|
+
...resolution ? { resolution: transformResolution(resolution) } : {},
|
|
738
|
+
...assignee ? { assignee: transformUser(assignee) } : {},
|
|
739
|
+
...reporter ? { reporter: transformUser(reporter) } : {},
|
|
740
|
+
...creator ? { creator: transformUser(creator) } : {},
|
|
741
|
+
...fixVersions ? { fixVersions: fixVersions.map(transformVersion) } : {},
|
|
742
|
+
...versions2 ? { versions: versions2.map(transformVersion) } : {},
|
|
743
|
+
...issuelinks ? { issuelinks: issuelinks.map(transformIssueLink) } : {},
|
|
744
|
+
...subtasks ? { subtasks: subtasks.map(transformIssueBasic) } : {},
|
|
745
|
+
...parent ? { parent: transformIssueBasic(parent) } : {},
|
|
746
|
+
...comment2 ? {
|
|
747
|
+
comment: {
|
|
748
|
+
comments: comment2.comments.map(transformComment),
|
|
749
|
+
maxResults: comment2.maxResults,
|
|
750
|
+
total: comment2.total,
|
|
751
|
+
startAt: comment2.startAt
|
|
752
|
+
}
|
|
753
|
+
} : {},
|
|
754
|
+
...worklog2 ? {
|
|
755
|
+
worklog: {
|
|
756
|
+
worklogs: worklog2.worklogs.map(transformWorklog),
|
|
757
|
+
maxResults: worklog2.maxResults,
|
|
758
|
+
total: worklog2.total,
|
|
759
|
+
startAt: worklog2.startAt
|
|
760
|
+
}
|
|
761
|
+
} : {},
|
|
762
|
+
...attachment ? { attachment: attachment.map(transformAttachment) } : {}
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
|
|
478
766
|
// src/commands/issue/batch-create.ts
|
|
479
767
|
function batchCreate(parent) {
|
|
480
768
|
parent.command("batch-create").description("Create multiple issues from a JSON array").requiredOption("--issues <json>", "JSON array of issue objects").addHelpText(
|
|
@@ -489,7 +777,7 @@ Examples:
|
|
|
489
777
|
for (const issue of parsed) {
|
|
490
778
|
try {
|
|
491
779
|
const result = await client.issues.create(issue);
|
|
492
|
-
results.push({ key: result.key });
|
|
780
|
+
results.push({ key: result.key, url: issueBrowseUrl(result.key) });
|
|
493
781
|
} catch (error) {
|
|
494
782
|
results.push({ error: error instanceof Error ? error.message : "Unknown error" });
|
|
495
783
|
}
|
|
@@ -555,7 +843,8 @@ Examples:
|
|
|
555
843
|
const cloneResult = {
|
|
556
844
|
cloned: true,
|
|
557
845
|
source: key,
|
|
558
|
-
newIssue: result
|
|
846
|
+
newIssue: result,
|
|
847
|
+
url: issueBrowseUrl(newKey)
|
|
559
848
|
};
|
|
560
849
|
if (opts.includeAttachments && f.attachment?.length) {
|
|
561
850
|
const tmpFiles = [];
|
|
@@ -607,7 +896,7 @@ function commentEdit(parent) {
|
|
|
607
896
|
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) => {
|
|
608
897
|
const client = getClient();
|
|
609
898
|
const result = await client.issues.editComment({ issueKeyOrId: key, commentId: opts.id, body: opts.body });
|
|
610
|
-
output(result);
|
|
899
|
+
output(transformComment(result));
|
|
611
900
|
});
|
|
612
901
|
}
|
|
613
902
|
|
|
@@ -616,12 +905,12 @@ function comment(parent) {
|
|
|
616
905
|
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) => {
|
|
617
906
|
const client = getClient();
|
|
618
907
|
const result = await client.issues.addComment({ issueKeyOrId: key, body: opts.body });
|
|
619
|
-
output(result);
|
|
908
|
+
output(transformComment(result));
|
|
620
909
|
});
|
|
621
910
|
}
|
|
622
911
|
|
|
623
912
|
// src/commands/issue/create.ts
|
|
624
|
-
function
|
|
913
|
+
function create2(parent) {
|
|
625
914
|
parent.command("create").description("Create a new issue").requiredOption("--project <key>", "Project key or ID").requiredOption("--type <name>", "Issue type name (e.g., Task, Bug, Story)").requiredOption("--summary <text>", "Issue summary/title").option("--description <text>", "Issue description in wiki markup").option("--assignee <username>", "Assignee username").option("--reporter <username>", "Reporter username").option("--priority <name>", "Priority name (e.g., High, Medium, Low)").option("--labels <labels>", "Comma-separated labels").option("--components <names>", "Comma-separated component names").option("--fix-versions <versions>", "Comma-separated fix version names").option("--due-date <date>", "Due date in YYYY-MM-DD format").option("--parent <key>", "Parent issue key (for subtasks)").option("--custom-fields <json>", `Additional custom fields as JSON (e.g., '{"customfield_10100": "EPIC-1"}')`).addHelpText(
|
|
626
915
|
"after",
|
|
627
916
|
`
|
|
@@ -648,7 +937,7 @@ Examples:
|
|
|
648
937
|
parent: opts.parent,
|
|
649
938
|
customFields: opts.customFields ? JSON.parse(opts.customFields) : void 0
|
|
650
939
|
});
|
|
651
|
-
output(result);
|
|
940
|
+
output(transformCreatedIssue(result));
|
|
652
941
|
}
|
|
653
942
|
);
|
|
654
943
|
}
|
|
@@ -756,7 +1045,7 @@ function getWorklog(parent) {
|
|
|
756
1045
|
startAt: opts.startAt,
|
|
757
1046
|
maxResults: opts.max
|
|
758
1047
|
});
|
|
759
|
-
output(result);
|
|
1048
|
+
output(transformPaged(result, transformWorklog));
|
|
760
1049
|
});
|
|
761
1050
|
}
|
|
762
1051
|
|
|
@@ -777,7 +1066,7 @@ var DEFAULT_FIELDS = [
|
|
|
777
1066
|
];
|
|
778
1067
|
|
|
779
1068
|
// src/commands/issue/get.ts
|
|
780
|
-
function
|
|
1069
|
+
function get2(parent) {
|
|
781
1070
|
parent.command("get <key>").description("Get issue details").option("--fields <fields>", "Comma-separated fields to return (defaults to essential fields)").option("--all-fields", "Return all fields instead of defaults").option("--expand <expand>", 'Expand options (e.g., "transitions", "changelog")').addHelpText(
|
|
782
1071
|
"after",
|
|
783
1072
|
"\nExamples:\n jiradc issue get PROJ-123\n jiradc issue get PROJ-123 --fields summary,status,assignee\n jiradc issue get PROJ-123 --all-fields\n jiradc issue get PROJ-123 --expand changelog,transitions"
|
|
@@ -789,7 +1078,7 @@ function get(parent) {
|
|
|
789
1078
|
fields,
|
|
790
1079
|
expand: opts.expand
|
|
791
1080
|
});
|
|
792
|
-
output(result);
|
|
1081
|
+
output(transformIssue(result));
|
|
793
1082
|
});
|
|
794
1083
|
}
|
|
795
1084
|
|
|
@@ -801,7 +1090,13 @@ function linkEpic(parent) {
|
|
|
801
1090
|
issueKeyOrId: key,
|
|
802
1091
|
fields: { customfield_10100: opts.epic }
|
|
803
1092
|
});
|
|
804
|
-
output({
|
|
1093
|
+
output({
|
|
1094
|
+
linked: true,
|
|
1095
|
+
issue: key,
|
|
1096
|
+
url: issueBrowseUrl(key),
|
|
1097
|
+
epic: opts.epic,
|
|
1098
|
+
epicUrl: issueBrowseUrl(opts.epic)
|
|
1099
|
+
});
|
|
805
1100
|
});
|
|
806
1101
|
}
|
|
807
1102
|
|
|
@@ -810,7 +1105,7 @@ function linkTypes(parent) {
|
|
|
810
1105
|
parent.command("link-types").description("List all issue link types").addHelpText("after", "\nExamples:\n jiradc issue link-types").action(async () => {
|
|
811
1106
|
const client = getClient();
|
|
812
1107
|
const result = await client.links.getTypes();
|
|
813
|
-
output(result);
|
|
1108
|
+
output(result.map(transformIssueLinkType));
|
|
814
1109
|
});
|
|
815
1110
|
}
|
|
816
1111
|
|
|
@@ -845,7 +1140,7 @@ function search2(parent) {
|
|
|
845
1140
|
maxResults: opts.max,
|
|
846
1141
|
fields
|
|
847
1142
|
});
|
|
848
|
-
output(result);
|
|
1143
|
+
output(transformPaged(result, transformIssue));
|
|
849
1144
|
});
|
|
850
1145
|
}
|
|
851
1146
|
|
|
@@ -857,7 +1152,7 @@ function transition(parent) {
|
|
|
857
1152
|
).action(async (key, opts) => {
|
|
858
1153
|
const client = getClient();
|
|
859
1154
|
await client.issues.transition({ issueKeyOrId: key, transitionId: opts.to, comment: opts.comment });
|
|
860
|
-
output({ transitioned: true, issueKey: key });
|
|
1155
|
+
output({ transitioned: true, issueKey: key, url: issueBrowseUrl(key) });
|
|
861
1156
|
});
|
|
862
1157
|
}
|
|
863
1158
|
|
|
@@ -880,7 +1175,7 @@ function unlink2(parent) {
|
|
|
880
1175
|
}
|
|
881
1176
|
|
|
882
1177
|
// src/commands/issue/update.ts
|
|
883
|
-
function
|
|
1178
|
+
function update2(parent) {
|
|
884
1179
|
parent.command("update <key>").description("Update issue fields").option("--fields <json>", "JSON string of fields to update").option("--notify-users", "Notify users about the update (default: true)").option("--attachments <paths>", "Comma-separated local file paths to attach").addHelpText(
|
|
885
1180
|
"after",
|
|
886
1181
|
`
|
|
@@ -891,8 +1186,7 @@ Examples:
|
|
|
891
1186
|
jiradc issue update PROJ-123 --fields '{"summary": "With attachment"}' --attachments ./report.pdf`
|
|
892
1187
|
).action(async (key, opts) => {
|
|
893
1188
|
if (!opts.fields && !opts.attachments) {
|
|
894
|
-
|
|
895
|
-
process.exit(1);
|
|
1189
|
+
throw new Error("Provide --fields and/or --attachments");
|
|
896
1190
|
}
|
|
897
1191
|
const client = getClient();
|
|
898
1192
|
if (opts.fields) {
|
|
@@ -909,7 +1203,12 @@ Examples:
|
|
|
909
1203
|
}
|
|
910
1204
|
}
|
|
911
1205
|
}
|
|
912
|
-
output({
|
|
1206
|
+
output({
|
|
1207
|
+
updated: true,
|
|
1208
|
+
issueKey: key,
|
|
1209
|
+
url: issueBrowseUrl(key),
|
|
1210
|
+
...uploaded.length > 0 && { attachments: uploaded }
|
|
1211
|
+
});
|
|
913
1212
|
});
|
|
914
1213
|
}
|
|
915
1214
|
|
|
@@ -926,7 +1225,7 @@ function worklog(parent) {
|
|
|
926
1225
|
comment: opts.comment,
|
|
927
1226
|
started: opts.started
|
|
928
1227
|
});
|
|
929
|
-
output(result);
|
|
1228
|
+
output(transformWorklog(result));
|
|
930
1229
|
});
|
|
931
1230
|
}
|
|
932
1231
|
|
|
@@ -944,10 +1243,10 @@ Examples:
|
|
|
944
1243
|
$ jiradc issue attachment list PROJ-123
|
|
945
1244
|
`
|
|
946
1245
|
);
|
|
947
|
-
|
|
1246
|
+
get2(issue);
|
|
948
1247
|
search2(issue);
|
|
949
|
-
|
|
950
|
-
|
|
1248
|
+
create2(issue);
|
|
1249
|
+
update2(issue);
|
|
951
1250
|
deleteIssue(issue);
|
|
952
1251
|
transition(issue);
|
|
953
1252
|
transitions(issue);
|
|
@@ -968,17 +1267,8 @@ Examples:
|
|
|
968
1267
|
devStatus(issue);
|
|
969
1268
|
}
|
|
970
1269
|
|
|
971
|
-
// src/commands/project/components.ts
|
|
972
|
-
function components(parent) {
|
|
973
|
-
parent.command("components <key>").description("Get all components for a project").addHelpText("after", "\nExamples:\n jiradc project components PROJ").action(async (key) => {
|
|
974
|
-
const client = getClient();
|
|
975
|
-
const result = await client.projects.getComponents({ projectKeyOrId: key });
|
|
976
|
-
output(result);
|
|
977
|
-
});
|
|
978
|
-
}
|
|
979
|
-
|
|
980
1270
|
// src/commands/project/list.ts
|
|
981
|
-
function
|
|
1271
|
+
function list4(parent) {
|
|
982
1272
|
parent.command("list").description("List all projects").option("--expand <expand>", 'Expand options (e.g., "description,lead")').option("--include-archived", "Include archived projects (default: false)").addHelpText(
|
|
983
1273
|
"after",
|
|
984
1274
|
"\nExamples:\n jiradc project list\n jiradc project list --expand description,lead\n jiradc project list --include-archived"
|
|
@@ -1009,16 +1299,14 @@ function registerProjectCommands(program2) {
|
|
|
1009
1299
|
Examples:
|
|
1010
1300
|
$ jiradc project list
|
|
1011
1301
|
$ jiradc project versions PROJ
|
|
1012
|
-
$ jiradc project components PROJ
|
|
1013
1302
|
`
|
|
1014
1303
|
);
|
|
1015
|
-
|
|
1304
|
+
list4(project);
|
|
1016
1305
|
versions(project);
|
|
1017
|
-
components(project);
|
|
1018
1306
|
}
|
|
1019
1307
|
|
|
1020
1308
|
// src/commands/sprint/create.ts
|
|
1021
|
-
function
|
|
1309
|
+
function create3(parent) {
|
|
1022
1310
|
parent.command("create").description("Create a new sprint").requiredOption("--board <id>", "Board ID to create sprint in", positiveInt).requiredOption("--name <name>", "Sprint name").option("--start-date <date>", "Start date in ISO 8601 format").option("--end-date <date>", "End date in ISO 8601 format").option("--goal <goal>", "Sprint goal").addHelpText(
|
|
1023
1311
|
"after",
|
|
1024
1312
|
'\nExamples:\n jiradc sprint create --board 42 --name "Sprint 10"\n jiradc sprint create --board 42 --name "Sprint 10" --start-date 2026-03-20 --end-date 2026-04-03 --goal "Complete auth module"'
|
|
@@ -1055,10 +1343,10 @@ function issues2(parent) {
|
|
|
1055
1343
|
}
|
|
1056
1344
|
|
|
1057
1345
|
// src/commands/sprint/list.ts
|
|
1058
|
-
import { Option as
|
|
1346
|
+
import { Option as Option4 } from "commander";
|
|
1059
1347
|
var SPRINT_STATES = ["future", "active", "closed"];
|
|
1060
|
-
function
|
|
1061
|
-
parent.command("list").description("List sprints for a board").requiredOption("--board <id>", "Board ID", positiveInt).addOption(new
|
|
1348
|
+
function list5(parent) {
|
|
1349
|
+
parent.command("list").description("List sprints for a board").requiredOption("--board <id>", "Board ID", positiveInt).addOption(new Option4("--state <state>", "Filter by sprint state").choices(SPRINT_STATES)).addHelpText(
|
|
1062
1350
|
"after",
|
|
1063
1351
|
"\nExamples:\n jiradc sprint list --board 42\n jiradc sprint list --board 42 --state active"
|
|
1064
1352
|
).action(async (opts) => {
|
|
@@ -1072,10 +1360,10 @@ function list4(parent) {
|
|
|
1072
1360
|
}
|
|
1073
1361
|
|
|
1074
1362
|
// src/commands/sprint/update.ts
|
|
1075
|
-
import { Argument as Argument3, Option as
|
|
1363
|
+
import { Argument as Argument3, Option as Option5 } from "commander";
|
|
1076
1364
|
var SPRINT_STATES2 = ["future", "active", "closed"];
|
|
1077
|
-
function
|
|
1078
|
-
parent.command("update").description("Update an existing sprint").addArgument(new Argument3("<id>", "Sprint ID").argParser(positiveInt)).option("--name <name>", "New sprint name").addOption(new
|
|
1365
|
+
function update3(parent) {
|
|
1366
|
+
parent.command("update").description("Update an existing sprint").addArgument(new Argument3("<id>", "Sprint ID").argParser(positiveInt)).option("--name <name>", "New sprint name").addOption(new Option5("--state <state>", "New sprint state").choices(SPRINT_STATES2)).option("--start-date <date>", "New start date in ISO 8601 format").option("--end-date <date>", "New end date in ISO 8601 format").option("--goal <goal>", "New sprint goal").addHelpText(
|
|
1079
1367
|
"after",
|
|
1080
1368
|
'\nExamples:\n jiradc sprint update 100 --name "Sprint 10 - Extended"\n jiradc sprint update 100 --state active\n jiradc sprint update 100 --end-date 2026-04-10 --goal "Updated goal"'
|
|
1081
1369
|
).action(
|
|
@@ -1106,10 +1394,10 @@ Examples:
|
|
|
1106
1394
|
$ jiradc sprint create --board 42 --name "Sprint 10" --start-date 2026-04-01 --end-date 2026-04-14
|
|
1107
1395
|
`
|
|
1108
1396
|
);
|
|
1109
|
-
|
|
1397
|
+
list5(sprint);
|
|
1110
1398
|
issues2(sprint);
|
|
1111
|
-
|
|
1112
|
-
|
|
1399
|
+
create3(sprint);
|
|
1400
|
+
update3(sprint);
|
|
1113
1401
|
}
|
|
1114
1402
|
|
|
1115
1403
|
// src/commands/user/me.ts
|
|
@@ -1147,7 +1435,7 @@ function readPackageVersion() {
|
|
|
1147
1435
|
}
|
|
1148
1436
|
var DIM = "\x1B[2m";
|
|
1149
1437
|
var RESET = "\x1B[0m";
|
|
1150
|
-
var program = new
|
|
1438
|
+
var program = new Command8();
|
|
1151
1439
|
program.name("jiradc").description("Jira Data Center CLI").version(readPackageVersion()).configureHelp({
|
|
1152
1440
|
styleTitle: (str) => styleText("bold", str),
|
|
1153
1441
|
styleUsage: (str) => styleText("dim", str),
|
|
@@ -1179,6 +1467,7 @@ program.hook("preAction", (thisCommand) => {
|
|
|
1179
1467
|
});
|
|
1180
1468
|
registerIssueCommands(program);
|
|
1181
1469
|
registerProjectCommands(program);
|
|
1470
|
+
registerComponentCommands(program);
|
|
1182
1471
|
registerBoardCommands(program);
|
|
1183
1472
|
registerSprintCommands(program);
|
|
1184
1473
|
registerFieldCommands(program);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jiradc-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12-g5c93acb.2",
|
|
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.31"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/node": "24.10.4",
|