- Go 99.6%
- Makefile 0.2%
- Shell 0.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
TUI: Search tab with project, status, assignee and text filters and sort keys See merge request gheinemeyer/jira-tui!2 |
||
| bench | ||
| cmd/jira | ||
| docs | ||
| internal | ||
| .gitignore | ||
| go.mod | ||
| go.sum | ||
| Makefile | ||
| PLAN.md | ||
| README.md | ||
jira — a fast Jira Cloud CLI
jira is a command-line client for Jira Cloud written in Go. It has the same
command layout as ankitpokhrel/jira-cli
and is built to be fast: it starts almost instantly, makes as few HTTP requests as
it can, and keeps responses small.
Why it's fast
- Nothing runs at startup. The config file, the cache and the HTTP client are
only created when a command needs them.
jira --helpandjira opennever touch the network. - Small responses. Every search and fetch asks only for the fields that will be
printed. If you pick fewer columns with
--columns, less data is fetched. - Fewer requests. One HTTP client is shared, so the connection is reused
(keep-alive, HTTP/2, gzip). Searches use the
POST /rest/api/3/search/jqlendpoint, which pages with tokens. - Requests run in parallel where they can.
issue viewfetches the issue and its comments at the same time.issue createlooks up the issue type and the assignee at the same time.initchecks your credentials while it fetches the project list. - Metadata is cached on disk. Projects, boards, issue types, the current user
and user lookups are cached, so repeat commands such as
issue assign KEY jane@example.comneed a single request.jira initalready caches your user, so even the firstissue assign KEY meis one request. - Fewer lookups.
sprint list --currentis a single JQL search when no--boardis given. It skips the board and sprint lookups. - Attachments in few round trips. A comment with any number of files takes
3 round trips: one upload, the image IDs looked up in parallel, then the
comment.
attachment get KEY ID -o FILEstarts the download straight away. - Output streams.
--plain,--csvand--jsonrows are printed as each page of results arrives.
Install
You need Go 1.26 or later.
git clone <repo-url> jira-cli && cd jira-cli
make install # builds into ~/.local/bin/jira (set PREFIX to change)
make build # or build only, into bin/jira
make stamps the version from git describe, and jira --version prints it.
Without make: go build -trimpath -ldflags="-s -w" -o jira ./cmd/jira. In that
case jira --version prints dev.
Shell completion scripts come from jira completion bash|zsh|fish|powershell.
Quick start
export JIRA_API_TOKEN=<your token> # see "Authentication" below
jira init # server, email, default project and board
jira me # check that the credentials work
jira issue list -a me -s ~Done # your open issues
jira init asks for the server (for example example.atlassian.net), your email
and the API token. It checks them with Jira, then lets you pick a default project
and board from a list. Press Enter to keep the value shown in brackets. The config
is written to ~/.config/jira/config.yml with 0600 permissions.
Authentication
jira uses basic auth with your Atlassian account email and an API token.
-
Go to https://id.atlassian.com/manage-profile/security/api-tokens.
-
Click Create API token, give it a name and copy the token.
-
Put it in your shell profile:
export JIRA_API_TOKEN=<your token>
The environment variable is the recommended place for the token. When
JIRA_API_TOKEN is set, jira init uses it and does not ask for a token, and it
never writes that value to the config file. If you type a token into jira init
instead, it asks whether to store it in the config file. The default answer is no.
Configuration
~/.config/jira/config.yml (or $XDG_CONFIG_HOME/jira/config.yml; use
--config to pick another file):
server: https://example.atlassian.net # https:// is added if left out
email: you@example.com
api_token: ... # optional; JIRA_API_TOKEN is preferred
project: PROJ # default project for -p
board: "42" # default board: ID or name
columns: [key, status, assignee, summary] # default issue list columns
cache_ttl: 24h # how long cached metadata is trusted
image_protocol: auto # auto, kitty, iterm, sixel, blocks or none
comment_order: oldest # oldest (default) or newest comments first, in issue view and jira ui
favorites: # saved queries: jira ui tab 5, jira issue list --fav NAME
- name: My open bugs
jql: project = PROJ AND type = Bug AND assignee = currentUser() AND statusCategory != Done
- name: Needs review
jql: project = PROJ AND status = "In Review" ORDER BY updated DESC
favorites is usually managed from jira ui, which rewrites only that key and
keeps the rest of the file and its comments as they are. A favorite's JQL runs
as written in the UI. With --fav, the default project is added, as with -q.
These environment variables override the matching settings in the file:
| Variable | Overrides |
|---|---|
JIRA_SERVER |
server. JIRA_URL also works and is used when JIRA_SERVER isn't set. |
JIRA_EMAIL |
email |
JIRA_API_TOKEN |
api_token |
JIRA_PROJECT |
project |
server, email and the token are required. If one is missing, commands stop
with an error that names it before any request is sent. The -p flag overrides
both the file and JIRA_PROJECT.
Examples
The full reference for every command and flag is in docs/commands.md.
# Issues
jira issue list -a me -s "In Progress"
jira issue list -q 'labels = backend' --plain --columns key,summary
jira issue list --fav "My open bugs"
jira issue view PROJ-123 --comments 5
jira issue create -t Bug -s "Login fails" -b "Steps: ..." -y High -a me
jira issue edit PROJ-123 -s "New summary" -y High
jira issue edit PROJ-123 -l urgent -l -triage # add urgent, remove triage
jira issue assign PROJ-123 jane@example.com
jira issue move PROJ-123 "In Progress"
jira issue comment add PROJ-123 "Deployed to staging"
jira issue comment add PROJ-123 "Broken layout" --attach shot.png
jira issue comment add PROJ-123 "Over to you @[Jane Doe]" # tags Jane
jira issue attachment list PROJ-123
jira issue attachment get PROJ-123 log.txt
jira issue attachment view PROJ-123 shot.png # draws it in the terminal
jira issue link PROJ-1 PROJ-2 Blocks # PROJ-1 blocks PROJ-2
jira issue clone PROJ-123 -s "Copy of login bug"
jira issue delete PROJ-123
# Epics
jira epic list # epics in the project
jira epic list PROJ-10 # issues in an epic
jira epic create -s "Checkout v2" -a me
jira epic add PROJ-10 PROJ-11 PROJ-12
jira epic remove PROJ-12
# Sprints and boards
jira board list
jira sprint list # active and future sprints of the default board
jira sprint list --current # issues in the project's open sprints
jira sprint add 42 PROJ-11 PROJ-12
# Other
jira project list
jira me
jira open PROJ-123
jira cache clear
Full-screen interface
jira ui opens an interface with Issues, Sprint, Epics, Projects, Favorites
and Search tabs. It has a list, a detail pane, and forms to move, assign, comment on, edit,
create, delete and link issues. You can use the keyboard or the mouse:
j/kto move,/to filter,:for JQL and?for helpito go to an issue by key or URLsto open related issues (parent, sub-tasks, links), withescto walk backspace/ctrl+ato select several issues, thenm,aorcto move, assign or comment on them all- the Favorites tab (
5) for saved queries, andFto save the current query - the Search tab (
6):ffilters by text, project, status and assignee,Schanges the sort field andRreverses the order vto list attachments and view images full-screen, andctrl+vor drag-and-drop in the comment form to attach screenshots and files
jira issue list -i ... opens the same interface on the results of a list.
Requests run in the background, more pages load as you scroll, and the
highlighted issue is fetched before you open it.
See docs/tui.md for the layout, keys, mouse and forms.
Terminal image support
Images are drawn with the best protocol the terminal supports, detected on first
use. Set image_protocol in the config to override the detection.
| Protocol | Terminals |
|---|---|
| kitty graphics | kitty, Ghostty, WezTerm. In herdr, add kitty_graphics = true under [experimental] in ~/.config/herdr/config.toml. |
| iTerm2 inline images | iTerm2 (also WezTerm and the VS Code terminal) |
| sixel | Terminals that report sixel, such as foot, xterm and Windows Terminal |
| blocks (fallback) | Any terminal: coloured half-blocks, exact with 24-bit colour |
Pasting an image with ctrl+v reads the clipboard with a system tool:
| OS | Needs |
|---|---|
| Linux (Wayland) | wl-clipboard (wl-paste) |
| Linux (X11) | xclip |
| macOS | nothing, it's built in (osascript, or pngpaste if installed) |
| Windows | nothing, it's built in (PowerShell) |
Details are in docs/tui.md.
Global flags
| Flag | Description |
|---|---|
-p, --project KEY |
Project key. Overrides the config and JIRA_PROJECT. |
--config PATH |
Config file to use (default ~/.config/jira/config.yml). |
--no-cache |
Don't read or write the metadata cache. |
--debug |
Print each HTTP request and how long it took to stderr. |
--no-color |
Turn off coloured output. |
--version |
Print the version and exit. |
Output formats
List commands (issue list, epic list, sprint list, board list,
project list, issue attachment list) take these flags:
| Flag | Output |
|---|---|
| (default) | An aligned table cut to the terminal width, with colours for status and priority. |
--plain |
Tab-separated and never cut, which suits cut, awk and grep. |
--csv |
CSV. |
--json |
JSON. Issue lists print the full issue objects with every fetched field. |
--no-headers |
Leave out the header row. |
Issue lists also take --columns (choose from key, type, status,
priority, assignee, reporter, summary, labels, created and updated)
and --limit N (default 100, 0 means no limit).
Colours are used only when stdout is a terminal. You can turn them off with
--no-color, NO_COLOR=1 or TERM=dumb. When stdout is a terminal, issue lists
and issue view go through $PAGER (default less -FRX, which exits straight
away if the output fits on one screen). Use PAGER=cat to turn the pager off.
Cache
Data that rarely changes is cached as JSON files in ~/.cache/jira/ (or
$XDG_CACHE_HOME/jira/):
- the project list
- the boards for each project
- the issue types for each project
- the priority list
- the current user (used for
meinassignandcreate -a me). It is saved byjira initand kept for 30 days whatevercache_ttlsays, because your account ID doesn't change. - user lookups by name or email
- the link types
- the last 20
:queries ofjira ui
Cache entries are stored separately for each server and email, so switching
sites or accounts never returns data from the other one. Other entries expire
after cache_ttl (default 24h).
Some things are never cached. Workflow transitions are always fetched live,
because a stale transition ID could quietly run the wrong transition. jira me
always asks the server, so it also works as a credentials check.
--no-cache skips the cache for one command, and jira cache clear deletes all
of it. If a new project, board or issue type is missing, or a user lookup gives an
old result, clear the cache.
Troubleshooting
See which requests are sent: add --debug. Each request is printed to stderr
as one line with the method, path, status and time:
GET /rest/api/3/myself 200 182ms
POST /rest/api/3/search/jql 200 341ms
Retries are marked with (retry N). A request is retried up to 3 times with
backoff, and Retry-After is honoured. A 429 (rate limited) or 503 is retried for
any request, because Jira did not process it. Other 5xx errors and network errors
are retried only for GET, PUT and DELETE, because a POST may already have taken
effect.
missing config: ...: run jira init, or set the environment variables the
error names.
401 Unauthorized: check email and the token. The token must belong to the
same Atlassian account as the email. Run jira me to test.
no project set: pass -p KEY or set project in the config.
N boards found: the project has more than one board. Pass --board or set
board in the config (see jira board list).
no transition matches "...": the error lists the transitions available from
the issue's current status. Use one of those names.
Stale names or IDs: run jira cache clear, or use --no-cache for one run.