-
Notifications
You must be signed in to change notification settings - Fork 348
Have a buf source migrate command #4412
Copy link
Copy link
Open
Labels
FeatureNew feature or requestNew feature or request
Description
Feature
Similar to buf config migrate, which migrates/upgrades the buf.{yaml,gen.yaml} config files, it would be nice to have a command in buf source which is able to migrate/upgrade the syntax/edition of the proto source.
Example UX
buf source migrate <input> [--syntax, --diff]
- The input default is
.if not specified, and is otherwise a source input (dir/on-disk modules/workspace orprotofileref), same behaviour as other commands we have. - The user can optionally specify a
--syntax, e.g.--syntax=proto3or--syntax=2024(for editions 2024). If no syntax is specified, we'll use the latest implemented edition of the compiler the CLI version current depends on (https://github.com/bufbuild/protocompile/blob/aa1a63ac3dac8c2eb5bbebf21d6a8b5c0b8f8e5b/experimental/ast/syntax/editions.go#L24) - If the source is already on the specified syntax and/or the source is already on the latest syntax, it's a no-op on the source file
--diffproduces only a diff output, if any, and does not write in-place. The default behaviour writes in-place. This is the same UX asbuf config migrate(although I am open to deviating from that, just wanted to use an existing frame of reference for consistency)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
FeatureNew feature or requestNew feature or request