From a24dc14213526869bc8740250cc9c0365d1b4b95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?m=C3=BCde?= Date: Thu, 14 May 2026 20:47:05 +0200 Subject: [PATCH] hive-c0re: cli scaffolding (stubs) --- Cargo.toml | 10 +++++++ hive-c0re/Cargo.toml | 10 +++++++ hive-c0re/src/main.rs | 69 +++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 87 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bc13696..ec8e622 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,3 +9,13 @@ members = [ [workspace.package] edition = "2024" version = "0.1.0" + +[workspace.dependencies] +anyhow = "1" +clap = { version = "4", features = ["derive"] } +hive-sh4re = { path = "hive-sh4re" } +serde = { version = "1", features = ["derive"] } +serde_json = "1" +tokio = { version = "1", features = ["io-util", "macros", "net", "process", "rt-multi-thread", "signal"] } +tracing = "0.1" +tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/hive-c0re/Cargo.toml b/hive-c0re/Cargo.toml index e0ef81d..be3ed94 100644 --- a/hive-c0re/Cargo.toml +++ b/hive-c0re/Cargo.toml @@ -2,3 +2,13 @@ name = "hive-c0re" edition.workspace = true version.workspace = true + +[dependencies] +anyhow.workspace = true +clap.workspace = true +hive-sh4re.workspace = true +serde.workspace = true +serde_json.workspace = true +tokio.workspace = true +tracing.workspace = true +tracing-subscriber.workspace = true diff --git a/hive-c0re/src/main.rs b/hive-c0re/src/main.rs index 629d0d0..24f4ac8 100644 --- a/hive-c0re/src/main.rs +++ b/hive-c0re/src/main.rs @@ -1,3 +1,68 @@ -fn main() { - println!("hive-c0re placeholder"); +use std::path::PathBuf; + +use anyhow::{Result, bail}; +use clap::{Parser, Subcommand}; + +#[derive(Parser)] +#[command(name = "hive-c0re", about = "hyperhive coordinator daemon and CLI")] +struct Cli { + #[command(subcommand)] + cmd: Cmd, +} + +#[derive(Subcommand)] +enum Cmd { + /// Run the coordinator daemon. + Serve { + /// Flake reference for the agent base template. + #[arg(long, default_value = "/etc/hyperhive#agent-base")] + agent_flake: String, + /// Path to the host admin socket. + #[arg(long, default_value = "/run/hyperhive/host.sock")] + socket: PathBuf, + }, + /// Spawn a new agent container (creates `hive-agent-`). + Spawn { name: String }, + /// Stop a managed container (graceful). + Kill { name: String }, + /// Apply pending config to a managed container. + Rebuild { name: String }, + /// List managed containers. + List, +} + +fn main() -> Result<()> { + tracing_subscriber::fmt() + .with_env_filter( + tracing_subscriber::EnvFilter::try_from_default_env() + .unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("info")), + ) + .init(); + + let cli = Cli::parse(); + match cli.cmd { + Cmd::Serve { + agent_flake, + socket, + } => { + tracing::info!(?socket, %agent_flake, "serve: not yet implemented"); + bail!("serve not yet implemented"); + } + Cmd::Spawn { name } => { + tracing::info!(%name, "spawn: not yet implemented"); + bail!("spawn not yet implemented"); + } + Cmd::Kill { name } => { + tracing::info!(%name, "kill: not yet implemented"); + bail!("kill not yet implemented"); + } + Cmd::Rebuild { name } => { + tracing::info!(%name, "rebuild: not yet implemented"); + bail!("rebuild not yet implemented"); + } + Cmd::List => { + tracing::info!("list: not yet implemented"); + bail!("list not yet implemented"); + } + } }