1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Project: hyperi-rustlib
// File: src/cli/mod.rs
// Purpose: Standard CLI framework for DFE services
// Language: Rust
//
// License: FSL-1.1-ALv2
// Copyright: (c) 2026 HYPERI PTY LIMITED
//! Standard CLI framework for DFE Rust services.
//!
//! Provides the 80% of CLI boilerplate that every DFE service needs:
//! config path, log level/format, metrics address, version, config-check.
//! Apps provide the 20% (config type, service logic) via the [`DfeApp`] trait.
//!
//! ## Quick Start
//!
//! ```rust,ignore
//! use clap::Parser;
//! use hyperi_rustlib::cli::{CommonArgs, DfeApp, CliError, StandardCommand, VersionInfo, run_app};
//!
//! #[derive(Parser)]
//! #[command(name = "dfe-loader", version)]
//! struct App {
//! #[command(flatten)]
//! common: CommonArgs,
//!
//! #[command(subcommand)]
//! command: Option<StandardCommand>,
//! }
//!
//! impl DfeApp for App {
//! type Config = MyConfig;
//!
//! fn name(&self) -> &str { "dfe-loader" }
//! fn env_prefix(&self) -> &str { "DFE_LOADER" }
//! fn version_info(&self) -> VersionInfo {
//! VersionInfo::new("dfe-loader", env!("CARGO_PKG_VERSION"))
//! }
//! fn common_args(&self) -> &CommonArgs { &self.common }
//! fn command(&self) -> Option<&StandardCommand> { self.command.as_ref() }
//! fn load_config(&self, path: Option<&str>) -> Result<MyConfig, CliError> { todo!() }
//! async fn run_service(&self, config: MyConfig) -> Result<(), CliError> { todo!() }
//! }
//!
//! #[tokio::main]
//! async fn main() {
//! let app = App::parse();
//! if let Err(e) = run_app(app).await {
//! eprintln!("fatal: {e}");
//! std::process::exit(1);
//! }
//! }
//! ```
// DfeApp + ServiceRuntime require the full service infrastructure stack
// (MetricsManager, MemoryGuard, ScalingPressure, AdaptiveWorkerPool).
// Gated behind `cli-service`. Bare `cli` exposes only the clap types.
pub use CommonArgs;
pub use StandardCommand;
pub use CliError;
pub use VersionInfo;
pub use ;
pub use ServiceRuntime;
pub use TopArgs;