rspyts-cli
rspyts-cli generates Python, TypeScript, and JSON Schema contracts from a
Rust cdylib built with rspyts.
Install
Commands
rspyts init [--dir <path>]
rspyts generate [--config <path>] [cargo options]
rspyts check [--config <path>] [cargo options]
rspyts manifest [--config <path>] [cargo options]
rspyts build [--config <path>] [cargo options] [--target host|<triple>...] [--out-dir <path>] [--output-format text|json]
Each command has one responsibility:
generatecompiles and validates the host bridge, then writes generated source.checkcompiles and validates the same bridge, compares the expected source with the filesystem, and never writes generated source or staged libraries.manifestprints the complete validated manifest and never stages a library. Cargo diagnostics remain on stderr, so redirected stdout is clean.buildis the only command that stages compiled artifacts. It does not generate source or validate generated-source drift.initwrites a starterrspyts.tomlwithout overwriting an existing file.
build selects the host when no --target is passed. Once --target is
present, it selects exactly the listed values; use the literal host to
include the host alongside explicit Rust target triples. Values may be
repeated or comma-separated:
A host build is staged in <python.out>/lib when Python output is configured,
or in Cargo's target/rspyts/native/<profile> directory otherwise. Explicit
targets are staged in target/rspyts/<target>/<profile>. --out-dir puts a
single selected artifact directly in the specified directory, which is useful
for wheel and archive assembly without mutating a source package:
Staging uses an atomic replacement, so readers do not observe partial files.
Configuration
Paths resolve from the configuration file. A section exists when its output is wanted and is omitted when it is not. Unknown keys are rejected.
[]
= "rust"
= ["bridge"]
= false
[]
= "python/src/example/_generated"
[]
= "typescript/src/generated"
[]
= "schema"
Generated Python always looks for its native library in the fixed lib
directory. Cross-crate type imports remain explicit language mappings:
[]
= "shared_types.generated"
[]
= "@scope/shared-types/generated"
The positive cargo overrides are --features, --no-default-features,
--release, and --locked. Crate features are contract inputs and therefore
live in [crate]; build profile and lock enforcement are invocation choices.
Commands use Cargo's development profile without lock enforcement unless
--release or --locked is passed.
Machine-readable builds
build --output-format json prints one versioned report to stdout. Progress
and Cargo diagnostics stay on stderr. Format version 1 contains resolved Cargo
inputs, the configured Python output when present, and every staged artifact:
Consumers should reject unsupported report versions instead of guessing at new fields.
Exit codes are 0 for success, 1 for generated drift, 2 for usage or
configuration errors, and 3 for build, load, validation, or write failures.
Licensed under MIT.