REPROTO(1)
β¨ NAME β¨
reproto β reconstruct .proto source files from compiled protobuf descriptor sets. okay so this is the REPROTO(1) page, bestie, and this tool is lowkey iconic: it takes compiled protobuf descriptor sets and regenerates the original .proto source files with correct syntax, field types, and options. no cap, that's the whole main character energy π
π SYNOPSIS π
reproto [OPTIONS] DESCRIPTOR_FILES...
π¦ DESCRIPTION π¦
reproto reads one or more binary or text-format protobuf descriptor sets and regenerates the original .proto source files with correct syntax, field types, and options. it's giving "uncompile my heart" in the best way possible ππ
it supports proto2, proto3, and editions syntax, and accepts both .pb (binary FileDescriptorSet) and .textpb (text-format) descriptor files as input. fr fr, all the syntax eras are invited to the party π
πΈ ARGUMENTS πΈ
DESCRIPTOR_FILESβ One or more descriptor files to process. Accepts binaryFileDescriptorSet, binaryFileDescriptorProto,#@prototext-format descriptors, or directories (processed recursively). Any file extension is accepted;.pband.descare conventional. Paths are resolved relative to directories given by-I(--desc-root), or relative to the current working directory if-Iis not provided. iykyk, the-Ithing is the vibe check for path resolution π§
π OPTIONS π
okay bestie, here's the full menu β every flag is here, periodt. no skipping the "boring" ones, because they all matter π
π§ Input
-I,--desc-rootPATH β Root for resolving relativeDESCRIPTOR_FILESpaths and for locating imports (repeatable; likeprotoc -I). A directory is read as-is; a file is read as a blob, standing for the descriptors embedded in it, one member perFileDescriptorProtofound (whatprotoscanwould have extracted). Defaults to the current directory.
π Output
-O,--proto-outDIRECTORY β Output directory for generated.protofiles (created if absent). Not required when using--schema-db-out,--scoring-html-out, or--dry-run. Defaults to the--schema-db-outstubΒ΄sΒ΄protoΒ΄child when that option is given;--no-proto-outsuppresses that default. When--schema-db-outis also given,DIRmay not be inside its stub directory unlessDIRis that stubΒ΄s immediateΒ΄protoΒ΄child.--no-proto-outβ Do not write.protofiles. Suppresses the-Odirectory that--schema-db-outotherwise implies; an error if-Ois also given.-b,--emit-binaryβ Also write binary descriptor files (.pb) alongside.protooutput.--source-infoβ Embed aSourceCodeInfosynthesized from the reconstructed.prototext in binary descriptor output (-b,--schema-db-out). On by default.--dry-runβ Do not actually create.protofiles.
π± Variant / Schema
--proto-variantFILE β Path to a variant specification YAML file. If omitted,$REPROTO_VARIANTis used; otherwise the built-ingoogle.protobufdefault applies.--use-variantCHOICE β Use the variantΒ΄s embedded copy of a well-known file instead of whatever the input.pbfiles contain. Accepts:any,empty,timestamp,duration,struct,wrappers,descriptor,all. May be repeated.--keep-descriptor-pathβ Keep the variant descriptor import path as-is (do not rewrite togoogle/protobuf/descriptor.proto).
π Filtering
-s,--seedTEXT β FQDN or path pattern to treat as an output root. FQDN (needs a prefix):desc:my.pkg.MyMsg,file:foo.proto(the FDP namedfoo.proto). Path (bare, orpath:prefix):foo.pb(every FDP in that physical file), matched against the-I-relativepath. Glob (either form): one*.proto(one level),borg/**(recursive).-p,--pruneTEXT β FQDN or path pattern to exclude from output. FQDN (needs a prefix):desc:my.pkg.MyMsg,file:foo.proto(the FDP namedfoo.proto). Path (bare, orpath:prefix):foo.pb(that physical file, never loaded), matched against the-I-relativepath. Glob (either form): one*.proto(one level),borg/**(recursive).-C,--filter-configFILE β Path to a YAML file with"seed:"/"prune:"lists of FQDNs or path patterns (same syntax as-s/--seedand-p/--prune). Merged with any-s/-pflags given on the command line.
π¨ Rendering
--force-proto2-outputβ Force all output to proto2 syntax, regardless of the input syntax. Without this flag, output syntax matches the input (polyglot mode).--force-proto2-for-editionsβ Translate editions-syntax files to proto2 in output and binary descriptors, the schema DB included. Symmetric with--force-proto2-outputbut limited to editions files only. Use this for readers that do not support editions, such asprost-reflect.--redact-commentsβ Redact comments from reconstructed.protofiles.--redact-orphansβ Redact orphans from reconstructed.protofiles.--go-rootTEXT β Forcego_packageoption in reconstructed.protofiles.
π οΈ Advanced
--schema-db-outFILE β Write the schema DB toFILE(must end in.desc). WritesFILE(FileDescriptorSetof all loaded FDPs),FILE-stem/hopcroft.rkyv(compiled scoring graph), andFILE-stem/index.rkyv(lazy-loading FDS index). If-Ois also given, it may not be insideFILE-stemunless it is exactlyFILE-stem/proto.--emit-scoring-yamlβ Write per-file scoring-graph YAML files alongside.protooutput under--proto-out.--emit-extension-rangesβ Record each messageΒ΄s extension ranges in the scoring graph, so that an unknown field number inside a declared range is not counted against the type.--scoring-html-outFILE β Write scoring-graph HTML visualisations toFILE; requires--schema-db-out.--with-leaf-nodesβ Include leaf (wire-type sink) nodes in--scoring-html-outgraphs (hidden by default).--hideTEXT β FQDN or glob pattern to hide from--scoring-html-outgraphs (same syntax as--prune). Matched nodes and their incident edges are dropped from the HTML; no effect on the schema DB.--debugβ Print detailed debug information (development only).--fdp-pluginPATH β Python file executed as a transformation hook on everyFileDescriptorProtoreproto parses, before anything reads it. Must definefdp_plugin(fdp), which mutatesfdpin place. Called more than once per input file, so it must be deterministic; it must not read reproto state.--keep-duplicatesβ Do not prune files whose symbols conflict with already-loaded files (legacy behaviour; by default conflicting files are silently pruned and a warning is emitted).
π©Ί Diagnostics
--detailed-warningsβ Print every warning occurrence immediately as it is emitted (default: squash repeated warnings and show a count summary at the end).--quiet,-qβ Suppress progress messages and warnings. Errors are always printed.--debug-fqdnβ Print detailed information about FQDNs (development only).
π Other
--emit-descriptorβ Writedescriptor.prototo the output directory (default: on).--versionβ Print version and exit.--helpβ Show a help message and exit.
πΏ ENVIRONMENT πΏ
REPROTO_VARIANTβ Path to a variant YAML file used when--proto-variantis not given.REPROTO_GEN_MANβ When set to a directory, write the man pages ofreprotoandreproto-instantiate-schemainto it and exit._REPROTO_COMPLETEβ When set tobash_source,zsh_sourceorfish_source, print the completion script for that shell and exit. The scripts set it tobash_complete,zsh_completeorfish_completeto get the candidates.
β οΈ NOTES β οΈ
bestie, important vibe check:reprotodoes not support multi-fileFileDescriptorSetinputs (i.e..pbfiles produced withprotoc --include_imports). Each.pbfile must contain exactly oneFileDescriptorProto. Pass all.pbfiles together on the command line and letreprotoresolve cross-file imports. no cap, this one matters π
π§ͺ EXAMPLES π§ͺ
π§Έ Reconstruct a descriptor set
Compile each .proto to its own descriptor set (without --include_imports), then pass all .pb files to reproto:
protoc --descriptor_set_out=phone_number.pb --proto_path=. phone_number.proto
protoc --descriptor_set_out=address_book.pb --proto_path=. address_book.proto
reproto --use-variant descriptor -I . -O out/ phone_number.pb address_book.pb
β¨ Selective output (one message and its dependencies)
reproto --use-variant descriptor -I . -O out/ --seed desc:.tutorial.Person \
phone_number.pb address_book.pb
π¦ Using the embedded descriptor variant
The --use-variant descriptor flag supplies descriptor.proto from the built-in variant bundle, so no separate descriptor .pb is needed:
reproto --use-variant descriptor -I . -O out/ phone_number.pb address_book.pb
π Enable shell completion
Packages usually install the scripts. Otherwise, in bash, zsh or fish:
source <(_REPROTO_COMPLETE=bash_source reproto)
source <(_REPROTO_COMPLETE=zsh_source reproto)
_REPROTO_COMPLETE=fish_source reproto | source
π SEE ALSO π
protoc(1), prototext(1) β go say hi to the cousins π
mwah π that's the whole reproto 0.3.6 moment, dated 2026, on page REPROTO(1) β now go reconstruct something iconic β¨π«Ά
π¦ where this page comes from
- nixpkgs unstable: reproto 0.3.6
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms