🚀 Cirious Codex CLI
Rapid Command Line Application Scaffolding for the Cirious Ecosystem
📖 Overview
Cirious Codex CLI is the premier entrypoint library for building powerful, production-ready Command Line Interfaces (CLIs) and microservices within the Cirious ecosystem.
Instead of writing boilerplate code to parse arguments, instantiate loggers, and load environment configurations, cirious_codex_cli automates the entire bootstrapping process. It seamlessly connects cirious_codex_config and cirious_codex_logger out of the box, allowing you to focus purely on your business logic.
✨ Features
- Argument Parsing & Sub-command Routing: Elegant, type-safe CLI definition via
clapderive macros with automatic--helpgeneration and strict validation. - Automated Logger Bootstrapping: The
--verboseflag automatically switches thecirious_codex_loggerbetweenInfoandDebuglevels, with styled terminal output viacirious_codex_term. - Automated Configuration Loading: The
--config <path>flag triggerscirious_codex_configto read, parse, and merge the configuration file with environment variables, delivering a strongly-typed struct to your handler. - CLI Override Pattern: Arguments passed directly in the terminal can seamlessly override values from the configuration file, following the standard 12-factor app methodology.
- Ecosystem Integration: Built to leverage the full power of the
cirious_codexfacade, includingCodexErrorandCodexOk.
🚀 Quick Start
Add the following to your Cargo.toml:
[]
= "0.1.1"
= { = "4.5", = ["derive"] }
= { = "1.0", = ["derive"] }
Example 1: Basic Routing
Define your CLI, implement the CodexCommand contract, and let the engine bootstrap everything.
use ;
use ;
use Deserialize;
Run it:
# Standard mode (Info level logging)
# Verbose mode (Debug level logging)
Example 2: Production Microservice (CLI Override Pattern)
use ;
use ;
use Deserialize;
With a microservice.json configuration file:
Run it:
# Serve using port from config (3000)
# Serve overriding port via CLI (8080 takes precedence)
# Run destructive migrations with verbose logging
🚧 Current Status & Roadmap
✅ v0.1.0 — Completed
- Design the argument parsing and sub-command routing API.
- Implement automatic initialization of
cirious_codex_loggerdispatchers based on CLI flags. - Implement automated configuration loading bridging with
cirious_codex_config. - Create robust examples demonstrating rapid application scaffolding.
- Publish
cirious_codex_clitocrates.ioas a standalone crate.
🔭 v0.2.0 — Planned
- Add a global
init_cli!macro for zero-boilerplate entrypoints. - Implement a
Result-aware handler variant (execute_cli_result) that integrates withCodexError. - Add support for
APP_*environment variable overrides viacirious_codex_config's env prefix API.
📜 License
Licensed under either of the following, at your option: