buf icon indicating copy to clipboard operation
buf copied to clipboard

Add an interactive "buf config init"

Open bufdev opened this issue 2 years ago • 1 comments

Every time I go to help a repository migrate, I have to use mental energy to figure out how to form the config, regularly resulting in me going back to the documentation - which is weird, considering I wrote it. I imagine that every user does this.

I want a buf config init, buf mod init, buf init or the like that creates a buf.yaml with the following logic:

  • Set the version to the current version.
  • Attempt to do buf build. If it fails, say "we couldn't build, what are your roots? Here's the docs for what the roots are, enter them now:", or even better, do some smart attempts to figure out what the roots are based on the error messages (not for now though)
  • Attempt to do buf check lint. If it fails, generate the config ignore. The best would be to add stuff to except if a given linter fails for more than 75% of the files, and to ignore_only otherwise.

In the future, this will also ask for the module name.

I think this could significantly lower the onboarding burden.

bufdev avatar Aug 31 '21 14:08 bufdev

We have buf mod init available now, but it doesn't perform all of the functionality mentioned here (the automatic build, lint, etc). I imagine we could add a flag to perform these additional steps though (e.g. buf mod init --verify or something similar). That experience sounds pretty slick with respect to onboarding users from protoc -> buf, so I can still see the value.

Is this something we still want to do? (cc @bufdev)

amckinney avatar Aug 11 '22 18:08 amckinney