diff --git a/crates/omnigraph-cli/src/main.rs b/crates/omnigraph-cli/src/main.rs index dfe4c94..748d44d 100644 --- a/crates/omnigraph-cli/src/main.rs +++ b/crates/omnigraph-cli/src/main.rs @@ -533,7 +533,7 @@ enum ConfigCommand { #[arg(long)] config: Option, /// Resolve the named graph (or `defaults.graph`) to its typed locator. - #[arg(long)] + #[arg(long, conflicts_with = "show_origin")] resolved: bool, /// Annotate each value with the layer (global/project) it came from. #[arg(long = "show-origin")] @@ -3166,7 +3166,6 @@ async fn main() -> Result<()> { resolved.resolve_graph(None, Some(&graph))?; write_active_context(&ActiveContext { graph: graph.clone(), - server: None, })?; println!("active graph set to '{graph}'"); } diff --git a/crates/omnigraph-cli/tests/cli.rs b/crates/omnigraph-cli/tests/cli.rs index 6666cd4..8dba27e 100644 --- a/crates/omnigraph-cli/tests/cli.rs +++ b/crates/omnigraph-cli/tests/cli.rs @@ -371,6 +371,19 @@ fn config_view_resolved_prints_embedded_and_remote_locators() { assert_eq!(remote["graph_id"], "prod"); } +#[test] +fn config_view_resolved_conflicts_with_show_origin() { + // The two modes are mutually exclusive; the parser rejects the combo loudly + // rather than silently dropping --show-origin. + output_failure( + cli() + .arg("config") + .arg("view") + .arg("--resolved") + .arg("--show-origin"), + ); +} + #[test] fn use_sets_active_graph_targeted_by_bare_commands() { let graph_dir = tempdir().unwrap(); diff --git a/crates/omnigraph-config/src/lib.rs b/crates/omnigraph-config/src/lib.rs index 3613e37..047f72f 100644 --- a/crates/omnigraph-config/src/lib.rs +++ b/crates/omnigraph-config/src/lib.rs @@ -1072,14 +1072,13 @@ pub fn global_config_file() -> Option { } /// The active context selected by `omnigraph use` — RFC-002 §5. A thin pointer to -/// the default graph (and optionally its server), written to -/// `/state/active.yaml` and read as the `State` layer (between global and -/// project) so a bare command targets the active graph. +/// the default graph, written to `/state/active.yaml` and read as the +/// `State` layer (between global and project) so a bare command targets the active +/// graph. (A default *server* belongs here too once server-qualified selection +/// lands in V2/V3 — not modeled now to avoid an unused field.) #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ActiveContext { pub graph: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub server: Option, } /// Path of the active-context state file (`/state/active.yaml`). @@ -1100,9 +1099,8 @@ pub fn write_active_context(context: &ActiveContext) -> Result<()> { } /// Build the synthetic `State` layer config from an active-context file, if it -/// exists: a thin config whose only effect is setting `defaults.graph` (and, when -/// present, the default server). Marked not-loaded-from-file so it raises no -/// version/legacy warnings. +/// exists: a thin config whose only effect is setting `defaults.graph`. Marked +/// not-loaded-from-file so it raises no version/legacy warnings. fn load_state_layer(path: &Path) -> Result> { if !path.exists() { return Ok(None);