CLI

One binary, six commands. From a checkout bun run src/cli/index.ts is the same entry point and takes every command and flag below.

Commands

commanddoes
crust init <dir>scaffold into an empty directory: plain HTML and CSS, no bundler
crust init <dir> --reactthe React + Vite scaffold
crust init <dir> --nextthe Next.js scaffold, static export only
crust init <dir> --sveltethe Svelte + Vite scaffold
crust init <dir> --vuethe Vue + Vite scaffold
crust init <dir> --solidthe Solid + Vite scaffold: Solid 2, no SolidStart
crust dev [file]watch the backend, restart it on change, keep the frontend with its own dev server
crust build [file]compile the binary; on macOS assemble X.app in dist/ and ad-hoc sign it; --sign --notarize --dmg add the release stages
crust package [--format <fmt>]release artefacts for dmg, appimage or nsis; --format is repeatable and defaults to dmg
crust doctorone line per launch check; exit 1 if any check failed
crust perf record --app <dir>launch with the perf sink and write one sample per second to --out; see the performance guide
crust perf diff <a> <b>compare two records field by field; exit 1 when a metric regressed past --tolerance

crust perf owns its argv and its own crust perf --help, so it is not one of the five cac commands — but it is the sixth thing the binary can do.

crust perf diff writes its failures — a bad --tolerance, an unreadable record, or a record with no frame block — to stderr with exit 1; the comparison table and its REGRESS rows stay on stdout. crust perf record detaches its trap and re-raises SIGINT, SIGTERM and SIGHUP, and a failed run removes its --out file, so a later diff cannot read the previous run's result as this run's.

crust sign, crust dmg and crust notarize are gone. Each now prints crust: unknown command "<verb>" and exits 1. Their work is done by stages of crust build, run in one invocation after the plain build in this order: build → ad-hoc sign → --sign → --notarize → --dmg. --sign replaces the ad-hoc signature with a Developer ID; --notarize submits the signed app, then staples and validates its ticket; --dmg builds the image from the already-stapled app. The disk image itself is not notarized — the app's ticket travels inside it.

init refuses a non-empty directory, naming the entries it found, rather than merging into it.

Flags

flagapplies todoes
--dir <path>allproject directory, default the current directory
--config <path>allconfig file, relative to --dir
--entry <path>allbackend entry, relative to --dir, default src/main.ts then main.ts
--format <fmt>packagedmg, appimage or nsis; repeat the flag for several
--log-level <level>devtrace, debug, info, warn or error for this run; default info
--signbuildDeveloper ID sign the app, replacing the ad-hoc signature (needs CRUST_SIGNING_IDENTITY)
--notarizebuildnotarize and staple the signed app; implies --sign
--dmgbuildbuild a disk image from the signed app (macOS)
--reactinitcopy the React + Vite template
--nextinitcopy the Next.js template
--svelteinitcopy the Svelte + Vite template
--vueinitcopy the Vue + Vite template
--solidinitcopy the Vite + Solid 2 template
--help, -hallprint the usage text, exit 0
--version, -vallprint the version, exit 0

The five init flags are different scaffolds; passing two is refused before anything is written, naming each flag with the scaffold it copies. Any of them outside init fails with crust: --svelte only applies to init. init takes the directory once — a positional and --dir together is init takes one directory — pass <dir> or --dir, not both. An unknown option, a second positional, or a flag missing its value prints crust: <reason> then run "crust --help" for usage, and exits 1. Any stage flag on a command other than build fails with --<flag> only applies to build, and --log-level outside dev with --log-level only applies to dev. A value --log-level does not recognise is refused by name — unknown log level "verbose" — expected trace, debug, info, warn or error — rather than quietly running at the default.

The stages refuse before any build work runs. --notarize without --sign is notarize requires --sign — an ad-hoc signature cannot be submitted; add --sign with CRUST_SIGNING_IDENTITY. --sign without the identity is sign requires CRUST_SIGNING_IDENTITY — set "Developer ID Application: Name (TEAMID)". Off macOS, --dmg and --sign refuse with --dmg has no disk image on <platform> — a disk image is macOS only and --sign needs codesign, which is macOS-only (this platform is <platform>). --notarize without a credential or Developer ID signature names which is missing.

Single-file mode

commanddoes
crust dev app.tsxrun that one file as the whole app, with no config
crust build app.tsxbuild from the file; dist/<basename>.app on macOS

The config is built in memory: id crust.single.<slug>, name and window title from the basename, version 0.0.0, one window at 900×700. The page is bundled to <dir>/.crust/single in dev and <dir>/dist/single in a build. The backend is the framework itself — info and echo are registered, so invoke("info") proves the round trip — and every plugin is still reachable in the three-argument form. A file whose source contains export default is mounted as a React component, so react and react-dom must be installed beside it; any other file is loaded for its own side effects. A crust.config.ts beside the file is refused rather than guessed at.

crust dev

crust doctor

Checks, in order: platform, bun, config, macos, shim, bridge, dev port, dev url, backend, dev watch, window, source (known-fatal traps, only in an app directory with a config), assets, templates, bundle, gatekeeper (only when a .app is in dist/), then the extensions block. Each line is [ok], [note] or [fail], and only fail is counted. The run ends all checks passed with exit 0, or N checks failed with exit 1.

The extensions block reports zig, rustc and clang as found with their version or missing, then one verdict per .zig, .rs or .c file under native/. A source file whose compiler is missing counts as a failure; a project with no native/ directory prints one line and adds nothing to the count.

dev port classifies the port dev.url names before dev url probes it: free, held by a process that answers the URL (a note), held by one that answers nothing (the strictPort failure and the only fail in that pair), or answering while nothing listens locally (a proxy, a note).

Environment

variableread bydoes
CRUST_SIGNING_IDENTITYcrust build --sign, --notarizethe Developer ID identity to sign with; absent, --sign fails naming the variable and prints the expected form
CRUST_NOTARY_PROFILEcrust build --notarizea notarytool store-credentials profile; wins over the one-shot route
CRUST_NOTARY_APPLE_IDcrust build --notarizethe Apple ID for the one-shot credential route
CRUST_NOTARY_PASSWORDcrust build --notarizethe app-specific password for that Apple ID
CRUST_NOTARY_TEAM_IDcrust build --notarizethe team the Apple ID belongs to
CRUST_DEV_FILEcrust/vitethe bridge handshake path, default devHandshakePath() in the OS temp dir
CRUST_LOGcrust dev, every crust runtimeminimum log level: trace, debug, info, warn or error; beats logging.level, loses to --log-level
CRUST_SHIM_AUDITdarwin shim in crust dev / e2e harness1 adds ownership counters to the macOS C shim; a source checkout only — see below
XDG_CACHE_HOMEcompiled crust CLIbase for the private crust/framework/<version> cache, default ~/.cache; a tampered tree is refused by name

CRUST_SHIM_AUDIT=1 is a framework switch, not an app setting. It adds -DCRUST_SHIM_AUDIT when the macOS shim is compiled, so each audited unit counts acquisitions and drops and the harness can assert a zero balance; requestShimAudit() is the programmatic form the in-repo harness uses. Both go through the same availability check, which turns the switch into a no-op when NODE_ENV is production or the shim/*.c sources are not on disk — the case in a compiled binary. Use it from a source checkout in crust dev or an e2e run; a shipped app cannot be audited this way.

An uncaught command failure prints crust <command>: <message> and exits 1. Nothing prints a stack trace and nothing exits 0 on a refusal.