Skip to content

Command-line reference

Every milo subcommand, its arguments and the flags it reads.

This page is generated by scripts/gen-lang-docs.ts from the commands and cliOptions keys of milo lang --json, which are projected from the same table milo --help prints. A command or flag cannot appear in one and be missing from the other.

Compiler commands

CommandWhat it does
run <file> [args]Compile and run (no artifacts left behind).
build <file> [-o out]Compile to executable.
test [file|dir...]Run tests (*_test.milo, recursive in a dir; cwd by default).
check <file>Type-check only, no codegen.
fix <file>Apply every machine-applicable fix the check reports (&mut markers, imports, @ sigils, unused unsafe), in every file it reaches.
emit-ast <file>Emit the parsed AST as JSON.
emit-hir <file>Emit the typed HIR as JSON.
emit-ir <file>Emit LLVM IR.
emit-obj <file>Compile to object file (.o).
build-lib <files...>Compile to static library (.a).
fmt <file...>Format source files (to stdout unless -w).
prove <file>Prove contracts hold, via std/smt, the milo-native prover.
safety <file> --safety=<level>Check safety profile compliance.
wcet <file> [-o out]Emit OTAWA flow facts (loop bounds) for WCET analysis.
lspRun the language server on stdio (what an editor launches).
skillPrint language guide for LLMs.
helpPrint this help (also --help, -h).
langThe language's vocabulary as data: keywords, types, operators, builtins, warnings, attributes, commands.
explain <name>What one warning, @attribute or keyword means, with an example and how to silence it.
api <terms>Search std signatures by name/doc.
doc <file|dir>Reference markdown from doc-comments.

run

sh
milo run <file> [args]

Compile and run (no artifacts left behind).

build

sh
milo build <file> [-o out]

Compile to executable.

test

sh
milo test [file|dir...]

Run tests (*_test.milo, recursive in a dir; cwd by default). A test is a top-level fn test*() with no parameters; each runs in its own process, so a trap fails only that test.

FlagEffect
--contractsInstead, test every fn's requires/ensures on drawn inputs (any .milo).
-t <pattern>Run only tests matching (substring or regex).
--test-name-pattern <pattern>Long form of -t.
--jsonMachine-readable results.

check

sh
milo check <file>

Type-check only, no codegen.

FlagEffect
--jsonMachine-readable diagnostics, each with its fix when one is mechanical.

fix

sh
milo fix <file>

Apply every machine-applicable fix the check reports (&mut markers, imports, @ sigils, unused unsafe), in every file it reaches.

emit-ast

sh
milo emit-ast <file>

Emit the parsed AST as JSON.

FlagEffect
--allInclude imported modules.
--spansKeep source spans.

emit-hir

sh
milo emit-hir <file>

Emit the typed HIR as JSON.

FlagEffect
--allThe full module, imports included.
--spansKeep source spans.

emit-ir

sh
milo emit-ir <file>

Emit LLVM IR.

emit-obj

sh
milo emit-obj <file>

Compile to object file (.o).

build-lib

sh
milo build-lib <files...>

Compile to static library (.a).

fmt

sh
milo fmt <file...>

Format source files (to stdout unless -w).

FlagEffect
-wWrite in place, printing each file that changed.

prove

sh
milo prove <file>

Prove contracts hold, via std/smt, the milo-native prover.

FlagEffect
--solver=z3Use z3 instead (adds non-linear arithmetic).
--emit-smtPrint the SMT-LIB2 obligations instead of solving them.
--allInclude imported stdlib.
--jsonMachine-readable report.

safety

sh
milo safety <file> --safety=<level>
milo safety --list

Check safety profile compliance.

  • milo safety --list: List available safety profiles.
FlagEffect
--jsonMachine-readable violations.

wcet

sh
milo wcet <file> [-o out]

Emit OTAWA flow facts (loop bounds) for WCET analysis.

FlagEffect
--cyclesA Cortex-M cycle bound from the linked ELF (bare-metal ARM --target only).

lsp

sh
milo lsp

Run the language server on stdio (what an editor launches).

skill

sh
milo skill

Print language guide for LLMs.

help

sh
milo help

Print this help (also --help, -h).

lang

sh
milo lang

The language's vocabulary as data: keywords, types, operators, builtins, warnings, attributes, commands.

FlagEffect
--jsonThe full payload, for tooling.

explain

sh
milo explain <name>

What one warning, @attribute or keyword means, with an example and how to silence it.

FlagEffect
--jsonThe raw entry.

api

sh
milo api <terms>

Search std signatures by name/doc.

FlagEffect
--module std/xDump one module's full API.
--markdownEmit reference docs.
--jsonEvery std symbol.

doc

sh
milo doc <file|dir>

Reference markdown from doc-comments.

FlagEffect
-o <dir>Write one .md per module.

Package commands

CommandWhat it does
init | new <name>Create milo.json here / scaffold a new project.
add <pkg>Add a library dependency (milo.json + milo.lock).
remove <pkg>Drop a dependency and prune the lock.
installSync this project from milo.lock.
update [pkg]Re-resolve tags and rewrite the lock.
tree | why <pkg>Dependency graph / who pulls a package in.
vendorCopy deps into ./vendor and rewrite to local paths.
publishValidate, tag, push.
tool install <pkg>Build and install a global executable (~/.local/bin).

init

sh
milo init
milo new <name>

Create milo.json here / scaffold a new project.

add

sh
milo add <pkg>

Add a library dependency (milo.json + milo.lock).

FlagEffect
--devRecord it under devDeps.

remove

sh
milo remove <pkg>

Drop a dependency and prune the lock.

install

sh
milo install

Sync this project from milo.lock.

FlagEffect
--frozenFail if the lock is stale.

update

sh
milo update [pkg]

Re-resolve tags and rewrite the lock.

tree

sh
milo tree
milo why <pkg>

Dependency graph / who pulls a package in.

vendor

sh
milo vendor

Copy deps into ./vendor and rewrite to local paths.

publish

sh
milo publish

Validate, tag, push.

tool

sh
milo tool install <pkg>
milo tool uninstall <name>
milo tool list [--repair]
milo tool run <pkg> [args]

Build and install a global executable (~/.local/bin).

  • milo tool uninstall <name>: Remove an installed executable.
  • milo tool list [--repair]: List installed executables (--repair: rebuild the index).
  • milo tool run <pkg> [args]: Build and run a package's binary without installing.

Options

Parsed by every command that takes a source file. Each acts on the ones that apply to it: an optimization level matters to build and run, not to check.

OptionEffect
--releaseOptimize (-O3).
--debugNo optimization (-O0).
-gEmit DWARF line info (source-level lldb/hades); composes with any -O / --debug.
-O<level>Clang opt level: 0,1,2,3,s,z (default: -O2).
--sanitizeLink with AddressSanitizer (requires clang).
--static-depsStatic-link native deps (openssl/sqlite) for a portable binary.
--overflow-checksTrap on +/-/* overflow at any -O (on by default in every mode).
--no-overflow-checksWrap on +/-/* overflow at any -O (opt out of the default traps).
--contract-checksAssert requires/ensures/invariant at any -O (default: only --debug).
--no-contract-checksDrop those asserts at any -O (e.g. fast -O0 builds).
--strip-panic-locationsBlank source paths out of runtime panic messages (-g still embeds them).
--fastQuick edit-loop build: -O0, wrapping (~2x faster compile).
--cgus=<n>Codegen units compiled in parallel (default: auto, 1 for --release/-g).
--deny=<warning>Treat warning as error (e.g. --deny=unused-variable).
--allow=<warning>Suppress warning (e.g. --allow=unused-result).
--expect=<warning>Suppress it, and report if it stops occurring (e.g. --expect=index-clone).
--deny-allTreat all warnings as errors (off-by-default warnings: large-stack-array, mut-param-bundle, opaque-call-on-thread, single-variant-match, unused-import, unowned-pointer-copy, unchecked-ffi-contract, unused-move, unverified-extern).
--jsonMachine-readable output, for tooling instead of a human (api, lang, explain, check, prove, safety, test; see docs/json-api.md).
--safety=<level>Enforce safety profile (e.g. --safety=do178).
--target=<name>Cross-compile target (e.g. cortex-m3).
--heap-size=<N>Bare-metal heap cap in bytes or k/m (e.g. 64k); default: all free RAM.
--max-stack-array=<N>Large-stack-array warning threshold, bytes or k/m (default: 512k).
--no-entryOmit the C entry point, for a freestanding image with its own reset vector.
--emit-headerWith emit-obj, also write a C header for the exported symbols.
--versionPrint the compiler version and exit.
--helpPrint this help and exit (also -h).

Also accepted, but left out of milo --help: milo lex <file> (compiler-debug output, not a user-facing command).