Architecture

XaCLI crate structure and design

Architecture

Crate Structure

crates/
├── xacli/              # Facade crate (ONLY PUBLISHED)
├── xacli-core/         # Core types (internal)
├── xacli-derive/       # Derive macros (internal)
├── xacli-components/   # UI components (internal)
└── xacli-testing/      # Testing utilities (internal)

Important: Only xacli is published to crates.io. Internal crates have publish = false.

User API

// Core (always available)
use xacli::{App, Command, Arg, Context, Result};

// Derive macros
use xacli::derive::{App, Command};

// Interactive components
use xacli::components::*;

// Testing utilities
use xacli::testing::{TestingApp, TestCase, assert};

Feature Flags

FeatureDescription
deriveDerive macros
componentsInteractive UI
testingTest utilities

Default: empty (default = [])

Design Principles

  1. Derive-first - Derive macros are the primary API
  2. Owned data - Commands use owned strings, not references
  3. Sync-first - Synchronous execution (async planned)
  4. Testable - Built-in testing support via TestingApp

Execution Flow

#[derive(App)] struct → MyApp::execute() → parse args → run commands