spf13 / cobra

A Commander for modern Go CLI interactions
https://cobra.dev
Apache License 2.0
37.66k stars 2.83k forks source link

Add a command that allows users of a COBRA cli to send feedback #1570

Open asilverman opened 2 years ago

asilverman commented 2 years ago

First, spf13/cobra is just brilliant and elegant! Also, it is extremely popular and broadly used. I was inspired by a functionality that exists in azure-cli that automates and makes more user friendly the process of creating a github issue on a cli application.

I think that this functionality if implemented at the framework level would have a HUGE impact on the quality and user-experience for the spf13/cobra community of developers and the users of applications leveraging this framework.

The basic concept is to keep a log file that registers a rolling window of the last 25 commands and when app feedback is executed, there is an interactive set of questions asked to the user to populate on behalf of the user a github issue on the repository of the application in question.

I would be honored if you would consider implementing this idea and would love to help make it possible if this is something you would consider me for.

asilverman commented 2 years ago

Check out go bug as a reference

marckhouzam commented 2 years ago

Thanks @asilverman for the idea. Let me start by saying that I'm not a maintainer so anything I say is my own personal opinion.

I think facilitating the reporting of bugs has value. Am I right that bugs would be reported to the project of the tool being used and not to the Cobra project? So a user of helm (which is built using Cobra) would use this feature to report a bug to the Helm project?

I agree that standardizing such a feature in Cobra would allow many projects to benefit from it and help users have the same experience across tools for this feature.

I think what will be interesting from the point of view of Cobra is to know if such a feature can be generalized in a framework so that each program using Cobra can configure it for their own needs. Did you think about what the interface would be for programs using Cobra to configure such a feature?

asilverman commented 2 years ago

First of all, thank you so much for reading and considering my proposal @marckhouzam!

I think facilitating the reporting of bugs has value. Am I right that bugs would be reported to the project of the tool being used and not to the Cobra project? So a user of helm (which is built using Cobra) would use this feature to report a bug to the Helm project?

Yes, the proposal is to provide a configurable and generic command that handles the logic to report bugs for projects implemented using Cobra. Ideally, this generic command for example would accept an issue template, a set of functions that gather information and potentially other arguments and generate (github) issues based on this input. Also, the way that I envision this feature is that Cobra would be able to keep a rolling log file containing the last 20 operations being made by the main command and allow the cli user to select which invocation to use as a basis for the issue. This workflow is best exemplified in the az feedback command.

Did you think about what the interface would be for programs using Cobra to configure such a feature?

I would start by generalizing the go bug implementation to accept the bug template, repo-url as input and then enrich it incrementally with features.

asilverman commented 2 years ago

Another option is to use the Cobra command generator to generate a feedback command that provides the plumbing for bug reporting functionality so that each project can augment this functionality as they please

marckhouzam commented 2 years ago

Here is another such bug-report command as provided by istioctl which may help in the effort of figuring out how difficult (or easy) it would be to generalize this functionality.

https://istio.io/latest/docs/reference/commands/istioctl/#istioctl-bug-report

johnSchnake commented 2 years ago

I like how go bug simply opens the browser window with a few helpful bits of info prepared.

As a general CLI function though, 99% of it would have to be provided by the end user:

I think if you reduced this to what could be done in general it would actually be very little besides opening a browser window.

I think that functionality is wonderful, but I'm not sure if there is enough generality to its implementation that it would be useful.

Happy to have others chime in though.

asilverman commented 2 years ago

I think if you reduced this to what could be done in general it would actually be very little besides opening a browser window.

Sounds to me like this is an oversimplification, we could integrate with Github REST APIs to open PRs and prepopulate them based on info gathered by COBRA that is shared across all projects (like the commit, version and dependencies)

It would be possible to expose a public interface that allows implementors to register debug info gathering scripts that shall be run (from the local context of the console app) to gather specific information relevant to the project

It would be possible to append logs and include the exact run command, its input and output exactly as was experienced by the user when invoking the app (by keeping a small rolling log with this information in a temp folder)

More things could be done, but these pop as quickly providing a lot of value

burntcarrot commented 2 years ago

Sounds to me like this is an oversimplification, we could integrate with Github REST APIs to open PRs and prepopulate them based on info gathered by COBRA that is shared across all projects (like the commit, version and dependencies)

This still introduces specificity - bug reports could be filed to different services (Gitlab, etc.), which have their own methods of authentication. I feel like having Github as the default option won't be a great idea.

@asilverman With that said, I'm still interested in this as a feature, but I think this needs generalization. I'll try working on this, and probably, I'll open a pull request to the project if enough interest is generated for this feature.