Skip to content

Add anthropics/buffa-packaging plugin v0.3.0#2370

Draft
iainmcgin wants to merge 1 commit intobufbuild:mainfrom
iainmcgin:add-buffa-packaging-plugin
Draft

Add anthropics/buffa-packaging plugin v0.3.0#2370
iainmcgin wants to merge 1 commit intobufbuild:mainfrom
iainmcgin:add-buffa-packaging-plugin

Conversation

@iainmcgin
Copy link
Copy Markdown

Adds the protoc-gen-buffa-packaging plugin for assembling buffa-style per-file output into a single mod.rs module tree.

What this plugin does

protoc-gen-buffa-packaging reads the proto package structure (not message/service bodies) and writes a mod.rs that include!s each generated file at the right module nesting level. It works with any codegen plugin that emits per-file output named via the buffa naming convention (foo/v1/bar.proto -> foo.v1.bar.rs), which includes protoc-gen-buffa itself and plugins layered on top of it (like protoc-gen-connect-rust).

Why register this in BSR

The buffa plugin (#2333) emits per-file output without a mod.rs. For local buf generate users, the packaging plugin assembles the module tree so the generated code can be used as pub mod proto; from a single #[path]. BSR's lib.rs synthesis handles the SDK-crate case differently, but BSR users who pull the plugin into a buf.gen.yaml workflow still need this packaging step.

Options

  • filter=services — only include proto files that declare at least one service. Useful when packaging output from a service-stub generator that skips files without services.

The plugin requires strategy: all (client-side concern in buf.gen.yaml) so it sees the full file set in one invocation.

No registry block

This plugin emits only mod.rs files containing #[path] and pub mod declarations - no Rust code with cargo deps. So no registry: block is needed (same pattern as community/neoeinstein-prost-crate).

Dependencies

Logically pairs with #2333 (anthropics/buffa) and #2334 (anthropics/connect-rust). The packaging plugin works on output from those plugins but does not declare them as plugin deps - it operates on the descriptor set, not on the generated code.

Process note

CONTRIBUTING.md asks for an issue first - happy to open one if you would prefer to discuss before reviewing. Filed as draft.

@iainmcgin iainmcgin force-pushed the add-buffa-packaging-plugin branch from e0f1531 to a9ac911 Compare April 2, 2026 21:36
@iainmcgin iainmcgin changed the title Add anthropics/buffa-packaging plugin v0.2.0 Add anthropics/buffa-packaging plugin v0.3.0 Apr 2, 2026
protoc-gen-buffa-packaging emits a mod.rs module tree that includes
per-file output from protoc-gen-buffa (or any plugin layered on it).
The plugin reads the proto package structure (not message bodies) and
writes a mod.rs that include!s each generated file at the right module
nesting level.

Requires `strategy: all` so the plugin sees the full file set in one
invocation. Supports a `filter=services` option for packaging output
from service-stub generators that skip files without services.

Crates: https://crates.io/crates/protoc-gen-buffa-packaging
Repo: https://github.com/anthropics/buffa
@iainmcgin iainmcgin force-pushed the add-buffa-packaging-plugin branch from a9ac911 to fd585ed Compare April 3, 2026 01:20
@iainmcgin
Copy link
Copy Markdown
Author

I'll leave this as draft until we determine if it makes sense for this to be exposed as a remote plugin, or if we should treat this as a local-only helper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant