sails-cli 1.0.0-beta.2

CLI tools the Sails framework
Documentation

⛵ Sails CLI

sails-cli is the command-line interface for working with Sails projects. It provides commands to scaffold a new Sails workspace, generate clients from IDL, extract IDL from Rust crates, and produce Solidity bindings.

The binary is exposed as the Cargo subcommand cargo sails.

Usage

Install the CLI:

cargo install sails-cli

Or install a prebuilt binary with cargo-binstall:

cargo binstall sails-cli

Show available commands:

cargo sails --help

Create a new Sails project:

cargo sails new my-ping

Create a project without network access and use a local sails-rs path:

cargo sails new my-ping --offline --sails-path ../rs

Generate Rust client code from IDL:

cargo sails client-rs path/to/app.idl

Generate TypeScript client code from IDL:

cargo sails client-js path/to/app.idl

Generate IDL from a Cargo manifest:

cargo sails idl --manifest-path path/to/Cargo.toml

Embed IDL into a WASM binary as a custom section:

cargo sails idl-embed --wasm path/to/app.opt.wasm --idl path/to/app.idl

Extract IDL from a WASM binary:

cargo sails idl-extract --wasm path/to/app.opt.wasm

Generate Solidity artifacts from IDL:

cargo sails sol --idl-path path/to/app.idl

Generated Sails Project Parts

The cargo sails new command creates a workspace with a few distinct parts:

  • Root crate: the workspace entry point that wires dependencies together and contains the build logic for the final WASM and IDL artifacts.
  • app crate: the package that contains the program business logic and service implementation.
  • client crate: the package that builds the generated Rust client interface for interacting with the program.
  • tests directory: integration tests based on gtest/gclient.

Typical generated-project workflow:

cd my-ping
cargo test
cargo build

If you need Ethereum-compatible contracts for Vara.ETH, create the workspace with --eth.