Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: provide a --json flag #118

Open
Aghassi opened this issue May 16, 2022 · 3 comments
Open

feat: provide a --json flag #118

Aghassi opened this issue May 16, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@Aghassi
Copy link

Aghassi commented May 16, 2022

The intended use case for this tool is for users implementing the CLI tool on their own CI without convenience hooks. This means we need the ability to manipulate the output of this tool so that we can format it and display it to the user. I'd like to request a --json flag be added so that developers can take in json and manipulate it to their liking on their ci pipelines instead of using the pre-formatted output this tool provides.

@Aghassi
Copy link
Author

Aghassi commented May 16, 2022

I also just noticed this in the README

JSON output will be added soon.

So glad to know this is on the roadmap

@lili2311
Copy link
Contributor

lili2311 commented Jul 7, 2022

Hi @Aghassi could you provide an example of what sort of information / data shape you are looking for in this output?

@lili2311 lili2311 added the enhancement New feature or request label Jul 7, 2022
@Aghassi
Copy link
Author

Aghassi commented Jul 14, 2022

At the very least I'd expect something like

{
  "added": [],
  "removed": [],
  "vulnerabilities": [],
  "fixable": []
}

Where fixable contains an object like

{
  "name": "",
  "command": ""
}

This way I could do something do something like this:

  1. Run snyk script
  2. If the script fails, parse the stderr (which is json)
  3. Have a script that reads the json and sees if there are vulnerabilities and fixes

I think an API surface you may want to consider mirroring is https://eslint.org/ as they have this concept and I think it is very well executed on.

My response is a bit off the cuff, but basically I want to know

  1. why it failed
  2. what dep is offending (if any)
  3. how can I fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants