buf icon indicating copy to clipboard operation
buf copied to clipboard

`buf config init` that can parse the Protobuf roots of a given source directory

Open doriable opened this issue 1 year ago • 0 comments

Feature

Having buf config init take a directory (. by default), finds all Protobuf definitions, and create a buf.yaml with the appropriate modules.

For example, I have a source repository for my project that might look something like:

.
├── LICENSE
├── README.md
├── proto
│   ├── api
│   └── vendor
└── src

Running buf config init, it would:

  • Find all the Protobuf definitions
  • Scans the import paths of all the files
  • Figures out that there are two Protobuf roots, api and vendor
  • Produce a buf.yaml with the following content:
version: v2
modules:
  - path: proto/api
  - path: proto/vendor

This is pretty closely related to https://github.com/bufbuild/buf/issues/3159

doriable avatar Jul 22 '24 19:07 doriable