This commit is contained in:
Sergio
2026-05-07 01:04:12 +00:00
parent 90e5bd3c73
commit ebfdf43170
9 changed files with 102 additions and 117 deletions
+8 -8
View File
@@ -5,7 +5,7 @@
//! cargo run --example brainctl -p ente-brain -- entropy
//! cargo run --example brainctl -p ente-brain -- top 10
//! cargo run --example brainctl -p ente-brain -- crystals
//! cargo run --example brainctl -p ente-brain -- crystal-kcl 0
//! cargo run --example brainctl -p ente-brain -- crystal-json 0
//!
//! Path del socket: $ENTE_BRAIN_SOCK o $XDG_RUNTIME_DIR/ente-brain.sock
@@ -42,9 +42,9 @@ async fn main() -> anyhow::Result<()> {
IntrospectRequest::TopCorrelations { n }
}
"crystals" => IntrospectRequest::Crystals,
"crystal-kcl" => {
"crystal-json" => {
let i: usize = args.get(2).and_then(|s| s.parse().ok()).unwrap_or(0);
IntrospectRequest::CrystalKcl { index: i }
IntrospectRequest::CrystalJson { index: i }
}
"promote" => {
let i: usize = args.get(2).and_then(|s| s.parse().ok()).unwrap_or(0);
@@ -70,7 +70,7 @@ async fn main() -> anyhow::Result<()> {
}
other => {
eprintln!("subcomando desconocido: {other}");
eprintln!("válidos: list-rules | entropy | top <n> | crystals | crystal-kcl <i> | promote <i> | remove <ulid> | audit <limit> | flush-audit | reload [path]");
eprintln!("válidos: list-rules | entropy | top <n> | crystals | crystal-json <i> | promote <i> | remove <ulid> | audit <limit> | flush-audit | reload [path]");
std::process::exit(2);
}
};
@@ -114,11 +114,11 @@ fn print_response(r: &IntrospectResponse) {
c.antecedent, c.consequent, c.conditional_prob, c.pmi, c.support);
}
}
IntrospectResponse::Kcl(s) => println!("{s}"),
IntrospectResponse::Promoted { rule_id, kcl_snippet } => {
IntrospectResponse::Json(s) => println!("{s}"),
IntrospectResponse::Promoted { rule_id, rule_json } => {
println!("regla creada: {rule_id}");
println!("--- KCL para auditoría / persistencia ---");
println!("{kcl_snippet}");
println!("--- JSON para auditoría / persistencia ---");
println!("{rule_json}");
}
IntrospectResponse::Removed(was_present) => {
if *was_present { println!("regla eliminada"); }