Import, audit, benchmark, and export production-ready brand systems from MoonBit design tokens.
Dependencies
moon update
moon run cmd/main -- demo
moon run cmd/main -- benchmark
moon test --target all///|
test {
let book = moonbit_brandbook()
let report = book.validate_with_policy(ValidationPolicy::strict())
assert_false(report.has_errors())
assert_true(book.to_theme_json().contains("colors"))
}moon run cmd/main -- help
moon run cmd/main -- demo --format html
moon run cmd/main -- validate --input examples/brandbook.json
moon run cmd/main -- render --format tailwind --text <document>
moon run cmd/main -- render --format html --input examples/brandbook.json --output _build/brandbook.html
moon run cmd/main -- benchmarkmoon fmt --check
moon check --deny-warn --target all
moon test --deny-warn --target all
moon test --enable-coverage --target native
moon coverage report -f summary
moon info
git diff --exit-codefn AccessibilityPolicy::for_thresholds(normal_min_x100 : Int, large_min_x100 : Int) -> AccessibilityPolicypub struct BenchmarkReport {
toolchain : String
measurements : Array[BenchmarkMeasurement]
} derive(Eq, Debug)fn BenchmarkReport::measurement_named(self : BenchmarkReport, name : String) -> BenchmarkMeasurement?fn BoundaryCase::new(name : String, input : String, expected_valid : Bool, focus : String) -> BoundaryCasepub struct BrandBook {
name : String
tagline : String
voice : Voice
assets : AssetSet
palette : Palette
typography : Typography
components : Array[ComponentSpec]
forbidden : Array[MisuseRule]
metadata : Meta
} derive(Eq, Debug)pub struct BrandQualityReport {
score : Int
dimensions : Array[QualityDimension]
audit : AuditReport
} derive(Eq, Debug)fn BrandTemplate::with_accent(book : BrandBook, name : String, value : String, role : String) -> BrandBookpub struct CatalogEntry {
path : String
name : String
kind : TokenKind
value : ThemeValue
description : String
} derive(Eq, Debug)pub struct CliRequest {
command : CliCommand
format : CliFormat
input : String
input_path : String
output : String
} derive(Eq, Debug)fn CliRequest::new(command : CliCommand, format : CliFormat, input : String, output : String) -> CliRequestfn ComponentPolicy::with_minimums(self : ComponentPolicy, anatomy : Int, states : Int, tokens : Int) -> ComponentPolicyfn ComponentSpec::audit(self : ComponentSpec, policy : ComponentPolicy, path : String) -> AuditReportfn ContentPolicy::with_minimums(self : ContentPolicy, principles : Int, misuse_rules : Int) -> ContentPolicypub struct ContrastPair {
foreground : ColorToken
background : ColorToken
ratio_x100 : Int
grade : ContrastGrade
} derive(Eq, Debug)pub struct Diagnostic {
severity : DiagnosticSeverity
path : String
message : String
location : SourceLocation?
} derive(Eq, Debug)fn ExportEntry::new(name : String, format : String, extension : String, output_bytes : Int, description : String) -> ExportEntrypub struct ExportManifest {
project : String
version : String
entries : Array[ExportEntry]
} derive(Eq, Debug)fn GuideSection::new(id : String, title : String, summary : String, body : String, order : Int) -> GuideSectionpub struct Logo {
name : String
path : String
min_width_px : Int
clear_space : Space
background : BackgroundRule
} derive(Eq, Debug)fn Logo::new(name : String, path : String, min_width_px : Int, clear_space : Space, background : BackgroundRule) -> Logopub struct PipelineResult {
value : BrandBook?
events : Array[PipelineEvent]
diagnostics : DiagnosticBag
exports : RenderBundle?
} derive(Eq, Debug)fn PolicyRule::new(id : String, title : String, rationale : String, severity : String) -> PolicyRulefn ReferenceGraph::add(self : ReferenceGraph, source : String, target : String, kind : ReferenceKind) -> ReferenceGraphfn ReferenceGraph::add_alias(self : ReferenceGraph, source : String, target : String) -> ReferenceGraphpub struct ThemeDiff {
added : Array[ThemeToken]
removed : Array[ThemeToken]
changed : Array[ThemeChange]
} derive(Eq, Debug)pub struct ThemeDocument {
tokens : Array[ThemeToken]
aliases : Array[ThemeAlias]
provenance : Array[ThemeProvenance]
} derive(Eq, Debug)fn ThemeDocument::override_token(self : ThemeDocument, token : ThemeToken, source : String) -> ThemeDocumentpub struct ThemeToken {
path : TokenPath
kind : TokenKind
value : ThemeValue
description : String
} derive(Eq, Debug)fn TypographyPolicy::with_fallback_requirement(self : TypographyPolicy, required : Bool) -> TypographyPolicyfn TypographyPolicy::with_line_ratio_bounds(self : TypographyPolicy, minimum_x100 : Int, maximum_x100 : Int) -> TypographyPolicyfn TypographyPolicy::with_monotonic_requirement(self : TypographyPolicy, required : Bool) -> TypographyPolicyfn TypographyPolicy::with_size_bounds(self : TypographyPolicy, minimum : Int, maximum : Int) -> TypographyPolicyImport, audit, benchmark, and export production-ready brand systems from MoonBit design tokens.
Dependencies