v0.2.0
[0.2.0] — 2026-06-08
A typed AST overlay over the v0.1 parse tree, a lossless mutation API, a canonical formatter, and a
format CLI with a pre-commit hook — every layer operating on script text alone, still with no GMAT,
C, or Node toolchain required and the byte-for-byte round-trip preserved for untouched input.
Added
- Typed AST overlay (
gmat_script.ast) — a typed view over the v0.1 CST: aScriptroot that
splits configuration from the mission sequence atBeginMissionSequence, typedResources with
dict-like dotted field access (script.spacecraft["Sat"]["SMA"]), an ordered, typed mission
sequence (GenericCommand,Assignment,FunctionCall,If/For/While,Target/
Optimizesolver blocks, opaqueScriptBlock), and total, structural value coercion — numbers,
strings, booleans,ObjectRefreferences, brace-lists, 1-D / 2-D arrays, and colon ranges — with a
RawValueraw-text fallback. The overlay holds only references into the wrapped tree, so it
re-emits byte-for-byte (#12). - Mutation API — the overlay is now mutable while every untouched byte is preserved.
Resource
is aMutableMapping(script.spacecraft["Sat"]["SMA"] = 7000,del, plusupdate/pop/
clear);Scriptgainsadd_resource/remove_resource/rename_resource(rewriting every
textual reference form, or declaration-only) andinsert_command/remove_command/
move_command/replace_command. Each edit splices byte-ranges and re-parses, so only edited
spans change and the result re-parses with zeroERRORnodes; a corrupting edit raises
MutationErrorand leaves the source untouched (#13). - Canonical formatter —
gmat_script.format(source, style="canonical"), a deterministic,
idempotent pretty-printer that re-lays-out in source order and never reorders, so
parse(format(x))is structurally equal toparse(x)— safe on every save or as a pre-commit
hook. Canonical form: single spacing around=/ operators, one statement per line, per-resource
grouping, four-space block indentation, and verbatimBeginScriptbodies; auto-fixes are limited
to dropping a redundantGMATprefix and optional;and stripping trailing whitespace. The
canonical-form contract is recorded as design decision D14 (#14). gmat-script formatCLI and pre-commit hook — aformatsubcommand that rewrites files in
place (-formats stdin), with read-only--checkand--diffmodes whose exit codes mirror
ruff format. A shipped.pre-commit-hooks.yamlexposesgmat-script-format(in place) and
gmat-script-format-check(check-only) for.script/.gmffiles, needing no GMAT, C, or Node
toolchain (#15).- Documentation — new Typed AST, Editing, and Formatter guide pages; a refreshed README
quick-start with mutate and format examples and a command-line section; and three runnable
examples/scripts (programmatic field edit, resource rename, format-in-place) (#17).
Changed
gmat-script(PyPI) andtree-sitter-gmat(npm) continue to release in version lockstep. The
grammar is unchanged since 0.1.1; this release carries it forward to 0.2.0 to keep the two packages
at one version.