Invocation, options and results
Ссылкаtopaz emit
topaz emit [entry]
Ввод
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.
Параметры и конфликты
| Параметр | Значение по умолчанию | Контракт | Конфликты |
|---|---|---|---|
--compiler rust|self | self | compiler selector (default self); rust selects the reference compiler Also rejects combination with --producer, --self-source. | Не перечислены |
--locked | false | Verify topaz.lock before compiling the selected package. | Не перечислены |
--verbose | false | Reports the selected compiler and whether it was explicit or the default. For | Не перечислены |
--root <dir> | entry directory; . in package mode | The explicit source root or package root for this invocation. | Не перечислены |
--out-dir <dir> | Не указано | expose generated Rust source for inspection/integration ( | Не перечислены |
--native-report-json <file> | Не указано | checked native emit/build only: atomically write a deterministic lowering decision report without changing normal output or artifacts | Не перечислены |
--backend boxed|native | boxed | emit/build: lowering backend (default boxed). Native specialization requires --compiler rust. | Не перечислены |
--target rust | rust | emit only: generated source target (default rust) | Не перечислены |
--language-version <5.21> | 5.21 | language version selector | Не перечислены |
--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. | Не перечислены |
--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. | Не перечислены |
Каналы вывода
stdout
stderr
Статус завершения
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.
Эффекты
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
СсылкаChoose an output directory when the complete source set is needed. Standard output carries the primary generated source.
Option conditions
Ссылка- 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
СсылкаCommand 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.
Причина
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.
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
СсылкаExample 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.
Причина
An output target selects the representation of the generated program. Rejecting an unknown target prevents the command from producing a different representation than requested.
Example
СсылкаArgument-rejection example
Ссылкаfunction identity<T>(value: T) -> T {value}
Ожидаемый результат
Ожидаемый результат
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.
Verification scope
СсылкаObserved 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.