Repository conventions
These rules add to the Luna-Flow documentation standard for floating; they
never relax it. The manual describes the implementation on the current branch.
The current release is 0.8.0, the version in moon.mod.
Chapters and guides
Every package has one page per chapter, named after its package path:
- API reference (
api/<package>.md) lists every public type, function, method, error and value with its signature and observable semantics. - Tutorial (
tutorial/<package>.md) works through tasks with small examples that compile. - Design (
design/<package>.md) explains the representation, the mathematics, the invariants and the decisions taken, and ends with the package’s boundaries.
The four numerical cores, bin_float, decimal, decimal_gda and
ball_float, have two more chapters, as the standard allows:
- Conformance (
conformance/<package>.md) states a pinned, finite evidence claim and its exclusions. - Performance (
performance/<package>.md) records reproducible measurements and target-specific dispatch evidence without making API promises.
The guides are fixed by tools/doc_quality.py: index.md (overview and
package map), getting_started.md (package choice and first steps),
numeric_semantics.md (shared numerical vocabulary), architecture.md
(layers and responsibilities), verification.md (gates and conformance
scope), performance_audit.md (audit of the historical performance baseline)
and this page. Do not add or rename guides without updating that list.
README.md positions the current release and points into the manual.
CHANGELOG.md owns release history and migration notes.
Package pages
- Mirror every
moon.pkg: the package insrc/<path>/moon.pkgis documented inapi/<path>.md,tutorial/<path>.mdanddesign/<path>.md. Files do not create packages;moon.pkgboundaries do. - Give every package all three pages. Packages without an application API
(frontends, CLIs,
internal/*,bench/*,consistency,doc_examples) still document their generated interface, maintainer workflow and stability boundary. - Every package also keeps a
src/<path>/README.mbt.md. pkg.generated.mbtiis the public-surface inventory; source and tests define behaviour. A method is documented as callable with dot syntax only if the.mbtilists it aspub fn Type::name; trait-implementation methods are not promoted implicitly and must be declared withpub extend.- Do not document planned APIs as existing, and do not keep research notes as
separate pages. Promote durable conclusions into design, conformance or
performance pages, and move superseded history to
CHANGELOG.md. - Pages name only the current release. A page may mention an older release
only when it carries a
<!-- historical-performance-baseline: X.Y.Z -->marker for that version;tools/doc_quality.pyrejects any other historical version.
API snapshots
Every API page ends with ## Complete public interface, whose body is an exact
copy of the package’s pkg.generated.mbti between the markers
<!-- generated-api-start --> and <!-- generated-api-end -->, fenced as
mbti. Individual signatures in the page body are mbti blocks too.
tools/doc_quality.py compares the snapshot with the generated file (it also
accepts the older moonbit fence), so regenerate it whenever moon info
changes the interface.
Numeric documentation rules
- Use
precision,rounding,classify,sign,normalized,quantum,contextandflagsas defined in numeric semantics. - Separate the stored representation, the exact value, the rounded result, status flags, checked errors and interval enclosures.
- State when parsing preserves the quantum and when normalization changes the cohort without changing the value.
- Name the order an API uses.
compare,<and sorting are a total preorder that puts every NaN above every number; the IEEE partial order (with unordered) andtotalOrderare separate APIs. Never imply a scalar order for interval values. - For
*_ctxAPIs, document both the returned value and the flags. - For checked APIs and wrappers, document the domain-specific transition: a result error, IEEE flag accumulation, or a GDA trap short-circuit and its recovery.
- Document
decimalanddecimal_gdaas separate contracts: IEEE operations return per-operation flags, while GDA operations thread sticky status and traps throughGdaOutcome. - Write mathematics in TeX (
$…$,$$…$$) and cite the standard clause or classical result a derivation relies on.
Examples
- Runnable examples are complete top-level items, normally a
testblock, fencedmoonbit, and they show their output withinspect. They must compile and pass against the current branch. - Partial snippets, signatures in prose, executable-package code and
internal/*code that cannot be imported from outside the module are fencedmoonbit nocheck;moon.pkgsnippets are fencedtext. - Import aliases:
@lf_algforLuna-Flow/luna-genericand@lf_arithforLuna-Flow/arithmetic; floating packages use their default aliases (@bin_float,@decimal, …). - Call only what the
.mbtilists. For example,BinFloathas noto_doubleoris_finitemethod; useto_shortest_stringand@def.is_finite(x).
Translations
English pages in doc/manual are the only source. Translations live in the
gettext catalogs doc/locale/<locale>/LC_MESSAGES/manual.po for the locales in
doc/conf.json and are never edited as page copies. Do not translate
identifiers, package names, paths, commands, version strings or mathematics.
Typst attachments live in doc/attachments/ and are shared by all locales.
Review checklist
- Run
moon infoand compare each changedpkg.generated.mbtiwith its API page; refresh the## Complete public interfacesnapshot. - Check that every
moon.pkgstill has itsapi/,tutorial/anddesign/pages (and the evidence pages of the four cores). - Compile and run every changed example (
moonbitblocks) against the current branch. - Run
python3 tools/doc_quality.py(orjust docs, which also runs thesrc/doc_examplestests). - Run
lunadoc updateto refreshdoc/locale/manual.potand merge the catalogs, translate new and fuzzy entries, then checklunadoc status(coverage per locale) andlunadoc check --compile(layout, catalogs, links and Typst attachments). - Run
moon fmt,moon check --target all --deny-warn, the relevant tests, andjust prbefore submitting. - On a release bump, update
moon.mod, the version inREADME.md, this page andCHANGELOG.mdtogether.