JIRA is everybody’s favorite enterprise issue management system. It’s the system many of us just love to hate.
Unlike some vocal people on the interwebs, I don’t “hate” JIRA, but I like to keep it at arm’s length. My job is not to be a JIRA jockey (although I do know me some JQL, about which more below) — my job is to get shit done.
And getting shit done quickly, for me at least, is usually a function of being able to control my tools from the command line, including via scripts.
That’s why I have written several scripts for interacting with JIRA from the command line (they’re explained below). You can get them from Github.
Note that they use some hard-coded values that match the JIRA server where I work, which you’ll have to change. However they do at least use your
.netrc for passwords, etc., so you should be able to change them for your own use with a quick
The functionality isn’t there to fully replace your web browser, especially if you work at a company that insists on enterprise-level JIRA jockeying, with crazy themes and labels and stuff, but here’s what’s included as of this writing — for each command, I’ve marked whether it is “plumbing” or “porcelain”:
jira-get-issue(plumbing): View an issue’s JSON, which you can pipe through tools such as
jqto build other more generic tools you can control from your text editor, scripts, etc.
jira-create-issue(porcelain): This one is “end-user-ready”, in the sense that you call it and it pops up your text editor of choice so you can write the issue description, and when you close your editor the issue is created for you!
jira-search-issues(plumbing): Uses JQL to search your JIRA, and returns a bunch of issues as JSON for you to fiddle with however you prefer.
jira-create-issue, this one pops open your text editor to add a comment to an issue.
jira-get-issue-status(plumbing): Gets back JSON describing an issue’s status. Used to check the status to transition an issue forwards or backwards using
jira-set-issue-status(porcelain-ish): Depending on an issue’s status, bump it forwards or backwards to an adjacent status. Help output describes the statuses and their ordering. (I’m not so sure about this one; more design work is needed, it’s still not really “porcelain”.)
As an example of using one of the plumbing tools to make a more user-friendly CLI tool, I have one I call
jli that just gives me a list of my currently open issues:
#!/usr/bin/env sh jira-search-issues "assignee = rloveland AND status not in \ (Closed, Resolved)" | jq '.key + " " + .fields.summary' | sed -e 's/\"//g';
Since it’s an arbitrary JQL query returning JSON, it’s easy to imagine how you might extend this to give separate lists per-project, ordered by status, etc. You can make your own little terminal- or text-file-based dashboard, send yourself a daily digest email using a larger script, and so forth.
There are some others, but I only have them on my work computer. For example, I have one that checks JIRA for new tickets by diffing the list of my assigned tickets and my local TODO list, which is in a text file.
Obviously these tools could use further development to be more modular and general-purpose, and they don’t come anywhere near covering the whole JIRA API, but they’re pretty small and easy to modify for your own use.
Most importantly, I use them every day at my job, so I know they work and are useful.
Hopefully they are useful to you too!