CLI reference
Source of truth is crates/zz_cli/src/main.rs dispatch + per-command modules.
Exit 0 success, 1 errors / fmt-check failed, 2 test discovery/compile error.
Run / eval / dis / profile
Section titled “Run / eval / dis / profile”zz # REPL (:help, :quit, :type expr, :clear)zz run [<file.zz>] # VM, no artifacts; defaults to project entryzz run --bytecode [<file.zz>|file.zzc] # force the chunk VM (never the tree walker)zz run --native [<file.zz>] # AOT cached build + exec private staged copyzz run --embed <dir> [<file.zz>] # expose assets (`fs.embedfs()`)zz run --native -o <name> [<file.zz>] # name the published binaryzz run --watch [<file.zz>] [--clear] [--debounce <ms>] [--watch-ignore <glob>]...zz run --features a,b [<file.zz>] # enable project features (repeatable)zz run --all-features [<file.zz>] # enable every declared featurezz eval "<src>" # eval string, print resultzz dis [<file.zzc|file.zz>] # disassemble bytecode/chunkzz dis --vm [--stats] [<file>] # VM chunk ops (or per-class mix) + source siteszz profile [<file.zz>] [-- args]# PGO profile flow (llvm-profdata merge)--watch rejects --native/--bytecode. Roots >20k entries refuse with a hint.
zz run engine = run-cache state: warm → cached IR in the chunk VM, miss →
tree walker (+ store). ZZ_RUN_CACHE=0 forces the walker, ZZ_VERBOSE=1
prints hit/miss and stage lines; entries live in <build-cache>/run-v2
(LRU, 256), cleared by zz cache clean. zz run --help lists the flags.
ZZ_VM_STATS=1 zz run f.zz counts dispatched ops and prints a per-class
summary (fused/int-op/stack/arith/control/call/access/alloc) to stderr
at exit; program stdout is untouched. zz dis --vm shows the same chunks
statically, zz dis --vm --stats the class mix and top opcodes.
zz build [-p|--release|-O3|--static|--dynamic|--full|--pgo] [--target <triple>] [--cc <clang|zig>] [--embed <dir>] [-o <name>] [<file.zz>]-prelease-O3 -flto=thincached~/.zz/cache;--fullmax LTO (+ PGO training with-- <args>).--staticself-contained (not macOS),--dynamicfast-O0 -g.--targetcross (implies-p, safe baseline CPU,-fuse-ld=lld,-lws2_32on Windows).--cc zig|clang,--verboseprints clang line,--embed <dir>bakes assets.--pgonative-host only;--allow-source-builds/--allow-hooksgate source builds.
Outputs: standalone ./<stem>; project <root>/bin/<name>; --target adds
-<triple>; -o renames. Atomic publish; sidecars app.c/build.sh/build.bat.
Build phases
Section titled “Build phases”zz build reports five generic steps on stderr, identical for every backend:
building demopkg (static)==> [1/5] Checking: 12 modules (10 cached)==> [2/5] Optimizing: 512 functions==> [3/5] Compiling: 14 files (3 cached)==> [4/5] Linking: 14 files==> [5/5] Publishing: bin/demopkg (1.2 MB)✓ built bin/demopkg (static, 1.2 MB)- The header names the target: a project build uses the
zz.tomlpackage name (building demopkg (static), plus a dim entry when it is not the conventionalsrc/main.zz), a loose file its file name (building hello.zz (static)). - On a TTY each step owns one line, rewritten in place with a live counter
(modules checked, files compiled) and closed with
✓and elapsed time. Piped stderr gets exactly one plain line per step — no ANSI, no\r. - Unchanged source short-circuits before type-checking:
==> cached · source unchanged, then only thePublishingstep. A cached build does not needclangonPATH. - Colour is on by default on a TTY.
ZZ_COLOR=neverdisables it andZZ_COLOR=alwaysforces ANSI through a pipe;NO_COLORandTERM=dumbalways win over both.auto(the default) means TTY only. ZZ_BUILD_CACHE=0forces a real build (no cache probe, no reuse), likeZZ_RUN_CACHE=0/ZZ_CHECK_CACHE=0.--verboseadds timing lines; a cache hit names the reused entry (zz: cache hit <path>) instead of a toolchain line.zz profile,zz build --full -- <args>andzz installnest the same five steps under their own numbered pipeline;zz run --native,zz testandzz benchstay silent.
Check / fix / fmt
Section titled “Check / fix / fmt”zz check [PATH] [--fix|-f] [--hard] [--interactive|-i] [--stats] [--format json]zz fix [PATH] [--hard] # = check --fixzz fmt [PATH] [-c|--check] # -c dry runzz check --check rejected (use zz fmt --check).
Test / bench / cover
Section titled “Test / bench / cover”zz test [path] [--exact] [--tag <t>] [--skip <s>] [--jobs N] [--serial] [--nocapture] [--seed <n>] [--list] [--repeat N] [--fail-fast] [--fail-on-empty] [--native] [--engine vm|native] [-p|--release] [--timeout <ms>] [--soft-timeout] [--json] [--junit <path>] [--slow-threshold <ms>] [--changed] [--update-snapshots] [--no-doctests]
zz bench [path] [--engine native] [--list] [--filter/-f <s>] [--exact] [--tag/-t <t>] [--skip/-s <s>] [--iters/-n N] [--warmup/-w N] [--timeout <ms>] [--json]
zz cover [path] # VM + AOT coverage, see coverage.md--nocapture forces --serial with a note. zz.toml [test] mirrors flags; CLI wins.
Packages
Section titled “Packages”zz init [name] | zz new <name>zz add <dep> | zz install [--frozen] | zz install -i | zz remove <dep>zz update | zz outdated | zz deps | zz auditzz search <q> | zz info <pkg> | zz registry | zz login | zz publishzz generate-wrapperzz clean [--deps] # bin/build/src/bin (+ vendor + lock)zz cache clean | zz cache gcManifest wins on source; stale lock pins ignored with a note; fresh clones fetch+link.
publish bundles DOCS.md else docs/**/*.md (max 200KB).
--features a,b / --all-features also apply to build, check, and
install; without [features] the flags are a no-op (default selection).
System
Section titled “System”zz setup | zz completion [shell] # PATH + completions oncezz upgrade [--dry-run] | zz doctor [--fix]zz toolchain install [--version X] | zz toolchain status|use|uninstallZZ_HOME relocates cache; ZZ_TOOLCHAIN_ROOT relocates managed toolchain.
Toolchain from official ziglang.org index.json, sha256-checked; pin prefers
managed zig unless --cc forces provider.
Full narratives: CLI, Check/fmt, Test/bench, Packages.