Skip to content

--stdin on every model-reading verb, and delete the mgtt surface - #4

Merged
sajonaro merged 5 commits into
mainfrom
delete-mgtt-surface
Aug 15, 2026
Merged

--stdin on every model-reading verb, and delete the mgtt surface#4
sajonaro merged 5 commits into
mainfrom
delete-mgtt-surface

Conversation

@sajonaro

Copy link
Copy Markdown
Contributor

Two things, in the order they have to happen: add the general capability, then remove the special case.

--stdin — additive, nothing breaks

Every model-reading verb gains --stdin. It is a general convenience for any generated model, not a concession to one bridge: a model that arrives on a pipe never has to touch the disk.

--stdin is stripped before positionals are counted, which is what makes it decidable. query, derive and compare all take further positionals after the model, so dropping it silently would shift the rest left; with the flag removed, the remaining arity is fixed and the sentinel goes into the model slot the verb already has. No verb, and nothing in the engine, learns that stdin exists.

Two shapes needed a decision:

  • compare OLD.writ --stdin--stdin fills the new side and must follow the old model, or compare --stdin baseline.writ and compare baseline.writ --stdin would strip to the same one positional and one of them would silently compare backwards.
  • query --stdin NAME --claims FILEquery finds its questions by convention (MODEL.writMODEL.claims), and a piped model has no beside; it resolved <stdin>.claims and reported a file nobody named. --claims overrides the sibling and is required with --stdin, which now says so. The convention stays the default, so every existing invocation is unchanged, and this matches check, which has had the flag all along.

docs/tour.md listed "there is no --claims flag on it" under things that will catch you once — the worst place for a stale rule. Corrected there, in the cheat sheet, and in the README table.

Deleting the mgtt surface

The translation now lives in mgt-tool/mgtt2writ.

writ is a language. SQL is a notation standard that does not move; mgtt is a product with a schema that does. One such reading is defensible — a second would make writ a collection of bridges wearing a language's name, and deferring that to a trigger nobody would notice was the wrong call.

Removed: tooling/mgtt/ (1643 lines), tooling/cli/cmd_mgtt.ml, the dispatch arm, the help entry, tests/unit/test_mgtt.ml and its fixture, docs/mgtt-bridge.md (moved to mgtt2writ as docs/reading.md), and the README section. 3167 deletions, 4 insertions.

Nothing in writ names mgtt now.

Verification

make test green — 26 test binaries, including test_stdin: 14 checks. make lint clean apart from four files with pre-existing drift (cmd_sql.ml, mcp/bin/*, sql_ast.ml) that I deliberately left alone.

The pipeline it enables, verified end to end against the real binaries:

$ mgtt model export --json | mgtt2writ | writ check --stdin
states: 6   edges: 9    …    exit 0

Rationale: ADR 0001.

sajonaro and others added 5 commits August 15, 2026 03:34
Loader.read_model resolves the model THROUGH the injected resolve
callback, so a piped model needs no core change — only a resolver that
answers one reserved name. Read to EOF because in_channel_length fails
on a pipe; memoised because stdin drains once.

The verbs become a library (writ_cli, unwrapped) with Writ a thin
executable over it: an executable's modules cannot be linked into a
test, and the sentinel is worth checking without running the binary.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Flags are stripped before positionals are counted, which is what makes
this unambiguous where a bare verb would not be: query, derive and
compare all take further positionals after the model, so dropping it
would just shift the rest left.

compare refuses --stdin before the positional: it fills the NEW side,
and the two spellings would otherwise parse identically with one of
them silently comparing backwards.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
query finds its questions by convention — MODEL.writ -> MODEL.claims —
and a model read from stdin has no beside. It resolved <stdin>.claims
and reported a file nobody named.

--claims overrides the sibling and is required with --stdin, which now
errors saying so. Every existing invocation is unchanged: the
convention is still the default. Matches check, which has had the flag
all along; the tour's 'there is no --claims flag on it' is corrected.
The translation lives in mgt-tool/mgtt2writ now. writ is a language; a
dialect for one third-party product does not belong in its tree, and a
second such reading would have made it a collection of bridges wearing
a language's name.

Removes tooling/mgtt/, the verb, its help entry, its tests and fixture,
docs/mgtt-bridge.md (moved to mgtt2writ as docs/reading.md), and the
README section. --stdin stays: it is a general convenience for any
generated model, not a concession to this bridge.

See mgt-tool/mgtt docs/decisions/0001-where-the-writ-bridge-lives.md.
@sajonaro
sajonaro merged commit 1dc45da into main Aug 15, 2026
1 check passed
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant