actr-cli
中文 | English
actr-cli is the command line tool for Actor-RTC framework projects. It bootstraps projects, manages service dependencies, discovers services on the network, and generates code from Protocol Buffers definitions.
Status and limitations
- The CLI entrypoint exposes:
init,install,discovery,gen, andcheck. init(Rust and Swift) andgenare functional today.installanddiscoverydepend on service components that are not registered inContainerBuilder::build, so they will fail with "not registered" errors until the container wiring is implemented.checkinsrc/main.rsis a placeholder implementation.- Python and Kotlin init/codegen are not implemented yet.
Requirements
- Rust 1.88+ and Cargo
protocin PATHrustfmtin PATH (skip withactr gen --no-format)
Rust codegen:
protoc-gen-prostin PATH (used by--prost_out)protoc-gen-actrframeworkin PATH- If missing,
actr genattempts to build and install it from an Actr workspace that containscrates/framework-protoc-codegen.
- If missing,
Swift init/codegen:
protoc-gen-swiftprotoc-gen-actrframework-swiftxcodegenproject.ymlpresent in the project root forxcodegen generate
Install (from source)
Or install the binary into your Cargo bin directory:
Quick start
Create a Rust project:
Create a Swift project (template: echo only):
Commands
actr init
Initialize a new project. If required fields are missing, the command will prompt interactively.
Flags:
--template <name>: project template (Swift supportsechoonly)--project-name <name>: project name when initializing in the current directory--signaling <url>: signaling server URL (required)-l, --language <rust|python|swift|kotlin>: target language (default:rust)
Examples:
# New directory
# Current directory
# Swift
actr install
Install service dependencies from Actr.toml or add new dependencies by package spec.
Flags:
--force: reserved (not wired yet)--force-update: reserved (not wired yet)--skip-verification: reserved (not wired yet)
Examples:
# Install dependencies listed in Actr.toml
# Add a dependency
actr discovery
Discover services on the network and optionally add them to Actr.toml.
This command is interactive and will prompt for selection and actions.
Flags:
--filter <pattern>: service name filter (e.g.user-*)--verbose: reserved (not wired yet)--auto-install: install the selected service without prompting
Example:
actr gen
Generate code from proto files.
Flags:
-i, --input <path>: input proto file or directory (default:proto)-o, --output <path>: output directory (default:src/generated)--clean: remove the output directory before generating--no-scaffold: skip user code scaffold generation--overwrite-user-code: overwrite existing user code files--no-format: skiprustfmt--debug: keep intermediate generated files-l, --language <rust|python|swift|kotlin>: target language (default:rust)
Examples:
# Rust (defaults)
# Rust with explicit paths
# Swift
Notes:
- Rust codegen runs
rustfmtandcargo checkautomatically unless--no-formatis set. - Generated Rust files are set to read-only after generation.
- Swift codegen runs
xcodegen generateand requiresproject.yml. - Python/Kotlin generators are placeholders and do not emit code yet.
actr check
The CLI currently exposes a placeholder check command that prints the provided
flags. The full CheckCommand implementation exists in src/commands/check.rs
but is not wired into the CLI entrypoint yet.
Configuration (Actr.toml)
Actr.toml is used by multiple commands (notably install and gen) and should
define the Actor type under [package.actr_type].
Minimal example:
= 1
= []
[]
= "example-service"
= "An Actor-RTC service"
[]
= "acme"
= "example-service"
[]
# "acme+other-service" = {}
[]
= "ws://127.0.0.1:8080"
License
Apache-2.0. See LICENSE.