This audit records the current public API surface by semantic category. It is a
review aid for future API changes, not a promise that every listed declaration
is stable forever. The guard in tools/moui/validate_api_surface enforces these
counts against generated pkg.generated.mbti files.
The canonical numeric snapshot is generated in
Repository Facts from the API validator's
structured report. Semantic category budgets remain executable policy in
tools/moui/validate_api_surface; this narrative deliberately does not copy
their current counts.
app_constructormay grow only for reusable controls, layouts, or workflow surfaces that belong inmoui/viewsand have focused tests plus catalog or guide coverage.app_state_helpermay grow for small app-owned state helpers, descriptor constructors, or validators that reduce repeated app boilerplate without moving business policy into the framework.app_styleshould grow slowly. Prefer extending existing style structs or theme token groups over adding parallel style concepts.advanced_core_protocolshould be mostly frozen. Additions need a clear cross-runtime contract reason and must not encode concrete controls, runtime state, platform services, renderer implementation details, or diagnostics.runtime_diagnostic,host_contract, andrenderer_contractcan grow when the owning package needs a new integration boundary, but new APIs should stay package-local and avoid re-exporting through app-facing facades.required_protocolis current structural exposure. Treat increases as review-worthy because they usually expose enum/struct shapes that are harder to change later.test_exposureis budgeted at zero for the tracked packages. Prefer package-private helpers and test-only files over public declarations that exist only for tests.migration_debttracksmoui/viewspub(all) structdeclarations. The completed visibility migration is recorded in ADR 0004.pub(all) enumis no longer classified as debt: MoonBit requirespub(all)to expose enum variants for external construction, so enums are treated as intentional public API and classified intoapp_styleorapp_state_helper.
- Keep
moui/coreclosed to new concrete controls, form/routing/WebView workflows, runtime snapshots, and design-system defaults. The existing legacy family guard should remain at zero occurrences for these families. - Review any future
moui/viewspub(all) structtypes first when doing API cleanup.pub(all) enumtypes are intentional public API in MoonBit (variants needpub(all)for external construction); they are not migration candidates. Prefer opaquetypedeclarations orpub structwith constructors andwith_xxxmethods; see ADR 0004. - Avoid adding more low-level paint helpers to
moui/viewsunless they are necessary forcanvasand app-facing custom drawing. Domain paint value types should stay undermoui/graphicsor directmoui/core. - Keep runtime inspector expansion in
moui/runtime; do not forward diagnostics throughmoui, domain facades, ormoui/views. - Keep host async-image, WebView, window, route, text-input, accessibility, and
redraw contracts in
moui/backend/host; concrete platform packages should not leak into app packages.
When a public declaration is added or removed:
- Run
moon infoif generated interfaces changed. - Run
node scripts/validate-api-surface.mjs. - If the semantic classification budget fails, either move the API to the owning package or update the category budget with a short rationale in the same change.
- Run
node scripts/generate-repo-docs.mjs --writeand commit the generated facts when the intended snapshot changes.