Skip to content

morphe 1.0.0

Choose a tag to compare

@GregoryGelfond GregoryGelfond released this 25 Aug 03:39
· 26 commits to main since this release

The first release — and the version is a promise: the house style and the
command-line surface are stable now, and anything that breaks either bumps the
major. morphe formats the clingo/clingcon dialect of ASP (and its ASP-Core-2
variant) the way rustfmt, black, and ruff format their languages — one fixed
style, a single knob — with one guarantee that sets it apart.

  • It will not write output it cannot certify against its input. Before
    writing a byte, morphe re-parses its own candidate and proves it stands in the
    right relation to the input: by default token-stream equivalence — the same
    statements and comments, in the same order, differing only in whitespace (and,
    unless --preserve-spellings, synonym spellings). If the proof fails it writes
    nothing and exits 70. Checked, not asserted.
  • --reorder proves a permutation instead of same-order equivalence. It
    reorganizes top-level statements into a canonical signature order — #defined,
    #const, rules, #show — holding order-sensitive statements and #include in
    place as barriers, and proves the result a pure permutation of the input. The
    one meaning-affecting toggle, [unsafe] reorder_includes, hoists an #include
    on your assertion that it is pure; morphe cannot verify that, and says so in a
    note rather than silently.
  • One fixed style, a single knob. No options to argue over: the only dial is
    --line-width (default 100), and --dialect selects clingo or asp-core-2.
    Comments are carried to the anchors the parser gives them, never transposed.
  • #script bodies stay verbatim unless you opt in. Python (via ruff) and Lua
    (via StyLua) reformatting is behind build-time features, off by default; each
    backend runs behind a hardened boundary and carries its own tool's guarantee,
    not morphe's certificate.
  • A command line built for CI and editors. Format files, directories, and
    stdin; in-place writes are atomic, so an interrupted run never truncates a
    source. --check and --diff write nothing and exit 1 on a change. A
    directory honours .gitignore and --exclude; configuration is a morphe.toml
    discovered by walking up, where an unknown key is a usage error, not a silent
    drop.
  • It formats; it does not rewrite. No semantic transformation, no evaluation,
    no grounding, no solving — those belong to other tools. The certificate covers
    the ASP program; the embedded seam has its own posture in
    docs/security/threat-model.md.
  • The guarantee is exercised, not just written. Property tests for
    idempotence, the certificate grant, comment placement, and the permutation; a
    fuzz target; and a differential against clingo itself.

Getting it. morphe is not yet on crates.io — it depends on themelios-syntax
by path — so build from source, cloning the two repositories as siblings. Rust
1.97+ (edition 2024). The README lists every option.