///|
async fn main {
let args = @env.args()
// NOTE: this cannot exit non-zero. MoonBit exposes no process-exit entry point
// in the packages available here (no `sys` package; moonbitlang/async has only
// `Output::exit_code`, which reads a finished process). So a target that
// cannot be located prints ERROR and still exits 0 — a caller must read the
// output, not the exit code. Recorded as a known limitation.
//
// Usage:
// moonx riantr/moonbit_static_analysis@latest [--exclude ]...
// [--extern-iface-dir ]...
// [--no-auto-fetch-deps]
// registry coordinate (author/module[@version]) or a path
// --exclude a directory name to skip, repeatable
// --extern-iface-dir a directory to scan for `.mbti` files whose declared
// types/values are treated as valid in every .mbt file
// under analysis. Repeatable. The natural target is
// `.repos/` after `moon fetch` of the dependencies you
// want indexed. The target's own tree is always indexed.
// --no-auto-fetch-deps by default the analyzer reads the target's
// `moon.mod` and `moon fetch`es each direct import.
// Pass this to skip the auto-fetch.
// --mmd ALSO write the scan as a mermaid `stateDiagram-v2`
// to ``, and print `MMD` on the
// last line. Opt-in on purpose: stdout stays the
// authoritative text report, and a diagram may be a
// deliberate subset (see `mermaid_states`' file cap),
// so it is never the only output.
// --mmd-auto Same, but pick the name —
// `