aontu

How-to guides

Each guide solves one task and assumes you know the basics: the tutorial teaches those. Every example is executed by the engine repository's test suite before it reaches this page.

Run, embed, and integrate

Getting aontu into your process or pipeline, and its answers out.

Templates, defaults, and composition

Building one model out of reusable parts.

Schemas and constraints

Saying what data must look like, from optional keys to recursive shapes.

  • Constrain every element of a list

    Type every element of a list with a `&:` spread, and know why a bare `[string]` does not.

  • Forbid unexpected keys

    Seal a map with `close` so a typo'd or invented key is refused instead of absorbed.

  • Make a field optional

    Suffix a key with `?` so a field that never receives a value is dropped instead of erroring.

  • Name a reusable constraint

    Build a `uint8`/`port` vocabulary as a `type()`-marked block of ordinary fields.

  • Define a recursive schema

    Reference a definition inside itself to get a schema that applies at every depth of the data.

  • Carry exact money over JSON

    Keep money exact inside aontu and cross JSON as a fixed-scale decimal string with a conversion mark.

  • Export JSON Schema

    Export a model as JSON Schema 2020-12 with `aontu jsonschema`, and read the loss report it owes you.

  • Generate code from a model

    Generate target-language source from a model: a rule set over the records, a component tree of files and lines, and `aontu render` to write the bytes and hold them against their goldens.

Query, explain, and change

The model get, model why, model set and trim loop over a live document.

  • Query a path

    Print one node of the evaluated document by path, or a keys, types, or depth-limited view of it.

  • Explain a value

    List every contribution that met at a path (which file, which line, which layer) with aontu model why.

  • Change a value with an overlay

    Append a change to an overlay file with aontu model set, so the original document keeps its bytes and a bad change is refused before it lands.

  • Gate an agent's changes by role

    Ask aontu allow whether a role may change a subtree before aontu model set writes it, with the answer read from a role model that is itself an aontu document.

  • Change a pinned value

    Rewrite a pinned literal where the author wrote it with aontu model set --in-place, and know the cases where the verb appends instead.

  • Find dead entries

    Report map entries whose removal changes nothing, so layered files do not silt up with lines a template already implies.

  • Draw a model

    Draw a model as a dependency tree, matrix or architecture layers with aontu view, and gate the committed figures in CI.

Validate and evolve

The gate verbs: vet, breaking, relations, reaches and hash.

  • Validate data in CI

    Run aontu vet in a pipeline so a document that does not hold fails the build, with the reason attached.

  • Gate schema changes

    Gate schema edits with aontu breaking, so a change that would refuse previously valid documents fails the review.

  • Check that components agree about their relations

    Declare a relation once at the field with rel(), acyclic() and inverse(), and have the whole model's edge set checked.

  • Query reachability between entities

    Ask whether one entity reaches another over the declared edges with aontu reaches, and get the path as the answer.

  • Pin what a document means

    Pin a document's meaning to one string with aontu hash, and detect when the meaning moves.

  • Format a document

    Put a document in the agreed form with `aontu fmt`, gate a repository on it in CI, read what the formatter will and will not change, and point `--lint` at the style it never touches.

Modules and multi-file

Splitting a model across files and vendoring a dependency closure.

  • Split a model across files

    Load other source files with @"path" so a base model and its overrides unify into one document.

  • Vendor a dependency closure for an offline build

    Lock a dependency closure with aontu sync and commit aontu_meta/vendor/ so a build resolves every import with no network at all.

  • Vendor a module by hand

    Bootstrap a module dependency with no repository to fetch from by copying its source tree into aontu_meta/vendor/ and letting aontu sync pin what it means.

  • Publish a package

    Publish a package with aontu publish, gated on compatibility with the version before it, into a local repository that aontu pkg serve serves and aontu sync reads.