chore: monorepo inicial con arje + minga + yahweh absorbidos
Workspace en 4 ejes (core/modules/apps/shared):
- core/: 24 crates de arje (Init systemd-compatible: ente-card, ente-zero,
ente-kernel, ente-bus, ente-cas, ente-soma, ente-wasm, ente-snapshot,
ente-brain, ente-echo, ente-policy-provider, + 12 crates *-compat)
- modules/semantic_dht/: 5 crates de minga (minga-core con AST/CAS/MST,
minga-p2p con libp2p Kad, minga-store, minga-vfs, minga-cli)
- modules/ui_engine/: 11 crates de yahweh (libs/{core,theme,bus,providers},
widgets/{tree,splitter,tabs,tiled,container_core,text_input})
- apps/: 5 crates de yahweh (file_explorer, database_explorer, text_viewer,
image_viewer, yahweh-shell)
- shared_wit/protocol.wit: handshake/lifecycle inicial
Cargo.toml unificado: thiserror bumped a 2 (transparente para arje), tokio
"full", paths intra-workspace de yahweh redirigidos a su nueva ubicación.
cargo check --workspace: 0 errores, 17 warnings (dead code preexistente).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
//! busctl: cliente CLI para el bus interno del fractal.
|
||||
//!
|
||||
//! Uso:
|
||||
//! cargo run --example busctl -- list-entes
|
||||
//! cargo run --example busctl -- announce
|
||||
//! cargo run --example busctl -- power-off
|
||||
//!
|
||||
//! Si `ENTE_BUS_SOCK` no está en el entorno, cae al path dev por defecto.
|
||||
|
||||
use ente_bus::{BusClient, BusRequest};
|
||||
use std::env;
|
||||
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
let args: Vec<String> = env::args().collect();
|
||||
let cmd = args.get(1).map(|s| s.as_str()).unwrap_or("list-entes");
|
||||
|
||||
let mut client = match BusClient::from_env().await {
|
||||
Ok(c) => c,
|
||||
Err(_) => {
|
||||
let user = env::var("USER").unwrap_or_else(|_| "ente".into());
|
||||
let runtime = env::var("XDG_RUNTIME_DIR")
|
||||
.unwrap_or_else(|_| env::var("TMPDIR").unwrap_or_else(|_| "/tmp".into()));
|
||||
let path = format!("{runtime}/ente-bus-{user}.sock");
|
||||
eprintln!("ENTE_BUS_SOCK no definido, intentando {path}");
|
||||
BusClient::connect(&path).await?
|
||||
}
|
||||
};
|
||||
|
||||
let req = match cmd {
|
||||
"list-entes" => BusRequest::ListEntes,
|
||||
"announce" => BusRequest::Announce { capabilities: vec![] },
|
||||
"power-off" => BusRequest::PowerOff { interactive: false },
|
||||
"reboot" => BusRequest::Reboot { interactive: false },
|
||||
"suspend" => BusRequest::Suspend { interactive: false },
|
||||
"invoke-echo" => {
|
||||
let msg = args.get(2).map(|s| s.as_str()).unwrap_or("hola");
|
||||
BusRequest::Invoke {
|
||||
cap: ente_echo::echo_capability(),
|
||||
blob: msg.as_bytes().to_vec(),
|
||||
}
|
||||
}
|
||||
other => {
|
||||
eprintln!("subcomando desconocido: {other}");
|
||||
eprintln!("válidos: list-entes, announce, power-off, reboot, suspend, invoke-echo <text>");
|
||||
std::process::exit(2);
|
||||
}
|
||||
};
|
||||
let resp = client.call(req).await?;
|
||||
println!("{resp:#?}");
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user