본문으로 건너뛰기
토파즈6.0 · 출시 전
다운로드 →

문서 검색

명세 6.0

방향키로 결과를 고르고 Enter를 눌러 여세요.

API 이름, 진단 번호, 규칙 또는 프로젝트 주제를 입력하세요.

    도구

    init

    Creates a Topaz package at the selected root.

    Invocation, options and results

    링크

    topaz init

    호출 형식
    1. topaz init

    입력

    topaz init accepts no positional operands. --root <dir> selects the destination and defaults to the current directory. A supplied directory value must be nonempty.

    The target is native. --target native selects it explicitly. Other target values are rejected before files are written.

    The generated package uses the current language mode. An explicit --language-version 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.

    옵션과 충돌

    옵션기본값계약충돌
    --root <dir>.

    The explicit source root or package root for this invocation.

    없음
    --target nativenative

    scaffold a deterministic current-profile native package at --root (default .); refuses to overwrite existing files

    없음
    --language-version <5.21>5.21

    language version selector

    없음

    출력 채널

    stdout

    stderr

    종료 상태

    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.

    효과

    The command creates the selected root and its src directory as needed. It creates topaz.toml and src/main.tpz 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_app.

    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-table.1. Initialization creates neither topaz.lock nor a vendor tree. Lock generation is a separate operation.

    Operation

    링크

    Use an empty destination for a new package. Existing files are protected from replacement.

    Option conditions

    링크

    --target applies to emit, build, or init only

    Behavior contract

    링크
    규칙tools-commands-init.rule.behavior

    Command behavior

    Arguments and rejection

    topaz init accepts no positional operands. --root <dir> selects the destination and defaults to the current directory. A supplied directory value must be nonempty.

    The target is native. --target native selects it explicitly. Other target values are rejected before files are written.

    The generated package uses the current language mode. An explicit --language-version 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. --format json is rejected because initialization has no JSON report.

    The generated manifest has package version 0.1.0, entry src/main.tpz, 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.toml and src/main.tpz 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_app.

    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-table.1. Initialization creates neither topaz.lock nor a vendor tree. Lock generation is a separate operation.

    이유

    Package creation chooses the destination through --root. 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.

    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

    링크
    규칙tools-commands-init.rule.invocation

    Example contract

    The invocation topaz init main.tpz --language-version 5.21 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.

    이유

    The package destination is selected by --root. Rejecting a positional file keeps package creation from accepting an unused second destination.

    Example

    링크

    Argument-rejection example

    링크
    main.tpzArgument-rejection example플레이그라운드 열기 →
    1. function identity<T>(value: T) -> T {
    2. value
    3. }
    대상 제품 5.21.3
    기대 결과

    기대 결과

    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.

    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.

    Related references

    링크

    Compiler selection →

    Packages, locks and targets →

    메뉴

    다운로드 →