WebAssembly / WebAssembly/WASI

Proposal: "Protobuf main"

Open
#541 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

S-inactive
Dominant language
Rust
Stars
5.8k
Forks
333
Avg merge
2d 13h
Merged PRs (30d)
3

Description

Instead of having the classic argc/argv interface which everyone knows and loves, it'd be nice if wasi could provide a typed CLI interface, either using protobuf or some bespoke new thing.

Specifically, something supporting tagged enums/sum types for arguments.

It should be as easy as specifying whether an argument is a file or a string or an open fd.

As a hypothetical example, a "protobuf main" grep might take an argument for a pattern. If this argument is a string, the pattern is the string. If this argument is a file or an open fd, the pattern is read from the file/fd.

Further type checking could be applied to such commands, which are just not available with current tools.

Something like

int main(wasi_protobuf_t protobuf)

would define a "protobuf main".

A few unresolved questions are:

  1. How to communicate the schema to the host.
  2. How to represent C argc/argv in protobuf space. (i.e. what restrictions do we apply to the schema? what elements does the host require the schema to support? can we just say "every schema that wants to support C/POSIX must have at least [this element]"?)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or implementation entry points are named. Start by reviewing the WASI interface and schema-related design discussions, then resolve how hosts communicate schemas and how C argc/argv map into the proposed typed interface. Done would require an agreed design and an identified implementation path.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
api, cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.