refactor(cli,server): rename the --target flag to --graph (no alias)

The graph-selection flag is now `--graph` (the canonical noun, matching
`graphs:`/`cli.graph`) with NO `--target` compat alias — a clean break, to avoid
two-names-for-one-thing confusion. Applied across the 21 `omnigraph` subcommands
and the `omnigraph-server` binary (the field stays `target` internally;
`value_name = "GRAPH"` keeps help text clean). Updates the user-facing "no graph to
serve" and stored-query selection-hint error messages, plus the two cli.rs tests
that drove `--target`.

Breaking: `--target` is removed (now an unknown-flag error); use `--graph`. `uri`
is unchanged (positional or `--uri` per command — deliberately not folded into a
shared arg, since the two uri patterns can't share one flattened definition without
a breaking uri-form change). `--target-branch` (policy explain) is unrelated and
untouched. Code comments and docs still referencing `--target` are swept in L8 with
the docs.
This commit is contained in:
Ragnor Comerford 2026-06-03 18:34:48 +02:00
parent f3331edd51
commit fada7cf404
No known key found for this signature in database
4 changed files with 28 additions and 28 deletions

View file

@ -91,7 +91,7 @@ enum Command {
Load {
/// Graph URI
uri: Option<String>,
#[arg(long)]
#[arg(long = "graph", value_name = "GRAPH")]
target: Option<String>,
#[arg(long)]
config: Option<PathBuf>,
@ -108,7 +108,7 @@ enum Command {
Ingest {
/// Graph URI
uri: Option<String>,
#[arg(long)]
#[arg(long = "graph", value_name = "GRAPH")]
target: Option<String>,
#[arg(long)]
config: Option<PathBuf>,
@ -147,7 +147,7 @@ enum Command {
Lint {
/// Graph URI
uri: Option<String>,
#[arg(long)]
#[arg(long = "graph", value_name = "GRAPH")]
target: Option<String>,
#[arg(long)]
config: Option<PathBuf>,
@ -167,7 +167,7 @@ enum Command {
Snapshot {
/// Graph URI
uri: Option<String>,
#[arg(long)]
#[arg(long = "graph", value_name = "GRAPH")]
target: Option<String>,
#[arg(long)]
config: Option<PathBuf>,
@ -180,7 +180,7 @@ enum Command {
Export {
/// Graph URI
uri: Option<String>,
#[arg(long)]
#[arg(long = "graph", value_name = "GRAPH")]
target: Option<String>,
#[arg(long)]
config: Option<PathBuf>,
@ -210,7 +210,7 @@ enum Command {
uri: Option<String>,
#[arg(hide = true)]
legacy_uri: Option<String>,
#[arg(long)]
#[arg(long = "graph", value_name = "GRAPH")]
target: Option<String>,
#[arg(long)]
config: Option<PathBuf>,
@ -248,7 +248,7 @@ enum Command {
uri: Option<String>,
#[arg(hide = true)]
legacy_uri: Option<String>,
#[arg(long)]
#[arg(long = "graph", value_name = "GRAPH")]
target: Option<String>,
#[arg(long)]
config: Option<PathBuf>,
@ -279,7 +279,7 @@ enum Command {
Optimize {
/// Graph URI
uri: Option<String>,
#[arg(long)]
#[arg(long = "graph", value_name = "GRAPH")]
target: Option<String>,
#[arg(long)]
config: Option<PathBuf>,
@ -290,7 +290,7 @@ enum Command {
Cleanup {
/// Graph URI
uri: Option<String>,
#[arg(long)]
#[arg(long = "graph", value_name = "GRAPH")]
target: Option<String>,
#[arg(long)]
config: Option<PathBuf>,
@ -328,7 +328,7 @@ enum GraphsCommand {
/// Remote server URL (e.g. `https://server.example.com`).
#[arg(long)]
uri: Option<String>,
#[arg(long)]
#[arg(long = "graph", value_name = "GRAPH")]
target: Option<String>,
#[arg(long)]
config: Option<PathBuf>,
@ -344,7 +344,7 @@ enum BranchCommand {
/// Graph URI
#[arg(long)]
uri: Option<String>,
#[arg(long)]
#[arg(long = "graph", value_name = "GRAPH")]
target: Option<String>,
#[arg(long)]
config: Option<PathBuf>,
@ -359,7 +359,7 @@ enum BranchCommand {
/// Graph URI
#[arg(long)]
uri: Option<String>,
#[arg(long)]
#[arg(long = "graph", value_name = "GRAPH")]
target: Option<String>,
#[arg(long)]
config: Option<PathBuf>,
@ -371,7 +371,7 @@ enum BranchCommand {
/// Graph URI
#[arg(long)]
uri: Option<String>,
#[arg(long)]
#[arg(long = "graph", value_name = "GRAPH")]
target: Option<String>,
#[arg(long)]
config: Option<PathBuf>,
@ -384,7 +384,7 @@ enum BranchCommand {
/// Graph URI
#[arg(long)]
uri: Option<String>,
#[arg(long)]
#[arg(long = "graph", value_name = "GRAPH")]
target: Option<String>,
#[arg(long)]
config: Option<PathBuf>,
@ -402,7 +402,7 @@ enum SchemaCommand {
Plan {
/// Graph URI
uri: Option<String>,
#[arg(long)]
#[arg(long = "graph", value_name = "GRAPH")]
target: Option<String>,
#[arg(long)]
config: Option<PathBuf>,
@ -420,7 +420,7 @@ enum SchemaCommand {
Apply {
/// Graph URI
uri: Option<String>,
#[arg(long)]
#[arg(long = "graph", value_name = "GRAPH")]
target: Option<String>,
#[arg(long)]
config: Option<PathBuf>,
@ -445,7 +445,7 @@ enum SchemaCommand {
Show {
/// Graph URI
uri: Option<String>,
#[arg(long)]
#[arg(long = "graph", value_name = "GRAPH")]
target: Option<String>,
#[arg(long)]
config: Option<PathBuf>,
@ -461,7 +461,7 @@ enum CommitCommand {
List {
/// Graph URI
uri: Option<String>,
#[arg(long)]
#[arg(long = "graph", value_name = "GRAPH")]
target: Option<String>,
#[arg(long)]
config: Option<PathBuf>,
@ -475,7 +475,7 @@ enum CommitCommand {
/// Graph URI
#[arg(long)]
uri: Option<String>,
#[arg(long)]
#[arg(long = "graph", value_name = "GRAPH")]
target: Option<String>,
#[arg(long)]
config: Option<PathBuf>,
@ -523,7 +523,7 @@ enum QueriesCommand {
Validate {
/// Graph URI
uri: Option<String>,
#[arg(long)]
#[arg(long = "graph", value_name = "GRAPH")]
target: Option<String>,
#[arg(long)]
config: Option<PathBuf>,
@ -532,7 +532,7 @@ enum QueriesCommand {
},
/// List the registered stored queries (name, MCP exposure, params).
List {
#[arg(long)]
#[arg(long = "graph", value_name = "GRAPH")]
target: Option<String>,
#[arg(long)]
config: Option<PathBuf>,
@ -1828,7 +1828,7 @@ fn resolve_registry_selection_for_list(
}
bail!(
"stored-query registries are configured for graph{} {} but no graph was selected. Pass `--target {}` or set `cli.graph`.",
"stored-query registries are configured for graph{} {} but no graph was selected. Pass `--graph {}` or set `cli.graph`.",
if graph_names.len() == 1 { "" } else { "s" },
graph_names.join(", "),
graph_names[0],

View file

@ -2513,7 +2513,7 @@ fn queries_list_requires_graph_selection_for_per_graph_only_registries() {
);
let stderr = String::from_utf8_lossy(&output.stderr);
assert!(
stderr.contains("local") && stderr.contains("--target local"),
stderr.contains("local") && stderr.contains("--graph local"),
"error must name the graph and give a concrete selection hint; stderr:\n{stderr}"
);
}
@ -2550,7 +2550,7 @@ fn queries_list_without_graph_selection_lists_top_level_registry() {
fn queries_list_unknown_target_errors() {
// `queries list` opens no graph URI, so unknown-graph validation can't ride
// along on URI resolution the way it does for every other command. An
// unknown `--target` must still error (naming the graph) instead of
// unknown `--graph` must still error (naming the graph) instead of
// silently falling back to the top-level registry and showing the wrong
// (or empty) catalog.
let graph = SystemGraph::loaded();
@ -2570,7 +2570,7 @@ fn queries_list_unknown_target_errors() {
cli()
.arg("queries")
.arg("list")
.arg("--target")
.arg("--graph")
.arg("nonexistent")
.arg("--config")
.arg(&config),

View file

@ -1050,8 +1050,8 @@ pub fn load_server_settings(
} else {
// Rule 5 → error with migration hint.
bail!(
"no graph to serve: pass a URI (`omnigraph-server <URI>`), select a target \
(`--target <name> --config omnigraph.yaml`), set `server.graph: <name>` in \
"no graph to serve: pass a URI (`omnigraph-server <URI>`), select a graph \
(`--graph <name> --config omnigraph.yaml`), set `server.graph: <name>` in \
omnigraph.yaml, or for multi-graph mode add a `graphs:` map to the config \
file referenced by `--config`."
);

View file

@ -10,7 +10,7 @@ use omnigraph_server::{ServerConfig, init_tracing, load_server_settings, serve};
struct Cli {
/// Graph URI
uri: Option<String>,
#[arg(long)]
#[arg(long = "graph", value_name = "GRAPH")]
target: Option<String>,
#[arg(long)]
config: Option<PathBuf>,