Giter Club home page Giter Club logo

jira-cmd's Introduction

jira-cmd

NPM Version Build Status Package downloads paypal

A Jira command line interface based on jilla.

Its got tons of functionalities

  • showing all jira assigned to you
  • show all jira corresponding to custom JQL
  • showing all jira with shortcut to custom JQL saved in config
  • creating new jira
  • creating new jira with shortcut that picks the default values for fields configured in config
  • showing sprint details and sprint id for boards
  • adding an issue to sprint
  • adding multiple issues to a sprint in one go
  • ability to use username alias shortcuts for commenting,assigning and adding watchers. It helps to not remember the usernames, just save their shortcuts in config.

Installation

Install node.js.

Then, in your shell type:

$ npm install -g jira-cmd

Usage

First use
$ jira
Jira URL: https://jira.atlassian.com/
Username: xxxxxx
Password: xxxxxx
Information stored!

This save your credentials (base64 encoded) in your $HOME/.jira folder.

Help

Usage: jira.js [options] [command]

Commands:

ls [options]           List my issues
start <issue>          Start working on an issue.
stop <issue>           Stop working on an issue.
review <issue> [assignee] Mark issue as being reviewed [by assignee(optional)].
done [options] <issue> Mark issue as finished.
running                List issues in progress.
jql [options] <query>  Run JQL query
link <from> <to>       link issues
search <term>          Find issues.
assign <issue> [user]  Assign an issue to <user>. Provide only issue# to assign to me
watch <issue> [user]   Watch an issue to <user>. Provide only issue# to watch to me
comment <issue> [text] Comment an issue.
show [options] <issue> Show info about an issue
open <issue>           Open an issue in a browser
worklog <issue>        Show worklog about an issue
worklogadd [options] <issue> <timeSpent> [comment] Log work for an issue
create [project[-issue]] Create an issue or a sub-task
config [options]       Change configuration
sprint [options]       Works with sprint boards
With no arguments, displays all rapid boards
With -r argument, attempt to find a single rapid board and display its active sprints
With both -r and -s arguments attempt to get a single rapidboard/ sprint and show its issues. If a single sprint board isnt found, show all matching sprint boards

Options:

-h, --help     output usage information
-V, --version  output the version number

Using Create

Usage: create [options] [project[-issue]]
	Options:

	-h, --help                      output usage information
	-p, --project <project>         Rapid board on which project is to be created
	-P, --priority <priority>       priority of the issue
	-T --type <type>                Issue type
	-s --subtask <subtask>          Issue subtask
	-t --title <title>              Issue title
	-d --description <description>  Issue description
	-a --assignee <assignee>        Issue assignee

Using jira new functionality

What does jira new offers

  • if you make issues very frequently then you can save multiple templates of default values with a key to call with in ~/jira/config.json . then you just have to do jira new KEY1 *
    "default_create" : {
	<!-- fields which you want to prompt every time  -->
	<!-- whenever you create a new issue -->
	"__always_ask" :{
	    "fields" :{
		"description" :{}, <!-- description would be prompted everytime -->
		"priority": {}	   <!-- priority would be prompted every time -->
	    }
	},
	<!-- you will do jira new KEY1 to use this template of default values -->
	"KEY1" : {
	    "project": "YOUR_PROJECT", <!-- mandatory -->
	    "issueType": 3,			   <!-- mandatory -->
	    "default" : {
			"components": [{
				"id": "15226"
			}],
			"customfield_12901" : "infrastructure",
			"customfield_10008" : "MDO-9584",
			"customfield_12902": {
				"id": "11237"
			},
			<!-- in this case, this customfield corresponds to cc-->
			<!-- , so when creating new jira with this template-->
			<!-- every iissue would have username prakhar in cc-->
			"customfield_10901": [{ <!-- how to give usernames -->
				"name": "prakhar"	
			}]
	    },
	"quick" : { <!-- another template shortcut -->
	
		},
	"SOME_ALIAS" :{ <!-- yet another template shortcut -->
	
		}
	},
}
  • Now there are 2 portions of default_create config
    • __always_ask : it contains the fields which would always be prompted when you create an issue. For eg. in above given json , whenever we'll create a new issue , description and priority would always be asked along with other mandatory fields for the board.
    • Rest of the keys in default_create are the shortcut keys which you will refer to while calling jira new key

Using jira edit functionality

This jira edit functionality is in beta phase and only few type of fields are allowed to be edited. currently only items of type strings are supported

  • jira edit JRA-254

(0) Summary (1) Issue Type (2) Component/s (3) Dev Estimate (4) Description (5) Fix Version/s (6) Priority (7) Labels (8) Code Reviewer (9) Sprint (10) Epic Link (11) Attachment (12) Depn Team (13) CC (14) Due Date (15) Linked Issues (16) Comment (17) Assignee enter Input 7 labels Enter value testlabel1,testlabel2 Issue edited successfully!

```
  • to edit jira in non interactive mode, giving field to be edited and its values is possible.

fields{ summary {…} issuetype {…} components {…} customfield_12000 {…} description {…} fixVersions {…} priority {…} labels { required false schema { type "array" items "string" system "labels" } name "Labels" autoCompleteUrl "https://jira.com….0/labels/suggest?query=" operations […] } customfield_11600 {…} customfield_10007 {…} customfield_10008 {…} attachment {…} customfield_11901 {…} customfield_10901 {…} duedate {…} issuelinks {…} comment {…} assignee {…} } ``` * jira edit JRA-254 "FIELD_NAME::FIELDVALUES" * Fieldnames can be hard to remember when using on command line, so you can save these field names in ~/.jira/config.json . Suppose the response of edit meta is

``` json
 fields	{
	summary	{…}
	issuetype	{…}
	components	{…}
	customfield_12000	{…}
	description	{…}
	fixVersions	{…}
	priority	{
		required	false
		schema	{
			type	"priority"
			system	"priority"
		}
		name	"Priority"
		operations	[…]
		allowedValues	{
		0	{
			self	"https://jira.com/rest/api/2/priority/1"
			iconUrl	"https://jira.com…/priorities/critical.svg"
			name	"Highest"
			id	"1"
			},
		1	{
			self	"https://jira.com/rest/api/2/priority/2"
			iconUrl	"https://jira.com…cons/priorities/high.svg"
			name	"High"
			id	"2"
			}
		2	{,
			self	"https://jira.com/rest/api/2/priority/3"
			iconUrl	"https://jira.com…ns/priorities/medium.svg"
			name	"Medium"
			id	"3"
			},
		3	{
			self	"https://jira.com/rest/api/2/priority/4"
			iconUrl	"https://jira.com…icons/priorities/low.svg"
			name	"Low"
			id	"4"
			},
		4	{
			self	"https://jira.com/rest/api/2/priority/5"
			iconUrl	"https://jira.com…ns/priorities/lowest.svg"
			name	"Lowest"
			id	"5"
			}
		5	{…}
		6	{…}
		7	{…}
		8	{…}
		9	{…}
	}
	labels	{…}
	customfield_11600	{…}
	customfield_10007	{…}
	customfield_10008	{…}
	attachment	{…}
	customfield_11901	{…}
	customfield_10901	{…}
	duedate	{…}
	issuelinks	{…}
	comment	{…}
	assignee	{…}
}

```
  • In above meta priority corresponds to CC field. So settign its default value in config.json would be
  "edit_meta": {
  	"__default": { <!-- would work like "jira CART-2047 alias_for_high" would change the priority of task to high -->
  		"alias_for_high": {
  			"fields": {
  				"priority": {
  					"id": "2"
  				}
  			}
  		}
  	},
  	"sprint": {
  		"key": "customfield_10007"
  	},
  	"alias_for_label": { <!-- would work "jira edit CART-2047 alias_for_label::label1,label2" -->
  		"key": "labels",
  		"default": {
  			"test1": "t1,t2"
  		}
  	}
  },
  • entries in edit_meta are as follows
    • __default : corresponds to raw put body we can put in config.json, which is passed as it is to the put call to jira edit api.
    • Other keys at the level of __default are alias for fields which can be used as shortform for bigger named keys. Eg. jira edit JRA-546 "sprint::123" would first check alias for key sprint in edit_meta , if found it picks the key field from the alias. and makes a put call corresponding to the actual key that has been stored.
      • key : actual key to which call is made to edit
      • default : if input value is not given corresponding to a key , for eg. jira edit JRA-354 alias_for_label , then it picks this default key from config.json as though the input was given from commandline. It would act as if the command issued was jira edit JRA-354 "alias_for_label::t1,t2"
  • remember that enties in __default should be of form alias: {...actual json.. }

Jira mark functionality to mark a jira as done,blocked, invalid etc jira mark JRA-123

There are multiple other jira transitions beside done,invalid,start,stop etc which are directly supported as jira done JRA-123 or jira invalid JRA-786 etc.

  • Sometimes some jira do not change transition into these states directly due to defined workflow. They can go into certain states only from current state. In these cases or in general you can use jira mark functionality. It works as follows jira mark CART-2047

    $> jira mark JRA-2047
    (71) Blocked
    (91) Invalid
    (141) Done(No Prod Deply)
    (181) Wontfix
    (251) Duplicate
    (291) Partner Issue
    (301) Other tech team issue
    (241) Reopen
    Enter transition 251
    	
  • Above mentioned input would mark the task JRA-2047 as duplicate.

How to know the fields metadata for a project/rapidboard

Using Jira JQL

  • get issues for jql eg. jira jql "YOUR_JQL_OR_JQL_SHORTCUT" when using a particular jql frequently , you can save that jql in ~/.jira/config.json,an example jql is saved there with key reported

  • eg . jira jql reported would run the jql written against reported key [saved by default ] in ~/.jira/config.json

    Usage: jql [options] [query]
    	Options:
      
        -h, --help           output usage information
        -c, --custom <name>  Filter by custom jql saved in jira config
    

Using jira sprint functionality, you can

  • get issues tagged in a sprint eg. jira sprint -r YOUR_RAPIDBOARD -s STRING_TO_SEARCH_IN_SPRINT_NAME
  • tag an issue in a sprint eg. jira sprint -a YOUR_ISSUE_KEY -i YOUR_SPRINT_ID
  • tag multiple issues from JQL to a sprint . Eg. jira sprint -j YOUR_JQL_OR_JQL_SHORTCUT -i YOUR_SPRINT_ID

Usage: sprint [options]

Options:	
-h, --help                  output usage information
-r, --rapidboard <name>     Rapidboard to show sprints for
-s, --sprint <name>         Sprint to show the issues
-a, --add <projIssue>       Add project issue to sprint
-i, --sprintId <sprintId>   Id of the sprint
-j, --jql <jql>             Id of the sprint
  • Suppose you want to move all of your pending issues which are present in previous sprint and not marked done . Given that customfield_10007 corresponds to sprint. following jira jql -c "cf[10007]=1787 and assignee=aman6.jain and status not in ('invalid','done')" gives the issues which are not done in sprint with id 1787 . now you can use this jql to mark them moved to new sprint as jira sprint -i 1890 -j "cf[10007]=1787 and assignee=aman6.jain and status not in ('invalid','done')" . And all issues would move to sprint with id 1890.

searching issues

if you want to search a text in all the issues

  • using jira search jira jql search SEARCH_TERM
  • using jira jql [recommended] jira jql "summary ~ SEARCH_TERM OR description ~ SEARCH_TERM"

how to use username alias/nicknames with cmd-jira

  • find users username

  • save the username alias/nickname in user_alias block of ~/.jira/config.json .

    • for eg. if username is [email protected] and you choose nickname as palash then your user_alias map would look like
    	{
    		"user_alias" :{
    			"nickname1" : "username of user 1",
    			"nickname2" : "username 2"
    		}
    	}
    • now you can use the nickname in following commands
      • to add watchers jira watch MPP-948 nickname1
      • to tag some one in comment jira comment MPP-948 "[~nickname2] you are tagged in this comment"
      • assigning an issue to someone using nickname jira assign MPP-948 nickname1 would assign MPP-948 to nickname1 user.

finding username

  • to find a user's username
    • browse to their profile on jira
    • under their avatar/photo is a field called Username
    • this is the user's username which you should use.

Explaining ~/.jira/config.json

  • auth : here the basic authentication information is stored. You would need to change it if url of your jira is changed.

    • example block
    	"auth": {
    		"token": "AUTO_GENERATED_TOKEN_FROM_PASSWORD",
    		"url": "YOUR_JIRA_URL",
    		"user": "YOUR_JIRA_EMAIL"
    	}
    • mostly you wont need to touch this block, only when your username or password changes then you'll have to reconfigure it using jira config command.
  • custom_jql: here you will store the jql to get the type of issues you frequently want to see and monitor in single command. eg. jira jql reported would give the issues corresponding to jql saved against reported key in custom_jql by default.

    • example block
    	"custom_jql": {
    		"mpp": "project=MPP and status !=done",
    		"reported": "reporter=currentUser() and status not in ('Done', 'Invalid')",
    	},
    
    • now you can use this jql in multiple commands
      • listing jql issues jira jql reported
      • adding all issues in jql to a sprint id jira sprint -j reported -i SPRINT_ID
  • default_create : now this is part of the jira new functionality, in which you can configure templates in config.json, so when you create a new jira, default values are picked from templates and other required fields or fields which you have declared mandatory are prompted for your input.

  • edit_meta

  • options

    • list_issues_columns: definitions of the columns used in displaying the issues with jira ls or jira list. Default columns are Key, Priority, Summary and Status. Keys are the column headers. Values are object with:
      • jsPath the path in the JSON of an issue (returned by a call to rest/api/2/search?jql=assignee=currentUser(), example given in Using jira edit functionality)
      • defaultValue (optional) if the field is not present or its value is equivalent to false (zero, null or ""), the default value will be used instead
      • isDate (optional) mark that the value is a date and should be formatted accordingly
      • isDuration (optional) mark that the value is a duration (like 2h or 3d) and should be formatted accordingly
      • truncate (optional) length that string values should not exceed. If they do they'll be truncated.
        "list_issues_columns": {
          "Key": {
            "jsPath": "key"
          },
          "Priority": {
            "jsPath": "fields.priority.name",
            "defaultValue": ""
          },
          "Summary": {
            "jsPath": "fields.summary",
            "truncate": 50
          },
          "Status": {
            "jsPath": "fields.status.name"
          },
          "Estimate": {
            "jsPath": "fields.progress.total",
            "isDuration": true
          },
          "Logged": {
            "jsPath": "fields.progress.progress",
            "isDuration": true
          },
          "Created": {
            "jsPath": "fields.created",
    	    "isDate": true
          }
        }
    • work_hours_in_day: number of hours in the working days as setup in JIRA.

Each command have individual usage help (using --help or -h)

Advanced options

Checkout ~/.jira/config.json for more options.

MIT License

Copyright (c) 2013 [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

jira-cmd's People

Contributors

afanasy avatar coreytrombley avatar drusellers avatar dvcrn avatar edeweerd1a avatar elwynelwyn avatar germanrcuriel avatar hungvietdo avatar johnnadratowski avatar ktilcu avatar laboshinl avatar natpicone avatar palashkulsh avatar pgilad avatar renato-bohler avatar richardbronosky avatar schmkr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

jira-cmd's Issues

Error for all methods, node -v – v0.10.28, OSX

Mac-mini-seryh:~ seryh$ jira search 166

/usr/local/lib/node_modules/jira-cmd/lib/jira/ls.js:25
return console.log(res.body.errorMessages.join('\n'));
^
TypeError: Cannot call method 'join' of undefined
at /usr/local/lib/node_modules/jira-cmd/lib/jira/ls.js:25:55
at Request.callback (/usr/local/lib/node_modules/jira-cmd/node_modules/superagent/lib/node/index.js:586:3)
at Request. (/usr/local/lib/node_modules/jira-cmd/node_modules/superagent/lib/node/index.js:133:10)
at Request.EventEmitter.emit (events.js:95:17)
at Stream. (/usr/local/lib/node_modules/jira-cmd/node_modules/superagent/lib/node/index.js:714:12)
at Stream.EventEmitter.emit (events.js:117:20)
at Unzip. (/usr/local/lib/node_modules/jira-cmd/node_modules/superagent/lib/node/utils.js:120:12)
at Unzip.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:919:16
at process._tickCallback (node.js:419:13)

Crash on empty field

If I run "jira show -o duedate PRO-373" where PRO-373 has a due date, then this date is returned. If I then remove the due date from PRO-373 (or select another issue without due date), then jira-cmd crashes:

% jira show -o duedate PRO-373
2015-10-15
% jira show -o duedate PRO-373
/home/meme/bin/node.js/node-v0.12.0-linux-x64/lib/node_modules/jira-cmd/lib/jira/describe.js:31
              console.log(res.body.fields[field].name);
                                                ^
TypeError: Cannot read property 'name' of null
    at /home/meme/bin/node.js/node-v0.12.0-linux-x64/lib/node_modules/jira-cmd/lib/jira/describe.js:31:49
    at Request.callback (/home/meme/bin/node.js/node-v0.12.0-linux-x64/lib/node_modules/jira-cmd/node_modules/superagent/lib/node/index.js:586:3)
    at Request.<anonymous> (/home/meme/bin/node.js/node-v0.12.0-linux-x64/lib/node_modules/jira-cmd/node_modules/superagent/lib/node/index.js:133:10)
    at Request.emit (events.js:107:17)
    at IncomingMessage.<anonymous> (/home/meme/bin/node.js/node-v0.12.0-linux-x64/lib/node_modules/jira-cmd/node_modules/superagent/lib/node/index.js:714:12)
    at IncomingMessage.emit (events.js:129:20)
    at _stream_readable.js:908:16
    at process._tickCallback (node.js:355:11)

I have jira-cmd 0.4.1 and JIRA 6.3.13

jira ls No issues

jira -V
v0.5.4

node -v
v8.16.0

Then, config per steps:

Jira URL: https://co.atlassian.net/
Username: [email protected]
Password:
Information stored!

Then:

jira ls
No issues
$ jira config

TypeError: callback is not a function
    at Object.setConfig (/Users/liftco/.nvm/versions/node/v8.16.0/lib/node_modules/jira-cmd/lib/auth.js:62:24)
    at Command.<anonymous> (/Users/liftco/.nvm/versions/node/v8.16.0/lib/node_modules/jira-cmd/bin/jira.js:364:22)
    at Command.<anonymous> (/Users/liftco/.nvm/versions/node/v8.16.0/lib/node_modules/jira-cmd/node_modules/commander/index.js:254:8)
    at emitTwo (events.js:126:13)
    at Command.emit (events.js:214:7)
    at Command.parseArgs (/Users/liftco/.nvm/versions/node/v8.16.0/lib/node_modules/jira-cmd/node_modules/commander/index.js:471:12)
    at Command.parse (/Users/liftco/.nvm/versions/node/v8.16.0/lib/node_modules/jira-cmd/node_modules/commander/index.js:378:15)
    at /Users/liftco/.nvm/versions/node/v8.16.0/lib/node_modules/jira-cmd/bin/jira.js:402:13
    at Object.execCb (/Users/liftco/.nvm/versions/node/v8.16.0/lib/node_modules/jira-cmd/node_modules/requirejs/bin/r.js:1941:33)
    at Module.check (/Users/liftco/.nvm/versions/node/v8.16.0/lib/node_modules/jira-cmd/node_modules/requirejs/bin/r.js:1116:51)

Previously (yesterday), this was working fine. I even uninstalled via npm and rm -rf ~/.jira/config.json. Same results, No issues.

It appears the callback in setConfig is undefined at jira-cmd/lib/auth.js:63:24:

setConfig: function (callback) {
            var that = this;
            if (this.checkConfig()) {
                this.updateConfig();
                console.log('callback', callback); // callback undefined
                return callback(true);
            } else {
                if (!fs.existsSync(this.cfgPath)) {
                    fs.mkdirSync(this.cfgPath);
                }

I love this CLI tool, any tips on how to debug?

List issues by favorite filter

I run jira ls and I get an error message that there is no value 'In Review' for field 'status'. Apparently this is due to a specific set of statuses in our Jira.

I have a filter 'My Issues' in Jira where the list of issues is configured. I found a temporary solution by replacing the + '+AND+status+in+(Open,"In+Progress",Reopened,"To+Do","In+Review")'with + '+AND+filter=12308' in the lib/jira/js.js .

It would be useful to be able to choise the favorite filter at the configuration stage to list issues.

Worklogadd doesn't work

The #35 lists my setup. Once I made jira-cmd work, I created the issue from the Web GUI.

It's called CS-519.

Next I do:

jira worklogadd CS-519 3h something

I don't see these changes reflected in the Web GUI. It seems like nothing has been changed. Output on the console:

wkoszek|19:07:07|0|/Users/wkoszek/.jira$ jira worklogadd CS-519 3h something
Worklog to issue [CS-519] was added!.

ECONNREFUSED

When I run any command correctly, I'm getting the following error:

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED xxx.xxx.xxx.xxx:443
    at Object.exports._errnoException (util.js:1020:11)
    at exports._exceptionWithHostPort (util.js:1043:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1086:14)

Do I need to need to enable anything in Jira to allow secure requests?

Configuration should be stored in the user's profile directory

For Windows environments, the configuration file(s) should be stored in the user's profile directory, be it the local or roaming profile. These would be the APPDATA environment variable (roaming profile, can be "transported" across PCs) or the APPDATALOCAL, which is the user's machine-specific profile directory.

In Windows, the HOME* environment variables (home, homedrive, homepath, homeshare) are values which are set when the user is authenticated via AD, which means that any user who run the script on Windows from a non-AD connected system is likely to run into several issues, mostly that computing the .jira configuration directory will result in being the equivalent of ./.jira, or possibly also /.jira. The latter, for non-priviledged accounts, would fail catastrophically. For priviledged users on shared systems, that could lead to their credentials being used by other users, not to mention the credentials also being compromised for anyone savvy enough to figure out the the source of the data, and how to reverse it.

jira-cmd "create" doesn't work

I do:

npm install -g jira-cmd
jira ls
[put pass/user/URL]
jira ls <- breaks because of "In Review" stage present in ~/.jira/config.json
[ edit ~/.jira/config.json and remove "In Review" stage]
jira ls <- starts to work fine.

Now I want to create a bug case:

$ jira create
Type the project name or key: CS
Type the parent task key (only the numbers) if exists, otherwise press enter:
(1) Bug
(2) New Feature
(3) Task
(4) Improvement
(10000) Epic
(10001) Story
Select issue type: 1
Type the issue title: "we"
Type ths issue description: "f"
(1) Highest
(2) High
(3) Medium
(4) Low
(5) Lowest
Select the priority: 2
/usr/local/lib/node_modules/jira-cmd/lib/jira/create.js:270
return console.log(res.body.errorMessages.join('\n'));
^
TypeError: Cannot read property 'join' of undefined
at /usr/local/lib/node_modules/jira-cmd/lib/jira/create.js:273:54
at Request.callback (/usr/local/lib/node_modules/jira-cmd/node_modules/superagent/lib/node/index.js:586:3)
at Request. (/usr/local/lib/node_modules/jira-cmd/node_modules/superagent/lib/node/index.js:133:10)
at Request.emit (events.js:107:17)
at IncomingMessage. (/usr/local/lib/node_modules/jira-cmd/node_modules/superagent/lib/node/index.js:714:12)
at IncomingMessage.emit (events.js:129:20)
at _stream_readable.js:908:16
at process._tickCallback (node.js:355:11)

I added some printouts:

267 .end(function (res) {
268 //console.log("--res--\n");
269 //console.log(res);
270 if (!res.ok) {
271 //console.log(config.auth.token);
272 console.log(res.body.errorMessages);
273 return console.log(res.body.errorMessages.join('\n'));
274 }

271 shows good auth token. jira ls shows me JIRA issues etc.
272 shows undefined.
269 shows whole bunch of sensitive data.

Weird:

    _header: 'GET /rest/api/2/issue HTTP/1.1\r\nHost: tpjira.atlassian.net\r\naccept-encoding: gzip, deflate\r\nCookie: \r\nauthorization: ........<token is here>

And it's getting:

   text: '<!DOCTYPE html><html><head><title>Apache Tomcat/8.0.20 - Error report</title><style type="text/css">H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}.line {height: 1px; background-color: #525D76; border: none;}</style> </head><body><h1>HTTP Status 405 - Method Not Allowed</h1><div class="line"></div><p><b>type</b> Status report</p><p><b>message</b> <u>Method Not Allowed</u></p><p><b>description</b> <u>The specified HTTP method is not allowed for the requested resource.</u></p><hr class="line"><h3>Apache Tomcat/8.0.20</h3></body></html>'

Which is expected, since Apache says it supports either POST or OPTIONS.

I'd expect this code to be issuing POST request, not GET request.

Add support for "log work" action

We use the timetracking feature of jira a lot, would be awesome be able to do something like:

jira log-work <issue> 90m 'fixed some bugs' or something.

NODE_TLS_REJECT_UNAUTHORIZED is set to 0 by default

https://github.com/germanrcuriel/jira-cmd/blob/8353dfdd2ae86757135e9985aabd38d66810186f/lib/config.js#L6

I don't think this should be here at all. A better idea would be to enable TLS check by default and let people disable it manually in a config file of sorts or inform them they should add their CA for self-signed certificates using NODE_EXTRA_CA_CERTS variable.

I understand some are having issues with their self-hosted Jira instances and everything, but most of us would prefer to make security decisions ourselves. Disabling this security feature for everyone is a bad choice.

jira done improvements

Hi @germanrcuriel I did a few improvements to jira done command but I'm going to wait for #33 to be ok to merge.

The feature that I'm going to introduce is the following:
screen shot 2015-05-18 at 5 36 20 pm

Resolution

When -r is absent, the most relevant would be assumed as defined in:
screen shot 2015-05-18 at 5 37 58 pm
https://confluence.atlassian.com/display/JIRA/Defining+Resolution+Field+Values

If an invalid resolution was informed the following will appear:
screen shot 2015-05-18 at 5 39 47 pm

Time Spent

The -t flag is also optional and if present we will automatically add a worklog to that issue. If abscent, nothing about time management would be done.

What do you think?

jira stop issue

Seems like jira Agile doesn't have the transition "To Do". Te correct name for it would be "Stop Progress". So the command jira stop doesn't work...

Sounds good to have a config like this:

{
  "auth": {
    "url": "https://my.jira.net.br/",
    "user": "user",
    "token": "token"
  },
  "options": {
    "jira_stop": {
      "status": "Stop Progress"
    },
    "jira_start": {
      "status": "In Progress"
    },
    "jira_review": {
      "status": "In Review"
    },
    "jira_done": {
      "status": "Done"
    },
    "available_issues_statuses": [
      "Open",
      "In Progress",
      "Reopened",
      "To Do"
    ]
  }
}

What do you think?

The value 'In Review' does not exist for the field 'status'.

Turns you that you expect that a status called "In Review" here we only have To Do, In Progress and Done. Would be interesting if those status could be in a config file stored along with our credentials.

The only way to work around this issue is by changing the line:
+ '+AND+status+in+(Open,"In+Progress",Reopened,"To+Do","In+Review")'

Customize jira jql output columns

If I visit foo.atlassian.net/issues/?filter=10062 I can write some JQL in the GUI. I can also select the columns which get displayed.

I would like to likewise set the output columns. Currently the output columns are:

Key
Priority
Summary
Status

Say I want to include Epic Link and Assignee here, how would I do this? If you point to a starting point in the codebase I can probably create PR to add this functionality if not already existing :D.

problems using it under a "hosted" jira

Hi,

I'm not using a "cloud" version of Jira, here we have a hosted version and it's connected to Active Directory.

I've setup the correctly, answering all questions asked.

After running jira ls I got this error: UNABLE_TO_VERIFY_LEAF_SIGNATURE. I could work around this issue by setting an env variable:
export NODE_TLS_REJECT_UNAUTHORIZED=0

Now I'm getting the error: AUTHENTICATION_DENIED but my credentials are fine. The same used in the web interface.

Any ideas?

node version 0.10.26

How to add line break and special character on log work?

Thanks for this tool. It is really handy and saved my time.

I've successfully logged my work and time.

I usually write my task in detail using line break and '-' character, but I found I can't use them.
Is there any solution for this?

One more question, what is date format for start date?

Thanks!

jira ls - no issues

I am also getting the "no issues" bug when running

jira ls

I saw that there is another recent similar issue that was closed 8 days ago here https://github.com/germanrcuriel/jira-cmd/issues/75 however the fix won't work for me since we are using a hosted jira so the link on how to get the token is not relevant.

Any ideas how I can get this tool working?

Support 2 factor auth

Tried logging in and it asked for a password which I gave. Never asked for a 2fa token. Fails with "Error: got 401 response" on attempt at ls cmd.

"can't set raw mode on non-tty" when adding username

When I run jira and try to input my username, I get back the error:

(node) tty.setRawMode is deprecated. Use process.stdin.setRawMode     instead.
    tty.js:20
    throw new Error('can\'t     set raw mode on non-tty');
        ^

Error: can't set raw mode on     non-tty
    at Object.<anonymous> (    tty.js:20:11)
at Object.deprecated (    internal/util.js:55:15)
at setRawMode (C:\Users\dgolant\AppData\Roaming\nvm\v4.4.5\node_modules\jira-cmd\node_modules\commander\    index.js:945:11)
at Command.password (C:\Users\dgolant\AppData\Roaming\nvm\v4.4.5\node_modules\jira-cmd\node_modules\comm    ander\index.js:948:3)
at Object.Auth.ask (C:\Users\dgolant\AppData\Roaming\nvm\v4.4.5\node_modules\j    ira-cmd\lib\auth.js:36:17)
at C:\Users\dgolant\AppData\Roaming\nvm\v4.4.5\node_modules\jira-cmd\lib\auth.    js:70:18
at C:\Users\dgolant\AppData\Roaming\nvm\v4.4.5\node_modules\jira-cmd\lib\auth.    js:46:13
at Socket.<anonymous> (C:\Users\dgolant\AppData\Roaming\nvm\v4.4.5\node_modules\jira-cmd\node_modules\co    mmander\index.js:830:5)
at Socket.g (    events.js:260:16)
at emitOne (    events.js:77:13)

Changing config on existing profile error

~ ⍉ ➜ jira config                
Jira URL: https://some.atlassian.net
Username: admin
Password: 
Information stored!
~ ➜ jira ls                    
Error: got 401 response
~ ➜ rm -rf  ~/.jira/config.json
~ ⍉ ➜ jira config
[TypeError: callback is not a function]

worklogadd

Would it be easy to add the date of a worklog?

Installing it with yarn leads to a crash on it's initial run

Happens on the first run.

TypeError: program.prompt is not a function
    at Object.ask (/Users/furkantunali/.config/yarn/global/node_modules/cmd-jira/lib/auth.js:48:25)
    at Object.setConfig (/Users/furkantunali/.config/yarn/global/node_modules/cmd-jira/lib/auth.js:68:22)
    at Command.<anonymous> (/Users/furkantunali/.config/yarn/global/node_modules/cmd-jira/bin/jira.js:48:18)
    at Command.listener (/Users/furkantunali/.config/yarn/global/node_modules/commander/index.js:315:8)
    at Command.emit (events.js:182:13)
    at Command.parseArgs (/Users/furkantunali/.config/yarn/global/node_modules/commander/index.js:651:12)
    at Command.parse (/Users/furkantunali/.config/yarn/global/node_modules/commander/index.js:474:21)
    at /Users/furkantunali/.config/yarn/global/node_modules/cmd-jira/bin/jira.js:404:13
    at Object.execCb (/Users/furkantunali/.config/yarn/global/node_modules/requirejs/bin/r.js:1941:33)
    at Module.check (/Users/furkantunali/.config/yarn/global/node_modules/requirejs/bin/r.js:1116:51)```

jira ls - List "New" issues

Hi all!

When I execute "jira ls", I only see "In Progress" issues. Is possible to see "New" and "Closed" issues?

If jira cloud does not support subtasks, shows an error

I'm working with an older jira cloud project that tracks issues for an open-source project (so maybe isn't getting latest jira software because on a free plan?) Anyway, when I run jira show CORE-1110 I get an error:

/usr/lib/node_modules/cmd-jira/lib/jira/describe.js:75
            {'Subtasks': res.body.fields.subtasks.length},
                                                 ^

TypeError: Cannot read property 'length' of undefined
    at /usr/lib/node_modules/cmd-jira/lib/jira/describe.js:75:50
    at Request.callback (/usr/lib/node_modules/cmd-jira/node_modules/superagent/lib/node/index.js:586:3)
    at Request.<anonymous> (/usr/lib/node_modules/cmd-jira/node_modules/superagent/lib/node/index.js:133:10)
    at emitOne (events.js:77:13)
    at Request.emit (events.js:169:7)
    at Stream.<anonymous> (/usr/lib/node_modules/cmd-jira/node_modules/superagent/lib/node/index.js:714:12)
    at emitNone (events.js:72:20)
    at Stream.emit (events.js:166:7)
    at Unzip.<anonymous> (/usr/lib/node_modules/cmd-jira/node_modules/superagent/lib/node/utils.js:120:12)
    at emitNone (events.js:72:20)

I changed line 75 of cmd-jira/lib/jira/decsribe.js to this in my local install:

            {'Subtasks': (res.body.fields.subtasks ? res.body.fields.subtasks.length : "")},

and that fixed it. If I have time later today I'll submit a PR.

Default board functionality for jira sprint?

Hi @germanrcuriel
Do you think that a feature like "default board" for jira sprint command would be useful?

My main goal here it's to make possible to just type jira sprint with no arguments.

The board would be inherited from the default_board option when there is no -r flag passed. Also the -s, when absent, we will assume that it would be the current active sprint.

In my scenario we only use one board and it's really annoying having to carry that -r flag a all the time along with the -s.

What do you feel about that? Do you think that it is only me or usually people frequently switch between boards via command line?

request: preset jql cmds

couldn't find support for extending the commandset
So I fixed this for now using this bash-wrapper

#!/bin/bash
# bash wrapper with preset-support for https://www.npmjs.com/package/jira-cmd

if [[ ! -n $1 ]]; then 
  jira | while IFS='' read line; do 
    echo "$line"
    [[ "$line" =~ "Works with sprint boards" ]] && { grep ") #" $0 | sed 's/) #//g'; }
  done | grep -vF "[[" # why this last grep?
  exit 0 
fi
{
  case "$1" in

    last) #                   Shows issues since last week
          jira jql "created > $(date --date="last week" +"%Y-%m-%d" | tr "[:upper:]" "[:lower:]" ) and created < $(date --date="tomorrow" +"%Y-%m-%d" | tr "[:upper:]" "[:lower:]" )"
          ;;
    *)
          jira "$@"
          ;;
  esac
} | grep -v '─' | more -R

Example


  Usage: jira [options] [command]

  Commands:

    ls [options]           List my issues
    start <issue>          Start working on an issue.
    stop <issue>           Stop working on an issue.
    review <issue> [assignee] Mark issue as being reviewed [by assignee(optional)].
    done [options] <issue> Mark issue as finished.
    running                List issues in progress.
    jql <query>            Run JQL query
    search <term>          Find issues.
    assign <issue> [user]  Assign an issue to <user>. Provide only issue# to assign to me
    comment <issue> [text] Comment an issue.
    show [options] <issue> Show info about an issue
    open <issue>           Open an issue in a browser
    worklog <issue>        Show worklog about an issue
    worklogadd [options] <issue> <timeSpent> [comment] Log work for an issue
    create [project[-issue]] Create an issue or a sub-task
    config [options]       Change configuration
    sprint [options]       Works with sprint boards
--> last                   Shows issues since last week                                                 
    With no arguments, displays all rapid boards
    With -r argument, attempt to find a single rapid board and display its active sprints
    With both -r and -s arguments attempt to get a single rapidboard/ sprint and show its issues. If a single sprint board isnt found, show all matching sprint boards

  Options:

    -h, --help     output usage information
    -V, --version  output the version number

but would be nice as a native feature

Config Upgrade Path

Just tried out #28 locally and am getting:

C:\Projects\jira-cmd\lib\jira\ls.js:64
      var statuses = config.options.available_issues_statuses.join('", "')
                                   ^
TypeError: Cannot read property 'available_issues_statuses' of undefined
    at Object.ls.showAll (C:\Projects\jira-cmd\lib\jira\ls.js:64:36)
    at C:\Projects\jira-cmd\bin\jira.js:37:16
    at Object.Auth.setConfig (C:\Projects\jira-cmd\lib\auth.js:51:16)
    ...

Maybe provide a config upgrade path, @igorescobar?

[Cancelled] Confirm about "jira ls, jira running"

What is your jql for jira ls and jira running?
I have alot of issue in my projects but when I run jira ls or jira running in terminal it return

No issues 

Even when I run jira jql reported with the builtin reported jql query, it return No issues but if I copy&paste the reported jql to web and click search, it return many (2345 issues)
Here is my setting in config.json and my issues in server.
setting in config.json
issues in server

jira done <issue> doesn't work

Hi,

When calling jira done <issue>, I get no output whatsoever.

A query made with jira jql confirms that the task is still In Progress.

I can use jira stop and jira start correctly though

worklog doesn't work

Hi, I encountered this problem with worklog subcommand:

jira.js worklog APM-42231
/home/kokos/foo/jira-cmd/node_modules/cli-table/lib/cli-table/index.js:180
      var contents = item.toString().split("\n").reduce(function (memo, l) {
                          ^
TypeError: Cannot call method 'toString' of undefined
    at /home/kokos/foo/jira-cmd/node_modules/cli-table/lib/cli-table/index.js:180:27
    at Array.forEach (native)
    at generateRow (/home/kokos/foo/jira-cmd/node_modules/cli-table/lib/cli-table/index.js:179:11)
    at /home/kokos/foo/jira-cmd/node_modules/cli-table/lib/cli-table/index.js:273:16
    at Table.forEach (native)
    at Table.toString (/home/kokos/foo/jira-cmd/node_modules/cli-table/lib/cli-table/index.js:256:10)
    at /home/kokos/foo/jira-cmd/lib/jira/worklog.js:75:27
    at Request.callback (/home/kokos/foo/jira-cmd/node_modules/superagent/lib/node/index.js:586:3)
    at Request.<anonymous> (/home/kokos/foo/jira-cmd/node_modules/superagent/lib/node/index.js:133:10)
    at Request.emit (events.js:95:17)
    at IncomingMessage.<anonymous> (/home/kokos/foo/jira-cmd/node_modules/superagent/lib/node/index.js:714:12)
    at IncomingMessage.emit (events.js:117:20)
    at _stream_readable.js:944:16
    at process._tickCallback (node.js:442:13)

BTW, Did you plan further development of this package?

edit: adding to worklog works

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.