Invocation, options and results
Linktopaz build
topaz build [entry]
Input
topaz build [entry] accepts one optional source entry. Without it, the command loads topaz. from -, which defaults to the current directory. With an entry, the default source root is the entry directory.
- is required and its value must be nonempty. The target is native, web, or web-. An explicit - overrides the package manifest. Otherwise a package uses [build]. and an entry build uses native.
- selects the optimized profile. Without it the native output uses the debug profile. - executes a successfully built native artifact. Web targets reject - before a build starts.
Program arguments follow - and are accepted when - is present. They are passed unchanged to the built program. A program receiving explicit arguments must provide the supported exported entry contract.
- selects self or rust and defaults to self. - selects boxed or native and defaults to boxed. Native lowering requires -. - requires native lowering and a nonempty path.
The common compiler resource options require positive integer values. Unknown targets or backends, unsupported language modes, unsupported compiler combinations, output-format options, repeated options, attached values, extra entries, and missing values are rejected before compilation.
Options and conflicts
| Option | Default | Contract | Conflicts |
|---|---|---|---|
--compiler rust|self | self | compiler selector (default self); rust selects the reference compiler Also rejects combination with --producer, --self-source. | None listed |
--release | false | Command switch. | None listed |
--run | false | Command switch. | None listed |
--locked | false | Verify topaz.lock before compiling the selected package. | None listed |
--verbose | false | Reports the selected compiler and whether it was explicit or the default. For | None listed |
--root <dir> | entry directory; . in package mode | The explicit source root or package root for this invocation. | None listed |
--out-dir <dir> | Not specified | lower + scaffold (--out-dir | None listed |
--native-report-json <file> | Not specified | checked native emit/build only: atomically write a deterministic lowering decision report without changing normal output or artifacts | None listed |
--backend boxed|native | boxed | emit/build: lowering backend (default boxed). Native specialization requires --compiler rust. | None listed |
--target native|web|web-worker | native for an explicit entry; topaz.toml [build].target in package mode | build only: native executable (default), WASM package, or worker-ready web package | None listed |
--language-version <5.21> | 5.21 | language version selector | None listed |
--compiler-memory-mib <MiB> | 8192 | self compiler worker memory budget (8192); overrides TOPAZ_COMPILER_MEMORY_MIB A positive integer is required. Environment input: TOPAZ_COMPILER_MEMORY_MIB. | None listed |
--compiler-time-ms <ms> | 1800000 | self compilation wall-clock budget (1800000); overrides TOPAZ_COMPILER_TIME_MS A positive integer is required. Environment input: TOPAZ_COMPILER_TIME_MS. | None listed |
-- <args...> | Not specified | run/build --run: explicit program args passed to exported main(args, stdin) ( | None listed |
Output channels
stdout
stderr
Exit status
0
The requested artifact was installed and no requested native execution failed.
1
Invalid arguments, package or lock failures, parsing, resolution, checking or lowering failures, unsupported target or profile combinations, unavailable installed build tools, resource exhaustion, build-tool failure, and artifact publication failure. A requested native process that cannot start or terminates without a representable exit status also returns 1.
nonzero
After successful artifact publication with --run, a native program exit from 1 through 255 is returned unchanged. The built artifact remains installed.
Effects
The command reads source, manifest, locked dependency content, and declared extern or Lispex inputs. It builds in a Topaz-owned temporary workspace and copies the final artifact into the requested destination.
An existing topaz- must name the same target. Managed output paths must remain inside the destination and must not traverse symlinks. Existing unrelated files are preserved, and collisions with unowned paths are rejected.
New artifact bytes are staged before installation. Stale files recorded by the previous artifact manifest may be removed. The new manifest is installed after the managed files. An I/O failure during installation can leave incomplete output without a completed artifact manifest and returns failure.
Temporary workspaces and build logs may remain for storage inspection after a failed build. - adds the filesystem and other host effects of the executed program. Those effects are governed by the applicable program host and package capabilities.
Compilation and artifact construction use installed components and offline locked build tools. Missing build inputs cause failure rather than a registry request, toolchain download, or compiler fallback.
Automatic native execution may perform the network operations allowed by the program host. A build without - does not execute the application.
The compilation identity includes the selected compiler, language mode, backend, target, build profile, source bytes, locked dependencies, runtime components, host build toolchain, and build configuration. Byte reproducibility compares artifacts with all of those inputs fixed.
Different host toolchains, target platforms, compiler choices, or build profiles are different inputs. Temporary paths, progress timing, and build logs are not stable artifact content. Program output under - additionally depends on its arguments, input, and host effects.
Package mode uses the manifest entry, dependency declarations, target configuration, and capabilities. - verifies the existing lock before compilation and does not create or repair it.
Registry dependencies and Lispex package configuration require locked compilation. Missing, stale, duplicate, or undeclared lock entries fail before artifact production. An entry-file build outside package mode rejects -.
Build does not edit topaz., update topaz., or vendor missing dependency content. The emitted native build crate has its own locked offline runtime closure, separate from the package lock.
Operation
LinkChoose an output directory and a target supported by the installed product. Target selection and package activation are defined in Packages, locks and targets.
Option conditions
Link- applies to emit, build, or init only
- applies to build only
- applies to build only
- applies to emit/build only
- applies to emit/build only
- requires -
--locked applies to package-mode check, run, emit, build, test, doc, bench, compiler observe, compiler preview. Selected-entry test also accepts it when --root contains topaz.toml.
- program args apply to run, test, and build - only
- cannot be combined with bootstrap - or -
build - cannot be combined with -
build - cannot be combined with -
build requires - (a non-empty directory)
Behavior contract
LinkCommand behavior
Arguments and rejection
topaz build [entry] accepts one optional source entry. Without it, the command loads topaz. from -, which defaults to the current directory. With an entry, the default source root is the entry directory.
- is required and its value must be nonempty. The target is native, web, or web-. An explicit - overrides the package manifest. Otherwise a package uses [build]. and an entry build uses native.
- selects the optimized profile. Without it the native output uses the debug profile. - executes a successfully built native artifact. Web targets reject - before a build starts.
Program arguments follow - and are accepted when - is present. They are passed unchanged to the built program. A program receiving explicit arguments must provide the supported exported entry contract.
- selects self or rust and defaults to self. - selects boxed or native and defaults to boxed. Native lowering requires -. - requires native lowering and a nonempty path.
The common compiler resource options require positive integer values. Unknown targets or backends, unsupported language modes, unsupported compiler combinations, output-format options, repeated options, attached values, extra entries, and missing values are rejected before compilation.
Output
The build writes compiler diagnostics, build progress, warnings, and the final artifact path to standard error. A build without - leaves standard output empty.
With -, standard output and standard error from the program are inherited after the build succeeds. Build diagnostics remain on standard error.
- is rejected because build has no JSON report mode. The optional native lowering report is a separate file with schema identifier topaz.. It reports lowering decisions without replacing build output or the produced artifact.
A native build installs target/ or target/ under the output directory, with the executable suffix required by the host. A web build installs topaz-, topaz-, and topaz-. A worker build also installs its worker entry and client glue.
The destination includes topaz- and the required license and notice files. A reached Lispex application adds its identified runtime payload and host glue to the artifact.
Exit status
Exit code 0 means the requested artifact was installed and no requested native execution failed.
Exit code 1 covers invalid arguments, package or lock failures, parsing, resolution, checking or lowering failures, unsupported target or profile combinations, unavailable installed build tools, resource exhaustion, build-tool failure, and artifact publication failure.
After a successful build with -, the command returns the program exit code when it is representable from 0 through 255. A failed process start, signal termination, or unrepresentable process status returns 1. Program failure does not remove the built artifact.
Filesystem effects
The command reads source, manifest, locked dependency content, and declared extern or Lispex inputs. It builds in a Topaz-owned temporary workspace and copies the final artifact into the requested destination.
An existing topaz- must name the same target. Managed output paths must remain inside the destination and must not traverse symlinks. Existing unrelated files are preserved, and collisions with unowned paths are rejected.
New artifact bytes are staged before installation. Stale files recorded by the previous artifact manifest may be removed. The new manifest is installed after the managed files. An I/O failure during installation can leave incomplete output without a completed artifact manifest and returns failure.
Temporary workspaces and build logs may remain for storage inspection after a failed build. - adds the filesystem and other host effects of the executed program. Those effects are governed by the applicable program host and package capabilities.
Network access
Compilation and artifact construction use installed components and offline locked build tools. Missing build inputs cause failure rather than a registry request, toolchain download, or compiler fallback.
Automatic native execution may perform the network operations allowed by the program host. A build without - does not execute the application.
Reproducibility
The compilation identity includes the selected compiler, language mode, backend, target, build profile, source bytes, locked dependencies, runtime components, host build toolchain, and build configuration. Byte reproducibility compares artifacts with all of those inputs fixed.
Different host toolchains, target platforms, compiler choices, or build profiles are different inputs. Temporary paths, progress timing, and build logs are not stable artifact content. Program output under - additionally depends on its arguments, input, and host effects.
Packages and locks
Package mode uses the manifest entry, dependency declarations, target configuration, and capabilities. - verifies the existing lock before compilation and does not create or repair it.
Registry dependencies and Lispex package configuration require locked compilation. Missing, stale, duplicate, or undeclared lock entries fail before artifact production. An entry-file build outside package mode rejects -.
Build does not edit topaz., update topaz., or vendor missing dependency content. The emitted native build crate has its own locked offline runtime closure, separate from the package lock.
Why
Building an artifact and executing it express different intentions. Keeping - explicit lets callers request an artifact without application effects. The target chooses the resulting artifact and does not silently choose another compiler.
Source evidence
- compiler/crates/topaz_cli/src/command/flags.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/command/dispatch.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/commands/build.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/command/validation.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/compiler_support.rs at
b48527d0a174
The linked public CLI recipe checks the exact displayed argument rejection before the requested operation. It does not execute the successful operation or verify its effects.
Successful builds invoke host toolchains and create binary artifacts, and - executes application code. These invocations are outside the reviewed execution allowlist. The linked recipe rejects an invalid target before building. Host and Lispex target activation require administrator-owned installed-product CI evidence.
Example contract
LinkExample contract
The invocation topaz build main. is expected to exit with 1.
Reject an unsupported target during argument validation before producing source, building a program, or creating a binary.
Why
An output target selects the representation of the generated program. Rejecting an unknown target prevents the command from producing a different representation than requested.
Source evidence
- compiler/crates/topaz_cli/src/command/flags.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/command/dispatch.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/commands/build.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/command/validation.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/compiler_support.rs at
b48527d0a174
Example
LinkArgument-rejection example
Linkfunction identity<T>(value: T) -> T {value}
Expected result
Expected result
Textual rejection details remain Pending in the reference model. The independent Tools example gate expects exit 1.
Reject an unsupported target during argument validation before producing source, building a program, or creating a binary.
Source evidence
- compiler/crates/topaz_cli/src/command/flags.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/command/dispatch.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/commands/build.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/command/validation.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/compiler_support.rs at
b48527d0a174
Verification scope
LinkObserved with Topaz 5.21.3 on 2026-11-06T08:36:29.642Z. This invocation passed; exit 1. 3 assertions were evaluated against the independent expected result. Execution record. This result covers the displayed invocation.