codama-cli

Crates.iocodama-cli
lib.rscodama-cli
version0.7.2
created_at2025-11-25 14:49:22.251355+00
updated_at2026-01-23 15:12:29.229634+00
descriptionCommand-line interface for Codama
homepage
repositoryhttps://github.com/codama-idl/codama-rs
max_upload_size
id1949901
size24,401
Loris Leiva (lorisleiva)

documentation

README

codama-cli

Command-line interface for generating Codama IDL from Rust projects.

Installation

cargo install --path codama-cli

Or build from source:

cargo build --release -p codama-cli

Usage

Generate IDL to stdout

codama-rs generate-idl ./my-program

Pretty-print the output

codama-rs generate-idl ./my-program --pretty

Save to file

codama-rs generate-idl ./my-program -o idl.json

Combine flags

codama-rs generate-idl ./my-program --pretty --output idl.json

Command Reference

Command-line interface for Codama

Usage: codama-rs <COMMAND>

Commands:
  generate-idl  Generate IDL from a Rust project
  help          Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

generate-idl subcommand

Generate IDL from a Rust project

Usage: codama-rs generate-idl [OPTIONS] [PATH]

Arguments:
  [PATH]  Path to the Rust project (defaults to current directory) [default: .]

Options:
  -o, --output <OUTPUT>  Output file path (defaults to stdout)
  -p, --pretty           Pretty-print the JSON output
  -h, --help             Print help

Examples

Example 1: Generate from current directory

cd my-solana-program
codama-rs generate-idl

Example 2: Generate with formatted JSON

codama-rs generate-idl ./programs/my-program --pretty

Output:

{
  "kind": "rootNode",
  "standard": "codama",
  "program": {
    "kind": "programNode",
    "name": "myProgram",
    ...
  }
}

Example 3: Save to file for processing

codama-rs generate-idl ./my-program -o idl.json
# IDL written to: idl.json

Requirements

  • Rust toolchain
  • A Rust project with a valid Cargo.toml and library or binary target

License

Apache-2.0

Commit count: 563

cargo fmt