Invocation, options and results
Linktopaz emit
topaz emit [entry]
Input
topaz emit [entry] accepts one optional source entry. Without an entry it loads the package at -, defaulting to the current directory. With an entry, the default root is its directory.
The output target is rust. - selects it explicitly and any other target is rejected. Without -, the primary source is written to standard output. With -, the directory value must be nonempty.
- selects self or rust. - selects boxed or native. The defaults are self and boxed. Native lowering requires -.
- requires native lowering and a nonempty file path. It requests a separate lowering report and does not select JSON presentation for emitted source.
A package with a reached Lispex application requires - so that its runtime closure can accompany the generated source. Program arguments, -, -, output-format options, missing values, repeated options, attached values, and additional entries are rejected.
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 |
--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 | expose generated Rust source for inspection/integration ( | 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 rust | rust | emit only: generated source target (default rust) | 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 |
Output channels
stdout
stderr
Exit status
0
The requested source stream or complete crate was emitted successfully.
1
Invalid arguments, input or lock failures, parsing, resolution, checking or lowering failures, unsupported compiler or profile combinations, resource exhaustion, missing runtime components, and output or report write failures.
Effects
The command reads the selected source and applicable package inputs. Emitting to standard output creates no output crate. Compiler workspaces may be created by the selected compiler.
- creates the crate directory and writes the generated crate files and admitted runtime closure. Existing files with generated paths may be replaced. Files outside the chosen output directory are not crate outputs.
The optional native report is staged and published at its explicit path. It does not grant authority to modify the input manifest or lock. A failed crate write can leave files already written during that invocation.
Emission uses local package content and the installed runtime closure without network access. It neither invokes Cargo to build the crate nor executes the generated program.
Identical source and package bytes, lock identities, compiler, language mode, backend, and runtime components produce identical generated source and crate content. Generated content does not depend on enumeration order, wall-clock time, or a random workspace name.
Diagnostics can include input paths and the completion line includes the chosen destination. Comparing those streams requires the same path inputs.
- verifies an existing package lock before compilation. Registry dependencies and Lispex configuration require it. Missing or mismatched dependencies fail rather than being materialized.
Emission leaves topaz. and topaz. unchanged. The generated crate's Cargo. binds its embedded Rust runtime closure and does not replace the Topaz package lock.
Operation
LinkChoose an output directory when the complete source set is needed. Standard output carries the primary generated source.
Option conditions
Link- applies to emit, build, or init 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.
- cannot be combined with bootstrap - or -
a reached Lispex application requires emit - so its exact conditional runtime closure can be written
Behavior contract
LinkCommand behavior
Arguments and rejection
topaz emit [entry] accepts one optional source entry. Without an entry it loads the package at -, defaulting to the current directory. With an entry, the default root is its directory.
The output target is rust. - selects it explicitly and any other target is rejected. Without -, the primary source is written to standard output. With -, the directory value must be nonempty.
- selects self or rust. - selects boxed or native. The defaults are self and boxed. Native lowering requires -.
- requires native lowering and a nonempty file path. It requests a separate lowering report and does not select JSON presentation for emitted source.
A package with a reached Lispex application requires - so that its runtime closure can accompany the generated source. Program arguments, -, -, output-format options, missing values, repeated options, attached values, and additional entries are rejected.
Output
Without -, standard output contains the primary UTF-8 generated Rust source and no human banner. Standard error carries diagnostics and requested verbose compiler details.
With -, standard output is empty and standard error identifies the completed self-contained crate. The crate contains generated source, Cargo., Cargo., pinned toolchain information, the vendored runtime closure, and source-distribution notices.
- is rejected because emit has no JSON report mode. The optional native lowering report is written to its requested file with schema identifier topaz.. It does not change ordinary output channels.
No source output is produced for an argument, package, resolution, checking, or lowering failure. A later output I/O error can leave a partial stream or partially written crate and is reported as failure.
Exit status
Exit code 0 means the requested source stream or complete crate was emitted successfully.
Exit code 1 covers invalid arguments, input or lock failures, parsing, resolution, checking or lowering failures, unsupported compiler or profile combinations, resource exhaustion, missing runtime components, and output or report write failures.
Filesystem effects
The command reads the selected source and applicable package inputs. Emitting to standard output creates no output crate. Compiler workspaces may be created by the selected compiler.
- creates the crate directory and writes the generated crate files and admitted runtime closure. Existing files with generated paths may be replaced. Files outside the chosen output directory are not crate outputs.
The optional native report is staged and published at its explicit path. It does not grant authority to modify the input manifest or lock. A failed crate write can leave files already written during that invocation.
Network access
Emission uses local package content and the installed runtime closure without network access. It neither invokes Cargo to build the crate nor executes the generated program.
Reproducibility
Identical source and package bytes, lock identities, compiler, language mode, backend, and runtime components produce identical generated source and crate content. Generated content does not depend on enumeration order, wall-clock time, or a random workspace name.
Diagnostics can include input paths and the completion line includes the chosen destination. Comparing those streams requires the same path inputs.
Packages and locks
- verifies an existing package lock before compilation. Registry dependencies and Lispex configuration require it. Missing or mismatched dependencies fail rather than being materialized.
Emission leaves topaz. and topaz. unchanged. The generated crate's Cargo. binds its embedded Rust runtime closure and does not replace the Topaz package lock.
Why
Emitting source supports inspection and integration, while building requests an executable artifact. These intentions remain distinct even when a later external build produces the same program. The lowering report is also distinct from the emitted source.
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/command/validation.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/compiler_support.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/commands/emit.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 source emission and crate creation are outside the exact reviewed execution allowlist. The linked safe recipe rejects an invalid target. Runtime closure and artifact checks remain for the administrator's CI rather than new unreviewed runner arguments.
Example contract
LinkExample contract
The invocation topaz emit 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/command/validation.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/compiler_support.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/commands/emit.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/command/validation.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/compiler_support.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/commands/emit.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.