MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / ledger

Function ledger

atomic-cli/src/commands/change/tree.rs:380–414  ·  view source on GitHub ↗
(graph: &ProvenanceGraph)

Source from the content-addressed store, hash-verified

378}
379
380fn ledger(graph: &ProvenanceGraph) -> Tree {
381 let mut section = Tree::new("Change Ledger");
382 section.push(format!("Session: {}", graph.session_id));
383 section.push(format!(
384 "Agent: {} ({})",
385 graph.agent_display_name, graph.agent_vendor
386 ));
387 section.push(format!(
388 "Nodes: {} Edges: {} Changes: {}",
389 graph.node_count(),
390 graph.edge_count(),
391 graph.change_count()
392 ));
393 for node in &graph.nodes {
394 let tool = node
395 .tool_name
396 .as_ref()
397 .map(|tool| format!(" [{tool}]"))
398 .unwrap_or_default();
399 let duration = node
400 .duration_ms
401 .map(|ms| format!(" ({ms}ms)"))
402 .unwrap_or_default();
403 let mut entry = Tree::new(format!("{}: {}{tool}{duration}", node.kind, node.summary));
404 if let Some(detail) = node
405 .detail
406 .as_ref()
407 .and_then(|detail| command::format_node_detail(detail))
408 {
409 entry.push(detail);
410 }
411 section.children.push(entry);
412 }
413 section
414}
415
416#[cfg(test)]
417mod tests {

Callers 1

renderFunction · 0.85

Calls 3

format_node_detailFunction · 0.85
as_refMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected