mirror of
https://github.com/ModernRelay/omnigraph.git
synced 2026-06-27 02:39:38 +02:00
refactor(cli): drop cluster init — no replacement scaffold
Andrew's call, and the right one by the repo's own lens: a minimal
cluster.yaml is five lines; a generator is a second copy of the schema to
keep in sync forever, emitting a file that is unusable until hand-edited
anyway (graphs: {} cannot apply or serve). Terraform has no config
scaffolder either. New users copy from the cluster quick-start; migrants
get a ready-to-review cluster.yaml from config migrate. RFC-008 stage 3
becomes purely subtractive.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
3adbc65af2
commit
5328c91341
5 changed files with 8 additions and 105 deletions
|
|
@ -345,23 +345,6 @@ pub(crate) enum Command {
|
|||
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub(crate) enum ClusterCommand {
|
||||
/// Scaffold a minimal cluster.yaml in the config directory (refuses
|
||||
/// if one exists). The cluster checkout replaces the legacy
|
||||
/// omnigraph.yaml scaffold (RFC-008 stage 3).
|
||||
Init {
|
||||
/// Directory to scaffold into (default: .)
|
||||
#[arg(long, default_value = ".")]
|
||||
config: PathBuf,
|
||||
/// Optional deployment label (metadata.name)
|
||||
#[arg(long)]
|
||||
name: Option<String>,
|
||||
/// Optional storage root URI (s3://bucket/prefix); omit for the
|
||||
/// config-dir layout
|
||||
#[arg(long)]
|
||||
storage: Option<String>,
|
||||
#[arg(long)]
|
||||
json: bool,
|
||||
},
|
||||
/// Validate cluster.yaml and referenced schemas, queries, and policy files.
|
||||
Validate {
|
||||
/// Cluster config directory containing cluster.yaml.
|
||||
|
|
|
|||
|
|
@ -1217,43 +1217,6 @@ async fn main() -> Result<()> {
|
|||
}
|
||||
}
|
||||
Command::Cluster { command } => match command {
|
||||
ClusterCommand::Init {
|
||||
config,
|
||||
name,
|
||||
storage,
|
||||
json,
|
||||
} => {
|
||||
let target = config.join("cluster.yaml");
|
||||
if target.exists() {
|
||||
bail!(
|
||||
"'{}' already exists — cluster init refuses to overwrite",
|
||||
target.display()
|
||||
);
|
||||
}
|
||||
std::fs::create_dir_all(&config)?;
|
||||
let mut scaffold = String::from("version: 1\n");
|
||||
if let Some(name) = &name {
|
||||
scaffold.push_str(&format!("metadata:\n name: {name}\n"));
|
||||
}
|
||||
match &storage {
|
||||
Some(root) => scaffold.push_str(&format!("storage: {root}\n")),
|
||||
None => scaffold.push_str(
|
||||
"# storage: s3://bucket/prefix # omit: this folder is the storage root\n",
|
||||
),
|
||||
}
|
||||
scaffold.push_str(
|
||||
"graphs: {}\n# graphs:\n# knowledge:\n# schema: knowledge.pg\n# queries: queries/\n",
|
||||
);
|
||||
std::fs::write(&target, scaffold)?;
|
||||
if json {
|
||||
print_json(&serde_json::json!({ "created": target.display().to_string() }))?;
|
||||
} else {
|
||||
println!(
|
||||
"created {} — declare graphs, then `omnigraph cluster import` and `apply`",
|
||||
target.display()
|
||||
);
|
||||
}
|
||||
}
|
||||
ClusterCommand::Validate { config, json } => {
|
||||
let output = validate_config_dir(config);
|
||||
finish_cluster_validate(&output, json)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue