CLI and config reference
This page lists every witforge subcommand, flag, witforge.toml configuration key, and exit
code. The test suite verifies this page against the CLI parser so no option can go undocumented.
Exit codes
Section titled “Exit codes”| Exit code | Meaning |
|---|---|
0 |
Success (valid contract, up-to-date generated files, passing gate) |
1 |
Contract, lockfile, compatibility, release-freeze, plugin contract diagnostic, or generated-output drift violation |
2 |
Operational, CLI usage, parse, I/O, or safety-guard error |
Global options
Section titled “Global options”Every subcommand accepts these global options:
| Option | Description |
|---|---|
--format <FORMAT> |
Diagnostic output format: human (default), json (versioned diagnostic envelope on stdout), or sarif (SARIF 2.1.0 on stdout). |
-q, --quiet |
Suppress human notes and summaries (never hides errors, exit codes, or JSON/SARIF output). |
-h, --help |
Print help for witforge or a subcommand. |
-V, --version |
Print version (bare X.Y.Z on exact clean release tags/tarballs; appends short Git commit and -dirty on development builds). |
Commands
Section titled “Commands”witforge check
Section titled “witforge check”Validate one version directory, an entire WIT root, or configured project(s) without writing.
| Option / Argument | Description |
|---|---|
[PATH] |
Version directory or WIT root; omit to check configured project root(s) via witforge.toml. |
--lock <PATH> |
Lockfile path (single version directory only; defaults to <WIT_DIR>/wire.lock). |
--first |
Treat every existing lockfile entry as a draft (single version directory only; conflicts with --against). |
--against <PATH> |
Treat entries from this baseline lockfile as released (single version directory only; conflicts with --first). |
--released <PATH> |
Released-version manifest path (defaults to <WIT_DIR>/../released or <WIT_ROOT>/released). |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Project name in witforge.toml. |
witforge lock
Section titled “witforge lock”Reconcile wire.lock for one version directory, assigning wire numbers to new members and
reserving removed ones. Refuses released directories.
| Option / Argument | Description |
|---|---|
<WIT_DIR> |
WIT version directory to lock. |
--lock <PATH> |
Lockfile path (defaults to <WIT_DIR>/wire.lock). |
--first |
Create or reconcile a fresh draft lockfile with no baseline (conflicts with --against). |
--against <PATH> |
Reconcile against a predecessor version’s wire.lock (conflicts with --first). |
--released <PATH> |
Additional released-version manifest to check alongside defaults. |
witforge rust
Section titled “witforge rust”Generate or check plain Rust types, interface traits, worlds.rs, witforge_deps.rs, and
convert.rs.
| Option / Argument | Description |
|---|---|
[WIT_ROOT] |
WIT root containing v<major>.<minor> version directories. |
--out <DIR> |
Output directory for generated Rust files. |
--check |
Verify existing files match without writing; exits 1 on drift. |
--diff |
Print a unified diff of output changes without changing the exit status. |
--serde |
Enable serde::Serialize and serde::Deserialize derives (conflicts with --no-serde). |
--no-serde |
Disable Serde derives, overriding witforge.toml (conflicts with --serde). |
--no-std |
Emit #![no_std] + alloc compatible paths (::alloc::*, ::core::*), overriding witforge.toml (conflicts with --std). |
--std |
Emit default std paths, overriding no-std = true in witforge.toml (conflicts with --no-std). |
--eq-hash |
Derive Eq and Hash on generated float-free records, variants, enums, and flags, overriding witforge.toml (conflicts with --no-eq-hash). |
--no-eq-hash |
Disable Eq/Hash derives, overriding eq-hash = true in witforge.toml (conflicts with --eq-hash). |
--try-from |
Emit TryFrom impls in convert.rs for converted nominal types, overriding witforge.toml (conflicts with --no-try-from). |
--no-try-from |
Disable TryFrom impls in convert.rs, overriding try-from = true in witforge.toml (conflicts with --try-from). |
--released <PATH> |
Released-version manifest path (defaults to <WIT_ROOT>/released). |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Project name in witforge.toml. |
witforge proto
Section titled “witforge proto”Generate or check per-major protobuf schemas (v<major>.proto and dependency .proto files).
| Option / Argument | Description |
|---|---|
[WIT_ROOT] |
WIT root containing v<major>.<minor> version directories. |
--out <DIR> |
Output directory for generated .proto files. |
--go-package <VALUE> |
Base go_package import path prefix (or explicit path;alias for single-file output), overriding project.<name>.proto.go-package. |
--java-package <VALUE> |
Base java_package prefix for emitted .proto files, overriding project.<name>.proto.java-package. |
--java-multiple-files |
Emit option java_multiple_files = true;, overriding config (conflicts with --no-java-multiple-files). |
--no-java-multiple-files |
Omit option java_multiple_files, overriding project.<name>.proto.java-multiple-files (conflicts with --java-multiple-files). |
--java-outer-classname <NAME> |
Emit option java_outer_classname = "<NAME>";, overriding project.<name>.proto.java-outer-classname. |
--csharp-namespace <VALUE> |
Base csharp_namespace prefix for emitted .proto files, overriding project.<name>.proto.csharp-namespace. |
--check |
Verify existing files match without writing; exits 1 on drift. |
--diff |
Print a unified diff of output changes without changing the exit status. |
--released <PATH> |
Released-version manifest path (defaults to <WIT_ROOT>/released). |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Project name in witforge.toml. |
witforge schema
Section titled “witforge schema”Generate or check JSON Schema files (v<major>_<minor>.schema.json and dependency schemas;
Draft 7 by default, or Draft 2020-12 with --draft 2020-12).
| Option / Argument | Description |
|---|---|
[WIT_ROOT] |
WIT root containing v<major>.<minor> version directories. |
--out <DIR> |
Output directory for generated JSON Schema files. |
--draft <DRAFT> |
JSON Schema dialect: 7 (default) or 2020-12 (overrides project.<name>.schema.draft). |
--check |
Verify existing files match without writing; exits 1 on drift. |
--diff |
Print a unified diff of output changes without changing the exit status. |
--released <PATH> |
Released-version manifest path (defaults to <WIT_ROOT>/released). |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Project name in witforge.toml. |
witforge glue
Section titled “witforge glue”Generate or check Rust/prost conversion glue (v<major>.rs, mod.rs, witforge_deps.rs).
| Option / Argument | Description |
|---|---|
[WIT_ROOT] |
WIT root containing v<major>.<minor> version directories. |
--out <DIR> |
Output directory for generated glue files. |
--plain-root <PATH> |
Absolute Rust module path to generated plain modules (for example crate::plain). |
--proto-root <PATH> |
Absolute Rust module path to prost modules (for example crate::proto). |
--no-std |
Emit #![no_std] + alloc compatible paths (::alloc::*, ::core::*), overriding witforge.toml (conflicts with --std). |
--std |
Emit default std paths, overriding no-std = true in witforge.toml (conflicts with --no-std). |
--check |
Verify existing files match without writing; exits 1 on drift. |
--diff |
Print a unified diff of output changes without changing the exit status. |
--released <PATH> |
Released-version manifest path (defaults to <WIT_ROOT>/released). |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Project name in witforge.toml. |
witforge doc
Section titled “witforge doc”Generate or check deterministic Markdown contract reference pages (index.md and one
v<major>_<minor>.md per live version).
| Option / Argument | Description |
|---|---|
[WIT_ROOT] |
WIT root containing v<major>.<minor> version directories. |
--out <DIR> |
Output directory for generated Markdown reference files. |
--check |
Verify existing files match without writing; exits 1 on drift. |
--diff |
Print a unified diff of output changes without changing the exit status. |
--released <PATH> |
Released-version manifest path (defaults to <WIT_ROOT>/released). |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Project name in witforge.toml. |
witforge ts
Section titled “witforge ts”Generate or check zero-dependency strict ESM TypeScript types, shared Option helpers
(witforge_types.ts), interfaces, dependency modules (witforge_deps/), world metadata
(worlds.ts), and bidirectional cross-version conversion adapters (convert.ts when two or more
live versions exist).
| Option / Argument | Description |
|---|---|
[WIT_ROOT] |
WIT root containing v<major>.<minor> version directories. |
--out <DIR> |
Output directory for generated TypeScript files. |
--check |
Verify existing files match without writing; exits 1 on drift. |
--diff |
Print a unified diff of output changes without changing the exit status. |
--released <PATH> |
Released-version manifest path (defaults to <WIT_ROOT>/released). |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Project name in witforge.toml. |
witforge ts-glue
Section titled “witforge ts-glue”Generate or check TypeScript checked protobuf glue targeting @bufbuild/protobuf (protobuf-es
v2): toProto / fromProto conversions, per-function toRequest / fromRequest /
toResponse / fromResponse helpers, METHOD constants, message schema references, and
structured WitforgeGlueError diagnostics enforcing all 13 rows of the WIT decode profile plus
encode-side range, scalar char, closed-enum, and exact fixed-length list bounds.
| Option / Argument | Description |
|---|---|
[WIT_ROOT] |
WIT root containing v<major>.<minor> version directories. |
--out <DIR> |
Output directory for generated TypeScript protobuf glue files. |
--plain-root <PATH> |
ESM import root containing generated plain TypeScript files (relative path such as ../plain or bare npm package specifier such as @acme/plain). |
--proto-root <PATH> |
ESM import root containing generated @bufbuild/protobuf *_pb.js files (relative path such as ../proto or bare npm package specifier such as @acme/proto). |
--check |
Verify existing files match without writing; exits 1 on drift. |
--diff |
Print a unified diff of output changes without changing the exit status. |
--released <PATH> |
Released-version manifest path (defaults to <WIT_ROOT>/released). |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Project name in witforge.toml. |
witforge py
Section titled “witforge py”Generate or check zero-dependency Python 3.11+ stdlib packages (@dataclass(frozen=True, slots=True),
StrEnum, Protocol interfaces, union variants, shared Option/Ok/Err helpers in
witforge_types.py, dependency packages under witforge_deps/, worlds.py, bidirectional
cross-version conversion adapters in convert.py when two or more live versions exist, and the
empty PEP 561 py.typed marker).
| Option / Argument | Description |
|---|---|
[WIT_ROOT] |
WIT root containing v<major>.<minor> version directories. |
--out <DIR> |
Output directory for generated Python package files. |
--check |
Verify existing files match without writing; exits 1 on drift. |
--diff |
Print a unified diff of output changes without changing the exit status. |
--released <PATH> |
Released-version manifest path (defaults to <WIT_ROOT>/released). |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Project name in witforge.toml. |
witforge py-glue
Section titled “witforge py-glue”Generate or check Python checked protobuf glue targeting official google.protobuf
(protoc --python_out and google.protobuf.json_format): to_proto / from_proto conversions,
per-function to_request / from_request / to_response / from_response helpers, METHOD
constants, message class references (proto_type, request_type, response_type), and structured
WitforgeGlueError (ValueError subclass) diagnostics enforcing all 13 rows of the WIT decode
profile plus encode-side integer (rejecting bool), Unicode scalar char, closed-enum, exact
fixed-length list, and map-key checks.
| Option / Argument | Description |
|---|---|
[WIT_ROOT] |
WIT root containing v<major>.<minor> version directories. |
--out <DIR> |
Output directory for generated Python protobuf glue files. |
--plain-root <PATH> |
Python package root containing generated plain Python modules (dotted absolute path such as my_app.plain or relative path such as ..plain). |
--proto-root <PATH> |
Python package root containing generated protoc --python_out *_pb2.py modules (dotted absolute path such as my_app.proto or relative path such as ..proto). When a contract uses deps/, add the --proto-root directory itself to PYTHONPATH / sys.path because protoc --python_out emits root-relative cross-file *_pb2 imports. |
--check |
Verify existing files match without writing; exits 1 on drift. |
--diff |
Print a unified diff of output changes without changing the exit status. |
--released <PATH> |
Released-version manifest path (defaults to <WIT_ROOT>/released). |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Project name in witforge.toml. |
witforge go
Section titled “witforge go”Generate or check zero-dependency, gofmt-formatted Go 1.22+ stdlib packages: root doc.go,
structs for records and flags, typed uint32 enums with Valid() and String(), sealed variant
interfaces with case structs, Go interface declarations for function-bearing WIT interfaces,
native fixed-length arrays ([N]T), exact signed/unsigned integer widths (uint8..uint64,
int8..int64), Unicode rune, shared generic Option[T] / Result[T, E] helpers in
witforge_types, witforge_deps/ packages with cross-major canonical-owner aliases, worlds
metadata, and bidirectional cross-version conversion packages under convert/ when two or more
live versions exist.
| Option / Argument | Description |
|---|---|
[WIT_ROOT] |
WIT root containing v<major>.<minor> version directories. |
--out <DIR> |
Output directory for generated Go package files. |
--go-module <VALUE> |
Go module import path prefix for emitted packages (for example example.com/acme/contracts/gen/plain). |
--check |
Verify existing files match without writing; exits 1 on drift. |
--diff |
Print a unified diff of output changes without changing the exit status. |
--released <PATH> |
Released-version manifest path (defaults to <WIT_ROOT>/released). |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Project name in witforge.toml. |
witforge go-glue
Section titled “witforge go-glue”Generate or check Go checked protobuf glue targeting google.golang.org/protobuf
(protoc-gen-go and protojson, paired with witforge proto --go-package): root doc.go,
structured *glueerr.GlueError implementing error, narrow-width and Unicode scalar helpers in
helpers, per-major <Type>ToProto / <Type>FromProto conversions, per-function
<Fn>ToRequest / <Fn>FromRequest / <Fn>ToResponse / <Fn>FromResponse helpers, typed
Method constants, and witforge_deps/ cross-major glue enforcing all 13 rows of the WIT decode
profile plus encode-side Unicode scalar rune, valid UTF-8 string, closed-enum, non-nil
[]byte, and deterministic sorted-key map<K, V> checks.
| Option / Argument | Description |
|---|---|
[WIT_ROOT] |
WIT root containing v<major>.<minor> version directories. |
--out <DIR> |
Output directory for generated Go protobuf glue files. |
--go-module <VALUE> |
Go module import path prefix for emitted glue packages (for example example.com/acme/contracts/gen/glue). |
--plain-root <VALUE> |
Go import path prefix for generated plain Go packages (matching witforge go --go-module). |
--proto-root <VALUE> |
Go import path prefix for generated *.pb.go packages (matching witforge proto --go-package). |
--check |
Verify existing files match without writing; exits 1 on drift. |
--diff |
Print a unified diff of output changes without changing the exit status. |
--released <PATH> |
Released-version manifest path (defaults to <WIT_ROOT>/released). |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Project name in witforge.toml. |
witforge java
Section titled “witforge java”Generate or check zero-dependency Java 21 LTS+ stdlib package trees under --java-package:
root package-info.java, shared WitforgeUnit, WitforgeResult, and WitforgeValues
defensive-copy/deep-equality helpers, per-version interface packages
(<pkg>.v<major>_<minor>.<iface>), immutable record declarations for records and flags,
enum declarations with witName(), sealed interface ... permits ... variants with nested
case records, service interface declarations for function-bearing WIT interfaces,
witforge_deps/ packages (with canonical-owner sharing across majors), Worlds.java
metadata when any live version declares worlds, and bidirectional cross-version conversion
adapters (ConversionErrorKind.java, WitforgeConversionException.java, Convert.java) when
two or more live versions exist.
| Option / Argument | Description |
|---|---|
[WIT_ROOT] |
WIT root containing v<major>.<minor> version directories. |
--out <DIR> |
Output directory for generated Java source files. |
--java-package <VALUE> |
Base Java package prefix for emitted packages (for example com.acme.contracts.plain). |
--check |
Verify existing files match without writing; exits 1 on drift. |
--diff |
Print a unified diff of output changes without changing the exit status. |
--released <PATH> |
Released-version manifest path (defaults to <WIT_ROOT>/released). |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Project name in witforge.toml. |
witforge java-glue
Section titled “witforge java-glue”Emit or check Java 21+ checked protobuf glue targeting official com.google.protobuf
(protobuf-java + protobuf-java-util JsonFormat), converting between plain Java types from
witforge java and protoc --java_out messages from witforge proto (supporting both
java_multiple_files = true and java_multiple_files = false). Emits root GlueErrorKind,
checked WitforgeGlueException, and WitforgeGlueHelpers, per-major <Iface>Glue classes,
and witforge_deps/ glue with canonical-owner forwarding.
| Option / Argument | Description |
|---|---|
[WIT_ROOT] |
WIT root containing v<major>.<minor> version directories. |
--out <DIR> |
Output directory for generated Java protobuf glue files. |
--java-package <VALUE> |
Base Java package prefix for emitted glue packages (for example com.acme.contracts.glue). |
--plain-root <VALUE> |
Base Java package prefix for generated plain Java types (matching witforge java --java-package). |
--proto-root <VALUE> |
Base Java package prefix for generated protobuf classes (matching witforge proto --java-package). |
--java-multiple-files |
Match paired .proto files compiled with option java_multiple_files = true; (default; conflicts with --no-java-multiple-files). |
--no-java-multiple-files |
Match paired .proto files compiled without java_multiple_files = true (nested under each file’s outer class; conflicts with --java-multiple-files). |
--java-outer-classname <NAME> |
Explicit option java_outer_classname matching paired .proto generation (used when --no-java-multiple-files is set). |
--check |
Verify existing files match without writing; exits 1 on drift. |
--diff |
Print a unified diff of output changes without changing the exit status. |
--released <PATH> |
Released-version manifest path (defaults to <WIT_ROOT>/released). |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Project name in witforge.toml. |
witforge csharp
Section titled “witforge csharp”Generate or check zero-dependency C# 12+ / .NET 8 LTS+ stdlib namespaces under
--csharp-namespace: #nullable enable on every file, root WitforgeTypes.cs (WitforgeUnit,
WitforgeOption<T> for nested option<option<...>>, WitforgeResult<T, E>, and WitforgeValues
defensive-copy and deep-equality helpers), per-version interface files
(V<major>_<minor>/<Interface>.cs), sealed record types for records and flags, enum
declarations with ToWitName/TryParseWitName extensions, abstract record + nested
sealed record variants, I<Interface> service interfaces, WitforgeDeps/ namespaces with
canonical-owner sharing across majors, Worlds.cs metadata when any live version declares
worlds, and bidirectional cross-version conversion adapters (Convert.cs) when two or more live
versions exist.
| Option / Argument | Description |
|---|---|
[WIT_ROOT] |
WIT root containing v<major>.<minor> version directories. |
--out <DIR> |
Output directory for generated C# source files. |
--csharp-namespace <VALUE> |
Base C# root namespace for emitted types (for example Acme.Contracts.Plain). |
--check |
Verify existing files match without writing; exits 1 on drift. |
--diff |
Print a unified diff of output changes without changing the exit status. |
--released <PATH> |
Released-version manifest path (defaults to <WIT_ROOT>/released). |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Project name in witforge.toml. |
witforge csharp-glue
Section titled “witforge csharp-glue”Emit or check C# 12+ / .NET 8 LTS+ checked protobuf glue targeting official Google.Protobuf
(JsonFormatter and JsonParser), converting between plain C# types from witforge csharp and
protoc --csharp_out messages from witforge proto --csharp-namespace. Emits #nullable enable
on every file, root GlueErrorKind.cs, WitforgeGlueException.cs, and WitforgeGlueHelpers.cs,
per-major V<major>/<Interface>Glue.cs classes (<Type>ToProto/<Type>FromProto,
<Type>ToBytes/<Type>FromBytes, <Type>ToJson/<Type>FromJson, Method<Fn> constants,
per-function request/response helpers, and <Fn>Params records), and WitforgeDeps/ glue with
canonical-owner forwarding across majors.
| Option / Argument | Description |
|---|---|
[WIT_ROOT] |
WIT root containing v<major>.<minor> version directories. |
--out <DIR> |
Output directory for generated C# protobuf glue files. |
--csharp-namespace <VALUE> |
Base C# root namespace for emitted glue types (for example Acme.Contracts.Glue). |
--plain-root <VALUE> |
Base C# root namespace for generated plain C# types (matching witforge csharp --csharp-namespace). |
--proto-root <VALUE> |
Base C# root namespace for generated protobuf messages (matching witforge proto --csharp-namespace). |
--check |
Verify existing files match without writing; exits 1 on drift. |
--diff |
Print a unified diff of output changes without changing the exit status. |
--released <PATH> |
Released-version manifest path (defaults to <WIT_ROOT>/released). |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Project name in witforge.toml. |
witforge plugin
Section titled “witforge plugin”Run a third-party process-based emitter plugin implementing the protocol_version = 1
JSON-over-stdio protocol, reusing witforge’s contract validation, lockfile enforcement,
ownership headers, cross-platform path guards, atomic nested-tree writes, --check, and --diff.
| Option / Argument | Description |
|---|---|
<NAME> |
Plugin name matching ^[a-z0-9][a-z0-9-]*$ (1 to 64 ASCII characters; resolves witforge-gen-<NAME> strictly along absolute PATH directories). |
[WIT_ROOT] |
WIT root containing v<major>.<minor> version directories. |
--out <DIR> |
Output directory for plugin-generated files. |
--plugin-bin <PATH> |
Explicit path to the plugin executable (CLI-only; never allowed in witforge.toml). |
--option <KEY=VALUE> |
Pass a KEY=VALUE option to the plugin (repeatable; overrides witforge.toml plugin options). |
--timeout-secs <SECS> |
Wall-clock timeout in seconds before terminating the plugin process (1..=3600, default 30, overrides config). |
--check |
Verify existing files match without writing; exits 1 on drift. |
--diff |
Print a unified diff of output changes without changing the exit status. |
--released <PATH> |
Released-version manifest path (defaults to <WIT_ROOT>/released). |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Project name in witforge.toml. |
witforge conformance
Section titled “witforge conformance”Generate or check the versioned cross-language protobuf conformance fixture bundle
(conformance_version = 1: vectors.json, proto/, and wit/).
| Option | Description |
|---|---|
--out <DIR> |
Output directory for the conformance bundle (vectors.json, proto/, wit/). |
--polyglot-proto-options |
Populate canonical Go, Java, and C# protobuf file options on emitted .proto files. |
--go-package <VALUE> |
Base go_package import path prefix for emitted .proto files. |
--java-package <VALUE> |
Base java_package prefix for emitted .proto files. |
--java-multiple-files |
Emit option java_multiple_files = true; on emitted .proto files (conflicts with --no-java-multiple-files). |
--no-java-multiple-files |
Omit option java_multiple_files, overriding --polyglot-proto-options (conflicts with --java-multiple-files). |
--java-outer-classname <NAME> |
Emit option java_outer_classname = "<NAME>"; on emitted .proto files. |
--csharp-namespace <VALUE> |
Base csharp_namespace prefix for emitted .proto files. |
--check |
Verify existing bundle files match without writing; exits 1 on drift. |
--diff |
Print a unified diff of bundle changes without changing the exit status. |
witforge generate
Section titled “witforge generate”Run built-in generators configured in witforge.toml across all projects or --project. Use
--only <GEN[,GEN...]> to run a selected subset of generators. Configured
[project.<name>.plugins.<plugin>] sections are validated for schema and output-root guards and
are never executed unless --allow-plugins is explicitly passed on the CLI (or invoke a single
plugin directly with witforge plugin <name>).
| Option | Description |
|---|---|
--only <GEN[,GEN...]> |
Limit generation to a comma-separated (or repeatable) subset of rust, proto, schema, glue, doc, ts, ts-glue, py, py-glue, go, go-glue, java, java-glue, csharp, csharp-glue, and plugins. Fails with WF9001 if any name is unknown, empty, or not configured in any selected project (and requires --allow-plugins when plugins is listed). |
--allow-plugins |
Explicitly opt in to executing configured [project.<name>.plugins.<plugin>] entries (off by default). |
--check |
Verify all configured outputs without writing; exits 1 on drift. |
--diff |
Print unified diffs of output changes without changing the exit status. |
--serde |
Enable Serde derives across configured Rust outputs (conflicts with --no-serde). |
--no-serde |
Disable Serde derives across configured Rust outputs (conflicts with --serde). |
--no-std |
Emit #![no_std] + alloc compatible paths across configured Rust and glue outputs (conflicts with --std). |
--std |
Emit default std paths across configured Rust and glue outputs, overriding config (conflicts with --no-std). |
--eq-hash |
Derive Eq and Hash on float-free generated Rust types, overriding config (conflicts with --no-eq-hash). |
--no-eq-hash |
Disable Eq/Hash derives on generated Rust types, overriding config (conflicts with --eq-hash). |
--try-from |
Emit TryFrom impls in convert.rs for converted nominal types, overriding config (conflicts with --no-try-from). |
--no-try-from |
Disable TryFrom impls in convert.rs, overriding config (conflicts with --try-from). |
--draft <DRAFT> |
Override the JSON Schema dialect for configured schema outputs (7 or 2020-12). |
--released <PATH> |
Override the released-version manifest path for the run. |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Select a single project from witforge.toml. |
witforge init
Section titled “witforge init”Scaffold a new witforge contract project (wit/v0.1/contract.wit, initial wit/v0.1/wire.lock,
and witforge.toml), refusing to overwrite any existing file.
| Option / Argument | Description |
|---|---|
[DIR] |
Target directory to initialize (defaults to .). |
--package <NS:NAME> |
WIT package identity (<namespace>:<name>, for example example:hello; defaults to example:<dir-name>). |
--serde |
Enable serde = true in the generated witforge.toml Rust section. |
witforge new-version
Section titled “witforge new-version”Scaffold the next minor (or major) version directory from the latest existing version or an
explicit --from version.
| Option / Argument | Description |
|---|---|
[WIT_ROOT] |
WIT root containing version directories; omit to use the configured project root. |
--major |
Create v<major+1>.0 without copying wire.lock instead of v<major>.<minor+1>. |
--from <VERSION> |
Source version directory to clone (for example v0.2), allowing maintenance minors on an earlier major line. |
--released <PATH> |
Path to the released-version manifest (defaults to <WIT_ROOT>/released or project.<name>.released). |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Select a single project from witforge.toml. |
witforge deps
Section titled “witforge deps”Manage vendored deps/ trees across unreleased version directories. Subcommands:
witforge deps sync: synchronizedeps/trees within each major without modifying released or retired directories.
witforge deps sync
Section titled “witforge deps sync”Synchronize vendored deps/ trees from the canonical source version of each major into unreleased
version directories of the same major, refusing symlinks and never modifying released or retired
directories.
| Option / Argument | Description |
|---|---|
[WIT_ROOT] |
WIT root containing version directories; omit to use the configured project root. |
--from <VERSION> |
Canonical source version directory (for example v0.1); defaults to the highest released (or lowest live) version per major. |
--check |
Report deps/ drift without writing; exits 1 (WF1033) if any unreleased version differs. |
--released <PATH> |
Path to the released-version manifest (defaults to <WIT_ROOT>/released or project.<name>.released). |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Select a single project from witforge.toml. |
witforge release
Section titled “witforge release”Validate a version directory and append it to the released manifest.
| Option / Argument | Description |
|---|---|
<WIT_DIR> |
WIT version directory to validate and record as released. |
--released <PATH> |
Released-version manifest path (defaults to <WIT_DIR>/../released). |
--forbid-unstable |
Refuse releasing a version containing any @unstable declaration, overriding config (conflicts with --allow-unstable). |
--allow-unstable |
Allow releasing a version containing @unstable declarations, overriding policy.forbid-unstable-in-release = true (conflicts with --forbid-unstable). |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Select a single project from witforge.toml. |
witforge retire
Section titled “witforge retire”Mark a released version directory as retired in the released manifest, enforcing contiguous
oldest-prefix retirement order and requiring at least one remaining live version.
| Option / Argument | Description |
|---|---|
<WIT_DIR> |
Released WIT version directory to mark as retired. |
--released <PATH> |
Released-version manifest path (defaults to <WIT_DIR>/../released). |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Select a single project from witforge.toml. |
witforge diff
Section titled “witforge diff”Compare two version directories or WIT roots (or compare a working-tree target against its Git
revision via --git-base) and classify wire, source, API, and protobuf binary decode
compatibility.
| Option / Argument | Description |
|---|---|
[OLD] |
Older version directory or WIT root (or target directory when --git-base is given; omit with --git-base to use the configured project root). |
[NEW] |
Newer version directory or WIT root (omit when --git-base is given). |
--git-base <REV> |
Compare the target version directory or WIT root against its committed Git tree at <REV>. |
--json |
Emit the full diff report as JSON on stdout (takes precedence over --format). |
--check[=VIEWS] |
Exit 1 when any breaking change hits the selected views: comma-separated subset of wire, source, api, decode (bare --check defaults to [project.<name>.policy].diff-check when configured, otherwise wire,source,api without decode). |
--config <PATH> |
Explicit witforge.toml path supplying [project.<name>.policy].diff-check and root for --git-base (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Select a single project from witforge.toml. |
witforge inspect
Section titled “witforge inspect”Inspect a single version directory or WIT root, printing a concise human summary or exporting the
deterministic, schema-versioned (version: 1) JSON contract IR with --json.
| Option / Argument | Description |
|---|---|
[PATH] |
Version directory or WIT root; omit to inspect the configured project root via witforge.toml. |
--json |
Emit the versioned JSON contract IR (version: 1) on stdout (takes precedence over --format). |
--released <PATH> |
Released-version manifest path when inspecting a WIT root (defaults to <WIT_ROOT>/released). |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Select a single project from witforge.toml. |
witforge freeze
Section titled “witforge freeze”Verify that every directory listed in wit/released has remained immutable in Git history
(allowing only one-way live -> retired transitions).
| Option / Argument | Description |
|---|---|
[WIT_ROOT] |
WIT root containing released and version directories; omit to check all configured projects. |
--released <PATH> |
Released-version manifest path (defaults to <WIT_ROOT>/released or project released in witforge.toml). |
--base <REV> |
Lower-bound Git revision to bound the manifest history scan (defaults to full history). |
--config <PATH> |
Explicit witforge.toml path (conflicts with --no-config). |
--no-config |
Disable upward witforge.toml discovery (conflicts with --config). |
--project <NAME> |
Select a single project from witforge.toml. |
witforge completions
Section titled “witforge completions”Print shell completion scripts generated from the CLI command definition.
| Argument | Description |
|---|---|
<SHELL> |
Target shell: bash, zsh, or fish. |
witforge explain
Section titled “witforge explain”Print the catalogue explanation and public documentation URL for a diagnostic code.
| Argument | Description |
|---|---|
<CODE> |
Diagnostic code such as WF1015 (case-insensitive). |
witforge.toml configuration keys
Section titled “witforge.toml configuration keys”witforge.toml is discovered upwards from the working directory (stopping at .git or the
filesystem root) unless --config or --no-config is passed. Unknown keys are refused (exit 2),
files must be UTF-8 without a BOM, and paths are resolved relative to witforge.toml without shell
expansion.
| Key | Required | Type | Description |
|---|---|---|---|
version |
yes | integer | Configuration schema version; must be 1. |
[project.<name>] |
yes (at least one) | table | Named contract project table. |
project.<name>.root |
yes | path | WIT root directory containing v<major>.<minor> version directories. |
project.<name>.released |
no | path | Released-version manifest path (defaults to <root>/released). |
[project.<name>.rust] |
no | table | Plain Rust generator configuration. |
project.<name>.rust.out |
yes (if section set) | path | Output directory for generated Rust files. |
project.<name>.rust.serde |
no | boolean | Enable serde::Serialize/Deserialize derives (default false). |
project.<name>.rust.no-std |
no | boolean | Emit #![no_std] + alloc compatible paths (::alloc::*, ::core::*) (default false). |
project.<name>.rust.eq-hash |
no | boolean | Derive Eq and Hash on generated float-free records, variants, enums, and flags (default false). |
project.<name>.rust.try-from |
no | boolean | Emit TryFrom impls in convert.rs for converted nominal types (default false). |
[project.<name>.proto] |
no | table | Protobuf generator configuration. |
project.<name>.proto.out |
yes (if section set) | path | Output directory for generated .proto files. |
project.<name>.proto.go-package |
no | string | Base go_package import path prefix (or explicit path;alias for single-file output). |
project.<name>.proto.java-package |
no | string | Base java_package prefix derived per emitted proto package. |
project.<name>.proto.java-multiple-files |
no | boolean | Emit option java_multiple_files = true; (or false;) on emitted .proto files. |
project.<name>.proto.java-outer-classname |
no | string | Emit option java_outer_classname = "<NAME>"; (collision-checked per Java package and file). |
project.<name>.proto.csharp-namespace |
no | string | Base csharp_namespace prefix derived as PascalCase segments per emitted proto package. |
[project.<name>.proto.packages.<proto_package>] |
no | table | Exact per-package overrides (go-package, java-package, java-multiple-files, java-outer-classname, csharp-namespace) keyed by emitted proto package name. |
[project.<name>.schema] |
no | table | JSON Schema generator configuration. |
project.<name>.schema.out |
yes (if section set) | path | Output directory for generated JSON Schema files. |
project.<name>.schema.draft |
no | string | JSON Schema dialect: "7" (default) or "2020-12". |
[project.<name>.glue] |
no | table | Rust/prost glue generator configuration. |
project.<name>.glue.out |
yes (if section set) | path | Output directory for generated glue files. |
project.<name>.glue.plain-root |
yes (if section set) | string | Absolute Rust module path to generated plain modules (crate::... or ::ext::...). |
project.<name>.glue.proto-root |
yes (if section set) | string | Absolute Rust module path to prost modules (crate::... or ::ext::...). |
project.<name>.glue.no-std |
no | boolean | Emit #![no_std] + alloc compatible paths (::alloc::*, ::core::*) (default false). |
[project.<name>.doc] |
no | table | Markdown contract reference documentation generator configuration. |
project.<name>.doc.out |
yes (if section set) | path | Output directory for generated Markdown reference files. |
[project.<name>.typescript] |
no | table | Strict ESM TypeScript plain types and interfaces generator configuration. |
project.<name>.typescript.out |
yes (if section set) | path | Output directory for generated TypeScript files. |
[project.<name>.typescript-glue] |
no | table | Checked TypeScript protobuf glue (@bufbuild/protobuf) generator configuration. |
project.<name>.typescript-glue.out |
yes (if section set) | path | Output directory for generated TypeScript protobuf glue files. |
project.<name>.typescript-glue.plain-root |
yes (if section set) | string | ESM import root for generated plain TypeScript files (relative path or bare npm package specifier). |
project.<name>.typescript-glue.proto-root |
yes (if section set) | string | ESM import root for generated @bufbuild/protobuf *_pb.js files (relative path or bare npm package specifier). |
[project.<name>.python] |
no | table | Python 3.11+ stdlib plain types and Protocol interfaces generator configuration. |
project.<name>.python.out |
yes (if section set) | path | Output directory for generated Python package files. |
[project.<name>.python-glue] |
no | table | Checked Python protobuf glue (google.protobuf) generator configuration. |
project.<name>.python-glue.out |
yes (if section set) | path | Output directory for generated Python protobuf glue files. |
project.<name>.python-glue.plain-root |
yes (if section set) | string | Python package root for generated plain Python modules (dotted absolute path or relative package path). |
project.<name>.python-glue.proto-root |
yes (if section set) | string | Python package root for generated protoc --python_out *_pb2.py modules (dotted absolute path or relative package path). |
[project.<name>.go] |
no | table | Go 1.22+ stdlib plain types and interfaces generator configuration. |
project.<name>.go.out |
yes (if section set) | path | Output directory for generated Go package files. |
project.<name>.go.go-module |
yes (if section set) | string | Go module import path prefix for emitted packages (for example example.com/acme/contracts/gen/plain). |
[project.<name>.go-glue] |
no | table | Checked Go protobuf glue (google.golang.org/protobuf) generator configuration. |
project.<name>.go-glue.out |
yes (if section set) | path | Output directory for generated Go protobuf glue files. |
project.<name>.go-glue.go-module |
yes (if section set) | string | Go module import path prefix for emitted glue packages (for example example.com/acme/contracts/gen/glue). |
project.<name>.go-glue.plain-root |
yes (if section set) | string | Go import path prefix for generated plain Go packages (matching witforge go --go-module). |
project.<name>.go-glue.proto-root |
yes (if section set) | string | Go import path prefix for generated *.pb.go packages (matching witforge proto --go-package). |
[project.<name>.java] |
no | table | Java 21+ stdlib plain types and interfaces generator configuration. |
project.<name>.java.out |
yes (if section set) | path | Output directory for generated Java source files. |
project.<name>.java.java-package |
yes (if section set) | string | Base Java package prefix for emitted packages (for example com.acme.contracts.plain). |
[project.<name>.java-glue] |
no | table | Checked Java 21+ protobuf glue (com.google.protobuf) generator configuration. |
project.<name>.java-glue.out |
yes (if section set) | path | Output directory for generated Java protobuf glue files. |
project.<name>.java-glue.java-package |
yes (if section set) | string | Base Java package prefix for emitted glue packages (for example com.acme.contracts.glue). |
project.<name>.java-glue.plain-root |
yes (if section set) | string | Base Java package prefix for generated plain Java types (matching witforge java --java-package). |
project.<name>.java-glue.proto-root |
yes (if section set) | string | Base Java package prefix for generated protobuf classes (matching witforge proto --java-package). |
project.<name>.java-glue.java-multiple-files |
no | boolean | Match paired .proto java_multiple_files = true|false (default true). |
project.<name>.java-glue.java-outer-classname |
no | string | Explicit option java_outer_classname matching paired .proto files when java-multiple-files = false. |
[project.<name>.csharp] |
no | table | C# 12+ / .NET 8+ stdlib plain types and interfaces generator configuration. |
project.<name>.csharp.out |
yes (if section set) | path | Output directory for generated C# source files. |
project.<name>.csharp.csharp-namespace |
yes (if section set) | string | Base C# root namespace for emitted types (for example Acme.Contracts.Plain). |
[project.<name>.csharp-glue] |
no | table | Checked C# 12+ / .NET 8+ protobuf glue (Google.Protobuf) generator configuration. |
project.<name>.csharp-glue.out |
yes (if section set) | path | Output directory for generated C# protobuf glue files. |
project.<name>.csharp-glue.csharp-namespace |
yes (if section set) | string | Base C# root namespace for emitted glue types (for example Acme.Contracts.Glue). |
project.<name>.csharp-glue.plain-root |
yes (if section set) | string | Base C# root namespace for generated plain C# types (matching witforge csharp --csharp-namespace). |
project.<name>.csharp-glue.proto-root |
yes (if section set) | string | Base C# root namespace for generated protobuf messages (matching witforge proto --csharp-namespace). |
[project.<name>.plugins.<plugin>] |
no | table | Third-party emitter plugin configuration for plugin <plugin> (^[a-z0-9][a-z0-9-]*$; executable paths are forbidden in config and witforge generate only executes plugins when --allow-plugins is passed). |
project.<name>.plugins.<plugin>.out |
yes (if section set) | path | Output directory for files emitted by plugin <plugin> (checked for overlap against every other configured output root). |
project.<name>.plugins.<plugin>.options |
no | table of strings | Optional string key-value options passed to the plugin in stdin JSON (overridden per key by CLI --option). |
project.<name>.plugins.<plugin>.timeout-secs |
no | integer | Optional wall-clock execution timeout in seconds (1..=3600, default 30, overridden by --timeout-secs). |
[project.<name>.policy] |
no | table | Project governance policy table. |
project.<name>.policy.diff-check |
no | array of strings | Default compatibility views for bare witforge diff --check (non-empty subset of "wire", "source", "api", "decode"). |
project.<name>.policy.forbid-unstable-in-release |
no | boolean | Refuse witforge release when any @unstable declaration is present (default false). |