Watch
0
0
Fork
You've already forked hyperhive
0

drop the hive-side matrix code: sweep, hivectl matrix and the apiUrl option

This commit is contained in:
damocles 2026-10-28 22:16:16 +01:00 • committed by mara
commit 6dbb18b6d4
3 changed files with 49 additions and 1007 deletions

View file

@ -10,8 +10,7 @@ use std::path::PathBuf;
about = "hyperhive host CLI — operator-facing administration",
long_about = "\
Sibling to the `hive-c0re` daemon binary. Covers host-side admin \
operations that don't go through the broker — manual user \
provisioning on the bundled matrix container, plus future \
operations that don't go through the broker, plus future \
recovery / debugging verbs.\
"
)]
@ -36,13 +35,6 @@ pub enum Cmd {
#[command(subcommand)]
cmd: ForgeCmd,
},
/// matrix-tuwunel invites.
///
/// Manual invites into a room by id or alias.
Matrix {
#[command(subcommand)]
cmd: MatrixCmd,
},
/// Lifecycle actions on ONE managed agent container. Needs the
/// hive-c0re daemon running.
///
@ -246,19 +238,6 @@ impl From<ReconcileFrom> for hive_host_sock::ReconcileDirection {
}
}
#[derive(Subcommand)]
pub enum MatrixCmd {
/// Invite a matrix user to a room. Idempotent.
Invite {
/// User to invite: a full id (`@mara:server`) or a bare
/// localpart (qualified with the homeserver's `server_name`).
user: String,
/// Target room id (`!abc:server`) or alias (`#name:server`).
#[arg(long)]
room: String,
},
}
#[derive(Subcommand)]
pub enum WgCmd {
/// Generate this hive's WireGuard key (if absent) and print its public

View file

@ -3,7 +3,7 @@
//! A thin client for the `hive-c0re` daemon: it speaks the host admin
//! socket protocol (`hive-host-sock`) and does NOT link the daemon crate.
//! Container lifecycle (`agent <name> <spawn|kill|rebuild|restart|choom|…>`,
//! `list-agents`, `stop` / `start`) and provisioning (`forge` / `matrix` /
//! `list-agents`, `stop` / `start`) and provisioning (`forge` /
//! `gateway`) all forward to the daemon, which owns the broker,
//! the credentials, and the provisioning logic — a running daemon is
//! required for those. A couple of verbs work off local host state
@ -31,8 +31,6 @@ mod completions;
mod quota;
mod util;
use completions::generate_completions;
mod matrix;
use matrix::run_matrix_cmd;
mod open;
use open::open_url;
mod wg;
@ -65,7 +63,6 @@ async fn main() -> Result<()> {
verbose,
} => forge_reconcile_config(&socket, &agent, from, verbose).await,
},
Cmd::Matrix { cmd } => run_matrix_cmd(&socket, cmd).await,
Cmd::Agent { name, cmd } => run_agent(&socket, &name, cmd).await,
Cmd::ListAgents { json } => agents_list(&socket, json).await,
Cmd::QuotaEnable => quota::quota_enable(&socket).await,

View file

@ -1,48 +0,0 @@
//! `hivectl matrix` — matrix provisioning verbs. hivectl forwards
//! each request to the daemon (which owns the sender token) and renders the
//! reply; it no longer links the matrix machinery itself.
use std::path::Path;
use anyhow::{Context as _, Result, bail};
use crate::cli::MatrixCmd;
/// Route a `matrix` subcommand to its handler. Extracted from `main`'s
/// dispatch match so the top-level router stays small.
pub(crate) async fn run_matrix_cmd(socket: &Path, cmd: MatrixCmd) -> Result<()> {
match cmd {
MatrixCmd::Invite { user, room } => matrix_invite(socket, &user, &room).await,
}
}
/// Send a matrix provisioning request to the daemon and print the
/// operator-facing result lines it returns. The daemon owns the sender token,
/// so hivectl no longer links the matrix machinery — it just forwards the
/// request and renders the reply.
async fn matrix_request(socket: &Path, req: hive_host_sock::HostRequest) -> Result<()> {
let resp = crate::client::request(socket, req)
.await
.with_context(|| format!("connect to daemon socket {}", socket.display()))?;
if !resp.ok {
bail!(
"matrix: {}",
resp.error.as_deref().unwrap_or("unknown error")
);
}
for line in &resp.messages {
println!("{line}");
}
Ok(())
}
async fn matrix_invite(socket: &Path, user: &str, room: &str) -> Result<()> {
matrix_request(
socket,
hive_host_sock::HostRequest::MatrixInvite {
user: user.to_owned(),
room: room.to_owned(),
},
)
.await
}