jira-cli

βš™οΈ Setup

Authenticate, write the config file, name custom fields and read the exit codes.

Authentication

Only the API token is a secret, so only the token comes from the environment. Create one at id.atlassian.com/manage-profile/security/api-tokens, then:

export ATLASSIAN_API_TOKEN=...
jira init --base-url myorg.atlassian.net --email you@example.com

jira init writes the config file and prints where it went. It refuses to overwrite an existing config unless you pass --force. --base-url and --email fall back to ATLASSIAN_BASE_URL and ATLASSIAN_USER_EMAIL when omitted.

Check it worked:

jira whoami

Environment variables

VariablePurpose
ATLASSIAN_API_TOKENThe token. Environment only, never the config file.
ATLASSIAN_BASE_URLOverrides baseUrl, handy for a second instance.
ATLASSIAN_USER_EMAILOverrides email.
ATLASSIAN_CLOUD_IDSkips the cloud ID lookup used by jira automation.
ATLASSIAN_AUTOMATION_HOSTsite or api, the default for jira automation --host.
NO_COLORDisables colour. It is also off automatically when stdout is piped.

The config file

Everything else lives in ~/.config/jira/config.json:

{
  "baseUrl": "myorg.atlassian.net",
  "email": "you@example.com",
  "customFields": [{ "id": "customfield_10002", "label": "points" }],
  "sprintField": "customfield_10020",
  "defaultProject": "ABC"
}

The interactive view also reads defaultBoard and hand-written tabs; see Interactive view.

Custom fields

Instances differ, so find the ids on yours with jira fields:

jira fields points
# ID                 NAME                   TYPE
# customfield_10784  Offshore Story Points  string
# customfield_10002  Story Points           number

jira fields [filter] lists custom fields matching the filter; add --all to include built-in fields, and --json for machine output. Add the ones you care about to customFields with a short label. Named fields are requested on every search and shown in jira issue view.

Exit codes

CodeMeans
0success
1Jira rejected the request, or bad usage
2the environment is not set up
3--json result may be truncated
4not authenticated

jira issue list and jira search stop at --limit (50 by default). Jira no longer reports a total, so a full page is the only sign rows were left behind. When that happens both commands warn on stderr, and with --json they exit 3. Stdout is untouched, so the JSON still parses. Raise --limit to be sure you have everything.