hive-c0re: cli scaffolding (stubs)
This commit is contained in:
parent
a63e9bdbfc
commit
a24dc14213
3 changed files with 87 additions and 2 deletions
10
Cargo.toml
10
Cargo.toml
|
|
@ -9,3 +9,13 @@ members = [
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
version = "0.1.0"
|
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"] }
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,13 @@
|
||||||
name = "hive-c0re"
|
name = "hive-c0re"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
version.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
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,68 @@
|
||||||
fn main() {
|
use std::path::PathBuf;
|
||||||
println!("hive-c0re placeholder");
|
|
||||||
|
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-<name>`).
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue