πŸ”₯ [WIP] Interactive Jira Command Line

JiraCLI

Build GO Report-card

Interactive Jira CLI

TusPHP Demo

🚧 This project is still a work in progress 🚧


This tool mostly focuses on issue search and navigation at the moment. However, it also includes features like issue creation, updating a ticket status, and so on. Note that the tool is only tested with the latest Jira cloud.

Installation

Install the runnable binary to your $GOPATH/bin.

$ go get github.com/ankitpokhrel/jira-cli/cmd/jira

Releases and other installation options will be available later.

Getting started

  1. Get a Jira API token and export it to your shell as a JIRA_API_TOKEN variable. Add it to your shell configuration file, for instance, $HOME/.bashrc, so that the variable is always available.
  2. Run jira init to generate a config file required for the tool.

Shell completion

Check jira completion --help for more info on setting up a bash/zsh shell completion.

Usage

The tool currently comes with an issue, epic, and sprint explorer. The flags are POSIX-compliant. You can combine available flags in any order to create a unique query. For example, the command below will give you high priority issues created this month with status To Do that are assigned to you and has a label backend.

$ jira issue list -yHigh -s"To Do" --created month -lbackend -a$(jira me)
Navigation

The lists are displayed in an interactive UI by default.

  • Use arrow keys or j, k, h, l characters to navigate through the list.
  • Use g and SHIFT+G to quickly navigate to the top and bottom respectively.
  • Press v to view selected issue details.
  • Hit ENTER to open the selected issue in the browser.
  • Press c to copy issue URL to the system clipboard. This requires xclip / xsel in linux.
  • Press CTRL+K to copy issue key to the system clipboard.
  • In an explorer view, press w to toggle focus between the sidebar and the contents screen.
  • Press q / ESC / CTRL+C to quit.

Issue

Issues are displayed in an interactive table view by default. You can output the results in a plain view using the --plain flag.

List

The list command lets you search and navigate the issues.

# List recent issues
$ jira issue list

# List issues created in last 7 days
$ jira issue list --created -7d

# List issues in status "To Do"
$ jira issue list -s"To Do"

# List recent issues in plain mode 
$ jira issue list --plain

Check some more examples/use-cases below.

List issues that I am watching
$ jira issue list -w
List issues assigned to me
$ jira issue list -a$(jira me)
List issues assigned to a user and are reported by another user
$ jira issue list -a"User A" -r"User B"
List issues assigned to me is of high priority and is open
$ jira issue list -a$(jira me) -yHigh -sopen
List issues assigned to no one and are created this week
$ jira issue list -ax --created week
List issues with resolution won't do
$ jira issue list -R"Won't do"
List issues whose status is not done and is created before 6 months and is assigned to someone
# Tilde (~) acts as a not operator
$ jira issue list -s~Done --created-before -24w -a~x
List issues created within an hour and updated in the last 30 minutes ⏱️
$ jira issue list --created -1h --updated -30m
Give me issues that are of high priority, is in progress, was created this month, and has given labels πŸ”₯
$ jira issue list -yHigh -s"In Progress" --created month -lbackend -l"high prio"
Wait, what was that ticket I opened earlier today? 😫
$ jira issue list --history
What was the first issue I ever reported on the current board? πŸ€”
$ jira issue list -r$(jira me) --reverse
What was the first bug I ever fixed in the current board? 🐞
$ jira issue list -a$(jira me) -tBug sDone -rFixed --reverse
What issues did I report this week? πŸ€·β€β™‚οΈ
$ jira issue list -r$(jira me) --created week
Am I watching any tickets in project XYZ? 🧐
$ jira issue list -w -pXYZ

Create

The create command lets you create an issue.

# Create an issue using interactive prompt
$ jira issue create

# Pass required parameters to skip prompt or use --no-input option
$ jira issue create -tBug -s"New Bug" -yHigh -lbug -lurgent -b"Bug description"

Create an issue

Assign

The assign command lets you assign user to an issue.

# Assign user to an issue using interactive prompt
$ jira issue assign

# Pass required parameters to skip prompt
$ jira issue assign ISSUE-1 "Jon Doe"

# Assign to self
$ jira issue assign ISSUE-1 $(jira me)

# Will prompt for selection if keyword suffix returns multiple entries
$ jira issue assign ISSUE-1 suffix

# Assign to default assignee
$ jira issue assign ISSUE-1 default

# Unassign
$ jira issue assign ISSUE-1 x

Assign issue to a user

Move/Transition

The move command lets you transition issue from one state to another.

# Move an issue using interactive prompt
$ jira issue move

# Pass required parameters to skip prompt
$ jira issue move ISSUE-1 "In Progress"

Move an issue

View

The view command lets you see issue details in a terminal. Atlassian document is roughly converted to a markdown and is nicely displayed in the terminal.

$ jira issue view ISSUE-1

View an issue

Epic

Epics are displayed in an explorer view by default. You can output the results in a table view using the --table flag. When viewing epic issues, you can use all filters available for the issue command.

See usage to learn more about UI interaction.

List

You can use all flags supported by issue list command here except for the issue type.

# List epics
$ jira epic list

# List epics in a table view
$ jira epic list --table

# List epics reported by me and are open
$ jira epic list -r$(jira me) -sOpen

# List issues in an epic
$ jira epic list KEY-1

# List all issue in an epic KEY-1 that is unassigned and has a high priority
$ jira epic list KEY-1 -ax -yHigh

# List high priority epics
$ jira epic list KEY-1 -yHigh

Create

Creating an epic is same as creating the issue except you also need to provide an epic name.

# Create an issue using interactive prompt
$ jira epic create

# Pass required parameters to skip prompt or use --no-input flag to skip prompt for non-mandatory params
$ jira epic create -n"Epic epic" -s"Everything" -yHigh -lbug -lurgent -b"Epic description"

Add

Add command allows you to add issues to the epic. You can add up to 50 issues to the epic at once.

# Add issues to the epic using interactive prompt
$ jira epic add

# Pass required parameters to skip prompt
$ jira epic add EPIC_KEY ISSUE_1 ISSUE_2

Sprint

Sprints are displayed in an explorer view by default. You can output the results in a table view using the --table flag. When viewing sprint issues, you can use all filters available for the issue command. The tool only shows 25 recent sprints.

See usage to learn more about UI interaction.

# List sprints in an explorer view
$ jira sprint list

# List sprints in a table view
$ jira sprint list --table

# List issues in current active sprint
$ jira sprint list --current

# List issues in current active sprint that are assigned to me
$ jira sprint list --current -a$(jira me)

# List issues in previous sprint
$ jira sprint list --prev

# List issues in next planned sprint
$ jira sprint list --next

# List future and active sprints
$ jira sprint list --state future,active

# List issues in a particular sprint. You can use all flags supported by issue list command here. 
# To get sprint id use `jira sprint list` or `jira sprint list --table`
$ jira sprint list SPRINT_ID

# List high priority issues in a sprint are assigned to me
$ jira sprint list SPRINT_ID -yHigh -a$(jira me)

Other commands

Navigate to the project
# Navigate to the project
$ jira open

# Navigate to the issue
$ jira open KEY-1
List all projects you have access to
$ jira project
List all boards in a project
$ jira board

Scripts

Often times, you may want to use the output of the command to do something cool. However, the default interactive UI might not allow you to do that. The tool comes with the --plain flag that displays results in a simple layout that can then be manipulated from the shell script.

Some example scripts are listed below.

Tickets created per day this month
#!/usr/bin/env bash

tickets=$(jira issue list --created month --plain --columns created --no-headers | awk '{print $1}' | awk -F'-' '{print $3}' | sort -n | uniq -c)

echo "${tickets}" | while IFS=$'\t' read -r line; do
  day=$(echo "${line}" | awk '{print $2}')
  count=$(echo "${line}" | awk '{print $1}')

  printf "Day #%s: %s\n" "${day}" "${count}"
done

# Output
Day #01: 19
Day #02: 10
Day #03: 21
...
Number of tickets per sprint
#!/usr/bin/env bash

sprints=$(jira sprint list --table --plain --columns id,name --no-headers)

echo "${sprints}" | while IFS=$'\t' read -r id name; do
  count=$(jira sprint list "${id}" --table --plain --no-headers 2>/dev/null | wc -l)

  printf "%10s: %3d\n" "${name}" $((count))
done

# Output
Sprint 3:   55
Sprint 2:   40
Sprint 1:   30
...
Number of unique assignee per sprint
#!/usr/bin/env bash

sprints=$(jira sprint list --table --plain --columns id,name --no-headers)

echo "${sprints}" | while IFS=$'\t' read -r id name; do
  count=$(jira sprint list "${id}" --table --plain --columns assignee --no-headers 2>/dev/null | sort -n | uniq | wc -l)

  printf "%10s: %3d\n" "${name}" $((count))
done

# Output
Sprint 3:   5
Sprint 2:   4
Sprint 1:   3

Future improvements

  • Issue creation.
  • Ability to view issue details.
  • Possibility to change issue status.
  • Possibility to assign issue to a user.
  • Comments management.
  • Historical data can be cached locally for faster execution.

Development

  1. Clone the repo.

    $ git clone [email protected]:ankitpokhrel/jira-cli.git
  2. Make changes, build the binary, and test your changes.

    $ make deps
    $ make install
  3. Run linter and tests before submitting a PR.

    $ make ci
Owner
Ankit Pokhrel
Backend @hellofresh previous Lazada/Alibaba
Ankit Pokhrel
Comments
  • Formatting issue or missing char set?

    Formatting issue or missing char set?

    Describe the bug

    jira view issue fails to display correctly

    Please provide following details

    1. JiraCLI Version:
      (Version="v0.0.0-dev", GitCommit="", CommitDate="", GoVersion="go1.18.2", Compiler="gc", Platform="linux/amd64")
      
    2. Are you using Jira cloud or on-premise jira server? Also mention the version for on-premise installation.
      on-premise, unsure of version 
      
    3. What operating system are you using? Also mention version.
      Fedora 36
      
    4. What terminal are you using? Also mention version.
      alacritty --version
      alacritty 0.10.1
      

    To Reproduce

    Steps to reproduce the behavior:

    1. jira view with above setup

    Expected behavior

    Output is readable

    Screenshots

    ESC[38;5;252mESC[0mESC[38;5;252mESC[0m  ESC[38;5;252m🐞 Bug  🚧 Closed  βŒ› Thu, 16 Jun 22
    

    Additional context

  • jira issue view <key> --plain does not work

    jira issue view --plain does not work

    Describe the bug It seems that the flag --plain is not considered or is not working

    Please provide following details

    1. JiraCLI Version:
      (Version="1.0.0-beta", GitCommit="118b51dc3913ba2af0411c9d4a344eaecda8571b", CommitDate="2022-05-09T05:49:06+00:00", GoVersion="go1.17.5", Compiler="gc", Platform="windows/amd64")
      
    2. Are you using Jira cloud or on-premise jira server? Also mention the version for on-premise installation.
      Jira on-premise v8.20.8
      
    3. What operating system are you using? Also mention version.
      Windows 10
      
    4. What terminal are you using? Also mention version.
      Windows Terminal
      

    To Reproduce

    Steps to reproduce the behavior:

    1. jira issue view <key> --plain
    2. See error

    Expected behavior I expected to read the output in plain mode.

  • Got response in unexpected format when fetching metadata

    Got response in unexpected format when fetching metadata

    Describe the bug jira init exits with the error Got response in unexpected format when fetching metadata. Please try again

    Please provide following details

    1. JiraCLI Version:
      (Version="v0.3.0", GitCommit="", CommitDate="", GoVersion="go1.16.1", Compiler="gc", Platform="darwin/amd64")
      
    2. Are you using Jira cloud or on-premise jira server? Also mention the version for on-premise installation.
      Jira Cloud
      
    3. What operating system are you using? Also mention version.
      macOS Catalina 10.15.7
      
    4. What terminal are you using? Also mention version.
      alacritty 0.10.1 (2844606)
      

    To Reproduce

    Steps to reproduce the behavior:

    1. export the JIRA_API_TOKEN
    2. run jira init
    3. Follow the prompts After choosing the default board, the error is printed.

    Expected behavior Configuration finalization

    Screenshots

    Additional context When running with the --debug flat, all responses are 200 OK

  • using

    using "jira issue list --plain -q ..." in a bash script producess weird errors

    Describe the bug

    total 8
    drwxrwxr-x. 1 guest guest   32 May 22 13:44 .
    drwxrwxr-x. 1 guest guest 1480 May 22 13:43 ..
    -rwxr-xr-x. 1 guest guest  122 May 22 13:44 test-jira-cli.sh
    [[email protected] tmp]$ cat test-jira-cli.sh 
    #!/bin/sh
    
    QUERY="fixVersion = Elektra"
    
    CMD="jira issue list --plain -q \"${QUERY}\""
    echo "[${CMD}]"
    
    $($CMD $QUERY)
      
    [[email protected] tmp]$ 
    [[email protected] tmp]$ ./test-jira-cli.sh 
    [jira issue list --plain -q "fixVersion = Elektra"]
    
    Error:
      - Error in the JQL Query: The quoted string 'fixVersion ORDER BY created DESC' has not been completed. (line 1, character 19)
    
    jira: Received unexpected response '400 Bad Request'.
    Please check the parameters you supplied and try again
    [[email protected] tmp]$
    

    As you can see the query does not contain "ORDER BY ..."

    Please provide following details

    1. JiraCLI Version:
      Please paste the output of `jira version` here.
      
    2. Are you using Jira cloud or on-premise jira server? Also mention the version for on-premise installation.
      (Version="main", GitCommit="90453390acd100cd5c438882fbe21cb479a25362", CommitDate="2022-05-12T15:27:37+00:00", GoVersion="go1.16.15", Compiler="gc", Platform="linux/amd64")
      
    3. What operating system are you using? Also mention version.
      Fedora release 35 (Thirty Five)
      
    4. What terminal are you using? Also mention version.
      GNOME Terminal Version 3.42.2 for GNOME 41
      

    To Reproduce

    simply run the adjusted above script (change the query to fit your project)

    Expected behavior

    jira-cli should run the query

  • `brew upgrade` failing on 1.0.0-beta

    `brew upgrade` failing on 1.0.0-beta

    Describe the bug

    I have Xcode 13.3.1 installed and set as the command line tools. On upgrading via brew I get the following:

    ==> Upgrading ankitpokhrel/jira-cli/jira-cli
      0.3.0 -> 1.0.0-beta
    
    Error: Your Command Line Tools are too outdated.
    Update them from Software Update in System Preferences or run:
      softwareupdate --all --install --force
    
    If that doesn't show you any updates, run:
      sudo rm -rf /Library/Developer/CommandLineTools
      sudo xcode-select --install
    
    Alternatively, manually download them from:
      https://developer.apple.com/download/all/.
    You should download the Command Line Tools for Xcode 13.3.
    

    Please provide following details

    1. JiraCLI Version:
      1.0.0-beta
      
    2. Are you using Jira cloud or on-premise jira server? Also mention the version for on-premise installation.
      N/A
      
    3. What operating system are you using? Also mention version.
      macOS Monterey 12.3.1
      
    4. What terminal are you using? Also mention version.
      iTerm 2 Build Build 3.4.15
      

    To Reproduce

    Steps to reproduce the behavior:

    1. Have Xcode 13.3.1 installed and set to the command line tools
    2. Have an older version of jira-cli installed3.
    3. Run brew upgrade
    4. See error

    Expected behavior The tools version test passes as 13.3.1 should meet the requirement for 13.3

    Screenshots N/A

    Additional context N/A

Submit timesheets to Jira from the command line
Submit timesheets to Jira from the command line

JiraTime jiratime makes it easy to submit worklog records to Jira quickly from the command line. It accepts timesheets on standard input so works well

Mar 2, 2022
A tiny cli command/daemon for syncing toggl time entries with Jira

toggl-sync A tiny cli command/daemon for syncing toggl time entries with Jira Installation Install the app via brew package manager. brew tap timemate

Nov 30, 2021
Interactive prompt for command-line applications
Interactive prompt for command-line applications

promptui Interactive prompt for command-line applications. We built Promptui because we wanted to make it easy and fun to explore cloud services with

Jun 26, 2022
An interactive command-line tool to manage your environments
An interactive command-line tool to manage your environments

goto An interactive command-line tool to manage your environments Overview You always need to login to some Linux machine or connect to a MySQL instan

Jun 23, 2022
jt is a CLI tool for viewing and manipulating JIRA issues.

jt - jira-tool jt is a CLI tool for viewing and manipulating JIRA issues. One common example usage to transition an issue to a new status: jt "In Prog

May 9, 2022
Helper tool to create and assign fix versions in Jira

Jira Helper Helper tool to interact with Jira from CI/CD scripts. Its main purpose is to create and assign version based on GitHub releases to Jira ti

Jun 5, 2022
An open-source GitLab command line tool bringing GitLab's cool features to your command line
An open-source GitLab command line tool bringing GitLab's cool features to your command line

GLab is an open source GitLab CLI tool bringing GitLab to your terminal next to where you are already working with git and your code without switching

Jun 25, 2022
A command line tool that builds and (re)starts your web application everytime you save a Go or template fileA command line tool that builds and (re)starts your web application everytime you save a Go or template file

# Fresh Fresh is a command line tool that builds and (re)starts your web application everytime you save a Go or template file. If the web framework yo

Nov 22, 2021
A command line tool to prompt for a value to be included in another command line.

readval is a command line tool which is designed for one specific purposeβ€”to prompt for a value to be included in another command line. readval prints

Dec 22, 2021
Go package to make lightweight ASCII line graph β•­β”ˆβ•― in command line apps with no other dependencies.
Go package to make lightweight ASCII line graph β•­β”ˆβ•― in command line apps with no other dependencies.

asciigraph Go package to make lightweight ASCII line graphs β•­β”ˆβ•―. Installation go get github.com/guptarohit/asciigraph Usage Basic graph package main

Jun 23, 2022
git-xargs is a command-line tool (CLI) for making updates across multiple Github repositories with a single command.
git-xargs is a command-line tool (CLI) for making updates across multiple Github repositories with a single command.

Table of contents Introduction Reference Contributing Introduction Overview git-xargs is a command-line tool (CLI) for making updates across multiple

Jun 26, 2022
git-xargs is a command-line tool (CLI) for making updates across multiple GitHub repositories with a single command
git-xargs is a command-line tool (CLI) for making updates across multiple GitHub repositories with a single command

git-xargs is a command-line tool (CLI) for making updates across multiple GitHub repositories with a single command. You give git-xargs:

Feb 5, 2022
Package command provide simple API to create modern command-line interface

Package command Package command provide simple API to create modern command-line interface, mainly for lightweight usage, inspired by cobra Usage pack

Jan 16, 2022
A command line tool for simplified docker volume command built with go

dockervol A command line tool for simplified docker volume command built with go. Features: Remove anonymous volume (beta) Remove volume by matching n

Dec 18, 2021
Watcher - A simple command line app to watch files in a directory for changes and run a command when files change!

Watcher - Develop your programs easily Watcher watches all the files present in the directory it is run from of the directory that is specified while

Mar 27, 2022
Abacus is a simple interactive calculator CLI

Abacus is a simple interactive calculator CLI with support for variables, comparison checks, and math functions abacus -

Jun 22, 2022
Building powerful interactive prompts in Go, inspired by python-prompt-toolkit.
Building powerful interactive prompts in Go, inspired by python-prompt-toolkit.

go-prompt A library for building powerful interactive prompts inspired by python-prompt-toolkit, making it easier to build cross-platform command line

Jul 1, 2022
Simplistic interactive filtering tool
Simplistic interactive filtering tool

peco Simplistic interactive filtering tool NOTE: If you are viewing this on GitHub, this document refers to the state of peco in whatever current bran

Jun 28, 2022
Terminal UI library with rich, interactive widgets β€”Β written in Golang
Terminal UI library with rich, interactive widgets β€”Β written in Golang

Rich Interactive Widgets for Terminal UIs This Go package provides commonly needed components for terminal based user interfaces. Among these componen

Jun 27, 2022