Coder Social home page Coder Social logo

jira-cli's Introduction

jira-cli's People

Contributors

afanasy avatar bowdi avatar coreytrombley avatar danshumaker avatar dependabot[bot] avatar drusellers avatar dvcrn avatar elwynelwyn avatar gems avatar germanrcuriel avatar hungvietdo avatar johnnadratowski avatar ktilcu avatar laboshinl avatar martinsantibanez avatar mikhaili avatar natpicone avatar palashkulsh avatar pgilad avatar schmkr avatar vitality-will-bowditch 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

Watchers

 avatar  avatar  avatar

jira-cli's Issues

Unable to persist data to Jira server.

I have been able to get this project set up and working so that I can pull info from my org's jira server instance. I have been unable to use this tool to persist any data back to the server. I've tried worklogs, comments, and editing fields. I'm being told that I should have permissions to updated via the api. Has this been reported before?

View issues with ls returns no issue when in reality api returned an error

my organization doesn't have the in review status setup, so when I try and list my issues using jira ls it says no issues.
this is what the response from the api looks like this, with a status of 400:

i tested this inside my browser and got the following error. When i removed the in review status, it worked.

{
  "errorMessages": [
    "The value 'In Review' does not exist for the field 'status'."
  ],
  "warningMessages": []
}

the jql sent over is:
assignee=currentUser() AND status in ("Open", "In Progress", "Reopened", "To Do", "In Review") order by key DESC

I was able to get around this by using a .filter directly inside the ls module on getAvailableStatuses - but I feel like if the api returns an error, something other than "No Issues" should be returned.

Unable to create issues

I have ran jira config successfully and now have an accesstoken in my ~/.jira-cli/config.json

I am able to list my issues and run arbitrary JQL.
The things i can't do is create new issues and edit them.

Running jira new --verbose yields a 404 not found.

   { Error: got 400 response
       at Response.toError (/home/my-username/tools/nodejs/lib/node_modules/jira-cli/node_modules/superagent/lib/node/response.js:100:13)
       at Response.setStatusProperties (/home/my-username/tools/nodejs/lib/node_modules/jira-cli/node_modules/superagent/lib/node/response.js:179:12)
       at new Response (/home/my-username/tools/nodejs/lib/node_modules/jira-cli/node_modules/superagent/lib/node/response.js:40:8)
       at IncomingMessage.<anonymous> (/home/my-username/tools/nodejs/lib/node_modules/jira-cli/node_modules/superagent/lib/node/index.js:712:22)
       at IncomingMessage.emit (events.js:194:15)
       at endReadableNT (_stream_readable.js:1103:12)
       at process._tickCallback (internal/process/next_tick.js:63:19) status: 400 },

That's a bad request from the default behavior of jira-cli.

Now, i checked the output more in detail and found a payload that is attempting to send

{ 
   "fields":{ 
      "project":{ 
         "id":"18100"
      },
      "issuetype":{ 
         "id":10002
      },
      "summary":"Test Testing Tested",
      "components":[ 
         { 
            "id":"23214"
         },
         { 
            "id":"23280"
         }
      ],
      "reporter":{ 
         "id":"mikael.ostberg"
      },
      "customfield_11801":{ 
         "id":"14628"
      }
   }
}

Notice the

      "reporter":{ 
         "id":"mikael.ostberg"
      },

Now the JIRA API Docs clearly states that the field for reporter should use name instead of id as reporter key. And if i set it using defaults to use name then i can create issues. However, editing them suffers from the same problem. I have a strong sensation that this line has something to do with it.

jira comment [options] <issue>,[text]

Hi,
Great work done with this library.
I am successfully able to send a comment to a jira case as I show it on the picture below:
image
I am new to javascript and there is no steps on my config.json file about: jira comment [options] <issue>,[text]
But it works fine for me.
However, is there any other way of running the comment command apart from that?
"test": "npx wdio run ./wdio.conf.js && jira comment JIR-571 [text]"
Any sample code to see it in action and for me to get some inspiration?

show custom field in `jira epic list EPIC-ID`

Hello,

thanks for this great tool! This is exactly what I have been looking for. Right now I am trying to show an epic with its tasks. These tasks have a custom field Story point estimate. I cannot figure out how to show the story points...

jira epic list HCS-3055 --plain --columns key,summary,status,story-point-estimate

This is what I thought should work after reading the information in the custom field PR, but it doesn't.

Suggestion: package.json

Hey I would like to add to project:
"start": "npm run global",
"dev": "node bin/jira.js",
"global": "npm i -g && jira",
"clean": "rimraf -rf ./.jira-cli"

Question: jira config

Jira config created in current working directory and not under current user directory (home directory)
Why not create under home directory?

dyld: Library not loaded

npm install -g jira-cli
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.66.dylib
Referenced from: /usr/local/bin/node
Reason: image not found
Abort trap: 6

Can this work with Google Authenticate?

I am getting 401s when I try to jira config with a company account that is authenticated through Google.

As expected, the combination of my email and password don't seem to work (although no login error shows up).

I then updated the config.json based on a custom API token from /id.atlassian.com/manage/api-tokens, and this also doesn't work. Any other tricks to try, or is this just not supported?

"npm WARN" deprecated dependencies identified when installing

Repro steps:

  1. open a zsh terminal application on MacOS, running node v14.15.4 and npm v7.19.0 (other versions of node and npm may also work)
  2. run: npm install -g jira-cli
  3. See the following "WARN" messages:
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142

added 194 packages, and audited 195 packages in 6s

24 packages are looking for funding
  run `npm fund` for details

4 low severity vulnerabilities

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

`TypeError: program.prompt is not a function` when running `jira config`

  • Using Node.js 10.15.3
  • Jira CLI 1.1.0

Output from jira config:

Did not find config file from JIRA_CONFIG environment variable or /Users/rummik/.jira-cli/config.json.

Setting one up in /Users/rummik/.jira-cli/config.json

TypeError: program.prompt is not a function
    at Object.ask (/Users/rummik/.config/yarn/global/node_modules/jira-cli/lib/auth.js:48:25)
    at Object.setup (/Users/rummik/.config/yarn/global/node_modules/jira-cli/lib/auth.js:63:22)
    at Command.<anonymous> (/Users/rummik/.config/yarn/global/node_modules/jira-cli/bin/jira.js:297:24)
    at Command.listener (/Users/rummik/.config/yarn/global/node_modules/commander/index.js:315:8)
    at Command.emit (events.js:189:13)
    at Command.parseArgs (/Users/rummik/.config/yarn/global/node_modules/commander/index.js:651:12)
    at Command.parse (/Users/rummik/.config/yarn/global/node_modules/commander/index.js:474:21)
    at /Users/rummik/.config/yarn/global/node_modules/jira-cli/bin/jira.js:373:13
    at Object.execCb (/Users/rummik/.config/yarn/global/node_modules/requirejs/bin/r.js:1941:33)
    at Module.check (/Users/rummik/.config/yarn/global/node_modules/requirejs/bin/r.js:1116:51)

View Issues Linked to an Epic

Hi,

It would be great if there would either be a new command, or a switch to the show command, or even automatic inference in the show command that would display the issues linked to an epic. I could also define JQL queries to do it using the jql command, but it's too much work to define a JQL for every single epic.

Check for authentication after config

When user changes configuration, the tool could check the authentication against the server for example by getting users issues and check if the connection works. If the connection does not work the tool could ask the authentication parameters again or just quit and remove the configuration file. Otherwise the tool just fails abnormally whatever command you run if your credentials don't work, for example the ls command:

/usr/local/lib/node_modules/jira-cli/lib/jira/ls.js:41
          if (!res.ok) {
                   ^

TypeError: Cannot read property 'ok' of undefined
    at /usr/local/lib/node_modules/jira-cli/lib/jira/ls.js:41:20
    at Request.callback (/usr/local/lib/node_modules/jira-cli/node_modules/superagent/lib/node/index.js:704:3)
    at ClientRequest.<anonymous> (/usr/local/lib/node_modules/jira-cli/node_modules/superagent/lib/node/index.js:637:10)
    at Object.onceWrapper (events.js:421:26)
    at ClientRequest.emit (events.js:314:20)
    at TLSSocket.socketErrorListener (_http_client.js:469:9)
    at TLSSocket.emit (events.js:314:20)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)

jira ls failing with error related to async package

After I connected the cli sucessfully via config command I ran into an issue when trying to query with ls command. see output below:

$ jira ls -v
https://[…redacted…].atlassian.net/rest/api/2/search?jql=assignee=currentUser()+AND+status+in+("Open", "In Progress", "Reopened", "To Do", "In Review")+order+by+key+DESC&maxResults=500&startAt=0&maxResults=500
/usr/lib/node_modules/jira-cli/node_modules/async/dist/async.js:966
        if (fn === null) throw new Error("Callback was already called.");
                         ^

Error: Callback was already called.
    at /usr/lib/node_modules/jira-cli/node_modules/async/dist/async.js:966:32
    at next (/usr/lib/node_modules/jira-cli/node_modules/async/dist/async.js:3022:18)
    at /usr/lib/node_modules/jira-cli/lib/jira/ls.js:47:18
    at Request.callback (/usr/lib/node_modules/jira-cli/node_modules/superagent/lib/node/index.js:704:3)
    at /usr/lib/node_modules/jira-cli/node_modules/superagent/lib/node/index.js:891:18
    at Stream.<anonymous> (/usr/lib/node_modules/jira-cli/node_modules/superagent/lib/node/parsers/json.js:17:7)
    at Stream.emit (events.js:315:20)
    at Unzip.<anonymous> (/usr/lib/node_modules/jira-cli/node_modules/superagent/lib/node/unzip.js:54:12)
    at Unzip.emit (events.js:315:20)
    at endReadableNT (internal/streams/readable.js:1327:12)

It may have to do with dependendant libraries and their management (uneducated guess from me). I'll attach versions for the core components, ask me if you need more:

node --version;
npm --version;
jira -V;
v14.15.3
6.14.9
2.4.0

Commander's description is colliding with --description arg

It looks like commander's description of the command and the JIRA argument --description are colliding. For example, if you were to console.log options['description'] here https://github.com/danshumaker/jira-cli/blob/master/bin/jira.js#L284, then you'll see the value is a [Function].

The end result is if you were to run jira new KEY, at this line https://github.com/danshumaker/jira-cli/blob/master/lib/jira/new.js#L294 options[eachFieldKey] for eachFieldKey = description, this comes out as true because of the [Function] and so the CLI does not ask for a description and tries to create a JIRA ticket without a description field which causes a 400 because this field is required.

I tried making this required in every possible way without any success.

Update dependencies

Right now installing the project gives a lot of deprecated packages warning.
Can we update some packages if possible? Willing to contribute if you need help.

Update alasql

Hi

Please update alasql to 0.7.0 or make sure you only use user created data by providing a parameter to alasql

jira jql --json flag doesn't do anything

When using the json flag with the jql command, nothing is outputted as when (.\lib\jira) ls (.js) .getIssues see's the json flag it short circuits to the callback, which in it's current state only outputs an error.

Error Number: -3008 | Message: getaddrinfo ENOTFOUND undefinedrest

Hi,
Has anyone encountered/solved this error?
A connection error occurred: Error Number: -3008 | Message: getaddrinfo ENOTFOUND undefinedrest
That error type may mean that host is expected without protocol?

steps

  • install jira-cli globally
  • get auth token from
  • jira config
    • prompt: "Jira URL: null"
  • Enter
  • prompt: Jira URL:
  • https://.atlassian.net
  • password: gfM***********************
  • verify that ~/.jira-cli/config.json has the expected url, & user. Note that it has some hash that is not the literal API token
"auth": {
    "url": "https://<mycompany>.atlassian.net",
    "user": "[email protected]",
    "token": "bW**************************************="
  },
  • jira ls
    A connection error occurred: Error Number: -3008 | Message: getaddrinfo ENOTFOUND undefinedrest

additional info

  • browser can resolve this: https://.atlassian.net/secure/BrowseProjects.jspa?selectedProjectType=software
Request Method: GET
Status Code: 200 
Remote Address: 18.246.31.139:443 <-- note the PORT 443 added for that document
Referrer Policy: same-origin

ping cannot resolve, and show a different IP address.

ping <mycompany>.atlassian.net
PING <mycompany>.atlassian.net (18.246.31.138): 56 data bytes
Request timeout for icmp_seq 0

I used Google as my auth provider when signing up for Jira at https://.atlassian.net

Commands handle config.auth.url differently

Some commands add a forward slash to the auth.url provided when configuring the url but not all of them.

Take jira worklog <issue> for example, this does not add a forward slash so when I set the url (we use Jira server) to our address I need to add the last forward slash for this to work i.e. set URL as 'https://company.com/jira/' which results in this endpoint https://company.com/jira/rest/api/latest/{issue}/worklog.

However, when using jira edit <issue> this adds in a backslash so the url that is generated with the above config results in https://company.com/jira//rest/api/2/issue/{issue}/editmeta.

`jira new` is broken: Circular stringify

Hello,
the stringify here causes the following error:

Error: TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'Command'
    |     property 'commands' -> object with constructor 'Array'
    |     index 0 -> object with constructor 'Command'
    --- property 'parent' closes the circle

version 2.0.0 throw exception on no config

throw exception, when no config

how to reproduce:
run jira for new user/ after jira config -c
jira-cli/bin/jira.js:52
host: config.authNew.host,
^
TypeError: Cannot read property 'host' of undefined
at Object. (/jira-cli/bin/jira.js:52:24)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

`TypeError: Cannot read property 'verbose' of null` when running `jira running`

Full stacktrace is:

TypeError: Cannot read property 'verbose' of null
    at ~/.nvm/versions/node/v11.11.0/lib/node_modules/jira-cli/lib/jira/ls.js:33:29
    at Object.doWhilst (~/.nvm/versions/node/v11.11.0/lib/node_modules/jira-cli/node_modules/async/dist/async.js:3024:5)
    at Object.callIssueApi (~/.nvm/versions/node/v11.11.0/lib/node_modules/jira-cli/lib/jira/ls.js:29:19)
    at Object.getIssues (~/.nvm/versions/node/v11.11.0/lib/node_modules/jira-cli/lib/jira/ls.js:63:18)
    at Object.showInProgress (~/.nvm/versions/node/v11.11.0/lib/node_modules/jira-cli/lib/jira/ls.js:139:25)
    at Command.<anonymous> (~/.nvm/versions/node/v11.11.0/lib/node_modules/jira-cli/bin/jira.js:129:16)
    at Command.<anonymous> (~/.nvm/versions/node/v11.11.0/lib/node_modules/jira-cli/node_modules/commander/index.js:254:8)
    at Command.emit (events.js:197:13)
    at Command.parseArgs (~/.nvm/versions/node/v11.11.0/lib/node_modules/jira-cli/node_modules/commander/index.js:471:12)
    at Command.parse (~/.nvm/versions/node/v11.11.0/lib/node_modules/jira-cli/node_modules/commander/index.js:378:15)

Basic auth with passwords is deprecated

I was really excited when I found this lib, but after running jira config and entering my credentials, I was getting "No issues" when running jira ls. Added some logging and found that a 401 is being returned with the message Basic authentication with passwords is deprecated. For more information, see: https://confluence.atlassian.com/cloud/deprecation-of-basic-authentication-with-passwords-for-jira-and-confluence-apis-972355348.html. Following that link, it says that change was June of 2019, although there is development and (unrelated) issues opened here since then, which makes me think it's been working for people. I tried swapping my password with an API token just to see if that would work, but it did not.

Q: es2015 migration

Hey do u want migrate to es2015 instead of requirejs?

  1. babel have plugin [babel-plugin-transform-amd-to-commonjs] so the migration will be very easy
  2. Easy to create tests and test the code
  3. Use of imports or require

Basic authentication is deprecated

I can't use the tool due to this error message:

Basic authentication with passwords is deprecated.  For more information, see: https://confluence.atlassian.com/cloud/deprecation-of-basic-authentication-with-passwords-for-jira-and-confluence-apis-972355348.html\n

Functionality to support marking unreleased relaseses released

I'm not sure if this functionality is already intended to be working or I'm misunderstanding the use of the -r, --released flag, but let's say I create a release via:

jira release -d "test 12" -p DEVOPS eid-releases-automator-v1.9.9

which I want to remain marked as "Unreleased" in JIRA.

Then some time later when that release has been deployed to Prod I want to mark it as "Released" in JIRA.

Should this work?

jira release -p DEVOPS -r "eid-releases-automator-v1.9.9"

When I execute the above it just prints the help menu:

Your first step is to run the config option.


  Usage: jira [options] [command]

  Commands:

    ls [options]           List my issues
....
....

Perhaps it's not intended to support updating the status of a release as released or unreleased after the initial release has been created?

Thanks!

How to specify reporter for a create template?

Hi!
Trying to use jira new with template: It always asks for reporter, I have tried editing the config to get reporter to be pre-set to my own user, simply will not work.
I have found the GUID:ish id that they use.

I have tried:

  1. "reporter": "<my guid>"
  2. "reporter": { "id":"<my guid>"
  3. "reporter": { "accountId":"<my guid>"

I have to reply to the reporter question (with the UUID) and then it works. But that is not so nice.

Anyway to config my userid for the new operation?

BR! /marcus

jira done ISSUE -r Done switch does not work

when i run

jira done JIRA-123 -r Done

then i expect

Resolution status to be Done.

But it does not.

workaround

edit ~/jira-cli/config.json to have "check_resolution": true

    "jira_done": {
      "status": "Done",
      "check_resolution": true
    }

TypeError running jira config in fresh install

After installing, when I run jira config to provide the URL and credentials, I get the following error:

$ jira config
/Users/luis/.nvm/versions/node/v13.13.0/lib/node_modules/jira-cli/bin/jira.js:52
  host: config.authNew.host,
                       ^

TypeError: Cannot read property 'host' of undefined
    at Object.<anonymous> (/Users/luis/.nvm/versions/node/v13.13.0/lib/node_modules/jira-cli/bin/jira.js:52:24)
    at Module._compile (internal/modules/cjs/loader.js:1123:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Module.load (internal/modules/cjs/loader.js:972:32)
    at Function.Module._load (internal/modules/cjs/loader.js:872:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47

Any ideas? Thank you!

jira create

Hey great project
Q: command "jira create" provide only issue "summary" without "description" is it right behavior?
flow: jira create -> project name -> issue type 1 -> summary -> creation

Error when opening issues

When I run the command jira open <ISSUE-ID> I get the following error:

/home/matthias/.n/lib/node_modules/jira-cli/node_modules/openurl/openurl.js:39
                throw error;
                ^

Error: [260087:260087:1117/141321.958923:ERROR:chrome_content_client.cc(343)] Failed to locate and load the component updated flash plugin.

    at Socket.<anonymous> (/home/matthias/.n/lib/node_modules/jira-cli/node_modules/openurl/openurl.js:35:25)
    at Socket.emit (events.js:323:22)
    at endReadableNT (_stream_readable.js:1204:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)

I think the error about flash not being installed is from the Chromium-based browser I use, one could argue that its errors should not propagate to the CLI (unless the browser actually doesn't start?).

To compare, a tool like xdg-open does indeed itself exit with zero status, even though the terminal does show the same error.

$ xdg-open https://hiberglobal.atlassian.net/browse/WEB-4314
$ [261390:261390:1117/141915.417745:ERROR:chrome_content_client.cc(343)] Failed to locate and load the component updated flash plugin.
Opening in existing browser session.
echo $?
0

It is questionable that the Chromium stuff thinks it is an error that I don't have any flash plugins installed,... 🤷‍♂️

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.