//! Mecha10 CLI Library
//!
//! This crate provides both a command-line interface and a library API for managing
//! Mecha10 robot projects. The library can be used programmatically by other tools.
//!
//! # Architecture
//!
//! The CLI follows a 3-layer architecture for maintainability and testability:
//!
//! ```text
//! Commands (clap Args)     → Pure data structures, no logic
//!     ↓
//! Handlers (orchestration) → Coordinate services, handle UI
//!     ↓
//! Services (business logic)→ Reusable, testable logic
//!     ↓
//! Mecha10 Core (framework) → Message passing runtime
//! ```
//!
//! # Library Usage
//!
//! ## Basic Project Operations
//!
//! ```rust,no_run
//! use mecha10_cli::{CliContext, services::ProjectService};
//! use std::path::Path;
//!
//! # async fn example() -> anyhow::Result<()> {
//! // Detect a Mecha10 project
//! let project = ProjectService::detect(Path::new("."))?;
//! println!("Project: {} v{}", project.name()?, project.version()?);
//!
//! // List project components
//! let nodes = project.list_nodes()?;
//! let drivers = project.list_drivers()?;
//! println!("Nodes: {:?}", nodes);
//! println!("Drivers: {:?}", drivers);
//!
//! // Validate project structure
//! project.validate()?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Working with Docker
//!
//! ```rust,no_run
//! use mecha10_cli::services::DockerService;
//!
//! # async fn example() -> anyhow::Result<()> {
//! let docker = DockerService::new();
//!
//! // Check Docker availability
//! docker.check_installation()?;
//! docker.check_daemon()?;
//!
//! // Manage services
//! docker.compose_up(true).await?;
//! let containers = docker.list_containers().await?;
//!
//! for container in containers {
//!     println!("{}: {}", container.name, container.status);
//! }
//! # Ok(())
//! # }
//! ```
//!
//! ## Using CliContext
//!
//! ```rust,no_run
//! use mecha10_cli::CliContextBuilder;
//! use tracing::Level;
//!
//! # async fn example() -> anyhow::Result<()> {
//! // Build a context with custom settings
//! let ctx = CliContextBuilder::new()
//!     .redis_url("redis://localhost:6380".to_string())
//!     .log_level(Level::DEBUG)
//!     .verbose(true)
//!     .build()?;
//!
//! // Access services through context
//! let docker = ctx.docker();
//! let redis = ctx.redis()?;
//!
//! // Services are lazy-initialized
//! let project = ctx.project()?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Configuration Management
//!
//! ```rust,no_run
//! use mecha10_cli::services::ConfigService;
//! use std::path::Path;
//!
//! # async fn example() -> anyhow::Result<()> {
//! // Load configuration
//! let config = ConfigService::load_default().await?;
//! println!("Robot ID: {}", config.robot.id);
//!
//! // Load from specific path
//! let config = ConfigService::load_from(Path::new("mecha10.json")).await?;
//!
//! // Check if initialized
//! if ConfigService::is_initialized_here() {
//!     println!("Project is initialized");
//! }
//! # Ok(())
//! # }
//! ```

// Public API exports
pub use context::{CliContext, CliContextBuilder};

// Re-export Level for tests and consumers
pub use tracing::Level;

// Public modules for library consumers
pub mod dev;
pub mod infrastructure;
pub mod paths;
pub mod services;
pub mod types;

// Internal modules (not public)
mod commands;
mod component_catalog;
mod context;
mod framework;
mod run;
mod sim;
mod templates;
mod utils;

// Re-export commonly used types
pub use types::{Cli, Commands};
