Trace-driven three-proof-strength control-flow, taint, value-range, slicing and contract analysis for MoonBit modules, as one Markdown report with Mermaid diagrams

| You call | You get back | Shape |
|---|---|---|
| LunaFlow analyze <coord> | report, trace, summary | .md, _trace.jsonl, _summary.json |
| LunaFlow analyze --funnel | the same three artefacts plus L2 alarms and L3 VCs | report §3 / §5.2 / §6.3 / §8 |
| LunaFlow analyze --level 2 | L1 baseline + abstract may-analysis | report §5.2, §6.3 |
| LunaFlow analyze --level 3 | L1 + L2 + contract VCs | report §8 |
| LunaFlow analyze --slice "<crit>" | dynamic backward/forward slice | Mermaid graph + statement table |
| LunaFlow analyze --coverage cov.xml | compiled-suite coverage mapped onto CFG nodes | report §4.4 |
| LunaFlow analyze --list-functions | function, file, statement count | FUNCTION<TAB>FILE<TAB>STATEMENTS |
| @app.load_module(root, coord, version, limit) | the parsed module and its ingestion statistics | (ModuleAst, ScanStats) |
| @app.check_contracts(ast, ["f"]) | the verification conditions of a function | ProofResult |
| @app.run_abstract(ast, max_functions, max_steps) | the L2 findings of a module | AbsResult |
moon add riantr/LunaFlow@0.1.3import {
"riantr/LunaFlow@0.1.3",
}///|
import {
"riantr/LunaFlow/src/app",
}Cannot find import 'riantr/LunaFlow/src/app@0.1.0' in my/app/src/thing@0.1.0///|
import {
"riantr/LunaFlow/src/app" @lf,
}moon run src/cli -- analyze <author>/<module>[@<version>|@latest]moonx riantr/LunaFlow@latest riantr/LunaFlow@latestmoonx riantr/LunaFlow/src/cli@latest analyze riantr/LunaFlow@latestmoon run src/cli -- analyze --dir .| Package | Kind | Native | Wasm | Wasm-GC | JS |
|---|---|---|---|---|---|
| riantr/LunaFlow/src/app | library | yes | — | — | — |
| riantr/LunaFlow/src/cli | executable | yes | — | — | — |
LunaFlow.png the mark this README shows
LunaFlow_Logo.png the same artwork at 1024x1024
LICENSE MIT
moon.mod module metadata (native target)
src/app/ 14 library files: parser, CFG, L1 interpreter,
L2 abstract interpreter, L3 contracts, funnel,
taint/slice, report renderer
src/app/*_test.mbt 37 tests in 7 files
src/cli/main.mbt async native CLI
fixtures/vuln_demo/ taint / dead-code / infinite-loop / contract fixture
features/ acceptance scenarios in Gherkin
docs/design.md design, comparison, acceptance criteria (A1-A18)
docs/qa/REPORT.md deep QA report (security, coverage, metrics)
reports/ generated reports for the validation modules
scripts/verify.mjs dependency-free acceptance checker
scripts/qa/ dependency-free QA harnesses| Command | Result |
|---|---|
| moon fmt --check | exit 0 |
| moon check --target native | exit 0, 135 warnings, 0 errors |
| moon test src/app --target native | 37 passed, 0 failed |
| moon build src/cli --target native | exit 0 |
| node scripts/verify.mjs | 87 passed, 0 failed |
| node scripts/qa/gherkin.mjs | 7 passed, 0 failed |
| node scripts/qa/e2e.mjs | 56 passed, 0 failed |
| node scripts/qa/fuzz.mjs | 110 passed, 0 failed |
| node scripts/qa/path_traversal.mjs | 7 passed, 0 failed |
| node scripts/qa/deep_nesting_probe.mjs | 2 passed, 0 failed |
| node scripts/qa/vendor_isolation.mjs | 13 passed, 0 failed |
| node scripts/qa/cli_resolver.mjs | 3 passed, 0 failed |
| node scripts/qa/verify_published.mjs 0.1.3 | 4 passed, 0 failed |
| Module | Files | Statements | L1 events | L2 findings | L3 VCs | Dead | Taint sinks | Time |
|---|---|---|---|---|---|---|---|---|
| riantr/moonbit_doubleML@latest → 0.164.62 | 220 | 43,822 | 162,708 | 127 (115 new) | 0 (no specs) | 137 | 102 | 6.0 s |
| riantr/moonbit_static_analysis@latest → 0.4.43 | 164 | 14,505 | 27,785 | 47 | 0 (no specs) | 48 | 103 | 3.0 s |
| fixtures/vuln_demo | 1 | 36 | 889 | 11 | 2 / 1 / 3 | 3 | 28 | 5 ms |
| LunaFlow itself (--dir .) | 22 | 3,497 | 17,957 | 24 | 2 / 1 / 3 | 24 | 3 | 0.15 s |
# analyze a published module; @latest is resolved once and pinned
moon run src/cli --target native -- analyze riantr/moonbit_doubleML@latest --out reports
# the full funnel, with a slice on a variable
moon run src/cli --target native -- analyze riantr/moonbit_doubleML@latest \
--out reports --funnel --slice "theta_hat@aggregate_coef_se"
# a local checkout, no registry resolution
moon run src/cli --target native -- analyze --dir fixtures/vuln_demo \
--out reports --funnel --slice "i@copy_prefix"
# focus on one function in a large module
moon run src/cli --target native -- analyze riantr/moonbit_static_analysis@latest \
--function render_reports --slice "buf@render_reports" --out reports
# compiled coverage, when the target builds
moon coverage analyze
moon coverage report -f cobertura -o cov.xml
moon run src/cli --target native -- analyze <coord> --coverage cov.xml --out reportsL1 concrete: 12 findings
L2 abstract: 11 findings, 4 new
L3 contracts: 2 proved / 1 failed / 3 unknownflowchart LR
L1["L1 concrete: 12 findings"] -->|"dedup, escalate"| L2["L2 abstract: 11 findings, 4 new"]
L2 -->|"critical functions"| L3["L3 contracts: 2 proved / 1 failed / 3 unknown"]| Function | VC kind | Status | Goal |
|---|---|---|---|
| get_checked | index-bounds | proved | ((n >= 0) && (n < values.length())) |
| get_checked | ensures | unknown | (values[n] >= 0) |
| get_unsafe | index-bounds | unknown | ((n >= 0) && (n < values.length())) |
| get_negative | index-bounds | failed | ((n >= 0) && (n < values.length())) |
| double | ensures | proved | ((n + n) >= 0) |
Install
Download zipTrace-driven three-proof-strength control-flow, taint, value-range, slicing and contract analysis for MoonBit modules, as one Markdown report with Mermaid diagrams