ADR 0005 — CLI shape: parse and emit <target> as core verbs¶
Status: accepted · 2026-06-01
Context¶
The CLI is the main user-facing surface. It should map cleanly onto the
ecosystem's transformation vocabulary (parse, normalize, lower, export,
validate) and stay extensible as authoring formats and backends are added,
without reshaping existing commands.
Decision¶
Two core verbs mirror the hub-and-spoke model:
parse <authoring-file> [--from <format>] [-o out.ir.json]— authoring → canonical IR.--fromselects the frontend (default and only:exprtk-ini). Combines theparse+normalizetransformations.emit <target> <model.ir.json> [-o out]— canonical IR → a backend view.emitis a command group so targets are added as subcommands (emit julianow;emit cpp,emit iniplanned) without touching existing ones.
Supporting commands: validate (IR or authoring file, optional --profile),
inspect (human summary), ast (debug tree), schema (export JSON Schema).
Conventions: kebab-case long options; -o/--output defaults to stdout so
commands compose in pipelines. Exit codes 0/1/2; diagnostics use
OK/WARN/ERROR.
Consequences¶
-
- The two verbs match the user's mental model ("turn my INI into IR", "build the Julia model from IR") and the org transformation table.
-
- Adding a frontend is a
--fromvalue; adding a backend is anemitsubcommand — both are additive, non-breaking.
- Adding a frontend is a
-
- stdout-by-default keeps commands scriptable and CI-friendly.
- −
emitas a group is slightly more typing than a flatemit-julia; justified by clean extensibility.
Alternatives considered¶
- Flat verbs per target (
to-julia,to-cpp). Rejected: the command set grows combinatorially and obscures the sharedlowertransformation. - A single
convert --from --to. Rejected: harder to give target-specific options and help; less discoverable thanemit <target> --help. - Always write files (no stdout). Rejected: stdout-by-default composes better and keeps the tool pipeline-friendly.
References¶
- Org architecture: transformations table (
parse,normalize,lower,export,validate) apcplants/docs/design/frontend-and-project-structure-options.md§5docs/design/model-parser.md§5