@mecha10/cli
Command-line interface for managing Mecha10 robot projects.
Features
- ✅ Project Scaffolding -
initcommand with templates - ✅ Development Mode -
devwith hot-reload and runtime integration - ✅ Production Mode -
runfor deployment - ✅ Build System -
buildwith cross-compilation support - ✅ Simulation -
simfor Godot environment generation - ✅ Topology -
topologyfor static analysis of nodes, pub/sub topics, and ports - ✅ Topics -
topicsfor message introspection and real-time monitoring - ✅ Deployment -
deploywith canary/rolling strategies - ✅ Log Viewer -
logsfor debugging - ✅ Status Display -
statusfor project overview - ✅ Cleanup -
cleanfor build artifacts - ✅ Quality Tools -
quality,format,lintcommands - ✅ Library API - Programmatic access to CLI functionality
Status
✅ Production-Ready - 3-layer architecture, 392 tests passing, 70-75% coverage
Architecture
The CLI follows a strict 3-layer architecture:
Commands (clap Args) → Pure data structures
↓
Handlers (orchestration) → Coordinate services, handle UI
↓
Services (business logic)→ Reusable, testable logic
↓
Mecha10 Core → Message passing runtime
See CLI_ARCHITECTURE.md for complete details.
Installation
Verify installation:
Commands
mecha10 init
Initialize a new robot project:
# Interactive wizard (recommended)
# Or with explicit parameters
Interactive Mode:
When you run mecha10 init without parameters, it launches an interactive wizard that prompts you for:
- Project name - The name of your robot project
- Robot type - Choose from:
rover- 4-wheeled mobile robot with sensors (camera, lidar, imu)humanoid- Bipedal walking robotarm- 6-DOF robotic arm manipulatorbasic- Minimal starting template
- Simulation - Whether to generate Godot RL simulation environments
Example Interactive Session:
🤖 Mecha10 Project Initialization Wizard
? Project name: my-rover
? What type of robot are you building?
❯ Rover - 4-wheeled mobile robot with sensors
Humanoid - Bipedal walking robot
Robotic Arm - 6-DOF manipulator
Basic - Minimal starting template
? Generate simulation environments? Yes
📋 Configuration Summary:
Project: my-rover
Robot Type: rover
Simulation: Yes
Command-line Flags:
You can also use command-line flags to skip the interactive prompts:
# Skip interactive mode with all parameters
# Provide only the name, prompt for robot type
# Provide only robot type, prompt for name
# Skip simulation generation
Templates:
basic- Minimal project structurerover- Ground robot with navigation (camera, lidar, imu, motor controller)arm- Manipulation robothumanoid- Bipedal walker
What it creates:
my-robot/
├── .mecha10/ # Framework config
├── config/ # Robot configurations
├── nodes/ # Your node implementations
├── models/ # RL models (ONNX files)
├── environments/ # Simulation environments
├── tests/ # Integration tests
├── logs/ # Runtime logs
└── mecha10.json # Project manifest
mecha10 dev
Start development mode with hot-reload:
Options:
--env <ENV>- Environment (dev, staging, production)--config <PATH>- Custom config path--log-level <LEVEL>- Log level (debug, info, warn, error)
What it does:
- Load
.mecha10/config.jsonandmecha10.json - Start all configured nodes
- Monitor health and auto-restart on crash
- Watch for config changes (hot-reload)
- Run until Ctrl+C
mecha10 run
Run in production mode:
Options:
--env <ENV>- Environment (default: production)--nodes <LIST>- Specific nodes to run (comma-separated)--config <PATH>- Custom config path
Example:
# Run only camera and SLAM nodes
mecha10 build
Build the project:
# Debug build
# Release build (optimized)
# Cross-compile for Raspberry Pi
Options:
--release- Build with optimizations--target <ARCH>- Cross-compile target
mecha10 deploy
Deploy to production:
Options:
--env <ENV>- Environment (staging, production)--strategy <STRATEGY>- Deployment strategy (canary, rolling, blue-green)
Strategies:
canary- Gradual rollout (10% → 50% → 100%)rolling- Node-by-node replacementblue-green- Instant switchover with rollback
Note: Requires platform API integration (stub implementation)
mecha10 train
Submit a training job:
Options:
--wait- Wait for job to complete
Note: Requires platform API integration (stub implementation)
mecha10 logs
View node logs:
# All nodes
# Specific node
# Follow logs (tail -f)
Note: Stub implementation
mecha10 status
Show project status:
Output:
Project Status:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Robot: my-robot
Platform: rover
Nodes: 3
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
mecha10 topology
Static analysis of project topology - visualize nodes, pub/sub topics, and service ports:
# Show nodes and their topic connections
# Group by topics instead of nodes
# Export to JSON
# ASCII graph view
Features:
- No runtime required (static code analysis)
- Multiple views (nodes, topics, graph)
- Shows Redis and service ports
- Analyzes pub/sub relationships from source code
See CLI Guide for complete documentation.
mecha10 topics
Discover and monitor Redis stream topics:
# List all topics (interactive browser)
# List topics matching a pattern
# Verbose output with topic details
Features:
- Interactive terminal-based topic browser
- Real-time topic monitoring
- Keyboard navigation (↑/↓ arrows, Enter to select)
- Live message streaming from selected topics
- Pattern matching support
Example Session:
📋 Mecha10 Topics
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Scanning Redis for topics matching: *
Found 3 topic(s)
Use ↑/↓ arrows to navigate, Enter to select, Esc to exit
❯ sensor/camera
sensor/lidar
control/motor
mecha10 models
Manage AI models from HuggingFace Hub:
# List available models from catalog
# Show only recommended models
# Download a model from catalog
# Download all recommended models
# Download custom model from HuggingFace
# List installed models
# Show model details
# Remove cached model
Features:
- Curated catalog of robotics/vision models
- Automatic downloads from HuggingFace Hub
- Automatic INT8 quantization for 2x faster inference
- Dual caching (HF cache + project models/)
- Offline support after first download
- Model metadata (size, task, input format)
Model Catalog:
yolov8n-face(6.3MB) - Fast face detectionmobilenet-v2(2.5MB) - Image classification, ImageNet-1000- Custom models via
--repoflag
Integration: Nodes reference models by name (auto-downloads if missing):
# config/image_classifier.toml
[]
= "mobilenet-v2" # Auto-downloads from catalog
Auto-download:
mecha10 setupdownloads recommended models- Nodes auto-download on first use if model missing
- Works offline once cached
INT8 Quantization:
Some models (like yolov8n) automatically generate optimized INT8 versions during download for 2x faster inference. See MODEL_QUANTIZATION.md for details.
mecha10 clean
Clean build artifacts:
# Clean build directories
# Also clean model cache
Removes:
build/target/.mecha10/cache/(if--cachespecified)
Global Options
All commands support:
--log-level <LEVEL>- Set log level (debug, info, warn, error)--config <PATH>- Custom config file path
Example:
Configuration
Project Config (mecha10.json)
Environment Variables (.env)
# Mecha10 Platform
MECHA10_API_URL=https://api.mecha10.dev
MECHA10_API_KEY=your-api-key
# Redis
REDIS_URL=redis://localhost:6379
# Fleet ID
FLEET_ID=production-fleet
# Development
DEV_MODE=false
LOG_LEVEL=info
Workflow
Development Workflow
# 1. Create project
# 2. Configure environment
# Edit .env with your values
# 3. Implement nodes
# Write your node code in nodes/
# 4. Start development
# 5. View status
# 6. Clean up
Production Workflow
# 1. Build for release
# 2. Test locally
# 3. Deploy to production
Training Workflow
# 1. Create training config
# Edit training/my-policy.yaml
# 2. Submit training job
# 3. Download model
# Model automatically deployed to .mecha10/cache/models/
Integration
With @mecha10/config:
let mut config_manager = new?;
let config = config_manager.load.await?;
With @mecha10/core:
let mut runtime = new.await?;
runtime.start_node.await?;
runtime.run.await?;
Logging
Uses tracing for structured logging:
INFO mecha10_cli: Starting development mode (env: dev)
INFO mecha10_cli: Loading config from: "mecha10.json"
INFO mecha10_core: Started node: camera
INFO mecha10_core: Started node: slam
Enable debug logging:
Error Handling
The CLI provides clear error messages:
Error: mecha10.json not found
Run 'mecha10 init <name>' to create a new project.
Error: Failed to start node 'camera'
No such file or directory: ./nodes/camera_node
Build the node first with: mecha10 build
Architecture
┌─────────────────┐
│ mecha10 CLI │
└────────┬────────┘
│
├──> ConfigManager (load configs)
│
├──> Runtime (start/monitor nodes)
│
└──> Platform API (deploy/train)
Examples
See QUICKSTART.md for complete examples.
Library Usage
The CLI can also be used as a library for programmatic access:
use ;
use Path;
async
See lib.rs documentation for complete API examples.
Available Services
All services are accessible through CliContext:
DockerService- Container and compose operationsRedisService- Redis connection managementConfigService- Project configurationProjectService- Project structure and validationSimulationService- Godot simulation generationProcessService- Child process managementTemplateService- Code generationComponentCatalogService- Component discoveryDiscoveryService- Network node discoveryDeploymentService- Deployment operationsPackageService- Package management
Development
# Build CLI
# Run directly
# Install locally
# Run tests
# Check code quality
Testing
The CLI has comprehensive test coverage:
- 392 tests passing
- 70-75% coverage across services
- All services have dedicated unit tests
- Integration tests for key workflows
See CLI_ARCHITECTURE.md for testing patterns.
License
MIT