Invocation, options and results
Linktopaz init
topaz init
Input
topaz init accepts no positional operands. - selects the destination and defaults to the current directory. A supplied directory value must be nonempty.
The target is native. - selects it explicitly. Other target values are rejected before files are written.
The generated package uses the current language mode. An explicit - must select that mode. It does not request an older scaffold.
Missing option values, unknown options, repeated options, attached values, program arguments after -, and output-format options are rejected before package creation.
Options and conflicts
| Option | Default | Contract | Conflicts |
|---|---|---|---|
--root <dir> | . | The explicit source root or package root for this invocation. | None listed |
--target native | native | scaffold a deterministic current-profile native package at --root (default | None listed |
--language-version <5.21> | 5.21 | language version selector | None listed |
Output channels
stdout
stderr
Exit status
0
Both the manifest and entry were written completely.
1
Invalid arguments, an unsupported target or language mode, an existing destination file, an unreadable destination, and any directory or file write failure.
Effects
The command creates the selected root and its src directory as needed. It creates topaz. and src/ with exclusive file creation.
Both destination paths are checked before either file is written. An existing manifest or entry is an error even when its contents match the scaffold. Other files in the root are preserved.
The manifest is written before the entry. A later I/O failure can leave the new manifest and directories behind. A failed scaffold is incomplete and is never reported as successful.
Initialization uses the installed template and makes no network requests. It does not download the standard library or a toolchain.
The same installed release, current language mode, and destination basename produce the same scaffold bytes. The package name keeps ASCII letters, digits, underscores, and hyphens from the basename and replaces other characters with underscores. An absent or empty basename selects topaz_.
The destination path in the completion message is resolved for the current filesystem. Repeating initialization in an already populated destination fails instead of replacing it.
The standard-library dependency uses a table as required by dependency-. Initialization creates neither topaz. nor a vendor tree. Lock generation is a separate operation.
Operation
LinkUse an empty destination for a new package. Existing files are protected from replacement.
Option conditions
Link- applies to emit, build, or init only
Behavior contract
LinkCommand behavior
Arguments and rejection
topaz init accepts no positional operands. - selects the destination and defaults to the current directory. A supplied directory value must be nonempty.
The target is native. - selects it explicitly. Other target values are rejected before files are written.
The generated package uses the current language mode. An explicit - must select that mode. It does not request an older scaffold.
Missing option values, unknown options, repeated options, attached values, program arguments after -, and output-format options are rejected before package creation.
Output
Successful creation leaves standard output empty. Standard error reports the package name and resolved destination in one completion line.
Failures write a human diagnostic to standard error and leave standard output empty. - is rejected because initialization has no JSON report.
The generated manifest has package version 0., entry src/, native build target, deterministic builds enabled, and a std dependency table containing the current language version. The entry is a complete Topaz program that writes Hello from Topaz and returns success.
Exit status
Exit code 0 means both the manifest and entry were written completely.
Exit code 1 covers invalid arguments, an unsupported target or language mode, an existing destination file, an unreadable destination, and any directory or file write failure.
Filesystem effects
The command creates the selected root and its src directory as needed. It creates topaz. and src/ with exclusive file creation.
Both destination paths are checked before either file is written. An existing manifest or entry is an error even when its contents match the scaffold. Other files in the root are preserved.
The manifest is written before the entry. A later I/O failure can leave the new manifest and directories behind. A failed scaffold is incomplete and is never reported as successful.
Network access
Initialization uses the installed template and makes no network requests. It does not download the standard library or a toolchain.
Reproducibility
The same installed release, current language mode, and destination basename produce the same scaffold bytes. The package name keeps ASCII letters, digits, underscores, and hyphens from the basename and replaces other characters with underscores. An absent or empty basename selects topaz_.
The destination path in the completion message is resolved for the current filesystem. Repeating initialization in an already populated destination fails instead of replacing it.
Packages and locks
The standard-library dependency uses a table as required by dependency-. Initialization creates neither topaz. nor a vendor tree. Lock generation is a separate operation.
Why
Package creation chooses the destination through -. A positional source path would express a second destination with no distinct role. Exclusive creation protects existing work and makes a successful scaffold immediately usable.
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/package/init.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/command/validation.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 initialization writes a package and is outside the execution allowlist. The linked safe recipe exercises rejection of an extra source operand. The public CLI cannot start in this sandbox, so the administrator runs that recipe in CI.
Example contract
LinkExample contract
The invocation topaz init main. is expected to exit with 1.
The command has no positional source operand. The adapter-supplied fixture operand is deliberately rejected before its operation; this is an arity example, not a successful init session.
Why
The package destination is selected by -. Rejecting a positional file keeps package creation from accepting an unused second destination.
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/package/init.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/command/validation.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.
The command has no positional source operand. The adapter-supplied fixture operand is deliberately rejected before its operation; this is an arity example, not a successful init session.
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/package/init.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/command/validation.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.