@kud/jira-cli 0.13.0 โ†’ 0.13.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 +50 -221
  2. package/dist/index.js +56 -24
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -1,248 +1,77 @@
1
- # jira-cli
1
+ <div align="center">
2
2
 
3
- Jira on the command line. Reads issues, comments and **attachments** as plain text, so you can pipe them into anything.
3
+ ๐ŸŽซ
4
4
 
5
- Black and white output, `--json` on every read, stable exit codes. Every subcommand is plain and pipeable โ€” the interactive view lives behind the bare `jira` command and nowhere else.
5
+ # Jira CLI
6
6
 
7
- ## Install
8
-
9
- ```sh
10
- npm install -g @kud/jira-cli
11
- ```
12
-
13
- ## Setup
14
-
15
- Only the token is a secret, so only the token comes from the environment:
16
-
17
- ```sh
18
- export ATLASSIAN_API_TOKEN=... # id.atlassian.com/manage-profile/security/api-tokens
19
- jira init --base-url myorg.atlassian.net --email you@example.com
20
- ```
21
-
22
- That writes `~/.config/jira/config.json`. `ATLASSIAN_BASE_URL` and `ATLASSIAN_USER_EMAIL` override it when you need a second instance.
23
-
24
- ## Attachments
25
-
26
- The thing most Jira CLIs skip. Attachments are listed with the comment they came from, and text ones print straight to stdout:
27
-
28
- ```sh
29
- jira attachment list ABC-123
30
- # ID FILENAME SIZE TYPE FROM
31
- # 292542 error.log 22.0KB text/plain comment by Ada Lovelace
32
- # 292731 screen.png 118KB image/png description
33
-
34
- jira attachment read ABC-123 error.log | grep -i timeout
35
- jira attachment get ABC-123 screen.png --output ~/Desktop/
36
- jira attachment upload ABC-123 ./build.log ./screenshot.png
37
- ```
38
-
39
- Descriptions and comments render as Markdown, with embedded files named rather than left as opaque ids:
40
-
41
- ```sh
42
- jira issue view ABC-123 --comments
43
- ```
44
-
45
- ## The interactive view
46
-
47
- Run `jira` with no arguments:
48
-
49
- ```sh
50
- jira
51
- ```
52
-
53
- Your issues as a board. By default the tabs are Jira's three status _categories_ โ€” **To do**, **In progress**, **Done** โ€” so it works on any instance without knowing what your board calls its columns. Pass `--board <id>` (or set `defaultBoard` in the config file) and the tabs become that board's own columns, matched by status id; statuses no column claims land on an **Off board** tab. Hand-written `tabs` in the config file win over both. Rows hang under their epic, carry a type pill, a priority glyph (`โ–ฒ` high, `โ–ผ` low) and how long since they last moved. Closed work from the last fortnight is on the Done tab; `a` loads everything.
54
-
55
- `โ†‘โ†“` to move, `โ†โ†’` (or `โ‡ฅ`) to switch tab, `enter` to open, `?` for the legend, `r` to refresh. `q` quits from anywhere; `esc` or `โŒซ` goes back one level โ€” a prompt, then the issue, then nothing.
56
-
57
- `/` searches. Plain words narrow the list as you type and, on `enter`, run as `text ~ "โ€ฆ"` within your issues โ€” so a match in a comment counts too. Anything shaped like JQL (`status = Done`, `labels in (a, b)`, `ORDER BY โ€ฆ`) is sent as-is and replaces the scope; the tag at the end of the line says which reading it took, and `โ‡ฅ` flips it. A query Jira rejects shows Jira's own message under the box and keeps your text for editing. `esc` clears the search.
58
-
59
- Inside an issue, `โ‡ฅ` switches between description, comments and attachments โ€” descriptions and comments render as real Markdown, and attachments are listed with the comment or description each was embedded in. `t` moves it, `c` comments, `a` assigns to you, `o` opens the browser, `esc` or `โŒซ` goes back. Writes ask before they act.
60
-
61
- Ink is loaded only for this view, via a dynamic import, so `jira issue list | grep` never pays for it. Piped or redirected, bare `jira` prints help instead of opening a UI.
62
-
63
- ## Using it alongside the Atlassian MCP
64
-
65
- The Atlassian MCP returns an issue's fields and comments, but **not** the content of its attachments โ€” it can tell you a file is there and nothing more. When the answer to a ticket is inside a screenshot, a log or a CSV, that is the gap this fills:
66
-
67
- ```sh
68
- jira attachment list ABC-123 # what is there, and where it came from
69
- jira attachment read ABC-123 error.log # text, straight to stdout
70
- jira attachment get ABC-123 shot.png -o /tmp/shot.png # then open or read it
71
- ```
7
+ ![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?style=flat-square&logo=typescript&logoColor=white)
8
+ ![Node.js](https://img.shields.io/badge/Node.js-339933?style=flat-square&logo=node.js&logoColor=white)
9
+ ![npm](https://img.shields.io/npm/v/@kud/jira-cli?style=flat-square&color=CB3837)
10
+ ![MIT](https://img.shields.io/badge/licence-MIT-22C55E?style=flat-square)
72
11
 
73
- Useful for agents in particular: `get` writes a real file, so an image can then be read and reasoned about rather than skipped.
12
+ **Jira on the command line โ€” read issues, comments and attachments as plain text**
74
13
 
75
- ## Issues
14
+ <a href="https://kud.io/projects/jira-cli">Website</a> ยท <a href="https://kud.io/projects/jira-cli/docs">Documentation</a>
76
15
 
77
- ```sh
78
- jira issue list # yours, most recently updated first
79
- jira issue list --status 'In Progress'
80
- jira issue list --project ABC --sprint current
81
- jira issue view ABC-123
82
- jira issue view ABC-123 --fields status,assignee,issuelinks
83
- jira issue transition ABC-123 # list what's available
84
- jira issue transition ABC-123 'In Review' # by transition name or target status
85
- jira issue open ABC-123
86
- ```
87
-
88
- Writing:
89
-
90
- ```sh
91
- jira issue create -p ABC -t Task -s 'Fix the thing' -b 'Longer **markdown** body' --status 'In Progress'
92
- jira issue create -p ABC -t Task -s 'A sub-task' --parent ABC-100 --link Relates:ABC-99
93
- jira issue edit ABC-123 --summary 'Better title' --assignee me --parent ABC-100
94
- jira issue edit ABC-123 --prepend-description '**Update:** finished QA'
95
- jira issue assign ABC-123 me # or a name, an email, an account id, or 'none'
96
- jira issue comment add ABC-123 - # body from stdin
97
- jira issue comment list ABC-123
98
- jira issue comment list ABC-123 --last 5 # the 5 most recent, oldest first
99
- jira issue comment edit ABC-123 12345 'Actually fixed in 2.1'
100
- jira issue delete ABC-123 # asks first; --yes to confirm in scripts
101
- jira issue rank ABC-1 ABC-2 --before ABC-3
102
- jira issue rank ABC-1 ABC-2 --top --jql 'project = ABC AND sprint = 42'
103
- jira issue link ABC-1 Blocks ABC-2
104
- jira issue link list ABC-1
105
- jira issue watch add ABC-123
106
- jira issue worklog add ABC-123 '2h 30m'
107
- jira issue worklog edit ABC-123 456 --time '3h'
108
- jira issue worklog delete ABC-123 456
109
- jira issue remotelink list ABC-123
110
- jira issue remotelink add ABC-123 https://example.atlassian.net/wiki/spaces/ABC/pages/1234
111
- jira issue remotelink remove ABC-123 789
112
- jira issue history ABC-123
113
- ```
114
-
115
- `jira issue view` lists the issue's links and subtasks, in plain text and in `--json`. Pass `--fields status,assignee,parent,issuelinks` (comma-separated) to see only those fields โ€” both in plain text and `--json`; the key and summary stay either way, and without `--fields` the view is exactly what it has always been.
116
-
117
- People are resolved for you. `issue assign`, and `--assignee` on `create` and `edit`, accept a name or an email: assignable users of the project are searched first, then every user. `me` means you, `none` unassigns, and a raw account id passes straight through. If a name matches several people nothing is assigned โ€” every match is printed on stderr and the command exits non-zero, because a guess is worse than an error.
118
-
119
- Parents and links belong to the same commands. `--parent ABC-100` sets a parent on `create` or `edit`, and `edit --parent none` clears it. `--link Relates:ABC-99` (repeatable, `<type>:<KEY>`) links the new issue right after creating it, exactly as `jira issue link <new> <type> <KEY>` would. The link type is checked against your instance's link type names before anything is created, so a typo costs nothing; if creation succeeds but a link fails, the new key and the failure are reported and the exit is non-zero.
16
+ </div>
120
17
 
121
- `create --status 'In Progress'` moves the new issue to that status right after creation and any links. If the fresh issue already sits in that status nothing is sent, and if the move fails the key and the reason are reported with a non-zero exit, as with links.
122
-
123
- `edit --prepend-description` and `--append-description` splice markdown onto the start or end of an existing description without touching it: the current ADF nodes are preserved and the converted markdown is added around them. Both may be combined; with `--body` neither is allowed. Like `-b`, a value of `-` reads stdin.
124
-
125
- `issue transition` takes either a transition name or the status it leads to (`Start Progress` or `In Progress`), matched case-insensitively and by transition id. With no argument it lists the transitions as `name โ†’ target status`.
126
-
127
- `issue rank --top --jql <jql>` ranks the keys above the first issue of the JQL scope. The JQL must order by rank (`ORDER BY Rank ASC` is appended when missing, and a JQL ordered any other way is refused, since its first result would not be the top). When the keys already occupy the top in rank order nothing is sent.
128
-
129
- Bodies accept Markdown โ€” paragraphs, headings, lists, fenced code, links and code spans are converted to ADF.
130
-
131
- Deletes (`issue delete`, `comment delete`, `worklog delete`, `remotelink remove`) ask before they act; piped or scripted runs refuse unless `--yes` is passed, since there is no undo on Jira's side. `remotelink add` is idempotent: re-adding the same url updates the same link rather than creating duplicates.
132
-
133
- ## Projects, boards and sprints
134
-
135
- ```sh
136
- jira project list
137
- jira project versions ABC
138
- jira project components ABC
139
- jira project statuses ABC
140
-
141
- jira board list
142
- jira board list --project ABC
143
- jira board view 42 # columns, their statuses, and the board's filter
144
- jira board view 42 --json
145
- jira board issues 42
146
- jira board backlog 42
147
- jira board epics 42
148
- jira epic ABC-100
149
-
150
- jira sprint list 42 --state active
151
- jira sprint issues 1234
152
- jira sprint add 1234 ABC-1 ABC-2
153
- jira backlog add ABC-1 ABC-2
154
- ```
18
+ ## Features
155
19
 
156
- ## Knowing what this instance supports
20
+ - **Attachments as text** โ€” list what is attached, with the comment it came from, and print text files straight to stdout or download the rest
21
+ - **Plain and pipeable** โ€” black and white output, `--json` on every read, stable exit codes
22
+ - **Full issue workflow** โ€” create, edit, transition (with a resolution), comment, link, watch, rank and log work
23
+ - **Projects, boards and sprints** โ€” browse projects, boards, sprints, epics and the backlog
24
+ - **Automation rules** โ€” list, export, import and switch Jira Automation rules, with secrets redacted on request
25
+ - **Interactive board** โ€” bare `jira` opens your issues as tabs, with search and in-place writes; Ink loads only for this view
157
26
 
158
- ```sh
159
- jira whoami
160
- jira meta issuetypes # also: priorities, statuses, resolutions, linktypes
161
- jira meta labels
162
- jira meta filters
163
- jira meta permissions ABC
164
- jira meta server
165
- jira count 'project = ABC AND status = Done'
166
- ```
167
-
168
- ## Scripting
169
-
170
- Every read command takes `--json`:
27
+ ## Install
171
28
 
172
29
  ```sh
173
- jira issue list --mine --json | jq -r '.[].key'
174
- jira search 'project = ABC AND created >= -7d' --json
30
+ npm install -g @kud/jira-cli
175
31
  ```
176
32
 
177
- Exit codes:
178
-
179
- | Code | Means |
180
- | ---- | --------------------------------------- |
181
- | `0` | success |
182
- | `1` | Jira rejected the request, or bad usage |
183
- | `2` | the environment is not set up |
184
- | `3` | `--json` result may be truncated |
185
- | `4` | not authenticated |
186
-
187
- `issue list` and `search` stop at `--limit` (50 by default), and Jira no longer
188
- reports a total, so a full page is the only evidence that rows were left behind.
189
- When one comes back, both commands warn on stderr, and with `--json` they also
190
- exit `3`. Stdout is untouched, so `--json` parses exactly as before and a caller
191
- that ignores the exit code sees no change. The table output keeps exiting `0`,
192
- so `jira issue list && โ€ฆ` still works at a terminal.
193
- Raise `--limit` to be sure you have it all.
194
-
195
- Colour is disabled automatically when stdout is not a TTY, and when `NO_COLOR` is set.
33
+ ## Usage
196
34
 
197
- ## Custom fields
198
-
199
- Jira instances differ. Find yours, then name the ones you care about:
35
+ Only the API token is a secret, so only the token comes from the environment:
200
36
 
201
37
  ```sh
202
- jira fields points
203
- # ID NAME TYPE
204
- # customfield_10784 Offshore Story Points string
205
- # customfield_10002 Story Points number
206
- ```
207
-
208
- ```json
209
- {
210
- "baseUrl": "myorg.atlassian.net",
211
- "email": "you@example.com",
212
- "customFields": [{ "id": "customfield_10002", "label": "points" }],
213
- "sprintField": "customfield_10020",
214
- "defaultProject": "ABC"
215
- }
38
+ export ATLASSIAN_API_TOKEN=...
39
+ jira init --base-url jira.example.com --email you@example.com
216
40
  ```
217
41
 
218
- Named fields are requested on every search and shown in `issue view`.
219
-
220
- ## Automation rules
221
-
222
- ```sh
223
- jira automation list --project SHOP # --state ENABLED|DISABLED, --limit, --json
224
- jira automation get 0192e5ac-0e25-71de-ba7b-d972e6a2049a > rule.json
225
- jira automation update 0192e5ac-0e25-71de-ba7b-d972e6a2049a --file rule.json
226
- jira automation create --file rule.json # prints the new rule's UUID; - reads stdin
227
- jira automation disable 0192e5ac-0e25-71de-ba7b-d972e6a2049a
228
- jira automation enable 0192e5ac-0e25-71de-ba7b-d972e6a2049a
42
+ ```console
43
+ $ jira attachment list ACME-1234
44
+ ID FILENAME SIZE TYPE FROM
45
+ 292542 error.log 22.0KB text/plain comment by Ada Lovelace
46
+ 292731 screen.png 118KB image/png description
47
+
48
+ $ jira attachment read ACME-1234 error.log | grep -i timeout
49
+ $ jira issue view ACME-1234 --fields status,assignee,issuelinks
50
+ $ jira issue transition ACME-1234 Done --resolution Fixed
51
+ $ jira issue open ACME-1234 --print
52
+ $ jira issue watch list ACME-1234
53
+ $ jira issue worklog edit ACME-1234 456 --time 3h --started 2026-10-27T09:00:00.000+0000
54
+ $ jira issue comment delete ACME-1234 12345
55
+ $ jira user search ada --project ACME
56
+ $ jira project view ACME
57
+ $ jira sprint view 1234
58
+ $ jira search 'project = ACME AND created >= -7d' --json | jq -r '.[].key'
59
+ $ jira automation get 0192e5ac-0e25-71de-ba7b-d972e6a2049a --redact
229
60
  ```
230
61
 
231
- These use Atlassian's [Automation REST API](https://developer.atlassian.com/cloud/automation/rest/api-group-rule-management/) with the same classic API token as everything else; nothing new to configure. The account behind it needs the **Jira administrator** global permission (Administer Jira): Jira answers a project admin with a bare 403, even for rules scoped to that project, and the CLI says so and exits 4. Project admins can still manage their project's rules in the Jira web UI.
62
+ Run `jira` with no arguments in a terminal for the interactive board. Inside an issue, description, comments and attachments sit in one scrolling view. Two flags help when exploring it: `--screen detail:ACME-1234` opens an issue directly (`--screen list` prints the available screens), and `--mock` runs against built-in sample data with no Jira needed.
232
63
 
233
- `create` and `update` take the shape `get` prints, `{ "rule": { โ€ฆ } }`, or a bare rule. The cloud ID is read from the site's `/_edge/tenant_info`; set `ATLASSIAN_CLOUD_ID` to skip that call. Requests go through the site's gateway by default; `--host api` (or `ATLASSIAN_AUTOMATION_HOST=api`) sends them to `api.atlassian.com` instead.
64
+ Exit codes: `0` success, `1` Jira rejected the request or bad usage, `2` environment not set up, `3` `--json` result may be truncated, `4` not authenticated.
234
65
 
235
- ## Escape hatch
66
+ Anything not covered has an escape hatch: `jira api /rest/api/3/myself`.
236
67
 
237
- Anything not covered:
68
+ ## Development
238
69
 
239
70
  ```sh
240
- jira api /rest/api/3/myself
241
- jira api /rest/api/3/issue/ABC-123/watchers -X POST -d '{"accountId":"..."}'
71
+ git clone https://github.com/kud/jira-cli.git
72
+ cd jira-cli
73
+ npm install
74
+ npm run dev
242
75
  ```
243
76
 
244
- A call returning 2xx with an empty body โ€” a 204, or a 201 with no content โ€” prints nothing and exits 0, rather than printing the string `null`; that way `null` only ever means Jira really answered null. A non-2xx is still an error, showing the body.
245
-
246
- ## Licence
247
-
248
- MIT
77
+ ๐Ÿ“š **Full documentation โ†’ [jira-cli/docs](https://kud.io/projects/jira-cli/docs)**
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import { realpathSync } from "fs";
14
14
  import { createRequire } from "module";
15
15
  import { fileURLToPath } from "url";
16
16
  import { Command } from "commander";
17
- import { configPath as configPath2, isJiraApiError as isJiraApiError3 } from "@kud/jira";
17
+ import { configPath as configPath2, isJiraApiError as isJiraApiError4 } from "@kud/jira";
18
18
 
19
19
  // src/commands/automation.ts
20
20
  import { readFileSync } from "fs";
@@ -534,7 +534,9 @@ import { adfToMarkdown as adfToMarkdown2, flattenIssueLinks as flattenIssueLinks
534
534
  import { readFileSync as readFileSync2 } from "fs";
535
535
  import {
536
536
  adfToMarkdown,
537
+ errorMessagesOf,
537
538
  flattenIssueLinks,
539
+ isJiraApiError as isJiraApiError3,
538
540
  markdownToAdf
539
541
  } from "@kud/jira";
540
542
 
@@ -562,7 +564,10 @@ var rankPosition = (options) => {
562
564
  if (top) {
563
565
  if (!jql) throw exitError(1, "--top requires --jql");
564
566
  if (before || after)
565
- throw exitError(1, "--top is mutually exclusive with --before and --after");
567
+ throw exitError(
568
+ 1,
569
+ "--top is mutually exclusive with --before and --after"
570
+ );
566
571
  return { top: true, jql };
567
572
  }
568
573
  if (jql)
@@ -633,10 +638,7 @@ var parseLinkSpecs = (link, types) => {
633
638
  (t) => t.name.toLowerCase() === type.toLowerCase()
634
639
  );
635
640
  if (!resolved)
636
- throw exitError(
637
- 1,
638
- `no link type '${type}'. Valid: ${titles.join(", ")}`
639
- );
641
+ throw exitError(1, `no link type '${type}'. Valid: ${titles.join(", ")}`);
640
642
  return { type: resolved.name, key };
641
643
  });
642
644
  };
@@ -648,23 +650,30 @@ var resolveAccountId = async (who, projectKey) => {
648
650
  const assignable = projectKey ? await ctx.client.searchAssignableUsers(who, projectKey) : [];
649
651
  const candidates = assignable.length > 0 ? assignable : await ctx.client.searchUsers(who);
650
652
  if (candidates.length === 0) throw exitError(1, `no user matching '${who}'`);
651
- if (candidates.length > 1) {
652
- for (const u of candidates)
653
- process.stderr.write(
654
- `${u.displayName}${u.emailAddress ? ` ${u.emailAddress}` : ""} ${u.accountId}
655
- `
656
- );
657
- throw exitError(1, `'${who}' matches ${candidates.length} people`);
658
- }
659
- return candidates[0].accountId;
653
+ const wanted = who.trim().toLowerCase();
654
+ const exact = candidates.filter(
655
+ (u) => u.displayName?.toLowerCase() === wanted || u.emailAddress?.toLowerCase() === wanted
656
+ );
657
+ const active = exact.filter((u) => u.active !== false);
658
+ if (active.length === 1) return active[0].accountId;
659
+ for (const u of candidates) process.stderr.write(`${candidateLine(u)}
660
+ `);
661
+ throw exitError(
662
+ 1,
663
+ active.length > 1 ? `'${who}' matches ${active.length} active users exactly \u2014 retry with an account id or email` : exact.length > 0 ? `'${who}' matches only inactive or unassignable users \u2014 retry with an assignable account` : `'${who}' has no exact match among ${candidates.length} result${candidates.length === 1 ? "" : "s"} \u2014 retry with the exact name, email, or account id`
664
+ );
660
665
  };
666
+ var candidateLine = (u) => `${u.displayName}${u.emailAddress ? ` ${u.emailAddress}` : ""} ${u.accountId}${u.active === false ? " (inactive)" : ""}`;
661
667
  var registerIssueWriteCommands = (issue) => {
662
668
  issue.command("create").description("create an issue").requiredOption("-p, --project <key>", "project key").requiredOption("-t, --type <type>", "issue type, e.g. Task").requiredOption("-s, --summary <text>", "summary").option("-b, --body <text>", "description; '-' reads stdin").option("-a, --assignee <who>", "assignee, or 'me'").option("-l, --label <label...>", "labels").option("--priority <name>", "priority name").option("--parent <key>", "parent issue key").option(
663
669
  "--link <type:key>",
664
670
  "link the new issue to another, repeatable, e.g. Relates:ABC-2",
665
671
  collectLink,
666
672
  []
667
- ).option("--status <name>", "transition the new issue to this status after creation").option("--json", "emit JSON").action(
673
+ ).option(
674
+ "--status <name>",
675
+ "transition the new issue to this status after creation"
676
+ ).option("--json", "emit JSON").action(
668
677
  async (options) => {
669
678
  const ctx = context();
670
679
  const fields = {
@@ -698,8 +707,10 @@ var registerIssueWriteCommands = (issue) => {
698
707
  `created ${created.key}, but the ${link2.type} link to ${link2.key} failed: ${messageOf(e)}`
699
708
  );
700
709
  }
701
- process.stderr.write(`linked ${created.key} ${link2.type} ${link2.key}
702
- `);
710
+ process.stderr.write(
711
+ `linked ${created.key} ${link2.type} ${link2.key}
712
+ `
713
+ );
703
714
  }
704
715
  if (options.status) {
705
716
  try {
@@ -734,7 +745,13 @@ var registerIssueWriteCommands = (issue) => {
734
745
  }
735
746
  }
736
747
  );
737
- issue.command("edit <key>").description("change an issue's fields").option("-s, --summary <text>", "new summary").option("-b, --body <text>", "new description; '-' reads stdin").option("--prepend-description <md>", "prepend markdown to the description; '-' reads stdin").option("--append-description <md>", "append markdown to the description; '-' reads stdin").option("-l, --label <label...>", "replace labels").option("--priority <name>", "priority name").option("--parent <key>", "parent issue key; 'none' clears it").option("-a, --assignee <who>", "assignee; 'me' or 'none' both work").action(
748
+ issue.command("edit <key>").description("change an issue's fields").option("-s, --summary <text>", "new summary").option("-b, --body <text>", "new description; '-' reads stdin").option(
749
+ "--prepend-description <md>",
750
+ "prepend markdown to the description; '-' reads stdin"
751
+ ).option(
752
+ "--append-description <md>",
753
+ "append markdown to the description; '-' reads stdin"
754
+ ).option("-l, --label <label...>", "replace labels").option("--priority <name>", "priority name").option("--parent <key>", "parent issue key; 'none' clears it").option("-a, --assignee <who>", "assignee; 'me' or 'none' both work").action(
738
755
  async (key, options) => {
739
756
  if (options.body && (options.prependDescription || options.appendDescription))
740
757
  throw exitError(
@@ -791,10 +808,23 @@ var registerIssueWriteCommands = (issue) => {
791
808
  `);
792
809
  });
793
810
  issue.command("assign <key> <who>").description("assign an issue; 'me', a name, or 'none' all work").action(async (key, who) => {
811
+ const ctx = context();
794
812
  const accountId = await resolveAccountId(who, projectOf(key));
795
- await context().client.assignIssue(key, accountId);
796
- process.stderr.write(`${key} assigned to ${accountId ? who : "nobody"}
797
- `);
813
+ try {
814
+ await ctx.client.assignIssue(key, accountId);
815
+ } catch (e) {
816
+ if (isJiraApiError3(e))
817
+ throw exitError(
818
+ 1,
819
+ `could not assign ${key}: ${errorMessagesOf(e).join("; ")}`
820
+ );
821
+ throw e;
822
+ }
823
+ const after = await ctx.client.getIssue(key);
824
+ process.stderr.write(
825
+ `${key} assigned to ${after.fields.assignee?.displayName ?? "nobody"}
826
+ `
827
+ );
798
828
  });
799
829
  const comment = issue.command("comment").description("read and write comments");
800
830
  comment.command("list <key>").alias("ls").description("comments on an issue").option("--json", "emit JSON").option("--last [n]", "show only the n most recent comments (default 1)").action(
@@ -966,7 +996,9 @@ var registerIssueWriteCommands = (issue) => {
966
996
  process.stderr.write(`removed remote link ${linkId} from ${key}
967
997
  `);
968
998
  });
969
- issue.command("rank <keys...>").description("order issues before or after another issue, or at the top of a JQL scope").option("--before <key>", "place the issues before this one").option("--after <key>", "place the issues after this one").option("--top", "rank at the top of the JQL scope (requires --jql)").option("--jql <jql>", "JQL scope for --top").action(
999
+ issue.command("rank <keys...>").description(
1000
+ "order issues before or after another issue, or at the top of a JQL scope"
1001
+ ).option("--before <key>", "place the issues before this one").option("--after <key>", "place the issues after this one").option("--top", "rank at the top of the JQL scope (requires --jql)").option("--jql <jql>", "JQL scope for --top").action(
970
1002
  async (keys, options) => {
971
1003
  const position = rankPosition(options);
972
1004
  if (!("top" in position)) {
@@ -1564,7 +1596,7 @@ registerAutomationCommands(program);
1564
1596
  registerApiCommand(program);
1565
1597
  var exitCodeFor = (error) => {
1566
1598
  if (isExitError(error)) return error.code;
1567
- if (isJiraApiError3(error))
1599
+ if (isJiraApiError4(error))
1568
1600
  return error.status === 401 || error.status === 403 ? 4 : 1;
1569
1601
  return 1;
1570
1602
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kud/jira-cli",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "type": "module",
5
5
  "description": "Jira on the command line โ€” read issues, comments and attachments as plain text",
6
6
  "keywords": [
@@ -16,7 +16,7 @@
16
16
  "type": "git",
17
17
  "url": "git+https://github.com/kud/jira-cli.git"
18
18
  },
19
- "homepage": "https://github.com/kud/jira-cli#readme",
19
+ "homepage": "https://kud.io/projects/jira-cli",
20
20
  "bugs": "https://github.com/kud/jira-cli/issues",
21
21
  "bin": {
22
22
  "jira": "dist/index.js"