BrotaParser
BrotaParser is a Rust parser and compiler for declarative frontend architecture contracts. It is independent and reusable, with BrotaLibre as its primary consumer.
Current status
The current public baseline is angular@0.1. It models Angular feature-area
organization and generic contract rules without claiming to implement Clean
Architecture, DDD, Feature-Sliced Design, or Vertical Slice Architecture.
Quick start
Compile a contract:
Read from stdin:
|
The normalized contract is written as JSON. See docs/cli.md
for exit codes and diagnostics.
Language
The language supports versioned contracts, profiles, areas, dependency rules, paths, required artifacts, exceptions, and comments:
contract admin-panel {
language "0.1"
profile angular version "0.1"
root "src"
area catalog
area orders
allow orders -> catalog
}
Read the architecture catalog for the language contract, profile rules, sources, and compatibility policy.
Library API
Downstream Rust applications can compile typed project configuration without depending on the parser AST:
use ;
let input = ProfileInput ;
let contract = compile_profile?;
Use compile_source when the input is already a .brota document. Use
compile_profile when a downstream application owns the project configuration
and wants a typed ArchitectureContract directly.
For architecture-authoritative generation, resolve the built-in Blueprint
instead. Blueprints describe the structure a generator must materialize, while
the derived .brota contract remains diagnostic:
use ;
let blueprint = resolve_blueprint?;
let contract = derive_contract;
let diagnostic_source = render_contract_source;
compile_profile remains available as a compatibility API for consumer-defined
contracts; it is not the authority API for built-in architecture profiles.
Development
BrotaParser compiles architecture contracts. Filesystem, TypeScript, Angular, and project conformance analysis belong to downstream adapters such as BrotaLibre.
Publishing
Releases are published automatically when an immutable
v<major>.<minor>.<patch> Git tag is pushed. The tag version must match
Cargo.toml.
Before the first release, create a crates.io API token and add it to the
repository Actions secrets as CRATES_IO_TOKEN. Then:
The Publish crate workflow verifies the tag, package version, and package
contents before publishing to crates.io.