jiradc-cli 1.0.17 → 1.0.18-g1be46a3.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.
Files changed (3) hide show
  1. package/README.md +43 -7
  2. package/dist/index.js +272 -62
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -15,6 +15,12 @@ export JIRA_URL="https://jira.example.com" # Base URL of your Jira instance
15
15
  export JIRA_TOKEN="your-personal-access-token" # HTTP Access Token from Jira
16
16
  ```
17
17
 
18
+ ## Breaking changes in this release
19
+
20
+ - `issue transitions` now returns a bare JSON array of transitions (previously wrapped in `{ transitions: [...] }`). Each transition is reduced to `{ id, name, to, fields? }` — verbose fields like `to.iconUrl`, `to.statusCategory`, `isGlobal`, `isInitial`, `isConditional`, `hasScreen` are stripped.
21
+ - `component list` now requires `--project <key>` instead of a positional `<projectKey>` argument.
22
+ - `issue link-epic` is now variadic on the issue argument: `link-epic <issueKey...> --epic <epicKey>`. Single-issue calls keep working.
23
+
18
24
  ## Commands
19
25
 
20
26
  All commands output JSON. Add `--pretty` to pretty-print.
@@ -26,16 +32,17 @@ All commands output JSON. Add `--pretty` to pretty-print.
26
32
  | `jiradc issue get <key>` | Get issue details (`--fields` to select, `--expand` for changelog/transitions) |
27
33
  | `jiradc issue search <jql>` | Search issues with JQL |
28
34
  | `jiradc issue create` | Create an issue (`--project`, `--type`, `--summary`, `--description`, `--custom-fields`) |
29
- | `jiradc issue update <key>` | Update an issue |
35
+ | `jiradc issue update <key>` | Update an issue (`--summary`, `--description`, `--priority`, `--assignee`, `--labels`, `--components`, `--fix-versions`, or `--fields` JSON) |
30
36
  | `jiradc issue delete <key>` | Delete an issue |
31
- | `jiradc issue transition <key> <transitionId>` | Transition issue to a new status |
37
+ | `jiradc issue assign <key> <user>` | Assign issue (user can be a username, `me`, or `none` to unassign) |
38
+ | `jiradc issue transition <key>` | Transition issue to a new status (`--to` accepts ID or status name, `--comment` to add a note) |
32
39
  | `jiradc issue transitions <key>` | List available transitions |
33
40
  | `jiradc issue comment <key>` | Add a comment |
34
41
  | `jiradc issue comment-edit <key> <commentId>` | Edit a comment |
35
42
  | `jiradc issue link <key> <targetKey>` | Link two issues (`--type` link type name) |
36
43
  | `jiradc issue unlink <linkId>` | Remove a link |
37
44
  | `jiradc issue link-types` | List available link types |
38
- | `jiradc issue link-epic <epicKey> <issueKey>` | Link an issue to an epic |
45
+ | `jiradc issue link-epic <keys...>` | Link one or more issues to an epic (`--epic <epicKey>`) |
39
46
  | `jiradc issue worklog <key>` | Add a work log entry |
40
47
  | `jiradc issue get-worklog <key>` | Get work log entries |
41
48
  | `jiradc issue changelog <key>` | Get issue changelog |
@@ -60,7 +67,16 @@ All commands output JSON. Add `--pretty` to pretty-print.
60
67
  |---------|-------------|
61
68
  | `jiradc project list` | List projects |
62
69
  | `jiradc project versions <key>` | List versions for a project |
63
- | `jiradc project components <key>` | List components for a project |
70
+
71
+ ### component
72
+
73
+ | Command | Description |
74
+ |---------|-------------|
75
+ | `jiradc component list` | List components for a project (`--project <key>`) |
76
+ | `jiradc component get <id>` | Get a component by ID |
77
+ | `jiradc component create` | Create a component (`--project`, `--name`, `--description`, `--lead`) |
78
+ | `jiradc component update <id>` | Update a component |
79
+ | `jiradc component issue-count <id>` | Get the number of issues using a component |
64
80
 
65
81
  ### board
66
82
 
@@ -93,7 +109,7 @@ All commands output JSON. Add `--pretty` to pretty-print.
93
109
 
94
110
  ## Pagination
95
111
 
96
- Search and list commands accept `--max` to control page size (Jira DC caps at 50 for agile endpoints). Responses include `nextPage` — pass it back as `--start-at` to fetch the next page. When `nextPage` is `null`, there are no more results.
112
+ Search and list commands accept `--limit` to control page size (Jira DC caps at 50 for agile endpoints). Responses include `nextPage` — pass it back as `--start` to fetch the next page. When `nextPage` is `null`, there are no more results.
97
113
 
98
114
  ## Examples
99
115
 
@@ -113,9 +129,26 @@ jiradc issue create --project AI --type Task --summary "Implement feature X" --d
113
129
  # Create with custom fields
114
130
  jiradc issue create --project AI --type Story --summary "User login" --custom-fields '{"customfield_10100": "value"}'
115
131
 
116
- # Transition an issue (find transition ID first)
132
+ # Transition by ID or by status name
117
133
  jiradc issue transitions AI-123
118
- jiradc issue transition AI-123 31
134
+ jiradc issue transition AI-123 --to 31
135
+ jiradc issue transition AI-123 --to "In Review" --comment "Ready for review"
136
+
137
+ # Assign
138
+ jiradc issue assign AI-123 me
139
+ jiradc issue assign AI-123 jsmith
140
+ jiradc issue assign AI-123 none
141
+
142
+ # Update with shortcuts (instead of --fields JSON)
143
+ jiradc issue update AI-123 --summary "New title" --priority High
144
+ jiradc issue update AI-123 --assignee me
145
+ jiradc issue update AI-123 --labels backend,urgent # set mode
146
+ jiradc issue update AI-123 --labels +urgent,-backend # mutate mode
147
+ jiradc issue update AI-123 --components +Frontend
148
+ jiradc issue update AI-123 --fix-versions 1.0,2.0
149
+
150
+ # Link multiple issues to an epic in one call
151
+ jiradc issue link-epic AI-456 AI-457 AI-458 --epic AI-100
119
152
 
120
153
  # Add a comment
121
154
  jiradc issue comment AI-123 --body "Fixed in commit abc123"
@@ -140,4 +173,7 @@ jiradc issue clone AI-123
140
173
 
141
174
  # Get dev status (linked branches, PRs)
142
175
  jiradc issue dev-status AI-123
176
+
177
+ # List components for a project
178
+ jiradc component list --project AI
143
179
  ```
package/dist/index.js CHANGED
@@ -432,17 +432,60 @@ function transformIssueFields(fields) {
432
432
  };
433
433
  }
434
434
 
435
+ // src/utils/transformers/transition.ts
436
+ function slimAllowedValue(raw) {
437
+ if (!raw || typeof raw !== "object") return {};
438
+ const av = raw;
439
+ const slim = {};
440
+ if (typeof av.id === "string") slim.id = av.id;
441
+ if (typeof av.name === "string") slim.name = av.name;
442
+ if (typeof av.value === "string") slim.value = av.value;
443
+ return slim;
444
+ }
445
+ function slimField(raw) {
446
+ if (!raw || typeof raw !== "object") return {};
447
+ const field = raw;
448
+ const out = {};
449
+ if (typeof field.required === "boolean") out.required = field.required;
450
+ if (typeof field.name === "string") out.name = field.name;
451
+ if (Array.isArray(field.allowedValues)) {
452
+ out.allowedValues = field.allowedValues.map(slimAllowedValue);
453
+ }
454
+ return out;
455
+ }
456
+ function slimFields(fields) {
457
+ const out = {};
458
+ for (const [key, raw] of Object.entries(fields)) {
459
+ out[key] = slimField(raw);
460
+ }
461
+ return out;
462
+ }
463
+ function transformTransition(t) {
464
+ const out = {
465
+ id: t.id,
466
+ name: t.name,
467
+ to: t.to.name
468
+ };
469
+ if (t.fields && Object.keys(t.fields).length > 0) {
470
+ out.fields = slimFields(t.fields);
471
+ }
472
+ return out;
473
+ }
474
+ function transformTransitions(response) {
475
+ return response.transitions.map(transformTransition);
476
+ }
477
+
435
478
  // src/commands/board/issues.ts
436
479
  function issues(parent) {
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(
480
+ parent.command("issues").description("Get issues for a board").addArgument(new Argument("<id>", "Board ID").argParser(positiveInt)).option("--limit <number>", "Max results (1-50, Jira DC caps at 50)", intInRange(1, 50), 25).option("--start <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(
438
481
  "after",
439
- '\nExamples:\n jiradc board issues 42\n jiradc board issues 42 --max 10\n jiradc board issues 42 --jql "status = Open" --fields summary,status\n jiradc board issues 42 --start-at 50 --max 25'
482
+ '\nExamples:\n jiradc board issues 42\n jiradc board issues 42 --limit 10\n jiradc board issues 42 --jql "status = Open" --fields summary,status\n jiradc board issues 42 --start 50 --limit 25'
440
483
  ).action(async (id, opts) => {
441
484
  const client = getClient();
442
485
  const result = await client.agile.getBoardIssues({
443
486
  boardId: id,
444
- startAt: opts.startAt,
445
- maxResults: opts.max,
487
+ startAt: opts.start,
488
+ maxResults: opts.limit,
446
489
  fields: opts.fields?.split(",").map((f) => f.trim()),
447
490
  jql: opts.jql
448
491
  });
@@ -454,13 +497,13 @@ function issues(parent) {
454
497
  import { Option } from "commander";
455
498
  var BOARD_TYPES = ["scrum", "kanban", "simple"];
456
499
  function list(parent) {
457
- parent.command("list").description("List agile boards").option("--max <number>", "Max results (1-1000)", intInRange(1, 1e3), 25).option("--project <key>", "Filter boards by project key or ID").addOption(new Option("--type <type>", "Board type filter").choices(BOARD_TYPES)).option("--name <name>", "Filter boards by name").addHelpText(
500
+ parent.command("list").description("List agile boards").option("--limit <number>", "Max results (1-1000)", intInRange(1, 1e3), 25).option("--project <key>", "Filter boards by project key or ID").addOption(new Option("--type <type>", "Board type filter").choices(BOARD_TYPES)).option("--name <name>", "Filter boards by name").addHelpText(
458
501
  "after",
459
- '\nExamples:\n jiradc board list\n jiradc board list --max 10\n jiradc board list --project PROJ\n jiradc board list --type scrum --name "Team Board"'
502
+ '\nExamples:\n jiradc board list\n jiradc board list --limit 10\n jiradc board list --project PROJ\n jiradc board list --type scrum --name "Team Board"'
460
503
  ).action(async (opts) => {
461
504
  const client = getClient();
462
505
  const result = await client.agile.getBoards({
463
- maxResults: opts.max,
506
+ maxResults: opts.limit,
464
507
  projectKeyOrId: opts.project,
465
508
  type: opts.type,
466
509
  name: opts.name
@@ -477,7 +520,7 @@ function registerBoardCommands(program2) {
477
520
  Examples:
478
521
  $ jiradc board list
479
522
  $ jiradc board list --type scrum --project PROJ
480
- $ jiradc board issues 42 --max 20
523
+ $ jiradc board issues 42 --limit 20
481
524
  `
482
525
  );
483
526
  list(board);
@@ -550,9 +593,9 @@ function issueCount(parent) {
550
593
 
551
594
  // src/commands/component/list.ts
552
595
  function list2(parent) {
553
- parent.command("list <projectKey>").description("List all components for a project").addHelpText("after", "\nExamples:\n jiradc component list AI").action(async (projectKey) => {
596
+ parent.command("list").description("List all components for a project").requiredOption("--project <key>", "Project key (e.g., AI)").addHelpText("after", "\nExamples:\n jiradc component list --project AI").action(async (opts) => {
554
597
  const client = getClient();
555
- const result = await client.components.list({ projectKeyOrId: projectKey });
598
+ const result = await client.components.list({ projectKeyOrId: opts.project });
556
599
  output(result.map(transformComponent));
557
600
  });
558
601
  }
@@ -597,7 +640,7 @@ function registerComponentCommands(program2) {
597
640
  "after",
598
641
  `
599
642
  Examples:
600
- $ jiradc component list AI
643
+ $ jiradc component list --project AI
601
644
  $ jiradc component get 11289
602
645
  $ jiradc component create --project AI --name Backend
603
646
  $ jiradc component update 11289 --name Backend
@@ -615,15 +658,15 @@ Examples:
615
658
 
616
659
  // src/commands/field/options.ts
617
660
  function options(parent) {
618
- 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(
661
+ parent.command("options <id>").description("Get available options for a custom field").option("--query <text>", "Filter options by text").option("--limit <number>", "Max results to return (1-1000)", intInRange(1, 1e3), 25).option("--page <number>", "Page number (1-indexed)", positiveInt).addHelpText(
619
662
  "after",
620
- '\nExamples:\n jiradc field options 10001\n jiradc field options 10001 --query "High"\n jiradc field options 10001 --max 20 --page 2'
663
+ '\nExamples:\n jiradc field options 10001\n jiradc field options 10001 --query "High"\n jiradc field options 10001 --limit 20 --page 2'
621
664
  ).action(async (id, opts) => {
622
665
  const client = getClient();
623
666
  const result = await client.fields.getFieldOptions({
624
667
  fieldId: id,
625
668
  query: opts.query,
626
- maxResults: opts.max,
669
+ maxResults: opts.limit,
627
670
  page: opts.page
628
671
  });
629
672
  output(transformPaged({ ...result, startAt: result.startAt ?? 0 }, transformCustomFieldOption));
@@ -657,6 +700,42 @@ Examples:
657
700
  options(field);
658
701
  }
659
702
 
703
+ // src/utils/resolve-user.ts
704
+ var cachedMe;
705
+ async function resolveUserToken(token) {
706
+ if (token === "none") return null;
707
+ if (token === "me") {
708
+ if (cachedMe !== void 0) return cachedMe;
709
+ const me2 = await getClient().users.getMyself();
710
+ if (!me2.name) {
711
+ throw new Error('Could not resolve "me": authenticated user has no name field');
712
+ }
713
+ cachedMe = me2.name;
714
+ return cachedMe;
715
+ }
716
+ return token;
717
+ }
718
+
719
+ // src/commands/issue/assign.ts
720
+ function assign(parent) {
721
+ parent.command("assign <key> <user>").description('Assign an issue. <user> is a username, "me", or "none" to unassign.').addHelpText(
722
+ "after",
723
+ `
724
+ Examples:
725
+ jiradc issue assign PROJ-123 jsmith
726
+ jiradc issue assign PROJ-123 me
727
+ jiradc issue assign PROJ-123 none`
728
+ ).action(async (key, user) => {
729
+ const resolved = await resolveUserToken(user);
730
+ const client = getClient();
731
+ await client.issues.update({
732
+ issueKeyOrId: key,
733
+ fields: { assignee: resolved === null ? null : { name: resolved } }
734
+ });
735
+ output({ assigned: true, issue: transformIssueRef(key), assignee: resolved });
736
+ });
737
+ }
738
+
660
739
  // src/commands/issue/attachment/delete.ts
661
740
  function deleteAttachment(parent) {
662
741
  parent.command("delete").description("Delete an attachment by ID").requiredOption("--id <attachmentId>", "Attachment ID to delete").addHelpText("after", "\nExamples:\n jiradc issue attachment delete --id 12345").action(async (opts) => {
@@ -842,16 +921,16 @@ function attachments(parent) {
842
921
 
843
922
  // src/commands/issue/batch-changelog.ts
844
923
  function batchChangelog(parent) {
845
- parent.command("batch-changelog <keys>").description("Get changelogs for multiple issues at once").option("--max <number>", "Max changelog entries per issue (1-50, Jira DC caps at 50)", intInRange(1, 50), 25).addHelpText(
924
+ parent.command("batch-changelog <keys>").description("Get changelogs for multiple issues at once").option("--limit <number>", "Max changelog entries per issue (1-50, Jira DC caps at 50)", intInRange(1, 50), 25).addHelpText(
846
925
  "after",
847
- "\nExamples:\n jiradc issue batch-changelog PROJ-1,PROJ-2,PROJ-3\n jiradc issue batch-changelog PROJ-123,PROJ-124 --max 10"
926
+ "\nExamples:\n jiradc issue batch-changelog PROJ-1,PROJ-2,PROJ-3\n jiradc issue batch-changelog PROJ-123,PROJ-124 --limit 10"
848
927
  ).action(async (keys, opts) => {
849
928
  const client = getClient();
850
929
  const keyList = keys.split(",").map((k) => k.trim());
851
930
  const entries = await Promise.all(
852
931
  keyList.map(async (key) => {
853
932
  try {
854
- const data = await client.issues.getChangelog({ issueKeyOrId: key, maxResults: opts.max });
933
+ const data = await client.issues.getChangelog({ issueKeyOrId: key, maxResults: opts.limit });
855
934
  return [key, data];
856
935
  } catch (error) {
857
936
  return [key, { error: error instanceof Error ? error.message : "Unknown error" }];
@@ -887,9 +966,12 @@ Examples:
887
966
 
888
967
  // src/commands/issue/changelog.ts
889
968
  function changelog(parent) {
890
- parent.command("changelog <key>").description("Get changelog for an issue").option("--max <number>", "Max changelog entries (1-50, Jira DC caps at 50)", intInRange(1, 50), 25).addHelpText("after", "\nExamples:\n jiradc issue changelog PROJ-123\n jiradc issue changelog PROJ-123 --max 10").action(async (key, opts) => {
969
+ parent.command("changelog <key>").description("Get changelog for an issue").option("--limit <number>", "Max changelog entries (1-50, Jira DC caps at 50)", intInRange(1, 50), 25).addHelpText(
970
+ "after",
971
+ "\nExamples:\n jiradc issue changelog PROJ-123\n jiradc issue changelog PROJ-123 --limit 10"
972
+ ).action(async (key, opts) => {
891
973
  const client = getClient();
892
- const result = await client.issues.getChangelog({ issueKeyOrId: key, maxResults: opts.max });
974
+ const result = await client.issues.getChangelog({ issueKeyOrId: key, maxResults: opts.limit });
893
975
  output(result);
894
976
  });
895
977
  }
@@ -1133,15 +1215,15 @@ function devStatus(parent) {
1133
1215
 
1134
1216
  // src/commands/issue/get-worklog.ts
1135
1217
  function getWorklog(parent) {
1136
- parent.command("get-worklog <key>").description("Get worklogs for an issue").option("--start-at <number>", "Starting index for pagination", nonNegativeInt).option("--max <number>", "Max results per page (1-1000)", intInRange(1, 1e3), 25).addHelpText(
1218
+ parent.command("get-worklog <key>").description("Get worklogs for an issue").option("--start <number>", "Starting index for pagination", nonNegativeInt).option("--limit <number>", "Max results per page (1-1000)", intInRange(1, 1e3), 25).addHelpText(
1137
1219
  "after",
1138
- "\nExamples:\n jiradc issue get-worklog PROJ-123\n jiradc issue get-worklog PROJ-123 --max 10\n jiradc issue get-worklog PROJ-123 --start-at 10 --max 5"
1220
+ "\nExamples:\n jiradc issue get-worklog PROJ-123\n jiradc issue get-worklog PROJ-123 --limit 10\n jiradc issue get-worklog PROJ-123 --start 10 --limit 5"
1139
1221
  ).action(async (key, opts) => {
1140
1222
  const client = getClient();
1141
1223
  const result = await client.issues.getWorklogs({
1142
1224
  issueKeyOrId: key,
1143
- startAt: opts.startAt,
1144
- maxResults: opts.max
1225
+ startAt: opts.start,
1226
+ maxResults: opts.limit
1145
1227
  });
1146
1228
  output(transformPaged(result, transformWorklog));
1147
1229
  });
@@ -1182,17 +1264,37 @@ function get2(parent) {
1182
1264
 
1183
1265
  // src/commands/issue/link-epic.ts
1184
1266
  function linkEpic(parent) {
1185
- parent.command("link-epic <key>").description("Link an issue to an epic").requiredOption("--epic <epicKey>", "Epic issue key").addHelpText("after", "\nExamples:\n jiradc issue link-epic PROJ-456 --epic PROJ-123").action(async (key, opts) => {
1267
+ parent.command("link-epic <keys...>").description("Link one or more issues to an epic").requiredOption("--epic <epicKey>", "Epic issue key").addHelpText(
1268
+ "after",
1269
+ `
1270
+ Examples:
1271
+ jiradc issue link-epic PROJ-456 --epic PROJ-123
1272
+ jiradc issue link-epic PROJ-456 PROJ-457 PROJ-458 --epic PROJ-123`
1273
+ ).action(async (keys, opts) => {
1186
1274
  const client = getClient();
1187
- await client.issues.update({
1188
- issueKeyOrId: key,
1189
- fields: { customfield_10100: opts.epic }
1275
+ const results = await Promise.allSettled(
1276
+ keys.map(
1277
+ (key) => client.issues.update({ issueKeyOrId: key, fields: { customfield_10100: opts.epic } }).then(() => key)
1278
+ )
1279
+ );
1280
+ const linked = [];
1281
+ const failed = [];
1282
+ results.forEach((r, i) => {
1283
+ if (r.status === "fulfilled") {
1284
+ linked.push({ key: r.value });
1285
+ } else {
1286
+ const message = r.reason instanceof Error ? r.reason.message : String(r.reason);
1287
+ failed.push({ key: keys[i], error: message });
1288
+ }
1190
1289
  });
1191
1290
  output({
1192
- linked: true,
1193
- issue: transformIssueRef(key),
1194
- epic: transformIssueRef(opts.epic)
1291
+ epic: transformIssueRef(opts.epic),
1292
+ linked,
1293
+ ...failed.length > 0 && { failed }
1195
1294
  });
1295
+ if (failed.length > 0) {
1296
+ process.exitCode = 1;
1297
+ }
1196
1298
  });
1197
1299
  }
1198
1300
 
@@ -1229,16 +1331,16 @@ function link(parent) {
1229
1331
 
1230
1332
  // src/commands/issue/search.ts
1231
1333
  function search2(parent) {
1232
- parent.command("search <jql>").description("Search issues using JQL").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 fields to return (defaults to essential fields)").option("--all-fields", "Return all fields instead of defaults").addHelpText(
1334
+ parent.command("search <jql>").description("Search issues using JQL").option("--limit <number>", "Max results (1-50, Jira DC caps at 50)", intInRange(1, 50), 25).option("--start <number>", "Starting index for pagination", nonNegativeInt).option("--fields <fields>", "Comma-separated fields to return (defaults to essential fields)").option("--all-fields", "Return all fields instead of defaults").addHelpText(
1233
1335
  "after",
1234
- '\nExamples:\n jiradc issue search "project = PROJ AND status = Open"\n jiradc issue search "assignee = currentUser()" --max 10 --fields summary,status\n jiradc issue search "project = PROJ" --start-at 50 --max 50'
1336
+ '\nExamples:\n jiradc issue search "project = PROJ AND status = Open"\n jiradc issue search "assignee = currentUser()" --limit 10 --fields summary,status\n jiradc issue search "project = PROJ" --start 50 --limit 50'
1235
1337
  ).action(async (jql, opts) => {
1236
1338
  const client = getClient();
1237
1339
  const fields = opts.allFields ? void 0 : opts.fields?.split(",").map((f) => f.trim()) ?? DEFAULT_FIELDS;
1238
1340
  const result = await client.issues.search({
1239
1341
  jql,
1240
- startAt: opts.startAt,
1241
- maxResults: opts.max,
1342
+ startAt: opts.start,
1343
+ maxResults: opts.limit,
1242
1344
  fields
1243
1345
  });
1244
1346
  output(transformPaged(result, transformIssue));
@@ -1247,12 +1349,37 @@ function search2(parent) {
1247
1349
 
1248
1350
  // src/commands/issue/transition.ts
1249
1351
  function transition(parent) {
1250
- parent.command("transition <key>").description("Transition issue to a new status").requiredOption("--to <id>", 'Transition ID (get from "jiradc issue transitions")').option("--comment <text>", "Comment to add during transition").addHelpText(
1352
+ parent.command("transition <key>").description("Transition issue to a new status").requiredOption("--to <idOrName>", "Transition ID, or status name (case-insensitive)").option("--comment <text>", "Comment to add during transition").addHelpText(
1251
1353
  "after",
1252
- '\nExamples:\n jiradc issue transition PROJ-123 --to 31\n jiradc issue transition PROJ-123 --to 31 --comment "Moving to review"'
1354
+ `
1355
+ Examples:
1356
+ jiradc issue transition PROJ-123 --to 31
1357
+ jiradc issue transition PROJ-123 --to "In Review"
1358
+ jiradc issue transition PROJ-123 --to Done --comment "Verified in staging"`
1253
1359
  ).action(async (key, opts) => {
1254
1360
  const client = getClient();
1255
- await client.issues.transition({ issueKeyOrId: key, transitionId: opts.to, comment: opts.comment });
1361
+ let transitionId;
1362
+ if (/^\d+$/.test(opts.to)) {
1363
+ transitionId = opts.to;
1364
+ } else {
1365
+ const raw = await client.issues.getTransitions({
1366
+ issueKeyOrId: key,
1367
+ expand: "transitions.fields"
1368
+ });
1369
+ const transitions2 = transformTransitions(raw);
1370
+ const target = opts.to.toLowerCase();
1371
+ const matches = transitions2.filter((t) => t.name.toLowerCase() === target);
1372
+ if (matches.length === 0) {
1373
+ const names = transitions2.map((t) => `"${t.name}"`).join(", ");
1374
+ throw new Error(`Transition "${opts.to}" not available from current status. Available: ${names || "(none)"}`);
1375
+ }
1376
+ if (matches.length > 1) {
1377
+ const ids = matches.map((t) => t.id).join(", ");
1378
+ throw new Error(`Multiple transitions named "${opts.to}". Use --to <id> with one of: ${ids}`);
1379
+ }
1380
+ transitionId = matches[0].id;
1381
+ }
1382
+ await client.issues.transition({ issueKeyOrId: key, transitionId, comment: opts.comment });
1256
1383
  output({ transitioned: true, issue: transformIssueRef(key) });
1257
1384
  });
1258
1385
  }
@@ -1261,8 +1388,11 @@ function transition(parent) {
1261
1388
  function transitions(parent) {
1262
1389
  parent.command("transitions <key>").description("Get available transitions for an issue").addHelpText("after", "\nExamples:\n jiradc issue transitions PROJ-123").action(async (key) => {
1263
1390
  const client = getClient();
1264
- const result = await client.issues.getTransitions({ issueKeyOrId: key });
1265
- output(result);
1391
+ const result = await client.issues.getTransitions({
1392
+ issueKeyOrId: key,
1393
+ expand: "transitions.fields"
1394
+ });
1395
+ output(transformTransitions(result));
1266
1396
  });
1267
1397
  }
1268
1398
 
@@ -1275,24 +1405,103 @@ function unlink2(parent) {
1275
1405
  });
1276
1406
  }
1277
1407
 
1408
+ // src/utils/multi-value.ts
1409
+ import { InvalidArgumentError as InvalidArgumentError2 } from "commander";
1410
+ function parseMultiValue(flagName, raw) {
1411
+ const items = raw.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
1412
+ if (items.length === 0) {
1413
+ throw new InvalidArgumentError2(`${flagName} cannot be empty`);
1414
+ }
1415
+ const lonePrefix = items.find((s) => s === "+" || s === "-");
1416
+ if (lonePrefix !== void 0) {
1417
+ throw new InvalidArgumentError2(`${flagName} has an empty value after '${lonePrefix}' prefix`);
1418
+ }
1419
+ const prefixed = items.filter((s) => s.startsWith("+") || s.startsWith("-"));
1420
+ const bare = items.filter((s) => !s.startsWith("+") && !s.startsWith("-"));
1421
+ if (prefixed.length > 0 && bare.length > 0) {
1422
+ throw new InvalidArgumentError2(
1423
+ `${flagName} mixes set and mutate syntax. Either all values have +/- prefix, or none do.`
1424
+ );
1425
+ }
1426
+ if (bare.length > 0) {
1427
+ return { mode: "set", values: bare };
1428
+ }
1429
+ const adds = prefixed.filter((s) => s.startsWith("+")).map((s) => s.slice(1));
1430
+ const removes = prefixed.filter((s) => s.startsWith("-")).map((s) => s.slice(1));
1431
+ return { mode: "mutate", adds, removes };
1432
+ }
1433
+
1278
1434
  // src/commands/issue/update.ts
1435
+ function buildUpdateOps(parsed, wrap) {
1436
+ if (parsed.mode !== "mutate") return void 0;
1437
+ return [...parsed.adds.map((v) => ({ add: wrap(v) })), ...parsed.removes.map((v) => ({ remove: wrap(v) }))];
1438
+ }
1439
+ function buildSetValue(parsed, wrap) {
1440
+ if (parsed.mode !== "set") return void 0;
1441
+ return parsed.values.map(wrap);
1442
+ }
1279
1443
  function update2(parent) {
1280
- 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(
1444
+ parent.command("update <key>").description("Update issue fields").option("--fields <json>", "JSON string of fields to update (advanced; merges with shortcuts, wins on conflict)").option("--no-notify-users", "Suppress notification emails (default: notify)").option("--attachments <paths>", "Comma-separated local file paths to attach").option("--summary <text>", "Set the issue summary").option("--description <text>", "Set the issue description (wiki markup)").option("--priority <name>", "Set the priority by name (e.g. High)").option("--assignee <user>", 'Set the assignee. Username, "me", or "none" to unassign.').option("--labels <list>", 'Set labels ("a,b,c") or mutate ("+add,-remove")').option("--components <list>", 'Set components ("a,b") or mutate ("+add,-remove")').option("--fix-versions <list>", 'Set fix versions ("1.0,2.0") or mutate ("+1.0,-0.9")').addHelpText(
1281
1445
  "after",
1282
1446
  `
1283
1447
  Examples:
1284
- jiradc issue update PROJ-123 --fields '{"summary": "New title"}'
1285
- jiradc issue update PROJ-123 --fields '{"assignee": {"name": "jsmith"}, "priority": {"name": "High"}}'
1286
- jiradc issue update PROJ-123 --attachments /path/to/file.pdf,/path/to/image.png
1287
- jiradc issue update PROJ-123 --fields '{"summary": "With attachment"}' --attachments ./report.pdf`
1448
+ jiradc issue update PROJ-123 --summary "New title"
1449
+ jiradc issue update PROJ-123 --priority High --assignee me
1450
+ jiradc issue update PROJ-123 --labels backend,urgent
1451
+ jiradc issue update PROJ-123 --labels +urgent,-backend
1452
+ jiradc issue update PROJ-123 --components +Frontend
1453
+ jiradc issue update PROJ-123 --fields '{"customfield_10100": "EPIC-1"}' --priority High
1454
+ jiradc issue update PROJ-123 --attachments /path/to/file.pdf,/path/to/image.png`
1288
1455
  ).action(async (key, opts) => {
1289
- if (!opts.fields && !opts.attachments) {
1290
- throw new Error("Provide --fields and/or --attachments");
1456
+ const hasShortcut = opts.summary !== void 0 || opts.description !== void 0 || opts.priority !== void 0 || opts.assignee !== void 0 || opts.labels !== void 0 || opts.components !== void 0 || opts.fixVersions !== void 0;
1457
+ if (!opts.fields && !opts.attachments && !hasShortcut) {
1458
+ throw new Error(
1459
+ "Provide at least one of --fields, --attachments, or a shortcut flag (--summary, --priority, --labels, ...)"
1460
+ );
1461
+ }
1462
+ const fields = {};
1463
+ const updateOps = {};
1464
+ if (opts.summary !== void 0) fields.summary = opts.summary;
1465
+ if (opts.description !== void 0) fields.description = opts.description;
1466
+ if (opts.priority !== void 0) fields.priority = { name: opts.priority };
1467
+ if (opts.assignee !== void 0) {
1468
+ const resolved = await resolveUserToken(opts.assignee);
1469
+ fields.assignee = resolved === null ? null : { name: resolved };
1470
+ }
1471
+ if (opts.labels !== void 0) {
1472
+ const parsed = parseMultiValue("--labels", opts.labels);
1473
+ const setVal = buildSetValue(parsed, (v) => v);
1474
+ const ops = buildUpdateOps(parsed, (v) => v);
1475
+ if (setVal) fields.labels = setVal;
1476
+ if (ops) updateOps.labels = ops;
1477
+ }
1478
+ if (opts.components !== void 0) {
1479
+ const parsed = parseMultiValue("--components", opts.components);
1480
+ const setVal = buildSetValue(parsed, (v) => ({ name: v }));
1481
+ const ops = buildUpdateOps(parsed, (v) => ({ name: v }));
1482
+ if (setVal) fields.components = setVal;
1483
+ if (ops) updateOps.components = ops;
1484
+ }
1485
+ if (opts.fixVersions !== void 0) {
1486
+ const parsed = parseMultiValue("--fix-versions", opts.fixVersions);
1487
+ const setVal = buildSetValue(parsed, (v) => ({ name: v }));
1488
+ const ops = buildUpdateOps(parsed, (v) => ({ name: v }));
1489
+ if (setVal) fields.fixVersions = setVal;
1490
+ if (ops) updateOps.fixVersions = ops;
1291
1491
  }
1292
- const client = getClient();
1293
1492
  if (opts.fields) {
1294
- const parsed = JSON.parse(opts.fields);
1295
- await client.issues.update({ issueKeyOrId: key, fields: parsed, notifyUsers: opts.notifyUsers });
1493
+ const parsedFields = JSON.parse(opts.fields);
1494
+ Object.assign(fields, parsedFields);
1495
+ }
1496
+ const client = getClient();
1497
+ const didFieldUpdate = Object.keys(fields).length > 0 || Object.keys(updateOps).length > 0;
1498
+ if (didFieldUpdate) {
1499
+ await client.issues.update({
1500
+ issueKeyOrId: key,
1501
+ fields: Object.keys(fields).length > 0 ? fields : void 0,
1502
+ update: Object.keys(updateOps).length > 0 ? updateOps : void 0,
1503
+ notifyUsers: opts.notifyUsers
1504
+ });
1296
1505
  }
1297
1506
  const uploaded = [];
1298
1507
  if (opts.attachments) {
@@ -1305,9 +1514,9 @@ Examples:
1305
1514
  }
1306
1515
  }
1307
1516
  output({
1308
- updated: true,
1309
- issue: transformIssueRef(key),
1310
- ...uploaded.length > 0 && { attachments: uploaded }
1517
+ ...didFieldUpdate && { updated: true },
1518
+ ...uploaded.length > 0 && { attached: true, attachments: uploaded },
1519
+ issue: transformIssueRef(key)
1311
1520
  });
1312
1521
  });
1313
1522
  }
@@ -1336,7 +1545,7 @@ function registerIssueCommands(program2) {
1336
1545
  `
1337
1546
  Examples:
1338
1547
  $ jiradc issue get PROJ-123
1339
- $ jiradc issue search "project = PROJ AND status = Open" --max 10
1548
+ $ jiradc issue search "project = PROJ AND status = Open" --limit 10
1340
1549
  $ jiradc issue create --project PROJ --type Task --summary "Fix the bug" --priority High
1341
1550
  $ jiradc issue update PROJ-123 --fields '{"summary": "New title"}'
1342
1551
  $ jiradc issue transition PROJ-123 --to 11
@@ -1350,6 +1559,7 @@ Examples:
1350
1559
  deleteIssue(issue);
1351
1560
  transition(issue);
1352
1561
  transitions(issue);
1562
+ assign(issue);
1353
1563
  comment(issue);
1354
1564
  commentEdit(issue);
1355
1565
  worklog(issue);
@@ -1426,15 +1636,15 @@ function create3(parent) {
1426
1636
  // src/commands/sprint/issues.ts
1427
1637
  import { Argument as Argument2 } from "commander";
1428
1638
  function issues2(parent) {
1429
- parent.command("issues").description("Get issues in a sprint").addArgument(new Argument2("<id>", "Sprint 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 sprint").addHelpText(
1639
+ parent.command("issues").description("Get issues in a sprint").addArgument(new Argument2("<id>", "Sprint ID").argParser(positiveInt)).option("--limit <number>", "Max results (1-50, Jira DC caps at 50)", intInRange(1, 50), 25).option("--start <number>", "Starting index for pagination", nonNegativeInt).option("--fields <fields>", "Comma-separated field names to return").option("--jql <jql>", "Additional JQL filter within the sprint").addHelpText(
1430
1640
  "after",
1431
- '\nExamples:\n jiradc sprint issues 100\n jiradc sprint issues 100 --max 20\n jiradc sprint issues 100 --jql "status = Done" --fields summary,status\n jiradc sprint issues 100 --start-at 50 --max 25'
1641
+ '\nExamples:\n jiradc sprint issues 100\n jiradc sprint issues 100 --limit 20\n jiradc sprint issues 100 --jql "status = Done" --fields summary,status\n jiradc sprint issues 100 --start 50 --limit 25'
1432
1642
  ).action(async (id, opts) => {
1433
1643
  const client = getClient();
1434
1644
  const result = await client.agile.getSprintIssues({
1435
1645
  sprintId: id,
1436
- startAt: opts.startAt,
1437
- maxResults: opts.max,
1646
+ startAt: opts.start,
1647
+ maxResults: opts.limit,
1438
1648
  fields: opts.fields?.split(",").map((f) => f.trim()),
1439
1649
  jql: opts.jql
1440
1650
  });
@@ -1490,7 +1700,7 @@ function registerSprintCommands(program2) {
1490
1700
  Examples:
1491
1701
  $ jiradc sprint list --board 42
1492
1702
  $ jiradc sprint list --board 42 --state active
1493
- $ jiradc sprint issues 123 --max 20
1703
+ $ jiradc sprint issues 123 --limit 20
1494
1704
  $ jiradc sprint create --board 42 --name "Sprint 10" --start-date 2026-04-01 --end-date 2026-04-14
1495
1705
  `
1496
1706
  );
@@ -1625,15 +1835,15 @@ function me(parent) {
1625
1835
 
1626
1836
  // src/commands/user/search.ts
1627
1837
  function search3(parent) {
1628
- parent.command("search <query>").description("Search users by partial username, display name or email").option("--max <n>", "Maximum results (1-50)", intInRange(1, 50), 25).option("--start <n>", "Starting index (pagination offset)", nonNegativeInt, 0).option("--include-inactive", "Include inactive users in results", false).addHelpText(
1838
+ parent.command("search <query>").description("Search users by partial username, display name or email").option("--limit <n>", "Maximum results (1-50)", intInRange(1, 50), 25).option("--start <n>", "Starting index (pagination offset)", nonNegativeInt, 0).option("--include-inactive", "Include inactive users in results", false).addHelpText(
1629
1839
  "after",
1630
- '\nExamples:\n jiradc user search Drago\n jiradc user search "John Smith"\n jiradc user search dragomir@first.bet --max 5'
1840
+ '\nExamples:\n jiradc user search Drago\n jiradc user search "John Smith"\n jiradc user search dragomir@first.bet --limit 5'
1631
1841
  ).action(async (query, opts) => {
1632
1842
  const client = getClient();
1633
1843
  const result = await client.users.searchUsers({
1634
1844
  username: query,
1635
1845
  startAt: opts.start,
1636
- maxResults: opts.max,
1846
+ maxResults: opts.limit,
1637
1847
  includeActive: true,
1638
1848
  includeInactive: opts.includeInactive
1639
1849
  });
@@ -1688,7 +1898,7 @@ ${styleText("bold", "Environment:")}
1688
1898
 
1689
1899
  ${styleText("bold", "Examples:")}
1690
1900
  ${DIM}$${RESET} jiradc user me
1691
- ${DIM}$${RESET} jiradc issue search "project = PROJ AND status = Open" --max 10
1901
+ ${DIM}$${RESET} jiradc issue search "project = PROJ AND status = Open" --limit 10
1692
1902
  ${DIM}$${RESET} jiradc issue get PROJ-123 --fields summary,status
1693
1903
  ${DIM}$${RESET} jiradc issue create --project PROJ --type Task --summary "Fix the bug"
1694
1904
  ${DIM}$${RESET} jiradc issue transition PROJ-123 --to 11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jiradc-cli",
3
- "version": "1.0.17",
3
+ "version": "1.0.18-g1be46a3.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.35"
15
+ "jira-data-center-client": "1.0.35-g1be46a3.1"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/node": "24.10.4",
@@ -22,8 +22,8 @@
22
22
  "tsx": "^4.19.2",
23
23
  "typescript": "^5.7.2",
24
24
  "vitest": "^4.0.16",
25
- "config-typescript": "0.0.0",
26
- "config-eslint": "0.0.0"
25
+ "config-eslint": "0.0.0",
26
+ "config-typescript": "0.0.0"
27
27
  },
28
28
  "engines": {
29
29
  "node": ">=22.0.0"