550c98f275
Reorganización física de crates/: - core/ (mezclaba 6 propósitos) se divide en protocol/, init/, runtime/, compat/ - shared/ (3 crates) se redistribuye en protocol/ e init/ - lapaloma (sub-módulo de ui_engine) se promueve a modules/pineal/ Renames de proyectos: - shipote → shuma (runtime de sandboxes) - nouser → akasha (explorador de Mónadas) - yahweh → nahual (motor GPUI, antes ui_engine/) - lapaloma → pineal (data-viz agnóstica) Fraccionamiento UI → core agnóstico: - vista-core (DeckState + snap, 175 LOC, 5 tests verdes) - barra-core (Task + render_html + sanitize, 90 LOC, 5 tests verdes) - vista-web y barra-web ahora son thin DOM bindings Documentación nueva: - 16 SDDs por subdirectorio (≤80 LOC c/u): protocol/init/runtime/compat + 10 módulos + apps/ - docs/STATUS.md con cifras reales por proyecto - docs/ROADMAP.md con plan a finalización (6 hitos, ~6-8 semanas) - CHANGELOG.md particionado en docs/changelog/<proyecto>.md (7 buckets) Automatización: - scripts/reorg.py — script idempotente que: git mv directorios, renombra package names, recomputa path = refs, reescribe imports rust, actualiza workspace Cargo.toml. Soporta --dry-run. - scripts/split-changelog.py — particiona CHANGELOG por componente. Validación: - cargo check --workspace pasa (124 crates + 2 nuevos cores). - 10 tests adicionales (5 en vista-core + 5 en barra-core) verdes. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
53 lines
1.9 KiB
Rust
53 lines
1.9 KiB
Rust
//! 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(())
|
|
}
|