feat(maestro-tui): wire --config flag + document tui in INSTALL.md (NAP-283)
ci / rust (push) Failing after 5m13s
ci / rust (push) Failing after 5m13s
- `RunConfig` grows a `config_path: Option<PathBuf>` field, plumbed from the umbrella binary's global `--config` flag through to `MaestroConfigFile` loading. Explicit `--config <path>` wins over `$MAESTRO_CONFIG` over the platform default; a missing file still falls back to shipped defaults. - `docs/INSTALL.md` gains a "terminal UI" section: that `maestro tui` ships in the default feature set, how to opt out (`--no-default-features --features cli,daemon`), the `MAESTRO_DAEMON_URL` override, and a worked example of `[tui]` / `[tui.keymap.normal]` config pointing at the full action vocabulary in the design spec. - Adds a thin-build line for `--features cli` (CLI-only client) and lists `tui` in the default-feature set. - CLAUDE.md repo-layout block lists the new `maestro-tui` crate. Closes the NAP-275 v1 epic.
This commit is contained in:
@@ -22,6 +22,7 @@ pub mod state;
|
||||
pub mod tabs;
|
||||
pub mod terminal;
|
||||
|
||||
use std::path::PathBuf;
|
||||
use std::time::Duration;
|
||||
|
||||
use ratatui::backend::CrosstermBackend;
|
||||
@@ -38,6 +39,10 @@ pub struct RunConfig {
|
||||
/// HTTP base URL of the local daemon, e.g. `http://127.0.0.1:7070`.
|
||||
/// No trailing slash.
|
||||
pub daemon_url: String,
|
||||
/// Explicit `--config <path>` override from the umbrella binary's global
|
||||
/// flag. When `None`, [`maestro_config::resolve_config_path`] picks the
|
||||
/// default (`$MAESTRO_CONFIG` or `~/.config/maestro/config.toml`).
|
||||
pub config_path: Option<PathBuf>,
|
||||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
@@ -62,8 +67,13 @@ pub async fn run(cfg: RunConfig) -> Result<(), TuiError> {
|
||||
// Health check — fail fast if no daemon is reachable.
|
||||
health_check(&base_url).await?;
|
||||
|
||||
// Load runtime config from disk if present; fall back to defaults.
|
||||
let cfg_file = match maestro_config::resolve_config_path() {
|
||||
// Load runtime config: explicit `--config <path>` wins, then
|
||||
// `$MAESTRO_CONFIG`, then the platform default. Missing file is fine —
|
||||
// we fall back to shipped defaults.
|
||||
let cfg_path = cfg.config_path.clone().map(Ok).unwrap_or_else(|| {
|
||||
maestro_config::resolve_config_path().map_err(|e| TuiError::Config(e.to_string()))
|
||||
});
|
||||
let cfg_file = match cfg_path {
|
||||
Ok(path) => maestro_config::MaestroConfigFile::load_or_default(&path)
|
||||
.map_err(|e| TuiError::Config(e.to_string()))?,
|
||||
Err(_) => maestro_config::MaestroConfigFile::default(),
|
||||
|
||||
@@ -167,7 +167,11 @@ async fn dispatch(cli: Cli) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let daemon_url = args
|
||||
.daemon_url
|
||||
.unwrap_or_else(|| "http://127.0.0.1:7070".to_string());
|
||||
maestro_tui::run(maestro_tui::RunConfig { daemon_url }).await?
|
||||
maestro_tui::run(maestro_tui::RunConfig {
|
||||
daemon_url,
|
||||
config_path: cli.config,
|
||||
})
|
||||
.await?
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user