wip: Report harmony execution outcome

This commit is contained in:
2025-09-09 17:59:14 -04:00
parent 11481b16cd
commit ceafabf430
16 changed files with 217 additions and 190 deletions

View File

@@ -0,0 +1,32 @@
use std::sync::Mutex;
use harmony::instrumentation::{self, HarmonyEvent};
use log::info;
pub fn init() {
let details: Mutex<Vec<String>> = Mutex::new(vec![]);
instrumentation::subscribe("Harmony CLI Reporter", {
move |event| {
let mut details = details.lock().unwrap();
if let HarmonyEvent::InterpretExecutionFinished {
execution_id: _,
topology: _,
interpret: _,
score: _,
outcome: Ok(outcome),
} = event
{
if outcome.status == harmony::interpret::InterpretStatus::SUCCESS {
details.extend(outcome.details.clone());
}
} else if let HarmonyEvent::HarmonyFinished = event {
info!("Here's a summary of what happened:");
for detail in details.iter() {
println!("{detail}");
}
}
}
});
}

View File

@@ -8,6 +8,7 @@ use inquire::Confirm;
use log::debug;
pub mod cli_logger; // FIXME: Don't make me pub
mod cli_reporter;
pub mod progress;
pub mod theme;
@@ -116,6 +117,7 @@ pub async fn run_cli<T: Topology + Send + Sync + 'static>(
args: Args,
) -> Result<(), Box<dyn std::error::Error>> {
cli_logger::init();
cli_reporter::init();
let mut maestro = Maestro::initialize(inventory, topology).await.unwrap();
maestro.register_all(scores);