Source diagnostics use path:line:column locations when the error originates
in Mako source. Human output includes the source line and caret; --json=v1
reports numeric line and column fields. I/O, linker, and environment errors
that do not originate at a source token report the file or tool context without
inventing a source line.
Reference for the current mako commands, flags, and workflows. Platform- and
integration-specific limits are called out where they apply.
Create a new project.
mako init myapp # default: mako.toml + main.mko
mako init myapp --name myapp # set package name explicitly
mako init mysvc --backend # HTTP API scaffold with routing
mako init myws --workspace # multi-package workspaceDefault scaffold:
myapp/
mako.toml # package manifest
main.mko # entry point (uses pack/pull/export)
Backend scaffold (--backend):
mysvc/
mako.toml
main.mko # HTTP server with /health + /v1/hello
README.md
Workspace scaffold (--workspace):
myws/
mako.toml # [workspace] members = ["lib", "app"]
lib/
mako.toml
lib.mko # shared library code
app/
mako.toml # depends on lib via path
main.mko # uses lib.greet(), lib.add()
| Flag | Description |
|---|---|
[PATH] |
Directory to create (default: .) |
--name <NAME> |
Package name (default: directory name) |
--backend |
Scaffold an HTTP JSON API service |
--workspace |
Scaffold a multi-package workspace with lib + app |
Compile a .mko file to a native binary.
mako build main.mko # debug build (-O0)
mako build --release main.mko # optimized (-O3 -flto)
mako build main.mko -o myapp # custom output name
mako build --target wasm32-wasip1 main.mko # cross-compile to WebAssembly
mako build --target x86_64-unknown-linux-musl main.mko # static Linux binary
mako build --emit-c main.mko # show generated C instead of linking
mako build . # build all workspace members
mako build -p app # build one workspace member| Flag | Description |
|---|---|
[FILE] |
Source file or directory (default: .) |
-o, --out <PATH> |
Output binary path |
--release |
Optimize with -O3 -flto |
--emit-c |
Print generated C to stdout |
--target <TRIPLE> |
Cross-compile target |
--sanitize <TYPE> |
Pass -fsanitize= to clang (e.g. address, thread) |
--static-link |
Force static linking |
--overflow <MODE> |
Integer overflow: wrap (default), trap (abort), ignore |
--bounds <MODE> |
Legacy bounds policy spelling; safe indexing is checked in every build |
--no-incremental |
Disable build caching |
-j, --jobs <N> |
Parallel compile jobs (default: CPU count) |
-p, --package <NAME> |
Build one workspace member |
--time |
Print compile timings |
Supported targets:
| Target | Platform |
|---|---|
aarch64-apple-darwin |
macOS Apple Silicon |
x86_64-apple-darwin |
macOS Intel |
x86_64-unknown-linux-gnu |
Linux x86_64 |
aarch64-unknown-linux-gnu |
Linux ARM64 |
x86_64-unknown-linux-musl |
Linux static (musl) |
aarch64-unknown-linux-musl |
Linux ARM64 static (musl) |
x86_64-pc-windows-gnu |
Windows x86_64 |
wasm32-wasip1 |
WebAssembly (WASI) |
Compile and run.
mako run main.mko # compile and execute
mako run main.mko -- arg1 arg2 # pass arguments to program
mako run --release main.mko # run optimized build
mako run -p app # run workspace memberArguments after -- are forwarded to the compiled program. Access them with
argc() and arg_get(index).
| Flag | Description |
|---|---|
[FILE] |
Source file or directory (default: .) |
[ARGS]... |
Arguments forwarded to the program |
-p, --package <NAME> |
Workspace member to run |
--release |
Optimize before running |
--time |
Print compile timings |
--no-incremental |
Disable build caching |
-j, --jobs <N> |
Parallel compile jobs |
--overflow <MODE> |
wrap / trap / ignore (integer arithmetic and shifts) |
--bounds always |
Legacy-compatible spelling; safe checks are already retained |
Hot-reload seed: poll the entry file mtime, rebuild and rerun on change.
mako dev main.mko
mako dev . -p app --interval-ms 300
mako dev main.mko --overflow trap| Flag | Description |
|---|---|
[FILE] |
Source or package directory (default: .) |
-p, --package |
Workspace member |
--interval-ms <N> |
Poll interval (default 500) |
--release |
Optimized rebuilds |
--overflow |
Same as build/run (default trap for dev) |
Ctrl-C stops the watcher.
Type-check without compiling. Parse recovery reports all top-level parse errors in a file (not only the first).
mako check main.mko # check one file
mako check . # check all workspace members
mako check -p lib # check one member
mako check --json main.mko # legacy JSON array
mako check --json=v1 main.mko # versioned JSON report| Flag | Description |
|---|---|
[FILE] |
Source file or directory (default: .) |
-p, --package <NAME> |
Focus one workspace member |
--json[=legacy|v1] |
Emit JSON diagnostics; bare --json preserves the legacy array |
--no-incremental |
Disable typecheck cache |
The versioned form returns a stable envelope containing schemaVersion,
command, ok, targets, aggregate summary fields, and command-level
errors. Incompatible changes require a new schema version; consumers should
ignore unknown fields added to v1. Both JSON formats exit non-zero when any
target fails.
Run tests. Test files are *_test.mko with functions named TestXxx.
mako test examples/testing # run all tests in directory
mako test examples/testing -r TestAdd # filter by name
mako test examples/testing -r "Test*" # glob pattern
mako test examples/testing -v # verbose (show matched names)
mako test --coverage # print coverage + category counts
mako test examples/testing --json # stable machine-readable report
mako test --count 3 # run suite 3 times
mako test --race # enable ThreadSanitizerEach compiled test fixture runs as a separate process. MAKO_TEST_TIMEOUT_SECS
sets the per-fixture timeout; on Unix the runner also isolates fixtures in their
own process group so timed-out or orphaned descendants are cleaned up with the
test process.
Test file structure:
// add_test.mko
fn add(a: int, b: int) -> int {
return a + b
}
fn TestAdd() {
assert_eq(add(2, 3), 5)
assert_eq(add(0, 0), 0)
}
fn TestAddNegative() {
assert_eq(add(-1, 1), 0)
}
Test categories — the runner detects these from function name prefixes:
| Prefix | Category |
|---|---|
Test |
Unit test |
Fuzz |
Fuzz test |
Property |
Property-based test |
Snapshot |
Snapshot test |
Mock |
Mock test |
Fixture |
Fixture test |
| Flag | Description |
|---|---|
[PATH] |
Test file or directory (default: .) |
-r, --run <FILTER> |
Filter: substring, glob (*/?), or /regex/ |
-v, --verbose |
List matched test names |
--count <N> |
Run suite N times |
--coverage |
Print coverage report |
--json |
Emit one versioned JSON report and capture test output |
--race |
Enable ThreadSanitizer |
--sanitize <TYPE> |
Custom sanitizer |
-p, --package <NAME> |
Focus one workspace member |
JSON mode writes one object to stdout. Human output from each test process is
captured in the file result's stdout and stderr fields, so stdout remains
safe to pipe into a JSON parser. The top-level schemaVersion is 1; reports
include each run, file status, matched test names, duration, structured failure
details, and aggregate counts. The command exits nonzero when any reported run
fails. With --count, it stops after the first failing iteration.
status is passed, failed, or skipped. A failed file has a failure
object whose kind is compile, runner, exit, signal, timeout, or
load; fields that do not apply are null, and signal is populated only on
POSIX systems. Summary passed, failed, and skipped values count files,
while tests counts matched test functions, so they need not add up. Each
output stream retains up to 1 MiB and sets its corresponding stdoutTruncated
or stderrTruncated flag when more was produced. New optional fields may be
added within schema version 1, while incompatible changes require a version
bump.
Format .mko source files.
mako fmt main.mko # print formatted to stdout
mako fmt -w main.mko # write formatted back to file
mako fmt -w . # format all files in directory
mako fmt -l . # list files that need formatting
mako fmt -d . # show diffs
mako fmt --check . # fail if files need formatting
mako fmt -w -p lib # format one workspace member| Flag | Description |
|---|---|
[PATHS]... |
Files or directories (default: .) |
-w, --write |
Write result to file (default: stdout) |
-l, --list |
List files that differ from canonical format |
-d, --diff |
Show diffs |
--check |
List non-canonical files and exit non-zero if any differ |
-p, --package <NAME> |
Focus one workspace member |
Static analysis plus type-checking.
mako lint . # lint everything
mako lint -p app # lint one workspace member
mako lint --security app/main.mko # fail on insecure helpers such as TLS verify bypassSecurity lint treats helpers such as tls_get_insecure,
tls_client_new_insecure, and wss_client_connect_insecure as unsafe-boundary
footguns. Demo or test code can opt in on the exact line with
// mako: allow-insecure; production code should use the verified alternatives.
Generate API documentation.
mako doc . # generate to docs/api/
mako doc --out api-docs . # custom output directoryProduces markdown files with function signatures, types, and runnable example commands. Also generates a symbol search index.
Build and run with timing instrumentation.
mako profile main.mko # print compile + run timings
mako profile --release main.mko # profile optimized build
mako profile --json main.mko # JSON output for tooling
mako profile -p app # profile workspace memberRun benchmark files (bench_*.mko).
mako bench . # run all benchmarks
mako bench -p app # benchmark one workspace memberGenerate deployment scaffolds.
mako deploy docker # Dockerfile + .dockerignore
mako deploy serverless --provider fly --name my-app # Fly starter
# Cloud Run additionally requires an --image that you have pushed.
mako deploy wasm # browser/edge WASM starter files
mako deploy plugin # native or WASM plugin starterVerify your installation is healthy.
mako doctorChecks: compiler binary, runtime headers, native runtime support sources, structured install manifest fields, stdlib, clang, zig (optional), and VS Code extension.
mako version # e.g. mako version mako0.6.5 darwin/arm64
mako version -v # include git commit hash
mako --version # same as mako version
mako -V # sameStart the language server (stdio JSON-RPC).
mako lspSupports diagnostics, hover, completion, go-to-definition, document symbols, workspace symbols, signature help, and reference/rename operations for the implemented same-file and imported-function paths. Broader project-wide language analysis remains a roadmap item.
Configure your editor to run makori lsp as the language server for .mko files.
Start the Debug Adapter Protocol (DAP) adapter on stdio. Editors with a DAP
client (VS Code, Neovim, …) connect to it for breakpoints, stepping, and
stack frames on .mko source lines.
mako dapThe adapter reads the DAP launch request, builds the .mko program named in
its program field (debug flags -O0 -g, C backend, output in
$TMPDIR/mako_dbg_<stem>_<pid>), and proxies the session to a spawned
lldb-dap. A program that already points at a binary is used as-is; a
failed build returns a DAP error response. On disconnect the lldb-dap child
and the debugged process are killed. Takes no flags — the old seed flags
(--request, --stdio, --max-messages) are removed.
lldb-dap discovery: $MAKO_LLDB_DAP, then xcrun -f lldb-dap (macOS), then
lldb-dap / lldb-dap-21..16 on PATH. See DEBUG.md.
Build with debug info and launch an interactive lldb session with the Mako data formatters preloaded.
mako debug # debug the package in .
mako debug main.mko # debug a specific file
mako debug . -p app # debug one workspace member
mako debug main.mko -- arg1 # forward arguments to the program| Flag | Description |
|---|---|
[PATH] |
Source file or package directory (default: .) |
-p, --package <NAME> |
Workspace member to debug |
-- [ARGS]... |
Arguments forwarded to the program |
lldb discovery: $MAKO_LLDB, then xcrun -f lldb (macOS), then lldb on
PATH. Source-level debugging requires the C backend (the default native
backend emits no DWARF line info); mako debug and mako dap select it
automatically. See DEBUG.md.
Package management commands.
Same as makori init — creates mako.toml and main.mko.
Add a dependency to mako.toml.
mako pkg add helper ../helper # path dependency
mako pkg add helper path=../helper # same
mako pkg add path=../helper # name from directory basename
mako pkg add mylib https://github.com/user/mylib # git dependencyRemove a dependency from mako.toml.
mako pkg remove helperShow package name, version, and dependencies.
mako pkg listClone git dependencies into .mako/deps/.
mako pkg fetchRequires git and network access. Not run in CI by default.
Resolve dependencies and write mako.lock for reproducible builds.
mako pkg lockResolve all dependencies (SemVer, path, git, local registry), fetch, and
write mako.lock. When a lockfile already exists, every locked dependency is
rehashed and installation fails if its source metadata or content differs, a
transitive manifest cannot be read, or the lockfile is malformed. Alias of
lock. build, run, and check perform the same verification before loading
dependencies.
mako pkg installRe-resolve within SemVer bounds and refresh mako.lock. Use this command to
accept intentional dependency-content changes or migrate a version 1 lockfile.
mako pkg updatePublish to the local registry (.mako/registry/ or $MAKO_REGISTRY). Published
versions are CLI-enforced immutable: makori pkg publish rejects republishing
the same name and version. A PACKAGE.sha256 content digest is written for
post-publication tamper detection. The digest is staged atomically with the
package and verified before registry resolution; missing, malformed, or
mismatched digests are rejected. New publications use the v2: digest format;
unversioned digests remain readable for compatibility. The top-level
PACKAGE.sha256 name is reserved for registry metadata. This is local-registry
immutability, not signed publication — users with filesystem access can still
replace both the package and its digest.
Names use ASCII letters, digits, ., _, and -; / separates scoped name
components. Components may not start with ., and versions must be SemVer.
mako pkg publishGenerate a PACKAGE.sha256 content digest for a legacy package directory
that was published before v0.4.0. This is trust-on-first-use: it
legitimizes whatever content currently exists. Run this only on packages
whose content you have verified. Will not overwrite an existing digest.
mako pkg seal .mako/registry/util/1.0.0Check mako.lock against advisory and license policy files.
mako pkg auditUses mako-cve.toml for known vulnerabilities and mako-license.toml for
license policy. Both are optional.
The package manifest.
name = "myapp"
version = "0.1.0"
[dependencies]name = "myapp"
version = "0.1.0"
[dependencies]
helper = { path = "../helper", version = "0.1.0" }
utils = { git = "https://github.com/user/utils", version = "^1.0" }name = "myproject"
version = "0.1.0"
[workspace]
members = ["core", "lib", "app"][package]
name = "my-engine"
version = "0.1.0"
systems = true # legacy marker; all packages use the same ownership rules| Field | Description |
|---|---|
name |
Package name |
version |
SemVer version string |
systems |
Legacy marker; it does not change ownership and Makori has no GC |
| Flag / toml | Effect |
|---|---|
makori build --release |
-O3 -flto -DNDEBUG — safe bounds checks remain enabled |
makori build --release --bounds always |
Legacy-compatible spelling; safe checks are already retained |
[profile.release] bounds_checks = "on" |
Same as --bounds always for that package |
[dependencies] |
Map of dependency name → source |
[workspace] |
Workspace configuration |
members |
List of member directories |
| Form | Example |
|---|---|
| Path | helper = { path = "../helper" } |
| Path + version | helper = { path = "../helper", version = "0.1.0" } |
| Git | utils = { git = "https://github.com/user/utils" } |
| Git + tag | utils = { git = "...", tag = "v1.0.0" } |
| Git + branch | utils = { git = "...", branch = "main" } |
Reproducible dependency pins. Generated by makori pkg lock.
# mako.lock
version = 2
[[package]]
name = "root"
version = "0.1.0"
source = "path"
path = "."
content_hash = "sha256:2a78b67c8f640e71c4ef635bdf6f28c59ad31977f4041e1d7b5c3a01d5d78f2e"
[[package]]
name = "helper"
version = "0.1.0"
source = "path"
path = "../helper"
content_hash = "sha256:99f6a808da075bdcda271838491b9383c1e20a3be7fdb724770e4f4f18a42d14"Version 2 hashes the root mako.toml and all .mko sources recursively with
SHA-256. Paths are relative and normalized, so relocating an unchanged package
does not change its digest. .git, .mako, target, and mako.lock entries
are excluded, as are unrelated files that are not Mako package inputs.
Symbolic links and non-UTF-8 paths are rejected because they cannot be
represented reproducibly on all supported platforms. Dependency paths with
quotes, backslashes, or control characters are also rejected because the
lockfile format intentionally has no string-escape grammar. Lockfile version,
required fields, source-specific metadata, duplicate package names, and
sha256: digest syntax are validated when the file is read.
Do not edit the lockfile manually. Commit it to version control for
reproducible builds. makori pkg install, build, run, and check reject
integrity mismatches. Restore the dependency or inspect the change and run
makori pkg update to accept it intentionally.
| Variable | Description |
|---|---|
MAKO_RUNTIME |
Override runtime header path |
MAKO_STD |
Override stdlib path |
MAKO_CC |
Override C compiler (default: clang) |
MAKO_USE_ZIG |
Force zig cc for compilation |
MAKO_JOBS |
Default parallel job count |
MAKO_REGISTRY |
Local package registry path |
MAKO_LIVE_TLS |
Enable live TLS tests |
MAKO_LIVE_NGHTTP2 |
Enable live HTTP/2 tests |
MAKO_LIVE_QUIC |
Enable live QUIC tests |
MAKO_LLDB_DAP |
Override lldb-dap path for mako dap |
MAKO_LLDB |
Override lldb path for mako debug |
MAKO_LLDB_FORMATTERS |
Override lldb data formatter script path |
Enabled by default. The compiler caches:
- Typecheck results — skip re-checking unchanged files
- Object files — skip re-compiling unchanged C output
- C source — skip re-generating unchanged codegen output
Cache lives in .mako/cache/. Clear with rm -rf .mako/cache/ or use
--no-incremental to bypass.
Parallel compilation uses -j flag or MAKO_JOBS environment variable.
Default is the number of CPU cores.
The compiler and runtime pass 320+ tests covering:
on Type { fn method(self) -> T { ... } }method blockspack/pull/exportmodule system (pack-qualified types, lits, enums)- User generics with monomorphization:
fn name[T](x: T) -> T,struct Pair[T],enum Box[T], boundsfn f[T: I](…)(0.2.2) - Tuples
(int, string)and multi-returnlet a, b = f()(incl. structs) - Maps: keys
int|string|float, valuesint|string|float|Struct;maps_* make(chan[T], n)/chan_open[T]for int/bool/float/string/struct/enum/tuple;chan_len/chan_capon anychan[T]- Structural
==/!=on structs and enums switch/case/defaultalongsidematchfan(xs, fn(x) { x * x })data parallelismgo f()fire-and-forget onto enclosing crew- Compound assignments (
+=,-=,++,--) - If-expressions (
let x = if c { a } else { b }) - Polymorphic
print ==on strings- Checked arithmetic (
checked_add/sub/mul,would_overflow_*) - Graceful shutdown (
install_graceful_shutdown,shutdown_requested, drain lifecycle) - Distributed tracing (
trace_begin/end/id/set/current/log,middleware_trace) - Leak detection (
leak_mark/check/scope_enter/exit,leak_report_json) crew_drain(timeout_ms)for draining crew tasksconst fncompile-time evaluation- Parser multi-error recovery
Init scaffolds (makori init) generate projects using the current pack/pull/
export conventions by default.
Native applications may explicitly add C source files to build, run, or
test:
mako build main.mko --native-source native/bridge.c
mako test tests --native-source native/test_bridge.c --native-source native/capture.c--native-source <FILE> is repeatable and accepts only regular .c files.
Mako passes each path as a compiler argument, never through a shell, and does
not scan the project directory for sources. This avoids accidentally linking
an unrelated file or a second main. The option is rejected for WebAssembly
targets and is applied to both incremental and direct native link paths.