Skip to content

Repository files navigation

message-format

Rust workspace for compiling and executing MessageFormat catalogs.

Workspace

  • message-format: no_std core crate containing a runtime (message_format::runtime) for loading verified catalogs and formatting messages, plus an optional compiler (message_format::compiler, behind the compile feature) for compiling source text to binary catalog bytes.
  • message-format-resource-json: JSON resource adapters over the compiler resource model.
  • message-format-resource-toml: TOML resource adapter over the compiler resource model.
  • message-format-conformance: conformance harness for fixtures and golden tests.
  • apps/message-format-cli: CLI for compiling explicit resource-adapter inputs into one binary catalog.

CLI

Validate a resource container without writing a catalog:

cargo run -p message-format-cli -- compile --check \
  --input-format resource-toml \
  messages/app.toml

Validate custom functions with a host-agnostic manifest:

cargo run -p message-format-cli -- compile --check \
  --input-format resource-toml \
  --functions functions.toml \
  messages/app.toml

Minimal manifest example:

[functions.string]
format = true
select = true

[functions."app:link"]
format = true
operand = "string"

[functions."app:link".options.href]
value = "either"
required = true

Compile a project-owned TOML resource container:

cargo run -p message-format-cli -- compile \
  --input-format resource-toml \
  -o app.mfcat \
  messages/app.toml

Compile a flat JSON resource catalog:

cargo run -p message-format-cli -- compile \
  --input-format json-flat \
  -o app.mfcat \
  messages/app.json

Compile a Chrome-style messages.json resource catalog:

cargo run -p message-format-cli -- compile \
  --input-format json-chrome \
  -o app.mfcat \
  messages/app.messages.json

For a single raw MF2 message string, use the compiler module directly (message_format::compiler::compile_str with the compile feature, or message_format::Catalog::compile_str). The CLI operates on explicit resource/container formats rather than guessing message ids from raw MF2 text.

Specs

  • spec/catalog-binary-format.md: current binary catalog wire layout and compatibility intent.
  • spec/default-semantics.md: strict default behavior for missing args, unknown functions, and select defaults.

Docs

  • docs/architecture-boundaries.md: module ownership boundaries and pipeline invariants.
  • docs/error-model.md: compile/load/format error contracts across modules.
  • docs/runtime-vm-semantics.md: VM execution invariants and host/error contracts.
  • CONTRIBUTING.md: contributor workflow, gates, and commit conventions.

About

No description, website, or topics provided.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages