Skip to main content
The Palyra CLI (palyra) is a thick client designed for secure local and remote management of the Palyra runtime. It employs a deeply nested command tree built on the clap library, providing a unified interface for operations ranging from low-level gateway diagnostics to high-level agent orchestration and security governance.

Command Tree and Parser Implementation

The CLI uses a declarative argument structure defined in crates/palyra-cli/src/args/mod.rs. The root parser, Cli, handles global options like --profile, --config, and --output-format, while delegating specific logic to subcommands crates/palyra-cli/src/args/mod.rs#49-118.

Parser Architecture

The implementation follows a modular pattern where each major command family has a corresponding file in src/args/ for definition and src/commands/ for execution crates/palyra-cli/src/commands/mod.rs#1-51.
ComponentRoleFile Reference
CliRoot parser struct using clap(Parser)crates/palyra-cli/src/lib.rs#76-80
CommandTop-level enum for all subcommandscrates/palyra-cli/src/lib.rs#80-89
GlobalOptionsShared flags for profiles, logging, and state rootscrates/palyra-cli/tests/help_snapshots/root-help-unix.txt#62-89

Command Logic Data Flow

The following diagram illustrates how a CLI command moves from user input to gRPC or HTTP execution against the daemon. CLI Execution Flow Sources: crates/palyra-cli/src/lib.rs#76-89, crates/palyra-cli/src/commands/system.rs#10-17, crates/palyra-cli/src/commands/objectives.rs#12-19

Primary Command Families

Setup and Configuration

Runtime and Diagnostics

Orchestration and Automation

Security and Governance

Parity Matrix and Help Snapshot Testing

To ensure consistency across platforms and prevent command drift, the CLI utilizes a Parity Acceptance Matrix and automated snapshot testing.

Parity Matrix

The matrix defines the expected posture of every command, categorized by its “Canonical Family” or “Nested Surface” status crates/palyra-cli/tests/cli_parity_matrix.toml#3-14.
  • Postures: done, partial, intentional_deviation, capability_gated.
  • Validation: The cli_parity module verifies that the live clap tree matches the requirements (flags, aliases, paths) defined in the matrix crates/palyra-cli/tests/cli_parity_report.md#8-24.

Snapshot Testing

The system captures the --help output for every command in the tree and compares it against committed .txt files in tests/help_snapshots/ crates/palyra-cli/tests/help_snapshots.rs#6-9. Command-to-Code Entity Mapping Sources: crates/palyra-cli/src/commands/system.rs#29-33, crates/palyra-cli/src/commands/objectives.rs#52-116, crates/palyra-cli/src/args/profile.rs#1-171

Argument Structure Detail: Objectives

The objectives family demonstrates the complexity of the argument parser, handling nested structures for scheduling and delivery crates/palyra-cli/src/args/objectives.rs#88-147.
ArgumentTypeDescription
--kindObjectiveKindArgOne of objective, heartbeat, standing_order, program
--priorityObjectivePriorityArgEscalation level from low to critical
--schedule-typeObjectiveScheduleTypeArgLogic for execution: cron, every, or at
--delivery-modeRoutineDeliveryModeArgHow results are returned (e.g., SameChannel)
Sources: crates/palyra-cli/src/args/objectives.rs#149-227, crates/palyra-cli/src/commands/objectives.rs#84-113